# HG changeset patch # User Sam # Date 1694965456 -25200 # Node ID 528671dce35a7375f5d302e2ab2d8b8fb0417f19 # Parent fe5aced90cb23c563b0dcb9a3fb3c8c00b011005 did: formatting and better mesh-toString diff -r fe5aced90cb2 -r 528671dce35a src/semicongine/mesh.nim --- a/src/semicongine/mesh.nim Sun Sep 17 21:09:38 2023 +0700 +++ b/src/semicongine/mesh.nim Sun Sep 17 22:44:16 2023 +0700 @@ -39,12 +39,15 @@ textures*: Table[string, Texture] index*: uint16 # optional, may be used to index into uniform arrays in shader -let DEFAULT_MATERIAL = Material( +let DEFAULT_MATERIAL* = Material( name: "default material" ) +func instanceCount*(mesh: MeshObject): int = + mesh.instanceTransforms.len + func `$`*(mesh: MeshObject): string = - &"Mesh(vertexCount: {mesh.vertexCount}, vertexData: {mesh.vertexData.keys().toSeq()}, instanceData: {mesh.instanceData.keys().toSeq()}, indexType: {mesh.indexType})" + &"Mesh(vertexCount: {mesh.vertexCount}, instanceCount: {mesh.instanceCount}, vertexData: {mesh.vertexData.keys().toSeq()}, instanceData: {mesh.instanceData.keys().toSeq()}, indexType: {mesh.indexType})" func `$`*(mesh: Mesh): string = $mesh[] @@ -72,9 +75,6 @@ func hash*(mesh: Mesh): Hash = hash(cast[ptr MeshObject](mesh)) -func instanceCount*(mesh: MeshObject): int = - mesh.instanceTransforms.len - converter toVulkan*(indexType: MeshIndexType): VkIndexType = case indexType: of None: VK_INDEX_TYPE_NONE_KHR diff -r fe5aced90cb2 -r 528671dce35a src/semicongine/renderer.nim --- a/src/semicongine/renderer.nim Sun Sep 17 21:09:38 2023 +0700 +++ b/src/semicongine/renderer.nim Sun Sep 17 22:44:16 2023 +0700 @@ -429,7 +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.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) + drawable.draw(commandBuffer, vertexBuffers=renderer.scenedata[scene].vertexBuffers, indexBuffer=renderer.scenedata[scene].indexBuffer, pipeline.vk) if i < renderer.renderPass.subpasses.len - 1: commandBuffer.vkCmdNextSubpass(VK_SUBPASS_CONTENTS_INLINE)