changeset 826:7df5eacf84a0

add: mesh name to drawable
author Sam <sam@basx.dev>
date Wed, 04 Oct 2023 22:02:23 +0700
parents 8a2fae96570c
children dfa722fbd035
files src/semicongine/renderer.nim src/semicongine/vulkan/drawable.nim
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/semicongine/renderer.nim	Mon Oct 02 10:15:09 2023 +0700
+++ b/src/semicongine/renderer.nim	Wed Oct 04 22:02:23 2023 +0700
@@ -261,6 +261,7 @@
     # create drawables
     let indexed = mesh.indexType != MeshIndexType.None
     var drawable = Drawable(
+      name: mesh.name,
       elementCount: if indexed: mesh[].indicesCount else: mesh[].vertexCount,
       bufferOffsets: offsets,
       instanceCount: mesh[].instanceCount,
--- a/src/semicongine/vulkan/drawable.nim	Mon Oct 02 10:15:09 2023 +0700
+++ b/src/semicongine/vulkan/drawable.nim	Wed Oct 04 22:02:23 2023 +0700
@@ -7,6 +7,7 @@
 
 type
   Drawable* = object
+    name*: string
     elementCount*: int # number of vertices or indices
     bufferOffsets*: Table[VkPipeline, seq[(string, MemoryPerformanceHint, int)]] # list of buffers and list of offset for each attribute in that buffer
     instanceCount*: int # number of instance
@@ -19,9 +20,9 @@
 
 func `$`*(drawable: Drawable): string =
   if drawable.indexed:
-    &"Drawable(elementCount: {drawable.elementCount}, instanceCount: {drawable.instanceCount}, bufferOffsets: {drawable.bufferOffsets}, indexType: {drawable.indexType}, indexBufferOffset: {drawable.indexBufferOffset})"
+    &"Drawable({drawable.name}, elementCount: {drawable.elementCount}, instanceCount: {drawable.instanceCount}, bufferOffsets: {drawable.bufferOffsets}, indexType: {drawable.indexType}, indexBufferOffset: {drawable.indexBufferOffset})"
   else:
-    &"Drawable(elementCount: {drawable.elementCount}, instanceCount: {drawable.instanceCount}, bufferOffsets: {drawable.bufferOffsets})"
+    &"Drawable({drawable.name}, elementCount: {drawable.elementCount}, instanceCount: {drawable.instanceCount}, bufferOffsets: {drawable.bufferOffsets})"
 
 proc draw*(drawable: Drawable, commandBuffer: VkCommandBuffer, vertexBuffers: Table[MemoryPerformanceHint, Buffer], indexBuffer: Buffer, pipeline: VkPipeline) =
     debug "Draw ", drawable