mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 00:24:40 +00:00
Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSThread
This commit is contained in:
parent
a310983e49
commit
bcb0b8e088
3 changed files with 184 additions and 184 deletions
|
|
@ -157,9 +157,9 @@ void TSShapeInstance::animateNodes(S32 ss)
|
||||||
if (!rotBeenSet.test(nodeIndex))
|
if (!rotBeenSet.test(nodeIndex))
|
||||||
{
|
{
|
||||||
QuatF q1,q2;
|
QuatF q1,q2;
|
||||||
mShape->getRotation(*th->getSequence(),th->keyNum1,j,&q1);
|
mShape->getRotation(*th->getSequence(),th->mKeyNum1,j,&q1);
|
||||||
mShape->getRotation(*th->getSequence(),th->keyNum2,j,&q2);
|
mShape->getRotation(*th->getSequence(),th->mKeyNum2,j,&q2);
|
||||||
TSTransform::interpolate(q1,q2,th->keyPos,&smNodeCurrentRotations[nodeIndex]);
|
TSTransform::interpolate(q1,q2,th->mKeyPos,&smNodeCurrentRotations[nodeIndex]);
|
||||||
rotBeenSet.set(nodeIndex);
|
rotBeenSet.set(nodeIndex);
|
||||||
smRotationThreads[nodeIndex] = th;
|
smRotationThreads[nodeIndex] = th;
|
||||||
}
|
}
|
||||||
|
|
@ -178,9 +178,9 @@ void TSShapeInstance::animateNodes(S32 ss)
|
||||||
handleMaskedPositionNode(th,nodeIndex,j);
|
handleMaskedPositionNode(th,nodeIndex,j);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const Point3F & p1 = mShape->getTranslation(*th->getSequence(),th->keyNum1,j);
|
const Point3F & p1 = mShape->getTranslation(*th->getSequence(),th->mKeyNum1,j);
|
||||||
const Point3F & p2 = mShape->getTranslation(*th->getSequence(),th->keyNum2,j);
|
const Point3F & p2 = mShape->getTranslation(*th->getSequence(),th->mKeyNum2,j);
|
||||||
TSTransform::interpolate(p1,p2,th->keyPos,&smNodeCurrentTranslations[nodeIndex]);
|
TSTransform::interpolate(p1,p2,th->mKeyPos,&smNodeCurrentTranslations[nodeIndex]);
|
||||||
smTranslationThreads[nodeIndex] = th;
|
smTranslationThreads[nodeIndex] = th;
|
||||||
}
|
}
|
||||||
tranBeenSet.set(nodeIndex);
|
tranBeenSet.set(nodeIndex);
|
||||||
|
|
@ -222,7 +222,7 @@ void TSShapeInstance::animateNodes(S32 ss)
|
||||||
for (i=firstBlend; i<mThreadList.size(); i++)
|
for (i=firstBlend; i<mThreadList.size(); i++)
|
||||||
{
|
{
|
||||||
TSThread * th = mThreadList[i];
|
TSThread * th = mThreadList[i];
|
||||||
if (th->blendDisabled)
|
if (th->mBlendDisabled)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
handleBlendSequence(th,a,b);
|
handleBlendSequence(th,a,b);
|
||||||
|
|
@ -330,7 +330,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b)
|
||||||
if (nodeIndex<a)
|
if (nodeIndex<a)
|
||||||
continue;
|
continue;
|
||||||
TSThread * thread = smRotationThreads[nodeIndex];
|
TSThread * thread = smRotationThreads[nodeIndex];
|
||||||
thread = thread && thread->transitionData.inTransition ? thread : NULL;
|
thread = thread && thread->mTransitionData.inTransition ? thread : NULL;
|
||||||
if (!thread)
|
if (!thread)
|
||||||
{
|
{
|
||||||
// if not controlled by a sequence in transition then there must be
|
// if not controlled by a sequence in transition then there must be
|
||||||
|
|
@ -338,7 +338,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b)
|
||||||
// transition now...use that thread to control interpolation
|
// transition now...use that thread to control interpolation
|
||||||
for (S32 i=0; i<mTransitionThreads.size(); i++)
|
for (S32 i=0; i<mTransitionThreads.size(); i++)
|
||||||
{
|
{
|
||||||
if (mTransitionThreads[i]->transitionData.oldRotationNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->rotationMatters.test(nodeIndex))
|
if (mTransitionThreads[i]->mTransitionData.oldRotationNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->rotationMatters.test(nodeIndex))
|
||||||
{
|
{
|
||||||
thread = mTransitionThreads[i];
|
thread = mTransitionThreads[i];
|
||||||
break;
|
break;
|
||||||
|
|
@ -347,7 +347,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b)
|
||||||
AssertFatal(thread!=NULL,"TSShapeInstance::handleRotTransitionNodes (rotation)");
|
AssertFatal(thread!=NULL,"TSShapeInstance::handleRotTransitionNodes (rotation)");
|
||||||
}
|
}
|
||||||
QuatF tmpQ;
|
QuatF tmpQ;
|
||||||
TSTransform::interpolate(mNodeReferenceRotations[nodeIndex].getQuatF(&tmpQ),smNodeCurrentRotations[nodeIndex],thread->transitionData.pos,&smNodeCurrentRotations[nodeIndex]);
|
TSTransform::interpolate(mNodeReferenceRotations[nodeIndex].getQuatF(&tmpQ),smNodeCurrentRotations[nodeIndex],thread->mTransitionData.pos,&smNodeCurrentRotations[nodeIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// then translation
|
// then translation
|
||||||
|
|
@ -356,7 +356,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b)
|
||||||
for (nodeIndex=start; nodeIndex<end; mTransitionTranslationNodes.next(nodeIndex))
|
for (nodeIndex=start; nodeIndex<end; mTransitionTranslationNodes.next(nodeIndex))
|
||||||
{
|
{
|
||||||
TSThread * thread = smTranslationThreads[nodeIndex];
|
TSThread * thread = smTranslationThreads[nodeIndex];
|
||||||
thread = thread && thread->transitionData.inTransition ? thread : NULL;
|
thread = thread && thread->mTransitionData.inTransition ? thread : NULL;
|
||||||
if (!thread)
|
if (!thread)
|
||||||
{
|
{
|
||||||
// if not controlled by a sequence in transition then there must be
|
// if not controlled by a sequence in transition then there must be
|
||||||
|
|
@ -364,7 +364,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b)
|
||||||
// transition now...use that thread to control interpolation
|
// transition now...use that thread to control interpolation
|
||||||
for (S32 i=0; i<mTransitionThreads.size(); i++)
|
for (S32 i=0; i<mTransitionThreads.size(); i++)
|
||||||
{
|
{
|
||||||
if (mTransitionThreads[i]->transitionData.oldTranslationNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->translationMatters.test(nodeIndex))
|
if (mTransitionThreads[i]->mTransitionData.oldTranslationNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->translationMatters.test(nodeIndex))
|
||||||
{
|
{
|
||||||
thread = mTransitionThreads[i];
|
thread = mTransitionThreads[i];
|
||||||
break;
|
break;
|
||||||
|
|
@ -375,7 +375,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b)
|
||||||
Point3F & p = smNodeCurrentTranslations[nodeIndex];
|
Point3F & p = smNodeCurrentTranslations[nodeIndex];
|
||||||
Point3F & p1 = mNodeReferenceTranslations[nodeIndex];
|
Point3F & p1 = mNodeReferenceTranslations[nodeIndex];
|
||||||
Point3F & p2 = p;
|
Point3F & p2 = p;
|
||||||
F32 k = thread->transitionData.pos;
|
F32 k = thread->mTransitionData.pos;
|
||||||
p.x = p1.x + k * (p2.x-p1.x);
|
p.x = p1.x + k * (p2.x-p1.x);
|
||||||
p.y = p1.y + k * (p2.y-p1.y);
|
p.y = p1.y + k * (p2.y-p1.y);
|
||||||
p.z = p1.z + k * (p2.z-p1.z);
|
p.z = p1.z + k * (p2.z-p1.z);
|
||||||
|
|
@ -389,7 +389,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b)
|
||||||
for (nodeIndex=start; nodeIndex<end; mTransitionScaleNodes.next(nodeIndex))
|
for (nodeIndex=start; nodeIndex<end; mTransitionScaleNodes.next(nodeIndex))
|
||||||
{
|
{
|
||||||
TSThread * thread = smScaleThreads[nodeIndex];
|
TSThread * thread = smScaleThreads[nodeIndex];
|
||||||
thread = thread && thread->transitionData.inTransition ? thread : NULL;
|
thread = thread && thread->mTransitionData.inTransition ? thread : NULL;
|
||||||
if (!thread)
|
if (!thread)
|
||||||
{
|
{
|
||||||
// if not controlled by a sequence in transition then there must be
|
// if not controlled by a sequence in transition then there must be
|
||||||
|
|
@ -397,7 +397,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b)
|
||||||
// transition now...use that thread to control interpolation
|
// transition now...use that thread to control interpolation
|
||||||
for (S32 i=0; i<mTransitionThreads.size(); i++)
|
for (S32 i=0; i<mTransitionThreads.size(); i++)
|
||||||
{
|
{
|
||||||
if (mTransitionThreads[i]->transitionData.oldScaleNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->scaleMatters.test(nodeIndex))
|
if (mTransitionThreads[i]->mTransitionData.oldScaleNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->scaleMatters.test(nodeIndex))
|
||||||
{
|
{
|
||||||
thread = mTransitionThreads[i];
|
thread = mTransitionThreads[i];
|
||||||
break;
|
break;
|
||||||
|
|
@ -406,14 +406,14 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b)
|
||||||
AssertFatal(thread!=NULL,"TSShapeInstance::handleTransitionNodes (scale).");
|
AssertFatal(thread!=NULL,"TSShapeInstance::handleTransitionNodes (scale).");
|
||||||
}
|
}
|
||||||
if (animatesUniformScale())
|
if (animatesUniformScale())
|
||||||
smNodeCurrentUniformScales[nodeIndex] += thread->transitionData.pos * (mNodeReferenceUniformScales[nodeIndex]-smNodeCurrentUniformScales[nodeIndex]);
|
smNodeCurrentUniformScales[nodeIndex] += thread->mTransitionData.pos * (mNodeReferenceUniformScales[nodeIndex]-smNodeCurrentUniformScales[nodeIndex]);
|
||||||
else if (animatesAlignedScale())
|
else if (animatesAlignedScale())
|
||||||
TSTransform::interpolate(mNodeReferenceScaleFactors[nodeIndex],smNodeCurrentAlignedScales[nodeIndex],thread->transitionData.pos,&smNodeCurrentAlignedScales[nodeIndex]);
|
TSTransform::interpolate(mNodeReferenceScaleFactors[nodeIndex],smNodeCurrentAlignedScales[nodeIndex],thread->mTransitionData.pos,&smNodeCurrentAlignedScales[nodeIndex]);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QuatF q;
|
QuatF q;
|
||||||
TSTransform::interpolate(mNodeReferenceScaleFactors[nodeIndex],smNodeCurrentArbitraryScales[nodeIndex].mScale,thread->transitionData.pos,&smNodeCurrentArbitraryScales[nodeIndex].mScale);
|
TSTransform::interpolate(mNodeReferenceScaleFactors[nodeIndex],smNodeCurrentArbitraryScales[nodeIndex].mScale,thread->mTransitionData.pos,&smNodeCurrentArbitraryScales[nodeIndex].mScale);
|
||||||
TSTransform::interpolate(mNodeReferenceArbitraryScaleRots[nodeIndex].getQuatF(&q),smNodeCurrentArbitraryScales[nodeIndex].mRotate,thread->transitionData.pos,&smNodeCurrentArbitraryScales[nodeIndex].mRotate);
|
TSTransform::interpolate(mNodeReferenceArbitraryScaleRots[nodeIndex].getQuatF(&q),smNodeCurrentArbitraryScales[nodeIndex].mRotate,thread->mTransitionData.pos,&smNodeCurrentArbitraryScales[nodeIndex].mRotate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -498,26 +498,26 @@ void TSShapeInstance::handleAnimatedScale(TSThread * thread, S32 a, S32 b, TSInt
|
||||||
case 4: // uniform -> aligned
|
case 4: // uniform -> aligned
|
||||||
case 8: // uniform -> arbitrary
|
case 8: // uniform -> arbitrary
|
||||||
{
|
{
|
||||||
F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum1,j);
|
F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->mKeyNum1,j);
|
||||||
F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum2,j);
|
F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->mKeyNum2,j);
|
||||||
uniformScale = TSTransform::interpolate(s1,s2,thread->keyPos);
|
uniformScale = TSTransform::interpolate(s1,s2,thread->mKeyPos);
|
||||||
alignedScale.set(uniformScale,uniformScale,uniformScale);
|
alignedScale.set(uniformScale,uniformScale,uniformScale);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5: // aligned -> aligned
|
case 5: // aligned -> aligned
|
||||||
case 9: // aligned -> arbitrary
|
case 9: // aligned -> arbitrary
|
||||||
{
|
{
|
||||||
const Point3F & s1 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum1,j);
|
const Point3F & s1 = mShape->getAlignedScale(*thread->getSequence(),thread->mKeyNum1,j);
|
||||||
const Point3F & s2 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum2,j);
|
const Point3F & s2 = mShape->getAlignedScale(*thread->getSequence(),thread->mKeyNum2,j);
|
||||||
TSTransform::interpolate(s1,s2,thread->keyPos,&alignedScale);
|
TSTransform::interpolate(s1,s2,thread->mKeyPos,&alignedScale);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 10: // arbitrary -> arbitary
|
case 10: // arbitrary -> arbitary
|
||||||
{
|
{
|
||||||
TSScale s1,s2;
|
TSScale s1,s2;
|
||||||
mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum1,j,&s1);
|
mShape->getArbitraryScale(*thread->getSequence(),thread->mKeyNum1,j,&s1);
|
||||||
mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum2,j,&s2);
|
mShape->getArbitraryScale(*thread->getSequence(),thread->mKeyNum2,j,&s2);
|
||||||
TSTransform::interpolate(s1,s2,thread->keyPos,&arbitraryScale);
|
TSTransform::interpolate(s1,s2,thread->mKeyPos,&arbitraryScale);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: AssertFatal(0,"TSShapeInstance::handleAnimatedScale"); break;
|
default: AssertFatal(0,"TSShapeInstance::handleAnimatedScale"); break;
|
||||||
|
|
@ -556,10 +556,10 @@ void TSShapeInstance::handleAnimatedScale(TSThread * thread, S32 a, S32 b, TSInt
|
||||||
|
|
||||||
void TSShapeInstance::handleMaskedPositionNode(TSThread * th, S32 nodeIndex, S32 offset)
|
void TSShapeInstance::handleMaskedPositionNode(TSThread * th, S32 nodeIndex, S32 offset)
|
||||||
{
|
{
|
||||||
const Point3F & p1 = mShape->getTranslation(*th->getSequence(),th->keyNum1,offset);
|
const Point3F & p1 = mShape->getTranslation(*th->getSequence(),th->mKeyNum1,offset);
|
||||||
const Point3F & p2 = mShape->getTranslation(*th->getSequence(),th->keyNum2,offset);
|
const Point3F & p2 = mShape->getTranslation(*th->getSequence(),th->mKeyNum2,offset);
|
||||||
Point3F p;
|
Point3F p;
|
||||||
TSTransform::interpolate(p1,p2,th->keyPos,&p);
|
TSTransform::interpolate(p1,p2,th->mKeyPos,&p);
|
||||||
|
|
||||||
if (!mMaskPosXNodes.test(nodeIndex))
|
if (!mMaskPosXNodes.test(nodeIndex))
|
||||||
smNodeCurrentTranslations[nodeIndex].x = p.x;
|
smNodeCurrentTranslations[nodeIndex].x = p.x;
|
||||||
|
|
@ -600,20 +600,20 @@ void TSShapeInstance::handleBlendSequence(TSThread * thread, S32 a, S32 b)
|
||||||
if (thread->getSequence()->rotationMatters.test(nodeIndex))
|
if (thread->getSequence()->rotationMatters.test(nodeIndex))
|
||||||
{
|
{
|
||||||
QuatF q1,q2;
|
QuatF q1,q2;
|
||||||
mShape->getRotation(*thread->getSequence(),thread->keyNum1,jrot,&q1);
|
mShape->getRotation(*thread->getSequence(),thread->mKeyNum1,jrot,&q1);
|
||||||
mShape->getRotation(*thread->getSequence(),thread->keyNum2,jrot,&q2);
|
mShape->getRotation(*thread->getSequence(),thread->mKeyNum2,jrot,&q2);
|
||||||
QuatF quat;
|
QuatF quat;
|
||||||
TSTransform::interpolate(q1,q2,thread->keyPos,&quat);
|
TSTransform::interpolate(q1,q2,thread->mKeyPos,&quat);
|
||||||
TSTransform::setMatrix(quat,&mat);
|
TSTransform::setMatrix(quat,&mat);
|
||||||
jrot++;
|
jrot++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread->getSequence()->translationMatters.test(nodeIndex))
|
if (thread->getSequence()->translationMatters.test(nodeIndex))
|
||||||
{
|
{
|
||||||
const Point3F & p1 = mShape->getTranslation(*thread->getSequence(),thread->keyNum1,jtrans);
|
const Point3F & p1 = mShape->getTranslation(*thread->getSequence(),thread->mKeyNum1,jtrans);
|
||||||
const Point3F & p2 = mShape->getTranslation(*thread->getSequence(),thread->keyNum2,jtrans);
|
const Point3F & p2 = mShape->getTranslation(*thread->getSequence(),thread->mKeyNum2,jtrans);
|
||||||
Point3F p;
|
Point3F p;
|
||||||
TSTransform::interpolate(p1,p2,thread->keyPos,&p);
|
TSTransform::interpolate(p1,p2,thread->mKeyPos,&p);
|
||||||
mat.setColumn(3,p);
|
mat.setColumn(3,p);
|
||||||
jtrans++;
|
jtrans++;
|
||||||
}
|
}
|
||||||
|
|
@ -622,26 +622,26 @@ void TSShapeInstance::handleBlendSequence(TSThread * thread, S32 a, S32 b)
|
||||||
{
|
{
|
||||||
if (thread->getSequence()->animatesUniformScale())
|
if (thread->getSequence()->animatesUniformScale())
|
||||||
{
|
{
|
||||||
F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum1,jscale);
|
F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->mKeyNum1,jscale);
|
||||||
F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum2,jscale);
|
F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->mKeyNum2,jscale);
|
||||||
F32 scale = TSTransform::interpolate(s1,s2,thread->keyPos);
|
F32 scale = TSTransform::interpolate(s1,s2,thread->mKeyPos);
|
||||||
TSTransform::applyScale(scale,&mat);
|
TSTransform::applyScale(scale,&mat);
|
||||||
}
|
}
|
||||||
else if (animatesAlignedScale())
|
else if (animatesAlignedScale())
|
||||||
{
|
{
|
||||||
Point3F s1 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum1,jscale);
|
Point3F s1 = mShape->getAlignedScale(*thread->getSequence(),thread->mKeyNum1,jscale);
|
||||||
Point3F s2 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum2,jscale);
|
Point3F s2 = mShape->getAlignedScale(*thread->getSequence(),thread->mKeyNum2,jscale);
|
||||||
Point3F scale;
|
Point3F scale;
|
||||||
TSTransform::interpolate(s1,s2,thread->keyPos,&scale);
|
TSTransform::interpolate(s1,s2,thread->mKeyPos,&scale);
|
||||||
TSTransform::applyScale(scale,&mat);
|
TSTransform::applyScale(scale,&mat);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TSScale s1,s2;
|
TSScale s1,s2;
|
||||||
mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum1,jscale,&s1);
|
mShape->getArbitraryScale(*thread->getSequence(),thread->mKeyNum1,jscale,&s1);
|
||||||
mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum2,jscale,&s2);
|
mShape->getArbitraryScale(*thread->getSequence(),thread->mKeyNum2,jscale,&s2);
|
||||||
TSScale scale;
|
TSScale scale;
|
||||||
TSTransform::interpolate(s1,s2,thread->keyPos,&scale);
|
TSTransform::interpolate(s1,s2,thread->mKeyPos,&scale);
|
||||||
TSTransform::applyScale(scale,&mat);
|
TSTransform::applyScale(scale,&mat);
|
||||||
}
|
}
|
||||||
jscale++;
|
jscale++;
|
||||||
|
|
@ -704,14 +704,14 @@ void TSShapeInstance::animateVisibility(S32 ss)
|
||||||
{
|
{
|
||||||
if (!beenSet.test(objectIndex) && th->getSequence()->visMatters.test(objectIndex))
|
if (!beenSet.test(objectIndex) && th->getSequence()->visMatters.test(objectIndex))
|
||||||
{
|
{
|
||||||
F32 state1 = mShape->getObjectState(*th->getSequence(),th->keyNum1,j).vis;
|
F32 state1 = mShape->getObjectState(*th->getSequence(),th->mKeyNum1,j).vis;
|
||||||
F32 state2 = mShape->getObjectState(*th->getSequence(),th->keyNum2,j).vis;
|
F32 state2 = mShape->getObjectState(*th->getSequence(),th->mKeyNum2,j).vis;
|
||||||
if ((state1-state2) * (state1-state2) > 0.99f)
|
if ((state1-state2) * (state1-state2) > 0.99f)
|
||||||
// goes from 0 to 1 -- discreet jump
|
// goes from 0 to 1 -- discreet jump
|
||||||
mMeshObjects[objectIndex].visible = th->keyPos<0.5f ? state1 : state2;
|
mMeshObjects[objectIndex].visible = th->mKeyPos<0.5f ? state1 : state2;
|
||||||
else
|
else
|
||||||
// interpolate between keyframes when visibility change is gradual
|
// interpolate between keyframes when visibility change is gradual
|
||||||
mMeshObjects[objectIndex].visible = (1.0f-th->keyPos) * state1 + th->keyPos * state2;
|
mMeshObjects[objectIndex].visible = (1.0f-th->mKeyPos) * state1 + th->mKeyPos * state2;
|
||||||
|
|
||||||
// record change so that later threads don't over-write us...
|
// record change so that later threads don't over-write us...
|
||||||
beenSet.set(objectIndex);
|
beenSet.set(objectIndex);
|
||||||
|
|
@ -765,7 +765,7 @@ void TSShapeInstance::animateFrame(S32 ss)
|
||||||
{
|
{
|
||||||
if (!beenSet.test(objectIndex) && th->getSequence()->frameMatters.test(objectIndex))
|
if (!beenSet.test(objectIndex) && th->getSequence()->frameMatters.test(objectIndex))
|
||||||
{
|
{
|
||||||
S32 key = (th->keyPos<0.5f) ? th->keyNum1 : th->keyNum2;
|
S32 key = (th->mKeyPos<0.5f) ? th->mKeyNum1 : th->mKeyNum2;
|
||||||
mMeshObjects[objectIndex].frame = mShape->getObjectState(*th->getSequence(),key,j).frameIndex;
|
mMeshObjects[objectIndex].frame = mShape->getObjectState(*th->getSequence(),key,j).frameIndex;
|
||||||
|
|
||||||
// record change so that later threads don't over-write us...
|
// record change so that later threads don't over-write us...
|
||||||
|
|
@ -820,7 +820,7 @@ void TSShapeInstance::animateMatFrame(S32 ss)
|
||||||
{
|
{
|
||||||
if (!beenSet.test(objectIndex) && th->getSequence()->matFrameMatters.test(objectIndex))
|
if (!beenSet.test(objectIndex) && th->getSequence()->matFrameMatters.test(objectIndex))
|
||||||
{
|
{
|
||||||
S32 key = (th->keyPos<0.5f) ? th->keyNum1 : th->keyNum2;
|
S32 key = (th->mKeyPos<0.5f) ? th->mKeyNum1 : th->mKeyNum2;
|
||||||
mMeshObjects[objectIndex].matFrame = mShape->getObjectState(*th->getSequence(),key,j).matFrameIndex;
|
mMeshObjects[objectIndex].matFrame = mShape->getObjectState(*th->getSequence(),key,j).matFrameIndex;
|
||||||
|
|
||||||
// record change so that later threads don't over-write us...
|
// record change so that later threads don't over-write us...
|
||||||
|
|
@ -909,7 +909,7 @@ void TSShapeInstance::animateSubtrees(bool forceFull)
|
||||||
void TSShapeInstance::addPath(TSThread *gt, F32 start, F32 end, MatrixF *mat)
|
void TSShapeInstance::addPath(TSThread *gt, F32 start, F32 end, MatrixF *mat)
|
||||||
{
|
{
|
||||||
// never get here while in transition...
|
// never get here while in transition...
|
||||||
AssertFatal(!gt->transitionData.inTransition,"TSShapeInstance::addPath");
|
AssertFatal(!gt->mTransitionData.inTransition,"TSShapeInstance::addPath");
|
||||||
|
|
||||||
if (!mat)
|
if (!mat)
|
||||||
mat = &mGroundTransform;
|
mat = &mGroundTransform;
|
||||||
|
|
@ -932,7 +932,7 @@ bool TSShapeInstance::initGround()
|
||||||
for (S32 i=0; i<mThreadList.size(); i++)
|
for (S32 i=0; i<mThreadList.size(); i++)
|
||||||
{
|
{
|
||||||
TSThread * th = mThreadList[i];
|
TSThread * th = mThreadList[i];
|
||||||
if (!th->transitionData.inTransition && th->getSequence()->numGroundFrames>0)
|
if (!th->mTransitionData.inTransition && th->getSequence()->numGroundFrames>0)
|
||||||
{
|
{
|
||||||
mGroundThread = th;
|
mGroundThread = th;
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -950,9 +950,9 @@ void TSShapeInstance::animateGround()
|
||||||
if (!mGroundThread && !initGround())
|
if (!mGroundThread && !initGround())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
S32 & loop = mGroundThread->path.loop;
|
S32 & loop = mGroundThread->mPath.loop;
|
||||||
F32 & start = mGroundThread->path.start;
|
F32 & start = mGroundThread->mPath.start;
|
||||||
F32 & end = mGroundThread->path.end;
|
F32 & end = mGroundThread->mPath.end;
|
||||||
|
|
||||||
// accumulate path transform
|
// accumulate path transform
|
||||||
if (loop>0)
|
if (loop>0)
|
||||||
|
|
@ -980,7 +980,7 @@ void TSShapeInstance::deltaGround(TSThread * thread, F32 start, F32 end, MatrixF
|
||||||
mat = &mGroundTransform;
|
mat = &mGroundTransform;
|
||||||
|
|
||||||
mat->identity();
|
mat->identity();
|
||||||
if (thread->transitionData.inTransition)
|
if (thread->mTransitionData.inTransition)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
F32 invDuration = 1.0f / thread->getDuration();
|
F32 invDuration = 1.0f / thread->getDuration();
|
||||||
|
|
@ -994,7 +994,7 @@ void TSShapeInstance::deltaGround(TSThread * thread, F32 start, F32 end, MatrixF
|
||||||
void TSShapeInstance::deltaGround1(TSThread * thread, F32 start, F32 end, MatrixF& mat)
|
void TSShapeInstance::deltaGround1(TSThread * thread, F32 start, F32 end, MatrixF& mat)
|
||||||
{
|
{
|
||||||
mat.identity();
|
mat.identity();
|
||||||
if (thread->transitionData.inTransition)
|
if (thread->mTransitionData.inTransition)
|
||||||
return;
|
return;
|
||||||
addPath(thread, start, end, &mat);
|
addPath(thread, start, end, &mat);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -696,20 +696,20 @@ class TSThread
|
||||||
{
|
{
|
||||||
friend class TSShapeInstance;
|
friend class TSShapeInstance;
|
||||||
|
|
||||||
S32 priority;
|
S32 mPriority;
|
||||||
|
|
||||||
TSShapeInstance * mShapeInstance; ///< Instance of the shape that this thread animates
|
TSShapeInstance * mShapeInstance; ///< Instance of the shape that this thread animates
|
||||||
|
|
||||||
S32 sequence; ///< Sequence this thread will perform
|
S32 mSequence; ///< Sequence this thread will perform
|
||||||
F32 pos;
|
F32 mPos;
|
||||||
|
|
||||||
F32 timeScale; ///< How fast to play through the sequence
|
F32 mTimeScale; ///< How fast to play through the sequence
|
||||||
|
|
||||||
S32 keyNum1; ///< Keyframe at or before current position
|
S32 mKeyNum1; ///< Keyframe at or before current position
|
||||||
S32 keyNum2; ///< Keyframe at or after current position
|
S32 mKeyNum2; ///< Keyframe at or after current position
|
||||||
F32 keyPos;
|
F32 mKeyPos;
|
||||||
|
|
||||||
bool blendDisabled; ///< Blend with other sequences?
|
bool mBlendDisabled; ///< Blend with other sequences?
|
||||||
|
|
||||||
/// if in transition...
|
/// if in transition...
|
||||||
struct TransitionData
|
struct TransitionData
|
||||||
|
|
@ -726,15 +726,15 @@ class TSThread
|
||||||
TSIntegerSet oldScaleNodes; ///< nodes controlled by this thread pre-transition
|
TSIntegerSet oldScaleNodes; ///< nodes controlled by this thread pre-transition
|
||||||
U32 oldSequence; ///< sequence that was set before transition began
|
U32 oldSequence; ///< sequence that was set before transition began
|
||||||
F32 oldPos; ///< position of sequence before transition began
|
F32 oldPos; ///< position of sequence before transition began
|
||||||
} transitionData;
|
} mTransitionData;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
F32 start;
|
F32 start;
|
||||||
F32 end;
|
F32 end;
|
||||||
S32 loop;
|
S32 loop;
|
||||||
} path;
|
} mPath;
|
||||||
bool makePath;
|
bool mMakePath;
|
||||||
|
|
||||||
/// given a position on the thread, choose correct keyframes
|
/// given a position on the thread, choose correct keyframes
|
||||||
/// slight difference between one-shot and cyclic sequences -- see comments below for details
|
/// slight difference between one-shot and cyclic sequences -- see comments below for details
|
||||||
|
|
@ -783,10 +783,10 @@ class TSThread
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TSShapeInstance * getShapeInstance() { return mShapeInstance; }
|
TSShapeInstance * getShapeInstance() { return mShapeInstance; }
|
||||||
bool hasSequence() const { return sequence >= 0; }
|
bool hasSequence() const { return mSequence >= 0; }
|
||||||
U32 getSeqIndex() const { return sequence; }
|
U32 getSeqIndex() const { return mSequence; }
|
||||||
const TSSequence* getSequence() const { return &(mShapeInstance->mShape->mSequences[sequence]); }
|
const TSSequence* getSequence() const { return &(mShapeInstance->mShape->mSequences[mSequence]); }
|
||||||
const String& getSequenceName() const { return mShapeInstance->mShape->getSequenceName(sequence); }
|
const String& getSequenceName() const { return mShapeInstance->mShape->getSequenceName(mSequence); }
|
||||||
S32 operator<(const TSThread &) const;
|
S32 operator<(const TSThread &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -168,19 +168,19 @@ void TSThread::setSequence(S32 seq, F32 toPos)
|
||||||
|
|
||||||
mShapeInstance->clearTransition(this);
|
mShapeInstance->clearTransition(this);
|
||||||
|
|
||||||
sequence = seq;
|
mSequence = seq;
|
||||||
priority = getSequence()->priority;
|
mPriority = getSequence()->priority;
|
||||||
pos = toPos;
|
mPos = toPos;
|
||||||
makePath = getSequence()->makePath();
|
mMakePath = getSequence()->makePath();
|
||||||
path.start = path.end = 0;
|
mPath.start = mPath.end = 0;
|
||||||
path.loop = 0;
|
mPath.loop = 0;
|
||||||
|
|
||||||
// 1.0f doesn't exist on cyclic sequences
|
// 1.0f doesn't exist on cyclic sequences
|
||||||
if (pos>0.9999f && getSequence()->isCyclic())
|
if (mPos>0.9999f && getSequence()->isCyclic())
|
||||||
pos = 0.9999f;
|
mPos = 0.9999f;
|
||||||
|
|
||||||
// select keyframes
|
// select keyframes
|
||||||
selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos);
|
selectKeyframes(mPos,getSequence(),&mKeyNum1,&mKeyNum2,&mKeyPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool continuePlay)
|
void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool continuePlay)
|
||||||
|
|
@ -192,49 +192,49 @@ void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool conti
|
||||||
// of the transition is interpolated. If we start to transtion from A to B,
|
// of the transition is interpolated. If we start to transtion from A to B,
|
||||||
// but before reaching B we transtion to C, we interpolate all nodes controlled
|
// but before reaching B we transtion to C, we interpolate all nodes controlled
|
||||||
// by A, B, or C to their new position.
|
// by A, B, or C to their new position.
|
||||||
if (transitionData.inTransition)
|
if (mTransitionData.inTransition)
|
||||||
{
|
{
|
||||||
transitionData.oldRotationNodes.overlap(getSequence()->rotationMatters);
|
mTransitionData.oldRotationNodes.overlap(getSequence()->rotationMatters);
|
||||||
transitionData.oldTranslationNodes.overlap(getSequence()->translationMatters);
|
mTransitionData.oldTranslationNodes.overlap(getSequence()->translationMatters);
|
||||||
transitionData.oldScaleNodes.overlap(getSequence()->scaleMatters);
|
mTransitionData.oldScaleNodes.overlap(getSequence()->scaleMatters);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
transitionData.oldRotationNodes = getSequence()->rotationMatters;
|
mTransitionData.oldRotationNodes = getSequence()->rotationMatters;
|
||||||
transitionData.oldTranslationNodes = getSequence()->translationMatters;
|
mTransitionData.oldTranslationNodes = getSequence()->translationMatters;
|
||||||
transitionData.oldScaleNodes = getSequence()->scaleMatters;
|
mTransitionData.oldScaleNodes = getSequence()->scaleMatters;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set time characteristics of transition
|
// set time characteristics of transition
|
||||||
transitionData.oldSequence = sequence;
|
mTransitionData.oldSequence = mSequence;
|
||||||
transitionData.oldPos = pos;
|
mTransitionData.oldPos = mPos;
|
||||||
transitionData.duration = duration;
|
mTransitionData.duration = duration;
|
||||||
transitionData.pos = 0.0f;
|
mTransitionData.pos = 0.0f;
|
||||||
transitionData.direction = timeScale>0.0f ? 1.0f : -1.0f;
|
mTransitionData.direction = mTimeScale>0.0f ? 1.0f : -1.0f;
|
||||||
transitionData.targetScale = continuePlay ? 1.0f : 0.0f;
|
mTransitionData.targetScale = continuePlay ? 1.0f : 0.0f;
|
||||||
|
|
||||||
// in transition...
|
// in transition...
|
||||||
transitionData.inTransition = true;
|
mTransitionData.inTransition = true;
|
||||||
|
|
||||||
// set target sequence data
|
// set target sequence data
|
||||||
sequence = seq;
|
mSequence = seq;
|
||||||
priority = getSequence()->priority;
|
mPriority = getSequence()->priority;
|
||||||
pos = toPos;
|
mPos = toPos;
|
||||||
makePath = getSequence()->makePath();
|
mMakePath = getSequence()->makePath();
|
||||||
path.start = path.end = 0;
|
mPath.start = mPath.end = 0;
|
||||||
path.loop = 0;
|
mPath.loop = 0;
|
||||||
|
|
||||||
// 1.0f doesn't exist on cyclic sequences
|
// 1.0f doesn't exist on cyclic sequences
|
||||||
if (pos>0.9999f && getSequence()->isCyclic())
|
if (mPos>0.9999f && getSequence()->isCyclic())
|
||||||
pos = 0.9999f;
|
mPos = 0.9999f;
|
||||||
|
|
||||||
// select keyframes
|
// select keyframes
|
||||||
selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos);
|
selectKeyframes(mPos,getSequence(),&mKeyNum1,&mKeyNum2,&mKeyPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TSThread::isInTransition()
|
bool TSThread::isInTransition()
|
||||||
{
|
{
|
||||||
return transitionData.inTransition;
|
return mTransitionData.inTransition;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSThread::animateTriggers()
|
void TSThread::animateTriggers()
|
||||||
|
|
@ -242,30 +242,30 @@ void TSThread::animateTriggers()
|
||||||
if (!getSequence()->numTriggers)
|
if (!getSequence()->numTriggers)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (path.loop)
|
switch (mPath.loop)
|
||||||
{
|
{
|
||||||
case -1 :
|
case -1 :
|
||||||
activateTriggers(path.start,0);
|
activateTriggers(mPath.start,0);
|
||||||
activateTriggers(1,path.end);
|
activateTriggers(1,mPath.end);
|
||||||
break;
|
break;
|
||||||
case 0 :
|
case 0 :
|
||||||
activateTriggers(path.start,path.end);
|
activateTriggers(mPath.start,mPath.end);
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
activateTriggers(path.start,1);
|
activateTriggers(mPath.start,1);
|
||||||
activateTriggers(0,path.end);
|
activateTriggers(0,mPath.end);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (path.loop>0)
|
if (mPath.loop>0)
|
||||||
{
|
{
|
||||||
activateTriggers(path.end,1);
|
activateTriggers(mPath.end,1);
|
||||||
activateTriggers(0,path.end);
|
activateTriggers(0,mPath.end);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activateTriggers(path.end,0);
|
activateTriggers(mPath.end,0);
|
||||||
activateTriggers(1,path.end);
|
activateTriggers(1,mPath.end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -320,32 +320,32 @@ void TSThread::activateTriggers(F32 a, F32 b)
|
||||||
|
|
||||||
F32 TSThread::getPos()
|
F32 TSThread::getPos()
|
||||||
{
|
{
|
||||||
return transitionData.inTransition ? transitionData.pos : pos;
|
return mTransitionData.inTransition ? mTransitionData.pos : mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 TSThread::getTime()
|
F32 TSThread::getTime()
|
||||||
{
|
{
|
||||||
return transitionData.inTransition ? transitionData.pos * transitionData.duration : pos * getSequence()->duration;
|
return mTransitionData.inTransition ? mTransitionData.pos * mTransitionData.duration : mPos * getSequence()->duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 TSThread::getDuration()
|
F32 TSThread::getDuration()
|
||||||
{
|
{
|
||||||
return transitionData.inTransition ? transitionData.duration : getSequence()->duration;
|
return mTransitionData.inTransition ? mTransitionData.duration : getSequence()->duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 TSThread::getScaledDuration()
|
F32 TSThread::getScaledDuration()
|
||||||
{
|
{
|
||||||
return getDuration() / mFabs(timeScale);
|
return getDuration() / mFabs(mTimeScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 TSThread::getTimeScale()
|
F32 TSThread::getTimeScale()
|
||||||
{
|
{
|
||||||
return timeScale;
|
return mTimeScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSThread::setTimeScale(F32 ts)
|
void TSThread::setTimeScale(F32 ts)
|
||||||
{
|
{
|
||||||
timeScale = ts;
|
mTimeScale = ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSThread::advancePos(F32 delta)
|
void TSThread::advancePos(F32 delta)
|
||||||
|
|
@ -353,76 +353,76 @@ void TSThread::advancePos(F32 delta)
|
||||||
if (mFabs(delta)>0.00001f)
|
if (mFabs(delta)>0.00001f)
|
||||||
{
|
{
|
||||||
// make dirty what this thread changes
|
// make dirty what this thread changes
|
||||||
U32 dirtyFlags = getSequence()->dirtyFlags | (transitionData.inTransition ? TSShapeInstance::TransformDirty : 0);
|
U32 dirtyFlags = getSequence()->dirtyFlags | (mTransitionData.inTransition ? TSShapeInstance::TransformDirty : 0);
|
||||||
for (S32 i=0; i<mShapeInstance->getShape()->mSubShapeFirstNode.size(); i++)
|
for (S32 i=0; i<mShapeInstance->getShape()->mSubShapeFirstNode.size(); i++)
|
||||||
mShapeInstance->mDirtyFlags[i] |= dirtyFlags;
|
mShapeInstance->mDirtyFlags[i] |= dirtyFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transitionData.inTransition)
|
if (mTransitionData.inTransition)
|
||||||
{
|
{
|
||||||
transitionData.pos += transitionData.direction * delta;
|
mTransitionData.pos += mTransitionData.direction * delta;
|
||||||
if (transitionData.pos<0 || transitionData.pos>=1.0f)
|
if (mTransitionData.pos<0 || mTransitionData.pos>=1.0f)
|
||||||
{
|
{
|
||||||
mShapeInstance->clearTransition(this);
|
mShapeInstance->clearTransition(this);
|
||||||
if (transitionData.pos<0.0f)
|
if (mTransitionData.pos<0.0f)
|
||||||
// return to old sequence
|
// return to old sequence
|
||||||
mShapeInstance->setSequence(this,transitionData.oldSequence,transitionData.oldPos);
|
mShapeInstance->setSequence(this,mTransitionData.oldSequence,mTransitionData.oldPos);
|
||||||
}
|
}
|
||||||
// re-adjust delta to be correct time-wise
|
// re-adjust delta to be correct time-wise
|
||||||
delta *= transitionData.targetScale * transitionData.duration / getSequence()->duration;
|
delta *= mTransitionData.targetScale * mTransitionData.duration / getSequence()->duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
// even if we are in a transition, keep playing the sequence
|
// even if we are in a transition, keep playing the sequence
|
||||||
|
|
||||||
if (makePath)
|
if (mMakePath)
|
||||||
{
|
{
|
||||||
path.start = pos;
|
mPath.start = mPos;
|
||||||
pos += delta;
|
mPos += delta;
|
||||||
if (!getSequence()->isCyclic())
|
if (!getSequence()->isCyclic())
|
||||||
{
|
{
|
||||||
pos = mClampF(pos , 0.0f, 1.0f);
|
mPos = mClampF(mPos , 0.0f, 1.0f);
|
||||||
path.loop = 0;
|
mPath.loop = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
path.loop = (S32)pos;
|
mPath.loop = (S32)mPos;
|
||||||
if (pos < 0.0f)
|
if (mPos < 0.0f)
|
||||||
path.loop--;
|
mPath.loop--;
|
||||||
pos -= path.loop;
|
mPos -= mPath.loop;
|
||||||
// following necessary because of floating point roundoff errors
|
// following necessary because of floating point roundoff errors
|
||||||
if (pos < 0.0f) pos += 1.0f;
|
if (mPos < 0.0f) mPos += 1.0f;
|
||||||
if (pos >= 1.0f) pos -= 1.0f;
|
if (mPos >= 1.0f) mPos -= 1.0f;
|
||||||
}
|
}
|
||||||
path.end = pos;
|
mPath.end = mPos;
|
||||||
|
|
||||||
animateTriggers(); // do this automatically...no need for user to call it
|
animateTriggers(); // do this automatically...no need for user to call it
|
||||||
|
|
||||||
AssertFatal(pos>=0.0f && pos<=1.0f,"TSThread::advancePos (1)");
|
AssertFatal(mPos>=0.0f && mPos<=1.0f,"TSThread::advancePos (1)");
|
||||||
AssertFatal(!getSequence()->isCyclic() || pos<1.0f,"TSThread::advancePos (2)");
|
AssertFatal(!getSequence()->isCyclic() || mPos<1.0f,"TSThread::advancePos (2)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos += delta;
|
mPos += delta;
|
||||||
if (!getSequence()->isCyclic())
|
if (!getSequence()->isCyclic())
|
||||||
pos = mClampF(pos, 0.0f, 1.0f);
|
mPos = mClampF(mPos, 0.0f, 1.0f);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos -= S32(pos);
|
mPos -= S32(mPos);
|
||||||
// following necessary because of floating point roundoff errors
|
// following necessary because of floating point roundoff errors
|
||||||
if (pos < 0.0f) pos += 1.0f;
|
if (mPos < 0.0f) mPos += 1.0f;
|
||||||
if (pos >= 1.0f) pos -= 1.0f;
|
if (mPos >= 1.0f) mPos -= 1.0f;
|
||||||
}
|
}
|
||||||
AssertFatal(pos>=0.0f && pos<=1.0f,"TSThread::advancePos (3)");
|
AssertFatal(mPos>=0.0f && mPos<=1.0f,"TSThread::advancePos (3)");
|
||||||
AssertFatal(!getSequence()->isCyclic() || pos<1.0f,"TSThread::advancePos (4)");
|
AssertFatal(!getSequence()->isCyclic() || mPos<1.0f,"TSThread::advancePos (4)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// select keyframes
|
// select keyframes
|
||||||
selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos);
|
selectKeyframes(mPos,getSequence(),&mKeyNum1,&mKeyNum2,&mKeyPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSThread::advanceTime(F32 delta)
|
void TSThread::advanceTime(F32 delta)
|
||||||
{
|
{
|
||||||
advancePos(timeScale * delta / getDuration());
|
advancePos(mTimeScale * delta / getDuration());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSThread::setPos(F32 pos)
|
void TSThread::setPos(F32 pos)
|
||||||
|
|
@ -432,40 +432,40 @@ void TSThread::setPos(F32 pos)
|
||||||
|
|
||||||
void TSThread::setTime(F32 time)
|
void TSThread::setTime(F32 time)
|
||||||
{
|
{
|
||||||
setPos(timeScale * time/getDuration());
|
setPos(mTimeScale * time/getDuration());
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 TSThread::getKeyframeCount()
|
S32 TSThread::getKeyframeCount()
|
||||||
{
|
{
|
||||||
AssertFatal(!transitionData.inTransition,"TSThread::getKeyframeCount: not while in transition");
|
AssertFatal(!mTransitionData.inTransition,"TSThread::getKeyframeCount: not while in transition");
|
||||||
|
|
||||||
return getSequence()->numKeyframes + 1;
|
return getSequence()->numKeyframes + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 TSThread::getKeyframeNumber()
|
S32 TSThread::getKeyframeNumber()
|
||||||
{
|
{
|
||||||
AssertFatal(!transitionData.inTransition,"TSThread::getKeyframeNumber: not while in transition");
|
AssertFatal(!mTransitionData.inTransition,"TSThread::getKeyframeNumber: not while in transition");
|
||||||
|
|
||||||
return keyNum1;
|
return mKeyNum1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSThread::setKeyframeNumber(S32 kf)
|
void TSThread::setKeyframeNumber(S32 kf)
|
||||||
{
|
{
|
||||||
AssertFatal(kf>=0 && kf<= getSequence()->numKeyframes,
|
AssertFatal(kf>=0 && kf<= getSequence()->numKeyframes,
|
||||||
"TSThread::setKeyframeNumber: invalid frame specified.");
|
"TSThread::setKeyframeNumber: invalid frame specified.");
|
||||||
AssertFatal(!transitionData.inTransition,"TSThread::setKeyframeNumber: not while in transition");
|
AssertFatal(!mTransitionData.inTransition,"TSThread::setKeyframeNumber: not while in transition");
|
||||||
|
|
||||||
keyNum1 = keyNum2 = kf;
|
mKeyNum1 = mKeyNum2 = kf;
|
||||||
keyPos = 0;
|
mKeyPos = 0;
|
||||||
pos = 0;
|
mPos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSThread::TSThread(TSShapeInstance * _shapeInst)
|
TSThread::TSThread(TSShapeInstance * _shapeInst)
|
||||||
{
|
{
|
||||||
timeScale = 1.0f;
|
mTimeScale = 1.0f;
|
||||||
mShapeInstance = _shapeInst;
|
mShapeInstance = _shapeInst;
|
||||||
transitionData.inTransition = false;
|
mTransitionData.inTransition = false;
|
||||||
blendDisabled = false;
|
mBlendDisabled = false;
|
||||||
setSequence(0,0.0f);
|
setSequence(0,0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -475,9 +475,9 @@ S32 TSThread::operator<(const TSThread & th2) const
|
||||||
{
|
{
|
||||||
// both blend or neither blend, sort based on priority only -- higher priority first
|
// both blend or neither blend, sort based on priority only -- higher priority first
|
||||||
S32 ret = 0; // do it this way to (hopefully) take advantage of 'conditional move' assembly instruction
|
S32 ret = 0; // do it this way to (hopefully) take advantage of 'conditional move' assembly instruction
|
||||||
if (priority > th2.priority)
|
if (mPriority > th2.mPriority)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
if (th2.priority > priority)
|
if (th2.mPriority > mPriority)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -542,7 +542,7 @@ U32 TSShapeInstance::threadCount()
|
||||||
|
|
||||||
void TSShapeInstance::setSequence(TSThread * thread, S32 seq, F32 pos)
|
void TSShapeInstance::setSequence(TSThread * thread, S32 seq, F32 pos)
|
||||||
{
|
{
|
||||||
if ( (thread->transitionData.inTransition && mTransitionThreads.size()>1) || mTransitionThreads.size()>0)
|
if ( (thread->mTransitionData.inTransition && mTransitionThreads.size()>1) || mTransitionThreads.size()>0)
|
||||||
{
|
{
|
||||||
// if we have transitions, make sure transforms are up to date...
|
// if we have transitions, make sure transforms are up to date...
|
||||||
sortThreads();
|
sortThreads();
|
||||||
|
|
@ -565,7 +565,7 @@ U32 TSShapeInstance::getSequence(TSThread * thread)
|
||||||
{
|
{
|
||||||
//AssertFatal( thread->sequence >= 0, "TSShapeInstance::getSequence: range error A");
|
//AssertFatal( thread->sequence >= 0, "TSShapeInstance::getSequence: range error A");
|
||||||
//AssertFatal( thread->sequence < mShape->sequences.size(), "TSShapeInstance::getSequence: range error B");
|
//AssertFatal( thread->sequence < mShape->sequences.size(), "TSShapeInstance::getSequence: range error B");
|
||||||
return (U32)thread->sequence;
|
return (U32)thread->mSequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeInstance::transitionToSequence(TSThread * thread, S32 seq, F32 pos, F32 duration, bool continuePlay)
|
void TSShapeInstance::transitionToSequence(TSThread * thread, S32 seq, F32 pos, F32 duration, bool continuePlay)
|
||||||
|
|
@ -583,13 +583,13 @@ void TSShapeInstance::transitionToSequence(TSThread * thread, S32 seq, F32 pos,
|
||||||
else if (!mScaleCurrentlyAnimated && thread->getSequence()->animatesScale())
|
else if (!mScaleCurrentlyAnimated && thread->getSequence()->animatesScale())
|
||||||
mScaleCurrentlyAnimated=true;
|
mScaleCurrentlyAnimated=true;
|
||||||
|
|
||||||
mTransitionRotationNodes.overlap(thread->transitionData.oldRotationNodes);
|
mTransitionRotationNodes.overlap(thread->mTransitionData.oldRotationNodes);
|
||||||
mTransitionRotationNodes.overlap(thread->getSequence()->rotationMatters);
|
mTransitionRotationNodes.overlap(thread->getSequence()->rotationMatters);
|
||||||
|
|
||||||
mTransitionTranslationNodes.overlap(thread->transitionData.oldTranslationNodes);
|
mTransitionTranslationNodes.overlap(thread->mTransitionData.oldTranslationNodes);
|
||||||
mTransitionTranslationNodes.overlap(thread->getSequence()->translationMatters);
|
mTransitionTranslationNodes.overlap(thread->getSequence()->translationMatters);
|
||||||
|
|
||||||
mTransitionScaleNodes.overlap(thread->transitionData.oldScaleNodes);
|
mTransitionScaleNodes.overlap(thread->mTransitionData.oldScaleNodes);
|
||||||
mTransitionScaleNodes.overlap(thread->getSequence()->scaleMatters);
|
mTransitionScaleNodes.overlap(thread->getSequence()->scaleMatters);
|
||||||
|
|
||||||
// if we aren't already in the list of transition threads, add us now
|
// if we aren't already in the list of transition threads, add us now
|
||||||
|
|
@ -605,7 +605,7 @@ void TSShapeInstance::transitionToSequence(TSThread * thread, S32 seq, F32 pos,
|
||||||
|
|
||||||
void TSShapeInstance::clearTransition(TSThread * thread)
|
void TSShapeInstance::clearTransition(TSThread * thread)
|
||||||
{
|
{
|
||||||
if (!thread->transitionData.inTransition)
|
if (!thread->mTransitionData.inTransition)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if other transitions are still playing,
|
// if other transitions are still playing,
|
||||||
|
|
@ -614,7 +614,7 @@ void TSShapeInstance::clearTransition(TSThread * thread)
|
||||||
animateNodeSubtrees();
|
animateNodeSubtrees();
|
||||||
|
|
||||||
// turn off transition...
|
// turn off transition...
|
||||||
thread->transitionData.inTransition = false;
|
thread->mTransitionData.inTransition = false;
|
||||||
|
|
||||||
// remove us from transition list
|
// remove us from transition list
|
||||||
S32 i;
|
S32 i;
|
||||||
|
|
@ -632,13 +632,13 @@ void TSShapeInstance::clearTransition(TSThread * thread)
|
||||||
mTransitionScaleNodes.clearAll();
|
mTransitionScaleNodes.clearAll();
|
||||||
for (i=0; i<mTransitionThreads.size(); i++)
|
for (i=0; i<mTransitionThreads.size(); i++)
|
||||||
{
|
{
|
||||||
mTransitionRotationNodes.overlap(mTransitionThreads[i]->transitionData.oldRotationNodes);
|
mTransitionRotationNodes.overlap(mTransitionThreads[i]->mTransitionData.oldRotationNodes);
|
||||||
mTransitionRotationNodes.overlap(mTransitionThreads[i]->getSequence()->rotationMatters);
|
mTransitionRotationNodes.overlap(mTransitionThreads[i]->getSequence()->rotationMatters);
|
||||||
|
|
||||||
mTransitionTranslationNodes.overlap(mTransitionThreads[i]->transitionData.oldTranslationNodes);
|
mTransitionTranslationNodes.overlap(mTransitionThreads[i]->mTransitionData.oldTranslationNodes);
|
||||||
mTransitionTranslationNodes.overlap(mTransitionThreads[i]->getSequence()->translationMatters);
|
mTransitionTranslationNodes.overlap(mTransitionThreads[i]->getSequence()->translationMatters);
|
||||||
|
|
||||||
mTransitionScaleNodes.overlap(mTransitionThreads[i]->transitionData.oldScaleNodes);
|
mTransitionScaleNodes.overlap(mTransitionThreads[i]->mTransitionData.oldScaleNodes);
|
||||||
mTransitionScaleNodes.overlap(mTransitionThreads[i]->getSequence()->scaleMatters);
|
mTransitionScaleNodes.overlap(mTransitionThreads[i]->getSequence()->scaleMatters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -709,10 +709,10 @@ void TSShapeInstance::updateTransitions()
|
||||||
for (i=0; i<mTransitionThreads.size(); i++)
|
for (i=0; i<mTransitionThreads.size(); i++)
|
||||||
{
|
{
|
||||||
TSThread * th = mTransitionThreads[i];
|
TSThread * th = mTransitionThreads[i];
|
||||||
if (th->transitionData.inTransition)
|
if (th->mTransitionData.inTransition)
|
||||||
{
|
{
|
||||||
th->transitionData.duration *= 1.0f - th->transitionData.pos;
|
th->mTransitionData.duration *= 1.0f - th->mTransitionData.pos;
|
||||||
th->transitionData.pos = 0.0f;
|
th->mTransitionData.pos = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -728,22 +728,22 @@ void TSShapeInstance::checkScaleCurrentlyAnimated()
|
||||||
|
|
||||||
void TSShapeInstance::setBlendEnabled(TSThread * thread, bool blendOn)
|
void TSShapeInstance::setBlendEnabled(TSThread * thread, bool blendOn)
|
||||||
{
|
{
|
||||||
thread->blendDisabled = !blendOn;
|
thread->mBlendDisabled = !blendOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TSShapeInstance::getBlendEnabled(TSThread * thread)
|
bool TSShapeInstance::getBlendEnabled(TSThread * thread)
|
||||||
{
|
{
|
||||||
return !thread->blendDisabled;
|
return !thread->mBlendDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeInstance::setPriority(TSThread * thread, F32 priority)
|
void TSShapeInstance::setPriority(TSThread * thread, F32 priority)
|
||||||
{
|
{
|
||||||
thread->priority = priority;
|
thread->mPriority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 TSShapeInstance::getPriority(TSThread * thread)
|
F32 TSShapeInstance::getPriority(TSThread * thread)
|
||||||
{
|
{
|
||||||
return thread->priority;
|
return thread->mPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 TSShapeInstance::getTime(TSThread * thread)
|
F32 TSShapeInstance::getTime(TSThread * thread)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue