Fix transform matrices multiplication order per glTF2.0 spec

Closes #1568
pull/1594/head
awefers 2017-11-27 11:30:18 -05:00 committed by Daniel Hritzkiv
parent 0ce3641deb
commit e53d4735b0
No known key found for this signature in database
GPG Key ID: D1D19875679D5CBF
1 changed files with 8 additions and 9 deletions

View File

@ -515,7 +515,13 @@ aiNode* ImportNode(aiScene* pScene, glTF2::Asset& r, std::vector<unsigned int>&
CopyValue(node.translation.value, trans);
aiMatrix4x4 t;
aiMatrix4x4::Translation(trans, t);
matrix = t * matrix;
matrix = matrix * t;
}
if (node.rotation.isPresent) {
aiQuaternion rot;
CopyValue(node.rotation.value, rot);
matrix = matrix * aiMatrix4x4(rot.GetMatrix());
}
if (node.scale.isPresent) {
@ -523,14 +529,7 @@ aiNode* ImportNode(aiScene* pScene, glTF2::Asset& r, std::vector<unsigned int>&
CopyValue(node.scale.value, scal);
aiMatrix4x4 s;
aiMatrix4x4::Scaling(scal, s);
matrix = s * matrix;
}
if (node.rotation.isPresent) {
aiQuaternion rot;
CopyValue(node.rotation.value, rot);
matrix = aiMatrix4x4(rot.GetMatrix()) * matrix;
matrix = matrix * s;
}
}