From 3ab2402f023f5dfd27e8092437f227c6487775dd Mon Sep 17 00:00:00 2001 From: Quentin01 Date: Wed, 12 Jul 2017 22:51:23 +0900 Subject: [PATCH] Correctly load translation, rotation and scale --- src/lug/Graphics/GltfLoader.cpp | 19 +++++++++++++++++++ thirdparty.yml | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/lug/Graphics/GltfLoader.cpp b/src/lug/Graphics/GltfLoader.cpp index 3bd83b58..c96270ff 100644 --- a/src/lug/Graphics/GltfLoader.cpp +++ b/src/lug/Graphics/GltfLoader.cpp @@ -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)) { diff --git a/thirdparty.yml b/thirdparty.yml index bd561b5d..c8e4fc2c 100644 --- a/thirdparty.yml +++ b/thirdparty.yml @@ -16,7 +16,7 @@ googlemock: gltf2-loader: repository: - tag: c007c437cb435d44506669b8959c7f1682ef2c16 + tag: 5c736d11b9c324d85ae44b03479274c33cff37ed imgui: repository: