2026-03-25 14:24:05 +01:00
|
|
|
cmake_minimum_required(VERSION 3.19)
|
|
|
|
|
project(BVLEVoxels LANGUAGES CXX)
|
|
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
|
|
|
|
|
# Wicked Engine options - disable what we don't need
|
|
|
|
|
set(WICKED_EDITOR OFF CACHE BOOL "" FORCE)
|
|
|
|
|
set(WICKED_TESTS OFF CACHE BOOL "" FORCE)
|
|
|
|
|
set(WICKED_IMGUI_EXAMPLE OFF CACHE BOOL "" FORCE)
|
|
|
|
|
set(WICKED_WINDOWS_TEMPLATE OFF CACHE BOOL "" FORCE)
|
|
|
|
|
set(WICKED_LINUX_TEMPLATE OFF CACHE BOOL "" FORCE)
|
|
|
|
|
set(WICKED_ENABLE_SYMLINKS OFF CACHE BOOL "" FORCE)
|
|
|
|
|
|
|
|
|
|
add_subdirectory(engine)
|
|
|
|
|
|
|
|
|
|
# ── Voxel Engine Library ──────────────────────────────────────────
|
|
|
|
|
file(GLOB_RECURSE VOXEL_SOURCES src/voxel/*.cpp src/voxel/*.h)
|
|
|
|
|
add_library(VoxelEngine STATIC ${VOXEL_SOURCES})
|
|
|
|
|
target_include_directories(VoxelEngine PUBLIC src)
|
|
|
|
|
target_link_libraries(VoxelEngine PUBLIC WickedEngine)
|
|
|
|
|
|
|
|
|
|
# ── Main Application ─────────────────────────────────────────────
|
|
|
|
|
file(GLOB APP_SOURCES src/app/*.cpp src/app/*.h)
|
|
|
|
|
add_executable(BVLEVoxels WIN32 ${APP_SOURCES})
|
|
|
|
|
target_link_libraries(BVLEVoxels PRIVATE VoxelEngine WickedEngine)
|
|
|
|
|
|
|
|
|
|
# Copy Content directory (shaders, etc.) to build output
|
|
|
|
|
add_custom_command(TARGET BVLEVoxels POST_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
|
|
|
${CMAKE_SOURCE_DIR}/engine/Content
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/Content
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Copy DXC shader compiler DLL next to the exe (required for runtime shader compilation)
|
|
|
|
|
add_custom_command(TARGET BVLEVoxels POST_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
|
${CMAKE_SOURCE_DIR}/engine/WickedEngine/dxcompiler.dll
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/dxcompiler.dll
|
|
|
|
|
COMMENT "Copying DXC shader compiler DLL"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Copy our custom shader sources into Wicked's shader source tree
|
|
|
|
|
# so LoadShader can find and compile them as "voxel/voxelVS.cso"
|
|
|
|
|
add_custom_command(TARGET BVLEVoxels POST_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
|
|
|
${CMAKE_SOURCE_DIR}/shaders
|
|
|
|
|
${CMAKE_SOURCE_DIR}/engine/WickedEngine/shaders/voxel
|
|
|
|
|
COMMENT "Copying voxel shaders to Wicked Engine shader source directory"
|
|
|
|
|
)
|
2026-03-25 19:38:50 +01:00
|
|
|
|
|
|
|
|
# Delete stale compiled voxel shaders to force runtime recompilation.
|
|
|
|
|
# Wicked Engine only compiles .hlsl → .cso when .cso is ABSENT (no timestamp check).
|
|
|
|
|
# Without this step, .hlsl changes are silently ignored if old .cso files exist.
|
|
|
|
|
add_custom_command(TARGET BVLEVoxels POST_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E rm -f
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelVS.cso
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelPS.cso
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelCullCS.cso
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelMeshCS.cso
|
Phase 5.1: Naive Surface Nets smooth rendering
Implement CPU-side Naive Surface Nets for smooth voxel surfaces (SmoothStone,
Snow) coexisting with blocky voxels (Grass, Dirt, Stone, Sand).
Key features:
- SmoothMesher with binary SDF, centroid vertex placement, per-axis boundary
clamping to align with blocky grid at smooth↔blocky transitions
- Cross-chunk connectivity: PAD=2 SDF grid, vertex range [-1, CHUNK_SIZE),
canonical edge ownership (no duplicate triangles, no z-fighting)
- Face normals oriented by edge axis+sign (robust with binary SDF, unlike
SDF gradient dot or centroid sampling approaches)
- Y-axis winding fix: sharing cells have different spatial arrangement,
requiring opposite winding from X and Z axes
- GPU mesher treats smooth neighbors as solid (no blocky faces toward smooth)
- Material blending: primary (smooth-only) + secondary (all counts) per vertex
- Dedicated shaders: voxelSmoothVS (vertex pulling t6) + voxelSmoothPS
(triplanar + lerp blending between two materials)
- Separate render pass with LoadOp::LOAD after voxels+topings
- New materials: SmoothStone (mat 6), blocky Stone (mat 3) and Dirt patches
added to world generation for boundary testing
2026-03-27 13:03:55 +01:00
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelTopingVS.cso
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelTopingPS.cso
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelSmoothVS.cso
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelSmoothPS.cso
|
2026-03-28 14:48:11 +01:00
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelSmoothCentroidCS.cso
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelSmoothCS.cso
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelBLASExtractCS.cso
|
2026-03-28 20:01:18 +01:00
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelShadowCS.cso
|
2026-03-29 09:31:19 +02:00
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelAOBlurCS.cso
|
|
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelAOApplyCS.cso
|
2026-03-25 19:38:50 +01:00
|
|
|
$<TARGET_FILE_DIR:BVLEVoxels>/shaders/hlsl6/voxel/voxelCommon.hlsli.cso
|
|
|
|
|
COMMENT "Clearing stale voxel shader cache (forces recompilation from current .hlsl sources)"
|
|
|
|
|
)
|