History

remove extraneous roots from Model::_jointStates

Andrew Meadows committed 12 years ago

Commit 9a552521 parent bb332662 files · +45 −19Browse files

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

Unified · Split

interface/src/avatar/SkeletonModel.cpp+11−13
@@ -515,9 +515,9 @@ void SkeletonModel::initRagdollPoints() { · 514 unmodified lines
515 515
516 initRagdollTransform();516 initRagdollTransform();
517 // one point for each joint517 // one point for each joint
518 int numJoints = _jointStates.size();518 int numStates = _jointStates.size();
519 _ragdollPoints.fill(VerletPoint(), numJoints);519 _ragdollPoints.fill(VerletPoint(), numStates);
520 for (int i = 0; i < numJoints; ++i) {520 for (int i = 0; i < numStates; ++i) {
521 const JointState& state = _jointStates.at(i);521 const JointState& state = _jointStates.at(i);
522 // _ragdollPoints start in model-frame522 // _ragdollPoints start in model-frame
523 _ragdollPoints[i].initPosition(state.getPosition());523 _ragdollPoints[i].initPosition(state.getPosition());
@@ -719,8 +719,8 @@ void SkeletonModel::buildShapes() { · 195 unmodified lines
719 719
720 // ... then move shapes back to current joint positions720 // ... then move shapes back to current joint positions
721 if (_ragdollPoints.size() == numStates) {721 if (_ragdollPoints.size() == numStates) {
722 int numJoints = _jointStates.size();722 int numStates = _jointStates.size();
723 for (int i = 0; i < numJoints; ++i) {723 for (int i = 0; i < numStates; ++i) {
724 // ragdollPoints start in model-frame724 // ragdollPoints start in model-frame
725 _ragdollPoints[i].initPosition(_jointStates.at(i).getPosition());725 _ragdollPoints[i].initPosition(_jointStates.at(i).getPosition());
726 }726 }
@@ -765,17 +765,15 @@ void SkeletonModel::updateMuscles() { · 38 unmodified lines
765 765
766void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) {766void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) {
767 // compute default joint transforms767 // compute default joint transforms
768 int numJoints = geometry.joints.size();768 int numStates = _jointStates.size();
769 if (numJoints != _ragdollPoints.size()) {
770 return;
771 }
772 QVector<glm::mat4> transforms;769 QVector<glm::mat4> transforms;
773 transforms.fill(glm::mat4(), numJoints);770 transforms.fill(glm::mat4(), numStates);
774 771
775 // compute the default transforms and slam the ragdoll positions accordingly772 // compute the default transforms and slam the ragdoll positions accordingly
776 // (which puts the shapes where we want them)773 // (which puts the shapes where we want them)
777 for (int i = 0; i < numJoints; i++) {774 for (int i = 0; i < numStates; i++) {
778 const FBXJoint& joint = geometry.joints.at(i);775 JointState& state = _jointStates[i];
776 const FBXJoint& joint = state.getFBXJoint();
779 int parentIndex = joint.parentIndex;777 int parentIndex = joint.parentIndex;
780 if (parentIndex == -1) {778 if (parentIndex == -1) {
781 transforms[i] = _jointStates[i].getTransform();779 transforms[i] = _jointStates[i].getTransform();
@@ -847,7 +845,7 @@ void SkeletonModel::resetShapePositionsToDefaultPose() { · 65 unmodified lines
847 }845 }
848 846
849 const FBXGeometry& geometry = _geometry->getFBXGeometry();847 const FBXGeometry& geometry = _geometry->getFBXGeometry();
850 if (geometry.joints.isEmpty() || _shapes.size() != geometry.joints.size()) {848 if (geometry.joints.isEmpty()) {
851 return;849 return;
852 }850 }
853 851

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