# HG changeset patch # User Sam # Date 1694444281 -25200 # Node ID 4ba8e610b9e8fd9322cd218258969925a43d381d # Parent 7a13941ba204c061a1779667b9b183de797141e5 add: feature to exclude meshes from draw calls diff -r 7a13941ba204 -r 4ba8e610b9e8 src/semicongine/mesh.nim --- a/src/semicongine/mesh.nim Mon Sep 11 21:31:22 2023 +0700 +++ b/src/semicongine/mesh.nim Mon Sep 11 21:58:01 2023 +0700 @@ -26,6 +26,7 @@ material*: Material transform*: Mat4 = Unit4F32 instanceTransforms*: seq[Mat4] + visible*: bool = true transformCache: seq[Mat4] vertexData: Table[string, DataList] instanceData: Table[string, DataList] diff -r 7a13941ba204 -r 4ba8e610b9e8 src/semicongine/renderer.nim --- a/src/semicongine/renderer.nim Mon Sep 11 21:31:22 2023 +0700 +++ b/src/semicongine/renderer.nim Mon Sep 11 21:58:01 2023 +0700 @@ -429,8 +429,7 @@ commandBuffer.vkCmdBindPipeline(renderer.renderPass.subpasses[i].pipelineBindPoint, pipeline.vk) commandBuffer.vkCmdBindDescriptorSets(renderer.renderPass.subpasses[i].pipelineBindPoint, pipeline.layout, 0, 1, addr(renderer.scenedata[scene].descriptorSets[pipeline.vk][renderer.swapchain.currentInFlight].vk), 0, nil) - for (drawable, mesh) in renderer.scenedata[scene].drawables: - if mesh.material.name == materialName: + for (drawable, mesh) in renderer.scenedata[scene].drawables.filterIt(it[1].visible and it[1].material.name == materialName): drawable.draw(commandBuffer, vertexBuffers=renderer.scenedata[scene].vertexBuffers, indexBuffer=renderer.scenedata[scene].indexBuffer, pipeline.vk) if i < renderer.renderPass.subpasses.len - 1: