From d2d9ca878884c3e097aab36f34ea3e356c74b368 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 14 May 2014 09:04:59 -0700 Subject: [PATCH] optimization: only compute baseTransform once --- interface/src/renderer/Model.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index f46fd48beb..0c688865f3 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -128,6 +128,7 @@ QVector Model::createJointStates(const FBXGeometry& geometry) jointIsSet.fill(false, numJoints); int numJointsSet = 0; int lastNumJointsSet = -1; + glm::mat4 baseTransform = glm::mat4_cast(_rotation) * glm::scale(_scale) * glm::translate(_offset); while (numJointsSet < numJoints && numJointsSet != lastNumJointsSet) { lastNumJointsSet = numJointsSet; for (int i = 0; i < numJoints; ++i) { @@ -138,7 +139,6 @@ QVector Model::createJointStates(const FBXGeometry& geometry) const FBXJoint& joint = geometry.joints[i]; int parentIndex = joint.parentIndex; if (parentIndex == -1) { - glm::mat4 baseTransform = glm::mat4_cast(_rotation) * glm::scale(_scale) * glm::translate(_offset); glm::quat combinedRotation = joint.preRotation * state.rotation * joint.postRotation; state.transform = baseTransform * geometry.offset * glm::translate(state.translation) * joint.preTransform * glm::mat4_cast(combinedRotation) * joint.postTransform;