Mercurial > games > semicongine
comparison src/zamikongine/mesh.nim @ 33:94c38e4b5782
did: refactoring, move more from make to nimscript
author | Sam <sam@basx.dev> |
---|---|
date | Sun, 15 Jan 2023 23:23:54 +0700 |
parents | beb86492b178 |
children | c3c963e7c1a6 |
comparison
equal
deleted
inserted
replaced
32:9edca5dc4e93 | 33:94c38e4b5782 |
---|---|
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 ) |