Skip to content

Commit

Permalink
Correctly load translation, rotation and scale
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin01 committed Jul 12, 2017
1 parent e818a0e commit 3ab2402
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/lug/Graphics/GltfLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,25 @@ static bool createNode(Renderer& renderer, const gltf2::Asset& asset, const gltf
node->attachMeshInstance(mesh);
}

node->setPosition({
gltfNode.translation[0],
gltfNode.translation[1],
gltfNode.translation[2]
}, Node::TransformSpace::Parent);

node->setRotation(Math::Quatf{
gltfNode.rotation[3],
gltfNode.rotation[0],
gltfNode.rotation[1],
gltfNode.rotation[2]
}, Node::TransformSpace::Parent);

node->scale({
gltfNode.scale[0],
gltfNode.scale[1],
gltfNode.scale[2]
});

for (uint32_t nodeIdx : gltfNode.children) {
const gltf2::Node& childrenGltfNode = asset.nodes[nodeIdx];
if (!createNode(renderer, asset, childrenGltfNode, *node)) {
Expand Down
2 changes: 1 addition & 1 deletion thirdparty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ googlemock:

gltf2-loader:
repository:
tag: c007c437cb435d44506669b8959c7f1682ef2c16
tag: 5c736d11b9c324d85ae44b03479274c33cff37ed

imgui:
repository:
Expand Down

0 comments on commit 3ab2402

Please sign in to comment.