From 0ffdc4334a154885292b37db47c7d077aa2ad6b0 Mon Sep 17 00:00:00 2001 From: Dave LeCompte Date: Wed, 2 Mar 2022 07:01:34 -0800 Subject: [PATCH] Examples/glview - apply translation, rotation, scale in that order Tested on the Kenney.nl CarKit models: https://www.kenney.nl/assets/car-kit --- examples/glview/glview.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/glview/glview.cc b/examples/glview/glview.cc index 5c112cf..849dc17 100644 --- a/examples/glview/glview.cc +++ b/examples/glview/glview.cc @@ -805,10 +805,6 @@ static void DrawNode(tinygltf::Model &model, const tinygltf::Node &node) { glMultMatrixd(node.matrix.data()); } else { // Assume Trans x Rotate x Scale order - if (node.scale.size() == 3) { - glScaled(node.scale[0], node.scale[1], node.scale[2]); - } - if (node.translation.size() == 3) { glTranslated(node.translation[0], node.translation[1], node.translation[2]); @@ -823,6 +819,9 @@ static void DrawNode(tinygltf::Model &model, const tinygltf::Node &node) { glRotated(angleDegrees, axis[0], axis[1], axis[2]); } + if (node.scale.size() == 3) { + glScaled(node.scale[0], node.scale[1], node.scale[2]); + } } // std::cout << "node " << node.name << ", Meshes " << node.meshes.size() <<