Mercurial > games > semicongine
changeset 747:37a9abfd0008
fix: glb import
author | Sam <sam@basx.dev> |
---|---|
date | Thu, 08 Jun 2023 00:29:29 +0700 |
parents | 386417abacba |
children | 4c36aa637912 |
files | src/semicongine/mesh.nim src/semicongine/resources/mesh.nim |
diffstat | 2 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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]
--- 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 = "<Unknown>"