MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / animateFrame

Method animateFrame

Engine/source/ts/tsAnimate.cpp:730–785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

728}
729
730void TSShapeInstance::animateFrame(S32 ss)
731{
732 PROFILE_SCOPE( TSShapeInstance_animateFrame );
733
734 S32 i;
735 if (!mMeshObjects.size())
736 return;
737
738 // find out who needs default values set
739 TSIntegerSet beenSet;
740 beenSet.setAll(mMeshObjects.size());
741 for (i=0; i<mThreadList.size(); i++)
742 beenSet.takeAway(mThreadList[i]->getSequence()->frameMatters);
743
744 // set defaults
745 S32 a = mShape->subShapeFirstObject[ss];
746 S32 b = a + mShape->subShapeNumObjects[ss];
747 for (i=a; i<b; i++)
748 if (beenSet.test(i))
749 mMeshObjects[i].frame = mShape->objectStates[i].frameIndex;
750
751 // go through each thread and set frame on those objects that
752 // are not set yet and are controlled by that thread
753 for (i=0; i<mThreadList.size(); i++)
754 {
755 TSThread * th = mThreadList[i];
756
757 const TSShape::Sequence* threadSequence = th->getSequence();
758
759 // For better or worse, object states are stored together (frame,
760 // matFrame, visibility all in one structure). Thus, indexing into
761 // object state array for animation for any of these attributes needs to
762 // take into account whether or not the other attributes are also animated.
763 // The object states should eventually be separated (like the node states were)
764 // in order to save memory and save the following step.
765 TSIntegerSet objectMatters = threadSequence->frameMatters;
766 objectMatters.overlap(threadSequence->matFrameMatters);
767 objectMatters.overlap(threadSequence->visMatters);
768
769 // skip to beginning of this sub-shape
770 S32 j=0;
771 S32 start = objectMatters.start();
772 S32 end = b;
773 for (S32 objectIndex = start; objectIndex<end; objectMatters.next(objectIndex), j++)
774 {
775 if (!beenSet.test(objectIndex) && threadSequence->frameMatters.test(objectIndex))
776 {
777 S32 key = (th->keyPos<0.5f) ? th->keyNum1 : th->keyNum2;
778 mMeshObjects[objectIndex].frame = mShape->getObjectState(*threadSequence,key,j).frameIndex;
779
780 // record change so that later threads don't over-write us...
781 beenSet.set(objectIndex);
782 }
783 }
784 }
785}
786
787void TSShapeInstance::animateMatFrame(S32 ss)

Callers

nothing calls this directly

Calls 9

takeAwayMethod · 0.80
sizeMethod · 0.45
setAllMethod · 0.45
getSequenceMethod · 0.45
testMethod · 0.45
overlapMethod · 0.45
startMethod · 0.45
nextMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected