| 465 | } |
| 466 | |
| 467 | void TSShapeInstance::handleAnimatedScale(TSThread * thread, S32 a, S32 b, TSIntegerSet & scaleBeenSet) |
| 468 | { |
| 469 | S32 j=0; |
| 470 | S32 start = thread->getSequence()->scaleMatters.start(); |
| 471 | S32 end = b; |
| 472 | |
| 473 | // code the scale conversion (might need to "upgrade" from uniform to arbitrary, e.g.) |
| 474 | // code uniform, aligned, and arbitrary as 0,1, and 2, respectively, |
| 475 | // with sequence coding in first two bits, shape coding in next two bits |
| 476 | S32 code = 0; |
| 477 | if (thread->getSequence()->animatesAlignedScale()) |
| 478 | code += 1; |
| 479 | else if (thread->getSequence()->animatesArbitraryScale()) |
| 480 | code += 2; |
| 481 | if (animatesAlignedScale()) |
| 482 | code += 4; |
| 483 | if (animatesArbitraryScale()) |
| 484 | code += 8; |
| 485 | |
| 486 | F32 uniformScale = 1.0f; |
| 487 | Point3F alignedScale(0.0f, 0.0f, 0.0f); |
| 488 | TSScale arbitraryScale; |
| 489 | for (S32 nodeIndex=start; nodeIndex<end; thread->getSequence()->scaleMatters.next(nodeIndex), j++) |
| 490 | { |
| 491 | if (nodeIndex<a) |
| 492 | continue; |
| 493 | |
| 494 | if (!scaleBeenSet.test(nodeIndex)) |
| 495 | { |
| 496 | // compute scale in sequence format |
| 497 | switch (code) |
| 498 | { // Sequence Shape |
| 499 | case 0: // uniform -> uniform |
| 500 | case 4: // uniform -> aligned |
| 501 | case 8: // uniform -> arbitrary |
| 502 | { |
| 503 | F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum1,j); |
| 504 | F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum2,j); |
| 505 | uniformScale = TSTransform::interpolate(s1,s2,thread->keyPos); |
| 506 | alignedScale.set(uniformScale,uniformScale,uniformScale); |
| 507 | break; |
| 508 | } |
| 509 | case 5: // aligned -> aligned |
| 510 | case 9: // aligned -> arbitrary |
| 511 | { |
| 512 | const Point3F & s1 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum1,j); |
| 513 | const Point3F & s2 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum2,j); |
| 514 | TSTransform::interpolate(s1,s2,thread->keyPos,&alignedScale); |
| 515 | break; |
| 516 | } |
| 517 | case 10: // arbitrary -> arbitary |
| 518 | { |
| 519 | TSScale s1,s2; |
| 520 | mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum1,j,&s1); |
| 521 | mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum2,j,&s2); |
| 522 | TSTransform::interpolate(s1,s2,thread->keyPos,&arbitraryScale); |
| 523 | break; |
| 524 | } |
nothing calls this directly
no test coverage detected