From 4a3fbfcdeec04379f133f4136d3b6138311d65d0 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 4 Jun 2014 13:34:58 -0700 Subject: [PATCH] getRotationInModelFrame -> getRotation --- interface/src/avatar/SkeletonModel.cpp | 6 +++--- interface/src/renderer/Model.cpp | 14 +++++++------- interface/src/renderer/Model.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index e689deb0a8..c2e4c47a3f 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -148,7 +148,7 @@ void SkeletonModel::applyHandPositionInModelFrame(int jointIndex, const glm::vec return; } JointState& state = _jointStates[jointIndex]; - glm::quat handRotation = state.getRotationInModelFrame(); + glm::quat handRotation = state.getRotation(); // align hand with forearm float sign = (jointIndex == geometry.rightHandJointIndex) ? 1.0f : -1.0f; @@ -267,7 +267,7 @@ void SkeletonModel::renderJointConstraints(int jointIndex) { glPushMatrix(); glTranslatef(position.x, position.y, position.z); - glm::quat parentRotation = (joint.parentIndex == -1) ? _rotation : _rotation * _jointStates.at(joint.parentIndex).getRotationInModelFrame(); + glm::quat parentRotation = (joint.parentIndex == -1) ? _rotation : _rotation * _jointStates.at(joint.parentIndex).getRotation(); glm::vec3 rotationAxis = glm::axis(parentRotation); glRotatef(glm::degrees(glm::angle(parentRotation)), rotationAxis.x, rotationAxis.y, rotationAxis.z); float fanScale = directionSize * 0.75f; @@ -300,7 +300,7 @@ void SkeletonModel::renderJointConstraints(int jointIndex) { } glPopMatrix(); - renderOrientationDirections(position, _rotation * jointState.getRotationInModelFrame(), directionSize); + renderOrientationDirections(position, _rotation * jointState.getRotation(), directionSize); jointIndex = joint.parentIndex; } while (jointIndex != -1 && geometry.joints.at(jointIndex).isFree); diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index 8206129c5b..305ad6753e 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -734,7 +734,7 @@ bool Model::getJointRotationInWorldFrame(int jointIndex, glm::quat& rotation) co if (jointIndex == -1 || jointIndex >= _jointStates.size()) { return false; } - rotation = _rotation * _jointStates[jointIndex].getRotationInModelFrame(); + rotation = _rotation * _jointStates[jointIndex].getRotation(); return true; } @@ -742,7 +742,7 @@ bool Model::getJointCombinedRotation(int jointIndex, glm::quat& rotation) const if (jointIndex == -1 || jointIndex >= _jointStates.size()) { return false; } - rotation = _rotation * _jointStates[jointIndex].getRotationInModelFrame(); + rotation = _rotation * _jointStates[jointIndex].getRotation(); return true; } @@ -958,7 +958,7 @@ void Model::updateShapePositions() { const JointState& state = _jointStates[i]; const FBXJoint& joint = state.getFBXJoint(); // shape position and rotation need to be in world-frame - glm::quat stateRotation = state.getRotationInModelFrame(); + glm::quat stateRotation = state.getRotation(); glm::vec3 shapeOffset = uniformScale * (stateRotation * joint.shapePosition); glm::vec3 worldPosition = _translation + _rotation * (state.getPositionInModelFrame() + shapeOffset); Shape* shape = _jointShapes[i]; @@ -1269,9 +1269,9 @@ bool Model::setJointPositionInModelFrame(int jointIndex, const glm::vec3& positi JointState& state = _jointStates[jointIndex]; // TODO: figure out what this is trying to do and combine it into one JointState method - endRotation = state.getRotationInModelFrame(); + endRotation = state.getRotation(); state.applyRotationDeltaInModelFrame(rotation * glm::inverse(endRotation), true, priority); - endRotation = state.getRotationInModelFrame(); + endRotation = state.getRotation(); } // then, we go from the joint upwards, rotating the end as close as possible to the target @@ -1285,7 +1285,7 @@ bool Model::setJointPositionInModelFrame(int jointIndex, const glm::vec3& positi } glm::vec3 jointPosition = extractTranslation(state.getTransform()); glm::vec3 jointVector = endPosition - jointPosition; - glm::quat oldCombinedRotation = state.getRotationInModelFrame(); + glm::quat oldCombinedRotation = state.getRotation(); glm::quat combinedDelta; float combinedWeight; if (useRotation) { @@ -1315,7 +1315,7 @@ bool Model::setJointPositionInModelFrame(int jointIndex, const glm::vec3& positi } } state.applyRotationDeltaInModelFrame(combinedDelta, true, priority); - glm::quat actualDelta = state.getRotationInModelFrame() * glm::inverse(oldCombinedRotation); + glm::quat actualDelta = state.getRotation() * glm::inverse(oldCombinedRotation); endPosition = actualDelta * jointVector + jointPosition; if (useRotation) { endRotation = actualDelta * endRotation; diff --git a/interface/src/renderer/Model.h b/interface/src/renderer/Model.h index 2dabd208af..23d40bb29e 100644 --- a/interface/src/renderer/Model.h +++ b/interface/src/renderer/Model.h @@ -43,7 +43,7 @@ public: void computeTransform(const glm::mat4& parentTransform); const glm::mat4& getTransform() const { return _transform; } - glm::quat getRotationInModelFrame() const { return _rotation; } + glm::quat getRotation() const { return _rotation; } glm::vec3 getPositionInModelFrame() const { return extractTranslation(_transform); } /// \return rotation from bind to model frame