mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-09 07:20:40 +00:00
Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSMesh
This commit is contained in:
parent
1778a8d7f2
commit
e2545c359c
12 changed files with 406 additions and 406 deletions
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -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<T>& operator=(const FreeableVector<T>& p) { Vector<T>::operator=(p); return *this; }
|
||||
};
|
||||
|
||||
FreeableVector<Point3F> verts;
|
||||
FreeableVector<Point3F> norms;
|
||||
FreeableVector<Point2F> tverts;
|
||||
FreeableVector<Point4F> tangents;
|
||||
FreeableVector<Point3F> mVerts;
|
||||
FreeableVector<Point3F> mNorms;
|
||||
FreeableVector<Point2F> mTVerts;
|
||||
FreeableVector<Point4F> mTangents;
|
||||
|
||||
// Optional second texture uvs.
|
||||
FreeableVector<Point2F> tverts2;
|
||||
FreeableVector<Point2F> mTVerts2;
|
||||
|
||||
// Optional vertex colors data.
|
||||
FreeableVector<ColorI> colors;
|
||||
FreeableVector<ColorI> mColors;
|
||||
/// @}
|
||||
|
||||
Vector<TSDrawPrimitive> primitives;
|
||||
Vector<U8> encodedNorms;
|
||||
Vector<U32> indices;
|
||||
Vector<TSDrawPrimitive> mPrimitives;
|
||||
Vector<U8> mEncodedNorms;
|
||||
Vector<U32> mIndices;
|
||||
|
||||
/// billboard data
|
||||
Point3F billboardAxis;
|
||||
Point3F mBillboardAxis;
|
||||
|
||||
/// @name Convex Hull Data
|
||||
/// Convex hulls are convex (no angles >= 180º) meshes used for collision
|
||||
/// @{
|
||||
|
||||
Vector<Point3F> planeNormals;
|
||||
Vector<F32> planeConstants;
|
||||
Vector<U32> planeMaterials;
|
||||
S32 planesPerFrame;
|
||||
U32 mergeBufferStart;
|
||||
Vector<Point3F> mPlaneNormals;
|
||||
Vector<F32> mPlaneConstants;
|
||||
Vector<U32> mPlaneMaterials;
|
||||
S32 mPlanesPerFrame;
|
||||
U32 mMergeBufferStart;
|
||||
/// @}
|
||||
|
||||
/// @name Render Methods
|
||||
|
|
|
|||
|
|
@ -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] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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; k<mesh->primitives.size(); k++)
|
||||
for (k=0; k<mesh->mPrimitives.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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,10 +86,10 @@ S32 TSSortedMesh::getNumPolys()
|
|||
Cluster & cluster = clusters[cIdx];
|
||||
for (S32 i=cluster.startPrimitive; i<cluster.endPrimitive; i++)
|
||||
{
|
||||
if (primitives[i].matIndex & TSDrawPrimitive::Triangles)
|
||||
count += primitives[i].numElements / 3;
|
||||
if (mPrimitives[i].matIndex & TSDrawPrimitive::Triangles)
|
||||
count += mPrimitives[i].numElements / 3;
|
||||
else
|
||||
count += primitives[i].numElements - 2;
|
||||
count += mPrimitives[i].numElements - 2;
|
||||
}
|
||||
cIdx = cluster.frontCluster; // always use frontCluster...we assume about the same no matter what
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public:
|
|||
void disassemble();
|
||||
|
||||
TSSortedMesh() {
|
||||
meshType = SortedMeshType;
|
||||
mMeshType = SortedMeshType;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue