mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 18:15:13 +02:00
namechange FromBindFrame ==> InBindFrame
This commit is contained in:
parent
00544aa975
commit
b8fb5e0298
4 changed files with 12 additions and 12 deletions
|
@ -69,7 +69,7 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
||||||
int jointIndex = geometry.humanIKJointIndices.at(humanIKJointIndex);
|
int jointIndex = geometry.humanIKJointIndices.at(humanIKJointIndex);
|
||||||
if (jointIndex != -1) {
|
if (jointIndex != -1) {
|
||||||
JointState& state = _jointStates[jointIndex];
|
JointState& state = _jointStates[jointIndex];
|
||||||
state.setRotationFromBindFrame(prioVR->getJointRotations().at(i), PALM_PRIORITY);
|
state.setRotationInBindFrame(prioVR->getJointRotations().at(i), PALM_PRIORITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -217,7 +217,7 @@ void SkeletonModel::applyPalmData(int jointIndex, PalmData& palm) {
|
||||||
setJointPosition(parentJointIndex, palmPosition + forearm,
|
setJointPosition(parentJointIndex, palmPosition + forearm,
|
||||||
glm::quat(), false, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
|
glm::quat(), false, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
|
||||||
JointState& parentState = _jointStates[parentJointIndex];
|
JointState& parentState = _jointStates[parentJointIndex];
|
||||||
parentState.setRotationFromBindFrame(palmRotation, PALM_PRIORITY);
|
parentState.setRotationInBindFrame(palmRotation, PALM_PRIORITY);
|
||||||
// lock hand to forearm by slamming its rotation (in parent-frame) to identity
|
// lock hand to forearm by slamming its rotation (in parent-frame) to identity
|
||||||
_jointStates[jointIndex].setRotationInConstrainedFrame(glm::quat());
|
_jointStates[jointIndex].setRotationInConstrainedFrame(glm::quat());
|
||||||
} else {
|
} else {
|
||||||
|
@ -381,13 +381,13 @@ void SkeletonModel::setHandPosition(int jointIndex, const glm::vec3& position, c
|
||||||
glm::quat shoulderRotation = rotationBetween(forwardVector, elbowPosition - shoulderPosition);
|
glm::quat shoulderRotation = rotationBetween(forwardVector, elbowPosition - shoulderPosition);
|
||||||
|
|
||||||
JointState& shoulderState = _jointStates[shoulderJointIndex];
|
JointState& shoulderState = _jointStates[shoulderJointIndex];
|
||||||
shoulderState.setRotationFromBindFrame(shoulderRotation, PALM_PRIORITY);
|
shoulderState.setRotationInBindFrame(shoulderRotation, PALM_PRIORITY);
|
||||||
|
|
||||||
JointState& elbowState = _jointStates[elbowJointIndex];
|
JointState& elbowState = _jointStates[elbowJointIndex];
|
||||||
elbowState.setRotationFromBindFrame(rotationBetween(shoulderRotation * forwardVector, wristPosition - elbowPosition) * shoulderRotation, PALM_PRIORITY);
|
elbowState.setRotationInBindFrame(rotationBetween(shoulderRotation * forwardVector, wristPosition - elbowPosition) * shoulderRotation, PALM_PRIORITY);
|
||||||
|
|
||||||
JointState& handState = _jointStates[jointIndex];
|
JointState& handState = _jointStates[jointIndex];
|
||||||
handState.setRotationFromBindFrame(rotation, PALM_PRIORITY);
|
handState.setRotationInBindFrame(rotation, PALM_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonModel::getLeftHandPosition(glm::vec3& position) const {
|
bool SkeletonModel::getLeftHandPosition(glm::vec3& position) const {
|
||||||
|
|
|
@ -95,7 +95,7 @@ void JointState::computeVisibleTransform(const glm::mat4& parentTransform) {
|
||||||
_visibleRotation = extractRotation(_visibleTransform);
|
_visibleRotation = extractRotation(_visibleTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat JointState::getRotationFromBindToModelFrame() const {
|
glm::quat JointState::getRotationInBindFrame() const {
|
||||||
return _rotation * _fbxJoint->inverseBindRotation;
|
return _rotation * _fbxJoint->inverseBindRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void JointState::restoreRotation(float fraction, float priority) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JointState::setRotationFromBindFrame(const glm::quat& rotation, float priority, bool constrain) {
|
void JointState::setRotationInBindFrame(const glm::quat& rotation, float priority, bool constrain) {
|
||||||
// rotation is from bind- to model-frame
|
// rotation is from bind- to model-frame
|
||||||
assert(_fbxJoint != NULL);
|
assert(_fbxJoint != NULL);
|
||||||
if (priority >= _animationPriority) {
|
if (priority >= _animationPriority) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
glm::vec3 getPosition() const { return extractTranslation(_transform); }
|
glm::vec3 getPosition() const { return extractTranslation(_transform); }
|
||||||
|
|
||||||
/// \return rotation from bind to model frame
|
/// \return rotation from bind to model frame
|
||||||
glm::quat getRotationFromBindToModelFrame() const;
|
glm::quat getRotationInBindFrame() const;
|
||||||
|
|
||||||
int getParentIndex() const { return _fbxJoint->parentIndex; }
|
int getParentIndex() const { return _fbxJoint->parentIndex; }
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public:
|
||||||
/// \param rotation is from bind- to model-frame
|
/// \param rotation is from bind- to model-frame
|
||||||
/// computes and sets new _rotationInConstrainedFrame
|
/// computes and sets new _rotationInConstrainedFrame
|
||||||
/// NOTE: the JointState's model-frame transform/rotation are NOT updated!
|
/// NOTE: the JointState's model-frame transform/rotation are NOT updated!
|
||||||
void setRotationFromBindFrame(const glm::quat& rotation, float priority, bool constrain = false);
|
void setRotationInBindFrame(const glm::quat& rotation, float priority, bool constrain = false);
|
||||||
|
|
||||||
void setRotationInConstrainedFrame(const glm::quat& targetRotation);
|
void setRotationInConstrainedFrame(const glm::quat& targetRotation);
|
||||||
void setVisibleRotationInConstrainedFrame(const glm::quat& targetRotation);
|
void setVisibleRotationInConstrainedFrame(const glm::quat& targetRotation);
|
||||||
|
|
|
@ -1041,8 +1041,8 @@ bool Model::setJointPosition(int jointIndex, const glm::vec3& position, const gl
|
||||||
if (useRotation) {
|
if (useRotation) {
|
||||||
JointState& state = _jointStates[jointIndex];
|
JointState& state = _jointStates[jointIndex];
|
||||||
|
|
||||||
state.setRotationFromBindFrame(rotation, priority);
|
state.setRotationInBindFrame(rotation, priority);
|
||||||
endRotation = state.getRotationFromBindToModelFrame();
|
endRotation = state.getRotationInBindFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
// then, we go from the joint upwards, rotating the end as close as possible to the target
|
// then, we go from the joint upwards, rotating the end as close as possible to the target
|
||||||
|
@ -1213,7 +1213,7 @@ void Model::inverseKinematics(int endIndex, glm::vec3 targetPosition, const glm:
|
||||||
} while (numIterations < MAX_ITERATION_COUNT && distanceToGo < ACCEPTABLE_IK_ERROR);
|
} while (numIterations < MAX_ITERATION_COUNT && distanceToGo < ACCEPTABLE_IK_ERROR);
|
||||||
|
|
||||||
// set final rotation of the end joint
|
// set final rotation of the end joint
|
||||||
endState.setRotationFromBindFrame(targetRotation, priority, true);
|
endState.setRotationInBindFrame(targetRotation, priority, true);
|
||||||
|
|
||||||
_shapesAreDirty = !_shapes.isEmpty();
|
_shapesAreDirty = !_shapes.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue