mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 06:13:09 +02:00
remove 'fromBind' argument to getJointRotation()
This commit is contained in:
parent
a62a270004
commit
9b3773fa3b
3 changed files with 14 additions and 14 deletions
|
@ -147,7 +147,7 @@ void SkeletonModel::applyHandPosition(int jointIndex, const glm::vec3& position)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JointState& state = _jointStates[jointIndex];
|
JointState& state = _jointStates[jointIndex];
|
||||||
glm::quat handRotation = state.getJointRotation(true);
|
glm::quat handRotation = state.getJointRotation();
|
||||||
|
|
||||||
// align hand with forearm
|
// align hand with forearm
|
||||||
float sign = (jointIndex == geometry.rightHandJointIndex) ? 1.0f : -1.0f;
|
float sign = (jointIndex == geometry.rightHandJointIndex) ? 1.0f : -1.0f;
|
||||||
|
@ -170,10 +170,10 @@ void SkeletonModel::applyPalmData(int jointIndex, PalmData& palm) {
|
||||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::AlternateIK) &&
|
if (!Menu::getInstance()->isOptionChecked(MenuOption::AlternateIK) &&
|
||||||
Menu::getInstance()->isOptionChecked(MenuOption::AlignForearmsWithWrists)) {
|
Menu::getInstance()->isOptionChecked(MenuOption::AlignForearmsWithWrists)) {
|
||||||
JointState parentState = _jointStates[parentJointIndex];
|
JointState parentState = _jointStates[parentJointIndex];
|
||||||
palmRotation = parentState.getJointRotation(true);
|
palmRotation = parentState.getJointRotation();
|
||||||
} else {
|
} else {
|
||||||
JointState state = _jointStates[jointIndex];
|
JointState state = _jointStates[jointIndex];
|
||||||
palmRotation = state.getJointRotation(true);
|
palmRotation = state.getJointRotation();
|
||||||
}
|
}
|
||||||
palmRotation = rotationBetween(palmRotation * geometry.palmDirection, palm.getNormal()) * palmRotation;
|
palmRotation = rotationBetween(palmRotation * geometry.palmDirection, palm.getNormal()) * palmRotation;
|
||||||
|
|
||||||
|
|
|
@ -756,11 +756,11 @@ bool Model::getJointPosition(int jointIndex, glm::vec3& position) const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::getJointRotationInWorldFrame(int jointIndex, glm::quat& rotation, bool fromBind) const {
|
bool Model::getJointRotationInWorldFrame(int jointIndex, glm::quat& rotation) const {
|
||||||
if (jointIndex == -1 || jointIndex >= _jointStates.size()) {
|
if (jointIndex == -1 || jointIndex >= _jointStates.size()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
rotation = _jointStates[jointIndex].getJointRotation(fromBind);
|
rotation = _jointStates[jointIndex].getJointRotation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ bool Model::getJointCombinedRotation(int jointIndex, glm::quat& rotation) const
|
||||||
if (jointIndex == -1 || jointIndex >= _jointStates.size()) {
|
if (jointIndex == -1 || jointIndex >= _jointStates.size()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
rotation = _jointStates[jointIndex].getRotationInWorldFrame();
|
rotation = _jointStates[jointIndex].getRotationInWorldFrame(_rotation);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1306,9 +1306,9 @@ bool Model::setJointPosition(int jointIndex, const glm::vec3& translation, const
|
||||||
JointState& state = _jointStates[jointIndex];
|
JointState& state = _jointStates[jointIndex];
|
||||||
|
|
||||||
// TODO: figure out what this is trying to do and combine it into one JointState method
|
// TODO: figure out what this is trying to do and combine it into one JointState method
|
||||||
endRotation = state.getJointRotation(true);
|
endRotation = state.getJointRotation();
|
||||||
state.applyRotationDelta(rotation * glm::inverse(endRotation), true, priority);
|
state.applyRotationDelta(rotation * glm::inverse(endRotation), true, priority);
|
||||||
endRotation = state.getJointRotation(true);
|
endRotation = state.getJointRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -2067,10 +2067,10 @@ void JointState::computeTransforms(const glm::mat4& parentTransform, const glm::
|
||||||
_combinedRotation = baseRotation * modifiedRotation;
|
_combinedRotation = baseRotation * modifiedRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat JointState::getJointRotation(bool fromBind) const {
|
glm::quat JointState::getJointRotation() const {
|
||||||
assert(_fbxJoint != NULL);
|
assert(_fbxJoint != NULL);
|
||||||
return _combinedRotation * (fromBind ? _fbxJoint->inverseBindRotation : _fbxJoint->inverseDefaultRotation);
|
return _combinedRotation * _fbxJoint->inverseBindRotation;
|
||||||
//return _rotationInModelFrame * (fromBind ? _fbxJoint->inverseBindRotation : _fbxJoint->inverseDefaultRotation);
|
//return _rotationInModelFrame * _fbxJoint->inverseBindRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JointState::restoreRotation(float fraction, float priority) {
|
void JointState::restoreRotation(float fraction, float priority) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
void computeTransforms(const glm::mat4& baseTransform, const glm::quat& baseRotation);
|
void computeTransforms(const glm::mat4& baseTransform, const glm::quat& baseRotation);
|
||||||
|
|
||||||
/// \return rotation from the joint's default (or bind) frame to world frame
|
/// \return rotation from the joint's default (or bind) frame to world frame
|
||||||
glm::quat getJointRotation(bool fromBind = false) const;
|
glm::quat getJointRotation() const;
|
||||||
|
|
||||||
void applyRotationDelta(const glm::quat& delta, bool constrain = true, float priority = 1.0f);
|
void applyRotationDelta(const glm::quat& delta, bool constrain = true, float priority = 1.0f);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
void setRotation(const glm::quat& rotation, float priority);
|
void setRotation(const glm::quat& rotation, float priority);
|
||||||
|
|
||||||
const glm::mat4& getHybridTransform() const { return _transform; }
|
const glm::mat4& getHybridTransform() const { return _transform; }
|
||||||
const glm::quat& getRotationInWorldFrame() const { return _combinedRotation; }
|
//const glm::quat& getRotationInWorldFrame() const { return _combinedRotation; }
|
||||||
void clearTransformTranslation();
|
void clearTransformTranslation();
|
||||||
|
|
||||||
glm::quat _rotation; // rotation relative to parent
|
glm::quat _rotation; // rotation relative to parent
|
||||||
|
@ -173,7 +173,7 @@ public:
|
||||||
int getLastFreeJointIndex(int jointIndex) const;
|
int getLastFreeJointIndex(int jointIndex) const;
|
||||||
|
|
||||||
bool getJointPosition(int jointIndex, glm::vec3& position) const;
|
bool getJointPosition(int jointIndex, glm::vec3& position) const;
|
||||||
bool getJointRotationInWorldFrame(int jointIndex, glm::quat& rotation, bool fromBind = false) const;
|
bool getJointRotationInWorldFrame(int jointIndex, glm::quat& rotation) const;
|
||||||
bool getJointCombinedRotation(int jointIndex, glm::quat& rotation) const;
|
bool getJointCombinedRotation(int jointIndex, glm::quat& rotation) const;
|
||||||
|
|
||||||
QStringList getJointNames() const;
|
QStringList getJointNames() const;
|
||||||
|
|
Loading…
Reference in a new issue