mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 05:33:10 +02:00
add getRotationInParentFrame()
This commit is contained in:
parent
b8fb5e0298
commit
ecc83e9559
2 changed files with 17 additions and 6 deletions
|
@ -82,16 +82,16 @@ void JointState::initTransform(const glm::mat4& parentTransform) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void JointState::computeTransform(const glm::mat4& parentTransform) {
|
void JointState::computeTransform(const glm::mat4& parentTransform) {
|
||||||
glm::quat rotationInConstrainedFrame = _fbxJoint->preRotation * _rotationInConstrainedFrame * _fbxJoint->postRotation;
|
glm::quat rotationInParentFrame = _fbxJoint->preRotation * _rotationInConstrainedFrame * _fbxJoint->postRotation;
|
||||||
glm::mat4 rotationInParentFrame = _fbxJoint->preTransform * glm::mat4_cast(rotationInConstrainedFrame) * _fbxJoint->postTransform;
|
glm::mat4 transformInParentFrame = _fbxJoint->preTransform * glm::mat4_cast(rotationInParentFrame) * _fbxJoint->postTransform;
|
||||||
_transform = parentTransform * glm::translate(_fbxJoint->translation) * rotationInParentFrame;
|
_transform = parentTransform * glm::translate(_fbxJoint->translation) * transformInParentFrame;
|
||||||
_rotation = extractRotation(_transform);
|
_rotation = extractRotation(_transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JointState::computeVisibleTransform(const glm::mat4& parentTransform) {
|
void JointState::computeVisibleTransform(const glm::mat4& parentTransform) {
|
||||||
glm::quat rotationInConstrainedFrame = _fbxJoint->preRotation * _visibleRotationInConstrainedFrame * _fbxJoint->postRotation;
|
glm::quat rotationInParentFrame = _fbxJoint->preRotation * _visibleRotationInConstrainedFrame * _fbxJoint->postRotation;
|
||||||
glm::mat4 rotationInParentFrame = _fbxJoint->preTransform * glm::mat4_cast(rotationInConstrainedFrame) * _fbxJoint->postTransform;
|
glm::mat4 transformInParentFrame = _fbxJoint->preTransform * glm::mat4_cast(rotationInParentFrame) * _fbxJoint->postTransform;
|
||||||
_visibleTransform = parentTransform * glm::translate(_fbxJoint->translation) * rotationInParentFrame;
|
_visibleTransform = parentTransform * glm::translate(_fbxJoint->translation) * transformInParentFrame;
|
||||||
_visibleRotation = extractRotation(_visibleTransform);
|
_visibleRotation = extractRotation(_visibleTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +99,14 @@ glm::quat JointState::getRotationInBindFrame() const {
|
||||||
return _rotation * _fbxJoint->inverseBindRotation;
|
return _rotation * _fbxJoint->inverseBindRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::quat JointState::getRotationInParentFrame() const {
|
||||||
|
return _fbxJoint->preRotation * _rotationInConstrainedFrame * _fbxJoint->postRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::quat JointState::getVisibleRotationInParentFrame() const {
|
||||||
|
return _fbxJoint->preRotation * _visibleRotationInConstrainedFrame * _fbxJoint->postRotation;
|
||||||
|
}
|
||||||
|
|
||||||
void JointState::restoreRotation(float fraction, float priority) {
|
void JointState::restoreRotation(float fraction, float priority) {
|
||||||
assert(_fbxJoint != NULL);
|
assert(_fbxJoint != NULL);
|
||||||
if (priority == _animationPriority || _animationPriority == 0.0f) {
|
if (priority == _animationPriority || _animationPriority == 0.0f) {
|
||||||
|
|
|
@ -48,6 +48,9 @@ public:
|
||||||
/// \return rotation from bind to model frame
|
/// \return rotation from bind to model frame
|
||||||
glm::quat getRotationInBindFrame() const;
|
glm::quat getRotationInBindFrame() const;
|
||||||
|
|
||||||
|
glm::quat getRotationInParentFrame() const;
|
||||||
|
glm::quat getVisibleRotationInParentFrame() const;
|
||||||
|
|
||||||
int getParentIndex() const { return _fbxJoint->parentIndex; }
|
int getParentIndex() const { return _fbxJoint->parentIndex; }
|
||||||
|
|
||||||
/// \param rotation rotation of joint in model-frame
|
/// \param rotation rotation of joint in model-frame
|
||||||
|
|
Loading…
Reference in a new issue