fix for no neck motion

FaceModel needs similar override to updateJointState() as SkeletonModel
This commit is contained in:
Andrew Meadows 2014-05-28 10:43:21 -07:00
parent bf4b0707c0
commit 676a8882fe
2 changed files with 19 additions and 1 deletions

View file

@ -70,6 +70,23 @@ void FaceModel::maybeUpdateEyeRotation(const JointState& parentState, const FBXJ
joint.rotation;
}
void FaceModel::updateJointState(int index) {
JointState& state = _jointStates[index];
const FBXGeometry& geometry = _geometry->getFBXGeometry();
const FBXJoint& joint = geometry.joints.at(index);
if (joint.parentIndex != -1) {
const JointState& parentState = _jointStates.at(joint.parentIndex);
if (index == geometry.neckJointIndex) {
maybeUpdateNeckRotation(parentState, joint, state);
} else if (index == geometry.leftEyeJointIndex || index == geometry.rightEyeJointIndex) {
maybeUpdateEyeRotation(parentState, joint, state);
}
}
Model::updateJointState(index);
}
bool FaceModel::getEyePositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const {
if (!isActive()) {
return false;

View file

@ -28,7 +28,8 @@ public:
virtual void maybeUpdateNeckRotation(const JointState& parentState, const FBXJoint& joint, JointState& state);
virtual void maybeUpdateEyeRotation(const JointState& parentState, const FBXJoint& joint, JointState& state);
virtual void updateJointState(int index);
/// Retrieve the positions of up to two eye meshes.
/// \return whether or not both eye meshes were found
bool getEyePositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const;