# HG changeset patch # User Sam # Date 1691860777 -25200 # Node ID 83954ffb238b094aeb3b0e5fb54940f2eee5d66b # Parent e656c0aad09301e620552f9f3ca4102d6ece36e3 fix: gltf import transform diff -r e656c0aad093 -r 83954ffb238b src/semicongine/resources/mesh.nim --- a/src/semicongine/resources/mesh.nim Sat Aug 12 23:55:05 2023 +0700 +++ b/src/semicongine/resources/mesh.nim Sun Aug 13 00:19:37 2023 +0700 @@ -153,13 +153,15 @@ for entry in getValues[uint16](data)[]: tri.add uint32(entry) + baseIndex if tri.len == 3: - mesh.appendIndicesData(tri[0], tri[1], tri[2]) + # FYI gltf uses counter-clockwise indexing + mesh.appendIndicesData(tri[0], tri[2], tri[1]) tri.setLen(0) of UInt32: for entry in getValues[uint32](data)[]: tri.add uint32(entry) if tri.len == 3: - mesh.appendIndicesData(tri[0], tri[1], tri[2]) + # FYI gltf uses counter-clockwise indexing + mesh.appendIndicesData(tri[0], tri[2], tri[1]) tri.setLen(0) else: raise newException(Exception, &"Unsupported index data type: {data.thetype}") @@ -247,7 +249,6 @@ var rootEntity = newEntity("") for nodeId in scenenode["nodes"]: var node = loadNode(root, root["nodes"][nodeId.getInt()], mainBuffer) - node.transform = node.transform * scale3d(1'f32, -1'f32, 1'f32) rootEntity.add node newScene(scenenode["name"].getStr(), rootEntity)