mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-14 21:15:52 +08:00
Examples/glview - apply translation, rotation, scale in that order
Tested on the Kenney.nl CarKit models: https://www.kenney.nl/assets/car-kit
This commit is contained in:
parent
d642c80a86
commit
0ffdc4334a
@ -805,10 +805,6 @@ static void DrawNode(tinygltf::Model &model, const tinygltf::Node &node) {
|
|||||||
glMultMatrixd(node.matrix.data());
|
glMultMatrixd(node.matrix.data());
|
||||||
} else {
|
} else {
|
||||||
// Assume Trans x Rotate x Scale order
|
// 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) {
|
if (node.translation.size() == 3) {
|
||||||
glTranslated(node.translation[0], node.translation[1],
|
glTranslated(node.translation[0], node.translation[1],
|
||||||
node.translation[2]);
|
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]);
|
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() <<
|
// std::cout << "node " << node.name << ", Meshes " << node.meshes.size() <<
|
||||||
|
Loading…
x
Reference in New Issue
Block a user