testing game export
This commit is contained in:
@@ -5,6 +5,22 @@ if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
project(${GAME_TITLE})
|
||||
project(@GAME_TITLE@)
|
||||
|
||||
add_executable(${GAME_TITLE} main.cpp )
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY @GAME_DESTINATION@)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG @GAME_DESTINATION@)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE @GAME_DESTINATION@)
|
||||
|
||||
find_package(Vulkan REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(Seele REQUIRED)
|
||||
|
||||
link_directories(${Seele_DIR}/lib)
|
||||
|
||||
add_executable(@GAME_TITLE@ main.cpp)
|
||||
target_link_libraries(@GAME_TITLE@ PUBLIC Seele::Engine)
|
||||
|
||||
add_custom_command(TARGET @GAME_TITLE@ POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy -t @GAME_DESTINATION@ $<TARGET_RUNTIME_DLLS:@GAME_TITLE@>
|
||||
COMMAND_EXPAND_LISTS
|
||||
)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
configure_file(cmake/main.cpp.in ${GAME_DESTINATION}/cmake/main.cpp @ONLY)
|
||||
configure_file(cmake/CMakeLists.txt.in ${GAME_DESTINATION}/cmake/CMakeLists.txt @ONLY)
|
||||
+27
-22
@@ -1,29 +1,34 @@
|
||||
#include "Window/WindowManager.h"
|
||||
#include ""
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include <Window/WindowManager.h>
|
||||
#include <Asset/AssetRegistry.h>
|
||||
#include <Window/GameView.h>
|
||||
#include <Graphics/Vulkan/VulkanGraphics.h>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
int main()
|
||||
{
|
||||
Gfx::PGraphics graphics = new Vulkan::Graphics();
|
||||
GraphicsInitializer initializer;
|
||||
graphics->init(initializer);
|
||||
|
||||
PWindowManager windowManager = new WindowManager();
|
||||
AssetRegistry::load("registry");
|
||||
WindowCreateInfo gameWindowInfo = {
|
||||
.title = ${GAME_TITLE},
|
||||
.width = 1280,
|
||||
.height = 720,
|
||||
.bFullscreen = false,
|
||||
.numSamples = 1,
|
||||
.pixelFormat = Gfx::SE_FORMAT_B8G8R8A8_UNORM,
|
||||
};
|
||||
auto window = windowManager->addWindow(gameWindowInfo);
|
||||
ViewportCreateInfo gameViewinfo = {
|
||||
.dimensions = {
|
||||
.size = {
|
||||
.x = 1280,
|
||||
.y = 720,
|
||||
},
|
||||
},
|
||||
};
|
||||
new GameView(windowManager->getGraphics(), window, gameViewInfo, ${DLL_PATH});
|
||||
AssetRegistry::init("Assets", graphics);
|
||||
|
||||
WindowCreateInfo mainWindowInfo;
|
||||
mainWindowInfo.title = "@GAME_TITLE@";
|
||||
mainWindowInfo.width = 1280;
|
||||
mainWindowInfo.height = 720;
|
||||
mainWindowInfo.bFullscreen = false;
|
||||
mainWindowInfo.numSamples = 1;
|
||||
mainWindowInfo.pixelFormat = Gfx::SE_FORMAT_B8G8R8A8_UNORM;
|
||||
auto window = windowManager->addWindow(graphics, mainWindowInfo);
|
||||
ViewportCreateInfo sceneViewInfo;
|
||||
sceneViewInfo.dimensions.size.x = 1280;
|
||||
sceneViewInfo.dimensions.size.y = 720;
|
||||
sceneViewInfo.dimensions.offset.x = 0;
|
||||
sceneViewInfo.dimensions.offset.y = 0;
|
||||
PGameView sceneView = new GameView(graphics, window, sceneViewInfo, "@GAME_BINARY@");
|
||||
sceneView->setFocused();
|
||||
window->render();
|
||||
return 0;
|
||||
}
|
||||
@@ -228,5 +228,7 @@ int main()
|
||||
//export game
|
||||
std::string outputPath = "C:\\Users\\Dynamitos\\TrackClearGame";
|
||||
|
||||
std::system("cmake --configure");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -6,6 +6,8 @@ target_sources(Engine
|
||||
AssetRegistry.cpp
|
||||
FontAsset.h
|
||||
FontAsset.cpp
|
||||
LevelAsset.h
|
||||
LevelAsset.cpp
|
||||
MaterialAsset.h
|
||||
MaterialAsset.cpp
|
||||
MaterialInstanceAsset.h
|
||||
@@ -21,6 +23,7 @@ target_sources(Engine
|
||||
Asset.h
|
||||
AssetRegistry.h
|
||||
FontAsset.h
|
||||
LevelAsset.h
|
||||
MaterialAsset.h
|
||||
MaterialInstanceAsset.h
|
||||
MeshAsset.h
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "LevelAsset.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
LevelAsset::LevelAsset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
LevelAsset::LevelAsset(std::string_view folderPath, std::string_view name)
|
||||
: Asset(folderPath, name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
LevelAsset::~LevelAsset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LevelAsset::save(ArchiveBuffer& buffer) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LevelAsset::load(ArchiveBuffer& buffer)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "Asset.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
class LevelAsset : public Asset
|
||||
{
|
||||
public:
|
||||
static constexpr uint64 IDENTIFIER = 0x20;
|
||||
LevelAsset();
|
||||
LevelAsset(std::string_view folderPath, std::string_view name);
|
||||
virtual ~LevelAsset();
|
||||
virtual void save(ArchiveBuffer& buffer) const override;
|
||||
virtual void load(ArchiveBuffer& buffer) override;
|
||||
private:
|
||||
|
||||
};
|
||||
} // namespace Seele
|
||||
@@ -188,10 +188,10 @@ void LightCullingPass::publishOutputs()
|
||||
resources->registerBufferOutput("LIGHTCULLING_OLIGHTLIST", oLightIndexList);
|
||||
resources->registerBufferOutput("LIGHTCULLING_TLIGHTLIST", tLightIndexList);
|
||||
|
||||
resources->registerBufferOutput("DIRECTIONAL_LIGHTS", directLightBuffer);
|
||||
resources->registerUniformOutput("NUM_DIRECTIONAL_LIGHTS", numDirLightBuffer);
|
||||
resources->registerBufferOutput("POINT_LIGHTS", pointLightBuffer);
|
||||
resources->registerUniformOutput("NUM_POINT_LIGHTS", numPointLightBuffer);
|
||||
resources->registerBufferOutput("DIRECTIONAL_LIGHTS", passData.lightEnv.directionalLights);
|
||||
resources->registerUniformOutput("NUM_DIRECTIONAL_LIGHTS", passData.lightEnv.numDirectional);
|
||||
resources->registerBufferOutput("POINT_LIGHTS", passData.lightEnv.pointLights);
|
||||
resources->registerUniformOutput("NUM_POINT_LIGHTS", passData.lightEnv.numPoints);
|
||||
|
||||
TextureCreateInfo textureInfo = {
|
||||
.width = dispatchParams.numThreadGroups.x,
|
||||
|
||||
@@ -105,15 +105,37 @@ Array<MeshBatch> Scene::getStaticMeshes()
|
||||
return result;
|
||||
}
|
||||
|
||||
LightEnv Scene::getLightBuffer() const
|
||||
LightEnv Scene::getLightBuffer()
|
||||
{
|
||||
result.directionalLights[0].color = Vector4(0.4, 0.3, 0.5, 1.0);
|
||||
result.directionalLights[0].direction = Vector4(0.5, -0.5, 0, 0);
|
||||
result.numDirectionalLights = 0;
|
||||
result.pointLights[0].positionWS = Vector4(0, 50, 0, 0);
|
||||
result.pointLights[0].colorRange = Vector4(0.2, 0.4, 0.7, 100);
|
||||
result.numPointLights = 1;
|
||||
return result;
|
||||
StaticArray<DirectionalLight, MAX_DIRECTIONAL_LIGHTS> dirLights;
|
||||
uint32 numDirLights;
|
||||
for(auto&& [entity, light] : registry.view<DirectionalLight>().each())
|
||||
{
|
||||
dirLights[numDirLights++] = light;
|
||||
}
|
||||
lightEnv.directionalLights->updateContents({
|
||||
.size = sizeof(DirectionalLight) * numDirLights,
|
||||
.data = (uint8*)dirLights.data(),
|
||||
});
|
||||
lightEnv.numDirectional->updateContents({
|
||||
.size = sizeof(uint32),
|
||||
.data = (uint8*)&numDirLights,
|
||||
});
|
||||
StaticArray<PointLight, MAX_POINT_LIGHTS> pointLights;
|
||||
uint32 numPointLights;
|
||||
for(auto&& [entity, light] : registry.view<PointLight>().each())
|
||||
{
|
||||
pointLights[numPointLights++] = light;
|
||||
}
|
||||
lightEnv.pointLights->updateContents({
|
||||
.size = sizeof(PointLight) * numPointLights,
|
||||
.data = (uint8*)pointLights.data(),
|
||||
});
|
||||
lightEnv.numPoints->updateContents({
|
||||
.size = sizeof(uint32),
|
||||
.data = (uint8*)&numPointLights,
|
||||
});
|
||||
return lightEnv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
registry.view<Component>().each(func);
|
||||
}
|
||||
Array<MeshBatch> getStaticMeshes();
|
||||
LightEnv getLightBuffer() const;
|
||||
LightEnv getLightBuffer();
|
||||
Component::Skybox getSkybox();
|
||||
Gfx::PStructuredBuffer getSceneDataBuffer() const { return sceneDataBuffer; }
|
||||
Gfx::PGraphics getGraphics() const { return graphics; }
|
||||
|
||||
Reference in New Issue
Block a user