| 320 | } |
| 321 | |
| 322 | void TSShapeInstance::handleTransitionNodes(S32 a, S32 b) |
| 323 | { |
| 324 | TSIntegerSet transitionNodes; |
| 325 | updateTransitionNodeTransforms(transitionNodes); |
| 326 | |
| 327 | S32 nodeIndex; |
| 328 | S32 start = mTransitionRotationNodes.start(); |
| 329 | S32 end = b; |
| 330 | for (nodeIndex=start; nodeIndex<end; mTransitionRotationNodes.next(nodeIndex)) |
| 331 | { |
| 332 | if (nodeIndex<a) |
| 333 | continue; |
| 334 | TSThread * thread = smRotationThreads[nodeIndex]; |
| 335 | thread = thread && thread->transitionData.inTransition ? thread : NULL; |
| 336 | if (!thread) |
| 337 | { |
| 338 | // if not controlled by a sequence in transition then there must be |
| 339 | // some other thread out there that used to control us that is in |
| 340 | // transition now...use that thread to control interpolation |
| 341 | for (S32 i=0; i<mTransitionThreads.size(); i++) |
| 342 | { |
| 343 | if (mTransitionThreads[i]->transitionData.oldRotationNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->rotationMatters.test(nodeIndex)) |
| 344 | { |
| 345 | thread = mTransitionThreads[i]; |
| 346 | break; |
| 347 | } |
| 348 | } |
| 349 | AssertFatal(thread!=NULL,"TSShapeInstance::handleRotTransitionNodes (rotation)"); |
| 350 | } |
| 351 | QuatF tmpQ; |
| 352 | TSTransform::interpolate(mNodeReferenceRotations[nodeIndex].getQuatF(&tmpQ),smNodeCurrentRotations[nodeIndex],thread->transitionData.pos,&smNodeCurrentRotations[nodeIndex]); |
| 353 | } |
| 354 | |
| 355 | // then translation |
| 356 | start = mTransitionTranslationNodes.start(); |
| 357 | end = b; |
| 358 | for (nodeIndex=start; nodeIndex<end; mTransitionTranslationNodes.next(nodeIndex)) |
| 359 | { |
| 360 | TSThread * thread = smTranslationThreads[nodeIndex]; |
| 361 | thread = thread && thread->transitionData.inTransition ? thread : NULL; |
| 362 | if (!thread) |
| 363 | { |
| 364 | // if not controlled by a sequence in transition then there must be |
| 365 | // some other thread out there that used to control us that is in |
| 366 | // transition now...use that thread to control interpolation |
| 367 | for (S32 i=0; i<mTransitionThreads.size(); i++) |
| 368 | { |
| 369 | if (mTransitionThreads[i]->transitionData.oldTranslationNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->translationMatters.test(nodeIndex)) |
| 370 | { |
| 371 | thread = mTransitionThreads[i]; |
| 372 | break; |
| 373 | } |
| 374 | } |
| 375 | AssertFatal(thread!=NULL,"TSShapeInstance::handleTransitionNodes (translation)."); |
| 376 | } |
| 377 | Point3F & p = smNodeCurrentTranslations[nodeIndex]; |
| 378 | Point3F & p1 = mNodeReferenceTranslations[nodeIndex]; |
| 379 | Point3F & p2 = p; |