setJointPositionInModelFrame -> setJointPosition

This commit is contained in:
Andrew Meadows 2014-06-04 13:56:37 -07:00
parent 3af4b1b333
commit ccfd620c84
3 changed files with 14 additions and 6 deletions

View file

@ -136,7 +136,7 @@ void SkeletonModel::applyHandPositionInModelFrame(int jointIndex, const glm::vec
if (jointIndex == -1 || jointIndex >= _jointStates.size()) {
return;
}
setJointPositionInModelFrame(jointIndex, position, glm::quat(), false, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
setJointPosition(jointIndex, position, glm::quat(), false, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
const FBXGeometry& geometry = _geometry->getFBXGeometry();
glm::vec3 handPosition, elbowPosition;
@ -194,7 +194,7 @@ void SkeletonModel::applyPalmDataInModelFrame(int jointIndex, PalmData& palm) {
} else if (Menu::getInstance()->isOptionChecked(MenuOption::AlignForearmsWithWrists)) {
glm::vec3 forearmVector = palmRotation * glm::vec3(sign, 0.0f, 0.0f);
setJointPositionInModelFrame(parentJointIndex, palmPosition + forearmVector *
setJointPosition(parentJointIndex, palmPosition + forearmVector *
geometry.joints.at(jointIndex).distanceToParent * extractUniformScale(_scale),
glm::quat(), false, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
JointState& parentState = _jointStates[parentJointIndex];
@ -202,7 +202,7 @@ void SkeletonModel::applyPalmDataInModelFrame(int jointIndex, PalmData& palm) {
// lock hand to forearm by slamming its rotation (in parent-frame) to identity
_jointStates[jointIndex]._rotationInParentFrame = glm::quat();
} else {
setJointPositionInModelFrame(jointIndex, palmPosition, palmRotation,
setJointPosition(jointIndex, palmPosition, palmRotation,
true, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
}
}

View file

@ -1246,7 +1246,7 @@ void Model::updateJointState(int index) {
}
}
bool Model::setJointPositionInModelFrame(int jointIndex, const glm::vec3& position, const glm::quat& rotation, bool useRotation,
bool Model::setJointPosition(int jointIndex, const glm::vec3& position, const glm::quat& rotation, bool useRotation,
int lastFreeIndex, bool allIntermediatesFree, const glm::vec3& alignment, float priority) {
if (jointIndex == -1 || _jointStates.isEmpty()) {
return false;
@ -1486,7 +1486,7 @@ void Model::applyCollision(CollisionInfo& collision) {
// transform into model-frame
glm::vec3 newEnd = glm::inverse(_rotation) * (start + glm::angleAxis(angle, axis) * (end - start) - _translation);
// try to move it
setJointPositionInModelFrame(jointIndex, newEnd, glm::quat(), false, -1, true);
setJointPosition(jointIndex, newEnd, glm::quat(), false, -1, true);
}
}
}

View file

@ -257,7 +257,15 @@ protected:
/// Updates the state of the joint at the specified index.
virtual void updateJointState(int index);
bool setJointPositionInModelFrame(int jointIndex, const glm::vec3& translation, const glm::quat& rotation = glm::quat(),
/// \param jointIndex index of joint in model structure
/// \param position position of joint in model-frame
/// \param rotation rotation of joint in model-frame
/// \param useRotation false if rotation should be ignored
/// \param lastFreeIndex
/// \param allIntermediatesFree
/// \param alignment
/// \return true if joint exists
bool setJointPosition(int jointIndex, const glm::vec3& position, const glm::quat& rotation = glm::quat(),
bool useRotation = false, int lastFreeIndex = -1, bool allIntermediatesFree = false,
const glm::vec3& alignment = glm::vec3(0.0f, -1.0f, 0.0f), float priority = 1.0f);