MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / animateMatFrame

Method animateMatFrame

Engine/source/ts/tsAnimate.cpp:787–842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

785}
786
787void TSShapeInstance::animateMatFrame(S32 ss)
788{
789 PROFILE_SCOPE( TSShapeInstance_animateMatFrame );
790
791 S32 i;
792 if (!mMeshObjects.size())
793 return;
794
795 // find out who needs default values set
796 TSIntegerSet beenSet;
797 beenSet.setAll(mMeshObjects.size());
798 for (i=0; i<mThreadList.size(); i++)
799 beenSet.takeAway(mThreadList[i]->getSequence()->matFrameMatters);
800
801 // set defaults
802 S32 a = mShape->subShapeFirstObject[ss];
803 S32 b = a + mShape->subShapeNumObjects[ss];
804 for (i=a; i<b; i++)
805 if (beenSet.test(i))
806 mMeshObjects[i].matFrame = mShape->objectStates[i].matFrameIndex;
807
808 // go through each thread and set matFrame on those objects that
809 // are not set yet and are controlled by that thread
810 for (i=0; i<mThreadList.size(); i++)
811 {
812 TSThread * th = mThreadList[i];
813
814 const TSShape::Sequence* threadSequence = th->getSequence();
815
816 // For better or worse, object states are stored together (frame,
817 // matFrame, visibility all in one structure). Thus, indexing into
818 // object state array for animation for any of these attributes needs to
819 // take into account whether or not the other attributes are also animated.
820 // The object states should eventually be separated (like the node states were)
821 // in order to save memory and save the following step.
822 TSIntegerSet objectMatters = threadSequence->frameMatters;
823 objectMatters.overlap(threadSequence->matFrameMatters);
824 objectMatters.overlap(threadSequence->visMatters);
825
826 // skip to beginining of this sub-shape
827 S32 j=0;
828 S32 start = objectMatters.start();
829 S32 end = b;
830 for (S32 objectIndex = start; objectIndex<end; objectMatters.next(objectIndex), j++)
831 {
832 if (!beenSet.test(objectIndex) && threadSequence->matFrameMatters.test(objectIndex))
833 {
834 S32 key = (th->keyPos<0.5f) ? th->keyNum1 : th->keyNum2;
835 mMeshObjects[objectIndex].matFrame = mShape->getObjectState(*threadSequence,key,j).matFrameIndex;
836
837 // record change so that later threads don't over-write us...
838 beenSet.set(objectIndex);
839 }
840 }
841 }
842}
843
844//-------------------------------------------------------------------------------------

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