From 4615bd6db82c8a36cb1b099575baaed0c1cef925 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 14:53:23 -0500 Subject: [PATCH] more compiler compliant cleanups plus a full set of tsMesh::foo to tsmesh::mFoo class var conversions for consistency --- Engine/source/environment/VolumetricFog.cpp | 4 +- .../source/gui/editor/guiShapeEdPreview.cpp | 6 +- Engine/source/ts/loader/appMesh.cpp | 16 +- Engine/source/ts/loader/tsShapeLoader.cpp | 2 +- Engine/source/ts/tsCollision.cpp | 12 +- Engine/source/ts/tsMesh.cpp | 354 +++++++++--------- Engine/source/ts/tsMesh.h | 44 +-- Engine/source/ts/tsMeshFit.cpp | 68 ++-- Engine/source/ts/tsShape.cpp | 48 +-- Engine/source/ts/tsShapeConstruct.cpp | 8 +- Engine/source/ts/tsShapeEdit.cpp | 16 +- Engine/source/ts/tsSortedMesh.cpp | 6 +- Engine/source/ts/tsSortedMesh.h | 2 +- 13 files changed, 293 insertions(+), 293 deletions(-) diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index 067dd0c5d..ba655ffa9 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -424,10 +424,10 @@ bool VolumetricFog::LoadShape() for (U32 k = 0; k < mesh->mIndices.size(); k++) det_size[i].indices->push_back(mesh->mIndices[k]); - U32 primitivesSize = mesh->primitives.size(); + U32 primitivesSize = mesh->mPrimitives.size(); for (U32 k = 0; k < primitivesSize; k++) { - const TSDrawPrimitive & draw = mesh->primitives[k]; + const TSDrawPrimitive & draw = mesh->mPrimitives[k]; GFXPrimitiveType drawType = GFXdrawTypes[draw.matIndex >> 30]; switch (drawType) { diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index e373a246b..300b6e95e 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -1244,9 +1244,9 @@ void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state) continue; // Count the number of draw calls and materials - mNumDrawCalls += mesh->primitives.size(); - for ( S32 iPrim = 0; iPrim < mesh->primitives.size(); iPrim++ ) - usedMaterials.push_back_unique( mesh->primitives[iPrim].matIndex & TSDrawPrimitive::MaterialMask ); + mNumDrawCalls += mesh->mPrimitives.size(); + for ( S32 iPrim = 0; iPrim < mesh->mPrimitives.size(); iPrim++ ) + usedMaterials.push_back_unique( mesh->mPrimitives[iPrim].matIndex & TSDrawPrimitive::MaterialMask ); // For skinned meshes, count the number of bones and weights if ( mesh->getMeshType() == TSMesh::SkinMeshType ) diff --git a/Engine/source/ts/loader/appMesh.cpp b/Engine/source/ts/loader/appMesh.cpp index aff73df67..bd5c291e0 100644 --- a/Engine/source/ts/loader/appMesh.cpp +++ b/Engine/source/ts/loader/appMesh.cpp @@ -147,13 +147,13 @@ TSMesh* AppMesh::constructTSMesh() } // Copy mesh elements - tsmesh->verts = points; - tsmesh->norms = normals; - tsmesh->tverts = uvs; - tsmesh->primitives = primitives; + tsmesh->mVerts = points; + tsmesh->mNorms = normals; + tsmesh->mTverts = uvs; + tsmesh->mPrimitives = primitives; tsmesh->mIndices = indices; - tsmesh->colors = colors; - tsmesh->tverts2 = uv2s; + tsmesh->mColors = colors; + tsmesh->mTverts2 = uv2s; // Finish initializing the shape tsmesh->setFlags(flags); @@ -162,8 +162,8 @@ TSMesh* AppMesh::constructTSMesh() tsmesh->numFrames = numFrames; tsmesh->numMatFrames = numMatFrames; tsmesh->vertsPerFrame = vertsPerFrame; - tsmesh->createTangents(tsmesh->verts, tsmesh->norms); - tsmesh->encodedNorms.set(NULL,0); + tsmesh->createTangents(tsmesh->mVerts, tsmesh->mNorms); + tsmesh->mEncodedNorms.set(NULL,0); return tsmesh; } diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 94f5e4fbf..5fa76d0fc 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -1172,7 +1172,7 @@ void TSShapeLoader::install() { TSMesh *mesh = shape->meshes[obj.startMeshIndex + iMesh]; - if (mesh && !mesh->primitives.size()) + if (mesh && !mesh->mPrimitives.size()) { S32 oldMeshCount = obj.numMeshes; destructInPlace(mesh); diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 8fafbed9e..7dc10271b 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1364,9 +1364,9 @@ void TSMesh::prepOpcodeCollision() // Figure out how many triangles we have... U32 triCount = 0; const U32 base = 0; - for ( U32 i = 0; i < primitives.size(); i++ ) + for ( U32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; const U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -1396,7 +1396,7 @@ void TSMesh::prepOpcodeCollision() } // Just do the first trilist for now. - mi->SetNbVertices( mVertexData.isReady() ? mNumVerts : verts.size() ); + mi->SetNbVertices( mVertexData.isReady() ? mNumVerts : mVerts.size() ); mi->SetNbTriangles( triCount ); // Stuff everything into appropriate arrays. @@ -1407,9 +1407,9 @@ void TSMesh::prepOpcodeCollision() mOpPoints = pts; // add the polys... - for ( U32 i = 0; i < primitives.size(); i++ ) + for ( U32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; const U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -1467,7 +1467,7 @@ void TSMesh::prepOpcodeCollision() } else { - pts[i].Set( verts[i].x, verts[i].y, verts[i].z ); + pts[i].Set( mVerts[i].x, mVerts[i].y, mVerts[i].z ); } } diff --git a/Engine/source/ts/tsMesh.cpp b/Engine/source/ts/tsMesh.cpp index 528d7f56c..5e767bd66 100644 --- a/Engine/source/ts/tsMesh.cpp +++ b/Engine/source/ts/tsMesh.cpp @@ -122,7 +122,7 @@ void TSMesh::innerRender( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb GFX->setVertexBuffer( vb ); GFX->setPrimitiveBuffer( pb ); - for( U32 p = 0; p < primitives.size(); p++ ) + for( U32 p = 0; p < mPrimitives.size(); p++ ) GFX->drawPrimitive( p ); } @@ -223,9 +223,9 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata, // NOTICE: SFXBB is removed and refraction is disabled! //coreRI->backBuffTex = GFX->getSfxBackBuffer(); - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - const TSDrawPrimitive &draw = primitives[i]; + const TSDrawPrimitive &draw = mPrimitives[i]; // We need to have a material. if ( draw.matIndex & TSDrawPrimitive::NoMaterial ) @@ -253,7 +253,7 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata, #ifndef TORQUE_OS_MAC // Get the instancing material if this mesh qualifies. - if ( meshType != SkinMeshType && pb->mPrimitiveArray[i].numVertices < smMaxInstancingVerts ) + if (mMeshType != SkinMeshType && pb->mPrimitiveArray[i].numVertices < smMaxInstancingVerts ) if (matInst && !matInst->getFeatures().hasFeature(MFT_HardwareSkinning)) matInst = InstancingMaterialHook::getInstancingMat( matInst ); @@ -293,13 +293,13 @@ const Point3F * TSMesh::getNormals( S32 firstVert ) if ( getFlags( UseEncodedNormals ) ) { gNormalStore.setSize( vertsPerFrame ); - for ( S32 i = 0; i < encodedNorms.size(); i++ ) - gNormalStore[i] = decodeNormal( encodedNorms[ i + firstVert ] ); + for ( S32 i = 0; i < mEncodedNorms.size(); i++ ) + gNormalStore[i] = decodeNormal(mEncodedNorms[ i + firstVert ] ); return gNormalStore.address(); } - return &norms[firstVert]; + return &mNorms[firstVert]; } //----------------------------------------------------- @@ -352,28 +352,28 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { // Don't use vertex() method as we want to retain the original indices OptimizedPolyList::VertIndex vert; - vert.vertIdx = opList->insertPoint( verts[ i + firstVert ] ); - vert.normalIdx = opList->insertNormal( norms[ i + firstVert ] ); - vert.uv0Idx = opList->insertUV0( tverts[ i + firstVert ] ); + vert.vertIdx = opList->insertPoint( mVerts[ i + firstVert ] ); + vert.normalIdx = opList->insertNormal( mNorms[ i + firstVert ] ); + vert.uv0Idx = opList->insertUV0( mTverts[ i + firstVert ] ); if ( hasTVert2 ) - vert.uv1Idx = opList->insertUV1( tverts2[ i + firstVert ] ); + vert.uv1Idx = opList->insertUV1(mTverts[ i + firstVert ] ); opList->mVertexList.push_back( vert ); } } else { - base = polyList->addPointAndNormal( verts[firstVert], norms[firstVert] ); + base = polyList->addPointAndNormal( mVerts[firstVert], mNorms[firstVert] ); for ( i = 1; i < vertsPerFrame; i++ ) - polyList->addPointAndNormal( verts[ i + firstVert ], norms[ i + firstVert ] ); + polyList->addPointAndNormal(mVerts[ i + firstVert ], mNorms[ i + firstVert ] ); } } } // add the polys... - for ( i = 0; i < primitives.size(); i++ ) + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -440,9 +440,9 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF } // add the polys... - for ( i = 0; i < primitives.size(); i++ ) + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -627,7 +627,7 @@ void TSMesh::support( S32 frame, const Point3F &v, F32 *currMaxDP, Point3F *curr bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList* materials ) { - if ( planeNormals.empty() ) + if ( mPlaneNormals.empty() ) buildConvexHull(); // if haven't done it yet... // Keep track of startTime and endTime. They start out at just under 0 and just over 1, respectively. @@ -657,15 +657,15 @@ bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, Ray S32 * pplane = &curPlane; bool * pfound = &found; - S32 startPlane = frame * planesPerFrame; - for ( S32 i = startPlane; i < startPlane + planesPerFrame; i++ ) + S32 startPlane = frame * mPlanesPerFrame; + for ( S32 i = startPlane; i < startPlane + mPlanesPerFrame; i++ ) { // if start & end outside, no collision // if start & end inside, continue // if start outside, end inside, or visa versa, find intersection of line with plane // then update intersection of line with hull (using startTime and endTime) - F32 dot1 = mDot( planeNormals[i], start ) - planeConstants[i]; - F32 dot2 = mDot( planeNormals[i], end) - planeConstants[i]; + F32 dot1 = mDot(mPlaneNormals[i], start ) - mPlaneConstants[i]; + F32 dot2 = mDot(mPlaneNormals[i], end) - mPlaneConstants[i]; if ( dot1 * dot2 > 0.0f ) { // same side of the plane...which side -- dot==0 considered inside @@ -747,10 +747,10 @@ bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, Ray // setup rayInfo if ( found && rayInfo ) { - curMaterial = planeMaterials[ curPlane - startPlane ]; + curMaterial = mPlaneMaterials[ curPlane - startPlane ]; rayInfo->t = (F32)startNum/(F32)startDen; // finally divide... - rayInfo->normal = planeNormals[curPlane]; + rayInfo->normal = mPlaneNormals[curPlane]; if (materials && materials->size() > 0) rayInfo->material = materials->getMaterialInst( curMaterial ); @@ -785,9 +785,9 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & BaseMatInstance* bestMaterial = NULL; Point3F dir = end - start; - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 drawStart = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::castRayRendered (1)" ); @@ -927,35 +927,35 @@ bool TSMesh::addToHull( U32 idx0, U32 idx1, U32 idx2 ) normal.normalize(); F32 k = mDot( normal, mVertexData.getBase(idx0).vert() ); - for ( S32 i = 0; i < planeNormals.size(); i++ ) + for ( S32 i = 0; i < mPlaneNormals.size(); i++ ) { - if ( mDot( planeNormals[i], normal ) > 0.99f && mFabs( k-planeConstants[i] ) < 0.01f ) + if ( mDot(mPlaneNormals[i], normal ) > 0.99f && mFabs( k- mPlaneConstants[i] ) < 0.01f ) return false; // this is a repeat... } // new plane, add it to the list... - planeNormals.push_back( normal ); - planeConstants.push_back( k ); + mPlaneNormals.push_back( normal ); + mPlaneConstants.push_back( k ); return true; } bool TSMesh::buildConvexHull() { // already done, return without error - if ( planeNormals.size() ) + if (mPlaneNormals.size() ) return true; bool error = false; // should probably only have 1 frame, but just in case... - planesPerFrame = 0; + mPlanesPerFrame = 0; S32 frame, i, j; for ( frame = 0; frame < numFrames; frame++ ) { S32 firstVert = vertsPerFrame * frame; - S32 firstPlane = planeNormals.size(); - for ( i = 0; i < primitives.size(); i++ ) + S32 firstPlane = mPlaneNormals.size(); + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildConvexHull (1)" ); @@ -967,7 +967,7 @@ bool TSMesh::buildConvexHull() if ( addToHull( mIndices[start + j + 0] + firstVert, mIndices[start + j + 1] + firstVert, mIndices[start + j + 2] + firstVert ) && frame == 0 ) - planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); + mPlaneMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } else { @@ -984,51 +984,51 @@ bool TSMesh::buildConvexHull() nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1 ); idx2 = mIndices[start + j] + firstVert; if ( addToHull( idx0, idx1, idx2 ) && frame == 0 ) - planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); + mPlaneMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } } } // make sure all the verts on this frame are inside all the planes for ( i = 0; i < vertsPerFrame; i++ ) - for ( j = firstPlane; j < planeNormals.size(); j++ ) - if ( mDot( mVertexData.getBase(firstVert + i).vert(), planeNormals[j] ) - planeConstants[j] < 0.01 ) // .01 == a little slack + for ( j = firstPlane; j < mPlaneNormals.size(); j++ ) + if ( mDot( mVertexData.getBase(firstVert + i).vert(), mPlaneNormals[j] ) - mPlaneConstants[j] < 0.01 ) // .01 == a little slack error = true; if ( frame == 0 ) - planesPerFrame = planeNormals.size(); + mPlanesPerFrame = mPlaneNormals.size(); - if ( (frame + 1) * planesPerFrame != planeNormals.size() ) + if ( (frame + 1) * mPlanesPerFrame != mPlaneNormals.size() ) { // eek, not all frames have same number of planes... - while ( (frame + 1) * planesPerFrame > planeNormals.size() ) + while ( (frame + 1) * mPlanesPerFrame > mPlaneNormals.size() ) { // we're short, duplicate last plane till we match - U32 sz = planeNormals.size(); - planeNormals.increment(); - planeNormals.last() = planeNormals[sz-1]; - planeConstants.increment(); - planeConstants.last() = planeConstants[sz-1]; + U32 sz = mPlaneNormals.size(); + mPlaneNormals.increment(); + mPlaneNormals.last() = mPlaneNormals[sz-1]; + mPlaneConstants.increment(); + mPlaneConstants.last() = mPlaneConstants[sz-1]; } - while ( (frame + 1) * planesPerFrame < planeNormals.size() ) + while ( (frame + 1) * mPlanesPerFrame < mPlaneNormals.size() ) { // harsh -- last frame has more than other frames // duplicate last plane in each frame for ( S32 k = frame - 1; k >= 0; k-- ) { - planeNormals.insert( k * planesPerFrame + planesPerFrame ); - planeNormals[k * planesPerFrame + planesPerFrame] = planeNormals[k * planesPerFrame + planesPerFrame - 1]; - planeConstants.insert( k * planesPerFrame + planesPerFrame ); - planeConstants[k * planesPerFrame + planesPerFrame] = planeConstants[k * planesPerFrame + planesPerFrame - 1]; + mPlaneNormals.insert( k * mPlanesPerFrame + mPlanesPerFrame ); + mPlaneNormals[k * mPlanesPerFrame + mPlanesPerFrame] = mPlaneNormals[k * mPlanesPerFrame + mPlanesPerFrame - 1]; + mPlaneConstants.insert( k * mPlanesPerFrame + mPlanesPerFrame ); + mPlaneConstants[k * mPlanesPerFrame + mPlanesPerFrame] = mPlaneConstants[k * mPlanesPerFrame + mPlanesPerFrame - 1]; if ( k == 0 ) { - planeMaterials.increment(); - planeMaterials.last() = planeMaterials[planeMaterials.size() - 2]; + mPlaneMaterials.increment(); + mPlaneMaterials.last() = mPlaneMaterials[mPlaneMaterials.size() - 2]; } } - planesPerFrame++; + mPlanesPerFrame++; } } - AssertFatal( (frame + 1) * planesPerFrame == planeNormals.size(),"TSMesh::buildConvexHull (3)" ); + AssertFatal( (frame + 1) * mPlanesPerFrame == mPlaneNormals.size(),"TSMesh::buildConvexHull (3)" ); } return !error; } @@ -1051,7 +1051,7 @@ void TSMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 frame, AssertFatal(!mVertexData.isReady() || (mVertexData.isReady() && mNumVerts == mVertexData.size() && mNumVerts == vertsPerFrame), "vertex number mismatch"); - if(verts.size() == 0 && mVertexData.isReady() && mVertexData.size() > 0) + if(mVerts.size() == 0 && mVertexData.isReady() && mVertexData.size() > 0) { baseVert = &mVertexData.getBase(0).vert(); stride = mVertexData.vertSize(); @@ -1066,11 +1066,11 @@ void TSMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 frame, } else { - baseVert = verts.address(); + baseVert = mVerts.address(); stride = sizeof(Point3F); if ( frame < 0 ) - numVerts = verts.size(); + numVerts = mVerts.size(); else { baseVert += frame * vertsPerFrame; @@ -1131,22 +1131,22 @@ void TSMesh::computeBounds( const Point3F *v, S32 numVerts, S32 stride, const Ma S32 TSMesh::getNumPolys() const { S32 count = 0; - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - switch (primitives[i].matIndex & TSDrawPrimitive::TypeMask) + switch (mPrimitives[i].matIndex & TSDrawPrimitive::TypeMask) { case TSDrawPrimitive::Triangles: - count += primitives[i].numElements / 3; + count += mPrimitives[i].numElements / 3; break; case TSDrawPrimitive::Fan: - count += primitives[i].numElements - 2; + count += mPrimitives[i].numElements - 2; break; case TSDrawPrimitive::Strip: // Don't count degenerate triangles - for ( S32 j = primitives[i].start; - j < primitives[i].start+primitives[i].numElements-2; + for ( S32 j = mPrimitives[i].start; + j < mPrimitives[i].start+ mPrimitives[i].numElements-2; j++ ) { if ((mIndices[j] != mIndices[j+1]) && @@ -1162,11 +1162,11 @@ S32 TSMesh::getNumPolys() const //----------------------------------------------------- -TSMesh::TSMesh() : meshType( StandardMeshType ) +TSMesh::TSMesh() : mMeshType( StandardMeshType ) { - VECTOR_SET_ASSOCIATION( planeNormals ); - VECTOR_SET_ASSOCIATION( planeConstants ); - VECTOR_SET_ASSOCIATION( planeMaterials ); + VECTOR_SET_ASSOCIATION(mPlaneNormals ); + VECTOR_SET_ASSOCIATION(mPlaneConstants ); + VECTOR_SET_ASSOCIATION(mPlaneMaterials ); mParentMesh = -1; mOptTree = NULL; @@ -1181,7 +1181,7 @@ TSMesh::TSMesh() : meshType( StandardMeshType ) mVertSize = 0; mVertOffset = 0; - parentMeshObject = NULL; + mParentMeshObject = NULL; } //----------------------------------------------------- @@ -1326,8 +1326,8 @@ void TSSkinMesh::createSkinBatchData() } else { - batchData.initialNorms = norms; - batchData.initialVerts = verts; + batchData.initialNorms = mNorms; + batchData.initialVerts = mVerts; } // Build the batch operations @@ -1546,10 +1546,10 @@ void TSSkinMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 fra { TORQUE_UNUSED(frame); - if (verts.size() != 0) + if (mVerts.size() != 0) { // Use unskinned verts - TSMesh::computeBounds( verts.address(), verts.size(), sizeof(Point3F), transform, bounds, center, radius ); + TSMesh::computeBounds(mVerts.address(), mVerts.size(), sizeof(Point3F), transform, bounds, center, radius ); } else if (frame <= 0 && batchData.initialVerts.size() > 0) { @@ -2368,10 +2368,10 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr // go through and create PrimitiveInfo array GFXPrimitive pInfo; - U32 primitivesSize = primitives.size(); + U32 primitivesSize = mPrimitives.size(); for (U32 i = 0; i < primitivesSize; i++) { - const TSDrawPrimitive & draw = primitives[i]; + const TSDrawPrimitive & draw = mPrimitives[i]; GFXPrimitiveType drawType = getDrawType(draw.matIndex >> 30); @@ -2436,21 +2436,21 @@ void TSMesh::assemble( bool skip ) S32 numVerts = tsalloc.get32(); S32 *ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); - verts.set( (Point3F*)ptr32, numVerts ); + mVerts.set( (Point3F*)ptr32, numVerts ); S32 numTVerts = tsalloc.get32(); ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); - tverts.set( (Point2F*)ptr32, numTVerts ); + mTverts.set( (Point2F*)ptr32, numTVerts ); if ( TSShape::smReadVersion > 25 ) { numTVerts = tsalloc.get32(); ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); - tverts2.set( (Point2F*)ptr32, numTVerts ); + mTverts2.set( (Point2F*)ptr32, numTVerts ); S32 numVColors = tsalloc.get32(); ptr32 = getSharedData32(mParentMesh, numVColors, (S32**)smColorsList.address(), skip ); - colors.set( (ColorI*)ptr32, numVColors ); + mColors.set( (ColorI*)ptr32, numVColors ); } S8 *ptr8; @@ -2459,27 +2459,27 @@ void TSMesh::assemble( bool skip ) // we have encoded normals and we want to use them... if (mParentMesh < 0 ) tsalloc.getPointer32( numVerts * 3 ); // adva nce past norms, don't use - norms.set( NULL, 0 ); + mNorms.set( NULL, 0 ); ptr8 = getSharedData8(mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); - encodedNorms.set( ptr8, numVerts ); + mEncodedNorms.set( ptr8, numVerts ); } else if ( TSShape::smReadVersion > 21 ) { // we have encoded normals but we don't want to use them... ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - norms.set( (Point3F*)ptr32, numVerts ); + mNorms.set( (Point3F*)ptr32, numVerts ); if (mParentMesh < 0 ) tsalloc.getPointer8( numVerts ); // advance past encoded normls, don't use - encodedNorms.set( NULL, 0 ); + mEncodedNorms.set( NULL, 0 ); } else { // no encoded normals... ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - norms.set( (Point3F*)ptr32, numVerts ); - encodedNorms.set( NULL, 0 ); + mNorms.set( (Point3F*)ptr32, numVerts ); + mEncodedNorms.set( NULL, 0 ); } // copy the primitives and indices...how we do this depends on what @@ -2553,7 +2553,7 @@ void TSMesh::assemble( bool skip ) AssertFatal(chkPrim==szPrimOut && chkInd==szIndOut,"TSMesh::primitive conversion"); // store output - primitives.set(primOut, szPrimOut); + mPrimitives.set(primOut, szPrimOut); mIndices.set(indOut, szIndOut); // delete temporary arrays if necessary @@ -2569,7 +2569,7 @@ void TSMesh::assemble( bool skip ) vertsPerFrame = tsalloc.get32(); U32 flags = (U32)tsalloc.get32(); - if ( encodedNorms.size() ) + if ( mEncodedNorms.size() ) flags |= UseEncodedNormals; setFlags( flags ); @@ -2577,9 +2577,9 @@ void TSMesh::assemble( bool skip ) // Set color & tvert2 flags if we have an old version if (TSShape::smReadVersion < 27) { - if (colors.size() > 0) setFlags(HasColor); - if (tverts2.size() > 0) setFlags(HasTVert2); - mNumVerts = verts.size(); + if (mColors.size() > 0) setFlags(HasColor); + if (mTverts2.size() > 0) setFlags(HasTVert2); + mNumVerts = mVerts.size(); } tsalloc.checkGuard(); @@ -2587,7 +2587,7 @@ void TSMesh::assemble( bool skip ) if ( tsalloc.allocShape32( 0 ) && TSShape::smReadVersion < 19 ) computeBounds(); // only do this if we copied the data... - createTangents(verts, norms); + createTangents(mVerts, mNorms); } void TSMesh::disassemble() @@ -2636,39 +2636,39 @@ void TSMesh::disassemble() else { // verts... - tsalloc.set32(verts.size()); + tsalloc.set32(mVerts.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size()); // if no parent mesh, then save off our verts + tsalloc.copyToBuffer32((S32*)mVerts.address(), 3 * mVerts.size()); // if no parent mesh, then save off our verts // tverts... - tsalloc.set32(tverts.size()); + tsalloc.set32(mTverts.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)tverts.address(), 2 * tverts.size()); // if no parent mesh, then save off our tverts + tsalloc.copyToBuffer32((S32*)mTverts.address(), 2 * mTverts.size()); // if no parent mesh, then save off our tverts if (TSShape::smVersion > 25) { // tverts2... - tsalloc.set32(tverts2.size()); + tsalloc.set32(mTverts2.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)tverts2.address(), 2 * tverts2.size()); // if no parent mesh, then save off our tverts + tsalloc.copyToBuffer32((S32*)mTverts2.address(), 2 * mTverts2.size()); // if no parent mesh, then save off our tverts // colors - tsalloc.set32(colors.size()); + tsalloc.set32(mColors.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)colors.address(), colors.size()); // if no parent mesh, then save off our tverts + tsalloc.copyToBuffer32((S32*)mColors.address(), mColors.size()); // if no parent mesh, then save off our tverts } // norms... if (mParentMesh < 0) // if no parent mesh, then save off our norms - tsalloc.copyToBuffer32((S32*)norms.address(), 3 * norms.size()); // norms.size()==verts.size() or error... + tsalloc.copyToBuffer32((S32*)mNorms.address(), 3 * mNorms.size()); // norms.size()==verts.size() or error... // encoded norms... if (mParentMesh < 0) { // if no parent mesh, compute encoded normals and copy over - for (S32 i = 0; i < norms.size(); i++) + for (S32 i = 0; i < mNorms.size(); i++) { - U8 normIdx = encodedNorms.size() ? encodedNorms[i] : encodeNormal(norms[i]); + U8 normIdx = mEncodedNorms.size() ? mEncodedNorms[i] : encodeNormal(mNorms[i]); tsalloc.copyToBuffer8((S8*)&normIdx, 1); } } @@ -2677,14 +2677,14 @@ void TSMesh::disassemble() // optimize triangle draw order during disassemble { FrameTemp tmpIdxs(mIndices.size()); - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - const TSDrawPrimitive& prim = primitives[i]; + const TSDrawPrimitive& prim = mPrimitives[i]; // only optimize triangle lists (strips and fans are assumed to be already optimized) if ( (prim.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { - TriListOpt::OptimizeTriangleOrdering(verts.size(), prim.numElements, + TriListOpt::OptimizeTriangleOrdering(mVerts.size(), prim.numElements, mIndices.address() + prim.start, tmpIdxs.address()); dCopyArray(mIndices.address() + prim.start, tmpIdxs.address(), prim.numElements); @@ -2695,8 +2695,8 @@ void TSMesh::disassemble() if (TSShape::smVersion > 25) { // primitives... - tsalloc.set32( primitives.size() ); - tsalloc.copyToBuffer32((S32*)primitives.address(),3*primitives.size()); + tsalloc.set32(mPrimitives.size() ); + tsalloc.copyToBuffer32((S32*)mPrimitives.address(),3* mPrimitives.size()); // indices... tsalloc.set32(mIndices.size()); @@ -2705,15 +2705,15 @@ void TSMesh::disassemble() else { // primitives - tsalloc.set32( primitives.size() ); - for (S32 i=0; i &_verts, const Vector Point3F *tan1 = tan0.address() + numVerts; dMemset( tan0.address(), 0, sizeof(Point3F) * 2 * numVerts ); - U32 numPrimatives = primitives.size(); + U32 numPrimatives = mPrimitives.size(); for (S32 i = 0; i < numPrimatives; i++ ) { - const TSDrawPrimitive & draw = primitives[i]; + const TSDrawPrimitive & draw = mPrimitives[i]; GFXPrimitiveType drawType = getDrawType( draw.matIndex >> 30 ); U32 p1Index = 0; @@ -3066,7 +3066,7 @@ void TSMesh::createTangents(const Vector &_verts, const Vector } } - tangents.setSize( numVerts ); + mTangents.setSize( numVerts ); // fill out final info from accumulated basis data for( U32 i = 0; i < numVerts; i++ ) @@ -3077,12 +3077,12 @@ void TSMesh::createTangents(const Vector &_verts, const Vector Point3F tempPt = t - n * mDot( n, t ); tempPt.normalize(); - tangents[i] = tempPt; + mTangents[i] = tempPt; Point3F cp; mCross( n, t, &cp ); - tangents[i].w = (mDot( cp, b ) < 0.0f) ? -1.0f : 1.0f; + mTangents[i].w = (mDot( cp, b ) < 0.0f) ? -1.0f : 1.0f; } } @@ -3090,7 +3090,7 @@ void TSMesh::convertToVertexData() { if (!mVertexData.isReady()) { - _convertToVertexData(mVertexData, verts, norms); + _convertToVertexData(mVertexData, mVerts, mNorms); } } @@ -3111,39 +3111,39 @@ void TSSkinMesh::convertToVertexData() void TSMesh::copySourceVertexDataFrom(const TSMesh* srcMesh) { - verts = srcMesh->verts; - tverts = srcMesh->tverts; - norms = srcMesh->norms; - colors = srcMesh->colors; - tverts2 = srcMesh->tverts2; + mVerts = srcMesh->mVerts; + mTverts = srcMesh->mTverts; + mNorms = srcMesh->mNorms; + mColors = srcMesh->mColors; + mTverts2 = srcMesh->mTverts2; - if (verts.size() == 0) + if (mVerts.size() == 0) { bool hasTVert2 = srcMesh->getHasTVert2(); bool hasColor = srcMesh->getHasColor(); - verts.setSize(srcMesh->mNumVerts); - tverts.setSize(srcMesh->mNumVerts); - norms.setSize(srcMesh->mNumVerts); + mVerts.setSize(srcMesh->mNumVerts); + mTverts.setSize(srcMesh->mNumVerts); + mNorms.setSize(srcMesh->mNumVerts); if (hasColor) - colors.setSize(mNumVerts); + mColors.setSize(mNumVerts); if (hasTVert2) - tverts2.setSize(mNumVerts); + mTverts2.setSize(mNumVerts); // Fill arrays for (U32 i = 0; i < mNumVerts; i++) { const __TSMeshVertexBase &cv = srcMesh->mVertexData.getBase(i); const __TSMeshVertex_3xUVColor &cvc = srcMesh->mVertexData.getColor(i); - verts[i] = cv.vert(); - tverts[i] = cv.tvert(); - norms[i] = cv.normal(); + mVerts[i] = cv.vert(); + mTverts[i] = cv.tvert(); + mNorms[i] = cv.normal(); if (hasColor) - cvc.color().getColor(&colors[i]); + cvc.color().getColor(&mColors[i]); if (hasTVert2) - tverts2[i] = cvc.tvert2(); + mTverts2[i] = cvc.tvert2(); } } } @@ -3173,21 +3173,21 @@ void TSSkinMesh::copySourceVertexDataFrom(const TSMesh* srcMesh) U32 TSMesh::getNumVerts() { - return mVertexData.isReady() ? mNumVerts : verts.size(); + return mVertexData.isReady() ? mNumVerts : mVerts.size(); } void TSMesh::_convertToVertexData(TSMeshVertexArray &outArray, const Vector &_verts, const Vector &_norms) { // Update tangents list - createTangents(verts, norms); + createTangents(mVerts, mNorms); AssertFatal(_verts.size() == mNumVerts, "vert count mismatch"); - AssertFatal(!getHasColor() || colors.size() == _verts.size(), "Vector of color elements should be the same size as other vectors"); - AssertFatal(!getHasTVert2() || tverts2.size() == _verts.size(), "Vector of tvert2 elements should be the same size as other vectors"); + AssertFatal(!getHasColor() || mColors.size() == _verts.size(), "Vector of color elements should be the same size as other vectors"); + AssertFatal(!getHasTVert2() || mTverts2.size() == _verts.size(), "Vector of tvert2 elements should be the same size as other vectors"); AssertFatal(!outArray.isReady(), "Mesh already converted to aligned data! Re-check code!"); AssertFatal(_verts.size() == _norms.size() && - _verts.size() == tangents.size(), + _verts.size() == mTangents.size(), "Vectors: verts, norms, tangents must all be the same size"); AssertFatal(mVertSize == outArray.vertSize(), "Size inconsistency"); @@ -3206,18 +3206,18 @@ void TSMesh::_convertToVertexData(TSMeshVertexArray &outArray, const Vector 0 || meshType & HasColor; } - U32 getHasTVert2() const { return tverts2.size() > 0 || meshType & HasTVert2; } - void setFlags(U32 flag) { meshType |= flag; } - void clearFlags(U32 flag) { meshType &= ~flag; } - U32 getFlags( U32 flag = 0xFFFFFFFF ) const { return meshType & flag; } + U32 getMeshType() const { return mMeshType & TypeMask; } + U32 getHasColor() const { return mColors.size() > 0 || mMeshType & HasColor; } + U32 getHasTVert2() const { return mTverts2.size() > 0 || mMeshType & HasTVert2; } + void setFlags(U32 flag) { mMeshType |= flag; } + void clearFlags(U32 flag) { mMeshType &= ~flag; } + U32 getFlags( U32 flag = 0xFFFFFFFF ) const { return mMeshType & flag; } const Point3F* getNormals( S32 firstVert ); @@ -319,34 +319,34 @@ protected: /// @name Vertex data /// @{ - FreeableVector verts; - FreeableVector norms; - FreeableVector tverts; - FreeableVector tangents; + FreeableVector mVerts; + FreeableVector mNorms; + FreeableVector mTverts; + FreeableVector mTangents; // Optional second texture uvs. - FreeableVector tverts2; + FreeableVector mTverts2; // Optional vertex colors data. - FreeableVector colors; + FreeableVector mColors; /// @} - Vector primitives; - Vector encodedNorms; + Vector mPrimitives; + Vector mEncodedNorms; Vector mIndices; /// billboard data - Point3F billboardAxis; + Point3F mBillboardAxis; /// @name Convex Hull Data /// Convex hulls are convex (no angles >= 180º) meshes used for collision /// @{ - Vector planeNormals; - Vector planeConstants; - Vector planeMaterials; - S32 planesPerFrame; - U32 mergeBufferStart; + Vector mPlaneNormals; + Vector mPlaneConstants; + Vector mPlaneMaterials; + S32 mPlanesPerFrame; + U32 mMergeBufferStart; /// @} /// @name Render Methods diff --git a/Engine/source/ts/tsMeshFit.cpp b/Engine/source/ts/tsMeshFit.cpp index 25b56ff32..0beb2d9a2 100644 --- a/Engine/source/ts/tsMeshFit.cpp +++ b/Engine/source/ts/tsMeshFit.cpp @@ -246,9 +246,9 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) { // Add indices S32 indicesBase = mIndices.size(); - for ( S32 i = 0; i < mesh->primitives.size(); i++ ) + for ( S32 i = 0; i < mesh->mPrimitives.size(); i++ ) { - const TSDrawPrimitive& draw = mesh->primitives[i]; + const TSDrawPrimitive& draw = mesh->mPrimitives[i]; if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { mIndices.merge( &mesh->mIndices[draw.start], draw.numElements ); @@ -282,7 +282,7 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) S32 count, stride; U8* pVert; - if ( mesh->mVertexData.isReady() && mesh->verts.size() == 0 ) + if ( mesh->mVertexData.isReady() && mesh->mVerts.size() == 0 ) { count = mesh->mVertexData.size(); stride = mesh->mVertexData.vertSize(); @@ -290,9 +290,9 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) } else { - count = mesh->verts.size(); + count = mesh->mVerts.size(); stride = sizeof(Point3F); - pVert = (U8*)mesh->verts.address(); + pVert = (U8*)mesh->mVerts.address(); } MatrixF objMat; @@ -337,12 +337,12 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT mesh->mIndices.push_back( indices[i*3 + 1] ); } - mesh->verts.set( verts, numVerts ); + mesh->mVerts.set( verts, numVerts ); // Compute mesh normals - mesh->norms.setSize( mesh->verts.size() ); - for (S32 iNorm = 0; iNorm < mesh->norms.size(); iNorm++) - mesh->norms[iNorm] = Point3F::Zero; + mesh->mNorms.setSize( mesh->mVerts.size() ); + for (S32 iNorm = 0; iNorm < mesh->mNorms.size(); iNorm++) + mesh->mNorms[iNorm] = Point3F::Zero; // Sum triangle normals for each vertex for (S32 iInd = 0; iInd < mesh->mIndices.size(); iInd += 3) @@ -352,38 +352,38 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT S32 idx1 = mesh->mIndices[iInd + 1]; S32 idx2 = mesh->mIndices[iInd + 2]; - const Point3F& v0 = mesh->verts[idx0]; - const Point3F& v1 = mesh->verts[idx1]; - const Point3F& v2 = mesh->verts[idx2]; + const Point3F& v0 = mesh->mVerts[idx0]; + const Point3F& v1 = mesh->mVerts[idx1]; + const Point3F& v2 = mesh->mVerts[idx2]; Point3F n; mCross(v2 - v0, v1 - v0, &n); n.normalize(); // remove this to use 'weighted' normals (large triangles will have more effect) - mesh->norms[idx0] += n; - mesh->norms[idx1] += n; - mesh->norms[idx2] += n; + mesh->mNorms[idx0] += n; + mesh->mNorms[idx1] += n; + mesh->mNorms[idx2] += n; } // Normalize the vertex normals (this takes care of averaging the triangle normals) - for (S32 iNorm = 0; iNorm < mesh->norms.size(); iNorm++) - mesh->norms[iNorm].normalize(); + for (S32 iNorm = 0; iNorm < mesh->mNorms.size(); iNorm++) + mesh->mNorms[iNorm].normalize(); // Set some dummy UVs - mesh->tverts.setSize( numVerts ); - for ( S32 j = 0; j < mesh->tverts.size(); j++ ) - mesh->tverts[j].set( 0, 0 ); + mesh->mTverts.setSize( numVerts ); + for ( S32 j = 0; j < mesh->mTverts.size(); j++ ) + mesh->mTverts[j].set( 0, 0 ); // Add a single triangle-list primitive - mesh->primitives.increment(); - mesh->primitives.last().start = 0; - mesh->primitives.last().numElements = mesh->mIndices.size(); - mesh->primitives.last().matIndex = TSDrawPrimitive::Triangles | + mesh->mPrimitives.increment(); + mesh->mPrimitives.last().start = 0; + mesh->mPrimitives.last().numElements = mesh->mIndices.size(); + mesh->mPrimitives.last().matIndex = TSDrawPrimitive::Triangles | TSDrawPrimitive::Indexed | TSDrawPrimitive::NoMaterial; - mesh->createTangents( mesh->verts, mesh->norms ); - mesh->encodedNorms.set( NULL,0 ); + mesh->createTangents( mesh->mVerts, mesh->mNorms); + mesh->mEncodedNorms.set( NULL,0 ); return mesh; } @@ -404,13 +404,13 @@ void MeshFit::addBox( const Point3F& sides, const MatrixF& mat ) if ( !mesh ) return; - if (mesh->verts.size() > 0) + if (mesh->mVerts.size() > 0) { - for (S32 i = 0; i < mesh->verts.size(); i++) + for (S32 i = 0; i < mesh->mVerts.size(); i++) { - Point3F v = mesh->verts[i]; + Point3F v = mesh->mVerts[i]; v.convolve(sides); - mesh->verts[i] = v; + mesh->mVerts[i] = v; } mesh->mVertexData.setReady(false); @@ -799,7 +799,7 @@ DefineTSShapeConstructorMethod( addPrimitive, bool, ( const char* meshName, cons MatrixF mat( txfm.getMatrix() ); // Transform the mesh vertices - if ( mesh->mVertexData.isReady() && mesh->verts.size() == 0 ) + if ( mesh->mVertexData.isReady() && mesh->mVerts.size() == 0 ) { for (S32 i = 0; i < mesh->mVertexData.size(); i++) { @@ -811,10 +811,10 @@ DefineTSShapeConstructorMethod( addPrimitive, bool, ( const char* meshName, cons } else { - for (S32 i = 0; i < mesh->verts.size(); i++) + for (S32 i = 0; i < mesh->mVerts.size(); i++) { - Point3F v(mesh->verts[i]); - mat.mulP( v, &mesh->verts[i] ); + Point3F v(mesh->mVerts[i]); + mat.mulP( v, &mesh->mVerts[i] ); } } diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index c5bc3000b..f1f77d91a 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -592,11 +592,11 @@ void TSShape::initObjects() if (mesh->mParentMesh >= 0 && mesh->mParentMesh < meshes.size()) { - mesh->parentMeshObject = meshes[mesh->mParentMesh]; + mesh->mParentMeshObject = meshes[mesh->mParentMesh]; } else { - mesh->parentMeshObject = NULL; + mesh->mParentMeshObject = NULL; } mesh->mVertexFormat = &mVertexFormat; @@ -623,7 +623,7 @@ void TSShape::initVertexBuffers() continue; destIndices += mesh->mIndices.size(); - destPrims += mesh->primitives.size(); + destPrims += mesh->mPrimitives.size(); } // For HW skinning we can just use the static buffer @@ -660,14 +660,14 @@ void TSShape::initVertexBuffers() AssertFatal(mesh->mVertOffset / mVertexSize == vertStart, "offset mismatch"); vertStart += mesh->mNumVerts; - primStart += mesh->primitives.size(); + primStart += mesh->mPrimitives.size(); indStart += mesh->mIndices.size(); mesh->mVB = mShapeVertexBuffer; mesh->mPB = mShapeVertexIndices; // Advance - piInput += mesh->primitives.size(); + piInput += mesh->mPrimitives.size(); ibIndices += mesh->mIndices.size(); if (TSSkinMesh::smDebugSkinVerts && mesh->getMeshType() == TSMesh::SkinMeshType) @@ -906,12 +906,12 @@ void TSShape::initVertexFeatures() mesh->mVertexData.setReady(true); #ifdef TORQUE_DEBUG - AssertFatal(mesh->mNumVerts == mesh->verts.size(), "vert mismatch"); + AssertFatal(mesh->mNumVerts == mesh->mVerts.size(), "vert mismatch"); for (U32 i = 0; i < mesh->mNumVerts; i++) { - Point3F v1 = mesh->verts[i]; + Point3F v1 = mesh->mVerts[i]; Point3F v2 = mesh->mVertexData.getBase(i).vert(); - AssertFatal(mesh->verts[i] == mesh->mVertexData.getBase(i).vert(), "vert data mismatch"); + AssertFatal(mesh->mVerts[i] == mesh->mVertexData.getBase(i).vert(), "vert data mismatch"); } if (mesh->getMeshType() == TSMesh::SkinMeshType) @@ -987,11 +987,11 @@ void TSShape::initMaterialList() if (!mesh) continue; - for (k=0; kprimitives.size(); k++) + for (k=0; kmPrimitives.size(); k++) { - if (mesh->primitives[k].matIndex & TSDrawPrimitive::NoMaterial) + if (mesh->mPrimitives[k].matIndex & TSDrawPrimitive::NoMaterial) continue; - S32 flags = materialList->getFlags(mesh->primitives[k].matIndex & TSDrawPrimitive::MaterialMask); + S32 flags = materialList->getFlags(mesh->mPrimitives[k].matIndex & TSDrawPrimitive::MaterialMask); if (flags & TSMaterialList::AuxiliaryMap) continue; if (flags & TSMaterialList::Translucent) @@ -1001,7 +1001,7 @@ void TSShape::initMaterialList() break; } } - if (k!=mesh->primitives.size()) + if (k!=mesh->mPrimitives.size()) break; } if (j!=obj.numMeshes) @@ -1521,15 +1521,15 @@ void TSShape::assembleShape() // fill in location of verts, tverts, and normals for detail levels if (mesh && meshType!=TSMesh::DecalMeshType) { - TSMesh::smVertsList[i] = mesh->verts.address(); - TSMesh::smTVertsList[i] = mesh->tverts.address(); + TSMesh::smVertsList[i] = mesh->mVerts.address(); + TSMesh::smTVertsList[i] = mesh->mTverts.address(); if (smReadVersion >= 26) { - TSMesh::smTVerts2List[i] = mesh->tverts2.address(); - TSMesh::smColorsList[i] = mesh->colors.address(); + TSMesh::smTVerts2List[i] = mesh->mTverts2.address(); + TSMesh::smColorsList[i] = mesh->mColors.address(); } - TSMesh::smNormsList[i] = mesh->norms.address(); - TSMesh::smEncodedNormsList[i] = mesh->encodedNorms.address(); + TSMesh::smNormsList[i] = mesh->mNorms.address(); + TSMesh::smEncodedNormsList[i] = mesh->mEncodedNorms.address(); TSMesh::smDataCopied[i] = !skip; // as long as we didn't skip this mesh, the data should be in shape now if (meshType==TSMesh::SkinMeshType) { @@ -1617,9 +1617,9 @@ void TSShape::assembleShape() if (skin) { TSMesh::smVertsList[i] = skin->batchData.initialVerts.address(); - TSMesh::smTVertsList[i] = skin->tverts.address(); + TSMesh::smTVertsList[i] = skin->mTverts.address(); TSMesh::smNormsList[i] = skin->batchData.initialNorms.address(); - TSMesh::smEncodedNormsList[i] = skin->encodedNorms.address(); + TSMesh::smEncodedNormsList[i] = skin->mEncodedNorms.address(); TSMesh::smDataCopied[i] = !skip; // as long as we didn't skip this mesh, the data should be in shape now TSSkinMesh::smInitTransformList[i] = skin->batchData.initialTransforms.address(); TSSkinMesh::smVertexIndexList[i] = skin->vertexIndex.address(); @@ -1805,15 +1805,15 @@ bool TSShape::canWriteOldFormat() const continue; // Cannot use old format if using the new functionality (COLORs, 2nd UV set) - if (meshes[i]->tverts2.size() || meshes[i]->colors.size()) + if (meshes[i]->mTverts2.size() || meshes[i]->mColors.size()) return false; // Cannot use old format if any primitive has too many triangles // (ie. cannot fit in a S16) - for (S32 j = 0; j < meshes[i]->primitives.size(); j++) + for (S32 j = 0; j < meshes[i]->mPrimitives.size(); j++) { - if ((meshes[i]->primitives[j].start + - meshes[i]->primitives[j].numElements) >= (1 << 15)) + if ((meshes[i]->mPrimitives[j].start + + meshes[i]->mPrimitives[j].numElements) >= (1 << 15)) { return false; } diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 612b5dcf7..50b500828 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -1340,7 +1340,7 @@ DefineTSShapeConstructorMethod( getMeshMaterial, const char*, ( const char* name GET_MESH( getMeshMaterial, mesh, name, "" ); // Return the name of the first material attached to this mesh - S32 matIndex = mesh->primitives[0].matIndex & TSDrawPrimitive::MaterialMask; + S32 matIndex = mesh->mPrimitives[0].matIndex & TSDrawPrimitive::MaterialMask; if ((matIndex >= 0) && (matIndex < mShape->materialList->size())) return mShape->materialList->getMaterialName( matIndex ); else @@ -1377,10 +1377,10 @@ DefineTSShapeConstructorMethod( setMeshMaterial, bool, ( const char* meshName, c } // Set this material for all primitives in the mesh - for ( S32 i = 0; i < mesh->primitives.size(); i++ ) + for ( S32 i = 0; i < mesh->mPrimitives.size(); i++ ) { - U32 matType = mesh->primitives[i].matIndex & ( TSDrawPrimitive::TypeMask | TSDrawPrimitive::Indexed ); - mesh->primitives[i].matIndex = ( matType | matIndex ); + U32 matType = mesh->mPrimitives[i].matIndex & ( TSDrawPrimitive::TypeMask | TSDrawPrimitive::Indexed ); + mesh->mPrimitives[i].matIndex = ( matType | matIndex ); } ADD_TO_CHANGE_SET(); diff --git a/Engine/source/ts/tsShapeEdit.cpp b/Engine/source/ts/tsShapeEdit.cpp index c0c540a66..f1b35a928 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -938,7 +938,7 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const // Copy mesh elements mesh->mIndices = srcMesh->mIndices; - mesh->primitives = srcMesh->primitives; + mesh->mPrimitives = srcMesh->mPrimitives; mesh->numFrames = srcMesh->numFrames; mesh->numMatFrames = srcMesh->numMatFrames; mesh->vertsPerFrame = srcMesh->vertsPerFrame; @@ -948,8 +948,8 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const // Copy vertex data in an *unpacked* form mesh->copySourceVertexDataFrom(srcMesh); - mesh->createTangents(mesh->verts, mesh->norms); - mesh->encodedNorms.set(NULL, 0); + mesh->createTangents(mesh->mVerts, mesh->mNorms); + mesh->mEncodedNorms.set(NULL, 0); mesh->computeBounds(); @@ -1108,12 +1108,12 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String // Copy materials used by the source mesh (only if from a different shape) if (srcShape != this) { - for (S32 i = 0; i < mesh->primitives.size(); i++) + for (S32 i = 0; i < mesh->mPrimitives.size(); i++) { - if (!(mesh->primitives[i].matIndex & TSDrawPrimitive::NoMaterial)) + if (!(mesh->mPrimitives[i].matIndex & TSDrawPrimitive::NoMaterial)) { - S32 drawType = (mesh->primitives[i].matIndex & (~TSDrawPrimitive::MaterialMask)); - S32 srcMatIndex = mesh->primitives[i].matIndex & TSDrawPrimitive::MaterialMask; + S32 drawType = (mesh->mPrimitives[i].matIndex & (~TSDrawPrimitive::MaterialMask)); + S32 srcMatIndex = mesh->mPrimitives[i].matIndex & TSDrawPrimitive::MaterialMask; const String& matName = srcShape->materialList->getMaterialName(srcMatIndex); // Add the material if it does not already exist @@ -1124,7 +1124,7 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String materialList->push_back(matName, srcShape->materialList->getFlags(srcMatIndex)); } - mesh->primitives[i].matIndex = drawType | destMatIndex; + mesh->mPrimitives[i].matIndex = drawType | destMatIndex; } } } diff --git a/Engine/source/ts/tsSortedMesh.cpp b/Engine/source/ts/tsSortedMesh.cpp index e2c5b489c..8a88ff319 100644 --- a/Engine/source/ts/tsSortedMesh.cpp +++ b/Engine/source/ts/tsSortedMesh.cpp @@ -86,10 +86,10 @@ S32 TSSortedMesh::getNumPolys() Cluster & cluster = clusters[cIdx]; for (S32 i=cluster.startPrimitive; i