History

move face/head code from Model into SkeletonModel

Andrew Meadows committed 12 years ago

Commit ae3b7921 parent 6efa4176 files · +76 −73Browse files

Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 6 files). Show all

Unified · Split

interface/src/avatar/SkeletonModel.cpp+44−1
@@ -198,10 +198,25 @@ void SkeletonModel::applyPalmData(int jointIndex, PalmData& palm) { · 197 unmodified lines
198}198}
199 199
200void SkeletonModel::updateJointState(int index) {200void SkeletonModel::updateJointState(int index) {
201 JointState& state = _jointStates[index];
202 const FBXGeometry& geometry = _geometry->getFBXGeometry();
203 const FBXJoint& joint = geometry.joints.at(index);
204 if (joint.parentIndex == -1) {
205 const JointState& parentState = _jointStates.at(joint.parentIndex);
206 if (index == geometry.leanJointIndex) {
207 maybeUpdateLeanRotation(parentState, joint, state);
208
209 } else if (index == geometry.neckJointIndex) {
210 maybeUpdateNeckRotation(parentState, joint, state);
211
212 } else if (index == geometry.leftEyeJointIndex || index == geometry.rightEyeJointIndex) {
213 maybeUpdateEyeRotation(parentState, joint, state);
214 }
215 }
216
201 Model::updateJointState(index);217 Model::updateJointState(index);
202 218
203 if (index == _geometry->getFBXGeometry().rootJointIndex) {219 if (index == _geometry->getFBXGeometry().rootJointIndex) {
204 JointState& state = _jointStates[index];
205 state.transform[3][0] = 0.0f;220 state.transform[3][0] = 0.0f;
206 state.transform[3][1] = 0.0f;221 state.transform[3][1] = 0.0f;
207 state.transform[3][2] = 0.0f;222 state.transform[3][2] = 0.0f;
@@ -388,3 +403,31 @@ float SkeletonModel::getRightArmLength() const { · 180 unmodified lines
388 return getLimbLength(getRightHandJointIndex());403 return getLimbLength(getRightHandJointIndex());
389}404}
390 405
406bool SkeletonModel::getHeadPosition(glm::vec3& headPosition) const {
407 return isActive() && getJointPosition(_geometry->getFBXGeometry().headJointIndex, headPosition);
408}
409
410bool SkeletonModel::getNeckPosition(glm::vec3& neckPosition) const {
411 return isActive() && getJointPosition(_geometry->getFBXGeometry().neckJointIndex, neckPosition);
412}
413
414bool SkeletonModel::getNeckParentRotation(glm::quat& neckParentRotation) const {
415 if (!isActive()) {
416 return false;
417 }
418 const FBXGeometry& geometry = _geometry->getFBXGeometry();
419 if (geometry.neckJointIndex == -1) {
420 return false;
421 }
422 return getJointRotation(geometry.joints.at(geometry.neckJointIndex).parentIndex, neckParentRotation);
423}
424
425bool SkeletonModel::getEyePositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const {
426 if (!isActive()) {
427 return false;
428 }
429 const FBXGeometry& geometry = _geometry->getFBXGeometry();
430 return getJointPosition(geometry.leftEyeJointIndex, firstEyePosition) &&
431 getJointPosition(geometry.rightEyeJointIndex, secondEyePosition);
432}
433

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t