# HG changeset patch # User Sam # Date 1686158969 -25200 # Node ID 37a9abfd00089b34c5c77f63583e9a34971b23e4 # Parent 386417abacba931c33a80212b7109619a7a771ef fix: glb import diff -r 386417abacba -r 37a9abfd0008 src/semicongine/mesh.nim --- a/src/semicongine/mesh.nim Tue Jun 06 01:00:43 2023 +0700 +++ b/src/semicongine/mesh.nim Thu Jun 08 00:29:29 2023 +0700 @@ -17,7 +17,7 @@ Big # up to 2^32 vertices Mesh* = ref object of Component instanceCount*: uint32 - instanceTransforms: seq[Mat4] # this should not reside in data["transform"], as we will use data["transform"] to store the final transformation matrix (as derived from the scene-tree) + instanceTransforms*: seq[Mat4] # this should not reside in data["transform"], as we will use data["transform"] to store the final transformation matrix (as derived from the scene-tree) dirtyInstanceTransforms: bool data: Table[string, DataList] changedAttributes: seq[string] diff -r 386417abacba -r 37a9abfd0008 src/semicongine/resources/mesh.nim --- a/src/semicongine/resources/mesh.nim Tue Jun 06 01:00:43 2023 +0700 +++ b/src/semicongine/resources/mesh.nim Thu Jun 08 00:29:29 2023 +0700 @@ -162,8 +162,7 @@ raise newException(Exception, &"Unsupported index data type: {data.thetype}") proc loadMesh(root: JsonNode, meshNode: JsonNode, mainBuffer: var seq[uint8]): Mesh = - result = new Mesh - result.instanceCount = 1 + result = Mesh(instanceCount: 1, instanceTransforms: newSeqWith(1, Unit4F32)) # check if and how we use indexes var indexCount = 0 @@ -192,7 +191,7 @@ for primitive in meshNode["primitives"]: result.addPrimitive(root, primitive, mainBuffer) - # gld uses +y up, but we (vulkan) don't + setInstanceData(result, "transform", newSeqWith(int(result.instanceCount), Unit4F32)) proc loadNode(root: JsonNode, node: JsonNode, mainBuffer: var seq[uint8]): Entity = var name = ""