many *many* generic is and js

This commit is contained in:
Azaezel 2018-03-13 00:57:31 -05:00
parent f10e5d5933
commit f08339c534
2 changed files with 29 additions and 29 deletions

View file

@ -566,8 +566,8 @@ void TSShape::initObjects()
if (accel != NULL) { if (accel != NULL) {
delete[] accel->vertexList; delete[] accel->vertexList;
delete[] accel->normalList; delete[] accel->normalList;
for (S32 j = 0; j < accel->numVerts; j++) for (S32 vertID = 0; vertID < accel->numVerts; vertID++)
delete[] accel->emitStrings[j]; delete[] accel->emitStrings[vertID];
delete[] accel->emitStrings; delete[] accel->emitStrings;
delete accel; delete accel;
} }
@ -683,9 +683,9 @@ void TSShape::initVertexBuffers()
U32 vertsInBuffer = mShapeVertexData.size / mVertexSize; U32 vertsInBuffer = mShapeVertexData.size / mVertexSize;
U32 indsInBuffer = ibIndices - indicesStart; U32 indsInBuffer = ibIndices - indicesStart;
for (U32 i = 0; i < primStart; i++) for (U32 primID = 0; primID < primStart; primID++)
{ {
GFXPrimitive &prim = mShapeVertexIndices->mPrimitiveArray[i]; GFXPrimitive &prim = mShapeVertexIndices->mPrimitiveArray[primID];
if (prim.type != GFXTriangleList && prim.type != GFXTriangleStrip) if (prim.type != GFXTriangleList && prim.type != GFXTriangleStrip)
{ {
@ -1303,10 +1303,10 @@ void TSShape::assembleShape()
S32 oldSz = groundTranslations.size(); S32 oldSz = groundTranslations.size();
groundTranslations.setSize(oldSz+seq.numGroundFrames); groundTranslations.setSize(oldSz+seq.numGroundFrames);
groundRotations.setSize(oldSz+seq.numGroundFrames); groundRotations.setSize(oldSz+seq.numGroundFrames);
for (S32 j=0;j<seq.numGroundFrames;j++) for (S32 groundFrm =0; groundFrm<seq.numGroundFrames; groundFrm++)
{ {
groundTranslations[j+oldSz] = nodeTranslations[seq.firstGroundFrame+j-numNodes]; groundTranslations[groundFrm +oldSz] = nodeTranslations[seq.firstGroundFrame+ groundFrm -numNodes];
groundRotations[j+oldSz] = nodeRotations[seq.firstGroundFrame+j-numNodes]; groundRotations[groundFrm +oldSz] = nodeRotations[seq.firstGroundFrame+ groundFrm -numNodes];
} }
seq.firstGroundFrame = oldSz; seq.firstGroundFrame = oldSz;
seq.baseTranslation -= numNodes; seq.baseTranslation -= numNodes;
@ -1378,9 +1378,9 @@ void TSShape::assembleShape()
ptr32 = tsalloc.copyToShape32( numDetails * 7, true ); ptr32 = tsalloc.copyToShape32( numDetails * 7, true );
details.setSize( numDetails ); details.setSize( numDetails );
for ( U32 i = 0; i < details.size(); i++, ptr32 += 7 ) for ( U32 detID = 0; detID < details.size(); detID++, ptr32 += 7 )
{ {
Detail *det = &(details[i]); Detail *det = &(details[detID]);
// Clear the struct... we don't want to leave // Clear the struct... we don't want to leave
// garbage in the parts that are unfilled. // garbage in the parts that are unfilled.
@ -1408,12 +1408,12 @@ void TSShape::assembleShape()
// Some DTS exporters (MAX - I'm looking at you!) write garbage into the // Some DTS exporters (MAX - I'm looking at you!) write garbage into the
// averageError and maxError values which stops LOD from working correctly. // averageError and maxError values which stops LOD from working correctly.
// Try to detect and fix it // Try to detect and fix it
for ( U32 i = 0; i < details.size(); i++ ) for ( U32 erID = 0; erID < details.size(); erID++ )
{ {
if ( ( details[i].averageError == 0 ) || ( details[i].averageError > 10000 ) || if ( ( details[erID].averageError == 0 ) || ( details[erID].averageError > 10000 ) ||
( details[i].maxError == 0 ) || ( details[i].maxError > 10000 ) ) ( details[erID].maxError == 0 ) || ( details[erID].maxError > 10000 ) )
{ {
details[i].averageError = details[i].maxError = -1.0f; details[erID].averageError = details[erID].maxError = -1.0f;
} }
} }
@ -1740,8 +1740,8 @@ void TSShape::disassembleShape()
{ {
// Legacy details => no explicit autobillboard parameters // Legacy details => no explicit autobillboard parameters
U32 legacyDetailSize32 = 7; // only store the first 7 4-byte values of each detail U32 legacyDetailSize32 = 7; // only store the first 7 4-byte values of each detail
for ( S32 i = 0; i < details.size(); i++ ) for ( S32 bbID = 0; bbID < details.size(); bbID++ )
tsalloc.copyToBuffer32( (S32*)&details[i], legacyDetailSize32 ); tsalloc.copyToBuffer32( (S32*)&details[bbID], legacyDetailSize32 );
} }
tsalloc.setGuard(); tsalloc.setGuard();

View file

@ -647,27 +647,27 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
nodeUniformScales.increment(newScaleMembership.count() * seq.numKeyframes); nodeUniformScales.increment(newScaleMembership.count() * seq.numKeyframes);
// remap node transforms from temporary arrays // remap node transforms from temporary arrays
for (S32 j = 0; j < nodeMap.size(); j++) for (S32 nodeID = 0; nodeID < nodeMap.size(); nodeID++)
{ {
if (nodeMap[j] < 0) if (nodeMap[nodeID] < 0)
continue; continue;
if (newTransMembership.test(nodeMap[j])) if (newTransMembership.test(nodeMap[nodeID]))
{ {
S32 src = seq.numKeyframes * seq.translationMatters.count(j); S32 src = seq.numKeyframes * seq.translationMatters.count(nodeID);
S32 dest = seq.baseTranslation + seq.numKeyframes * newTransMembership.count(nodeMap[j]); S32 dest = seq.baseTranslation + seq.numKeyframes * newTransMembership.count(nodeMap[nodeID]);
dCopyArray(&nodeTranslations[dest], &seqTranslations[src], seq.numKeyframes); dCopyArray(&nodeTranslations[dest], &seqTranslations[src], seq.numKeyframes);
} }
if (newRotMembership.test(nodeMap[j])) if (newRotMembership.test(nodeMap[nodeID]))
{ {
S32 src = seq.numKeyframes * seq.rotationMatters.count(j); S32 src = seq.numKeyframes * seq.rotationMatters.count(nodeID);
S32 dest = seq.baseRotation + seq.numKeyframes * newRotMembership.count(nodeMap[j]); S32 dest = seq.baseRotation + seq.numKeyframes * newRotMembership.count(nodeMap[nodeID]);
dCopyArray(&nodeRotations[dest], &seqRotations[src], seq.numKeyframes); dCopyArray(&nodeRotations[dest], &seqRotations[src], seq.numKeyframes);
} }
if (newScaleMembership.test(nodeMap[j])) if (newScaleMembership.test(nodeMap[nodeID]))
{ {
S32 src = seq.numKeyframes * seq.scaleMatters.count(j); S32 src = seq.numKeyframes * seq.scaleMatters.count(nodeID);
S32 dest = seq.baseScale + seq.numKeyframes * newScaleMembership.count(nodeMap[j]); S32 dest = seq.baseScale + seq.numKeyframes * newScaleMembership.count(nodeMap[nodeID]);
if (seq.flags & TSShape::ArbitraryScale) if (seq.flags & TSShape::ArbitraryScale)
{ {
dCopyArray(&nodeArbitraryScaleRots[dest], &seqArbitraryScaleRots[src], seq.numKeyframes); dCopyArray(&nodeArbitraryScaleRots[dest], &seqArbitraryScaleRots[src], seq.numKeyframes);
@ -713,10 +713,10 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
S32 oldSz = triggers.size(); S32 oldSz = triggers.size();
s->read(&sz); s->read(&sz);
triggers.setSize(oldSz+sz); triggers.setSize(oldSz+sz);
for (S32 i=0; i<sz;i++) for (S32 triggerID=0; triggerID<sz; triggerID++)
{ {
s->read(&triggers[i+oldSz].state); s->read(&triggers[triggerID +oldSz].state);
s->read(&triggers[i+oldSz].pos); s->read(&triggers[triggerID +oldSz].pos);
} }
if (smInitOnRead) if (smInitOnRead)