Skip to content

Commit

Permalink
Updated the cmake build_ShaderSets script to make it more portable an…
Browse files Browse the repository at this point in the history
…d easier to read and adjust.
  • Loading branch information
robertosfield committed Oct 15, 2024
1 parent bb3ec60 commit 5e37a26
Show file tree
Hide file tree
Showing 2 changed files with 41,102 additions and 41,040 deletions.
70 changes: 66 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,73 @@ add_custom_target(build_all_h
set_target_properties(build_all_h PROPERTIES FOLDER "VulkanSceneGraph")

# build_ShaderSets target automatically rebuilds the various built-in ShaderSets.
set(PBR_DEFINES
-v \"\"
-v "VSG_DIFFUSE_MAP"
-v "VSG_EMISSIVE_MAP"
-v "VSG_LIGHTMAP_MAP"
-v "VSG_METALLROUGHNESS_MAP"
-v "VSG_NORMAL_MAP"
-v "VSG_SKINNING"
-v "VSG_TWO_SIDED_LIGHTING"
-v "VSG_WORKFLOW_SPECGLOSS"
-v "VSG_DIFFUSE_MAP VSG_EMISSIVE_MAP"
-v "VSG_DIFFUSE_MAP VSG_LIGHTMAP_MAP"
-v "VSG_DIFFUSE_MAP VSG_METALLROUGHNESS_MAP"
-v "VSG_DIFFUSE_MAP VSG_NORMAL_MAP"
-v "VSG_DIFFUSE_MAP VSG_SKINNING"
-v "VSG_DIFFUSE_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_WORKFLOW_SPECGLOSS"
-v "VSG_LIGHTMAP_MAP VSG_METALLROUGHNESS_MAP"
-v "VSG_LIGHTMAP_MAP VSG_NORMAL_MAP"
-v "VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP"
-v "VSG_METALLROUGHNESS_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_EMISSIVE_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_LIGHTMAP_MAP VSG_METALLROUGHNESS_MAP"
-v "VSG_DIFFUSE_MAP VSG_LIGHTMAP_MAP VSG_NORMAL_MAP"
-v "VSG_DIFFUSE_MAP VSG_LIGHTMAP_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP"
-v "VSG_DIFFUSE_MAP VSG_METALLROUGHNESS_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_NORMAL_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_LIGHTMAP_MAP VSG_NORMAL_MAP VSG_WORKFLOW_SPECGLOSS"
-v "VSG_DIFFUSE_MAP VSG_EMISSIVE_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP"
-v "VSG_DIFFUSE_MAP VSG_LIGHTMAP_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP"
-v "VSG_DIFFUSE_MAP VSG_LIGHTMAP_MAP VSG_NORMAL_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_EMISSIVE_MAP VSG_LIGHTMAP_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP"
-v "VSG_DIFFUSE_MAP VSG_EMISSIVE_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_LIGHTMAP_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_LIGHTMAP_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP VSG_WORKFLOW_SPECGLOSS"
-v "VSG_DIFFUSE_MAP VSG_EMISSIVE_MAP VSG_LIGHTMAP_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_EMISSIVE_MAP VSG_LIGHTMAP_MAP VSG_NORMAL_MAP VSG_SPECULAR_MAP VSG_WORKFLOW_SPECGLOSS"
)

set(PHONG_DEFINES
-v \"\"
-v "VSG_BILLBOARD"
-v "VSG_DIFFUSE_MAP"
-v "VSG_BILLBOARD VSG_DIFFUSE_MAP"
)

set(FLAT_DEFINES
-v \"\"
-v "VSG_BILLBOARD"
-v "VSG_DIFFUSE_MAP"
-v "VSG_BILLBOARD VSG_DIFFUSE_MAP"
)

set(TEXT_DEFINES
-v "CPU_LAYOUT"
-v "CPU_LAYOUT BILLBOARD"
-v "GPU_LAYOUT"
-v "GPU_LAYOUT BILLBOARD"
)

add_custom_target(build_ShaderSets
COMMAND find ~/Data/glTF-Sample-Models/2.0 -name "*.glb" -o -name "*.gltf" | xargs vsgshaderset --pbr -o src/vsg/utils/shaders/pbr_ShaderSet.cpp --binary
COMMAND vsgshaderset --phong -v \"\" -v "VSG_BILLBOARD" -v "VSG_DIFFUSE_MAP" -v "VSG_BILLBOARD VSG_DIFFUSE_MAP" -o src/vsg/utils/shaders/phong_ShaderSet.cpp --binary
COMMAND vsgshaderset --flat -v \"\" -v "VSG_BILLBOARD" -v "VSG_DIFFUSE_MAP" -v "VSG_BILLBOARD VSG_DIFFUSE_MAP" -o src/vsg/utils/shaders/flat_ShaderSet.cpp --binary
COMMAND vsgshaderset --text -v "CPU_LAYOUT" -v "CPU_LAYOUT BILLBOARD" -v "GPU_LAYOUT" -v "GPU_LAYOUT BILLBOARD" -o src/vsg/text/shaders/text_ShaderSet.cpp --binary
COMMAND vsgshaderset --pbr ${PBR_DEFINES} -o src/vsg/utils/shaders/pbr_ShaderSet.cpp --binary
COMMAND vsgshaderset --phong ${PHONG_DEFINES} -o src/vsg/utils/shaders/phong_ShaderSet.cpp --binary
COMMAND vsgshaderset --flat ${FLAT_DEFINES} -o src/vsg/utils/shaders/flat_ShaderSet.cpp --binary
COMMAND vsgshaderset --text ${TEXT_DEFINES} -o src/vsg/text/shaders/text_ShaderSet.cpp --binary
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "update built-in ShaderSets"
)
Expand Down
Loading

0 comments on commit 5e37a26

Please sign in to comment.