| @@ -52,7 +52,6 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i · 51 unmodified lines |
| 52 | 52 | if (i < MAX_NUMBER_FLEX_VARIABLES) { |
| 53 | 53 | _tipTargetFlexCoefficients[i] = tipTargetFlexCoefficients[i]; |
| 54 | 54 | } |
| 55 | | − |
| 56 | 55 | } |
| 57 | 56 | _numTipTargetFlexCoefficients = std::min((int)tipTargetFlexCoefficients.size(), MAX_NUMBER_FLEX_VARIABLES); |
| 58 | 57 | |
| @@ -70,7 +69,6 @@ AnimSplineIK::~AnimSplineIK() { · 11 unmodified lines |
| 70 | 69 | } |
| 71 | 70 | |
| 72 | 71 | const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { |
| 73 | | − |
| 74 | 72 | assert(_children.size() == 1); |
| 75 | 73 | if (_children.size() != 1) { |
| 76 | 74 | return _poses; |
| @@ -135,8 +133,6 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const · 58 unmodified lines |
| 135 | 133 | _poses[_baseJointIndex] = baseParentAbsPose.inverse() * baseTargetAbsolutePose; |
| 136 | 134 | _poses[_baseJointIndex].scale() = glm::vec3(1.0f); |
| 137 | 135 | |
| 138 | | − |
| 139 | | − |
| 140 | 136 | // initialize the middle joint target |
| 141 | 137 | IKTarget midTarget; |
| 142 | 138 | midTarget.setType((int)IKTarget::Type::Spline); |
| @@ -167,7 +163,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const · 24 unmodified lines |
| 167 | 163 | tipTarget.setPose(tipRotation, tipTranslation); |
| 168 | 164 | tipTarget.setWeight(1.0f); |
| 169 | 165 | tipTarget.setFlexCoefficients(_numTipTargetFlexCoefficients, _tipTargetFlexCoefficients); |
| 170 | | − |
| 166 | + |
| 171 | 167 | // solve the upper spine spline |
| 172 | 168 | AnimChain upperJointChain; |
| 173 | 169 | AnimPoseVec finalAbsolutePoses; |
| @@ -241,7 +237,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const · 67 unmodified lines |
| 241 | 237 | |
| 242 | 238 | |
| 243 | 239 | } else if (context.getEnableDebugDrawIKTargets() != _previousEnableDebugIKTargets) { |
| 244 | | − |
| 240 | + |
| 245 | 241 | // remove markers if they were added last frame. |
| 246 | 242 | QString name = QString("ikTargetSplineTip"); |
| 247 | 243 | DebugDraw::getInstance().removeMyAvatarMarker(name); |
| @@ -374,9 +370,9 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, int base, c · 126 unmodified lines |
| 374 | 370 | } |
| 375 | 371 | } |
| 376 | 372 | ::blend(1, &absolutePoses[splineJointInfo.jointIndex], &desiredAbsPose, interpedCoefficient, &flexedAbsPose); |
| 377 | | − |
| 373 | + |
| 378 | 374 | AnimPose relPose = parentAbsPose.inverse() * flexedAbsPose; |
| 379 | | − |
| 375 | + |
| 380 | 376 | bool constrained = false; |
| 381 | 377 | if (splineJointInfo.jointIndex != base) { |
| 382 | 378 | // constrain the amount the spine can stretch or compress |
| @@ -398,7 +394,7 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, int base, c · 15 unmodified lines |
| 398 | 394 | relPose.trans() = glm::vec3(0.0f); |
| 399 | 395 | } |
| 400 | 396 | } |
| 401 | | − |
| 397 | + |
| 402 | 398 | if (!chainInfoOut.setRelativePoseAtJointIndex(splineJointInfo.jointIndex, relPose)) { |
| 403 | 399 | qCDebug(animation) << "error: joint not found in spline chain"; |
| 404 | 400 | } |