comparison 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
comparison
equal deleted inserted replaced
19:b55d6ecde79d 20:beb86492b178
500 engine.vulkan.frameDimension, 500 engine.vulkan.frameDimension,
501 engine.vulkan.renderPass, 501 engine.vulkan.renderPass,
502 vertexShader, 502 vertexShader,
503 fragmentShader, 503 fragmentShader,
504 ) 504 )
505 var allmeshes: seq[Mesh[T]]
505 for mesh in partsOfType[ref Mesh[T]](engine.currentscenedata): 506 for mesh in partsOfType[ref Mesh[T]](engine.currentscenedata):
506 engine.vulkan.vertexBuffers.add createVertexBuffers(mesh[], engine.vulkan.device.device, engine.vulkan.device.physicalDevice.device, engine.vulkan.commandPool, engine.vulkan.device.graphicsQueue) 507 allmeshes.add(mesh[])
508 var ubermesh = createUberMesh(allmeshes)
509 engine.vulkan.vertexBuffers.add createVertexBuffers(ubermesh, engine.vulkan.device.device, engine.vulkan.device.physicalDevice.device, engine.vulkan.commandPool, engine.vulkan.device.graphicsQueue)
510
511 var allindexedmeshes: seq[IndexedMesh[T, U]]
507 for mesh in partsOfType[ref IndexedMesh[T, U]](engine.currentscenedata): 512 for mesh in partsOfType[ref IndexedMesh[T, U]](engine.currentscenedata):
508 engine.vulkan.indexedVertexBuffers.add createIndexedVertexBuffers(mesh[], engine.vulkan.device.device, engine.vulkan.device.physicalDevice.device, engine.vulkan.commandPool, engine.vulkan.device.graphicsQueue) 513 allindexedmeshes.add(mesh[])
514 var indexedubermesh = createUberMesh(allindexedmeshes)
515 engine.vulkan.indexedVertexBuffers.add createIndexedVertexBuffers(indexedubermesh, engine.vulkan.device.device, engine.vulkan.device.physicalDevice.device, engine.vulkan.commandPool, engine.vulkan.device.graphicsQueue)
509 516
510 proc recordCommandBuffer(renderPass: VkRenderPass, pipeline: VkPipeline, commandBuffer: VkCommandBuffer, framebuffer: VkFramebuffer, frameDimension: VkExtent2D, engine: var Engine) = 517 proc recordCommandBuffer(renderPass: VkRenderPass, pipeline: VkPipeline, commandBuffer: VkCommandBuffer, framebuffer: VkFramebuffer, frameDimension: VkExtent2D, engine: var Engine) =
511 var 518 var
512 beginInfo = VkCommandBufferBeginInfo( 519 beginInfo = VkCommandBufferBeginInfo(
513 sType: VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, 520 sType: VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,