Mercurial > games > semicongine
changeset 345:1c40de824c39
add: feature to exclude meshes from draw calls
author | Sam <sam@basx.dev> |
---|---|
date | Mon, 11 Sep 2023 21:58:01 +0700 |
parents | b83b3a1ccb05 |
children | da0375455adb |
files | src/semicongine/mesh.nim src/semicongine/renderer.nim |
diffstat | 2 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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]
--- 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: