@@ -91,6 +91,7 @@ struct UniformBufferObject {
9191
9292struct PushConstant {
9393 uint32_t materialIndex;
94+ uint32_t reflective;
9495};
9596
9697class HelloTriangleApplication {
@@ -180,6 +181,7 @@ class HelloTriangleApplication {
180181 uint32_t firstVertex;
181182 uint32_t maxVertex;
182183 bool alphaCut;
184+ bool reflective;
183185 };
184186 std::vector<SubMesh> submeshes;
185187 std::vector<tinyobj::material_t > materials;
@@ -913,14 +915,16 @@ class HelloTriangleApplication {
913915
914916 // Note that this is only valid for this particular MODEL_PATH
915917 bool alphaCut = (shape.name .find (" nettle_plant" ) != std::string::npos);
918+ bool reflective = (shape.name .find (" table" ) != std::string::npos);
916919
917920 submeshes.push_back ({
918921 .indexOffset = startOffset,
919922 .indexCount = indexCount,
920923 .materialID = globalMaterialID,
921924 .firstVertex = 0u ,
922925 .maxVertex = localMaxV + 1 ,
923- .alphaCut = alphaCut
926+ .alphaCut = alphaCut,
927+ .reflective = reflective
924928 });
925929 }
926930
@@ -1652,7 +1656,7 @@ class HelloTriangleApplication {
16521656
16531657 for (auto & sub : submeshes) {
16541658 uint32_t idx = sub.materialID < 0 ? 0u : static_cast <uint32_t >(sub.materialID );
1655- commandBuffers[currentFrame].pushConstants <PushConstant>(pipelineLayout, vk::ShaderStageFlagBits::eFragment, 0 , PushConstant{ .materialIndex = idx });
1659+ commandBuffers[currentFrame].pushConstants <PushConstant>(pipelineLayout, vk::ShaderStageFlagBits::eFragment, 0 , PushConstant{ .materialIndex = idx, . reflective = sub. reflective });
16561660 commandBuffers[currentFrame].drawIndexed (sub.indexCount , 1 , sub.indexOffset , 0 , 0 );
16571661 }
16581662
0 commit comments