comparison tests/test_gltf.nim @ 1278:772bb32c4368

replcae lodepng with stb_image, some cleanup
author sam <sam@basx.dev>
date Mon, 29 Jul 2024 00:00:28 +0700
parents 4cf9872f7bb6
children e0ba4aead324
comparison
equal deleted inserted replaced
1270:4cfa8db3fc9e 1278:772bb32c4368
27 # normalTexture: int32 = -1 27 # normalTexture: int32 = -1
28 # occlusionTexture: int32 = -1 28 # occlusionTexture: int32 = -1
29 emissive: Vec4f = NewVec4f(0, 0, 0, 0) 29 emissive: Vec4f = NewVec4f(0, 0, 0, 0)
30 # emissiveTexture: int32 = -1 30 # emissiveTexture: int32 = -1
31 MainDescriptors = object 31 MainDescriptors = object
32 materials: array[32, GPUValue[Material, UniformBuffer]] 32 materials: array[50, GPUValue[Material, UniformBuffer]]
33 camera: GPUValue[Camera, UniformBufferMapped] 33 camera: GPUValue[Camera, UniformBufferMapped]
34 Shader = object 34 Shader = object
35 objectData {.PushConstantAttribute.}: ObjectData 35 objectData {.PushConstantAttribute.}: ObjectData
36 position {.VertexAttribute.}: Vec3f 36 position {.VertexAttribute.}: Vec3f
37 color {.VertexAttribute.}: Vec4f 37 color {.VertexAttribute.}: Vec4f
127 for primitive in mitems(mesh): 127 for primitive in mitems(mesh):
128 primitive[0].color = asGPUArray(newSeqWith(primitive[0].position.data.len, NewVec4f(1, 1, 1, 1)), VertexBuffer) 128 primitive[0].color = asGPUArray(newSeqWith(primitive[0].position.data.len, NewVec4f(1, 1, 1, 1)), VertexBuffer)
129 renderdata.AssignBuffers(primitive[0]) 129 renderdata.AssignBuffers(primitive[0])
130 renderdata.AssignBuffers(descriptors) 130 renderdata.AssignBuffers(descriptors)
131 131
132 var pipeline = CreatePipeline[Shader](renderPass = vulkan.swapchain.renderPass) 132 var pipeline = CreatePipeline[Shader](renderPass = vulkan.swapchain.renderPass, cullMode=[])
133 InitDescriptorSet(renderdata, pipeline.descriptorSetLayouts[0], descriptors) 133 InitDescriptorSet(renderdata, pipeline.descriptorSetLayouts[0], descriptors)
134 134
135 renderdata.FlushAllMemory() 135 renderdata.FlushAllMemory()
136 136
137 proc drawNode(commandbuffer: VkCommandBuffer, pipeline: Pipeline, nodeId: int, transform: Mat4) = 137 proc drawNode(commandbuffer: VkCommandBuffer, pipeline: Pipeline, nodeId: int, transform: Mat4) =