testing game export
This commit is contained in:
@@ -5,6 +5,22 @@ if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
|||||||
endif()
|
endif()
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
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 <Window/WindowManager.h>
|
||||||
#include ""
|
#include <Asset/AssetRegistry.h>
|
||||||
#include "Asset/AssetRegistry.h"
|
#include <Window/GameView.h>
|
||||||
|
#include <Graphics/Vulkan/VulkanGraphics.h>
|
||||||
|
|
||||||
|
using namespace Seele;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
Gfx::PGraphics graphics = new Vulkan::Graphics();
|
||||||
|
GraphicsInitializer initializer;
|
||||||
|
graphics->init(initializer);
|
||||||
|
|
||||||
PWindowManager windowManager = new WindowManager();
|
PWindowManager windowManager = new WindowManager();
|
||||||
AssetRegistry::load("registry");
|
AssetRegistry::init("Assets", graphics);
|
||||||
WindowCreateInfo gameWindowInfo = {
|
|
||||||
.title = ${GAME_TITLE},
|
WindowCreateInfo mainWindowInfo;
|
||||||
.width = 1280,
|
mainWindowInfo.title = "@GAME_TITLE@";
|
||||||
.height = 720,
|
mainWindowInfo.width = 1280;
|
||||||
.bFullscreen = false,
|
mainWindowInfo.height = 720;
|
||||||
.numSamples = 1,
|
mainWindowInfo.bFullscreen = false;
|
||||||
.pixelFormat = Gfx::SE_FORMAT_B8G8R8A8_UNORM,
|
mainWindowInfo.numSamples = 1;
|
||||||
};
|
mainWindowInfo.pixelFormat = Gfx::SE_FORMAT_B8G8R8A8_UNORM;
|
||||||
auto window = windowManager->addWindow(gameWindowInfo);
|
auto window = windowManager->addWindow(graphics, mainWindowInfo);
|
||||||
ViewportCreateInfo gameViewinfo = {
|
ViewportCreateInfo sceneViewInfo;
|
||||||
.dimensions = {
|
sceneViewInfo.dimensions.size.x = 1280;
|
||||||
.size = {
|
sceneViewInfo.dimensions.size.y = 720;
|
||||||
.x = 1280,
|
sceneViewInfo.dimensions.offset.x = 0;
|
||||||
.y = 720,
|
sceneViewInfo.dimensions.offset.y = 0;
|
||||||
},
|
PGameView sceneView = new GameView(graphics, window, sceneViewInfo, "@GAME_BINARY@");
|
||||||
},
|
sceneView->setFocused();
|
||||||
};
|
|
||||||
new GameView(windowManager->getGraphics(), window, gameViewInfo, ${DLL_PATH});
|
|
||||||
window->render();
|
window->render();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -228,5 +228,7 @@ int main()
|
|||||||
//export game
|
//export game
|
||||||
std::string outputPath = "C:\\Users\\Dynamitos\\TrackClearGame";
|
std::string outputPath = "C:\\Users\\Dynamitos\\TrackClearGame";
|
||||||
|
|
||||||
|
std::system("cmake --configure");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,8 @@ target_sources(Engine
|
|||||||
AssetRegistry.cpp
|
AssetRegistry.cpp
|
||||||
FontAsset.h
|
FontAsset.h
|
||||||
FontAsset.cpp
|
FontAsset.cpp
|
||||||
|
LevelAsset.h
|
||||||
|
LevelAsset.cpp
|
||||||
MaterialAsset.h
|
MaterialAsset.h
|
||||||
MaterialAsset.cpp
|
MaterialAsset.cpp
|
||||||
MaterialInstanceAsset.h
|
MaterialInstanceAsset.h
|
||||||
@@ -21,6 +23,7 @@ target_sources(Engine
|
|||||||
Asset.h
|
Asset.h
|
||||||
AssetRegistry.h
|
AssetRegistry.h
|
||||||
FontAsset.h
|
FontAsset.h
|
||||||
|
LevelAsset.h
|
||||||
MaterialAsset.h
|
MaterialAsset.h
|
||||||
MaterialInstanceAsset.h
|
MaterialInstanceAsset.h
|
||||||
MeshAsset.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_OLIGHTLIST", oLightIndexList);
|
||||||
resources->registerBufferOutput("LIGHTCULLING_TLIGHTLIST", tLightIndexList);
|
resources->registerBufferOutput("LIGHTCULLING_TLIGHTLIST", tLightIndexList);
|
||||||
|
|
||||||
resources->registerBufferOutput("DIRECTIONAL_LIGHTS", directLightBuffer);
|
resources->registerBufferOutput("DIRECTIONAL_LIGHTS", passData.lightEnv.directionalLights);
|
||||||
resources->registerUniformOutput("NUM_DIRECTIONAL_LIGHTS", numDirLightBuffer);
|
resources->registerUniformOutput("NUM_DIRECTIONAL_LIGHTS", passData.lightEnv.numDirectional);
|
||||||
resources->registerBufferOutput("POINT_LIGHTS", pointLightBuffer);
|
resources->registerBufferOutput("POINT_LIGHTS", passData.lightEnv.pointLights);
|
||||||
resources->registerUniformOutput("NUM_POINT_LIGHTS", numPointLightBuffer);
|
resources->registerUniformOutput("NUM_POINT_LIGHTS", passData.lightEnv.numPoints);
|
||||||
|
|
||||||
TextureCreateInfo textureInfo = {
|
TextureCreateInfo textureInfo = {
|
||||||
.width = dispatchParams.numThreadGroups.x,
|
.width = dispatchParams.numThreadGroups.x,
|
||||||
|
|||||||
@@ -105,15 +105,37 @@ Array<MeshBatch> Scene::getStaticMeshes()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
LightEnv Scene::getLightBuffer() const
|
LightEnv Scene::getLightBuffer()
|
||||||
{
|
{
|
||||||
result.directionalLights[0].color = Vector4(0.4, 0.3, 0.5, 1.0);
|
StaticArray<DirectionalLight, MAX_DIRECTIONAL_LIGHTS> dirLights;
|
||||||
result.directionalLights[0].direction = Vector4(0.5, -0.5, 0, 0);
|
uint32 numDirLights;
|
||||||
result.numDirectionalLights = 0;
|
for(auto&& [entity, light] : registry.view<DirectionalLight>().each())
|
||||||
result.pointLights[0].positionWS = Vector4(0, 50, 0, 0);
|
{
|
||||||
result.pointLights[0].colorRange = Vector4(0.2, 0.4, 0.7, 100);
|
dirLights[numDirLights++] = light;
|
||||||
result.numPointLights = 1;
|
}
|
||||||
return result;
|
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);
|
registry.view<Component>().each(func);
|
||||||
}
|
}
|
||||||
Array<MeshBatch> getStaticMeshes();
|
Array<MeshBatch> getStaticMeshes();
|
||||||
LightEnv getLightBuffer() const;
|
LightEnv getLightBuffer();
|
||||||
Component::Skybox getSkybox();
|
Component::Skybox getSkybox();
|
||||||
Gfx::PStructuredBuffer getSceneDataBuffer() const { return sceneDataBuffer; }
|
Gfx::PStructuredBuffer getSceneDataBuffer() const { return sceneDataBuffer; }
|
||||||
Gfx::PGraphics getGraphics() const { return graphics; }
|
Gfx::PGraphics getGraphics() const { return graphics; }
|
||||||
|
|||||||
Reference in New Issue
Block a user