Render target water

This commit is contained in:
2025-07-04 01:10:08 +03:00
parent f58402921f
commit b2e010bdb4
11 changed files with 405 additions and 179 deletions

View File

@@ -15,24 +15,34 @@ set(CREATE_SCENES
${CMAKE_SOURCE_DIR}/characters/male/vroid-normal-male.scene
)
option(OGRE_DYNAMIC "Build against dynamic ogre" ON)
# workaround horribly broken assimp cmake, fixed with assimp 5.1
add_library(fix::assimp INTERFACE IMPORTED)
set_target_properties(fix::assimp PROPERTIES
INTERFACE_LINK_LIBRARIES "${ASSIMP_LIBRARIES};pugixml"
INTERFACE_LINK_DIRECTORIES "${ASSIMP_LIBRARY_DIRS}"
)
#add_library(assimp INTERFACE IMPORTED)
#set_target_properties(assimp PROPERTIES
# INTERFACE_LINK_LIBRARIES "assimp;pugixml"
# # INTERFACE_LINK_DIRECTORIES "${ASSIMP_LIBRARY_DIRS}"
# INTERFACE_LINK_DIRECTORIES "${CMAKE_PREFIX_PATH}/lib"
#)
file(GLOB TERRAIN_SRC ${CMAKE_SOURCE_DIR}/src/terrain/*.cpp)
file(GLOB WATER_SRC ${CMAKE_SOURCE_DIR}/water/*.cpp)
# The COMPONENTS part checks that OGRE was built the way we need it
# The CONFIG flag makes sure we get OGRE instead of OGRE-next
find_package(OGRE REQUIRED COMPONENTS Bites Bullet Paging CONFIG)
find_package(OGRE REQUIRED COMPONENTS Bites Bullet Paging Terrain CONFIG)
find_package(ZLIB)
find_package(SDL2)
find_package(assimp)
find_package(assimp REQUIRED CONFIG)
find_package(Bullet)
find_package(OgreProcedural REQUIRED CONFIG)
find_package(pugixml REQUIRED CONFIG)
add_library(fix::assimp INTERFACE IMPORTED)
set_target_properties(fix::assimp PROPERTIES
INTERFACE_LINK_LIBRARIES "${ASSIMP_LIBRARIES};pugixml"
INTERFACE_LINK_DIRECTORIES "${ASSIMP_LIBRARY_DIRS}"
# INTERFACE_LINK_DIRECTORIES "${CMAKE_PREFIX_PATH}/lib"
)
add_library(fix::OgreProcedural INTERFACE IMPORTED)
set_target_properties(fix::OgreProcedural PROPERTIES
@@ -40,6 +50,21 @@ set_target_properties(fix::OgreProcedural PROPERTIES
INTERFACE_LINK_DIRECTORIES "${CMAKE_PREFIX_PATH}/lib"
)
if(NOT OGRE_DYNAMIC)
add_library(OgreGLSupportStatic INTERFACE IMPORTED)
set_target_properties(OgreGLSupportStatic PROPERTIES
INTERFACE_LINK_LIBRARIES "OgreGLSupportStatic"
INTERFACE_LINK_DIRECTORIES "${CMAKE_PREFIX_PATH}/lib"
)
endif()
add_library(fix::pugixml INTERFACE IMPORTED)
set_target_properties(fix::pugixml PROPERTIES
INTERFACE_LINK_LIBRARIES "pugixml"
INTERFACE_LINK_DIRECTORIES "${CMAKE_PREFIX_PATH}/lib"
)
add_subdirectory(src/lua)
@@ -47,7 +72,7 @@ add_subdirectory(src/lua)
add_executable(0_Bootstrap Bootstrap.cpp)
# this also sets the includes and pulls third party dependencies
target_link_libraries(0_Bootstrap OgreBites OgreBullet OgrePaging ${BULLET_DYNAMICS_LIBRARY} ${BULLET_COLLISION_LIBRARY} ${BULLET_MATH_LIBRARY})
target_link_libraries(0_Bootstrap OgreBites OgreBullet OgrePaging ${BULLET_DYNAMICS_LIBRARY} ${BULLET_COLLISION_LIBRARY} ${BULLET_MATH_LIBRARY} ${ASSIMP_LIBRARIES})
target_include_directories(0_Bootstrap PUBLIC OgreBites OgrePaging OgreBullet)
add_dependencies(0_Bootstrap stage_files)
@@ -60,7 +85,6 @@ add_executable(Procedural Procedural.cpp ${TERRAIN_SRC})
target_link_libraries(Procedural OgreBites OgreBullet OgrePaging OgreTerrain OgreProcedural::OgreProcedural ${BULLET_DYNAMICS_LIBRARY} ${BULLET_COLLISION_LIBRARY} ${BULLET_MATH_LIBRARY})
target_include_directories(Procedural PUBLIC OgreBites OgrePaging OgreBullet OgreTerrain OgreProcedural::OgreProcedural ${CMAKE_PREFIX_PATH}/include/OgreProcedural)
add_dependencies(Procedural stage_files import_buildings)
file(GLOB BUILDINGS_SRC ${CMAKE_SOURCE_DIR}/assets/blender/buildings/*.blend)
set(BUILDING_OUTPUT_FILES)
foreach(BUILDING_FILE ${BUILDINGS_SRC})
@@ -83,6 +107,13 @@ add_custom_target(import_buildings ALL DEPENDS ${BUILDING_OUTPUT_FILES})
add_executable(TerrainTest terrain.cpp ${TERRAIN_SRC})
target_link_libraries(TerrainTest OgreBites OgreBullet OgrePaging OgreTerrain lua ${BULLET_DYNAMICS_LIBRARY} ${BULLET_COLLISION_LIBRARY} ${BULLET_MATH_LIBRARY})
target_include_directories(TerrainTest PUBLIC OgreBites OgrePaging OgreTerrain OgreBullet PRIVATE . src/terrain src/lua src/lua/lua-5.4.8/src)
if(NOT OGRE_DYNAMIC)
target_link_libraries(TerrainTest fix::assimp pugixml)
target_link_libraries(Procedural fix::assimp pugixml)
target_link_libraries(0_Bootstrap fix::assimp pugixml)
target_link_libraries(GuiTest fix::assimp pugixml)
endif()
file(GLOB LUA_SCRIPTS_SRC ${CMAKE_SOURCE_DIR}/lua-scripts/*.lua)
set(LUA_SCRIPTS_OUTPUT)
@@ -150,6 +181,8 @@ set(WATER_SRC
water.program
water.frag
water.vert
depth.frag
depth.vert
water.compositor
waves2.png
)
@@ -201,3 +234,5 @@ add_custom_target(remove_scenes COMMAND rm -f ${CREATE_SCENES})
add_custom_target(import_vrm DEPENDS ${CREATE_SCENES})
install(TARGETS GuiTest DESTINATION bin)