This commit is contained in:
Andrew Meadows 2015-09-18 12:01:23 -07:00
parent 4cb2249cda
commit 07f3abfc91
3 changed files with 10 additions and 7 deletions

View file

@ -262,12 +262,10 @@ const AnimPoseVec& AnimInverseKinematics::evaluate(const AnimVariantMap& animVar
}
// only update the absolutePoses that need it: those between lowestMovedIndex and _maxTargetIndex
if (lowestMovedIndex < _maxTargetIndex) {
for (int i = lowestMovedIndex; i < _maxTargetIndex; ++i) {
int parentIndex = _skeleton->getParentIndex(i);
if (parentIndex != -1) {
absolutePoses[i] = absolutePoses[parentIndex] * _relativePoses[i];
}
for (int i = lowestMovedIndex; i <= _maxTargetIndex; ++i) {
int parentIndex = _skeleton->getParentIndex(i);
if (parentIndex != -1) {
absolutePoses[i] = absolutePoses[parentIndex] * _relativePoses[i];
}
}
} while (largestError > ACCEPTABLE_RELATIVE_ERROR && numLoops < MAX_IK_LOOPS && usecTimestampNow() < expiry);

View file

@ -20,3 +20,8 @@ void RotationAccumulator::add(glm::quat rotation) {
glm::quat RotationAccumulator::getAverage() {
return (_numRotations > 0) ? glm::normalize(_rotationSum) : glm::quat();
}
void RotationAccumulator::clear() {
_rotationSum *= 0.0f;
_numRotations = 0;
}

View file

@ -22,7 +22,7 @@ public:
glm::quat getAverage();
void clear() { _numRotations = 0; }
void clear();
private:
glm::quat _rotationSum;