mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-21 04:15:36 +00:00
Rename all member variables to follow the style guidelines (prefixed with the 'm') - class AppMesh
This commit is contained in:
parent
cf3eb26e6f
commit
aefa796056
5 changed files with 181 additions and 181 deletions
|
|
@ -23,10 +23,10 @@
|
|||
#include "ts/loader/appMesh.h"
|
||||
#include "ts/loader/tsShapeLoader.h"
|
||||
|
||||
Vector<AppMaterial*> AppMesh::appMaterials;
|
||||
Vector<AppMaterial*> AppMesh::mAppMaterials;
|
||||
|
||||
AppMesh::AppMesh()
|
||||
: flags(0), numFrames(0), numMatFrames(0), vertsPerFrame(0)
|
||||
: mFlags(0), mNumFrames(0), mNumMatFrames(0), mVertsPerFrame(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -44,43 +44,43 @@ void AppMesh::computeBounds(Box3F& bounds)
|
|||
|
||||
// Setup bone transforms
|
||||
Vector<MatrixF> boneTransforms;
|
||||
boneTransforms.setSize( nodeIndex.size() );
|
||||
boneTransforms.setSize( mNodeIndex.size() );
|
||||
for (S32 iBone = 0; iBone < boneTransforms.size(); iBone++)
|
||||
{
|
||||
MatrixF nodeMat = bones[iBone]->getNodeTransform( TSShapeLoader::DefaultTime );
|
||||
MatrixF nodeMat = mBones[iBone]->getNodeTransform( TSShapeLoader::DefaultTime );
|
||||
TSShapeLoader::zapScale(nodeMat);
|
||||
boneTransforms[iBone].mul( nodeMat, initialTransforms[iBone] );
|
||||
boneTransforms[iBone].mul( nodeMat, mInitialTransforms[iBone] );
|
||||
}
|
||||
|
||||
// Multiply verts by weighted bone transforms
|
||||
for (S32 iVert = 0; iVert < initialVerts.size(); iVert++)
|
||||
points[iVert].set( Point3F::Zero );
|
||||
for (S32 iVert = 0; iVert < mInitialVerts.size(); iVert++)
|
||||
mPoints[iVert].set( Point3F::Zero );
|
||||
|
||||
for (S32 iWeight = 0; iWeight < vertexIndex.size(); iWeight++)
|
||||
for (S32 iWeight = 0; iWeight < mVertexIndex.size(); iWeight++)
|
||||
{
|
||||
const S32& vertIndex = vertexIndex[iWeight];
|
||||
const MatrixF& deltaTransform = boneTransforms[ boneIndex[iWeight] ];
|
||||
const S32& vertIndex = mVertexIndex[iWeight];
|
||||
const MatrixF& deltaTransform = boneTransforms[ mBoneIndex[iWeight] ];
|
||||
|
||||
Point3F v;
|
||||
deltaTransform.mulP( initialVerts[vertIndex], &v );
|
||||
v *= weight[iWeight];
|
||||
deltaTransform.mulP( mInitialVerts[vertIndex], &v );
|
||||
v *= mWeight[iWeight];
|
||||
|
||||
points[vertIndex] += v;
|
||||
mPoints[vertIndex] += v;
|
||||
}
|
||||
|
||||
// compute bounds for the skinned mesh
|
||||
for (S32 iVert = 0; iVert < initialVerts.size(); iVert++)
|
||||
bounds.extend( points[iVert] );
|
||||
for (S32 iVert = 0; iVert < mInitialVerts.size(); iVert++)
|
||||
bounds.extend( mPoints[iVert] );
|
||||
}
|
||||
else
|
||||
{
|
||||
MatrixF transform = getMeshTransform(TSShapeLoader::DefaultTime);
|
||||
TSShapeLoader::zapScale(transform);
|
||||
|
||||
for (S32 iVert = 0; iVert < points.size(); iVert++)
|
||||
for (S32 iVert = 0; iVert < mPoints.size(); iVert++)
|
||||
{
|
||||
Point3F p;
|
||||
transform.mulP(points[iVert], &p);
|
||||
transform.mulP(mPoints[iVert], &p);
|
||||
bounds.extend(p);
|
||||
}
|
||||
}
|
||||
|
|
@ -89,39 +89,39 @@ void AppMesh::computeBounds(Box3F& bounds)
|
|||
void AppMesh::computeNormals()
|
||||
{
|
||||
// Clear normals
|
||||
normals.setSize( points.size() );
|
||||
for (S32 iNorm = 0; iNorm < normals.size(); iNorm++)
|
||||
normals[iNorm] = Point3F::Zero;
|
||||
mNormals.setSize( mPoints.size() );
|
||||
for (S32 iNorm = 0; iNorm < mNormals.size(); iNorm++)
|
||||
mNormals[iNorm] = Point3F::Zero;
|
||||
|
||||
// Sum triangle normals for each vertex
|
||||
for (S32 iPrim = 0; iPrim < primitives.size(); iPrim++)
|
||||
for (S32 iPrim = 0; iPrim < mPrimitives.size(); iPrim++)
|
||||
{
|
||||
const TSDrawPrimitive& prim = primitives[iPrim];
|
||||
const TSDrawPrimitive& prim = mPrimitives[iPrim];
|
||||
|
||||
for (S32 iInd = 0; iInd < prim.numElements; iInd += 3)
|
||||
{
|
||||
// Compute the normal for this triangle
|
||||
S32 idx0 = indices[prim.start + iInd + 0];
|
||||
S32 idx1 = indices[prim.start + iInd + 1];
|
||||
S32 idx2 = indices[prim.start + iInd + 2];
|
||||
S32 idx0 = mIndices[prim.start + iInd + 0];
|
||||
S32 idx1 = mIndices[prim.start + iInd + 1];
|
||||
S32 idx2 = mIndices[prim.start + iInd + 2];
|
||||
|
||||
const Point3F& v0 = points[idx0];
|
||||
const Point3F& v1 = points[idx1];
|
||||
const Point3F& v2 = points[idx2];
|
||||
const Point3F& v0 = mPoints[idx0];
|
||||
const Point3F& v1 = mPoints[idx1];
|
||||
const Point3F& v2 = mPoints[idx2];
|
||||
|
||||
Point3F n;
|
||||
mCross(v2 - v0, v1 - v0, &n);
|
||||
n.normalize(); // remove this to use 'weighted' normals (large triangles will have more effect)
|
||||
|
||||
normals[idx0] += n;
|
||||
normals[idx1] += n;
|
||||
normals[idx2] += n;
|
||||
mNormals[idx0] += n;
|
||||
mNormals[idx1] += n;
|
||||
mNormals[idx2] += n;
|
||||
}
|
||||
}
|
||||
|
||||
// Normalize the vertex normals (this takes care of averaging the triangle normals)
|
||||
for (S32 iNorm = 0; iNorm < normals.size(); iNorm++)
|
||||
normals[iNorm].normalize();
|
||||
for (S32 iNorm = 0; iNorm < mNormals.size(); iNorm++)
|
||||
mNormals[iNorm].normalize();
|
||||
}
|
||||
|
||||
TSMesh* AppMesh::constructTSMesh()
|
||||
|
|
@ -133,13 +133,13 @@ TSMesh* AppMesh::constructTSMesh()
|
|||
tsmesh = tsskin;
|
||||
|
||||
// Copy skin elements
|
||||
tsskin->weight = weight;
|
||||
tsskin->boneIndex = boneIndex;
|
||||
tsskin->vertexIndex = vertexIndex;
|
||||
tsskin->batchData.nodeIndex = nodeIndex;
|
||||
tsskin->batchData.initialTransforms = initialTransforms;
|
||||
tsskin->batchData.initialVerts = initialVerts;
|
||||
tsskin->batchData.initialNorms = initialNorms;
|
||||
tsskin->weight = mWeight;
|
||||
tsskin->boneIndex = mBoneIndex;
|
||||
tsskin->vertexIndex = mVertexIndex;
|
||||
tsskin->batchData.nodeIndex = mNodeIndex;
|
||||
tsskin->batchData.initialTransforms = mInitialTransforms;
|
||||
tsskin->batchData.initialVerts = mInitialVerts;
|
||||
tsskin->batchData.initialNorms = mInitialNorms;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -147,20 +147,20 @@ TSMesh* AppMesh::constructTSMesh()
|
|||
}
|
||||
|
||||
// Copy mesh elements
|
||||
tsmesh->verts = points;
|
||||
tsmesh->norms = normals;
|
||||
tsmesh->tverts = uvs;
|
||||
tsmesh->primitives = primitives;
|
||||
tsmesh->indices = indices;
|
||||
tsmesh->colors = colors;
|
||||
tsmesh->tverts2 = uv2s;
|
||||
tsmesh->verts = mPoints;
|
||||
tsmesh->norms = mNormals;
|
||||
tsmesh->tverts = mUVs;
|
||||
tsmesh->primitives = mPrimitives;
|
||||
tsmesh->indices = mIndices;
|
||||
tsmesh->colors = mColors;
|
||||
tsmesh->tverts2 = mUV2s;
|
||||
|
||||
// Finish initializing the shape
|
||||
tsmesh->setFlags(flags);
|
||||
tsmesh->setFlags(mFlags);
|
||||
tsmesh->computeBounds();
|
||||
tsmesh->numFrames = numFrames;
|
||||
tsmesh->numMatFrames = numMatFrames;
|
||||
tsmesh->vertsPerFrame = vertsPerFrame;
|
||||
tsmesh->numFrames = mNumFrames;
|
||||
tsmesh->numMatFrames = mNumMatFrames;
|
||||
tsmesh->vertsPerFrame = mVertsPerFrame;
|
||||
tsmesh->createTangents(tsmesh->verts, tsmesh->norms);
|
||||
tsmesh->encodedNorms.set(NULL,0);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,33 +42,33 @@ class AppMesh
|
|||
{
|
||||
public:
|
||||
// Mesh and skin elements
|
||||
Vector<Point3F> points;
|
||||
Vector<Point3F> normals;
|
||||
Vector<Point2F> uvs;
|
||||
Vector<Point2F> uv2s;
|
||||
Vector<ColorI> colors;
|
||||
Vector<TSDrawPrimitive> primitives;
|
||||
Vector<U32> indices;
|
||||
Vector<Point3F> mPoints;
|
||||
Vector<Point3F> mNormals;
|
||||
Vector<Point2F> mUVs;
|
||||
Vector<Point2F> mUV2s;
|
||||
Vector<ColorI> mColors;
|
||||
Vector<TSDrawPrimitive> mPrimitives;
|
||||
Vector<U32> mIndices;
|
||||
|
||||
// Skin elements
|
||||
Vector<F32> weight;
|
||||
Vector<S32> boneIndex;
|
||||
Vector<S32> vertexIndex;
|
||||
Vector<S32> nodeIndex;
|
||||
Vector<MatrixF> initialTransforms;
|
||||
Vector<Point3F> initialVerts;
|
||||
Vector<Point3F> initialNorms;
|
||||
Vector<F32> mWeight;
|
||||
Vector<S32> mBoneIndex;
|
||||
Vector<S32> mVertexIndex;
|
||||
Vector<S32> mNodeIndex;
|
||||
Vector<MatrixF> mInitialTransforms;
|
||||
Vector<Point3F> mInitialVerts;
|
||||
Vector<Point3F> mInitialNorms;
|
||||
|
||||
U32 flags;
|
||||
U32 vertsPerFrame;
|
||||
S32 numFrames;
|
||||
S32 numMatFrames;
|
||||
U32 mFlags;
|
||||
U32 mVertsPerFrame;
|
||||
S32 mNumFrames;
|
||||
S32 mNumMatFrames;
|
||||
|
||||
// Loader elements (can be discarded after loading)
|
||||
S32 detailSize;
|
||||
MatrixF objectOffset;
|
||||
Vector<AppNode*> bones;
|
||||
static Vector<AppMaterial*> appMaterials;
|
||||
S32 mDetailSize;
|
||||
MatrixF mObjectOffset;
|
||||
Vector<AppNode*> mBones;
|
||||
static Vector<AppMaterial*> mAppMaterials;
|
||||
|
||||
public:
|
||||
AppMesh();
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ bool cmpMeshNameAndSize(const String& key, const Vector<String>& names, void* ar
|
|||
{
|
||||
if (names[i].compare(key, 0, String::NoCase) == 0)
|
||||
{
|
||||
if (meshes[i]->detailSize == meshSize)
|
||||
if (meshes[i]->mDetailSize == meshSize)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -396,17 +396,17 @@ void TSShapeLoader::generateObjects()
|
|||
for (S32 iMesh = 0; iMesh < subshape->objMeshes.size(); iMesh++)
|
||||
{
|
||||
AppMesh* mesh = subshape->objMeshes[iMesh];
|
||||
mesh->detailSize = 2;
|
||||
String name = String::GetTrailingNumber( mesh->getName(), mesh->detailSize );
|
||||
name = getUniqueName( name, cmpMeshNameAndSize, meshNames, &(subshape->objMeshes), (void*)mesh->detailSize );
|
||||
mesh->mDetailSize = 2;
|
||||
String name = String::GetTrailingNumber( mesh->getName(), mesh->mDetailSize );
|
||||
name = getUniqueName( name, cmpMeshNameAndSize, meshNames, &(subshape->objMeshes), (void*)mesh->mDetailSize );
|
||||
meshNames.push_back( name );
|
||||
|
||||
// Fix up any collision details that don't have a negative detail level.
|
||||
if ( dStrStartsWith(meshNames[iMesh], "Collision") ||
|
||||
dStrStartsWith(meshNames[iMesh], "LOSCol") )
|
||||
{
|
||||
if (mesh->detailSize > 0)
|
||||
mesh->detailSize = -mesh->detailSize;
|
||||
if (mesh->mDetailSize > 0)
|
||||
mesh->mDetailSize = -mesh->mDetailSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -421,7 +421,7 @@ void TSShapeLoader::generateObjects()
|
|||
{
|
||||
if ((meshNames[i].compare(meshNames[j]) < 0) ||
|
||||
((meshNames[i].compare(meshNames[j]) == 0) &&
|
||||
(subshape->objMeshes[i]->detailSize < subshape->objMeshes[j]->detailSize)))
|
||||
(subshape->objMeshes[i]->mDetailSize < subshape->objMeshes[j]->mDetailSize)))
|
||||
{
|
||||
{
|
||||
AppMesh* tmp = subshape->objMeshes[i];
|
||||
|
|
@ -463,17 +463,17 @@ void TSShapeLoader::generateObjects()
|
|||
shape->objects.last().numMeshes++;
|
||||
|
||||
// Set mesh flags
|
||||
mesh->flags = 0;
|
||||
mesh->mFlags = 0;
|
||||
if (mesh->isBillboard())
|
||||
{
|
||||
mesh->flags |= TSMesh::Billboard;
|
||||
mesh->mFlags |= TSMesh::Billboard;
|
||||
if (mesh->isBillboardZAxis())
|
||||
mesh->flags |= TSMesh::BillboardZAxis;
|
||||
mesh->mFlags |= TSMesh::BillboardZAxis;
|
||||
}
|
||||
|
||||
// Set the detail name... do fixups for collision details.
|
||||
const char* detailName = "detail";
|
||||
if ( mesh->detailSize < 0 )
|
||||
if ( mesh->mDetailSize < 0 )
|
||||
{
|
||||
if ( dStrStartsWith(meshNames[iMesh], "Collision") ||
|
||||
dStrStartsWith(meshNames[iMesh], "Col") )
|
||||
|
|
@ -484,11 +484,11 @@ void TSShapeLoader::generateObjects()
|
|||
|
||||
// Attempt to add the detail (will fail if it already exists)
|
||||
S32 oldNumDetails = shape->details.size();
|
||||
shape->addDetail(detailName, mesh->detailSize, iSub);
|
||||
shape->addDetail(detailName, mesh->mDetailSize, iSub);
|
||||
if (shape->details.size() > oldNumDetails)
|
||||
{
|
||||
Con::warnf("Object mesh \"%s\" has no matching detail (\"%s%d\" has"
|
||||
" been added automatically)", mesh->getName(false), detailName, mesh->detailSize);
|
||||
" been added automatically)", mesh->getName(false), detailName, mesh->mDetailSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -519,30 +519,30 @@ void TSShapeLoader::generateSkins()
|
|||
skin->lookupSkinData();
|
||||
|
||||
// Just copy initial verts and norms for now
|
||||
skin->initialVerts.set(skin->points.address(), skin->vertsPerFrame);
|
||||
skin->initialNorms.set(skin->normals.address(), skin->vertsPerFrame);
|
||||
skin->mInitialVerts.set(skin->mPoints.address(), skin->mVertsPerFrame);
|
||||
skin->mInitialNorms.set(skin->mNormals.address(), skin->mVertsPerFrame);
|
||||
|
||||
// Map bones to nodes
|
||||
skin->nodeIndex.setSize(skin->bones.size());
|
||||
for (S32 iBone = 0; iBone < skin->bones.size(); iBone++)
|
||||
skin->mNodeIndex.setSize(skin->mBones.size());
|
||||
for (S32 iBone = 0; iBone < skin->mBones.size(); iBone++)
|
||||
{
|
||||
// Find the node that matches this bone
|
||||
skin->nodeIndex[iBone] = -1;
|
||||
skin->mNodeIndex[iBone] = -1;
|
||||
for (S32 iNode = 0; iNode < appNodes.size(); iNode++)
|
||||
{
|
||||
if (appNodes[iNode]->isEqual(skin->bones[iBone]))
|
||||
if (appNodes[iNode]->isEqual(skin->mBones[iBone]))
|
||||
{
|
||||
delete skin->bones[iBone];
|
||||
skin->bones[iBone] = appNodes[iNode];
|
||||
skin->nodeIndex[iBone] = iNode;
|
||||
delete skin->mBones[iBone];
|
||||
skin->mBones[iBone] = appNodes[iNode];
|
||||
skin->mNodeIndex[iBone] = iNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (skin->nodeIndex[iBone] == -1)
|
||||
if (skin->mNodeIndex[iBone] == -1)
|
||||
{
|
||||
Con::warnf("Could not find bone %d. Defaulting to first node", iBone);
|
||||
skin->nodeIndex[iBone] = 0;
|
||||
skin->mNodeIndex[iBone] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -569,7 +569,7 @@ void TSShapeLoader::generateDefaultStates()
|
|||
|
||||
zapScale(nodeMat);
|
||||
|
||||
appMesh->objectOffset = nodeMat.inverse() * meshMat;
|
||||
appMesh->mObjectOffset = nodeMat.inverse() * meshMat;
|
||||
}
|
||||
|
||||
generateObjectState(shape->objects[iObject], DefaultTime, true, true);
|
||||
|
|
@ -603,8 +603,8 @@ void TSShapeLoader::generateObjectState(TSShape::Object& obj, F32 t, bool addFra
|
|||
generateFrame(obj, t, addFrame, addMatFrame);
|
||||
|
||||
// set the frame number for the object state
|
||||
state.frameIndex = appMeshes[obj.startMeshIndex]->numFrames - 1;
|
||||
state.matFrameIndex = appMeshes[obj.startMeshIndex]->numMatFrames - 1;
|
||||
state.frameIndex = appMeshes[obj.startMeshIndex]->mNumFrames - 1;
|
||||
state.matFrameIndex = appMeshes[obj.startMeshIndex]->mNumMatFrames - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -614,45 +614,45 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo
|
|||
{
|
||||
AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh];
|
||||
|
||||
U32 oldNumPoints = appMesh->points.size();
|
||||
U32 oldNumUvs = appMesh->uvs.size();
|
||||
U32 oldNumPoints = appMesh->mPoints.size();
|
||||
U32 oldNumUvs = appMesh->mUVs.size();
|
||||
|
||||
// Get the mesh geometry at time, 't'
|
||||
// Geometry verts, normals and tverts can be animated (different set for
|
||||
// each frame), but the TSDrawPrimitives stay the same, so the way lockMesh
|
||||
// works is that it will only generate the primitives once, then after that
|
||||
// will just append verts, normals and tverts each time it is called.
|
||||
appMesh->lockMesh(t, appMesh->objectOffset);
|
||||
appMesh->lockMesh(t, appMesh->mObjectOffset);
|
||||
|
||||
// Calculate vertex normals if required
|
||||
if (appMesh->normals.size() != appMesh->points.size())
|
||||
if (appMesh->mNormals.size() != appMesh->mPoints.size())
|
||||
appMesh->computeNormals();
|
||||
|
||||
// If this is the first call, set the number of points per frame
|
||||
if (appMesh->numFrames == 0)
|
||||
if (appMesh->mNumFrames == 0)
|
||||
{
|
||||
appMesh->vertsPerFrame = appMesh->points.size();
|
||||
appMesh->mVertsPerFrame = appMesh->mPoints.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check frame topology => ie. that the right number of points, normals
|
||||
// and tverts was added
|
||||
if ((appMesh->points.size() - oldNumPoints) != appMesh->vertsPerFrame)
|
||||
if ((appMesh->mPoints.size() - oldNumPoints) != appMesh->mVertsPerFrame)
|
||||
{
|
||||
Con::warnf("Wrong number of points (%d) added at time=%f (expected %d)",
|
||||
appMesh->points.size() - oldNumPoints, t, appMesh->vertsPerFrame);
|
||||
appMesh->mPoints.size() - oldNumPoints, t, appMesh->mVertsPerFrame);
|
||||
addFrame = false;
|
||||
}
|
||||
if ((appMesh->normals.size() - oldNumPoints) != appMesh->vertsPerFrame)
|
||||
if ((appMesh->mNormals.size() - oldNumPoints) != appMesh->mVertsPerFrame)
|
||||
{
|
||||
Con::warnf("Wrong number of normals (%d) added at time=%f (expected %d)",
|
||||
appMesh->normals.size() - oldNumPoints, t, appMesh->vertsPerFrame);
|
||||
appMesh->mNormals.size() - oldNumPoints, t, appMesh->mVertsPerFrame);
|
||||
addFrame = false;
|
||||
}
|
||||
if ((appMesh->uvs.size() - oldNumUvs) != appMesh->vertsPerFrame)
|
||||
if ((appMesh->mUVs.size() - oldNumUvs) != appMesh->mVertsPerFrame)
|
||||
{
|
||||
Con::warnf("Wrong number of tverts (%d) added at time=%f (expected %d)",
|
||||
appMesh->uvs.size() - oldNumUvs, t, appMesh->vertsPerFrame);
|
||||
appMesh->mUVs.size() - oldNumUvs, t, appMesh->mVertsPerFrame);
|
||||
addMatFrame = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -663,21 +663,21 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo
|
|||
// points/normals/tverts are already in place!
|
||||
if (addFrame)
|
||||
{
|
||||
appMesh->numFrames++;
|
||||
appMesh->mNumFrames++;
|
||||
}
|
||||
else
|
||||
{
|
||||
appMesh->points.setSize(oldNumPoints);
|
||||
appMesh->normals.setSize(oldNumPoints);
|
||||
appMesh->mPoints.setSize(oldNumPoints);
|
||||
appMesh->mNormals.setSize(oldNumPoints);
|
||||
}
|
||||
|
||||
if (addMatFrame)
|
||||
{
|
||||
appMesh->numMatFrames++;
|
||||
appMesh->mNumMatFrames++;
|
||||
}
|
||||
else
|
||||
{
|
||||
appMesh->uvs.setSize(oldNumPoints);
|
||||
appMesh->mUVs.setSize(oldNumPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -690,11 +690,11 @@ void TSShapeLoader::generateMaterialList()
|
|||
{
|
||||
// Install the materials into the material list
|
||||
shape->materialList = new TSMaterialList;
|
||||
for (S32 iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++)
|
||||
for (S32 iMat = 0; iMat < AppMesh::mAppMaterials.size(); iMat++)
|
||||
{
|
||||
updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::appMaterials.size(), iMat);
|
||||
updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::mAppMaterials.size(), iMat);
|
||||
|
||||
AppMaterial* appMat = AppMesh::appMaterials[iMat];
|
||||
AppMaterial* appMat = AppMesh::mAppMaterials[iMat];
|
||||
shape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance());
|
||||
}
|
||||
}
|
||||
|
|
@ -1119,7 +1119,7 @@ void TSShapeLoader::sortDetails()
|
|||
// object does not already have a mesh with an equal or higher detail)
|
||||
S32 meshIndex = (iDet < object.numMeshes) ? iDet : object.numMeshes-1;
|
||||
|
||||
if (appMeshes[object.startMeshIndex + meshIndex]->detailSize < shape->details[iDet].size)
|
||||
if (appMeshes[object.startMeshIndex + meshIndex]->mDetailSize < shape->details[iDet].size)
|
||||
{
|
||||
// Add a NULL mesh
|
||||
appMeshes.insert(object.startMeshIndex + iDet, NULL);
|
||||
|
|
@ -1256,9 +1256,9 @@ TSShapeLoader::~TSShapeLoader()
|
|||
clearNodeTransformCache();
|
||||
|
||||
// Clear shared AppMaterial list
|
||||
for (S32 iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++)
|
||||
delete AppMesh::appMaterials[iMat];
|
||||
AppMesh::appMaterials.clear();
|
||||
for (S32 iMat = 0; iMat < AppMesh::mAppMaterials.size(); iMat++)
|
||||
delete AppMesh::mAppMaterials[iMat];
|
||||
AppMesh::mAppMaterials.clear();
|
||||
|
||||
// Delete Subshapes
|
||||
delete boundsNode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue