mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-26 10:03:48 +00:00
Issue found with PVS-Studio:
Many instances of a function or expression being used repeatedly, which can lower performance. Fixed it in these cases by creating on local var, reference or pointer that's used instead.
This commit is contained in:
parent
ec63398042
commit
2002d74b78
38 changed files with 465 additions and 371 deletions
|
|
@ -283,11 +283,12 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu
|
|||
|
||||
// Create the 3space node
|
||||
shape->nodes.increment();
|
||||
shape->nodes.last().nameIndex = shape->addName(nodeName);
|
||||
shape->nodes.last().parentIndex = parentIndex;
|
||||
shape->nodes.last().firstObject = -1;
|
||||
shape->nodes.last().firstChild = -1;
|
||||
shape->nodes.last().nextSibling = -1;
|
||||
TSShape::Node& lastNode = shape->nodes.last();
|
||||
lastNode.nameIndex = shape->addName(nodeName);
|
||||
lastNode.parentIndex = parentIndex;
|
||||
lastNode.firstObject = -1;
|
||||
lastNode.firstChild = -1;
|
||||
lastNode.nextSibling = -1;
|
||||
|
||||
// Add the AppNode to a matching list (so AppNodes can be accessed using 3space
|
||||
// node indices)
|
||||
|
|
@ -323,12 +324,14 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu
|
|||
appNode->getBool("BB::INCLUDE_POLES", includePoles);
|
||||
|
||||
S32 detIndex = shape->addDetail( "bbDetail", size, -1 );
|
||||
shape->details[detIndex].bbEquatorSteps = numEquatorSteps;
|
||||
shape->details[detIndex].bbPolarSteps = numPolarSteps;
|
||||
shape->details[detIndex].bbDetailLevel = dl;
|
||||
shape->details[detIndex].bbDimension = dim;
|
||||
shape->details[detIndex].bbIncludePoles = includePoles;
|
||||
shape->details[detIndex].bbPolarAngle = polarAngle;
|
||||
|
||||
TSShape::Detail& detIndexDetail = shape->details[detIndex];
|
||||
detIndexDetail.bbEquatorSteps = numEquatorSteps;
|
||||
detIndexDetail.bbPolarSteps = numPolarSteps;
|
||||
detIndexDetail.bbDetailLevel = dl;
|
||||
detIndexDetail.bbDimension = dim;
|
||||
detIndexDetail.bbIncludePoles = includePoles;
|
||||
detIndexDetail.bbPolarAngle = polarAngle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -462,10 +465,11 @@ void TSShapeLoader::generateObjects()
|
|||
if (!lastName || (meshNames[iMesh] != *lastName))
|
||||
{
|
||||
shape->objects.increment();
|
||||
shape->objects.last().nameIndex = shape->addName(meshNames[iMesh]);
|
||||
shape->objects.last().nodeIndex = subshape->objNodes[iMesh];
|
||||
shape->objects.last().startMeshIndex = appMeshes.size();
|
||||
shape->objects.last().numMeshes = 0;
|
||||
TSShape::Object& lastObject = shape->objects.last();
|
||||
lastObject.nameIndex = shape->addName(meshNames[iMesh]);
|
||||
lastObject.nodeIndex = subshape->objNodes[iMesh];
|
||||
lastObject.startMeshIndex = appMeshes.size();
|
||||
lastObject.numMeshes = 0;
|
||||
lastName = &meshNames[iMesh];
|
||||
}
|
||||
|
||||
|
|
@ -1190,10 +1194,12 @@ void TSShapeLoader::install()
|
|||
shape->meshes.push_back(NULL);
|
||||
|
||||
shape->objects.increment();
|
||||
shape->objects.last().nameIndex = shape->addName("dummy");
|
||||
shape->objects.last().nodeIndex = 0;
|
||||
shape->objects.last().startMeshIndex = 0;
|
||||
shape->objects.last().numMeshes = 1;
|
||||
|
||||
TSShape::Object& lastObject = shape->objects.last();
|
||||
lastObject.nameIndex = shape->addName("dummy");
|
||||
lastObject.nodeIndex = 0;
|
||||
lastObject.startMeshIndex = 0;
|
||||
lastObject.numMeshes = 1;
|
||||
|
||||
shape->objectStates.increment();
|
||||
shape->objectStates.last().frameIndex = 0;
|
||||
|
|
|
|||
|
|
@ -88,16 +88,18 @@ void TSShapeInstance::animateNodes(S32 ss)
|
|||
{
|
||||
TSThread * th = mThreadList[i];
|
||||
|
||||
if (th->getSequence()->isBlend())
|
||||
const TSShape::Sequence* threadSequence = th->getSequence();
|
||||
|
||||
if (threadSequence->isBlend())
|
||||
{
|
||||
// blend sequences need default (if not set by other sequence)
|
||||
// break rather than continue because the rest will be blends too
|
||||
firstBlend = i;
|
||||
break;
|
||||
}
|
||||
rotBeenSet.takeAway(th->getSequence()->rotationMatters);
|
||||
tranBeenSet.takeAway(th->getSequence()->translationMatters);
|
||||
scaleBeenSet.takeAway(th->getSequence()->scaleMatters);
|
||||
rotBeenSet.takeAway(threadSequence->rotationMatters);
|
||||
tranBeenSet.takeAway(threadSequence->translationMatters);
|
||||
scaleBeenSet.takeAway(threadSequence->scaleMatters);
|
||||
}
|
||||
rotBeenSet.takeAway(mCallbackNodes);
|
||||
rotBeenSet.takeAway(mHandsOffNodes);
|
||||
|
|
@ -576,9 +578,12 @@ void TSShapeInstance::handleBlendSequence(TSThread * thread, S32 a, S32 b)
|
|||
S32 jrot=0;
|
||||
S32 jtrans=0;
|
||||
S32 jscale=0;
|
||||
TSIntegerSet nodeMatters = thread->getSequence()->translationMatters;
|
||||
nodeMatters.overlap(thread->getSequence()->rotationMatters);
|
||||
nodeMatters.overlap(thread->getSequence()->scaleMatters);
|
||||
|
||||
const TSShape::Sequence* threadSequence = thread->getSequence();
|
||||
|
||||
TSIntegerSet nodeMatters = threadSequence->translationMatters;
|
||||
nodeMatters.overlap(threadSequence->rotationMatters);
|
||||
nodeMatters.overlap(threadSequence->scaleMatters);
|
||||
nodeMatters.takeAway(mHandsOffNodes);
|
||||
S32 start = nodeMatters.start();
|
||||
S32 end = b;
|
||||
|
|
@ -587,50 +592,50 @@ void TSShapeInstance::handleBlendSequence(TSThread * thread, S32 a, S32 b)
|
|||
// skip nodes outside of this detail
|
||||
if (start<a || mDisableBlendNodes.test(nodeIndex))
|
||||
{
|
||||
if (thread->getSequence()->rotationMatters.test(nodeIndex))
|
||||
if (threadSequence->rotationMatters.test(nodeIndex))
|
||||
jrot++;
|
||||
if (thread->getSequence()->translationMatters.test(nodeIndex))
|
||||
if (threadSequence->translationMatters.test(nodeIndex))
|
||||
jtrans++;
|
||||
if (thread->getSequence()->scaleMatters.test(nodeIndex))
|
||||
if (threadSequence->scaleMatters.test(nodeIndex))
|
||||
jscale++;
|
||||
continue;
|
||||
}
|
||||
|
||||
MatrixF mat(true);
|
||||
if (thread->getSequence()->rotationMatters.test(nodeIndex))
|
||||
if (threadSequence->rotationMatters.test(nodeIndex))
|
||||
{
|
||||
QuatF q1,q2;
|
||||
mShape->getRotation(*thread->getSequence(),thread->keyNum1,jrot,&q1);
|
||||
mShape->getRotation(*thread->getSequence(),thread->keyNum2,jrot,&q2);
|
||||
mShape->getRotation(*threadSequence,thread->keyNum1,jrot,&q1);
|
||||
mShape->getRotation(*threadSequence,thread->keyNum2,jrot,&q2);
|
||||
QuatF quat;
|
||||
TSTransform::interpolate(q1,q2,thread->keyPos,&quat);
|
||||
TSTransform::setMatrix(quat,&mat);
|
||||
jrot++;
|
||||
}
|
||||
|
||||
if (thread->getSequence()->translationMatters.test(nodeIndex))
|
||||
if (threadSequence->translationMatters.test(nodeIndex))
|
||||
{
|
||||
const Point3F & p1 = mShape->getTranslation(*thread->getSequence(),thread->keyNum1,jtrans);
|
||||
const Point3F & p2 = mShape->getTranslation(*thread->getSequence(),thread->keyNum2,jtrans);
|
||||
const Point3F & p1 = mShape->getTranslation(*threadSequence,thread->keyNum1,jtrans);
|
||||
const Point3F & p2 = mShape->getTranslation(*threadSequence,thread->keyNum2,jtrans);
|
||||
Point3F p;
|
||||
TSTransform::interpolate(p1,p2,thread->keyPos,&p);
|
||||
mat.setColumn(3,p);
|
||||
jtrans++;
|
||||
}
|
||||
|
||||
if (thread->getSequence()->scaleMatters.test(nodeIndex))
|
||||
if (threadSequence->scaleMatters.test(nodeIndex))
|
||||
{
|
||||
if (thread->getSequence()->animatesUniformScale())
|
||||
if (threadSequence->animatesUniformScale())
|
||||
{
|
||||
F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum1,jscale);
|
||||
F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum2,jscale);
|
||||
F32 s1 = mShape->getUniformScale(*threadSequence,thread->keyNum1,jscale);
|
||||
F32 s2 = mShape->getUniformScale(*threadSequence,thread->keyNum2,jscale);
|
||||
F32 scale = TSTransform::interpolate(s1,s2,thread->keyPos);
|
||||
TSTransform::applyScale(scale,&mat);
|
||||
}
|
||||
else if (animatesAlignedScale())
|
||||
{
|
||||
Point3F s1 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum1,jscale);
|
||||
Point3F s2 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum2,jscale);
|
||||
Point3F s1 = mShape->getAlignedScale(*threadSequence,thread->keyNum1,jscale);
|
||||
Point3F s2 = mShape->getAlignedScale(*threadSequence,thread->keyNum2,jscale);
|
||||
Point3F scale;
|
||||
TSTransform::interpolate(s1,s2,thread->keyPos,&scale);
|
||||
TSTransform::applyScale(scale,&mat);
|
||||
|
|
@ -638,8 +643,8 @@ void TSShapeInstance::handleBlendSequence(TSThread * thread, S32 a, S32 b)
|
|||
else
|
||||
{
|
||||
TSScale s1,s2;
|
||||
mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum1,jscale,&s1);
|
||||
mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum2,jscale,&s2);
|
||||
mShape->getArbitraryScale(*threadSequence,thread->keyNum1,jscale,&s1);
|
||||
mShape->getArbitraryScale(*threadSequence,thread->keyNum2,jscale,&s2);
|
||||
TSScale scale;
|
||||
TSTransform::interpolate(s1,s2,thread->keyPos,&scale);
|
||||
TSTransform::applyScale(scale,&mat);
|
||||
|
|
@ -686,15 +691,17 @@ void TSShapeInstance::animateVisibility(S32 ss)
|
|||
{
|
||||
TSThread * th = mThreadList[i];
|
||||
|
||||
const TSShape::Sequence* threadSequence = th->getSequence();
|
||||
|
||||
// For better or worse, object states are stored together (frame,
|
||||
// matFrame, visibility all in one structure). Thus, indexing into
|
||||
// object state array for animation for any of these attributes needs to
|
||||
// take into account whether or not the other attributes are also animated.
|
||||
// The object states should eventually be separated (like the node states were)
|
||||
// in order to save memory and save the following step.
|
||||
TSIntegerSet objectMatters = th->getSequence()->frameMatters;
|
||||
objectMatters.overlap(th->getSequence()->matFrameMatters);
|
||||
objectMatters.overlap(th->getSequence()->visMatters);
|
||||
TSIntegerSet objectMatters = threadSequence->frameMatters;
|
||||
objectMatters.overlap(threadSequence->matFrameMatters);
|
||||
objectMatters.overlap(threadSequence->visMatters);
|
||||
|
||||
// skip to beginning of this sub-shape
|
||||
S32 j=0;
|
||||
|
|
@ -702,10 +709,10 @@ void TSShapeInstance::animateVisibility(S32 ss)
|
|||
S32 end = b;
|
||||
for (S32 objectIndex = start; objectIndex<end; objectMatters.next(objectIndex), j++)
|
||||
{
|
||||
if (!beenSet.test(objectIndex) && th->getSequence()->visMatters.test(objectIndex))
|
||||
if (!beenSet.test(objectIndex) && threadSequence->visMatters.test(objectIndex))
|
||||
{
|
||||
F32 state1 = mShape->getObjectState(*th->getSequence(),th->keyNum1,j).vis;
|
||||
F32 state2 = mShape->getObjectState(*th->getSequence(),th->keyNum2,j).vis;
|
||||
F32 state1 = mShape->getObjectState(*threadSequence,th->keyNum1,j).vis;
|
||||
F32 state2 = mShape->getObjectState(*threadSequence,th->keyNum2,j).vis;
|
||||
if ((state1-state2) * (state1-state2) > 0.99f)
|
||||
// goes from 0 to 1 -- discreet jump
|
||||
mMeshObjects[objectIndex].visible = th->keyPos<0.5f ? state1 : state2;
|
||||
|
|
@ -747,15 +754,17 @@ void TSShapeInstance::animateFrame(S32 ss)
|
|||
{
|
||||
TSThread * th = mThreadList[i];
|
||||
|
||||
const TSShape::Sequence* threadSequence = th->getSequence();
|
||||
|
||||
// For better or worse, object states are stored together (frame,
|
||||
// matFrame, visibility all in one structure). Thus, indexing into
|
||||
// object state array for animation for any of these attributes needs to
|
||||
// take into account whether or not the other attributes are also animated.
|
||||
// The object states should eventually be separated (like the node states were)
|
||||
// in order to save memory and save the following step.
|
||||
TSIntegerSet objectMatters = th->getSequence()->frameMatters;
|
||||
objectMatters.overlap(th->getSequence()->matFrameMatters);
|
||||
objectMatters.overlap(th->getSequence()->visMatters);
|
||||
TSIntegerSet objectMatters = threadSequence->frameMatters;
|
||||
objectMatters.overlap(threadSequence->matFrameMatters);
|
||||
objectMatters.overlap(threadSequence->visMatters);
|
||||
|
||||
// skip to beginning of this sub-shape
|
||||
S32 j=0;
|
||||
|
|
@ -763,10 +772,10 @@ void TSShapeInstance::animateFrame(S32 ss)
|
|||
S32 end = b;
|
||||
for (S32 objectIndex = start; objectIndex<end; objectMatters.next(objectIndex), j++)
|
||||
{
|
||||
if (!beenSet.test(objectIndex) && th->getSequence()->frameMatters.test(objectIndex))
|
||||
if (!beenSet.test(objectIndex) && threadSequence->frameMatters.test(objectIndex))
|
||||
{
|
||||
S32 key = (th->keyPos<0.5f) ? th->keyNum1 : th->keyNum2;
|
||||
mMeshObjects[objectIndex].frame = mShape->getObjectState(*th->getSequence(),key,j).frameIndex;
|
||||
mMeshObjects[objectIndex].frame = mShape->getObjectState(*threadSequence,key,j).frameIndex;
|
||||
|
||||
// record change so that later threads don't over-write us...
|
||||
beenSet.set(objectIndex);
|
||||
|
|
@ -802,15 +811,17 @@ void TSShapeInstance::animateMatFrame(S32 ss)
|
|||
{
|
||||
TSThread * th = mThreadList[i];
|
||||
|
||||
const TSShape::Sequence* threadSequence = th->getSequence();
|
||||
|
||||
// For better or worse, object states are stored together (frame,
|
||||
// matFrame, visibility all in one structure). Thus, indexing into
|
||||
// object state array for animation for any of these attributes needs to
|
||||
// take into account whether or not the other attributes are also animated.
|
||||
// The object states should eventually be separated (like the node states were)
|
||||
// in order to save memory and save the following step.
|
||||
TSIntegerSet objectMatters = th->getSequence()->frameMatters;
|
||||
objectMatters.overlap(th->getSequence()->matFrameMatters);
|
||||
objectMatters.overlap(th->getSequence()->visMatters);
|
||||
TSIntegerSet objectMatters = threadSequence->frameMatters;
|
||||
objectMatters.overlap(threadSequence->matFrameMatters);
|
||||
objectMatters.overlap(threadSequence->visMatters);
|
||||
|
||||
// skip to beginining of this sub-shape
|
||||
S32 j=0;
|
||||
|
|
@ -818,10 +829,10 @@ void TSShapeInstance::animateMatFrame(S32 ss)
|
|||
S32 end = b;
|
||||
for (S32 objectIndex = start; objectIndex<end; objectMatters.next(objectIndex), j++)
|
||||
{
|
||||
if (!beenSet.test(objectIndex) && th->getSequence()->matFrameMatters.test(objectIndex))
|
||||
if (!beenSet.test(objectIndex) && threadSequence->matFrameMatters.test(objectIndex))
|
||||
{
|
||||
S32 key = (th->keyPos<0.5f) ? th->keyNum1 : th->keyNum2;
|
||||
mMeshObjects[objectIndex].matFrame = mShape->getObjectState(*th->getSequence(),key,j).matFrameIndex;
|
||||
mMeshObjects[objectIndex].matFrame = mShape->getObjectState(*threadSequence,key,j).matFrameIndex;
|
||||
|
||||
// record change so that later threads don't over-write us...
|
||||
beenSet.set(objectIndex);
|
||||
|
|
|
|||
|
|
@ -171,19 +171,21 @@ void TSShapeInstance::dump(Stream & stream)
|
|||
bool foundSkin = false;
|
||||
for (i=0; i<mShape->objects.size(); i++)
|
||||
{
|
||||
if (mShape->objects[i].nodeIndex<0) // must be a skin
|
||||
TSShape::Object& currentObject = mShape->objects[i];
|
||||
|
||||
if (currentObject.nodeIndex<0) // must be a skin
|
||||
{
|
||||
if (!foundSkin)
|
||||
dumpLine("\r\n Skins:\r\n");
|
||||
foundSkin=true;
|
||||
const char * skinName = "";
|
||||
S32 nameIndex = mShape->objects[i].nameIndex;
|
||||
S32 nameIndex = currentObject.nameIndex;
|
||||
if (nameIndex>=0)
|
||||
skinName = mShape->getName(nameIndex);
|
||||
dumpLine(avar(" Skin %s with following details: ",skinName));
|
||||
for (S32 num=0; num<mShape->objects[i].numMeshes; num++)
|
||||
for (S32 num=0; num<currentObject.numMeshes; num++)
|
||||
{
|
||||
if (mShape->meshes[mShape->objects[i].startMeshIndex + num])
|
||||
if (mShape->meshes[currentObject.startMeshIndex + num])
|
||||
dumpLine(avar(" %i",(S32)mShape->details[num].size));
|
||||
}
|
||||
dumpLine("\r\n");
|
||||
|
|
|
|||
|
|
@ -447,11 +447,13 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF
|
|||
cf->mVertexList[base + indices[start + j + 2]]);
|
||||
|
||||
cf->mFaceList.increment();
|
||||
cf->mFaceList.last().normal = plane;
|
||||
|
||||
cf->mFaceList.last().vertex[0] = base + indices[start + j + 0];
|
||||
cf->mFaceList.last().vertex[1] = base + indices[start + j + 1];
|
||||
cf->mFaceList.last().vertex[2] = base + indices[start + j + 2];
|
||||
ConvexFeature::Face& lastFace = cf->mFaceList.last();
|
||||
lastFace.normal = plane;
|
||||
|
||||
lastFace.vertex[0] = base + indices[start + j + 0];
|
||||
lastFace.vertex[1] = base + indices[start + j + 1];
|
||||
lastFace.vertex[2] = base + indices[start + j + 2];
|
||||
|
||||
for ( U32 l = 0; l < 3; l++ )
|
||||
{
|
||||
|
|
@ -514,8 +516,9 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF
|
|||
S32 k;
|
||||
for ( k = 0; k < cf->mEdgeList.size(); k++ )
|
||||
{
|
||||
if ( cf->mEdgeList[k].vertex[0] == newEdge0 &&
|
||||
cf->mEdgeList[k].vertex[1] == newEdge1)
|
||||
ConvexFeature::Edge currentEdge = cf->mEdgeList[k];
|
||||
if (currentEdge.vertex[0] == newEdge0 &&
|
||||
currentEdge.vertex[1] == newEdge1)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
|
|
@ -1437,10 +1440,12 @@ void TSSkinMesh::createBatchData()
|
|||
}
|
||||
|
||||
bt->_tmpVec->increment();
|
||||
bt->_tmpVec->last().vert = batchData.initialVerts[curTransform.vertexIndex];
|
||||
bt->_tmpVec->last().normal = batchData.initialNorms[curTransform.vertexIndex];
|
||||
bt->_tmpVec->last().weight = transformOp.weight;
|
||||
bt->_tmpVec->last().vidx = curTransform.vertexIndex;
|
||||
|
||||
BatchData::BatchedVertWeight& tempLast = bt->_tmpVec->last();
|
||||
tempLast.vert = batchData.initialVerts[curTransform.vertexIndex];
|
||||
tempLast.normal = batchData.initialNorms[curTransform.vertexIndex];
|
||||
tempLast.weight = transformOp.weight;
|
||||
tempLast.vidx = curTransform.vertexIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -443,10 +443,11 @@ void MeshFit::addSphere( F32 radius, const Point3F& center )
|
|||
mesh->computeBounds();
|
||||
|
||||
mMeshes.increment();
|
||||
mMeshes.last().type = MeshFit::Sphere;
|
||||
mMeshes.last().transform.identity();
|
||||
mMeshes.last().transform.setPosition( center );
|
||||
mMeshes.last().tsmesh = mesh;
|
||||
MeshFit::Mesh& lastMesh = mMeshes.last();
|
||||
lastMesh.type = MeshFit::Sphere;
|
||||
lastMesh.transform.identity();
|
||||
lastMesh.transform.setPosition(center);
|
||||
lastMesh.tsmesh = mesh;
|
||||
}
|
||||
|
||||
void MeshFit::fitSphere()
|
||||
|
|
@ -603,11 +604,12 @@ void MeshFit::fitK_DOP( const Vector<Point3F>& planes )
|
|||
|
||||
// Create TSMesh from convex hull
|
||||
mMeshes.increment();
|
||||
mMeshes.last().type = MeshFit::Hull;
|
||||
mMeshes.last().transform.identity();
|
||||
mMeshes.last().tsmesh = createTriMesh( result.mOutputVertices, result.mNumOutputVertices,
|
||||
MeshFit::Mesh& lastMesh = mMeshes.last();
|
||||
lastMesh.type = MeshFit::Hull;
|
||||
lastMesh.transform.identity();
|
||||
lastMesh.tsmesh = createTriMesh(result.mOutputVertices, result.mNumOutputVertices,
|
||||
result.mIndices, result.mNumFaces );
|
||||
mMeshes.last().tsmesh->computeBounds();
|
||||
lastMesh.tsmesh->computeBounds();
|
||||
}
|
||||
|
||||
//---------------------------
|
||||
|
|
@ -702,10 +704,11 @@ void MeshFit::fitConvexHulls( U32 depth, F32 mergeThreshold, F32 concavityThresh
|
|||
{
|
||||
// Create TSMesh from convex hull
|
||||
mMeshes.increment();
|
||||
mMeshes.last().type = MeshFit::Hull;
|
||||
mMeshes.last().transform.identity();
|
||||
mMeshes.last().tsmesh = createTriMesh( result.mVertices, result.mVcount, result.mIndices, result.mTcount );
|
||||
mMeshes.last().tsmesh->computeBounds();
|
||||
MeshFit::Mesh& lastMesh = mMeshes.last();
|
||||
lastMesh.type = MeshFit::Hull;
|
||||
lastMesh.transform.identity();
|
||||
lastMesh.tsmesh = createTriMesh(result.mVertices, result.mVcount, result.mIndices, result.mTcount);
|
||||
lastMesh.tsmesh->computeBounds();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -286,13 +286,15 @@ void TSThread::activateTriggers(F32 a, F32 b)
|
|||
S32 bIndex = numTriggers+firstTrigger; // initialized to handle case where pos past all triggers
|
||||
for (i=firstTrigger; i<numTriggers+firstTrigger; i++)
|
||||
{
|
||||
TSShape::Trigger currentTrigger = shape->triggers[i];
|
||||
|
||||
// is a between this trigger and previous one...
|
||||
if (a>lastPos && a<=shape->triggers[i].pos)
|
||||
if (a>lastPos && a <= currentTrigger.pos)
|
||||
aIndex = i;
|
||||
// is b between this trigger and previous one...
|
||||
if (b>lastPos && b<=shape->triggers[i].pos)
|
||||
if (b>lastPos && b <= currentTrigger.pos)
|
||||
bIndex = i;
|
||||
lastPos = shape->triggers[i].pos;
|
||||
lastPos = currentTrigger.pos;
|
||||
}
|
||||
|
||||
// activate triggers between aIndex and bIndex (depends on direction)
|
||||
|
|
@ -578,19 +580,21 @@ void TSShapeInstance::transitionToSequence(TSThread * thread, S32 seq, F32 pos,
|
|||
setDirty(AllDirtyMask);
|
||||
mGroundThread = NULL;
|
||||
|
||||
if (mScaleCurrentlyAnimated && !thread->getSequence()->animatesScale())
|
||||
const TSShape::Sequence* threadSequence = thread->getSequence();
|
||||
|
||||
if (mScaleCurrentlyAnimated && !threadSequence->animatesScale())
|
||||
checkScaleCurrentlyAnimated();
|
||||
else if (!mScaleCurrentlyAnimated && thread->getSequence()->animatesScale())
|
||||
else if (!mScaleCurrentlyAnimated && threadSequence->animatesScale())
|
||||
mScaleCurrentlyAnimated=true;
|
||||
|
||||
mTransitionRotationNodes.overlap(thread->transitionData.oldRotationNodes);
|
||||
mTransitionRotationNodes.overlap(thread->getSequence()->rotationMatters);
|
||||
mTransitionRotationNodes.overlap(threadSequence->rotationMatters);
|
||||
|
||||
mTransitionTranslationNodes.overlap(thread->transitionData.oldTranslationNodes);
|
||||
mTransitionTranslationNodes.overlap(thread->getSequence()->translationMatters);
|
||||
mTransitionTranslationNodes.overlap(threadSequence->translationMatters);
|
||||
|
||||
mTransitionScaleNodes.overlap(thread->transitionData.oldScaleNodes);
|
||||
mTransitionScaleNodes.overlap(thread->getSequence()->scaleMatters);
|
||||
mTransitionScaleNodes.overlap(threadSequence->scaleMatters);
|
||||
|
||||
// if we aren't already in the list of transition threads, add us now
|
||||
S32 i;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue