Moves around assets stuff in cmake
This commit is contained in:
@@ -59,10 +59,14 @@ foreach (ASSET IN LISTS ASSETS)
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/assets/${REL_PATH})
|
||||
endif ()
|
||||
|
||||
set(OUT_PATH ${CMAKE_BINARY_DIR}/bin/assets/${REL_PATH}${FILENAME})
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/assets/${FILENAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ASSET} ${CMAKE_BINARY_DIR}/bin/assets/${FILENAME}
|
||||
COMMENT " Copying ${ASSET} ")
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ASSET} ${OUT_PATH}
|
||||
COMMENT " Copying ${ASSET} to ${OUT_PATH}")
|
||||
|
||||
list(APPEND OUT_ASSETS ${CMAKE_BINARY_DIR}/bin/assets/${FILENAME})
|
||||
list(APPEND ADDITIONAL_CLEAN_FILES ${OUT_PATH})
|
||||
endforeach ()
|
||||
|
||||
file(GLOB_RECURSE SHADERS
|
||||
@@ -81,12 +85,16 @@ foreach (SHADER IN LISTS SHADERS)
|
||||
set(REL_PATH ${REL_PATH}/)
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/shaders/${REL_PATH})
|
||||
endif ()
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/shaders/${FILENAME}.spv
|
||||
COMMAND ${Vulkan_GLSLC_EXECUTABLE} ${SHADER_DEBUG_FLAGS} ${SHADER} -o ${CMAKE_BINARY_DIR}/bin/shaders/${REL_PATH}${FILENAME}.spv DEPENDS ${SHADER}
|
||||
COMMENT " Compiling ${SHADER} ")
|
||||
list(APPEND SPV_SHADERS ${CMAKE_BINARY_DIR}/bin/shaders/${FILENAME}.spv)
|
||||
endforeach ()
|
||||
|
||||
set(OUT_PATH ${CMAKE_BINARY_DIR}/bin/shaders/${REL_PATH}${FILENAME}.spv)
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/shaders/${FILENAME}.spv
|
||||
COMMAND ${Vulkan_GLSLC_EXECUTABLE} ${SHADER_DEBUG_FLAGS} ${SHADER} -o ${OUT_PATH} DEPENDS ${SHADER}
|
||||
COMMENT " Compiling ${SHADER} ")
|
||||
|
||||
list(APPEND SPV_SHADERS ${CMAKE_BINARY_DIR}/bin/shaders/${FILENAME}.spv)
|
||||
list(APPEND ADDITIONAL_CLEAN_FILES ${OUT_PATH})
|
||||
endforeach ()
|
||||
|
||||
add_custom_target(shaders ALL DEPENDS ${SPV_SHADERS})
|
||||
add_custom_target(assets ALL DEPENDS ${OUT_ASSETS})
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace fgl::engine
|
||||
SwapChain::MAX_FRAMES_IN_FLIGHT };
|
||||
|
||||
std::shared_ptr< Texture > debug_tex {
|
||||
getTextureStore().load( "models/textures/DebugTexture.png", vk::Format::eR8G8B8A8Unorm )
|
||||
getTextureStore().load( "assets/textures/DebugTexture.png", vk::Format::eR8G8B8A8Unorm )
|
||||
};
|
||||
|
||||
constexpr std::uint32_t matrix_default_size { 64_MiB };
|
||||
@@ -224,7 +224,7 @@ namespace fgl::engine
|
||||
{
|
||||
std::shared_ptr< Model > model { Model::createModel(
|
||||
Device::getInstance(),
|
||||
"models/night_heron8.obj",
|
||||
"assets/night_heron8.obj",
|
||||
m_entity_renderer.getVertexBuffer(),
|
||||
m_entity_renderer.getIndexBuffer() ) };
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace fgl::engine
|
||||
{
|
||||
std::shared_ptr< Model > model { Model::createModel(
|
||||
Device::getInstance(),
|
||||
"models/khronos-sponza/Sponza.gltf",
|
||||
"assets/khronos-sponza/Sponza.gltf",
|
||||
m_entity_renderer.getVertexBuffer(),
|
||||
m_entity_renderer.getIndexBuffer() ) };
|
||||
|
||||
@@ -277,13 +277,13 @@ namespace fgl::engine
|
||||
/*
|
||||
{
|
||||
ZoneScopedN( "Load phyiscs test" );
|
||||
std::vector< std::shared_ptr< Model > > models { Model::createModelsFromScene(
|
||||
std::vector< std::shared_ptr< Model > > assets { Model::createModelsFromScene(
|
||||
Device::getInstance(),
|
||||
"models/PhysicsTest.glb",
|
||||
"assets/PhysicsTest.glb",
|
||||
m_entity_renderer.getVertexBuffer(),
|
||||
m_entity_renderer.getIndexBuffer() ) };
|
||||
|
||||
for ( auto& model : models )
|
||||
for ( auto& model : assets )
|
||||
{
|
||||
GameObject object { GameObject::createGameObject() };
|
||||
object.m_model = std::move( model );
|
||||
@@ -303,7 +303,7 @@ namespace fgl::engine
|
||||
generateTerrainModel( m_terrain_system.getVertexBuffer(), m_terrain_system.getIndexBuffer() )
|
||||
};
|
||||
|
||||
//Texture texture { Texture::loadFromFile( "models/Vally/textures/heightmap.png" ) };
|
||||
//Texture texture { Texture::loadFromFile( "assets/Vally/textures/heightmap.png" ) };
|
||||
Texture texture { Texture::generateFromPerlinNoise( 1024, 1024, 120 ) };
|
||||
|
||||
Sampler sampler { vk::Filter::eLinear,
|
||||
@@ -334,7 +334,7 @@ namespace fgl::engine
|
||||
{
|
||||
std::shared_ptr< Model > model { Model::createModel(
|
||||
Device::getInstance(),
|
||||
"models/smooth_vase.obj",
|
||||
"assets/smooth_vase.obj",
|
||||
m_entity_renderer.getVertexBuffer(),
|
||||
m_entity_renderer.getIndexBuffer() ) };
|
||||
|
||||
@@ -352,7 +352,7 @@ namespace fgl::engine
|
||||
{
|
||||
std::shared_ptr< Model > flat_model { Model::createModel(
|
||||
Device::getInstance(),
|
||||
"models/flat_vase.obj",
|
||||
"assets/flat_vase.obj",
|
||||
m_entity_renderer.getVertexBuffer(),
|
||||
m_entity_renderer.getIndexBuffer() ) };
|
||||
|
||||
@@ -369,7 +369,7 @@ namespace fgl::engine
|
||||
{
|
||||
std::shared_ptr< Model > quad_model { Model::createModel(
|
||||
Device::getInstance(),
|
||||
"models/quad.obj",
|
||||
"assets/quad.obj",
|
||||
m_entity_renderer.getVertexBuffer(),
|
||||
m_entity_renderer.getIndexBuffer() ) };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user