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
198198 }
199199
200200 void 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+
201217 Model::updateJointState(index);
202218
203219 if (index == _geometry->getFBXGeometry().rootJointIndex) {
204− JointState& state = _jointStates[index];
205220 state.transform[3][0] = 0.0f;
206221 state.transform[3][1] = 0.0f;
207222 state.transform[3][2] = 0.0f;
@@ -388,3 +403,31 @@ float SkeletonModel::getRightArmLength() const { · 180 unmodified lines
388403 return getLimbLength(getRightHandJointIndex());
389404 }
390405
406+bool SkeletonModel::getHeadPosition(glm::vec3& headPosition) const {
407+ return isActive() && getJointPosition(_geometry->getFBXGeometry().headJointIndex, headPosition);
408+}
409+
410+bool SkeletonModel::getNeckPosition(glm::vec3& neckPosition) const {
411+ return isActive() && getJointPosition(_geometry->getFBXGeometry().neckJointIndex, neckPosition);
412+}
413+
414+bool 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+
425+bool 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