mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
tsmesh: parentMesh and indicies to mParentMesh and mIndicies (usual deal, complaints about method vars or temp ones potentially conflicting with class vars)
This commit is contained in:
parent
4a5c36352c
commit
ef0a4bee08
8 changed files with 125 additions and 125 deletions
|
|
@ -421,8 +421,8 @@ bool VolumetricFog::LoadShape()
|
||||||
|
|
||||||
det_size[i].indices = new Vector<U32>();
|
det_size[i].indices = new Vector<U32>();
|
||||||
|
|
||||||
for (U32 k = 0; k < mesh->indices.size(); k++)
|
for (U32 k = 0; k < mesh->mIndices.size(); k++)
|
||||||
det_size[i].indices->push_back(mesh->indices[k]);
|
det_size[i].indices->push_back(mesh->mIndices[k]);
|
||||||
|
|
||||||
U32 primitivesSize = mesh->primitives.size();
|
U32 primitivesSize = mesh->primitives.size();
|
||||||
for (U32 k = 0; k < primitivesSize; k++)
|
for (U32 k = 0; k < primitivesSize; k++)
|
||||||
|
|
@ -436,7 +436,7 @@ bool VolumetricFog::LoadShape()
|
||||||
pInfo.numPrimitives = draw.numElements / 3;
|
pInfo.numPrimitives = draw.numElements / 3;
|
||||||
pInfo.startIndex = draw.start;
|
pInfo.startIndex = draw.start;
|
||||||
// Use the first index to determine which 16-bit address space we are operating in
|
// Use the first index to determine which 16-bit address space we are operating in
|
||||||
pInfo.startVertex = mesh->indices[draw.start] & 0xFFFF0000;
|
pInfo.startVertex = mesh->mIndices[draw.start] & 0xFFFF0000;
|
||||||
pInfo.minIndex = pInfo.startVertex;
|
pInfo.minIndex = pInfo.startVertex;
|
||||||
pInfo.numVertices = getMin((U32)0x10000, mesh->mNumVerts - pInfo.startVertex);
|
pInfo.numVertices = getMin((U32)0x10000, mesh->mNumVerts - pInfo.startVertex);
|
||||||
break;
|
break;
|
||||||
|
|
@ -445,7 +445,7 @@ bool VolumetricFog::LoadShape()
|
||||||
pInfo.numPrimitives = draw.numElements - 2;
|
pInfo.numPrimitives = draw.numElements - 2;
|
||||||
pInfo.startIndex = draw.start;
|
pInfo.startIndex = draw.start;
|
||||||
// Use the first index to determine which 16-bit address space we are operating in
|
// Use the first index to determine which 16-bit address space we are operating in
|
||||||
pInfo.startVertex = mesh->indices[draw.start] & 0xFFFF0000;
|
pInfo.startVertex = mesh->mIndices[draw.start] & 0xFFFF0000;
|
||||||
pInfo.minIndex = pInfo.startVertex;
|
pInfo.minIndex = pInfo.startVertex;
|
||||||
pInfo.numVertices = getMin((U32)0x10000, mesh->mNumVerts - pInfo.startVertex);
|
pInfo.numVertices = getMin((U32)0x10000, mesh->mNumVerts - pInfo.startVertex);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ TSMesh* AppMesh::constructTSMesh()
|
||||||
tsmesh->norms = normals;
|
tsmesh->norms = normals;
|
||||||
tsmesh->tverts = uvs;
|
tsmesh->tverts = uvs;
|
||||||
tsmesh->primitives = primitives;
|
tsmesh->primitives = primitives;
|
||||||
tsmesh->indices = indices;
|
tsmesh->mIndices = indices;
|
||||||
tsmesh->colors = colors;
|
tsmesh->colors = colors;
|
||||||
tsmesh->tverts2 = uv2s;
|
tsmesh->tverts2 = uv2s;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1377,16 +1377,16 @@ void TSMesh::prepOpcodeCollision()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Have to walk the tristrip to get a count... may have degenerates
|
// 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 idx1;
|
||||||
U32 idx2 = base + indices[start + 1];
|
U32 idx2 = base + mIndices[start + 1];
|
||||||
U32 * nextIdx = &idx1;
|
U32 * nextIdx = &idx1;
|
||||||
for ( S32 j = 2; j < draw.numElements; j++ )
|
for ( S32 j = 2; j < draw.numElements; j++ )
|
||||||
{
|
{
|
||||||
*nextIdx = idx2;
|
*nextIdx = idx2;
|
||||||
// nextIdx = (j%2)==0 ? &idx0 : &idx1;
|
// nextIdx = (j%2)==0 ? &idx0 : &idx1;
|
||||||
nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&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 )
|
if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -1421,9 +1421,9 @@ void TSMesh::prepOpcodeCollision()
|
||||||
{
|
{
|
||||||
for ( S32 j = 0; j < draw.numElements; )
|
for ( S32 j = 0; j < draw.numElements; )
|
||||||
{
|
{
|
||||||
curIts->mVRef[2] = base + indices[start + j + 0];
|
curIts->mVRef[2] = base + mIndices[start + j + 0];
|
||||||
curIts->mVRef[1] = base + indices[start + j + 1];
|
curIts->mVRef[1] = base + mIndices[start + j + 1];
|
||||||
curIts->mVRef[0] = base + indices[start + j + 2];
|
curIts->mVRef[0] = base + mIndices[start + j + 2];
|
||||||
curIts->mMatIdx = matIndex;
|
curIts->mMatIdx = matIndex;
|
||||||
curIts++;
|
curIts++;
|
||||||
|
|
||||||
|
|
@ -1434,16 +1434,16 @@ void TSMesh::prepOpcodeCollision()
|
||||||
{
|
{
|
||||||
AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" );
|
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 idx1;
|
||||||
U32 idx2 = base + indices[start + 1];
|
U32 idx2 = base + mIndices[start + 1];
|
||||||
U32 * nextIdx = &idx1;
|
U32 * nextIdx = &idx1;
|
||||||
for ( S32 j = 2; j < draw.numElements; j++ )
|
for ( S32 j = 2; j < draw.numElements; j++ )
|
||||||
{
|
{
|
||||||
*nextIdx = idx2;
|
*nextIdx = idx2;
|
||||||
// nextIdx = (j%2)==0 ? &idx0 : &idx1;
|
// nextIdx = (j%2)==0 ? &idx0 : &idx1;
|
||||||
nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&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 )
|
if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -386,9 +386,9 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK
|
||||||
{
|
{
|
||||||
for ( S32 j = 0; j < draw.numElements; )
|
for ( S32 j = 0; j < draw.numElements; )
|
||||||
{
|
{
|
||||||
U32 idx0 = base + indices[start + j + 0];
|
U32 idx0 = base + mIndices[start + j + 0];
|
||||||
U32 idx1 = base + indices[start + j + 1];
|
U32 idx1 = base + mIndices[start + j + 1];
|
||||||
U32 idx2 = base + indices[start + j + 2];
|
U32 idx2 = base + mIndices[start + j + 2];
|
||||||
polyList->begin(material,surfaceKey++);
|
polyList->begin(material,surfaceKey++);
|
||||||
polyList->vertex( idx0 );
|
polyList->vertex( idx0 );
|
||||||
polyList->vertex( idx1 );
|
polyList->vertex( idx1 );
|
||||||
|
|
@ -402,16 +402,16 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK
|
||||||
{
|
{
|
||||||
AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" );
|
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 idx1;
|
||||||
U32 idx2 = base + indices[start + 1];
|
U32 idx2 = base + mIndices[start + 1];
|
||||||
U32 * nextIdx = &idx1;
|
U32 * nextIdx = &idx1;
|
||||||
for ( S32 j = 2; j < draw.numElements; j++ )
|
for ( S32 j = 2; j < draw.numElements; j++ )
|
||||||
{
|
{
|
||||||
*nextIdx = idx2;
|
*nextIdx = idx2;
|
||||||
// nextIdx = (j%2)==0 ? &idx0 : &idx1;
|
// nextIdx = (j%2)==0 ? &idx0 : &idx1;
|
||||||
nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&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 )
|
if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -452,24 +452,24 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF
|
||||||
{
|
{
|
||||||
for ( S32 j = 0; j < draw.numElements; j += 3 )
|
for ( S32 j = 0; j < draw.numElements; j += 3 )
|
||||||
{
|
{
|
||||||
PlaneF plane( cf->mVertexList[base + indices[start + j + 0]],
|
PlaneF plane( cf->mVertexList[base + mIndices[start + j + 0]],
|
||||||
cf->mVertexList[base + indices[start + j + 1]],
|
cf->mVertexList[base + mIndices[start + j + 1]],
|
||||||
cf->mVertexList[base + indices[start + j + 2]]);
|
cf->mVertexList[base + mIndices[start + j + 2]]);
|
||||||
|
|
||||||
cf->mFaceList.increment();
|
cf->mFaceList.increment();
|
||||||
|
|
||||||
ConvexFeature::Face& lastFace = cf->mFaceList.last();
|
ConvexFeature::Face& lastFace = cf->mFaceList.last();
|
||||||
lastFace.normal = plane;
|
lastFace.normal = plane;
|
||||||
|
|
||||||
lastFace.vertex[0] = base + indices[start + j + 0];
|
lastFace.vertex[0] = base + mIndices[start + j + 0];
|
||||||
lastFace.vertex[1] = base + indices[start + j + 1];
|
lastFace.vertex[1] = base + mIndices[start + j + 1];
|
||||||
lastFace.vertex[2] = base + indices[start + j + 2];
|
lastFace.vertex[2] = base + mIndices[start + j + 2];
|
||||||
|
|
||||||
for ( U32 l = 0; l < 3; l++ )
|
for ( U32 l = 0; l < 3; l++ )
|
||||||
{
|
{
|
||||||
U32 newEdge0, newEdge1;
|
U32 newEdge0, newEdge1;
|
||||||
U32 zero = base + indices[start + j + l];
|
U32 zero = base + mIndices[start + j + l];
|
||||||
U32 one = base + indices[start + j + ((l+1)%3)];
|
U32 one = base + mIndices[start + j + ((l+1)%3)];
|
||||||
newEdge0 = getMin( zero, one );
|
newEdge0 = getMin( zero, one );
|
||||||
newEdge1 = getMax( zero, one );
|
newEdge1 = getMax( zero, one );
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
@ -496,15 +496,15 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF
|
||||||
{
|
{
|
||||||
AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" );
|
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 idx1;
|
||||||
U32 idx2 = base + indices[start + 1];
|
U32 idx2 = base + mIndices[start + 1];
|
||||||
U32 * nextIdx = &idx1;
|
U32 * nextIdx = &idx1;
|
||||||
for ( S32 j = 2; j < draw.numElements; j++ )
|
for ( S32 j = 2; j < draw.numElements; j++ )
|
||||||
{
|
{
|
||||||
*nextIdx = idx2;
|
*nextIdx = idx2;
|
||||||
nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&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 )
|
if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -802,9 +802,9 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F &
|
||||||
{
|
{
|
||||||
for ( S32 j = 0; j < draw.numElements-2; j += 3 )
|
for ( S32 j = 0; j < draw.numElements-2; j += 3 )
|
||||||
{
|
{
|
||||||
idx0 = indices[drawStart + j + 0];
|
idx0 = mIndices[drawStart + j + 0];
|
||||||
idx1 = indices[drawStart + j + 1];
|
idx1 = mIndices[drawStart + j + 1];
|
||||||
idx2 = indices[drawStart + j + 2];
|
idx2 = mIndices[drawStart + j + 2];
|
||||||
|
|
||||||
F32 cur_t = 0;
|
F32 cur_t = 0;
|
||||||
Point2F b;
|
Point2F b;
|
||||||
|
|
@ -828,15 +828,15 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F &
|
||||||
{
|
{
|
||||||
AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::castRayRendered (2)" );
|
AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::castRayRendered (2)" );
|
||||||
|
|
||||||
idx0 = indices[drawStart + 0];
|
idx0 = mIndices[drawStart + 0];
|
||||||
idx2 = indices[drawStart + 1];
|
idx2 = mIndices[drawStart + 1];
|
||||||
U32 * nextIdx = &idx1;
|
U32 * nextIdx = &idx1;
|
||||||
for ( S32 j = 2; j < draw.numElements; j++ )
|
for ( S32 j = 2; j < draw.numElements; j++ )
|
||||||
{
|
{
|
||||||
*nextIdx = idx2;
|
*nextIdx = idx2;
|
||||||
// nextIdx = (j%2)==0 ? &idx0 : &idx1;
|
// nextIdx = (j%2)==0 ? &idx0 : &idx1;
|
||||||
nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&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 )
|
if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -964,25 +964,25 @@ bool TSMesh::buildConvexHull()
|
||||||
if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles )
|
if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles )
|
||||||
{
|
{
|
||||||
for ( j = 0; j < draw.numElements; j += 3 )
|
for ( j = 0; j < draw.numElements; j += 3 )
|
||||||
if ( addToHull( indices[start + j + 0] + firstVert,
|
if ( addToHull( mIndices[start + j + 0] + firstVert,
|
||||||
indices[start + j + 1] + firstVert,
|
mIndices[start + j + 1] + firstVert,
|
||||||
indices[start + j + 2] + firstVert ) && frame == 0 )
|
mIndices[start + j + 2] + firstVert ) && frame == 0 )
|
||||||
planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask );
|
planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AssertFatal( (draw.matIndex&TSDrawPrimitive::Strip) == TSDrawPrimitive::Strip,"TSMesh::buildConvexHull (2)" );
|
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 idx1;
|
||||||
U32 idx2 = indices[start + 1] + firstVert;
|
U32 idx2 = mIndices[start + 1] + firstVert;
|
||||||
U32 * nextIdx = &idx1;
|
U32 * nextIdx = &idx1;
|
||||||
for ( j = 2; j < draw.numElements; j++ )
|
for ( j = 2; j < draw.numElements; j++ )
|
||||||
{
|
{
|
||||||
*nextIdx = idx2;
|
*nextIdx = idx2;
|
||||||
// nextIdx = (j%2)==0 ? &idx0 : &idx1;
|
// nextIdx = (j%2)==0 ? &idx0 : &idx1;
|
||||||
nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&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 )
|
if ( addToHull( idx0, idx1, idx2 ) && frame == 0 )
|
||||||
planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask );
|
planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask );
|
||||||
}
|
}
|
||||||
|
|
@ -1149,9 +1149,9 @@ S32 TSMesh::getNumPolys() const
|
||||||
j < primitives[i].start+primitives[i].numElements-2;
|
j < primitives[i].start+primitives[i].numElements-2;
|
||||||
j++ )
|
j++ )
|
||||||
{
|
{
|
||||||
if ((indices[j] != indices[j+1]) &&
|
if ((mIndices[j] != mIndices[j+1]) &&
|
||||||
(indices[j] != indices[j+2]) &&
|
(mIndices[j] != mIndices[j+2]) &&
|
||||||
(indices[j+1] != indices[j+2]))
|
(mIndices[j+1] != mIndices[j+2]))
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1167,7 +1167,7 @@ TSMesh::TSMesh() : meshType( StandardMeshType )
|
||||||
VECTOR_SET_ASSOCIATION( planeNormals );
|
VECTOR_SET_ASSOCIATION( planeNormals );
|
||||||
VECTOR_SET_ASSOCIATION( planeConstants );
|
VECTOR_SET_ASSOCIATION( planeConstants );
|
||||||
VECTOR_SET_ASSOCIATION( planeMaterials );
|
VECTOR_SET_ASSOCIATION( planeMaterials );
|
||||||
parentMesh = -1;
|
mParentMesh = -1;
|
||||||
|
|
||||||
mOptTree = NULL;
|
mOptTree = NULL;
|
||||||
mOpMeshInterface = NULL;
|
mOpMeshInterface = NULL;
|
||||||
|
|
@ -2382,7 +2382,7 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr
|
||||||
pInfo.numPrimitives = draw.numElements / 3;
|
pInfo.numPrimitives = draw.numElements / 3;
|
||||||
pInfo.startIndex = startIndex + draw.start;
|
pInfo.startIndex = startIndex + draw.start;
|
||||||
// Use the first index to determine which 16-bit address space we are operating in
|
// Use the first index to determine which 16-bit address space we are operating in
|
||||||
pInfo.startVertex = (indices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this
|
pInfo.startVertex = (mIndices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this
|
||||||
pInfo.minIndex = 0; // minIndex are zero based index relative to startVertex. See @GFXDevice
|
pInfo.minIndex = 0; // minIndex are zero based index relative to startVertex. See @GFXDevice
|
||||||
pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex);
|
pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex);
|
||||||
pInfo.startVertex += startVertex;
|
pInfo.startVertex += startVertex;
|
||||||
|
|
@ -2393,7 +2393,7 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr
|
||||||
pInfo.numPrimitives = draw.numElements - 2;
|
pInfo.numPrimitives = draw.numElements - 2;
|
||||||
pInfo.startIndex = startIndex + draw.start;
|
pInfo.startIndex = startIndex + draw.start;
|
||||||
// Use the first index to determine which 16-bit address space we are operating in
|
// Use the first index to determine which 16-bit address space we are operating in
|
||||||
pInfo.startVertex = (indices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this
|
pInfo.startVertex = (mIndices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this
|
||||||
pInfo.minIndex = 0; // minIndex are zero based index relative to startVertex. See @GFXDevice
|
pInfo.minIndex = 0; // minIndex are zero based index relative to startVertex. See @GFXDevice
|
||||||
pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex);
|
pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex);
|
||||||
pInfo.startVertex += startVertex;
|
pInfo.startVertex += startVertex;
|
||||||
|
|
@ -2406,7 +2406,7 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr
|
||||||
*piArray++ = pInfo;
|
*piArray++ = pInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
dCopyArray(ibIndices, indices.address(), indices.size());
|
dCopyArray(ibIndices, mIndices.address(), mIndices.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSMesh::assemble( bool skip )
|
void TSMesh::assemble( bool skip )
|
||||||
|
|
@ -2415,7 +2415,7 @@ void TSMesh::assemble( bool skip )
|
||||||
|
|
||||||
numFrames = tsalloc.get32();
|
numFrames = tsalloc.get32();
|
||||||
numMatFrames = tsalloc.get32();
|
numMatFrames = tsalloc.get32();
|
||||||
parentMesh = tsalloc.get32();
|
mParentMesh = tsalloc.get32();
|
||||||
tsalloc.get32( (S32*)&mBounds, 6 );
|
tsalloc.get32( (S32*)&mBounds, 6 );
|
||||||
tsalloc.get32( (S32*)&mCenter, 3 );
|
tsalloc.get32( (S32*)&mCenter, 3 );
|
||||||
mRadius = (F32)tsalloc.get32();
|
mRadius = (F32)tsalloc.get32();
|
||||||
|
|
@ -2435,21 +2435,21 @@ void TSMesh::assemble( bool skip )
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 numVerts = tsalloc.get32();
|
S32 numVerts = tsalloc.get32();
|
||||||
S32 *ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip );
|
S32 *ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip );
|
||||||
verts.set( (Point3F*)ptr32, numVerts );
|
verts.set( (Point3F*)ptr32, numVerts );
|
||||||
|
|
||||||
S32 numTVerts = tsalloc.get32();
|
S32 numTVerts = tsalloc.get32();
|
||||||
ptr32 = getSharedData32( parentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip );
|
ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip );
|
||||||
tverts.set( (Point2F*)ptr32, numTVerts );
|
tverts.set( (Point2F*)ptr32, numTVerts );
|
||||||
|
|
||||||
if ( TSShape::smReadVersion > 25 )
|
if ( TSShape::smReadVersion > 25 )
|
||||||
{
|
{
|
||||||
numTVerts = tsalloc.get32();
|
numTVerts = tsalloc.get32();
|
||||||
ptr32 = getSharedData32( parentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip );
|
ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip );
|
||||||
tverts2.set( (Point2F*)ptr32, numTVerts );
|
tverts2.set( (Point2F*)ptr32, numTVerts );
|
||||||
|
|
||||||
S32 numVColors = tsalloc.get32();
|
S32 numVColors = tsalloc.get32();
|
||||||
ptr32 = getSharedData32( parentMesh, numVColors, (S32**)smColorsList.address(), skip );
|
ptr32 = getSharedData32(mParentMesh, numVColors, (S32**)smColorsList.address(), skip );
|
||||||
colors.set( (ColorI*)ptr32, numVColors );
|
colors.set( (ColorI*)ptr32, numVColors );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2457,27 +2457,27 @@ void TSMesh::assemble( bool skip )
|
||||||
if ( TSShape::smReadVersion > 21 && TSMesh::smUseEncodedNormals)
|
if ( TSShape::smReadVersion > 21 && TSMesh::smUseEncodedNormals)
|
||||||
{
|
{
|
||||||
// we have encoded normals and we want to use them...
|
// we have encoded normals and we want to use them...
|
||||||
if ( parentMesh < 0 )
|
if (mParentMesh < 0 )
|
||||||
tsalloc.getPointer32( numVerts * 3 ); // adva nce past norms, don't use
|
tsalloc.getPointer32( numVerts * 3 ); // adva nce past norms, don't use
|
||||||
norms.set( NULL, 0 );
|
norms.set( NULL, 0 );
|
||||||
|
|
||||||
ptr8 = getSharedData8( parentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip );
|
ptr8 = getSharedData8(mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip );
|
||||||
encodedNorms.set( ptr8, numVerts );
|
encodedNorms.set( ptr8, numVerts );
|
||||||
}
|
}
|
||||||
else if ( TSShape::smReadVersion > 21 )
|
else if ( TSShape::smReadVersion > 21 )
|
||||||
{
|
{
|
||||||
// we have encoded normals but we don't want to use them...
|
// 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 );
|
||||||
norms.set( (Point3F*)ptr32, numVerts );
|
norms.set( (Point3F*)ptr32, numVerts );
|
||||||
|
|
||||||
if ( parentMesh < 0 )
|
if (mParentMesh < 0 )
|
||||||
tsalloc.getPointer8( numVerts ); // advance past encoded normls, don't use
|
tsalloc.getPointer8( numVerts ); // advance past encoded normls, don't use
|
||||||
encodedNorms.set( NULL, 0 );
|
encodedNorms.set( NULL, 0 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no encoded normals...
|
// no encoded normals...
|
||||||
ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip );
|
ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip );
|
||||||
norms.set( (Point3F*)ptr32, numVerts );
|
norms.set( (Point3F*)ptr32, numVerts );
|
||||||
encodedNorms.set( NULL, 0 );
|
encodedNorms.set( NULL, 0 );
|
||||||
}
|
}
|
||||||
|
|
@ -2554,7 +2554,7 @@ void TSMesh::assemble( bool skip )
|
||||||
|
|
||||||
// store output
|
// store output
|
||||||
primitives.set(primOut, szPrimOut);
|
primitives.set(primOut, szPrimOut);
|
||||||
indices.set(indOut, szIndOut);
|
mIndices.set(indOut, szIndOut);
|
||||||
|
|
||||||
// delete temporary arrays if necessary
|
// delete temporary arrays if necessary
|
||||||
if (deleteInputArrays)
|
if (deleteInputArrays)
|
||||||
|
|
@ -2596,7 +2596,7 @@ void TSMesh::disassemble()
|
||||||
|
|
||||||
tsalloc.set32( numFrames );
|
tsalloc.set32( numFrames );
|
||||||
tsalloc.set32( numMatFrames );
|
tsalloc.set32( numMatFrames );
|
||||||
tsalloc.set32( parentMesh );
|
tsalloc.set32(mParentMesh);
|
||||||
tsalloc.copyToBuffer32( (S32*)&mBounds, 6 );
|
tsalloc.copyToBuffer32( (S32*)&mBounds, 6 );
|
||||||
tsalloc.copyToBuffer32( (S32*)&mCenter, 3 );
|
tsalloc.copyToBuffer32( (S32*)&mCenter, 3 );
|
||||||
tsalloc.set32( (S32)mRadius );
|
tsalloc.set32( (S32)mRadius );
|
||||||
|
|
@ -2637,33 +2637,33 @@ void TSMesh::disassemble()
|
||||||
{
|
{
|
||||||
// verts...
|
// verts...
|
||||||
tsalloc.set32(verts.size());
|
tsalloc.set32(verts.size());
|
||||||
if (parentMesh < 0)
|
if (mParentMesh < 0)
|
||||||
tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size()); // if no parent mesh, then save off our verts
|
tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size()); // if no parent mesh, then save off our verts
|
||||||
|
|
||||||
// tverts...
|
// tverts...
|
||||||
tsalloc.set32(tverts.size());
|
tsalloc.set32(tverts.size());
|
||||||
if (parentMesh < 0)
|
if (mParentMesh < 0)
|
||||||
tsalloc.copyToBuffer32((S32*)tverts.address(), 2 * tverts.size()); // if no parent mesh, then save off our tverts
|
tsalloc.copyToBuffer32((S32*)tverts.address(), 2 * tverts.size()); // if no parent mesh, then save off our tverts
|
||||||
|
|
||||||
if (TSShape::smVersion > 25)
|
if (TSShape::smVersion > 25)
|
||||||
{
|
{
|
||||||
// tverts2...
|
// tverts2...
|
||||||
tsalloc.set32(tverts2.size());
|
tsalloc.set32(tverts2.size());
|
||||||
if (parentMesh < 0)
|
if (mParentMesh < 0)
|
||||||
tsalloc.copyToBuffer32((S32*)tverts2.address(), 2 * tverts2.size()); // if no parent mesh, then save off our tverts
|
tsalloc.copyToBuffer32((S32*)tverts2.address(), 2 * tverts2.size()); // if no parent mesh, then save off our tverts
|
||||||
|
|
||||||
// colors
|
// colors
|
||||||
tsalloc.set32(colors.size());
|
tsalloc.set32(colors.size());
|
||||||
if (parentMesh < 0)
|
if (mParentMesh < 0)
|
||||||
tsalloc.copyToBuffer32((S32*)colors.address(), colors.size()); // if no parent mesh, then save off our tverts
|
tsalloc.copyToBuffer32((S32*)colors.address(), colors.size()); // if no parent mesh, then save off our tverts
|
||||||
}
|
}
|
||||||
|
|
||||||
// norms...
|
// norms...
|
||||||
if (parentMesh < 0) // if no parent mesh, then save off our 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*)norms.address(), 3 * norms.size()); // norms.size()==verts.size() or error...
|
||||||
|
|
||||||
// encoded norms...
|
// encoded norms...
|
||||||
if (parentMesh < 0)
|
if (mParentMesh < 0)
|
||||||
{
|
{
|
||||||
// if no parent mesh, compute encoded normals and copy over
|
// if no parent mesh, compute encoded normals and copy over
|
||||||
for (S32 i = 0; i < norms.size(); i++)
|
for (S32 i = 0; i < norms.size(); i++)
|
||||||
|
|
@ -2676,7 +2676,7 @@ void TSMesh::disassemble()
|
||||||
|
|
||||||
// optimize triangle draw order during disassemble
|
// optimize triangle draw order during disassemble
|
||||||
{
|
{
|
||||||
FrameTemp<TriListOpt::IndexType> tmpIdxs(indices.size());
|
FrameTemp<TriListOpt::IndexType> tmpIdxs(mIndices.size());
|
||||||
for ( S32 i = 0; i < primitives.size(); i++ )
|
for ( S32 i = 0; i < primitives.size(); i++ )
|
||||||
{
|
{
|
||||||
const TSDrawPrimitive& prim = primitives[i];
|
const TSDrawPrimitive& prim = primitives[i];
|
||||||
|
|
@ -2685,8 +2685,8 @@ void TSMesh::disassemble()
|
||||||
if ( (prim.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles )
|
if ( (prim.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles )
|
||||||
{
|
{
|
||||||
TriListOpt::OptimizeTriangleOrdering(verts.size(), prim.numElements,
|
TriListOpt::OptimizeTriangleOrdering(verts.size(), prim.numElements,
|
||||||
indices.address() + prim.start, tmpIdxs.address());
|
mIndices.address() + prim.start, tmpIdxs.address());
|
||||||
dCopyArray(indices.address() + prim.start, tmpIdxs.address(),
|
dCopyArray(mIndices.address() + prim.start, tmpIdxs.address(),
|
||||||
prim.numElements);
|
prim.numElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2699,8 +2699,8 @@ void TSMesh::disassemble()
|
||||||
tsalloc.copyToBuffer32((S32*)primitives.address(),3*primitives.size());
|
tsalloc.copyToBuffer32((S32*)primitives.address(),3*primitives.size());
|
||||||
|
|
||||||
// indices...
|
// indices...
|
||||||
tsalloc.set32(indices.size());
|
tsalloc.set32(mIndices.size());
|
||||||
tsalloc.copyToBuffer32((S32*)indices.address(),indices.size());
|
tsalloc.copyToBuffer32((S32*)mIndices.address(),mIndices.size());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -2717,10 +2717,10 @@ void TSMesh::disassemble()
|
||||||
}
|
}
|
||||||
|
|
||||||
// indices
|
// indices
|
||||||
tsalloc.set32(indices.size());
|
tsalloc.set32(mIndices.size());
|
||||||
Vector<S16> s16_indices(indices.size());
|
Vector<S16> s16_indices(mIndices.size());
|
||||||
for (S32 i=0; i<indices.size(); i++)
|
for (S32 i=0; i<mIndices.size(); i++)
|
||||||
s16_indices.push_back((S16)indices[i]);
|
s16_indices.push_back((S16)mIndices[i]);
|
||||||
tsalloc.copyToBuffer16(s16_indices.address(), s16_indices.size());
|
tsalloc.copyToBuffer16(s16_indices.address(), s16_indices.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2760,18 +2760,18 @@ void TSSkinMesh::assemble( bool skip )
|
||||||
{
|
{
|
||||||
sz = tsalloc.get32();
|
sz = tsalloc.get32();
|
||||||
S32 numVerts = sz;
|
S32 numVerts = sz;
|
||||||
ptr32 = getSharedData32(parentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip);
|
ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip);
|
||||||
batchData.initialVerts.set((Point3F*)ptr32, sz);
|
batchData.initialVerts.set((Point3F*)ptr32, sz);
|
||||||
|
|
||||||
S8 * ptr8;
|
S8 * ptr8;
|
||||||
if (TSShape::smReadVersion > 21 && TSMesh::smUseEncodedNormals)
|
if (TSShape::smReadVersion > 21 && TSMesh::smUseEncodedNormals)
|
||||||
{
|
{
|
||||||
// we have encoded normals and we want to use them...
|
// 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
|
tsalloc.getPointer32(numVerts * 3); // advance past norms, don't use
|
||||||
batchData.initialNorms.set(NULL, 0);
|
batchData.initialNorms.set(NULL, 0);
|
||||||
|
|
||||||
ptr8 = getSharedData8(parentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip);
|
ptr8 = getSharedData8(mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip);
|
||||||
encodedNorms.set(ptr8, numVerts);
|
encodedNorms.set(ptr8, numVerts);
|
||||||
// Note: we don't set the encoded normals flag because we handle them in updateSkin and
|
// 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)
|
// hide the fact that we are using them from base class (TSMesh)
|
||||||
|
|
@ -2779,10 +2779,10 @@ void TSSkinMesh::assemble( bool skip )
|
||||||
else if (TSShape::smReadVersion > 21)
|
else if (TSShape::smReadVersion > 21)
|
||||||
{
|
{
|
||||||
// we have encoded normals but we don't want to use them...
|
// 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);
|
batchData.initialNorms.set((Point3F*)ptr32, numVerts);
|
||||||
|
|
||||||
if (parentMesh < 0)
|
if (mParentMesh < 0)
|
||||||
tsalloc.getPointer8(numVerts); // advance past encoded normls, don't use
|
tsalloc.getPointer8(numVerts); // advance past encoded normls, don't use
|
||||||
|
|
||||||
encodedNorms.set(NULL, 0);
|
encodedNorms.set(NULL, 0);
|
||||||
|
|
@ -2790,7 +2790,7 @@ void TSSkinMesh::assemble( bool skip )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no encoded normals...
|
// 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);
|
batchData.initialNorms.set((Point3F*)ptr32, numVerts);
|
||||||
encodedNorms.set(NULL, 0);
|
encodedNorms.set(NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -2815,21 +2815,21 @@ void TSSkinMesh::assemble( bool skip )
|
||||||
}
|
}
|
||||||
|
|
||||||
sz = tsalloc.get32();
|
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 );
|
batchData.initialTransforms.set( ptr32, sz );
|
||||||
|
|
||||||
sz = tsalloc.get32();
|
sz = tsalloc.get32();
|
||||||
ptr32 = getSharedData32( parentMesh, sz, (S32**)smVertexIndexList.address(), skip );
|
ptr32 = getSharedData32(mParentMesh, sz, (S32**)smVertexIndexList.address(), skip );
|
||||||
vertexIndex.set( ptr32, sz );
|
vertexIndex.set( ptr32, sz );
|
||||||
|
|
||||||
ptr32 = getSharedData32( parentMesh, sz, (S32**)smBoneIndexList.address(), skip );
|
ptr32 = getSharedData32(mParentMesh, sz, (S32**)smBoneIndexList.address(), skip );
|
||||||
boneIndex.set( ptr32, sz );
|
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 );
|
weight.set( (F32*)ptr32, sz );
|
||||||
|
|
||||||
sz = tsalloc.get32();
|
sz = tsalloc.get32();
|
||||||
ptr32 = getSharedData32( parentMesh, sz, (S32**)smNodeIndexList.address(), skip );
|
ptr32 = getSharedData32(mParentMesh, sz, (S32**)smNodeIndexList.address(), skip );
|
||||||
batchData.nodeIndex.set( ptr32, sz );
|
batchData.nodeIndex.set( ptr32, sz );
|
||||||
|
|
||||||
tsalloc.checkGuard();
|
tsalloc.checkGuard();
|
||||||
|
|
@ -2883,7 +2883,7 @@ void TSSkinMesh::disassemble()
|
||||||
{
|
{
|
||||||
tsalloc.set32(batchData.initialVerts.size());
|
tsalloc.set32(batchData.initialVerts.size());
|
||||||
// if we have no parent mesh, then save off our verts & norms
|
// if we have no parent mesh, then save off our verts & norms
|
||||||
if (parentMesh < 0)
|
if (mParentMesh < 0)
|
||||||
{
|
{
|
||||||
tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size());
|
tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size());
|
||||||
|
|
||||||
|
|
@ -2900,7 +2900,7 @@ void TSSkinMesh::disassemble()
|
||||||
}
|
}
|
||||||
|
|
||||||
tsalloc.set32( batchData.initialTransforms.size() );
|
tsalloc.set32( batchData.initialTransforms.size() );
|
||||||
if ( parentMesh < 0 )
|
if (mParentMesh < 0 )
|
||||||
tsalloc.copyToBuffer32( (S32*)batchData.initialTransforms.address(), batchData.initialTransforms.size() * 16 );
|
tsalloc.copyToBuffer32( (S32*)batchData.initialTransforms.address(), batchData.initialTransforms.size() * 16 );
|
||||||
|
|
||||||
if (!mVertexData.isReady())
|
if (!mVertexData.isReady())
|
||||||
|
|
@ -2920,7 +2920,7 @@ void TSSkinMesh::disassemble()
|
||||||
|
|
||||||
if (TSShape::smVersion < 27)
|
if (TSShape::smVersion < 27)
|
||||||
{
|
{
|
||||||
if (parentMesh < 0)
|
if (mParentMesh < 0)
|
||||||
{
|
{
|
||||||
tsalloc.copyToBuffer32((S32*)vertexIndex.address(), vertexIndex.size());
|
tsalloc.copyToBuffer32((S32*)vertexIndex.address(), vertexIndex.size());
|
||||||
|
|
||||||
|
|
@ -2931,7 +2931,7 @@ void TSSkinMesh::disassemble()
|
||||||
}
|
}
|
||||||
|
|
||||||
tsalloc.set32( batchData.nodeIndex.size() );
|
tsalloc.set32( batchData.nodeIndex.size() );
|
||||||
if ( parentMesh < 0 )
|
if (mParentMesh < 0 )
|
||||||
tsalloc.copyToBuffer32( (S32*)batchData.nodeIndex.address(), batchData.nodeIndex.size() );
|
tsalloc.copyToBuffer32( (S32*)batchData.nodeIndex.address(), batchData.nodeIndex.size() );
|
||||||
|
|
||||||
tsalloc.setGuard();
|
tsalloc.setGuard();
|
||||||
|
|
@ -3035,7 +3035,7 @@ void TSMesh::createTangents(const Vector<Point3F> &_verts, const Vector<Point3F>
|
||||||
U32 p1Index = 0;
|
U32 p1Index = 0;
|
||||||
U32 p2Index = 0;
|
U32 p2Index = 0;
|
||||||
|
|
||||||
U32 *baseIdx = &indices[draw.start];
|
U32 *baseIdx = &mIndices[draw.start];
|
||||||
|
|
||||||
const U32 numElements = (U32)draw.numElements;
|
const U32 numElements = (U32)draw.numElements;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
S32 parentMesh; ///< index into shapes mesh list
|
S32 mParentMesh; ///< index into shapes mesh list
|
||||||
S32 numFrames;
|
S32 numFrames;
|
||||||
S32 numMatFrames;
|
S32 numMatFrames;
|
||||||
S32 vertsPerFrame;
|
S32 vertsPerFrame;
|
||||||
|
|
@ -333,7 +333,7 @@ protected:
|
||||||
|
|
||||||
Vector<TSDrawPrimitive> primitives;
|
Vector<TSDrawPrimitive> primitives;
|
||||||
Vector<U8> encodedNorms;
|
Vector<U8> encodedNorms;
|
||||||
Vector<U32> indices;
|
Vector<U32> mIndices;
|
||||||
|
|
||||||
/// billboard data
|
/// billboard data
|
||||||
Point3F billboardAxis;
|
Point3F billboardAxis;
|
||||||
|
|
|
||||||
|
|
@ -251,19 +251,19 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh )
|
||||||
const TSDrawPrimitive& draw = mesh->primitives[i];
|
const TSDrawPrimitive& draw = mesh->primitives[i];
|
||||||
if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles )
|
if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles )
|
||||||
{
|
{
|
||||||
mIndices.merge( &mesh->indices[draw.start], draw.numElements );
|
mIndices.merge( &mesh->mIndices[draw.start], draw.numElements );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
U32 idx0 = mesh->indices[draw.start + 0];
|
U32 idx0 = mesh->mIndices[draw.start + 0];
|
||||||
U32 idx1;
|
U32 idx1;
|
||||||
U32 idx2 = mesh->indices[draw.start + 1];
|
U32 idx2 = mesh->mIndices[draw.start + 1];
|
||||||
U32 *nextIdx = &idx1;
|
U32 *nextIdx = &idx1;
|
||||||
for ( S32 j = 2; j < draw.numElements; j++ )
|
for ( S32 j = 2; j < draw.numElements; j++ )
|
||||||
{
|
{
|
||||||
*nextIdx = idx2;
|
*nextIdx = idx2;
|
||||||
nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1);
|
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 )
|
if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -329,12 +329,12 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT
|
||||||
mesh->setFlags(0);
|
mesh->setFlags(0);
|
||||||
mesh->mNumVerts = numVerts;
|
mesh->mNumVerts = numVerts;
|
||||||
|
|
||||||
mesh->indices.reserve( numTris * 3 );
|
mesh->mIndices.reserve( numTris * 3 );
|
||||||
for ( S32 i = 0; i < numTris; i++ )
|
for ( S32 i = 0; i < numTris; i++ )
|
||||||
{
|
{
|
||||||
mesh->indices.push_back( indices[i*3 + 0] );
|
mesh->mIndices.push_back( indices[i*3 + 0] );
|
||||||
mesh->indices.push_back( indices[i*3 + 2] );
|
mesh->mIndices.push_back( indices[i*3 + 2] );
|
||||||
mesh->indices.push_back( indices[i*3 + 1] );
|
mesh->mIndices.push_back( indices[i*3 + 1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh->verts.set( verts, numVerts );
|
mesh->verts.set( verts, numVerts );
|
||||||
|
|
@ -345,12 +345,12 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT
|
||||||
mesh->norms[iNorm] = Point3F::Zero;
|
mesh->norms[iNorm] = Point3F::Zero;
|
||||||
|
|
||||||
// Sum triangle normals for each vertex
|
// 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
|
// Compute the normal for this triangle
|
||||||
S32 idx0 = mesh->indices[iInd + 0];
|
S32 idx0 = mesh->mIndices[iInd + 0];
|
||||||
S32 idx1 = mesh->indices[iInd + 1];
|
S32 idx1 = mesh->mIndices[iInd + 1];
|
||||||
S32 idx2 = mesh->indices[iInd + 2];
|
S32 idx2 = mesh->mIndices[iInd + 2];
|
||||||
|
|
||||||
const Point3F& v0 = mesh->verts[idx0];
|
const Point3F& v0 = mesh->verts[idx0];
|
||||||
const Point3F& v1 = mesh->verts[idx1];
|
const Point3F& v1 = mesh->verts[idx1];
|
||||||
|
|
@ -377,7 +377,7 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT
|
||||||
// Add a single triangle-list primitive
|
// Add a single triangle-list primitive
|
||||||
mesh->primitives.increment();
|
mesh->primitives.increment();
|
||||||
mesh->primitives.last().start = 0;
|
mesh->primitives.last().start = 0;
|
||||||
mesh->primitives.last().numElements = mesh->indices.size();
|
mesh->primitives.last().numElements = mesh->mIndices.size();
|
||||||
mesh->primitives.last().matIndex = TSDrawPrimitive::Triangles |
|
mesh->primitives.last().matIndex = TSDrawPrimitive::Triangles |
|
||||||
TSDrawPrimitive::Indexed |
|
TSDrawPrimitive::Indexed |
|
||||||
TSDrawPrimitive::NoMaterial;
|
TSDrawPrimitive::NoMaterial;
|
||||||
|
|
|
||||||
|
|
@ -585,14 +585,14 @@ void TSShape::initObjects()
|
||||||
if (!mesh)
|
if (!mesh)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mesh->parentMesh >= meshes.size())
|
if (mesh->mParentMesh >= meshes.size())
|
||||||
{
|
{
|
||||||
Con::warnf("Mesh %i has a bad parentMeshObject (%i)", iter - meshes.begin(), mesh->parentMesh);
|
Con::warnf("Mesh %i has a bad parentMeshObject (%i)", iter - meshes.begin(), mesh->mParentMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mesh->parentMesh >= 0 && mesh->parentMesh < meshes.size())
|
if (mesh->mParentMesh >= 0 && mesh->mParentMesh < meshes.size())
|
||||||
{
|
{
|
||||||
mesh->parentMeshObject = meshes[mesh->parentMesh];
|
mesh->parentMeshObject = meshes[mesh->mParentMesh];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -622,7 +622,7 @@ void TSShape::initVertexBuffers()
|
||||||
mesh->getMeshType() != TSMesh::SkinMeshType))
|
mesh->getMeshType() != TSMesh::SkinMeshType))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
destIndices += mesh->indices.size();
|
destIndices += mesh->mIndices.size();
|
||||||
destPrims += mesh->primitives.size();
|
destPrims += mesh->primitives.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -661,14 +661,14 @@ void TSShape::initVertexBuffers()
|
||||||
|
|
||||||
vertStart += mesh->mNumVerts;
|
vertStart += mesh->mNumVerts;
|
||||||
primStart += mesh->primitives.size();
|
primStart += mesh->primitives.size();
|
||||||
indStart += mesh->indices.size();
|
indStart += mesh->mIndices.size();
|
||||||
|
|
||||||
mesh->mVB = mShapeVertexBuffer;
|
mesh->mVB = mShapeVertexBuffer;
|
||||||
mesh->mPB = mShapeVertexIndices;
|
mesh->mPB = mShapeVertexIndices;
|
||||||
|
|
||||||
// Advance
|
// Advance
|
||||||
piInput += mesh->primitives.size();
|
piInput += mesh->primitives.size();
|
||||||
ibIndices += mesh->indices.size();
|
ibIndices += mesh->mIndices.size();
|
||||||
|
|
||||||
if (TSSkinMesh::smDebugSkinVerts && mesh->getMeshType() == TSMesh::SkinMeshType)
|
if (TSSkinMesh::smDebugSkinVerts && mesh->getMeshType() == TSMesh::SkinMeshType)
|
||||||
{
|
{
|
||||||
|
|
@ -845,7 +845,7 @@ void TSShape::initVertexFeatures()
|
||||||
mesh->mVertOffset = destVertex;
|
mesh->mVertOffset = destVertex;
|
||||||
|
|
||||||
destVertex += mesh->mVertSize * mesh->getNumVerts();
|
destVertex += mesh->mVertSize * mesh->getNumVerts();
|
||||||
destIndices += mesh->indices.size();
|
destIndices += mesh->mIndices.size();
|
||||||
|
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -756,13 +756,13 @@ void TSShape::removeMeshFromObject(S32 objIndex, S32 meshIndex)
|
||||||
if (meshes[k] == NULL)
|
if (meshes[k] == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (meshes[k]->parentMesh == idxToRemove)
|
if (meshes[k]->mParentMesh == idxToRemove)
|
||||||
{
|
{
|
||||||
meshes[k]->parentMesh = -1;
|
meshes[k]->mParentMesh = -1;
|
||||||
}
|
}
|
||||||
else if (meshes[k]->parentMesh > idxToRemove)
|
else if (meshes[k]->mParentMesh > idxToRemove)
|
||||||
{
|
{
|
||||||
meshes[k]->parentMesh--;
|
meshes[k]->mParentMesh--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -800,13 +800,13 @@ void TSShape::removeMeshFromObject(S32 objIndex, S32 meshIndex)
|
||||||
if (meshes[k] == NULL)
|
if (meshes[k] == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (meshes[k]->parentMesh == idxToRemove)
|
if (meshes[k]->mParentMesh == idxToRemove)
|
||||||
{
|
{
|
||||||
meshes[k]->parentMesh = -1;
|
meshes[k]->mParentMesh = -1;
|
||||||
}
|
}
|
||||||
else if (meshes[k]->parentMesh > idxToRemove)
|
else if (meshes[k]->mParentMesh > idxToRemove)
|
||||||
{
|
{
|
||||||
meshes[k]->parentMesh--;
|
meshes[k]->mParentMesh--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -937,7 +937,7 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const
|
||||||
return mesh; // return an empty mesh
|
return mesh; // return an empty mesh
|
||||||
|
|
||||||
// Copy mesh elements
|
// Copy mesh elements
|
||||||
mesh->indices = srcMesh->indices;
|
mesh->mIndices = srcMesh->mIndices;
|
||||||
mesh->primitives = srcMesh->primitives;
|
mesh->primitives = srcMesh->primitives;
|
||||||
mesh->numFrames = srcMesh->numFrames;
|
mesh->numFrames = srcMesh->numFrames;
|
||||||
mesh->numMatFrames = srcMesh->numMatFrames;
|
mesh->numMatFrames = srcMesh->numMatFrames;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue