optimize JointState::setRotationInConstrainedFrameInternal() to short cut cases where targetRotation matches previous targetRotation

This commit is contained in:
ZappoMan 2015-08-09 16:55:43 -07:00
parent 942958c4f1
commit 668778cfd9

View file

@ -244,11 +244,13 @@ void JointState::setRotationInConstrainedFrame(glm::quat targetRotation, float p
}
void JointState::setRotationInConstrainedFrameInternal(const glm::quat& targetRotation) {
glm::quat parentRotation = computeParentRotation();
_rotationInConstrainedFrame = targetRotation;
_transformChanged = true;
// R' = Rp * Rpre * r' * Rpost
_rotation = parentRotation * _fbxJoint->preRotation * _rotationInConstrainedFrame * _fbxJoint->postRotation;
if (_rotationInConstrainedFrame != targetRotation) {
glm::quat parentRotation = computeParentRotation();
_rotationInConstrainedFrame = targetRotation;
_transformChanged = true;
// R' = Rp * Rpre * r' * Rpost
_rotation = parentRotation * _fbxJoint->preRotation * _rotationInConstrainedFrame * _fbxJoint->postRotation;
}
}
void JointState::setVisibleRotationInConstrainedFrame(const glm::quat& targetRotation) {