comparison src/zamikongine/mesh.nim @ 494:0c18638c7217

did: refactoring, move more from make to nimscript
author Sam <sam@basx.dev>
date Sun, 15 Jan 2023 23:23:54 +0700
parents c472abfcee57
children c3c963e7c1a6
comparison
equal deleted inserted replaced
493:680c4b8ca28a 494:0c18638c7217
2 2
3 import ./vulkan 3 import ./vulkan
4 import ./thing 4 import ./thing
5 import ./buffer 5 import ./buffer
6 import ./vertex 6 import ./vertex
7 import ./math/vector
7 8
8 type 9 type
9 Mesh*[T] = object of Part 10 Mesh*[T] = object of Part
10 vertexData*: T 11 vertexData*: T
11 IndexedMesh*[T: object, U: uint16|uint32] = object of Part 12 IndexedMesh*[T: object, U: uint16|uint32] = object of Part
99 result[0] = createVertexBuffers(mesh, device, physicalDevice, commandPool, queue, useDeviceLocalBuffer)[0] 100 result[0] = createVertexBuffers(mesh, device, physicalDevice, commandPool, queue, useDeviceLocalBuffer)[0]
100 result[1] = createIndexBuffer(mesh, device, physicalDevice, commandPool, queue, useDeviceLocalBuffer) 101 result[1] = createIndexBuffer(mesh, device, physicalDevice, commandPool, queue, useDeviceLocalBuffer)
101 result[2] = uint32(mesh.indices.len * mesh.indices[0].len) 102 result[2] = uint32(mesh.indices.len * mesh.indices[0].len)
102 103
103 result[3] = getVkIndexType(mesh) 104 result[3] = getVkIndexType(mesh)
105
106 func squareData*[T:SomeFloat](): auto = PositionAttribute[Vec2[T]](
107 data: @[Vec2[T]([T(0), T(0)]), Vec2[T]([T(0), T(1)]), Vec2[T]([T(1), T(1)]), Vec2[T]([T(1), T(0)])]
108 )
109 func squareIndices*[T:uint16|uint32](): auto = seq[array[3, T]](
110 @[[T(1), T(0), T(3)], [T(2), T(1), T(3)], ]
111 )