Mercurial > games > semicongine
diff 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 |
line wrap: on
line diff
--- a/src/zamikongine/mesh.nim Sat Jan 14 23:34:50 2023 +0700 +++ b/src/zamikongine/mesh.nim Sun Jan 15 23:23:54 2023 +0700 @@ -4,6 +4,7 @@ import ./thing import ./buffer import ./vertex +import ./math/vector type Mesh*[T] = object of Part @@ -101,3 +102,10 @@ result[2] = uint32(mesh.indices.len * mesh.indices[0].len) result[3] = getVkIndexType(mesh) + +func squareData*[T:SomeFloat](): auto = PositionAttribute[Vec2[T]]( + 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)])] +) +func squareIndices*[T:uint16|uint32](): auto = seq[array[3, T]]( + @[[T(1), T(0), T(3)], [T(2), T(1), T(3)], ] +)