Mercurial > games > semicongine
diff src/zamikongine/vertex.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 | 680c4b8ca28a |
children | b41733878bc6 |
line wrap: on
line diff
--- a/src/zamikongine/vertex.nim Sat Jan 14 23:34:50 2023 +0700 +++ b/src/zamikongine/vertex.nim Sun Jan 15 23:23:54 2023 +0700 @@ -14,9 +14,9 @@ Unknown, Position Color GenericAttribute*[T:VertexAttributeType] = object data*: seq[T] - PositionAttribute*[T:VertexAttributeType] = object + PositionAttribute*[T:Vec] = object data*: seq[T] - ColorAttribute*[T:VertexAttributeType] = object + ColorAttribute*[T:Vec] = object data*: seq[T] VertexAttribute* = GenericAttribute|PositionAttribute|ColorAttribute @@ -85,6 +85,11 @@ else: assert result == uint32(value.data.len) +func VertexAttributesCount*[T](): uint32 = + for name, value in T().fieldPairs: + when typeof(value) is VertexAttribute: + result += 1 + func generateGLSLVertexDeclarations*[T](): string = var stmtList: seq[string] var i = 0