Mercurial > games > semicongine
diff src/zamikongine/engine.nim @ 20:beb86492b178
add: generate ubermeshes
author | Sam <sam@basx.dev> |
---|---|
date | Tue, 10 Jan 2023 00:23:40 +0700 |
parents | b55d6ecde79d |
children | b45a5d338cd0 |
line wrap: on
line diff
--- a/src/zamikongine/engine.nim Mon Jan 09 11:04:19 2023 +0700 +++ b/src/zamikongine/engine.nim Tue Jan 10 00:23:40 2023 +0700 @@ -502,10 +502,17 @@ vertexShader, fragmentShader, ) + var allmeshes: seq[Mesh[T]] for mesh in partsOfType[ref Mesh[T]](engine.currentscenedata): - engine.vulkan.vertexBuffers.add createVertexBuffers(mesh[], engine.vulkan.device.device, engine.vulkan.device.physicalDevice.device, engine.vulkan.commandPool, engine.vulkan.device.graphicsQueue) + allmeshes.add(mesh[]) + var ubermesh = createUberMesh(allmeshes) + engine.vulkan.vertexBuffers.add createVertexBuffers(ubermesh, engine.vulkan.device.device, engine.vulkan.device.physicalDevice.device, engine.vulkan.commandPool, engine.vulkan.device.graphicsQueue) + + var allindexedmeshes: seq[IndexedMesh[T, U]] for mesh in partsOfType[ref IndexedMesh[T, U]](engine.currentscenedata): - engine.vulkan.indexedVertexBuffers.add createIndexedVertexBuffers(mesh[], engine.vulkan.device.device, engine.vulkan.device.physicalDevice.device, engine.vulkan.commandPool, engine.vulkan.device.graphicsQueue) + allindexedmeshes.add(mesh[]) + var indexedubermesh = createUberMesh(allindexedmeshes) + engine.vulkan.indexedVertexBuffers.add createIndexedVertexBuffers(indexedubermesh, engine.vulkan.device.device, engine.vulkan.device.physicalDevice.device, engine.vulkan.commandPool, engine.vulkan.device.graphicsQueue) proc recordCommandBuffer(renderPass: VkRenderPass, pipeline: VkPipeline, commandBuffer: VkCommandBuffer, framebuffer: VkFramebuffer, frameDimension: VkExtent2D, engine: var Engine) = var