# HG changeset patch # User Sam # Date 1694444281 -25200 # Node ID 1c40de824c39a4ba9234805f27fc3c7909302048 # Parent b83b3a1ccb059a32cc08d6d06c62156d70c274d7 add: feature to exclude meshes from draw calls diff -r b83b3a1ccb05 -r 1c40de824c39 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 b83b3a1ccb05 -r 1c40de824c39 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: