From e2545c359c850ccdcd2310a75b9b506a17179f0f Mon Sep 17 00:00:00 2001 From: bank Date: Tue, 13 May 2014 12:43:01 +0400 Subject: [PATCH] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSMesh --- .../source/gui/editor/guiShapeEdPreview.cpp | 6 +- Engine/source/ts/loader/appMesh.cpp | 24 +- Engine/source/ts/loader/tsShapeLoader.cpp | 2 +- Engine/source/ts/tsCollision.cpp | 30 +- Engine/source/ts/tsMesh.cpp | 530 +++++++++--------- Engine/source/ts/tsMesh.h | 48 +- Engine/source/ts/tsMeshFit.cpp | 86 +-- Engine/source/ts/tsShape.cpp | 36 +- Engine/source/ts/tsShapeConstruct.cpp | 8 +- Engine/source/ts/tsShapeEdit.cpp | 34 +- Engine/source/ts/tsSortedMesh.cpp | 6 +- Engine/source/ts/tsSortedMesh.h | 2 +- 12 files changed, 406 insertions(+), 406 deletions(-) diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 098ff38f3..6d0841d7f 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -1228,9 +1228,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 d7a5088ea..404d81bdb 100644 --- a/Engine/source/ts/loader/appMesh.cpp +++ b/Engine/source/ts/loader/appMesh.cpp @@ -147,22 +147,22 @@ TSMesh* AppMesh::constructTSMesh() } // Copy mesh elements - tsmesh->verts = mPoints; - tsmesh->norms = mNormals; - tsmesh->tverts = mUVs; - tsmesh->primitives = mPrimitives; - tsmesh->indices = mIndices; - tsmesh->colors = mColors; - tsmesh->tverts2 = mUV2s; + tsmesh->mVerts = mPoints; + tsmesh->mNorms = mNormals; + tsmesh->mTVerts = mUVs; + tsmesh->mPrimitives = mPrimitives; + tsmesh->mIndices = mIndices; + tsmesh->mColors = mColors; + tsmesh->mTVerts2 = mUV2s; // Finish initializing the shape tsmesh->setFlags(mFlags); tsmesh->computeBounds(); - tsmesh->numFrames = mNumFrames; - tsmesh->numMatFrames = mNumMatFrames; - tsmesh->vertsPerFrame = mVertsPerFrame; - tsmesh->createTangents(tsmesh->verts, tsmesh->norms); - tsmesh->encodedNorms.set(NULL,0); + tsmesh->mNumFrames = mNumFrames; + tsmesh->mNumMatFrames = mNumMatFrames; + tsmesh->mVertsPerFrame = mVertsPerFrame; + 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 464de6a5d..542c23530 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -1157,7 +1157,7 @@ void TSShapeLoader::install() { TSMesh *mesh = mShape->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 bb57bf1c5..47cf594ed 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)" ); @@ -1377,16 +1377,16 @@ void TSMesh::prepOpcodeCollision() else { // Have to walk the tristrip to get a count... may have degenerates - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -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)" ); @@ -1421,9 +1421,9 @@ void TSMesh::prepOpcodeCollision() { for ( S32 j = 0; j < draw.numElements; ) { - curIts->mVRef[2] = base + indices[start + j + 0]; - curIts->mVRef[1] = base + indices[start + j + 1]; - curIts->mVRef[0] = base + indices[start + j + 2]; + curIts->mVRef[2] = base + mIndices[start + j + 0]; + curIts->mVRef[1] = base + mIndices[start + j + 1]; + curIts->mVRef[0] = base + mIndices[start + j + 2]; curIts->mMatIdx = matIndex; curIts++; @@ -1434,16 +1434,16 @@ void TSMesh::prepOpcodeCollision() { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -1462,7 +1462,7 @@ void TSMesh::prepOpcodeCollision() if( mVertexData.isReady() ) pts[i].Set( mVertexData[i].vert().x, mVertexData[i].vert().y, mVertexData[i].vert().z ); 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 ); mi->SetPointers( its, pts ); diff --git a/Engine/source/ts/tsMesh.cpp b/Engine/source/ts/tsMesh.cpp index f1af288f1..c5d5e9f3a 100644 --- a/Engine/source/ts/tsMesh.cpp +++ b/Engine/source/ts/tsMesh.cpp @@ -126,7 +126,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 ); } @@ -152,7 +152,7 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata, { PROFILE_SCOPE( TSMesh_InnerRender ); - if( vertsPerFrame <= 0 ) + if( mVertsPerFrame <= 0 ) return; F32 meshVisibility = rdata.getFadeOverride() * mVisibility; @@ -213,9 +213,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 ) @@ -242,7 +242,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 ) matInst = InstancingMaterialHook::getInstancingMat( matInst ); #endif @@ -280,14 +280,14 @@ 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 ] ); + gNormalStore.setSize( mVertsPerFrame ); + for ( S32 i = 0; i < mEncodedNorms.size(); i++ ) + gNormalStore[i] = decodeNormal( mEncodedNorms[ i + firstVert ] ); return gNormalStore.address(); } - return &norms[firstVert]; + return &mNorms[firstVert]; } //----------------------------------------------------- @@ -296,10 +296,10 @@ const Point3F * TSMesh::getNormals( S32 firstVert ) bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceKey, TSMaterialList *materials ) { - S32 firstVert = vertsPerFrame * frame, i, base = 0; + S32 firstVert = mVertsPerFrame * frame, i, base = 0; // add the verts... - if ( vertsPerFrame ) + if ( mVertsPerFrame ) { if ( mVertexData.isReady() ) { @@ -307,7 +307,7 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK if ( opList ) { base = opList->mVertexList.size(); - for ( i = 0; i < vertsPerFrame; i++ ) + for ( i = 0; i < mVertsPerFrame; i++ ) { // Don't use vertex() method as we want to retain the original indices OptimizedPolyList::VertIndex vert; @@ -323,7 +323,7 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK else { base = polyList->addPointAndNormal( mVertexData[firstVert].vert(), mVertexData[firstVert].normal() ); - for ( i = 1; i < vertsPerFrame; i++ ) + for ( i = 1; i < mVertsPerFrame; i++ ) { polyList->addPointAndNormal( mVertexData[ i + firstVert ].vert(), mVertexData[ i + firstVert ].normal() ); } @@ -335,32 +335,32 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK if ( opList ) { base = opList->mVertexList.size(); - for ( i = 0; i < vertsPerFrame; i++ ) + for ( i = 0; i < mVertsPerFrame; i++ ) { // 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 ( mHasTVert2 ) - vert.uv1Idx = opList->insertUV1( tverts2[ i + firstVert ] ); + vert.uv1Idx = opList->insertUV1( mTVerts2[ i + firstVert ] ); opList->mVertexList.push_back( vert ); } } else { - base = polyList->addPointAndNormal( verts[firstVert], norms[firstVert] ); - for ( i = 1; i < vertsPerFrame; i++ ) - polyList->addPointAndNormal( verts[ i + firstVert ], norms[ i + firstVert ] ); + base = polyList->addPointAndNormal( mVerts[firstVert], mNorms[firstVert] ); + for ( i = 1; i < mVertsPerFrame; i++ ) + 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)" ); @@ -373,9 +373,9 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { for ( S32 j = 0; j < draw.numElements; ) { - U32 idx0 = base + indices[start + j + 0]; - U32 idx1 = base + indices[start + j + 1]; - U32 idx2 = base + indices[start + j + 2]; + U32 idx0 = base + mIndices[start + j + 0]; + U32 idx1 = base + mIndices[start + j + 1]; + U32 idx2 = base + mIndices[start + j + 2]; polyList->begin(material,surfaceKey++); polyList->vertex( idx0 ); polyList->vertex( idx1 ); @@ -389,16 +389,16 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -416,20 +416,20 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexFeature* cf, U32& ) { - S32 firstVert = vertsPerFrame * frame; + S32 firstVert = mVertsPerFrame * frame; S32 i; S32 base = cf->mVertexList.size(); - for ( i = 0; i < vertsPerFrame; i++ ) + for ( i = 0; i < mVertsPerFrame; i++ ) { cf->mVertexList.increment(); mat.mulP( mVertexData[firstVert + i].vert(), &cf->mVertexList.last() ); } // 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)" ); @@ -439,22 +439,22 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF { for ( S32 j = 0; j < draw.numElements; j += 3 ) { - PlaneF plane( cf->mVertexList[base + indices[start + j + 0]], - cf->mVertexList[base + indices[start + j + 1]], - cf->mVertexList[base + indices[start + j + 2]]); + PlaneF plane( cf->mVertexList[base + mIndices[start + j + 0]], + cf->mVertexList[base + mIndices[start + j + 1]], + cf->mVertexList[base + mIndices[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]; + cf->mFaceList.last().vertex[0] = base + mIndices[start + j + 0]; + cf->mFaceList.last().vertex[1] = base + mIndices[start + j + 1]; + cf->mFaceList.last().vertex[2] = base + mIndices[start + j + 2]; for ( U32 l = 0; l < 3; l++ ) { U32 newEdge0, newEdge1; - U32 zero = base + indices[start + j + l]; - U32 one = base + indices[start + j + ((l+1)%3)]; + U32 zero = base + mIndices[start + j + l]; + U32 one = base + mIndices[start + j + ((l+1)%3)]; newEdge0 = getMin( zero, one ); newEdge1 = getMax( zero, one ); bool found = false; @@ -481,15 +481,15 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -575,23 +575,23 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF void TSMesh::support( S32 frame, const Point3F &v, F32 *currMaxDP, Point3F *currSupport ) { - if ( vertsPerFrame == 0 ) + if ( mVertsPerFrame == 0 ) return; U32 waterMark = FrameAllocator::getWaterMark(); - F32* pDots = (F32*)FrameAllocator::alloc( sizeof(F32) * vertsPerFrame ); + F32* pDots = (F32*)FrameAllocator::alloc( sizeof(F32) * mVertsPerFrame ); - S32 firstVert = vertsPerFrame * frame; + S32 firstVert = mVertsPerFrame * frame; m_point3F_bulk_dot( &v.x, &mVertexData[firstVert].vert().x, - vertsPerFrame, + mVertsPerFrame, mVertexData.vertSize(), pDots ); F32 localdp = *currMaxDP; S32 index = -1; - for ( S32 i = 0; i < vertsPerFrame; i++ ) + for ( S32 i = 0; i < mVertsPerFrame; i++ ) { if ( pDots[i] > localdp ) { @@ -611,7 +611,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. @@ -641,15 +641,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 @@ -731,10 +731,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 ); @@ -755,13 +755,13 @@ bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, Ray bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList* materials ) { - if( vertsPerFrame <= 0 ) + if( mVertsPerFrame <= 0 ) return false; if( mNumVerts == 0 ) return false; - S32 firstVert = vertsPerFrame * frame; + S32 firstVert = mVertsPerFrame * frame; bool found = false; F32 best_t = F32_MAX; @@ -769,9 +769,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)" ); @@ -786,9 +786,9 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & { for ( S32 j = 0; j < draw.numElements-2; j++) { - idx0 = indices[drawStart + j + 0]; - idx1 = indices[drawStart + j + 1]; - idx2 = indices[drawStart + j + 2]; + idx0 = mIndices[drawStart + j + 0]; + idx1 = mIndices[drawStart + j + 1]; + idx2 = mIndices[drawStart + j + 2]; F32 cur_t = 0; Point2F b; @@ -812,15 +812,15 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::castRayRendered (2)" ); - idx0 = indices[drawStart + 0]; - idx2 = indices[drawStart + 1]; + idx0 = mIndices[drawStart + 0]; + idx2 = mIndices[drawStart + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = indices[drawStart + j]; + idx2 = mIndices[drawStart + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -905,35 +905,35 @@ bool TSMesh::addToHull( U32 idx0, U32 idx1, U32 idx2 ) normal.normalize(); F32 k = mDot( normal, mVertexData[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++ ) + for ( frame = 0; frame < mNumFrames; frame++ ) { - S32 firstVert = vertsPerFrame * frame; - S32 firstPlane = planeNormals.size(); - for ( i = 0; i < primitives.size(); i++ ) + S32 firstVert = mVertsPerFrame * frame; + 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)" ); @@ -942,71 +942,71 @@ bool TSMesh::buildConvexHull() if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { for ( j = 0; j < draw.numElements; j += 3 ) - if ( addToHull( indices[start + j + 0] + firstVert, - indices[start + j + 1] + firstVert, - indices[start + j + 2] + firstVert ) && frame == 0 ) - planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); + if ( addToHull( mIndices[start + j + 0] + firstVert, + mIndices[start + j + 1] + firstVert, + mIndices[start + j + 2] + firstVert ) && frame == 0 ) + mPlaneMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } else { AssertFatal( (draw.matIndex&TSDrawPrimitive::Strip) == TSDrawPrimitive::Strip,"TSMesh::buildConvexHull (2)" ); - U32 idx0 = indices[start + 0] + firstVert; + U32 idx0 = mIndices[start + 0] + firstVert; U32 idx1; - U32 idx2 = indices[start + 1] + firstVert; + U32 idx2 = mIndices[start + 1] + firstVert; U32 * nextIdx = &idx1; for ( j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1 ); - idx2 = indices[start + j] + firstVert; + 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[firstVert + i].vert(), planeNormals[j] ) - planeConstants[j] < 0.01 ) // .01 == a little slack + for ( i = 0; i < mVertsPerFrame; i++ ) + for ( j = firstPlane; j < mPlaneNormals.size(); j++ ) + if ( mDot( mVertexData[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; } @@ -1036,21 +1036,21 @@ void TSMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 frame, numVerts = mNumVerts; else { - baseVert = &mVertexData[frame * vertsPerFrame].vert(); - numVerts = vertsPerFrame; + baseVert = &mVertexData[frame * mVertsPerFrame].vert(); + numVerts = mVertsPerFrame; } } else { - baseVert = verts.address(); + baseVert = mVerts.address(); stride = sizeof(Point3F); if ( frame < 0 ) - numVerts = verts.size(); + numVerts = mVerts.size(); else { - baseVert += frame * vertsPerFrame; - numVerts = vertsPerFrame; + baseVert += frame * mVertsPerFrame; + numVerts = mVertsPerFrame; } } computeBounds( baseVert, numVerts, stride, transform, bounds, center, radius ); @@ -1107,27 +1107,27 @@ 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 ((indices[j] != indices[j+1]) && - (indices[j] != indices[j+2]) && - (indices[j+1] != indices[j+2])) + if ((mIndices[j] != mIndices[j+1]) && + (mIndices[j] != mIndices[j+2]) && + (mIndices[j+1] != mIndices[j+2])) count++; } break; @@ -1138,12 +1138,12 @@ S32 TSMesh::getNumPolys() const //----------------------------------------------------- -TSMesh::TSMesh() : meshType( StandardMeshType ) +TSMesh::TSMesh() : mMeshType( StandardMeshType ) { - VECTOR_SET_ASSOCIATION( planeNormals ); - VECTOR_SET_ASSOCIATION( planeConstants ); - VECTOR_SET_ASSOCIATION( planeMaterials ); - parentMesh = -1; + VECTOR_SET_ASSOCIATION( mPlaneNormals ); + VECTOR_SET_ASSOCIATION( mPlaneConstants ); + VECTOR_SET_ASSOCIATION( mPlaneMaterials ); + mParentMesh = -1; mOptTree = NULL; mOpMeshInterface = NULL; @@ -1184,17 +1184,17 @@ void TSSkinMesh::updateSkin( const Vector &transforms, TSVertexBufferHa // set arrays #if defined(TORQUE_MAX_LIB) - verts.setSize(batchData.initialVerts.size()); - norms.setSize(batchData.initialNorms.size()); + mVerts.setSize(batchData.initialVerts.size()); + mNorms.setSize(batchData.initialNorms.size()); #else - if ( !batchDataInitialized && encodedNorms.size() ) + if ( !batchDataInitialized && mEncodedNorms.size() ) { // we co-opt responsibility for updating encoded normals from mesh - gNormalStore.setSize( vertsPerFrame ); - for ( S32 i = 0; i < vertsPerFrame; i++ ) - gNormalStore[i] = decodeNormal( encodedNorms[i] ); + gNormalStore.setSize( mVertsPerFrame ); + for ( S32 i = 0; i < mVertsPerFrame; i++ ) + gNormalStore[i] = decodeNormal( mEncodedNorms[i] ); - batchData.initialNorms.set( gNormalStore.address(), vertsPerFrame ); + batchData.initialNorms.set( gNormalStore.address(), mVertsPerFrame ); } #endif @@ -1497,7 +1497,7 @@ void TSSkinMesh::render( TSMaterialList *materials, createBatchData(); const bool vertsChanged = vertexBuffer.isNull() || vertexBuffer->mNumVerts != mNumVerts; - const bool primsChanged = primitiveBuffer.isNull() || primitiveBuffer->mIndexCount != indices.size(); + const bool primsChanged = primitiveBuffer.isNull() || primitiveBuffer->mIndexCount != mIndices.size(); if ( primsChanged || vertsChanged || isSkinDirty ) { @@ -2406,17 +2406,17 @@ void TSMesh::_createVBIB( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb } #endif - const bool primsChanged = ( pb.isValid() && pb->mIndexCount != indices.size() ); + const bool primsChanged = ( pb.isValid() && pb->mIndexCount != mIndices.size() ); if( primsChanged || pb.isNull() ) { // go through and create PrimitiveInfo array Vector piArray; 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 ); @@ -2427,7 +2427,7 @@ void TSMesh::_createVBIB( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb pInfo.numPrimitives = draw.numElements / 3; pInfo.startIndex = draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = indices[draw.start] & 0xFFFF0000; + pInfo.startVertex = mIndices[draw.start] & 0xFFFF0000; pInfo.minIndex = pInfo.startVertex; pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex); break; @@ -2438,7 +2438,7 @@ void TSMesh::_createVBIB( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb pInfo.numPrimitives = draw.numElements - 2; pInfo.startIndex = draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = indices[draw.start] & 0xFFFF0000; + pInfo.startVertex = mIndices[draw.start] & 0xFFFF0000; pInfo.minIndex = pInfo.startVertex; pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex); break; @@ -2450,13 +2450,13 @@ void TSMesh::_createVBIB( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb piArray.push_back( pInfo ); } - pb.set( GFX, indices.size(), piArray.size(), GFXBufferTypeStatic ); + pb.set( GFX, mIndices.size(), piArray.size(), GFXBufferTypeStatic ); U16 *ibIndices = NULL; GFXPrimitive *piInput = NULL; pb.lock( &ibIndices, &piInput ); - dCopyArray( ibIndices, indices.address(), indices.size() ); + dCopyArray( ibIndices, mIndices.address(), mIndices.size() ); dMemcpy( piInput, piArray.address(), piArray.size() * sizeof(GFXPrimitive) ); pb.unlock(); @@ -2467,59 +2467,59 @@ void TSMesh::assemble( bool skip ) { tsalloc.checkGuard(); - numFrames = tsalloc.get32(); - numMatFrames = tsalloc.get32(); - parentMesh = tsalloc.get32(); + mNumFrames = tsalloc.get32(); + mNumMatFrames = tsalloc.get32(); + mParentMesh = tsalloc.get32(); tsalloc.get32( (S32*)&mBounds, 6 ); tsalloc.get32( (S32*)&mCenter, 3 ); mRadius = (F32)tsalloc.get32(); S32 numVerts = tsalloc.get32(); - S32 *ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); - verts.set( (Point3F*)ptr32, numVerts ); + S32 *ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); + mVerts.set( (Point3F*)ptr32, numVerts ); S32 numTVerts = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); - tverts.set( (Point2F*)ptr32, numTVerts ); + ptr32 = getSharedData32( mParentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); + mTVerts.set( (Point2F*)ptr32, numTVerts ); if ( TSShape::smReadVersion > 25 ) { numTVerts = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); - tverts2.set( (Point2F*)ptr32, numTVerts ); + ptr32 = getSharedData32( mParentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); + mTVerts2.set( (Point2F*)ptr32, numTVerts ); S32 numVColors = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, numVColors, (S32**)smColorsList.address(), skip ); - colors.set( (ColorI*)ptr32, numVColors ); + ptr32 = getSharedData32( mParentMesh, numVColors, (S32**)smColorsList.address(), skip ); + mColors.set( (ColorI*)ptr32, numVColors ); } S8 *ptr8; if ( TSShape::smReadVersion > 21 && TSMesh::smUseEncodedNormals) { // we have encoded normals and we want to use them... - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) tsalloc.getPointer32( numVerts * 3 ); // advance past norms, don't use - norms.set( NULL, 0 ); + mNorms.set( NULL, 0 ); - ptr8 = getSharedData8( parentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); - encodedNorms.set( ptr8, numVerts ); + ptr8 = getSharedData8( mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); + mEncodedNorms.set( ptr8, numVerts ); } else if ( TSShape::smReadVersion > 21 ) { // we have encoded normals but we don't want to use them... - ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - norms.set( (Point3F*)ptr32, numVerts ); + ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + mNorms.set( (Point3F*)ptr32, numVerts ); - if ( parentMesh < 0 ) + 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( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - norms.set( (Point3F*)ptr32, numVerts ); - encodedNorms.set( NULL, 0 ); + ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + mNorms.set( (Point3F*)ptr32, numVerts ); + mEncodedNorms.set( NULL, 0 ); } // copy the primitives and indices...how we do this depends on what @@ -2593,8 +2593,8 @@ void TSMesh::assemble( bool skip ) AssertFatal(chkPrim==szPrimOut && chkInd==szIndOut,"TSMesh::primitive conversion"); // store output - primitives.set(primOut, szPrimOut); - indices.set(indOut, szIndOut); + mPrimitives.set(primOut, szPrimOut); + mIndices.set(indOut, szIndOut); // delete temporary arrays if necessary if (deleteInputArrays) @@ -2607,9 +2607,9 @@ void TSMesh::assemble( bool skip ) tsalloc.getPointer16( sz ); // skip deprecated merge indices tsalloc.align32(); - vertsPerFrame = tsalloc.get32(); + mVertsPerFrame = tsalloc.get32(); U32 flags = (U32)tsalloc.get32(); - if ( encodedNorms.size() ) + if ( mEncodedNorms.size() ) flags |= UseEncodedNormals; setFlags( flags ); @@ -2620,16 +2620,16 @@ void TSMesh::assemble( bool skip ) computeBounds(); // only do this if we copied the data... if(getMeshType() != SkinMeshType) - createTangents(verts, norms); + createTangents(mVerts, mNorms); } void TSMesh::disassemble() { tsalloc.setGuard(); - tsalloc.set32( numFrames ); - tsalloc.set32( numMatFrames ); - tsalloc.set32( parentMesh ); + tsalloc.set32( mNumFrames ); + tsalloc.set32( mNumMatFrames ); + tsalloc.set32( mParentMesh ); tsalloc.copyToBuffer32( (S32*)&mBounds, 6 ); tsalloc.copyToBuffer32( (S32*)&mCenter, 3 ); tsalloc.set32( (S32)mRadius ); @@ -2637,81 +2637,81 @@ void TSMesh::disassemble() // Re-create the vectors if(mVertexData.isReady()) { - verts.setSize(mNumVerts); - tverts.setSize(mNumVerts); - norms.setSize(mNumVerts); + mVerts.setSize(mNumVerts); + mTVerts.setSize(mNumVerts); + mNorms.setSize(mNumVerts); if(mHasColor) - colors.setSize(mNumVerts); + mColors.setSize(mNumVerts); if(mHasTVert2) - tverts2.setSize(mNumVerts); + mTVerts2.setSize(mNumVerts); // Fill arrays for(U32 i = 0; i < mNumVerts; i++) { const __TSMeshVertexBase &cv = mVertexData[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(mHasColor) - cv.color().getColor(&colors[i]); + cv.color().getColor(&mColors[i]); if(mHasTVert2) - tverts2[i] = cv.tvert2(); + mTVerts2[i] = cv.tvert2(); } } // verts... - tsalloc.set32( verts.size() ); - if ( parentMesh < 0 ) - tsalloc.copyToBuffer32( (S32*)verts.address(), 3 * verts.size() ); // if no parent mesh, then save off our verts + tsalloc.set32( mVerts.size() ); + if ( mParentMesh < 0 ) + tsalloc.copyToBuffer32( (S32*)mVerts.address(), 3 * mVerts.size() ); // if no parent mesh, then save off our verts // tverts... - tsalloc.set32( tverts.size() ); - if ( parentMesh < 0 ) - tsalloc.copyToBuffer32( (S32*)tverts.address(), 2 * tverts.size() ); // if no parent mesh, then save off our tverts + tsalloc.set32( mTVerts.size() ); + if ( mParentMesh < 0 ) + 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() ); - if ( parentMesh < 0 ) - tsalloc.copyToBuffer32( (S32*)tverts2.address(), 2 * tverts2.size() ); // if no parent mesh, then save off our tverts + tsalloc.set32( mTVerts2.size() ); + if ( mParentMesh < 0 ) + tsalloc.copyToBuffer32( (S32*)mTVerts2.address(), 2 * mTVerts2.size() ); // if no parent mesh, then save off our tverts // colors - tsalloc.set32( colors.size() ); - if ( parentMesh < 0 ) - tsalloc.copyToBuffer32( (S32*)colors.address(), colors.size() ); // if no parent mesh, then save off our tverts + tsalloc.set32( mColors.size() ); + if ( mParentMesh < 0 ) + tsalloc.copyToBuffer32( (S32*)mColors.address(), mColors.size() ); // if no parent mesh, then save off our tverts } // norms... - if ( parentMesh < 0 ) // if no parent mesh, then save off our norms - tsalloc.copyToBuffer32( (S32*)norms.address(), 3 * norms.size() ); // norms.size()==verts.size() or error... + if ( mParentMesh < 0 ) // if no parent mesh, then save off our norms + tsalloc.copyToBuffer32( (S32*)mNorms.address(), 3 * mNorms.size() ); // norms.size()==verts.size() or error... // encoded norms... - if ( parentMesh < 0 ) + 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 ); } } // optimize triangle draw order during disassemble { - FrameTemp tmpIdxs(indices.size()); - for ( S32 i = 0; i < primitives.size(); i++ ) + FrameTemp tmpIdxs(mIndices.size()); + 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, - indices.address() + prim.start, tmpIdxs.address()); - dCopyArray(indices.address() + prim.start, tmpIdxs.address(), + TriListOpt::OptimizeTriangleOrdering(mVerts.size(), prim.numElements, + mIndices.address() + prim.start, tmpIdxs.address()); + dCopyArray(mIndices.address() + prim.start, tmpIdxs.address(), prim.numElements); } } @@ -2720,32 +2720,32 @@ 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(indices.size()); - tsalloc.copyToBuffer32((S32*)indices.address(),indices.size()); + tsalloc.set32(mIndices.size()); + tsalloc.copyToBuffer32((S32*)mIndices.address(),mIndices.size()); } else { // primitives - tsalloc.set32( primitives.size() ); - for (S32 i=0; i s16_indices(indices.size()); - for (S32 i=0; i s16_indices(mIndices.size()); + for (S32 i=0; i21 && TSMesh::smUseEncodedNormals ) { // we have encoded normals and we want to use them... - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) tsalloc.getPointer32( numVerts * 3 ); // advance past norms, don't use batchData.initialNorms.set( NULL, 0 ); - ptr8 = getSharedData8( parentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); - encodedNorms.set( ptr8, numVerts ); + ptr8 = getSharedData8( mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); + mEncodedNorms.set( ptr8, numVerts ); // Note: we don't set the encoded normals flag because we handle them in updateSkin and // hide the fact that we are using them from base class (TSMesh) } else if ( TSShape::smReadVersion > 21 ) { // we have encoded normals but we don't want to use them... - ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); batchData.initialNorms.set( (Point3F*)ptr32, numVerts ); - if ( parentMesh < 0 ) + 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( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); batchData.initialNorms.set( (Point3F*)ptr32, numVerts ); - encodedNorms.set( NULL, 0 ); + mEncodedNorms.set( NULL, 0 ); } sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 16 * sz, (S32**)smInitTransformList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, 16 * sz, (S32**)smInitTransformList.address(), skip ); batchData.initialTransforms.set( ptr32, sz ); sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smVertexIndexList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, sz, (S32**)smVertexIndexList.address(), skip ); vertexIndex.set( ptr32, sz ); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smBoneIndexList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, sz, (S32**)smBoneIndexList.address(), skip ); boneIndex.set( ptr32, sz ); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smWeightList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, sz, (S32**)smWeightList.address(), skip ); weight.set( (F32*)ptr32, sz ); sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smNodeIndexList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, sz, (S32**)smNodeIndexList.address(), skip ); batchData.nodeIndex.set( ptr32, sz ); tsalloc.checkGuard(); @@ -2841,7 +2841,7 @@ void TSSkinMesh::disassemble() tsalloc.set32( batchData.initialVerts.size() ); // if we have no parent mesh, then save off our verts & norms - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) { tsalloc.copyToBuffer32( (S32*)batchData.initialVerts.address(), 3 * batchData.initialVerts.size() ); @@ -2851,17 +2851,17 @@ void TSSkinMesh::disassemble() // if no parent mesh, compute encoded normals and copy over for ( S32 i = 0; i < batchData.initialNorms.size(); i++ ) { - U8 normIdx = encodedNorms.size() ? encodedNorms[i] : encodeNormal( batchData.initialNorms[i] ); + U8 normIdx = mEncodedNorms.size() ? mEncodedNorms[i] : encodeNormal( batchData.initialNorms[i] ); tsalloc.copyToBuffer8( (S8*)&normIdx, 1 ); } } tsalloc.set32( batchData.initialTransforms.size() ); - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) tsalloc.copyToBuffer32( (S32*)batchData.initialTransforms.address(), batchData.initialTransforms.size() * 16 ); tsalloc.set32( vertexIndex.size() ); - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) { tsalloc.copyToBuffer32( (S32*)vertexIndex.address(), vertexIndex.size() ); @@ -2871,7 +2871,7 @@ void TSSkinMesh::disassemble() } tsalloc.set32( batchData.nodeIndex.size() ); - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) tsalloc.copyToBuffer32( (S32*)batchData.nodeIndex.address(), batchData.nodeIndex.size() ); tsalloc.setGuard(); @@ -2879,7 +2879,7 @@ void TSSkinMesh::disassemble() TSSkinMesh::TSSkinMesh() { - meshType = SkinMeshType; + mMeshType = SkinMeshType; mDynamic = true; batchDataInitialized = false; } @@ -2898,9 +2898,9 @@ inline void TSMesh::findTangent( U32 index1, const Point3F &v2 = _verts[index2]; const Point3F &v3 = _verts[index3]; - const Point2F &w1 = tverts[index1]; - const Point2F &w2 = tverts[index2]; - const Point2F &w3 = tverts[index3]; + const Point2F &w1 = mTVerts[index1]; + const Point2F &w2 = mTVerts[index2]; + const Point2F &w3 = mTVerts[index3]; F32 x1 = v2.x - v1.x; F32 x2 = v3.x - v1.x; @@ -2958,17 +2958,17 @@ void TSMesh::createTangents(const Vector &_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; U32 p2Index = 0; - U32 *baseIdx = &indices[draw.start]; + U32 *baseIdx = &mIndices[draw.start]; const U32 numElements = (U32)draw.numElements; @@ -3010,7 +3010,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++ ) @@ -3021,19 +3021,19 @@ 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; } } void TSMesh::convertToAlignedMeshData() { if(!mVertexData.isReady()) - _convertToAlignedMeshData(mVertexData, verts, norms); + _convertToAlignedMeshData(mVertexData, mVerts, mNorms); } @@ -3071,7 +3071,7 @@ void TSMesh::_convertToAlignedMeshData( TSMeshVertexArray &vertexData, const Vec AssertFatal(!vertexData.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"); mNumVerts = _verts.size(); @@ -3082,11 +3082,11 @@ void TSMesh::_convertToAlignedMeshData( TSMeshVertexArray &vertexData, const Vec if(mNumVerts == 0) return; - mHasColor = !colors.empty(); - AssertFatal(!mHasColor || colors.size() == _verts.size(), "Vector of color elements should be the same size as other vectors"); + mHasColor = !mColors.empty(); + AssertFatal(!mHasColor || mColors.size() == _verts.size(), "Vector of color elements should be the same size as other vectors"); - mHasTVert2 = !tverts2.empty(); - AssertFatal(!mHasTVert2 || tverts2.size() == _verts.size(), "Vector of tvert2 elements should be the same size as other vectors"); + mHasTVert2 = !mTVerts2.empty(); + AssertFatal(!mHasTVert2 || mTVerts2.size() == _verts.size(), "Vector of tvert2 elements should be the same size as other vectors"); // Create the proper array type void *aligned_mem = dMalloc_aligned(mVertSize * mNumVerts, 16); @@ -3100,21 +3100,21 @@ void TSMesh::_convertToAlignedMeshData( TSMeshVertexArray &vertexData, const Vec __TSMeshVertexBase &v = vertexData[i]; v.vert(_verts[i]); v.normal(_norms[i]); - v.tangent(tangents[i]); + v.tangent(mTangents[i]); - if(i < tverts.size()) - v.tvert(tverts[i]); - if(mHasTVert2 && i < tverts2.size()) - v.tvert2(tverts2[i]); - if(mHasColor && i < colors.size()) - v.color(colors[i]); + if(i < mTVerts.size()) + v.tvert(mTVerts[i]); + if(mHasTVert2 && i < mTVerts2.size()) + v.tvert2(mTVerts2[i]); + if(mHasColor && i < mColors.size()) + v.color(mColors[i]); } // Now that the data is in the aligned struct, free the Vector memory - verts.free_memory(); - norms.free_memory(); - tangents.free_memory(); - tverts.free_memory(); - tverts2.free_memory(); - colors.free_memory(); + mVerts.free_memory(); + mNorms.free_memory(); + mTangents.free_memory(); + mTVerts.free_memory(); + mTVerts2.free_memory(); + mColors.free_memory(); } \ No newline at end of file diff --git a/Engine/source/ts/tsMesh.h b/Engine/source/ts/tsMesh.h index d2ac79087..ff47f84b8 100644 --- a/Engine/source/ts/tsMesh.h +++ b/Engine/source/ts/tsMesh.h @@ -105,7 +105,7 @@ class TSMesh struct TSMeshVertexArray; protected: - U32 meshType; + U32 mMeshType; Box3F mBounds; Point3F mCenter; F32 mRadius; @@ -140,17 +140,17 @@ class TSMesh FlagMask = Billboard|BillboardZAxis|HasDetailTexture|UseEncodedNormals }; - U32 getMeshType() const { return meshType & TypeMask; } - 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; } + 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 ); - S32 parentMesh; ///< index into shapes mesh list - S32 numFrames; - S32 numMatFrames; - S32 vertsPerFrame; + S32 mParentMesh; ///< index into shapes mesh list + S32 mNumFrames; + S32 mNumMatFrames; + S32 mVertsPerFrame; /// @name Aligned Vertex Data /// @{ @@ -244,34 +244,34 @@ class TSMesh FreeableVector& operator=(const FreeableVector& p) { Vector::operator=(p); return *this; } }; - 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 indices; + 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 f82b079f4..9c07cceab 100644 --- a/Engine/source/ts/tsMeshFit.cpp +++ b/Engine/source/ts/tsMeshFit.cpp @@ -246,24 +246,24 @@ 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->indices[draw.start], draw.numElements ); + mIndices.merge( &mesh->mIndices[draw.start], draw.numElements ); } else { - U32 idx0 = mesh->indices[draw.start + 0]; + U32 idx0 = mesh->mIndices[draw.start + 0]; U32 idx1; - U32 idx2 = mesh->indices[draw.start + 1]; + U32 idx2 = mesh->mIndices[draw.start + 1]; U32 *nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = mesh->indices[draw.start + j]; + idx2 = mesh->mIndices[draw.start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -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; @@ -323,69 +323,69 @@ TSMesh* MeshFit::initMeshFromFile( const String& filename ) const TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numTris ) const { TSMesh* mesh = mShape->copyMesh( NULL ); - mesh->numFrames = 1; - mesh->numMatFrames = 1; - mesh->vertsPerFrame = numVerts; + mesh->mNumFrames = 1; + mesh->mNumMatFrames = 1; + mesh->mVertsPerFrame = numVerts; mesh->setFlags(0); mesh->mHasColor = false; mesh->mHasTVert2 = false; mesh->mNumVerts = numVerts; - mesh->indices.reserve( numTris * 3 ); + mesh->mIndices.reserve( numTris * 3 ); for ( S32 i = 0; i < numTris; i++ ) { - mesh->indices.push_back( indices[i*3 + 0] ); - mesh->indices.push_back( indices[i*3 + 2] ); - mesh->indices.push_back( indices[i*3 + 1] ); + mesh->mIndices.push_back( indices[i*3 + 0] ); + mesh->mIndices.push_back( indices[i*3 + 2] ); + 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->indices.size(); iInd += 3) + for (S32 iInd = 0; iInd < mesh->mIndices.size(); iInd += 3) { // Compute the normal for this triangle - S32 idx0 = mesh->indices[iInd + 0]; - S32 idx1 = mesh->indices[iInd + 1]; - S32 idx2 = mesh->indices[iInd + 2]; + S32 idx0 = mesh->mIndices[iInd + 0]; + 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->indices.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; } @@ -792,10 +792,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 726efabff..c17036b3b 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -569,8 +569,8 @@ void TSShape::initVertexFeatures() } else { - hasColors |= !mesh->colors.empty(); - hasTexcoord2 |= !mesh->tverts2.empty(); + hasColors |= !mesh->mColors.empty(); + hasTexcoord2 |= !mesh->mTVerts2.empty(); } } } @@ -676,11 +676,11 @@ void TSShape::initMaterialList() mHasSkinMesh |= mesh->getMeshType() == TSMesh::SkinMeshType; - 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) @@ -690,7 +690,7 @@ void TSShape::initMaterialList() break; } } - if (k!=mesh->primitives.size()) + if (k!=mesh->mPrimitives.size()) break; } if (j!=obj.numMeshes) @@ -1175,15 +1175,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) { @@ -1271,9 +1271,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(); @@ -1448,15 +1448,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 54e288850..0590b4fe9 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -1326,7 +1326,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 @@ -1363,10 +1363,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 8d585022f..ba3c99a51 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -900,11 +900,11 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const return mesh; // return an empty mesh // Copy mesh elements - mesh->indices = srcMesh->indices; - mesh->primitives = srcMesh->primitives; - mesh->numFrames = srcMesh->numFrames; - mesh->numMatFrames = srcMesh->numMatFrames; - mesh->vertsPerFrame = srcMesh->vertsPerFrame; + mesh->mIndices = srcMesh->mIndices; + mesh->mPrimitives = srcMesh->mPrimitives; + mesh->mNumFrames = srcMesh->mNumFrames; + mesh->mNumMatFrames = srcMesh->mNumMatFrames; + mesh->mVertsPerFrame = srcMesh->mVertsPerFrame; mesh->setFlags(srcMesh->getFlags()); mesh->mHasColor = srcMesh->mHasColor; mesh->mHasTVert2 = srcMesh->mHasTVert2; @@ -936,14 +936,14 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const } else { - mesh->verts = srcMesh->verts; - mesh->tverts = srcMesh->tverts; - mesh->tverts2 = srcMesh->tverts2; - mesh->colors = srcMesh->colors; - mesh->norms = srcMesh->norms; + mesh->mVerts = srcMesh->mVerts; + mesh->mTVerts = srcMesh->mTVerts; + mesh->mTVerts2 = srcMesh->mTVerts2; + mesh->mColors = srcMesh->mColors; + mesh->mNorms = srcMesh->mNorms; - mesh->createTangents(mesh->verts, mesh->norms); - mesh->encodedNorms.set(NULL,0); + mesh->createTangents(mesh->mVerts, mesh->mNorms); + mesh->mEncodedNorms.set(NULL,0); mesh->convertToAlignedMeshData(); } @@ -1103,12 +1103,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 @@ -1119,7 +1119,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