mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-08 22:37:11 +02:00
remove JointState::getRota/PositionInWorldFrame()
instead: use getRotat/PositionInModelFrame() and do math
This commit is contained in:
parent
729c01ddbf
commit
5d8e3d447a
2 changed files with 3 additions and 14 deletions
|
@ -775,7 +775,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);
|
rotation = _rotation * _jointStates[jointIndex].getRotationInModelFrame();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,12 +1018,12 @@ bool Model::findRayIntersection(const glm::vec3& origin, const glm::vec3& direct
|
||||||
float radiusScale = extractUniformScale(_scale);
|
float radiusScale = extractUniformScale(_scale);
|
||||||
for (int i = 0; i < _jointStates.size(); i++) {
|
for (int i = 0; i < _jointStates.size(); i++) {
|
||||||
const FBXJoint& joint = geometry.joints[i];
|
const FBXJoint& joint = geometry.joints[i];
|
||||||
glm::vec3 end = _jointStates[i].getPositionInWorldFrame(_rotation, _translation);
|
glm::vec3 end = _translation + _rotation * _jointStates[i].getPositionInModelFrame();
|
||||||
float endRadius = joint.boneRadius * radiusScale;
|
float endRadius = joint.boneRadius * radiusScale;
|
||||||
glm::vec3 start = end;
|
glm::vec3 start = end;
|
||||||
float startRadius = joint.boneRadius * radiusScale;
|
float startRadius = joint.boneRadius * radiusScale;
|
||||||
if (joint.parentIndex != -1) {
|
if (joint.parentIndex != -1) {
|
||||||
start = _jointStates[joint.parentIndex].getPositionInWorldFrame(_rotation, _translation);
|
start = _translation + _rotation * _jointStates[joint.parentIndex].getPositionInModelFrame();
|
||||||
startRadius = geometry.joints[joint.parentIndex].boneRadius * radiusScale;
|
startRadius = geometry.joints[joint.parentIndex].boneRadius * radiusScale;
|
||||||
}
|
}
|
||||||
// for now, use average of start and end radii
|
// for now, use average of start and end radii
|
||||||
|
@ -2053,14 +2053,6 @@ void JointState::computeTransformInModelFrame(const glm::mat4& parentTransform)
|
||||||
_rotationInModelFrame = extractRotation(_transformInModelFrame);
|
_rotationInModelFrame = extractRotation(_transformInModelFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat JointState::getRotationInWorldFrame(const glm::quat& baseRotation) const {
|
|
||||||
return baseRotation * _rotationInModelFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec3 JointState::getPositionInWorldFrame(const glm::quat& baseRotation, const glm::vec3& basePosition) const {
|
|
||||||
return basePosition + baseRotation * extractTranslation(_transformInModelFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JointState::computeTransforms(const glm::mat4& parentTransform, const glm::quat& baseRotation) {
|
void JointState::computeTransforms(const glm::mat4& parentTransform, const glm::quat& baseRotation) {
|
||||||
assert(_fbxJoint != NULL);
|
assert(_fbxJoint != NULL);
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,6 @@ public:
|
||||||
glm::quat getRotationInModelFrame() const { return _rotationInModelFrame; }
|
glm::quat getRotationInModelFrame() const { return _rotationInModelFrame; }
|
||||||
glm::vec3 getPositionInModelFrame() const { return extractTranslation(_transformInModelFrame); }
|
glm::vec3 getPositionInModelFrame() const { return extractTranslation(_transformInModelFrame); }
|
||||||
|
|
||||||
glm::quat getRotationInWorldFrame(const glm::quat& baseRotation) const;
|
|
||||||
glm::vec3 getPositionInWorldFrame(const glm::quat& baseRotation, const glm::vec3& basePosition) const;
|
|
||||||
|
|
||||||
/// computes new _transform and _combinedRotation
|
/// computes new _transform and _combinedRotation
|
||||||
void computeTransforms(const glm::mat4& baseTransform, const glm::quat& baseRotation);
|
void computeTransforms(const glm::mat4& baseTransform, const glm::quat& baseRotation);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue