mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSShape
This commit is contained in:
parent
2112c81446
commit
69dbaf5b85
35 changed files with 1377 additions and 1377 deletions
|
|
@ -568,7 +568,7 @@ bool Debris::onAdd()
|
||||||
// Setup our bounding box
|
// Setup our bounding box
|
||||||
if( mDataBlock->shape )
|
if( mDataBlock->shape )
|
||||||
{
|
{
|
||||||
mObjBox = mDataBlock->shape->bounds;
|
mObjBox = mDataBlock->shape->mBounds;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ void RenderShapeExample::createShape()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the bounding box
|
// Update the bounding box
|
||||||
mObjBox = mShape->bounds;
|
mObjBox = mShape->mBounds;
|
||||||
resetWorldBox();
|
resetWorldBox();
|
||||||
setRenderTransform(mObjToWorld);
|
setRenderTransform(mObjToWorld);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1246,7 +1246,7 @@ bool Explosion::explode()
|
||||||
mEndingMS = U32(mExplosionInstance->getScaledDuration(mExplosionThread) * 1000.0f);
|
mEndingMS = U32(mExplosionInstance->getScaledDuration(mExplosionThread) * 1000.0f);
|
||||||
|
|
||||||
mObjScale.convolve(mDataBlock->explosionScale);
|
mObjScale.convolve(mDataBlock->explosionScale);
|
||||||
mObjBox = mDataBlock->explosionShape->bounds;
|
mObjBox = mDataBlock->explosionShape->mBounds;
|
||||||
resetWorldBox();
|
resetWorldBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1142,7 +1142,7 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index,
|
||||||
const F32 typeMaxElevation = mMaxElevation[type];
|
const F32 typeMaxElevation = mMaxElevation[type];
|
||||||
const F32 typeMinElevation = mMinElevation[type];
|
const F32 typeMinElevation = mMinElevation[type];
|
||||||
const bool typeIsShape = mShapeInstances[ type ] != NULL;
|
const bool typeIsShape = mShapeInstances[ type ] != NULL;
|
||||||
const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->bounds : Box3F();
|
const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->mBounds : Box3F();
|
||||||
const F32 typeWindScale = mWindScale[type];
|
const F32 typeWindScale = mWindScale[type];
|
||||||
StringTableEntry typeLayer = mLayer[type];
|
StringTableEntry typeLayer = mLayer[type];
|
||||||
const bool typeInvertLayer = mInvertLayer[type];
|
const bool typeInvertLayer = mInvertLayer[type];
|
||||||
|
|
|
||||||
|
|
@ -268,8 +268,8 @@ void GuiMaterialPreview::setObjectModel(const char* modelName)
|
||||||
AssertFatal(mModel, avar("GuiMaterialPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName));
|
AssertFatal(mModel, avar("GuiMaterialPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName));
|
||||||
|
|
||||||
// Initialize camera values:
|
// Initialize camera values:
|
||||||
mOrbitPos = mModel->getShape()->center;
|
mOrbitPos = mModel->getShape()->mCenter;
|
||||||
mMinOrbitDist = mModel->getShape()->radius;
|
mMinOrbitDist = mModel->getShape()->mRadius;
|
||||||
|
|
||||||
lastRenderTime = Platform::getVirtualMilliseconds();
|
lastRenderTime = Platform::getVirtualMilliseconds();
|
||||||
}
|
}
|
||||||
|
|
@ -434,7 +434,7 @@ void GuiMaterialPreview::resetViewport()
|
||||||
mCameraRot.set( mDegToRad(30.0f), 0, mDegToRad(-30.0f) );
|
mCameraRot.set( mDegToRad(30.0f), 0, mDegToRad(-30.0f) );
|
||||||
mCameraPos.set(0.0f, 1.75f, 1.25f);
|
mCameraPos.set(0.0f, 1.75f, 1.25f);
|
||||||
mOrbitDist = 5.0f;
|
mOrbitDist = 5.0f;
|
||||||
mOrbitPos = mModel->getShape()->center;
|
mOrbitPos = mModel->getShape()->mCenter;
|
||||||
|
|
||||||
// Reset the viewport's lighting.
|
// Reset the viewport's lighting.
|
||||||
GuiMaterialPreview::mFakeSun->setColor( ColorF( 1.0f, 1.0f, 1.0f ) );
|
GuiMaterialPreview::mFakeSun->setColor( ColorF( 1.0f, 1.0f, 1.0f ) );
|
||||||
|
|
|
||||||
|
|
@ -366,8 +366,8 @@ void GuiObjectView::setObjectModel( const String& modelName )
|
||||||
|
|
||||||
// Initialize camera values.
|
// Initialize camera values.
|
||||||
|
|
||||||
mOrbitPos = mModel->getShape()->center;
|
mOrbitPos = mModel->getShape()->mCenter;
|
||||||
mMinOrbitDist = mModel->getShape()->radius;
|
mMinOrbitDist = mModel->getShape()->mRadius;
|
||||||
|
|
||||||
// Initialize animation.
|
// Initialize animation.
|
||||||
|
|
||||||
|
|
@ -645,7 +645,7 @@ void GuiObjectView::_initAnimation()
|
||||||
|
|
||||||
if( mAnimationSeq != -1 )
|
if( mAnimationSeq != -1 )
|
||||||
{
|
{
|
||||||
if( mAnimationSeq >= mModel->getShape()->sequences.size() )
|
if( mAnimationSeq >= mModel->getShape()->mSequences.size() )
|
||||||
{
|
{
|
||||||
Con::errorf( "GuiObjectView::_initAnimation - Sequence '%i' out of range for model '%s'",
|
Con::errorf( "GuiObjectView::_initAnimation - Sequence '%i' out of range for model '%s'",
|
||||||
mAnimationSeq,
|
mAnimationSeq,
|
||||||
|
|
@ -694,7 +694,7 @@ void GuiObjectView::_initMount()
|
||||||
|
|
||||||
// Make sure mount node is valid.
|
// Make sure mount node is valid.
|
||||||
|
|
||||||
if( mMountNode != -1 && mMountNode >= mModel->getShape()->nodes.size() )
|
if( mMountNode != -1 && mMountNode >= mModel->getShape()->mNodes.size() )
|
||||||
{
|
{
|
||||||
Con::errorf( "GuiObjectView::_initMount - Mount node index '%i' out of range for '%s'",
|
Con::errorf( "GuiObjectView::_initMount - Mount node index '%i' out of range for '%s'",
|
||||||
mMountNode,
|
mMountNode,
|
||||||
|
|
|
||||||
|
|
@ -350,7 +350,7 @@ bool PhysicsDebris::onAdd()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup our bounding box
|
// Setup our bounding box
|
||||||
mObjBox = mDataBlock->shape->bounds;
|
mObjBox = mDataBlock->shape->mBounds;
|
||||||
resetWorldBox();
|
resetWorldBox();
|
||||||
|
|
||||||
// Add it to the client scene.
|
// Add it to the client scene.
|
||||||
|
|
@ -688,20 +688,20 @@ void PhysicsDebris::_findNodes( U32 colNode, Vector<U32> &nodeIds )
|
||||||
// 2. Collision node is a child of its visible mesh node
|
// 2. Collision node is a child of its visible mesh node
|
||||||
|
|
||||||
TSShape *shape = mDataBlock->shape;
|
TSShape *shape = mDataBlock->shape;
|
||||||
S32 itr = shape->nodes[colNode].parentIndex;
|
S32 itr = shape->mNodes[colNode].parentIndex;
|
||||||
itr = shape->nodes[itr].firstChild;
|
itr = shape->mNodes[itr].firstChild;
|
||||||
|
|
||||||
while ( itr != -1 )
|
while ( itr != -1 )
|
||||||
{
|
{
|
||||||
if ( itr != colNode )
|
if ( itr != colNode )
|
||||||
nodeIds.push_back(itr);
|
nodeIds.push_back(itr);
|
||||||
itr = shape->nodes[itr].nextSibling;
|
itr = shape->mNodes[itr].nextSibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we didn't find any siblings of the collision node we assume
|
// If we didn't find any siblings of the collision node we assume
|
||||||
// it is case #2 and the collision nodes direct parent is the visible mesh.
|
// it is case #2 and the collision nodes direct parent is the visible mesh.
|
||||||
if ( nodeIds.size() == 0 && shape->nodes[colNode].parentIndex != -1 )
|
if ( nodeIds.size() == 0 && shape->mNodes[colNode].parentIndex != -1 )
|
||||||
nodeIds.push_back( shape->nodes[colNode].parentIndex );
|
nodeIds.push_back( shape->mNodes[colNode].parentIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool gEditingMission;
|
extern bool gEditingMission;
|
||||||
|
|
|
||||||
|
|
@ -698,7 +698,7 @@ bool PhysicsShape::_createShape()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set the world box.
|
// Set the world box.
|
||||||
mObjBox = db->shape->bounds;
|
mObjBox = db->shape->mBounds;
|
||||||
resetWorldBox();
|
resetWorldBox();
|
||||||
|
|
||||||
// If this is the server and its a client only simulation
|
// If this is the server and its a client only simulation
|
||||||
|
|
|
||||||
|
|
@ -492,12 +492,12 @@ bool PlayerData::preload(bool server, String &errorStr)
|
||||||
if (dStricmp(sp->name, "jet") != 0)
|
if (dStricmp(sp->name, "jet") != 0)
|
||||||
AssertWarn(dp->sequence != -1, avar("PlayerData::preload - Unable to find named animation sequence '%s'!", sp->name));
|
AssertWarn(dp->sequence != -1, avar("PlayerData::preload - Unable to find named animation sequence '%s'!", sp->name));
|
||||||
}
|
}
|
||||||
for (S32 b = 0; b < mShape->sequences.size(); b++)
|
for (S32 b = 0; b < mShape->mSequences.size(); b++)
|
||||||
{
|
{
|
||||||
if (!isTableSequence(b))
|
if (!isTableSequence(b))
|
||||||
{
|
{
|
||||||
dp->sequence = b;
|
dp->sequence = b;
|
||||||
dp->name = mShape->getName(mShape->sequences[b].nameIndex);
|
dp->name = mShape->getName(mShape->mSequences[b].nameIndex);
|
||||||
dp->velocityScale = false;
|
dp->velocityScale = false;
|
||||||
getGroundInfo(si,thread,dp++);
|
getGroundInfo(si,thread,dp++);
|
||||||
}
|
}
|
||||||
|
|
@ -614,7 +614,7 @@ void PlayerData::getGroundInfo(TSShapeInstance* si, TSThread* thread,ActionAnima
|
||||||
dp->dir.set(0.0f, 0.0f, 0.0f);
|
dp->dir.set(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
// Death animations MUST define ground transforms, so add dummy ones if required
|
// Death animations MUST define ground transforms, so add dummy ones if required
|
||||||
if (si->getShape()->sequences[dp->sequence].numGroundFrames == 0)
|
if (si->getShape()->mSequences[dp->sequence].numGroundFrames == 0)
|
||||||
si->getShape()->setSequenceGroundSpeed(dp->name, Point3F(0, 0, 0), Point3F(0, 0, 0));
|
si->getShape()->setSequenceGroundSpeed(dp->name, Point3F(0, 0, 0), Point3F(0, 0, 0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -764,7 +764,7 @@ bool Projectile::onAdd()
|
||||||
|
|
||||||
// Setup our bounding box
|
// Setup our bounding box
|
||||||
if (bool(mDataBlock->projectileShape) == true)
|
if (bool(mDataBlock->projectileShape) == true)
|
||||||
mObjBox = mDataBlock->projectileShape->bounds;
|
mObjBox = mDataBlock->projectileShape->mBounds;
|
||||||
else
|
else
|
||||||
mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0));
|
mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -319,9 +319,9 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
|
||||||
// Resolve details and camera node indexes.
|
// Resolve details and camera node indexes.
|
||||||
static const String sCollisionStr( "collision-" );
|
static const String sCollisionStr( "collision-" );
|
||||||
|
|
||||||
for (i = 0; i < mShape->details.size(); i++)
|
for (i = 0; i < mShape->mDetails.size(); i++)
|
||||||
{
|
{
|
||||||
const String &name = mShape->names[mShape->details[i].nameIndex];
|
const String &name = mShape->mNames[mShape->mDetails[i].nameIndex];
|
||||||
|
|
||||||
if (name.compare( sCollisionStr, sCollisionStr.length(), String::NoCase ) == 0)
|
if (name.compare( sCollisionStr, sCollisionStr.length(), String::NoCase ) == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -331,15 +331,15 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
|
||||||
mShape->computeBounds(collisionDetails.last(), collisionBounds.last());
|
mShape->computeBounds(collisionDetails.last(), collisionBounds.last());
|
||||||
mShape->getAccelerator(collisionDetails.last());
|
mShape->getAccelerator(collisionDetails.last());
|
||||||
|
|
||||||
if (!mShape->bounds.isContained(collisionBounds.last()))
|
if (!mShape->mBounds.isContained(collisionBounds.last()))
|
||||||
{
|
{
|
||||||
Con::warnf("Warning: shape %s collision detail %d (Collision-%d) bounds exceed that of shape.", shapeName, collisionDetails.size() - 1, collisionDetails.last());
|
Con::warnf("Warning: shape %s collision detail %d (Collision-%d) bounds exceed that of shape.", shapeName, collisionDetails.size() - 1, collisionDetails.last());
|
||||||
collisionBounds.last() = mShape->bounds;
|
collisionBounds.last() = mShape->mBounds;
|
||||||
}
|
}
|
||||||
else if (collisionBounds.last().isValidBox() == false)
|
else if (collisionBounds.last().isValidBox() == false)
|
||||||
{
|
{
|
||||||
Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", shapeName, collisionDetails.size() - 1, collisionDetails.last());
|
Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", shapeName, collisionDetails.size() - 1, collisionDetails.last());
|
||||||
collisionBounds.last() = mShape->bounds;
|
collisionBounds.last() = mShape->mBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The way LOS works is that it will check to see if there is a LOS detail that matches
|
// The way LOS works is that it will check to see if there is a LOS detail that matches
|
||||||
|
|
@ -360,9 +360,9 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
|
||||||
// Snag any "unmatched" LOS details
|
// Snag any "unmatched" LOS details
|
||||||
static const String sLOSStr( "LOS-" );
|
static const String sLOSStr( "LOS-" );
|
||||||
|
|
||||||
for (i = 0; i < mShape->details.size(); i++)
|
for (i = 0; i < mShape->mDetails.size(); i++)
|
||||||
{
|
{
|
||||||
const String &name = mShape->names[mShape->details[i].nameIndex];
|
const String &name = mShape->mNames[mShape->mDetails[i].nameIndex];
|
||||||
|
|
||||||
if (name.compare( sLOSStr, sLOSStr.length(), String::NoCase ) == 0)
|
if (name.compare( sLOSStr, sLOSStr.length(), String::NoCase ) == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -406,7 +406,7 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
|
||||||
damageSequence = mShape->findSequence("Damage");
|
damageSequence = mShape->findSequence("Damage");
|
||||||
|
|
||||||
//
|
//
|
||||||
F32 w = mShape->bounds.len_y() / 2;
|
F32 w = mShape->mBounds.len_y() / 2;
|
||||||
if (cameraMaxDist < w)
|
if (cameraMaxDist < w)
|
||||||
cameraMaxDist = w;
|
cameraMaxDist = w;
|
||||||
}
|
}
|
||||||
|
|
@ -602,7 +602,7 @@ DefineEngineMethod( ShapeBaseData, checkDeployPos, bool, ( TransformF txfm ),,
|
||||||
|
|
||||||
MatrixF mat = txfm.getMatrix();
|
MatrixF mat = txfm.getMatrix();
|
||||||
|
|
||||||
Box3F objBox = object->mShape->bounds;
|
Box3F objBox = object->mShape->mBounds;
|
||||||
Point3F boxCenter = (objBox.minExtents + objBox.maxExtents) * 0.5f;
|
Point3F boxCenter = (objBox.minExtents + objBox.maxExtents) * 0.5f;
|
||||||
objBox.minExtents = boxCenter + (objBox.minExtents - boxCenter) * 0.9f;
|
objBox.minExtents = boxCenter + (objBox.minExtents - boxCenter) * 0.9f;
|
||||||
objBox.maxExtents = boxCenter + (objBox.maxExtents - boxCenter) * 0.9f;
|
objBox.maxExtents = boxCenter + (objBox.maxExtents - boxCenter) * 0.9f;
|
||||||
|
|
@ -1104,11 +1104,11 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
|
||||||
if (isClientObject())
|
if (isClientObject())
|
||||||
mShapeInstance->cloneMaterialList();
|
mShapeInstance->cloneMaterialList();
|
||||||
|
|
||||||
mObjBox = mDataBlock->mShape->bounds;
|
mObjBox = mDataBlock->mShape->mBounds;
|
||||||
resetWorldBox();
|
resetWorldBox();
|
||||||
|
|
||||||
// Set the initial mesh hidden state.
|
// Set the initial mesh hidden state.
|
||||||
mMeshHidden.setSize( mDataBlock->mShape->objects.size() );
|
mMeshHidden.setSize( mDataBlock->mShape->mObjects.size() );
|
||||||
mMeshHidden.clear();
|
mMeshHidden.clear();
|
||||||
|
|
||||||
// Initialize the threads
|
// Initialize the threads
|
||||||
|
|
@ -1133,8 +1133,8 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
|
||||||
AssertFatal( prevDB != NULL, "ShapeBase::onNewDataBlock - how did you have a sequence playing without a prior datablock?" );
|
AssertFatal( prevDB != NULL, "ShapeBase::onNewDataBlock - how did you have a sequence playing without a prior datablock?" );
|
||||||
|
|
||||||
const TSShape *prevShape = prevDB->mShape;
|
const TSShape *prevShape = prevDB->mShape;
|
||||||
const TSShape::Sequence &prevSeq = prevShape->sequences[st.sequence];
|
const TSShape::Sequence &prevSeq = prevShape->mSequences[st.sequence];
|
||||||
const String &prevSeqName = prevShape->names[prevSeq.nameIndex];
|
const String &prevSeqName = prevShape->mNames[prevSeq.nameIndex];
|
||||||
|
|
||||||
st.sequence = mDataBlock->mShape->findSequence( prevSeqName );
|
st.sequence = mDataBlock->mShape->findSequence( prevSeqName );
|
||||||
|
|
||||||
|
|
@ -2130,7 +2130,7 @@ const char *ShapeBase::getThreadSequenceName( U32 slot )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name Index
|
// Name Index
|
||||||
const U32 nameIndex = getShape()->sequences[st.sequence].nameIndex;
|
const U32 nameIndex = getShape()->mSequences[st.sequence].nameIndex;
|
||||||
|
|
||||||
// Return Name.
|
// Return Name.
|
||||||
return getShape()->getName( nameIndex );
|
return getShape()->getName( nameIndex );
|
||||||
|
|
@ -2343,7 +2343,7 @@ void ShapeBase::advanceThreads(F32 dt)
|
||||||
for (U32 i = 0; i < MaxScriptThreads; i++) {
|
for (U32 i = 0; i < MaxScriptThreads; i++) {
|
||||||
Thread& st = mScriptThread[i];
|
Thread& st = mScriptThread[i];
|
||||||
if (st.thread) {
|
if (st.thread) {
|
||||||
if (!mShapeInstance->getShape()->sequences[st.sequence].isCyclic() && !st.atEnd &&
|
if (!mShapeInstance->getShape()->mSequences[st.sequence].isCyclic() && !st.atEnd &&
|
||||||
( ( st.timescale > 0.f )? mShapeInstance->getPos(st.thread) >= 1.0:
|
( ( st.timescale > 0.f )? mShapeInstance->getPos(st.thread) >= 1.0:
|
||||||
mShapeInstance->getPos(st.thread) <= 0)) {
|
mShapeInstance->getPos(st.thread) <= 0)) {
|
||||||
st.atEnd = true;
|
st.atEnd = true;
|
||||||
|
|
@ -2622,7 +2622,7 @@ void ShapeBase::_renderBoundingBox( ObjectRenderInst *ri, SceneRenderState *stat
|
||||||
MatrixF mat;
|
MatrixF mat;
|
||||||
getRenderImageTransform( ri->objectIndex, &mat );
|
getRenderImageTransform( ri->objectIndex, &mat );
|
||||||
|
|
||||||
const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->bounds;
|
const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->mBounds;
|
||||||
|
|
||||||
drawer->drawCube( desc, objBox, ColorI( 255, 255, 255 ), &mat );
|
drawer->drawCube( desc, objBox, ColorI( 255, 255, 255 ), &mat );
|
||||||
}
|
}
|
||||||
|
|
@ -3341,17 +3341,17 @@ void ShapeBaseConvex::findNodeTransform()
|
||||||
TSShapeInstance* si = pShapeBase->getShapeInstance();
|
TSShapeInstance* si = pShapeBase->getShapeInstance();
|
||||||
TSShape* shape = si->getShape();
|
TSShape* shape = si->getShape();
|
||||||
|
|
||||||
const TSShape::Detail* detail = &shape->details[dl];
|
const TSShape::Detail* detail = &shape->mDetails[dl];
|
||||||
const S32 subs = detail->subShapeNum;
|
const S32 subs = detail->subShapeNum;
|
||||||
const S32 start = shape->subShapeFirstObject[subs];
|
const S32 start = shape->mSubShapeFirstObject[subs];
|
||||||
const S32 end = start + shape->subShapeNumObjects[subs];
|
const S32 end = start + shape->mSubShapeNumObjects[subs];
|
||||||
|
|
||||||
// Find the first object that contains a mesh for this
|
// Find the first object that contains a mesh for this
|
||||||
// detail level. There should only be one mesh per
|
// detail level. There should only be one mesh per
|
||||||
// collision detail level.
|
// collision detail level.
|
||||||
for (S32 i = start; i < end; i++)
|
for (S32 i = start; i < end; i++)
|
||||||
{
|
{
|
||||||
const TSShape::Object* obj = &shape->objects[i];
|
const TSShape::Object* obj = &shape->mObjects[i];
|
||||||
if (obj->numMeshes && detail->objectDetailNum < obj->numMeshes)
|
if (obj->numMeshes && detail->objectDetailNum < obj->numMeshes)
|
||||||
{
|
{
|
||||||
nodeTransform = &si->mNodeTransforms[obj->nodeIndex];
|
nodeTransform = &si->mNodeTransforms[obj->nodeIndex];
|
||||||
|
|
@ -4921,7 +4921,7 @@ DefineEngineMethod( ShapeBase, changeMaterial, void, ( const char* mapTo, Materi
|
||||||
ShapeBase *clientObj = dynamic_cast< ShapeBase* > ( object->getClientObject() );
|
ShapeBase *clientObj = dynamic_cast< ShapeBase* > ( object->getClientObject() );
|
||||||
|
|
||||||
// Check the mapTo name exists for this shape
|
// Check the mapTo name exists for this shape
|
||||||
S32 matIndex = serverObj->getShape()->materialList->getMaterialNameList().find_next(String(mapTo));
|
S32 matIndex = serverObj->getShape()->mMaterialList->getMaterialNameList().find_next(String(mapTo));
|
||||||
if (matIndex < 0)
|
if (matIndex < 0)
|
||||||
{
|
{
|
||||||
Con::errorf("ShapeBase::changeMaterial failed: Invalid mapTo name '%s'", mapTo);
|
Con::errorf("ShapeBase::changeMaterial failed: Invalid mapTo name '%s'", mapTo);
|
||||||
|
|
@ -4940,19 +4940,19 @@ DefineEngineMethod( ShapeBase, changeMaterial, void, ( const char* mapTo, Materi
|
||||||
// Replace instances with the new material being traded in. For ShapeBase
|
// Replace instances with the new material being traded in. For ShapeBase
|
||||||
// class we have to update the server/client objects separately so both
|
// class we have to update the server/client objects separately so both
|
||||||
// represent our changes
|
// represent our changes
|
||||||
delete serverObj->getShape()->materialList->mMatInstList[matIndex];
|
delete serverObj->getShape()->mMaterialList->mMatInstList[matIndex];
|
||||||
serverObj->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
serverObj->getShape()->mMaterialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
||||||
if (clientObj)
|
if (clientObj)
|
||||||
{
|
{
|
||||||
delete clientObj->getShape()->materialList->mMatInstList[matIndex];
|
delete clientObj->getShape()->mMaterialList->mMatInstList[matIndex];
|
||||||
clientObj->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
clientObj->getShape()->mMaterialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finish up preparing the material instances for rendering
|
// Finish up preparing the material instances for rendering
|
||||||
const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPNTTB>();
|
const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPNTTB>();
|
||||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||||
|
|
||||||
serverObj->getShape()->materialList->getMaterialInst(matIndex)->init( features, flags );
|
serverObj->getShape()->mMaterialList->getMaterialInst(matIndex)->init( features, flags );
|
||||||
if (clientObj)
|
if (clientObj)
|
||||||
clientObj->getShapeInstance()->mMaterialList->getMaterialInst(matIndex)->init( features, flags );
|
clientObj->getShapeInstance()->mMaterialList->getMaterialInst(matIndex)->init( features, flags );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -490,9 +490,9 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr)
|
||||||
do {
|
do {
|
||||||
MatrixF nmat;
|
MatrixF nmat;
|
||||||
QuatF q;
|
QuatF q;
|
||||||
TSTransform::setMatrix(shape[i]->defaultRotations[node].getQuatF(&q),shape[i]->defaultTranslations[node],&nmat);
|
TSTransform::setMatrix(shape[i]->mDefaultRotations[node].getQuatF(&q),shape[i]->mDefaultTranslations[node],&nmat);
|
||||||
total.mul(nmat);
|
total.mul(nmat);
|
||||||
node = shape[i]->nodes[node].parentIndex;
|
node = shape[i]->mNodes[node].parentIndex;
|
||||||
}
|
}
|
||||||
while(node != -1);
|
while(node != -1);
|
||||||
total.inverse();
|
total.inverse();
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ bool TSStatic::_createShape()
|
||||||
NetConnection::filesWereDownloaded() )
|
NetConnection::filesWereDownloaded() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mObjBox = mShape->bounds;
|
mObjBox = mShape->mBounds;
|
||||||
resetWorldBox();
|
resetWorldBox();
|
||||||
|
|
||||||
mShapeInstance = new TSShapeInstance( mShape, isClientObject() );
|
mShapeInstance = new TSShapeInstance( mShape, isClientObject() );
|
||||||
|
|
@ -371,7 +371,7 @@ void TSStatic::_updatePhysics()
|
||||||
if ( mCollisionType == Bounds )
|
if ( mCollisionType == Bounds )
|
||||||
{
|
{
|
||||||
MatrixF offset( true );
|
MatrixF offset( true );
|
||||||
offset.setPosition( mShape->center );
|
offset.setPosition( mShape->mCenter );
|
||||||
colShape = PHYSICSMGR->createCollision();
|
colShape = PHYSICSMGR->createCollision();
|
||||||
colShape->addBox( getObjBox().getExtents() * 0.5f * mObjScale, offset );
|
colShape->addBox( getObjBox().getExtents() * 0.5f * mObjScale, offset );
|
||||||
}
|
}
|
||||||
|
|
@ -1109,7 +1109,7 @@ DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Materia
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the mapTo name exists for this shape
|
// Check the mapTo name exists for this shape
|
||||||
S32 matIndex = object->getShape()->materialList->getMaterialNameList().find_next(String(mapTo));
|
S32 matIndex = object->getShape()->mMaterialList->getMaterialNameList().find_next(String(mapTo));
|
||||||
if (matIndex < 0)
|
if (matIndex < 0)
|
||||||
{
|
{
|
||||||
Con::errorf("TSShape::changeMaterial failed: Invalid mapTo name '%s'", mapTo);
|
Con::errorf("TSShape::changeMaterial failed: Invalid mapTo name '%s'", mapTo);
|
||||||
|
|
@ -1127,13 +1127,13 @@ DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Materia
|
||||||
|
|
||||||
// Replace instances with the new material being traded in. Lets make sure that we only
|
// Replace instances with the new material being traded in. Lets make sure that we only
|
||||||
// target the specific targets per inst, this is actually doing more than we thought
|
// target the specific targets per inst, this is actually doing more than we thought
|
||||||
delete object->getShape()->materialList->mMatInstList[matIndex];
|
delete object->getShape()->mMaterialList->mMatInstList[matIndex];
|
||||||
object->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
object->getShape()->mMaterialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
||||||
|
|
||||||
// Finish up preparing the material instances for rendering
|
// Finish up preparing the material instances for rendering
|
||||||
const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPNTTB>();
|
const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPNTTB>();
|
||||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||||
object->getShape()->materialList->getMaterialInst(matIndex)->init( features, flags );
|
object->getShape()->mMaterialList->getMaterialInst(matIndex)->init( features, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( TSStatic, getModelFile, const char *, (),,
|
DefineEngineMethod( TSStatic, getModelFile, const char *, (),,
|
||||||
|
|
|
||||||
|
|
@ -823,8 +823,8 @@ void TurretShape::_updateNodes(const Point3F& rot)
|
||||||
if (node != -1)
|
if (node != -1)
|
||||||
{
|
{
|
||||||
MatrixF* mat = &mShapeInstance->mNodeTransforms[node];
|
MatrixF* mat = &mShapeInstance->mNodeTransforms[node];
|
||||||
Point3F defaultPos = mShapeInstance->getShape()->defaultTranslations[node];
|
Point3F defaultPos = mShapeInstance->getShape()->mDefaultTranslations[node];
|
||||||
Quat16 defaultRot = mShapeInstance->getShape()->defaultRotations[node];
|
Quat16 defaultRot = mShapeInstance->getShape()->mDefaultRotations[node];
|
||||||
|
|
||||||
QuatF qrot(zRot);
|
QuatF qrot(zRot);
|
||||||
qrot *= defaultRot.getQuatF();
|
qrot *= defaultRot.getQuatF();
|
||||||
|
|
@ -837,8 +837,8 @@ void TurretShape::_updateNodes(const Point3F& rot)
|
||||||
if (node != -1)
|
if (node != -1)
|
||||||
{
|
{
|
||||||
MatrixF* mat = &mShapeInstance->mNodeTransforms[node];
|
MatrixF* mat = &mShapeInstance->mNodeTransforms[node];
|
||||||
Point3F defaultPos = mShapeInstance->getShape()->defaultTranslations[node];
|
Point3F defaultPos = mShapeInstance->getShape()->mDefaultTranslations[node];
|
||||||
Quat16 defaultRot = mShapeInstance->getShape()->defaultRotations[node];
|
Quat16 defaultRot = mShapeInstance->getShape()->mDefaultRotations[node];
|
||||||
|
|
||||||
QuatF qrot(xRot);
|
QuatF qrot(xRot);
|
||||||
qrot *= defaultRot.getQuatF();
|
qrot *= defaultRot.getQuatF();
|
||||||
|
|
@ -853,8 +853,8 @@ void TurretShape::_updateNodes(const Point3F& rot)
|
||||||
if (node != -1)
|
if (node != -1)
|
||||||
{
|
{
|
||||||
MatrixF* mat = &mShapeInstance->mNodeTransforms[node];
|
MatrixF* mat = &mShapeInstance->mNodeTransforms[node];
|
||||||
Point3F defaultPos = mShapeInstance->getShape()->defaultTranslations[node];
|
Point3F defaultPos = mShapeInstance->getShape()->mDefaultTranslations[node];
|
||||||
Quat16 defaultRot = mShapeInstance->getShape()->defaultRotations[node];
|
Quat16 defaultRot = mShapeInstance->getShape()->mDefaultRotations[node];
|
||||||
|
|
||||||
QuatF qrot(xRot);
|
QuatF qrot(xRot);
|
||||||
qrot *= defaultRot.getQuatF();
|
qrot *= defaultRot.getQuatF();
|
||||||
|
|
@ -866,8 +866,8 @@ void TurretShape::_updateNodes(const Point3F& rot)
|
||||||
if (node != -1)
|
if (node != -1)
|
||||||
{
|
{
|
||||||
MatrixF* mat = &mShapeInstance->mNodeTransforms[node];
|
MatrixF* mat = &mShapeInstance->mNodeTransforms[node];
|
||||||
Point3F defaultPos = mShapeInstance->getShape()->defaultTranslations[node];
|
Point3F defaultPos = mShapeInstance->getShape()->mDefaultTranslations[node];
|
||||||
Quat16 defaultRot = mShapeInstance->getShape()->defaultRotations[node];
|
Quat16 defaultRot = mShapeInstance->getShape()->mDefaultRotations[node];
|
||||||
|
|
||||||
QuatF qrot(zRot);
|
QuatF qrot(zRot);
|
||||||
qrot *= defaultRot.getQuatF();
|
qrot *= defaultRot.getQuatF();
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ bool WheeledVehicleTire::preload(bool server, String &errorStr)
|
||||||
// Determinw wheel radius from the shape's bounding box.
|
// Determinw wheel radius from the shape's bounding box.
|
||||||
// The tire should be built with it's hub axis along the
|
// The tire should be built with it's hub axis along the
|
||||||
// object's Y axis.
|
// object's Y axis.
|
||||||
radius = shape->bounds.len_z() / 2;
|
radius = shape->mBounds.len_z() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -399,8 +399,8 @@ bool WheeledVehicleData::preload(bool server, String &errorStr)
|
||||||
if (collisionDetails[0] != -1) {
|
if (collisionDetails[0] != -1) {
|
||||||
MatrixF imat(1);
|
MatrixF imat(1);
|
||||||
SphereF sphere;
|
SphereF sphere;
|
||||||
sphere.center = mShape->center;
|
sphere.center = mShape->mCenter;
|
||||||
sphere.radius = mShape->radius;
|
sphere.radius = mShape->mRadius;
|
||||||
PlaneExtractorPolyList polyList;
|
PlaneExtractorPolyList polyList;
|
||||||
polyList.mPlaneList = &rigidBody.mPlaneList;
|
polyList.mPlaneList = &rigidBody.mPlaneList;
|
||||||
polyList.setTransform(&imat, Point3F(1,1,1));
|
polyList.setTransform(&imat, Point3F(1,1,1));
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ TSShapeInstance* TSForestItemData::_getShapeInstance() const
|
||||||
void TSForestItemData::_checkLastDetail()
|
void TSForestItemData::_checkLastDetail()
|
||||||
{
|
{
|
||||||
const S32 dl = mShape->mSmallestVisibleDL;
|
const S32 dl = mShape->mSmallestVisibleDL;
|
||||||
const TSDetail *detail = &mShape->details[dl];
|
const TSDetail *detail = &mShape->mDetails[dl];
|
||||||
|
|
||||||
// TODO: Expose some real parameters to the datablock maybe?
|
// TODO: Expose some real parameters to the datablock maybe?
|
||||||
if ( detail->subShapeNum != -1 )
|
if ( detail->subShapeNum != -1 )
|
||||||
|
|
@ -162,8 +162,8 @@ void TSForestItemData::_checkLastDetail()
|
||||||
mShape->addImposter( mShapeFile, 10, 4, 0, 0, 256, 0, 0 );
|
mShape->addImposter( mShapeFile, 10, 4, 0, 0, 256, 0, 0 );
|
||||||
|
|
||||||
// HACK: If i don't do this it crashes!
|
// HACK: If i don't do this it crashes!
|
||||||
while ( mShape->detailCollisionAccelerators.size() < mShape->details.size() )
|
while ( mShape->mDetailCollisionAccelerators.size() < mShape->mDetails.size() )
|
||||||
mShape->detailCollisionAccelerators.push_back( NULL );
|
mShape->mDetailCollisionAccelerators.push_back( NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,12 +174,12 @@ TSLastDetail* TSForestItemData::getLastDetail() const
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const S32 dl = mShape->mSmallestVisibleDL;
|
const S32 dl = mShape->mSmallestVisibleDL;
|
||||||
const TSDetail* detail = &mShape->details[dl];
|
const TSDetail* detail = &mShape->mDetails[dl];
|
||||||
if ( detail->subShapeNum >= 0 ||
|
if ( detail->subShapeNum >= 0 ||
|
||||||
mShape->billboardDetails.size() <= dl )
|
mShape->mBillboardDetails.size() <= dl )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return mShape->billboardDetails[dl];
|
return mShape->mBillboardDetails[dl];
|
||||||
}
|
}
|
||||||
|
|
||||||
ForestCellBatch* TSForestItemData::allocateBatch() const
|
ForestCellBatch* TSForestItemData::allocateBatch() const
|
||||||
|
|
@ -207,8 +207,8 @@ bool TSForestItemData::canBillboard( const SceneRenderState *state, const Forest
|
||||||
if ( dl < 0 )
|
if ( dl < 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const TSDetail *detail = &mShape->details[dl];
|
const TSDetail *detail = &mShape->mDetails[dl];
|
||||||
if ( detail->subShapeNum < 0 && dl < mShape->billboardDetails.size() )
|
if ( detail->subShapeNum < 0 && dl < mShape->mBillboardDetails.size() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public:
|
||||||
const Vector<S32>& getLOSDetails() const { return mLOSDetails; }
|
const Vector<S32>& getLOSDetails() const { return mLOSDetails; }
|
||||||
|
|
||||||
// ForestItemData
|
// ForestItemData
|
||||||
const Box3F& getObjBox() const { return mShape ? mShape->bounds : Box3F::Invalid; }
|
const Box3F& getObjBox() const { return mShape ? mShape->mBounds : Box3F::Invalid; }
|
||||||
bool render( TSRenderState *rdata, const ForestItem& item ) const;
|
bool render( TSRenderState *rdata, const ForestItem& item ) const;
|
||||||
ForestCellBatch* allocateBatch() const;
|
ForestCellBatch* allocateBatch() const;
|
||||||
bool canBillboard( const SceneRenderState *state, const ForestItem &item, F32 distToCamera ) const;
|
bool canBillboard( const SceneRenderState *state, const ForestItem &item, F32 distToCamera ) const;
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ void GuiShapeEdPreview::setCurrentDetail(S32 dl)
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
S32 smallest = mModel->getShape()->mSmallestVisibleDL;
|
S32 smallest = mModel->getShape()->mSmallestVisibleDL;
|
||||||
mModel->getShape()->mSmallestVisibleDL = mModel->getShape()->details.size()-1;
|
mModel->getShape()->mSmallestVisibleDL = mModel->getShape()->mDetails.size()-1;
|
||||||
mModel->setCurrentDetail( dl );
|
mModel->setCurrentDetail( dl );
|
||||||
mModel->getShape()->mSmallestVisibleDL = smallest;
|
mModel->getShape()->mSmallestVisibleDL = smallest;
|
||||||
|
|
||||||
|
|
@ -360,18 +360,18 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName)
|
||||||
AssertFatal( mModel, avar("GuiShapeEdPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName ));
|
AssertFatal( mModel, avar("GuiShapeEdPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName ));
|
||||||
|
|
||||||
// Initialize camera values:
|
// Initialize camera values:
|
||||||
mOrbitPos = mModel->getShape()->center;
|
mOrbitPos = mModel->getShape()->mCenter;
|
||||||
|
|
||||||
// Set camera move and zoom speed according to model size
|
// Set camera move and zoom speed according to model size
|
||||||
mMoveSpeed = mModel->getShape()->radius / sMoveScaler;
|
mMoveSpeed = mModel->getShape()->mRadius / sMoveScaler;
|
||||||
mZoomSpeed = mModel->getShape()->radius / sZoomScaler;
|
mZoomSpeed = mModel->getShape()->mRadius / sZoomScaler;
|
||||||
|
|
||||||
// Reset node selection
|
// Reset node selection
|
||||||
mHoverNode = -1;
|
mHoverNode = -1;
|
||||||
mSelectedNode = -1;
|
mSelectedNode = -1;
|
||||||
mSelectedObject = -1;
|
mSelectedObject = -1;
|
||||||
mSelectedObjDetail = 0;
|
mSelectedObjDetail = 0;
|
||||||
mProjectedNodes.setSize( mModel->getShape()->nodes.size() );
|
mProjectedNodes.setSize( mModel->getShape()->mNodes.size() );
|
||||||
|
|
||||||
// Reset detail stats
|
// Reset detail stats
|
||||||
mCurrentDL = 0;
|
mCurrentDL = 0;
|
||||||
|
|
@ -683,9 +683,9 @@ void GuiShapeEdPreview::refreshShape()
|
||||||
mModel->initNodeTransforms();
|
mModel->initNodeTransforms();
|
||||||
mModel->initMeshObjects();
|
mModel->initMeshObjects();
|
||||||
|
|
||||||
mProjectedNodes.setSize( mModel->getShape()->nodes.size() );
|
mProjectedNodes.setSize( mModel->getShape()->mNodes.size() );
|
||||||
|
|
||||||
if ( mSelectedObject >= mModel->getShape()->objects.size() )
|
if ( mSelectedObject >= mModel->getShape()->mObjects.size() )
|
||||||
{
|
{
|
||||||
mSelectedObject = -1;
|
mSelectedObject = -1;
|
||||||
mSelectedObjDetail = 0;
|
mSelectedObjDetail = 0;
|
||||||
|
|
@ -694,9 +694,9 @@ void GuiShapeEdPreview::refreshShape()
|
||||||
// Re-compute the collision mesh stats
|
// Re-compute the collision mesh stats
|
||||||
mColMeshes = 0;
|
mColMeshes = 0;
|
||||||
mColPolys = 0;
|
mColPolys = 0;
|
||||||
for ( S32 i = 0; i < mModel->getShape()->details.size(); i++ )
|
for ( S32 i = 0; i < mModel->getShape()->mDetails.size(); i++ )
|
||||||
{
|
{
|
||||||
const TSShape::Detail& det = mModel->getShape()->details[i];
|
const TSShape::Detail& det = mModel->getShape()->mDetails[i];
|
||||||
const String& detName = mModel->getShape()->getName( det.nameIndex );
|
const String& detName = mModel->getShape()->getName( det.nameIndex );
|
||||||
if ( ( det.subShapeNum < 0 ) || !detName.startsWith( "collision-" ) )
|
if ( ( det.subShapeNum < 0 ) || !detName.startsWith( "collision-" ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -704,12 +704,12 @@ void GuiShapeEdPreview::refreshShape()
|
||||||
mColPolys += det.polyCount;
|
mColPolys += det.polyCount;
|
||||||
|
|
||||||
S32 od = det.objectDetailNum;
|
S32 od = det.objectDetailNum;
|
||||||
S32 start = mModel->getShape()->subShapeFirstObject[det.subShapeNum];
|
S32 start = mModel->getShape()->mSubShapeFirstObject[det.subShapeNum];
|
||||||
S32 end = start + mModel->getShape()->subShapeNumObjects[det.subShapeNum];
|
S32 end = start + mModel->getShape()->mSubShapeNumObjects[det.subShapeNum];
|
||||||
for ( S32 j = start; j < end; j++ )
|
for ( S32 j = start; j < end; j++ )
|
||||||
{
|
{
|
||||||
const TSShape::Object &obj = mModel->getShape()->objects[j];
|
const TSShape::Object &obj = mModel->getShape()->mObjects[j];
|
||||||
const TSMesh* mesh = ( od < obj.numMeshes ) ? mModel->getShape()->meshes[obj.startMeshIndex + od] : NULL;
|
const TSMesh* mesh = ( od < obj.numMeshes ) ? mModel->getShape()->mMeshes[obj.startMeshIndex + od] : NULL;
|
||||||
if ( mesh )
|
if ( mesh )
|
||||||
mColMeshes++;
|
mColMeshes++;
|
||||||
}
|
}
|
||||||
|
|
@ -850,7 +850,7 @@ void GuiShapeEdPreview::exportToCollada( const String& path )
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
MatrixF orientation( true );
|
MatrixF orientation( true );
|
||||||
orientation.setPosition( mModel->getShape()->bounds.getCenter() );
|
orientation.setPosition( mModel->getShape()->mBounds.getCenter() );
|
||||||
orientation.inverse();
|
orientation.inverse();
|
||||||
|
|
||||||
OptimizedPolyList polyList;
|
OptimizedPolyList polyList;
|
||||||
|
|
@ -1135,8 +1135,8 @@ bool GuiShapeEdPreview::getCameraTransform(MatrixF* cameraMatrix)
|
||||||
cameraMatrix->identity();
|
cameraMatrix->identity();
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
Point3F camPos = mModel->getShape()->bounds.getCenter();
|
Point3F camPos = mModel->getShape()->mBounds.getCenter();
|
||||||
F32 offset = mModel->getShape()->bounds.len();
|
F32 offset = mModel->getShape()->mBounds.len();
|
||||||
|
|
||||||
switch (mDisplayType)
|
switch (mDisplayType)
|
||||||
{
|
{
|
||||||
|
|
@ -1166,11 +1166,11 @@ void GuiShapeEdPreview::computeSceneBounds(Box3F& bounds)
|
||||||
void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state)
|
void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state)
|
||||||
{
|
{
|
||||||
// Make sure current detail is valid
|
// Make sure current detail is valid
|
||||||
if ( !mModel->getShape()->details.size() )
|
if ( !mModel->getShape()->mDetails.size() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( mModel->getCurrentDetail() >= mModel->getShape()->details.size() )
|
if ( mModel->getCurrentDetail() >= mModel->getShape()->mDetails.size() )
|
||||||
setCurrentDetail( mModel->getShape()->details.size() - 1 );
|
setCurrentDetail( mModel->getShape()->mDetails.size() - 1 );
|
||||||
|
|
||||||
// Convert between FOV and distance so zoom is consistent between Perspective
|
// Convert between FOV and distance so zoom is consistent between Perspective
|
||||||
// and Orthographic views (conversion factor found by trial and error)
|
// and Orthographic views (conversion factor found by trial and error)
|
||||||
|
|
@ -1193,7 +1193,7 @@ void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state)
|
||||||
setCurrentDetail( 0 );
|
setCurrentDetail( 0 );
|
||||||
|
|
||||||
currentDetail = mModel->getCurrentDetail();
|
currentDetail = mModel->getCurrentDetail();
|
||||||
const TSShape::Detail& det = mModel->getShape()->details[ currentDetail ];
|
const TSShape::Detail& det = mModel->getShape()->mDetails[ currentDetail ];
|
||||||
|
|
||||||
mDetailPolys = det.polyCount;
|
mDetailPolys = det.polyCount;
|
||||||
mDetailSize = det.size;
|
mDetailSize = det.size;
|
||||||
|
|
@ -1213,17 +1213,17 @@ void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state)
|
||||||
{
|
{
|
||||||
Vector<U32> usedMaterials;
|
Vector<U32> usedMaterials;
|
||||||
|
|
||||||
S32 start = mModel->getShape()->subShapeFirstObject[det.subShapeNum];
|
S32 start = mModel->getShape()->mSubShapeFirstObject[det.subShapeNum];
|
||||||
S32 end = start + mModel->getShape()->subShapeNumObjects[det.subShapeNum];
|
S32 end = start + mModel->getShape()->mSubShapeNumObjects[det.subShapeNum];
|
||||||
|
|
||||||
for ( S32 iObj = start; iObj < end; iObj++ )
|
for ( S32 iObj = start; iObj < end; iObj++ )
|
||||||
{
|
{
|
||||||
const TSShape::Object& obj = mModel->getShape()->objects[iObj];
|
const TSShape::Object& obj = mModel->getShape()->mObjects[iObj];
|
||||||
|
|
||||||
if ( obj.numMeshes <= currentDetail )
|
if ( obj.numMeshes <= currentDetail )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const TSMesh* mesh = mModel->getShape()->meshes[ obj.startMeshIndex + currentDetail ];
|
const TSMesh* mesh = mModel->getShape()->mMeshes[ obj.startMeshIndex + currentDetail ];
|
||||||
if ( !mesh )
|
if ( !mesh )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -1262,7 +1262,7 @@ void GuiShapeEdPreview::updateThreads(F32 delta)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Make sure thread priority matches sequence priority (which may have changed)
|
// Make sure thread priority matches sequence priority (which may have changed)
|
||||||
mModel->setPriority( thread.key, mModel->getShape()->sequences[mModel->getSequence( thread.key )].priority );
|
mModel->setPriority( thread.key, mModel->getShape()->mSequences[mModel->getSequence( thread.key )].priority );
|
||||||
|
|
||||||
// Handle ping-pong
|
// Handle ping-pong
|
||||||
if ( thread.pingpong && !mModel->isInTransition( thread.key ) )
|
if ( thread.pingpong && !mModel->isInTransition( thread.key ) )
|
||||||
|
|
@ -1426,18 +1426,18 @@ void GuiShapeEdPreview::renderWorld(const RectI &updateRect)
|
||||||
// Render the shape bounding box
|
// Render the shape bounding box
|
||||||
if ( mRenderBounds )
|
if ( mRenderBounds )
|
||||||
{
|
{
|
||||||
Point3F boxSize = mModel->getShape()->bounds.maxExtents - mModel->getShape()->bounds.minExtents;
|
Point3F boxSize = mModel->getShape()->mBounds.maxExtents - mModel->getShape()->mBounds.minExtents;
|
||||||
|
|
||||||
GFXStateBlockDesc desc;
|
GFXStateBlockDesc desc;
|
||||||
desc.fillMode = GFXFillWireframe;
|
desc.fillMode = GFXFillWireframe;
|
||||||
GFX->getDrawUtil()->drawCube( desc, boxSize, mModel->getShape()->center, ColorF::WHITE );
|
GFX->getDrawUtil()->drawCube( desc, boxSize, mModel->getShape()->mCenter, ColorF::WHITE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the selected object bounding box
|
// Render the selected object bounding box
|
||||||
if ( mRenderObjBox && ( mSelectedObject != -1 ) )
|
if ( mRenderObjBox && ( mSelectedObject != -1 ) )
|
||||||
{
|
{
|
||||||
const TSShape::Object& obj = mModel->getShape()->objects[mSelectedObject];
|
const TSShape::Object& obj = mModel->getShape()->mObjects[mSelectedObject];
|
||||||
const TSMesh* mesh = ( mCurrentDL < obj.numMeshes ) ? mModel->getShape()->meshes[obj.startMeshIndex + mSelectedObjDetail] : NULL;
|
const TSMesh* mesh = ( mCurrentDL < obj.numMeshes ) ? mModel->getShape()->mMeshes[obj.startMeshIndex + mSelectedObjDetail] : NULL;
|
||||||
if ( mesh )
|
if ( mesh )
|
||||||
{
|
{
|
||||||
GFX->pushWorldMatrix();
|
GFX->pushWorldMatrix();
|
||||||
|
|
@ -1528,7 +1528,7 @@ void GuiShapeEdPreview::renderSunDirection() const
|
||||||
{
|
{
|
||||||
// Render four arrows aiming in the direction of the sun's light
|
// Render four arrows aiming in the direction of the sun's light
|
||||||
ColorI color( mFakeSun->getColor() );
|
ColorI color( mFakeSun->getColor() );
|
||||||
F32 length = mModel->getShape()->bounds.len() * 0.8f;
|
F32 length = mModel->getShape()->mBounds.len() * 0.8f;
|
||||||
|
|
||||||
// Get the sun's vectors
|
// Get the sun's vectors
|
||||||
Point3F fwd = mFakeSun->getTransform().getForwardVector();
|
Point3F fwd = mFakeSun->getTransform().getForwardVector();
|
||||||
|
|
@ -1536,8 +1536,8 @@ void GuiShapeEdPreview::renderSunDirection() const
|
||||||
Point3F right = mFakeSun->getTransform().getRightVector() * length / 8;
|
Point3F right = mFakeSun->getTransform().getRightVector() * length / 8;
|
||||||
|
|
||||||
// Calculate the start and end points of the first arrow (bottom left)
|
// Calculate the start and end points of the first arrow (bottom left)
|
||||||
Point3F start = mModel->getShape()->center - fwd * length - up/2 - right/2;
|
Point3F start = mModel->getShape()->mCenter - fwd * length - up/2 - right/2;
|
||||||
Point3F end = mModel->getShape()->center - fwd * length / 3 - up/2 - right/2;
|
Point3F end = mModel->getShape()->mCenter - fwd * length / 3 - up/2 - right/2;
|
||||||
|
|
||||||
GFXStateBlockDesc desc;
|
GFXStateBlockDesc desc;
|
||||||
desc.setZReadWrite( true, true );
|
desc.setZReadWrite( true, true );
|
||||||
|
|
@ -1560,10 +1560,10 @@ void GuiShapeEdPreview::renderNodes() const
|
||||||
GFX->setStateBlockByDesc( desc );
|
GFX->setStateBlockByDesc( desc );
|
||||||
|
|
||||||
PrimBuild::color( ColorI::WHITE );
|
PrimBuild::color( ColorI::WHITE );
|
||||||
PrimBuild::begin( GFXLineList, mModel->getShape()->nodes.size() * 2 );
|
PrimBuild::begin( GFXLineList, mModel->getShape()->mNodes.size() * 2 );
|
||||||
for ( S32 i = 0; i < mModel->getShape()->nodes.size(); i++)
|
for ( S32 i = 0; i < mModel->getShape()->mNodes.size(); i++)
|
||||||
{
|
{
|
||||||
const TSShape::Node& node = mModel->getShape()->nodes[i];
|
const TSShape::Node& node = mModel->getShape()->mNodes[i];
|
||||||
if (node.parentIndex >= 0)
|
if (node.parentIndex >= 0)
|
||||||
{
|
{
|
||||||
Point3F start(mModel->mNodeTransforms[i].getPosition());
|
Point3F start(mModel->mNodeTransforms[i].getPosition());
|
||||||
|
|
@ -1576,7 +1576,7 @@ void GuiShapeEdPreview::renderNodes() const
|
||||||
PrimBuild::end();
|
PrimBuild::end();
|
||||||
|
|
||||||
// Render the node axes
|
// Render the node axes
|
||||||
for ( S32 i = 0; i < mModel->getShape()->nodes.size(); i++)
|
for ( S32 i = 0; i < mModel->getShape()->mNodes.size(); i++)
|
||||||
{
|
{
|
||||||
// Render the selected and hover nodes last (so they are on top)
|
// Render the selected and hover nodes last (so they are on top)
|
||||||
if ( ( i == mSelectedNode ) || ( i == mHoverNode ) )
|
if ( ( i == mSelectedNode ) || ( i == mHoverNode ) )
|
||||||
|
|
@ -1626,7 +1626,7 @@ void GuiShapeEdPreview::renderNodeAxes(S32 index, const ColorF& nodeColor) const
|
||||||
|
|
||||||
void GuiShapeEdPreview::renderNodeName(S32 index, const ColorF& textColor) const
|
void GuiShapeEdPreview::renderNodeName(S32 index, const ColorF& textColor) const
|
||||||
{
|
{
|
||||||
const TSShape::Node& node = mModel->getShape()->nodes[index];
|
const TSShape::Node& node = mModel->getShape()->mNodes[index];
|
||||||
const String& nodeName = mModel->getShape()->getName( node.nameIndex );
|
const String& nodeName = mModel->getShape()->getName( node.nameIndex );
|
||||||
|
|
||||||
Point2I pos( mProjectedNodes[index].x, mProjectedNodes[index].y + sNodeRectSize + 6 );
|
Point2I pos( mProjectedNodes[index].x, mProjectedNodes[index].y + sNodeRectSize + 6 );
|
||||||
|
|
@ -1641,9 +1641,9 @@ void GuiShapeEdPreview::renderCollisionMeshes() const
|
||||||
{
|
{
|
||||||
ConcretePolyList polylist;
|
ConcretePolyList polylist;
|
||||||
polylist.setTransform( &MatrixF::Identity, Point3F::One );
|
polylist.setTransform( &MatrixF::Identity, Point3F::One );
|
||||||
for ( S32 iDet = 0; iDet < mModel->getShape()->details.size(); iDet++ )
|
for ( S32 iDet = 0; iDet < mModel->getShape()->mDetails.size(); iDet++ )
|
||||||
{
|
{
|
||||||
const TSShape::Detail& det = mModel->getShape()->details[iDet];
|
const TSShape::Detail& det = mModel->getShape()->mDetails[iDet];
|
||||||
const String& detName = mModel->getShape()->getName( det.nameIndex );
|
const String& detName = mModel->getShape()->getName( det.nameIndex );
|
||||||
|
|
||||||
// Ignore non-collision details
|
// Ignore non-collision details
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,8 @@ bool BlobShadow::shouldRender(F32 camDist)
|
||||||
if (mShapeBase && mShapeBase->getFadeVal() < TSMesh::VISIBILITY_EPSILON)
|
if (mShapeBase && mShapeBase->getFadeVal() < TSMesh::VISIBILITY_EPSILON)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
F32 shadowLen = 10.0f * mShapeInstance->getShape()->radius;
|
F32 shadowLen = 10.0f * mShapeInstance->getShape()->mRadius;
|
||||||
Point3F pos = mShapeInstance->getShape()->center;
|
Point3F pos = mShapeInstance->getShape()->mCenter;
|
||||||
|
|
||||||
// this is a bit of a hack...move generic shadows towards feet/base of shape
|
// this is a bit of a hack...move generic shadows towards feet/base of shape
|
||||||
pos *= 0.5f;
|
pos *= 0.5f;
|
||||||
|
|
@ -182,7 +182,7 @@ void BlobShadow::setRadius(F32 radius)
|
||||||
|
|
||||||
void BlobShadow::setRadius(TSShapeInstance * shapeInstance, const Point3F & scale)
|
void BlobShadow::setRadius(TSShapeInstance * shapeInstance, const Point3F & scale)
|
||||||
{
|
{
|
||||||
const Box3F & bounds = shapeInstance->getShape()->bounds;
|
const Box3F & bounds = shapeInstance->getShape()->mBounds;
|
||||||
F32 dx = 0.5f * (bounds.maxExtents.x-bounds.minExtents.x) * scale.x;
|
F32 dx = 0.5f * (bounds.maxExtents.x-bounds.minExtents.x) * scale.x;
|
||||||
F32 dy = 0.5f * (bounds.maxExtents.y-bounds.minExtents.y) * scale.y;
|
F32 dy = 0.5f * (bounds.maxExtents.y-bounds.minExtents.y) * scale.y;
|
||||||
F32 dz = 0.5f * (bounds.maxExtents.z-bounds.minExtents.z) * scale.z;
|
F32 dz = 0.5f * (bounds.maxExtents.z-bounds.minExtents.z) * scale.z;
|
||||||
|
|
|
||||||
|
|
@ -359,24 +359,24 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds)
|
||||||
bounds.maxExtents += shapeOffset;
|
bounds.maxExtents += shapeOffset;
|
||||||
|
|
||||||
// Now adjust all positions for root level nodes (nodes with no parent)
|
// Now adjust all positions for root level nodes (nodes with no parent)
|
||||||
for (S32 iNode = 0; iNode < mShape->nodes.size(); iNode++)
|
for (S32 iNode = 0; iNode < mShape->mNodes.size(); iNode++)
|
||||||
{
|
{
|
||||||
if ( !mAppNodes[iNode]->isParentRoot() )
|
if ( !mAppNodes[iNode]->isParentRoot() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Adjust default translation
|
// Adjust default translation
|
||||||
mShape->defaultTranslations[iNode] += shapeOffset;
|
mShape->mDefaultTranslations[iNode] += shapeOffset;
|
||||||
|
|
||||||
// Adjust animated translations
|
// Adjust animated translations
|
||||||
for (S32 iSeq = 0; iSeq < mShape->sequences.size(); iSeq++)
|
for (S32 iSeq = 0; iSeq < mShape->mSequences.size(); iSeq++)
|
||||||
{
|
{
|
||||||
const TSShape::Sequence& seq = mShape->sequences[iSeq];
|
const TSShape::Sequence& seq = mShape->mSequences[iSeq];
|
||||||
if ( seq.translationMatters.test(iNode) )
|
if ( seq.translationMatters.test(iNode) )
|
||||||
{
|
{
|
||||||
for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
|
for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
|
||||||
{
|
{
|
||||||
S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame;
|
S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame;
|
||||||
mShape->nodeTranslations[index] += shapeOffset;
|
mShape->mNodeTranslations[index] += shapeOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu
|
||||||
if (appNode->isBounds())
|
if (appNode->isBounds())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
S32 subShapeNum = mShape->subShapeFirstNode.size()-1;
|
S32 subShapeNum = mShape->mSubShapeFirstNode.size()-1;
|
||||||
Subshape* subshape = mSubShapes[subShapeNum];
|
Subshape* subshape = mSubShapes[subShapeNum];
|
||||||
|
|
||||||
// Check if we should collapse this node
|
// Check if we should collapse this node
|
||||||
|
|
@ -264,19 +264,19 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Check that adding this node will not exceed the maximum node count
|
// Check that adding this node will not exceed the maximum node count
|
||||||
if (mShape->nodes.size() >= MAX_TS_SET_SIZE)
|
if (mShape->mNodes.size() >= MAX_TS_SET_SIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
myIndex = mShape->nodes.size();
|
myIndex = mShape->mNodes.size();
|
||||||
String nodeName = getUniqueName(appNode->getName(), cmpShapeName, mShape->names);
|
String nodeName = getUniqueName(appNode->getName(), cmpShapeName, mShape->mNames);
|
||||||
|
|
||||||
// Create the 3space node
|
// Create the 3space node
|
||||||
mShape->nodes.increment();
|
mShape->mNodes.increment();
|
||||||
mShape->nodes.last().nameIndex = mShape->addName(nodeName);
|
mShape->mNodes.last().nameIndex = mShape->addName(nodeName);
|
||||||
mShape->nodes.last().parentIndex = parentIndex;
|
mShape->mNodes.last().parentIndex = parentIndex;
|
||||||
mShape->nodes.last().firstObject = -1;
|
mShape->mNodes.last().firstObject = -1;
|
||||||
mShape->nodes.last().firstChild = -1;
|
mShape->mNodes.last().firstChild = -1;
|
||||||
mShape->nodes.last().nextSibling = -1;
|
mShape->mNodes.last().nextSibling = -1;
|
||||||
|
|
||||||
// Add the AppNode to a matching list (so AppNodes can be accessed using 3space
|
// Add the AppNode to a matching list (so AppNodes can be accessed using 3space
|
||||||
// node indices)
|
// node indices)
|
||||||
|
|
@ -312,12 +312,12 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu
|
||||||
appNode->getBool("BB::INCLUDE_POLES", includePoles);
|
appNode->getBool("BB::INCLUDE_POLES", includePoles);
|
||||||
|
|
||||||
S32 detIndex = mShape->addDetail( "bbDetail", size, -1 );
|
S32 detIndex = mShape->addDetail( "bbDetail", size, -1 );
|
||||||
mShape->details[detIndex].bbEquatorSteps = numEquatorSteps;
|
mShape->mDetails[detIndex].bbEquatorSteps = numEquatorSteps;
|
||||||
mShape->details[detIndex].bbPolarSteps = numPolarSteps;
|
mShape->mDetails[detIndex].bbPolarSteps = numPolarSteps;
|
||||||
mShape->details[detIndex].bbDetailLevel = dl;
|
mShape->mDetails[detIndex].bbDetailLevel = dl;
|
||||||
mShape->details[detIndex].bbDimension = dim;
|
mShape->mDetails[detIndex].bbDimension = dim;
|
||||||
mShape->details[detIndex].bbIncludePoles = includePoles;
|
mShape->mDetails[detIndex].bbIncludePoles = includePoles;
|
||||||
mShape->details[detIndex].bbPolarAngle = polarAngle;
|
mShape->mDetails[detIndex].bbPolarAngle = polarAngle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -351,15 +351,15 @@ void TSShapeLoader::generateSubshapes()
|
||||||
|
|
||||||
// Recurse through the node hierarchy, adding 3space nodes and
|
// Recurse through the node hierarchy, adding 3space nodes and
|
||||||
// collecting geometry
|
// collecting geometry
|
||||||
S32 firstNode = mShape->nodes.size();
|
S32 firstNode = mShape->mNodes.size();
|
||||||
mShape->subShapeFirstNode.push_back(firstNode);
|
mShape->mSubShapeFirstNode.push_back(firstNode);
|
||||||
|
|
||||||
for (U32 iBranch = 0; iBranch < subshape->branches.size(); iBranch++)
|
for (U32 iBranch = 0; iBranch < subshape->branches.size(); iBranch++)
|
||||||
recurseSubshape(subshape->branches[iBranch], -1, true);
|
recurseSubshape(subshape->branches[iBranch], -1, true);
|
||||||
|
|
||||||
mShape->subShapeNumNodes.push_back(mShape->nodes.size() - firstNode);
|
mShape->mSubShapeNumNodes.push_back(mShape->mNodes.size() - firstNode);
|
||||||
|
|
||||||
if (mShape->nodes.size() >= MAX_TS_SET_SIZE)
|
if (mShape->mNodes.size() >= MAX_TS_SET_SIZE)
|
||||||
{
|
{
|
||||||
Con::warnf("Shape exceeds the maximum node count (%d). Ignoring additional nodes.",
|
Con::warnf("Shape exceeds the maximum node count (%d). Ignoring additional nodes.",
|
||||||
MAX_TS_SET_SIZE);
|
MAX_TS_SET_SIZE);
|
||||||
|
|
@ -389,7 +389,7 @@ void TSShapeLoader::generateObjects()
|
||||||
for (S32 iSub = 0; iSub < mSubShapes.size(); iSub++)
|
for (S32 iSub = 0; iSub < mSubShapes.size(); iSub++)
|
||||||
{
|
{
|
||||||
Subshape* subshape = mSubShapes[iSub];
|
Subshape* subshape = mSubShapes[iSub];
|
||||||
mShape->subShapeFirstObject.push_back(mShape->objects.size());
|
mShape->mSubShapeFirstObject.push_back(mShape->mObjects.size());
|
||||||
|
|
||||||
// Get the names and sizes of the meshes for this subshape
|
// Get the names and sizes of the meshes for this subshape
|
||||||
Vector<String> meshNames;
|
Vector<String> meshNames;
|
||||||
|
|
@ -450,17 +450,17 @@ void TSShapeLoader::generateObjects()
|
||||||
|
|
||||||
if (!lastName || (meshNames[iMesh] != *lastName))
|
if (!lastName || (meshNames[iMesh] != *lastName))
|
||||||
{
|
{
|
||||||
mShape->objects.increment();
|
mShape->mObjects.increment();
|
||||||
mShape->objects.last().nameIndex = mShape->addName(meshNames[iMesh]);
|
mShape->mObjects.last().nameIndex = mShape->addName(meshNames[iMesh]);
|
||||||
mShape->objects.last().nodeIndex = subshape->objNodes[iMesh];
|
mShape->mObjects.last().nodeIndex = subshape->objNodes[iMesh];
|
||||||
mShape->objects.last().startMeshIndex = mAppMeshes.size();
|
mShape->mObjects.last().startMeshIndex = mAppMeshes.size();
|
||||||
mShape->objects.last().numMeshes = 0;
|
mShape->mObjects.last().numMeshes = 0;
|
||||||
lastName = &meshNames[iMesh];
|
lastName = &meshNames[iMesh];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add this mesh to the object
|
// Add this mesh to the object
|
||||||
mAppMeshes.push_back(mesh);
|
mAppMeshes.push_back(mesh);
|
||||||
mShape->objects.last().numMeshes++;
|
mShape->mObjects.last().numMeshes++;
|
||||||
|
|
||||||
// Set mesh flags
|
// Set mesh flags
|
||||||
mesh->mFlags = 0;
|
mesh->mFlags = 0;
|
||||||
|
|
@ -483,9 +483,9 @@ void TSShapeLoader::generateObjects()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to add the detail (will fail if it already exists)
|
// Attempt to add the detail (will fail if it already exists)
|
||||||
S32 oldNumDetails = mShape->details.size();
|
S32 oldNumDetails = mShape->mDetails.size();
|
||||||
mShape->addDetail(detailName, mesh->mDetailSize, iSub);
|
mShape->addDetail(detailName, mesh->mDetailSize, iSub);
|
||||||
if (mShape->details.size() > oldNumDetails)
|
if (mShape->mDetails.size() > oldNumDetails)
|
||||||
{
|
{
|
||||||
Con::warnf("Object mesh \"%s\" has no matching detail (\"%s%d\" has"
|
Con::warnf("Object mesh \"%s\" has no matching detail (\"%s%d\" has"
|
||||||
" been added automatically)", mesh->getName(false), detailName, mesh->mDetailSize);
|
" been added automatically)", mesh->getName(false), detailName, mesh->mDetailSize);
|
||||||
|
|
@ -493,18 +493,18 @@ void TSShapeLoader::generateObjects()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get object count for this subshape
|
// Get object count for this subshape
|
||||||
mShape->subShapeNumObjects.push_back(mShape->objects.size() - mShape->subShapeFirstObject.last());
|
mShape->mSubShapeNumObjects.push_back(mShape->mObjects.size() - mShape->mSubShapeFirstObject.last());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeLoader::generateSkins()
|
void TSShapeLoader::generateSkins()
|
||||||
{
|
{
|
||||||
Vector<AppMesh*> skins;
|
Vector<AppMesh*> skins;
|
||||||
for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++)
|
for (S32 iObject = 0; iObject < mShape->mObjects.size(); iObject++)
|
||||||
{
|
{
|
||||||
for (S32 iMesh = 0; iMesh < mShape->objects[iObject].numMeshes; iMesh++)
|
for (S32 iMesh = 0; iMesh < mShape->mObjects[iObject].numMeshes; iMesh++)
|
||||||
{
|
{
|
||||||
AppMesh* mesh = mAppMeshes[mShape->objects[iObject].startMeshIndex + iMesh];
|
AppMesh* mesh = mAppMeshes[mShape->mObjects[iObject].startMeshIndex + iMesh];
|
||||||
if (mesh->isSkin())
|
if (mesh->isSkin())
|
||||||
skins.push_back(mesh);
|
skins.push_back(mesh);
|
||||||
}
|
}
|
||||||
|
|
@ -551,12 +551,12 @@ void TSShapeLoader::generateSkins()
|
||||||
void TSShapeLoader::generateDefaultStates()
|
void TSShapeLoader::generateDefaultStates()
|
||||||
{
|
{
|
||||||
// Generate default object states (includes initial geometry)
|
// Generate default object states (includes initial geometry)
|
||||||
for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++)
|
for (S32 iObject = 0; iObject < mShape->mObjects.size(); iObject++)
|
||||||
{
|
{
|
||||||
updateProgress(Load_GenerateDefaultStates, "Generating initial mesh and node states...",
|
updateProgress(Load_GenerateDefaultStates, "Generating initial mesh and node states...",
|
||||||
mShape->objects.size(), iObject);
|
mShape->mObjects.size(), iObject);
|
||||||
|
|
||||||
TSShape::Object& obj = mShape->objects[iObject];
|
TSShape::Object& obj = mShape->mObjects[iObject];
|
||||||
|
|
||||||
// Calculate the objectOffset for each mesh at T=0
|
// Calculate the objectOffset for each mesh at T=0
|
||||||
for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++)
|
for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++)
|
||||||
|
|
@ -572,7 +572,7 @@ void TSShapeLoader::generateDefaultStates()
|
||||||
appMesh->mObjectOffset = nodeMat.inverse() * meshMat;
|
appMesh->mObjectOffset = nodeMat.inverse() * meshMat;
|
||||||
}
|
}
|
||||||
|
|
||||||
generateObjectState(mShape->objects[iObject], smDefaultTime, true, true);
|
generateObjectState(mShape->mObjects[iObject], smDefaultTime, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate default node transforms
|
// Generate default node transforms
|
||||||
|
|
@ -591,8 +591,8 @@ void TSShapeLoader::generateDefaultStates()
|
||||||
|
|
||||||
void TSShapeLoader::generateObjectState(TSShape::Object& obj, F32 t, bool addFrame, bool addMatFrame)
|
void TSShapeLoader::generateObjectState(TSShape::Object& obj, F32 t, bool addFrame, bool addMatFrame)
|
||||||
{
|
{
|
||||||
mShape->objectStates.increment();
|
mShape->mObjectStates.increment();
|
||||||
TSShape::ObjectState& state = mShape->objectStates.last();
|
TSShape::ObjectState& state = mShape->mObjectStates.last();
|
||||||
|
|
||||||
state.frameIndex = 0;
|
state.frameIndex = 0;
|
||||||
state.matFrameIndex = 0;
|
state.matFrameIndex = 0;
|
||||||
|
|
@ -689,13 +689,13 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo
|
||||||
void TSShapeLoader::generateMaterialList()
|
void TSShapeLoader::generateMaterialList()
|
||||||
{
|
{
|
||||||
// Install the materials into the material list
|
// Install the materials into the material list
|
||||||
mShape->materialList = new TSMaterialList;
|
mShape->mMaterialList = new TSMaterialList;
|
||||||
for (S32 iMat = 0; iMat < AppMesh::mAppMaterials.size(); iMat++)
|
for (S32 iMat = 0; iMat < AppMesh::mAppMaterials.size(); iMat++)
|
||||||
{
|
{
|
||||||
updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::mAppMaterials.size(), iMat);
|
updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::mAppMaterials.size(), iMat);
|
||||||
|
|
||||||
AppMaterial* appMat = AppMesh::mAppMaterials[iMat];
|
AppMaterial* appMat = AppMesh::mAppMaterials[iMat];
|
||||||
mShape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance());
|
mShape->mMaterialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -712,8 +712,8 @@ void TSShapeLoader::generateSequences()
|
||||||
// Initialize the sequence
|
// Initialize the sequence
|
||||||
mAppSequences[iSeq]->setActive(true);
|
mAppSequences[iSeq]->setActive(true);
|
||||||
|
|
||||||
mShape->sequences.increment();
|
mShape->mSequences.increment();
|
||||||
TSShape::Sequence& seq = mShape->sequences.last();
|
TSShape::Sequence& seq = mShape->mSequences.last();
|
||||||
|
|
||||||
seq.nameIndex = mShape->addName(mAppSequences[iSeq]->getName());
|
seq.nameIndex = mShape->addName(mAppSequences[iSeq]->getName());
|
||||||
seq.toolBegin = mAppSequences[iSeq]->getStart();
|
seq.toolBegin = mAppSequences[iSeq]->getStart();
|
||||||
|
|
@ -788,7 +788,7 @@ void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq)
|
||||||
// Check if any of the node rotations are different to
|
// Check if any of the node rotations are different to
|
||||||
// the default rotation
|
// the default rotation
|
||||||
QuatF defaultRot;
|
QuatF defaultRot;
|
||||||
mShape->defaultRotations[iNode].getQuatF(&defaultRot);
|
mShape->mDefaultRotations[iNode].getQuatF(&defaultRot);
|
||||||
|
|
||||||
for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
|
for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
|
||||||
{
|
{
|
||||||
|
|
@ -807,7 +807,7 @@ void TSShapeLoader::setTranslationMembership(TSShape::Sequence& seq)
|
||||||
{
|
{
|
||||||
// Check if any of the node translations are different to
|
// Check if any of the node translations are different to
|
||||||
// the default translation
|
// the default translation
|
||||||
Point3F& defaultTrans = mShape->defaultTranslations[iNode];
|
Point3F& defaultTrans = mShape->mDefaultTranslations[iNode];
|
||||||
|
|
||||||
for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
|
for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
|
||||||
{
|
{
|
||||||
|
|
@ -865,12 +865,12 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc
|
||||||
seq.frameMatters.clearAll(); // vert animation (morph) (size = objects.size())
|
seq.frameMatters.clearAll(); // vert animation (morph) (size = objects.size())
|
||||||
seq.matFrameMatters.clearAll(); // UV animation (size = objects.size())
|
seq.matFrameMatters.clearAll(); // UV animation (size = objects.size())
|
||||||
|
|
||||||
for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++)
|
for (S32 iObject = 0; iObject < mShape->mObjects.size(); iObject++)
|
||||||
{
|
{
|
||||||
if (!mAppMeshes[mShape->objects[iObject].startMeshIndex])
|
if (!mAppMeshes[mShape->mObjects[iObject].startMeshIndex])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mAppMeshes[mShape->objects[iObject].startMeshIndex]->animatesVis(appSeq))
|
if (mAppMeshes[mShape->mObjects[iObject].startMeshIndex]->animatesVis(appSeq))
|
||||||
seq.visMatters.set(iObject);
|
seq.visMatters.set(iObject);
|
||||||
// Morph and UV animation has been deprecated
|
// Morph and UV animation has been deprecated
|
||||||
//if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesFrame(appSeq))
|
//if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesFrame(appSeq))
|
||||||
|
|
@ -934,44 +934,44 @@ void TSShapeLoader::addNodeRotation(QuatF& rot, bool defaultVal)
|
||||||
rot16.set(rot);
|
rot16.set(rot);
|
||||||
|
|
||||||
if (!defaultVal)
|
if (!defaultVal)
|
||||||
mShape->nodeRotations.push_back(rot16);
|
mShape->mNodeRotations.push_back(rot16);
|
||||||
else
|
else
|
||||||
mShape->defaultRotations.push_back(rot16);
|
mShape->mDefaultRotations.push_back(rot16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeLoader::addNodeTranslation(Point3F& trans, bool defaultVal)
|
void TSShapeLoader::addNodeTranslation(Point3F& trans, bool defaultVal)
|
||||||
{
|
{
|
||||||
if (!defaultVal)
|
if (!defaultVal)
|
||||||
mShape->nodeTranslations.push_back(trans);
|
mShape->mNodeTranslations.push_back(trans);
|
||||||
else
|
else
|
||||||
mShape->defaultTranslations.push_back(trans);
|
mShape->mDefaultTranslations.push_back(trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeLoader::addNodeUniformScale(F32 scale)
|
void TSShapeLoader::addNodeUniformScale(F32 scale)
|
||||||
{
|
{
|
||||||
mShape->nodeUniformScales.push_back(scale);
|
mShape->mNodeUniformScales.push_back(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeLoader::addNodeAlignedScale(Point3F& scale)
|
void TSShapeLoader::addNodeAlignedScale(Point3F& scale)
|
||||||
{
|
{
|
||||||
mShape->nodeAlignedScales.push_back(scale);
|
mShape->mNodeAlignedScales.push_back(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeLoader::addNodeArbitraryScale(QuatF& qrot, Point3F& scale)
|
void TSShapeLoader::addNodeArbitraryScale(QuatF& qrot, Point3F& scale)
|
||||||
{
|
{
|
||||||
Quat16 rot16;
|
Quat16 rot16;
|
||||||
rot16.set(qrot);
|
rot16.set(qrot);
|
||||||
mShape->nodeArbitraryScaleRots.push_back(rot16);
|
mShape->mNodeArbitraryScaleRots.push_back(rot16);
|
||||||
mShape->nodeArbitraryScaleFactors.push_back(scale);
|
mShape->mNodeArbitraryScaleFactors.push_back(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq)
|
void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq)
|
||||||
{
|
{
|
||||||
seq.baseRotation = mShape->nodeRotations.size();
|
seq.baseRotation = mShape->mNodeRotations.size();
|
||||||
seq.baseTranslation = mShape->nodeTranslations.size();
|
seq.baseTranslation = mShape->mNodeTranslations.size();
|
||||||
seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? mShape->nodeArbitraryScaleRots.size() :
|
seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? mShape->mNodeArbitraryScaleRots.size() :
|
||||||
(seq.flags & TSShape::AlignedScale) ? mShape->nodeAlignedScales.size() :
|
(seq.flags & TSShape::AlignedScale) ? mShape->mNodeAlignedScales.size() :
|
||||||
mShape->nodeUniformScales.size();
|
mShape->mNodeUniformScales.size();
|
||||||
|
|
||||||
for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++)
|
for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++)
|
||||||
{
|
{
|
||||||
|
|
@ -999,9 +999,9 @@ void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq)
|
||||||
|
|
||||||
void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSequence* appSeq)
|
void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSequence* appSeq)
|
||||||
{
|
{
|
||||||
seq.baseObjectState = mShape->objectStates.size();
|
seq.baseObjectState = mShape->mObjectStates.size();
|
||||||
|
|
||||||
for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++)
|
for (S32 iObject = 0; iObject < mShape->mObjects.size(); iObject++)
|
||||||
{
|
{
|
||||||
bool visMatters = seq.visMatters.test(iObject);
|
bool visMatters = seq.visMatters.test(iObject);
|
||||||
bool frameMatters = seq.frameMatters.test(iObject);
|
bool frameMatters = seq.frameMatters.test(iObject);
|
||||||
|
|
@ -1012,7 +1012,7 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq
|
||||||
for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
|
for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
|
||||||
{
|
{
|
||||||
F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1);
|
F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1);
|
||||||
generateObjectState(mShape->objects[iObject], time, frameMatters, matFrameMatters);
|
generateObjectState(mShape->mObjects[iObject], time, frameMatters, matFrameMatters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1020,7 +1020,7 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq
|
||||||
|
|
||||||
void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSequence* appSeq)
|
void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSequence* appSeq)
|
||||||
{
|
{
|
||||||
seq.firstGroundFrame = mShape->groundTranslations.size();
|
seq.firstGroundFrame = mShape->mGroundTranslations.size();
|
||||||
seq.numGroundFrames = 0;
|
seq.numGroundFrames = 0;
|
||||||
|
|
||||||
if (!mBoundsNode)
|
if (!mBoundsNode)
|
||||||
|
|
@ -1048,15 +1048,15 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq
|
||||||
// Add ground transform
|
// Add ground transform
|
||||||
Quat16 rotation;
|
Quat16 rotation;
|
||||||
rotation.set(QuatF(mat));
|
rotation.set(QuatF(mat));
|
||||||
mShape->groundTranslations.push_back(mat.getPosition());
|
mShape->mGroundTranslations.push_back(mat.getPosition());
|
||||||
mShape->groundRotations.push_back(rotation);
|
mShape->mGroundRotations.push_back(rotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSequence* appSeq)
|
void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSequence* appSeq)
|
||||||
{
|
{
|
||||||
// Initialize triggers
|
// Initialize triggers
|
||||||
seq.firstTrigger = mShape->triggers.size();
|
seq.firstTrigger = mShape->mTriggers.size();
|
||||||
seq.numTriggers = appSeq->getNumTriggers();
|
seq.numTriggers = appSeq->getNumTriggers();
|
||||||
if (!seq.numTriggers)
|
if (!seq.numTriggers)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1066,8 +1066,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque
|
||||||
// Add triggers
|
// Add triggers
|
||||||
for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++)
|
for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++)
|
||||||
{
|
{
|
||||||
mShape->triggers.increment();
|
mShape->mTriggers.increment();
|
||||||
appSeq->getTrigger(iTrigger, mShape->triggers.last());
|
appSeq->getTrigger(iTrigger, mShape->mTriggers.last());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Track the triggers that get turned off by this shape...normally, triggers
|
// Track the triggers that get turned off by this shape...normally, triggers
|
||||||
|
|
@ -1077,7 +1077,7 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque
|
||||||
U32 offTriggers = 0;
|
U32 offTriggers = 0;
|
||||||
for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++)
|
for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++)
|
||||||
{
|
{
|
||||||
U32 state = mShape->triggers[seq.firstTrigger+iTrigger].state;
|
U32 state = mShape->mTriggers[seq.firstTrigger+iTrigger].state;
|
||||||
if ((state & TSShape::Trigger::StateOn) == 0)
|
if ((state & TSShape::Trigger::StateOn) == 0)
|
||||||
offTriggers |= (state & TSShape::Trigger::StateMask);
|
offTriggers |= (state & TSShape::Trigger::StateMask);
|
||||||
}
|
}
|
||||||
|
|
@ -1085,8 +1085,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque
|
||||||
// We now know which states are turned off, set invert on all those (including when turned on)
|
// We now know which states are turned off, set invert on all those (including when turned on)
|
||||||
for (int iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++)
|
for (int iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++)
|
||||||
{
|
{
|
||||||
if (mShape->triggers[seq.firstTrigger + iTrigger].state & offTriggers)
|
if (mShape->mTriggers[seq.firstTrigger + iTrigger].state & offTriggers)
|
||||||
mShape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse;
|
mShape->mTriggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1105,29 +1105,29 @@ void TSShapeLoader::sortDetails()
|
||||||
|
|
||||||
for (S32 iDet = 0; iDet < validDetails.size(); iDet++)
|
for (S32 iDet = 0; iDet < validDetails.size(); iDet++)
|
||||||
{
|
{
|
||||||
TSShape::Detail &detail = mShape->details[validDetails[iDet]];
|
TSShape::Detail &detail = mShape->mDetails[validDetails[iDet]];
|
||||||
if (detail.subShapeNum >= 0)
|
if (detail.subShapeNum >= 0)
|
||||||
detail.objectDetailNum = iDet;
|
detail.objectDetailNum = iDet;
|
||||||
|
|
||||||
for (S32 iObj = mShape->subShapeFirstObject[iSub];
|
for (S32 iObj = mShape->mSubShapeFirstObject[iSub];
|
||||||
iObj < (mShape->subShapeFirstObject[iSub] + mShape->subShapeNumObjects[iSub]);
|
iObj < (mShape->mSubShapeFirstObject[iSub] + mShape->mSubShapeNumObjects[iSub]);
|
||||||
iObj++)
|
iObj++)
|
||||||
{
|
{
|
||||||
TSShape::Object &object = mShape->objects[iObj];
|
TSShape::Object &object = mShape->mObjects[iObj];
|
||||||
|
|
||||||
// Insert a NULL mesh for this detail level if required (ie. if the
|
// Insert a NULL mesh for this detail level if required (ie. if the
|
||||||
// object does not already have a mesh with an equal or higher detail)
|
// object does not already have a mesh with an equal or higher detail)
|
||||||
S32 meshIndex = (iDet < object.numMeshes) ? iDet : object.numMeshes-1;
|
S32 meshIndex = (iDet < object.numMeshes) ? iDet : object.numMeshes-1;
|
||||||
|
|
||||||
if (mAppMeshes[object.startMeshIndex + meshIndex]->mDetailSize < mShape->details[iDet].size)
|
if (mAppMeshes[object.startMeshIndex + meshIndex]->mDetailSize < mShape->mDetails[iDet].size)
|
||||||
{
|
{
|
||||||
// Add a NULL mesh
|
// Add a NULL mesh
|
||||||
mAppMeshes.insert(object.startMeshIndex + iDet, NULL);
|
mAppMeshes.insert(object.startMeshIndex + iDet, NULL);
|
||||||
object.numMeshes++;
|
object.numMeshes++;
|
||||||
|
|
||||||
// Fixup the start index for the other objects
|
// Fixup the start index for the other objects
|
||||||
for (S32 k = iObj+1; k < mShape->objects.size(); k++)
|
for (S32 k = iObj+1; k < mShape->mObjects.size(); k++)
|
||||||
mShape->objects[k].startMeshIndex++;
|
mShape->mObjects[k].startMeshIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1142,20 +1142,20 @@ void TSShapeLoader::install()
|
||||||
{
|
{
|
||||||
// Arrays that are filled in by ts shape init, but need
|
// Arrays that are filled in by ts shape init, but need
|
||||||
// to be allocated beforehand.
|
// to be allocated beforehand.
|
||||||
mShape->subShapeFirstTranslucentObject.setSize(mShape->subShapeFirstObject.size());
|
mShape->mSubShapeFirstTranslucentObject.setSize(mShape->mSubShapeFirstObject.size());
|
||||||
|
|
||||||
// Construct TS sub-meshes
|
// Construct TS sub-meshes
|
||||||
mShape->meshes.setSize(mAppMeshes.size());
|
mShape->mMeshes.setSize(mAppMeshes.size());
|
||||||
for (U32 m = 0; m < mAppMeshes.size(); m++)
|
for (U32 m = 0; m < mAppMeshes.size(); m++)
|
||||||
mShape->meshes[m] = mAppMeshes[m] ? mAppMeshes[m]->constructTSMesh() : NULL;
|
mShape->mMeshes[m] = mAppMeshes[m] ? mAppMeshes[m]->constructTSMesh() : NULL;
|
||||||
|
|
||||||
// Remove empty meshes and objects
|
// Remove empty meshes and objects
|
||||||
for (S32 iObj = mShape->objects.size()-1; iObj >= 0; iObj--)
|
for (S32 iObj = mShape->mObjects.size()-1; iObj >= 0; iObj--)
|
||||||
{
|
{
|
||||||
TSShape::Object& obj = mShape->objects[iObj];
|
TSShape::Object& obj = mShape->mObjects[iObj];
|
||||||
for (S32 iMesh = obj.numMeshes-1; iMesh >= 0; iMesh--)
|
for (S32 iMesh = obj.numMeshes-1; iMesh >= 0; iMesh--)
|
||||||
{
|
{
|
||||||
TSMesh *mesh = mShape->meshes[obj.startMeshIndex + iMesh];
|
TSMesh *mesh = mShape->mMeshes[obj.startMeshIndex + iMesh];
|
||||||
|
|
||||||
if (mesh && !mesh->mPrimitives.size())
|
if (mesh && !mesh->mPrimitives.size())
|
||||||
{
|
{
|
||||||
|
|
@ -1171,45 +1171,45 @@ void TSShapeLoader::install()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a dummy object if needed so the shape loads and renders ok
|
// Add a dummy object if needed so the shape loads and renders ok
|
||||||
if (!mShape->details.size())
|
if (!mShape->mDetails.size())
|
||||||
{
|
{
|
||||||
mShape->addDetail("detail", 2, 0);
|
mShape->addDetail("detail", 2, 0);
|
||||||
mShape->subShapeNumObjects.last() = 1;
|
mShape->mSubShapeNumObjects.last() = 1;
|
||||||
|
|
||||||
mShape->meshes.push_back(NULL);
|
mShape->mMeshes.push_back(NULL);
|
||||||
|
|
||||||
mShape->objects.increment();
|
mShape->mObjects.increment();
|
||||||
mShape->objects.last().nameIndex = mShape->addName("dummy");
|
mShape->mObjects.last().nameIndex = mShape->addName("dummy");
|
||||||
mShape->objects.last().nodeIndex = 0;
|
mShape->mObjects.last().nodeIndex = 0;
|
||||||
mShape->objects.last().startMeshIndex = 0;
|
mShape->mObjects.last().startMeshIndex = 0;
|
||||||
mShape->objects.last().numMeshes = 1;
|
mShape->mObjects.last().numMeshes = 1;
|
||||||
|
|
||||||
mShape->objectStates.increment();
|
mShape->mObjectStates.increment();
|
||||||
mShape->objectStates.last().frameIndex = 0;
|
mShape->mObjectStates.last().frameIndex = 0;
|
||||||
mShape->objectStates.last().matFrameIndex = 0;
|
mShape->mObjectStates.last().matFrameIndex = 0;
|
||||||
mShape->objectStates.last().vis = 1.0f;
|
mShape->mObjectStates.last().vis = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update smallest visible detail
|
// Update smallest visible detail
|
||||||
mShape->mSmallestVisibleDL = -1;
|
mShape->mSmallestVisibleDL = -1;
|
||||||
mShape->mSmallestVisibleSize = 999999;
|
mShape->mSmallestVisibleSize = 999999;
|
||||||
for (S32 i = 0; i < mShape->details.size(); i++)
|
for (S32 i = 0; i < mShape->mDetails.size(); i++)
|
||||||
{
|
{
|
||||||
if ((mShape->details[i].size >= 0) &&
|
if ((mShape->mDetails[i].size >= 0) &&
|
||||||
(mShape->details[i].size < mShape->mSmallestVisibleSize))
|
(mShape->mDetails[i].size < mShape->mSmallestVisibleSize))
|
||||||
{
|
{
|
||||||
mShape->mSmallestVisibleDL = i;
|
mShape->mSmallestVisibleDL = i;
|
||||||
mShape->mSmallestVisibleSize = mShape->details[i].size;
|
mShape->mSmallestVisibleSize = mShape->mDetails[i].size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
computeBounds(mShape->bounds);
|
computeBounds(mShape->mBounds);
|
||||||
if (!mShape->bounds.isValidBox())
|
if (!mShape->mBounds.isValidBox())
|
||||||
mShape->bounds = Box3F(1.0f);
|
mShape->mBounds = Box3F(1.0f);
|
||||||
|
|
||||||
mShape->bounds.getCenter(&mShape->center);
|
mShape->mBounds.getCenter(&mShape->mCenter);
|
||||||
mShape->radius = (mShape->bounds.maxExtents - mShape->center).len();
|
mShape->mRadius = (mShape->mBounds.maxExtents - mShape->mCenter).len();
|
||||||
mShape->tubeRadius = mShape->radius;
|
mShape->mTubeRadius = mShape->mRadius;
|
||||||
|
|
||||||
mShape->init();
|
mShape->init();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,14 @@ void TSShapeInstance::sortThreads()
|
||||||
void TSShapeInstance::setDirty(U32 dirty)
|
void TSShapeInstance::setDirty(U32 dirty)
|
||||||
{
|
{
|
||||||
AssertFatal((dirty & AllDirtyMask) == dirty,"TSShapeInstance::setDirty: illegal dirty flags");
|
AssertFatal((dirty & AllDirtyMask) == dirty,"TSShapeInstance::setDirty: illegal dirty flags");
|
||||||
for (S32 i=0; i<mShape->subShapeFirstNode.size(); i++)
|
for (S32 i=0; i<mShape->mSubShapeFirstNode.size(); i++)
|
||||||
mDirtyFlags[i] |= dirty;
|
mDirtyFlags[i] |= dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeInstance::clearDirty(U32 dirty)
|
void TSShapeInstance::clearDirty(U32 dirty)
|
||||||
{
|
{
|
||||||
AssertFatal((dirty & AllDirtyMask) == dirty,"TSShapeInstance::clearDirty: illegal dirty flags");
|
AssertFatal((dirty & AllDirtyMask) == dirty,"TSShapeInstance::clearDirty: illegal dirty flags");
|
||||||
for (S32 i=0; i<mShape->subShapeFirstNode.size(); i++)
|
for (S32 i=0; i<mShape->mSubShapeFirstNode.size(); i++)
|
||||||
mDirtyFlags[i] &= ~dirty;
|
mDirtyFlags[i] &= ~dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,25 +62,25 @@ void TSShapeInstance::animateNodes(S32 ss)
|
||||||
{
|
{
|
||||||
PROFILE_SCOPE( TSShapeInstance_animateNodes );
|
PROFILE_SCOPE( TSShapeInstance_animateNodes );
|
||||||
|
|
||||||
if (!mShape->nodes.size())
|
if (!mShape->mNodes.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// @todo: When a node is added, we need to make sure to resize the nodeTransforms array as well
|
// @todo: When a node is added, we need to make sure to resize the nodeTransforms array as well
|
||||||
mNodeTransforms.setSize(mShape->nodes.size());
|
mNodeTransforms.setSize(mShape->mNodes.size());
|
||||||
|
|
||||||
// temporary storage for node transforms
|
// temporary storage for node transforms
|
||||||
smNodeCurrentRotations.setSize(mShape->nodes.size());
|
smNodeCurrentRotations.setSize(mShape->mNodes.size());
|
||||||
smNodeCurrentTranslations.setSize(mShape->nodes.size());
|
smNodeCurrentTranslations.setSize(mShape->mNodes.size());
|
||||||
smNodeLocalTransforms.setSize(mShape->nodes.size());
|
smNodeLocalTransforms.setSize(mShape->mNodes.size());
|
||||||
smRotationThreads.setSize(mShape->nodes.size());
|
smRotationThreads.setSize(mShape->mNodes.size());
|
||||||
smTranslationThreads.setSize(mShape->nodes.size());
|
smTranslationThreads.setSize(mShape->mNodes.size());
|
||||||
|
|
||||||
TSIntegerSet rotBeenSet;
|
TSIntegerSet rotBeenSet;
|
||||||
TSIntegerSet tranBeenSet;
|
TSIntegerSet tranBeenSet;
|
||||||
TSIntegerSet scaleBeenSet;
|
TSIntegerSet scaleBeenSet;
|
||||||
rotBeenSet.setAll(mShape->nodes.size());
|
rotBeenSet.setAll(mShape->mNodes.size());
|
||||||
tranBeenSet.setAll(mShape->nodes.size());
|
tranBeenSet.setAll(mShape->mNodes.size());
|
||||||
scaleBeenSet.setAll(mShape->nodes.size());
|
scaleBeenSet.setAll(mShape->mNodes.size());
|
||||||
smNodeLocalTransformDirty.clearAll();
|
smNodeLocalTransformDirty.clearAll();
|
||||||
|
|
||||||
S32 i,j,nodeIndex,a,b,start,end,firstBlend = mThreadList.size();
|
S32 i,j,nodeIndex,a,b,start,end,firstBlend = mThreadList.size();
|
||||||
|
|
@ -114,18 +114,18 @@ void TSShapeInstance::animateNodes(S32 ss)
|
||||||
// we'll set default regardless of mask status
|
// we'll set default regardless of mask status
|
||||||
|
|
||||||
// all the nodes marked above need to have the default transform
|
// all the nodes marked above need to have the default transform
|
||||||
a = mShape->subShapeFirstNode[ss];
|
a = mShape->mSubShapeFirstNode[ss];
|
||||||
b = a + mShape->subShapeNumNodes[ss];
|
b = a + mShape->mSubShapeNumNodes[ss];
|
||||||
for (i=a; i<b; i++)
|
for (i=a; i<b; i++)
|
||||||
{
|
{
|
||||||
if (rotBeenSet.test(i))
|
if (rotBeenSet.test(i))
|
||||||
{
|
{
|
||||||
mShape->defaultRotations[i].getQuatF(&smNodeCurrentRotations[i]);
|
mShape->mDefaultRotations[i].getQuatF(&smNodeCurrentRotations[i]);
|
||||||
smRotationThreads[i] = NULL;
|
smRotationThreads[i] = NULL;
|
||||||
}
|
}
|
||||||
if (tranBeenSet.test(i))
|
if (tranBeenSet.test(i))
|
||||||
{
|
{
|
||||||
smNodeCurrentTranslations[i] = mShape->defaultTranslations[i];
|
smNodeCurrentTranslations[i] = mShape->mDefaultTranslations[i];
|
||||||
smTranslationThreads[i] = NULL;
|
smTranslationThreads[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -235,7 +235,7 @@ void TSShapeInstance::animateNodes(S32 ss)
|
||||||
// multiply transforms...
|
// multiply transforms...
|
||||||
for (i=a; i<b; i++)
|
for (i=a; i<b; i++)
|
||||||
{
|
{
|
||||||
S32 parentIdx = mShape->nodes[i].parentIndex;
|
S32 parentIdx = mShape->mNodes[i].parentIndex;
|
||||||
if (parentIdx < 0)
|
if (parentIdx < 0)
|
||||||
mNodeTransforms[i] = smNodeLocalTransforms[i];
|
mNodeTransforms[i] = smNodeLocalTransforms[i];
|
||||||
else
|
else
|
||||||
|
|
@ -248,12 +248,12 @@ void TSShapeInstance::handleDefaultScale(S32 a, S32 b, TSIntegerSet & scaleBeenS
|
||||||
// set default scale values (i.e., identity) and do any initialization
|
// set default scale values (i.e., identity) and do any initialization
|
||||||
// relating to animated scale (since scale normally not animated)
|
// relating to animated scale (since scale normally not animated)
|
||||||
|
|
||||||
smScaleThreads.setSize(mShape->nodes.size());
|
smScaleThreads.setSize(mShape->mNodes.size());
|
||||||
scaleBeenSet.takeAway(mCallbackNodes);
|
scaleBeenSet.takeAway(mCallbackNodes);
|
||||||
scaleBeenSet.takeAway(mHandsOffNodes);
|
scaleBeenSet.takeAway(mHandsOffNodes);
|
||||||
if (animatesUniformScale())
|
if (animatesUniformScale())
|
||||||
{
|
{
|
||||||
smNodeCurrentUniformScales.setSize(mShape->nodes.size());
|
smNodeCurrentUniformScales.setSize(mShape->mNodes.size());
|
||||||
for (S32 i=a; i<b; i++)
|
for (S32 i=a; i<b; i++)
|
||||||
if (scaleBeenSet.test(i))
|
if (scaleBeenSet.test(i))
|
||||||
{
|
{
|
||||||
|
|
@ -263,7 +263,7 @@ void TSShapeInstance::handleDefaultScale(S32 a, S32 b, TSIntegerSet & scaleBeenS
|
||||||
}
|
}
|
||||||
else if (animatesAlignedScale())
|
else if (animatesAlignedScale())
|
||||||
{
|
{
|
||||||
smNodeCurrentAlignedScales.setSize(mShape->nodes.size());
|
smNodeCurrentAlignedScales.setSize(mShape->mNodes.size());
|
||||||
for (S32 i=a; i<b; i++)
|
for (S32 i=a; i<b; i++)
|
||||||
if (scaleBeenSet.test(i))
|
if (scaleBeenSet.test(i))
|
||||||
{
|
{
|
||||||
|
|
@ -273,7 +273,7 @@ void TSShapeInstance::handleDefaultScale(S32 a, S32 b, TSIntegerSet & scaleBeenS
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
smNodeCurrentArbitraryScales.setSize(mShape->nodes.size());
|
smNodeCurrentArbitraryScales.setSize(mShape->mNodes.size());
|
||||||
for (S32 i=a; i<b; i++)
|
for (S32 i=a; i<b; i++)
|
||||||
if (scaleBeenSet.test(i))
|
if (scaleBeenSet.test(i))
|
||||||
{
|
{
|
||||||
|
|
@ -672,12 +672,12 @@ void TSShapeInstance::animateVisibility(S32 ss)
|
||||||
beenSet.takeAway(mThreadList[i]->getSequence()->visMatters);
|
beenSet.takeAway(mThreadList[i]->getSequence()->visMatters);
|
||||||
|
|
||||||
// set defaults
|
// set defaults
|
||||||
S32 a = mShape->subShapeFirstObject[ss];
|
S32 a = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 b = a + mShape->subShapeNumObjects[ss];
|
S32 b = a + mShape->mSubShapeNumObjects[ss];
|
||||||
for (i=a; i<b; i++)
|
for (i=a; i<b; i++)
|
||||||
{
|
{
|
||||||
if (beenSet.test(i))
|
if (beenSet.test(i))
|
||||||
mMeshObjects[i].visible = mShape->objectStates[i].vis;
|
mMeshObjects[i].visible = mShape->mObjectStates[i].vis;
|
||||||
}
|
}
|
||||||
|
|
||||||
// go through each thread and set visibility on those objects that
|
// go through each thread and set visibility on those objects that
|
||||||
|
|
@ -735,11 +735,11 @@ void TSShapeInstance::animateFrame(S32 ss)
|
||||||
beenSet.takeAway(mThreadList[i]->getSequence()->frameMatters);
|
beenSet.takeAway(mThreadList[i]->getSequence()->frameMatters);
|
||||||
|
|
||||||
// set defaults
|
// set defaults
|
||||||
S32 a = mShape->subShapeFirstObject[ss];
|
S32 a = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 b = a + mShape->subShapeNumObjects[ss];
|
S32 b = a + mShape->mSubShapeNumObjects[ss];
|
||||||
for (i=a; i<b; i++)
|
for (i=a; i<b; i++)
|
||||||
if (beenSet.test(i))
|
if (beenSet.test(i))
|
||||||
mMeshObjects[i].frame = mShape->objectStates[i].frameIndex;
|
mMeshObjects[i].frame = mShape->mObjectStates[i].frameIndex;
|
||||||
|
|
||||||
// go through each thread and set frame on those objects that
|
// go through each thread and set frame on those objects that
|
||||||
// are not set yet and are controlled by that thread
|
// are not set yet and are controlled by that thread
|
||||||
|
|
@ -790,11 +790,11 @@ void TSShapeInstance::animateMatFrame(S32 ss)
|
||||||
beenSet.takeAway(mThreadList[i]->getSequence()->matFrameMatters);
|
beenSet.takeAway(mThreadList[i]->getSequence()->matFrameMatters);
|
||||||
|
|
||||||
// set defaults
|
// set defaults
|
||||||
S32 a = mShape->subShapeFirstObject[ss];
|
S32 a = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 b = a + mShape->subShapeNumObjects[ss];
|
S32 b = a + mShape->mSubShapeNumObjects[ss];
|
||||||
for (i=a; i<b; i++)
|
for (i=a; i<b; i++)
|
||||||
if (beenSet.test(i))
|
if (beenSet.test(i))
|
||||||
mMeshObjects[i].matFrame = mShape->objectStates[i].matFrameIndex;
|
mMeshObjects[i].matFrame = mShape->mObjectStates[i].matFrameIndex;
|
||||||
|
|
||||||
// go through each thread and set matFrame on those objects that
|
// go through each thread and set matFrame on those objects that
|
||||||
// are not set yet and are controlled by that thread
|
// are not set yet and are controlled by that thread
|
||||||
|
|
@ -842,7 +842,7 @@ void TSShapeInstance::animate(S32 dl)
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return;
|
return;
|
||||||
|
|
||||||
S32 ss = mShape->details[dl].subShapeNum;
|
S32 ss = mShape->mDetails[dl].subShapeNum;
|
||||||
|
|
||||||
// this is a billboard detail...
|
// this is a billboard detail...
|
||||||
if (ss<0)
|
if (ss<0)
|
||||||
|
|
@ -878,7 +878,7 @@ void TSShapeInstance::animateNodeSubtrees(bool forceFull)
|
||||||
// force transforms to animate
|
// force transforms to animate
|
||||||
setDirty(TransformDirty);
|
setDirty(TransformDirty);
|
||||||
|
|
||||||
for (S32 i=0; i<mShape->subShapeNumNodes.size(); i++)
|
for (S32 i=0; i<mShape->mSubShapeNumNodes.size(); i++)
|
||||||
{
|
{
|
||||||
if (mDirtyFlags[i] & TransformDirty)
|
if (mDirtyFlags[i] & TransformDirty)
|
||||||
{
|
{
|
||||||
|
|
@ -896,7 +896,7 @@ void TSShapeInstance::animateSubtrees(bool forceFull)
|
||||||
// force full animate
|
// force full animate
|
||||||
setDirty(AllDirtyMask);
|
setDirty(AllDirtyMask);
|
||||||
|
|
||||||
for (S32 i=0; i<mShape->subShapeNumNodes.size(); i++)
|
for (S32 i=0; i<mShape->mSubShapeNumNodes.size(); i++)
|
||||||
{
|
{
|
||||||
if (mDirtyFlags[i] & TransformDirty)
|
if (mDirtyFlags[i] & TransformDirty)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,10 @@ bool TSShapeInstance::buildPolyList(AbstractPolyList * polyList, S32 dl)
|
||||||
if (dl==-1)
|
if (dl==-1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AssertFatal(dl>=0 && dl<mShape->details.size(),"TSShapeInstance::buildPolyList");
|
AssertFatal(dl>=0 && dl<mShape->mDetails.size(),"TSShapeInstance::buildPolyList");
|
||||||
|
|
||||||
// get subshape and object detail
|
// get subshape and object detail
|
||||||
const TSDetail * detail = &mShape->details[dl];
|
const TSDetail * detail = &mShape->mDetails[dl];
|
||||||
S32 ss = detail->subShapeNum;
|
S32 ss = detail->subShapeNum;
|
||||||
S32 od = detail->objectDetailNum;
|
S32 od = detail->objectDetailNum;
|
||||||
|
|
||||||
|
|
@ -67,8 +67,8 @@ bool TSShapeInstance::buildPolyList(AbstractPolyList * polyList, S32 dl)
|
||||||
bool emitted = false;
|
bool emitted = false;
|
||||||
U32 surfaceKey = 0;
|
U32 surfaceKey = 0;
|
||||||
|
|
||||||
S32 start = mShape->subShapeFirstObject[ss];
|
S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = mShape->subShapeNumObjects[ss] + start;
|
S32 end = mShape->mSubShapeNumObjects[ss] + start;
|
||||||
if (start<end)
|
if (start<end)
|
||||||
{
|
{
|
||||||
MatrixF initialMat;
|
MatrixF initialMat;
|
||||||
|
|
@ -124,10 +124,10 @@ bool TSShapeInstance::getFeatures(const MatrixF& mat, const Point3F& n, ConvexFe
|
||||||
if (dl==-1)
|
if (dl==-1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AssertFatal(dl>=0 && dl<mShape->details.size(),"TSShapeInstance::buildPolyList");
|
AssertFatal(dl>=0 && dl<mShape->mDetails.size(),"TSShapeInstance::buildPolyList");
|
||||||
|
|
||||||
// get subshape and object detail
|
// get subshape and object detail
|
||||||
const TSDetail * detail = &mShape->details[dl];
|
const TSDetail * detail = &mShape->mDetails[dl];
|
||||||
S32 ss = detail->subShapeNum;
|
S32 ss = detail->subShapeNum;
|
||||||
S32 od = detail->objectDetailNum;
|
S32 od = detail->objectDetailNum;
|
||||||
|
|
||||||
|
|
@ -135,8 +135,8 @@ bool TSShapeInstance::getFeatures(const MatrixF& mat, const Point3F& n, ConvexFe
|
||||||
bool emitted = false;
|
bool emitted = false;
|
||||||
U32 surfaceKey = 0;
|
U32 surfaceKey = 0;
|
||||||
|
|
||||||
S32 start = mShape->subShapeFirstObject[ss];
|
S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = mShape->subShapeNumObjects[ss] + start;
|
S32 end = mShape->mSubShapeNumObjects[ss] + start;
|
||||||
if (start<end)
|
if (start<end)
|
||||||
{
|
{
|
||||||
MatrixF final;
|
MatrixF final;
|
||||||
|
|
@ -168,10 +168,10 @@ bool TSShapeInstance::castRay(const Point3F & a, const Point3F & b, RayInfo * ra
|
||||||
if (dl==-1)
|
if (dl==-1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AssertFatal(dl>=0 && dl<mShape->details.size(),"TSShapeInstance::castRay");
|
AssertFatal(dl>=0 && dl<mShape->mDetails.size(),"TSShapeInstance::castRay");
|
||||||
|
|
||||||
// get subshape and object detail
|
// get subshape and object detail
|
||||||
const TSDetail * detail = &mShape->details[dl];
|
const TSDetail * detail = &mShape->mDetails[dl];
|
||||||
S32 ss = detail->subShapeNum;
|
S32 ss = detail->subShapeNum;
|
||||||
S32 od = detail->objectDetailNum;
|
S32 od = detail->objectDetailNum;
|
||||||
|
|
||||||
|
|
@ -179,8 +179,8 @@ bool TSShapeInstance::castRay(const Point3F & a, const Point3F & b, RayInfo * ra
|
||||||
if ( ss < 0 )
|
if ( ss < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
S32 start = mShape->subShapeFirstObject[ss];
|
S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = mShape->subShapeNumObjects[ss] + start;
|
S32 end = mShape->mSubShapeNumObjects[ss] + start;
|
||||||
RayInfo saveRay;
|
RayInfo saveRay;
|
||||||
saveRay.t = 1.0f;
|
saveRay.t = 1.0f;
|
||||||
const MatrixF * saveMat = NULL;
|
const MatrixF * saveMat = NULL;
|
||||||
|
|
@ -255,18 +255,18 @@ bool TSShapeInstance::castRayRendered(const Point3F & a, const Point3F & b, RayI
|
||||||
if (dl==-1)
|
if (dl==-1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AssertFatal(dl>=0 && dl<mShape->details.size(),"TSShapeInstance::castRayRendered");
|
AssertFatal(dl>=0 && dl<mShape->mDetails.size(),"TSShapeInstance::castRayRendered");
|
||||||
|
|
||||||
// get subshape and object detail
|
// get subshape and object detail
|
||||||
const TSDetail * detail = &mShape->details[dl];
|
const TSDetail * detail = &mShape->mDetails[dl];
|
||||||
S32 ss = detail->subShapeNum;
|
S32 ss = detail->subShapeNum;
|
||||||
S32 od = detail->objectDetailNum;
|
S32 od = detail->objectDetailNum;
|
||||||
|
|
||||||
if ( ss == -1 )
|
if ( ss == -1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
S32 start = mShape->subShapeFirstObject[ss];
|
S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = mShape->subShapeNumObjects[ss] + start;
|
S32 end = mShape->mSubShapeNumObjects[ss] + start;
|
||||||
RayInfo saveRay;
|
RayInfo saveRay;
|
||||||
saveRay.t = 1.0f;
|
saveRay.t = 1.0f;
|
||||||
const MatrixF * saveMat = NULL;
|
const MatrixF * saveMat = NULL;
|
||||||
|
|
@ -339,15 +339,15 @@ Point3F TSShapeInstance::support(const Point3F & v, S32 dl)
|
||||||
{
|
{
|
||||||
// if dl==-1, nothing to do
|
// if dl==-1, nothing to do
|
||||||
AssertFatal(dl != -1, "Error, should never try to collide with a non-existant detail level!");
|
AssertFatal(dl != -1, "Error, should never try to collide with a non-existant detail level!");
|
||||||
AssertFatal(dl>=0 && dl<mShape->details.size(),"TSShapeInstance::support");
|
AssertFatal(dl>=0 && dl<mShape->mDetails.size(),"TSShapeInstance::support");
|
||||||
|
|
||||||
// get subshape and object detail
|
// get subshape and object detail
|
||||||
const TSDetail * detail = &mShape->details[dl];
|
const TSDetail * detail = &mShape->mDetails[dl];
|
||||||
S32 ss = detail->subShapeNum;
|
S32 ss = detail->subShapeNum;
|
||||||
S32 od = detail->objectDetailNum;
|
S32 od = detail->objectDetailNum;
|
||||||
|
|
||||||
S32 start = mShape->subShapeFirstObject[ss];
|
S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = mShape->subShapeNumObjects[ss] + start;
|
S32 end = mShape->mSubShapeNumObjects[ss] + start;
|
||||||
|
|
||||||
F32 currMaxDP = -1e9f;
|
F32 currMaxDP = -1e9f;
|
||||||
Point3F currSupport = Point3F(0, 0, 0);
|
Point3F currSupport = Point3F(0, 0, 0);
|
||||||
|
|
@ -404,22 +404,22 @@ void TSShapeInstance::computeBounds(S32 dl, Box3F & bounds)
|
||||||
if (dl==-1)
|
if (dl==-1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AssertFatal(dl>=0 && dl<mShape->details.size(),"TSShapeInstance::computeBounds");
|
AssertFatal(dl>=0 && dl<mShape->mDetails.size(),"TSShapeInstance::computeBounds");
|
||||||
|
|
||||||
// get subshape and object detail
|
// get subshape and object detail
|
||||||
const TSDetail * detail = &mShape->details[dl];
|
const TSDetail * detail = &mShape->mDetails[dl];
|
||||||
S32 ss = detail->subShapeNum;
|
S32 ss = detail->subShapeNum;
|
||||||
S32 od = detail->objectDetailNum;
|
S32 od = detail->objectDetailNum;
|
||||||
|
|
||||||
// use shape bounds for imposter details
|
// use shape bounds for imposter details
|
||||||
if (ss < 0)
|
if (ss < 0)
|
||||||
{
|
{
|
||||||
bounds = mShape->bounds;
|
bounds = mShape->mBounds;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 start = mShape->subShapeFirstObject[ss];
|
S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = mShape->subShapeNumObjects[ss] + start;
|
S32 end = mShape->mSubShapeNumObjects[ss] + start;
|
||||||
|
|
||||||
// run through objects and updating bounds as we go
|
// run through objects and updating bounds as we go
|
||||||
bounds.minExtents.set( 10E30f, 10E30f, 10E30f);
|
bounds.minExtents.set( 10E30f, 10E30f, 10E30f);
|
||||||
|
|
@ -587,10 +587,10 @@ bool TSShapeInstance::buildPolyListOpcode( S32 dl, AbstractPolyList *polyList, c
|
||||||
if (dl==-1)
|
if (dl==-1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AssertFatal(dl>=0 && dl<mShape->details.size(),"TSShapeInstance::buildPolyListOpcode");
|
AssertFatal(dl>=0 && dl<mShape->mDetails.size(),"TSShapeInstance::buildPolyListOpcode");
|
||||||
|
|
||||||
// get subshape and object detail
|
// get subshape and object detail
|
||||||
const TSDetail * detail = &mShape->details[dl];
|
const TSDetail * detail = &mShape->mDetails[dl];
|
||||||
S32 ss = detail->subShapeNum;
|
S32 ss = detail->subShapeNum;
|
||||||
if ( ss < 0 )
|
if ( ss < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -600,8 +600,8 @@ bool TSShapeInstance::buildPolyListOpcode( S32 dl, AbstractPolyList *polyList, c
|
||||||
// nothing emitted yet...
|
// nothing emitted yet...
|
||||||
bool emitted = false;
|
bool emitted = false;
|
||||||
|
|
||||||
S32 start = mShape->subShapeFirstObject[ss];
|
S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = mShape->subShapeNumObjects[ss] + start;
|
S32 end = mShape->mSubShapeNumObjects[ss] + start;
|
||||||
if (start<end)
|
if (start<end)
|
||||||
{
|
{
|
||||||
MatrixF initialMat;
|
MatrixF initialMat;
|
||||||
|
|
@ -670,12 +670,12 @@ bool TSShapeInstance::castRayOpcode( S32 dl, const Point3F & startPos, const Poi
|
||||||
if (dl==-1)
|
if (dl==-1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AssertFatal(dl>=0 && dl<mShape->details.size(),"TSShapeInstance::castRayOpcode");
|
AssertFatal(dl>=0 && dl<mShape->mDetails.size(),"TSShapeInstance::castRayOpcode");
|
||||||
|
|
||||||
info->t = 100.f;
|
info->t = 100.f;
|
||||||
|
|
||||||
// get subshape and object detail
|
// get subshape and object detail
|
||||||
const TSDetail * detail = &mShape->details[dl];
|
const TSDetail * detail = &mShape->mDetails[dl];
|
||||||
S32 ss = detail->subShapeNum;
|
S32 ss = detail->subShapeNum;
|
||||||
if ( ss < 0 )
|
if ( ss < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -686,8 +686,8 @@ bool TSShapeInstance::castRayOpcode( S32 dl, const Point3F & startPos, const Poi
|
||||||
bool emitted = false;
|
bool emitted = false;
|
||||||
|
|
||||||
const MatrixF* saveMat = NULL;
|
const MatrixF* saveMat = NULL;
|
||||||
S32 start = mShape->subShapeFirstObject[ss];
|
S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = mShape->subShapeNumObjects[ss] + start;
|
S32 end = mShape->mSubShapeNumObjects[ss] + start;
|
||||||
if (start<end)
|
if (start<end)
|
||||||
{
|
{
|
||||||
MatrixF mat;
|
MatrixF mat;
|
||||||
|
|
@ -742,18 +742,18 @@ bool TSShapeInstance::castRayOpcode( S32 dl, const Point3F & startPos, const Poi
|
||||||
|
|
||||||
bool TSShapeInstance::buildConvexOpcode( const MatrixF &objMat, const Point3F &objScale, S32 dl, const Box3F &bounds, Convex *c, Convex *list )
|
bool TSShapeInstance::buildConvexOpcode( const MatrixF &objMat, const Point3F &objScale, S32 dl, const Box3F &bounds, Convex *c, Convex *list )
|
||||||
{
|
{
|
||||||
AssertFatal(dl>=0 && dl<mShape->details.size(),"TSShapeInstance::buildConvexOpcode");
|
AssertFatal(dl>=0 && dl<mShape->mDetails.size(),"TSShapeInstance::buildConvexOpcode");
|
||||||
|
|
||||||
// get subshape and object detail
|
// get subshape and object detail
|
||||||
const TSDetail * detail = &mShape->details[dl];
|
const TSDetail * detail = &mShape->mDetails[dl];
|
||||||
S32 ss = detail->subShapeNum;
|
S32 ss = detail->subShapeNum;
|
||||||
S32 od = detail->objectDetailNum;
|
S32 od = detail->objectDetailNum;
|
||||||
|
|
||||||
// nothing emitted yet...
|
// nothing emitted yet...
|
||||||
bool emitted = false;
|
bool emitted = false;
|
||||||
|
|
||||||
S32 start = mShape->subShapeFirstObject[ss];
|
S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = mShape->subShapeNumObjects[ss] + start;
|
S32 end = mShape->mSubShapeNumObjects[ss] + start;
|
||||||
if (start<end)
|
if (start<end)
|
||||||
{
|
{
|
||||||
MatrixF initialMat = objMat;
|
MatrixF initialMat = objMat;
|
||||||
|
|
@ -823,10 +823,10 @@ void TSShape::findColDetails( bool useVisibleMesh, Vector<S32> *outDetails, Vect
|
||||||
U32 highestDetail = -1;
|
U32 highestDetail = -1;
|
||||||
F32 highestSize = -F32_MAX;
|
F32 highestSize = -F32_MAX;
|
||||||
|
|
||||||
for ( U32 i = 0; i < details.size(); i++ )
|
for ( U32 i = 0; i < mDetails.size(); i++ )
|
||||||
{
|
{
|
||||||
// Make sure we skip any details that shouldn't be rendered
|
// Make sure we skip any details that shouldn't be rendered
|
||||||
if ( details[i].size < 0 )
|
if ( mDetails[i].size < 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -838,10 +838,10 @@ void TSShape::findColDetails( bool useVisibleMesh, Vector<S32> *outDetails, Vect
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Otherwise test against the current highest size
|
// Otherwise test against the current highest size
|
||||||
if ( details[i].size > highestSize )
|
if ( mDetails[i].size > highestSize )
|
||||||
{
|
{
|
||||||
highestDetail = i;
|
highestDetail = i;
|
||||||
highestSize = details[i].size;
|
highestSize = mDetails[i].size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -861,9 +861,9 @@ void TSShape::findColDetails( bool useVisibleMesh, Vector<S32> *outDetails, Vect
|
||||||
//
|
//
|
||||||
// The LOS (light of sight) details are used for raycasts.
|
// The LOS (light of sight) details are used for raycasts.
|
||||||
|
|
||||||
for ( U32 i = 0; i < details.size(); i++ )
|
for ( U32 i = 0; i < mDetails.size(); i++ )
|
||||||
{
|
{
|
||||||
const String &name = names[ details[i].nameIndex ];
|
const String &name = mNames[ mDetails[i].nameIndex ];
|
||||||
if ( !dStrStartsWith( name, "Collision" ) )
|
if ( !dStrStartsWith( name, "Collision" ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -906,9 +906,9 @@ void TSShape::findColDetails( bool useVisibleMesh, Vector<S32> *outDetails, Vect
|
||||||
|
|
||||||
// Snag any "unmatched" LOS details and put
|
// Snag any "unmatched" LOS details and put
|
||||||
// them at the end of the list.
|
// them at the end of the list.
|
||||||
for ( U32 i = 0; i < details.size(); i++ )
|
for ( U32 i = 0; i < mDetails.size(); i++ )
|
||||||
{
|
{
|
||||||
const String &name = names[ details[i].nameIndex ];
|
const String &name = mNames[ mDetails[i].nameIndex ];
|
||||||
if ( !dStrStartsWith( name, "LOS" ) )
|
if ( !dStrStartsWith( name, "LOS" ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -954,7 +954,7 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F &
|
||||||
// visible detail levels.
|
// visible detail levels.
|
||||||
|
|
||||||
// A negative subshape on the detail means we don't have geometry.
|
// A negative subshape on the detail means we don't have geometry.
|
||||||
const TSShape::Detail &detail = details[0];
|
const TSShape::Detail &detail = mDetails[0];
|
||||||
if ( detail.subShapeNum < 0 )
|
if ( detail.subShapeNum < 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -964,16 +964,16 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F &
|
||||||
polyList.setTransform( &MatrixF::Identity, scale );
|
polyList.setTransform( &MatrixF::Identity, scale );
|
||||||
|
|
||||||
// Create the collision meshes.
|
// Create the collision meshes.
|
||||||
S32 start = subShapeFirstObject[ detail.subShapeNum ];
|
S32 start = mSubShapeFirstObject[ detail.subShapeNum ];
|
||||||
S32 end = start + subShapeNumObjects[ detail.subShapeNum ];
|
S32 end = start + mSubShapeNumObjects[ detail.subShapeNum ];
|
||||||
for ( S32 o=start; o < end; o++ )
|
for ( S32 o=start; o < end; o++ )
|
||||||
{
|
{
|
||||||
const TSShape::Object &object = objects[o];
|
const TSShape::Object &object = mObjects[o];
|
||||||
if ( detail.objectDetailNum >= object.numMeshes )
|
if ( detail.objectDetailNum >= object.numMeshes )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// No mesh or no verts.... nothing to do.
|
// No mesh or no verts.... nothing to do.
|
||||||
TSMesh *mesh = meshes[ object.startMeshIndex + detail.objectDetailNum ];
|
TSMesh *mesh = mMeshes[ object.startMeshIndex + detail.objectDetailNum ];
|
||||||
if ( !mesh || mesh->mNumVerts == 0 )
|
if ( !mesh || mesh->mNumVerts == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -1013,31 +1013,31 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F &
|
||||||
//
|
//
|
||||||
// TODO: We need to support LOS collision for physics.
|
// TODO: We need to support LOS collision for physics.
|
||||||
//
|
//
|
||||||
for ( U32 i = 0; i < details.size(); i++ )
|
for ( U32 i = 0; i < mDetails.size(); i++ )
|
||||||
{
|
{
|
||||||
const TSShape::Detail &detail = details[i];
|
const TSShape::Detail &detail = mDetails[i];
|
||||||
const String &name = names[detail.nameIndex];
|
const String &name = mNames[detail.nameIndex];
|
||||||
|
|
||||||
// Is this a valid collision detail.
|
// Is this a valid collision detail.
|
||||||
if ( !dStrStartsWith( name, "Collision" ) || detail.subShapeNum < 0 )
|
if ( !dStrStartsWith( name, "Collision" ) || detail.subShapeNum < 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Now go thru the meshes for this detail.
|
// Now go thru the meshes for this detail.
|
||||||
S32 start = subShapeFirstObject[ detail.subShapeNum ];
|
S32 start = mSubShapeFirstObject[ detail.subShapeNum ];
|
||||||
S32 end = start + subShapeNumObjects[ detail.subShapeNum ];
|
S32 end = start + mSubShapeNumObjects[ detail.subShapeNum ];
|
||||||
if ( start >= end )
|
if ( start >= end )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for ( S32 o=start; o < end; o++ )
|
for ( S32 o=start; o < end; o++ )
|
||||||
{
|
{
|
||||||
const TSShape::Object &object = objects[o];
|
const TSShape::Object &object = mObjects[o];
|
||||||
const String &meshName = names[ object.nameIndex ];
|
const String &meshName = mNames[ object.nameIndex ];
|
||||||
|
|
||||||
if ( object.numMeshes <= detail.objectDetailNum )
|
if ( object.numMeshes <= detail.objectDetailNum )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// No mesh, a flat bounds, or no verts.... nothing to do.
|
// No mesh, a flat bounds, or no verts.... nothing to do.
|
||||||
TSMesh *mesh = meshes[ object.startMeshIndex + detail.objectDetailNum ];
|
TSMesh *mesh = mMeshes[ object.startMeshIndex + detail.objectDetailNum ];
|
||||||
if ( !mesh || mesh->getBounds().isEmpty() || mesh->mNumVerts == 0 )
|
if ( !mesh || mesh->getBounds().isEmpty() || mesh->mNumVerts == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector
|
||||||
space[level*3] = '\0';
|
space[level*3] = '\0';
|
||||||
|
|
||||||
const char *nodeName = "";
|
const char *nodeName = "";
|
||||||
const TSShape::Node & node = mShape->nodes[nodeIndex];
|
const TSShape::Node & node = mShape->mNodes[nodeIndex];
|
||||||
if (node.nameIndex != -1)
|
if (node.nameIndex != -1)
|
||||||
nodeName = mShape->getName(node.nameIndex);
|
nodeName = mShape->getName(node.nameIndex);
|
||||||
dumpLine(avar("%s%s", space, nodeName));
|
dumpLine(avar("%s%s", space, nodeName));
|
||||||
|
|
@ -93,7 +93,7 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector
|
||||||
for (S32 k=0; k<obj->object->numMeshes; k++)
|
for (S32 k=0; k<obj->object->numMeshes; k++)
|
||||||
{
|
{
|
||||||
S32 f = obj->object->startMeshIndex;
|
S32 f = obj->object->startMeshIndex;
|
||||||
if (mShape->meshes[f+k])
|
if (mShape->mMeshes[f+k])
|
||||||
dumpLine(avar(" %i",detailSizes[k]));
|
dumpLine(avar(" %i",detailSizes[k]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,9 +108,9 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector
|
||||||
}
|
}
|
||||||
|
|
||||||
// search for children
|
// search for children
|
||||||
for (S32 k=nodeIndex+1; k<mShape->nodes.size(); k++)
|
for (S32 k=nodeIndex+1; k<mShape->mNodes.size(); k++)
|
||||||
{
|
{
|
||||||
if (mShape->nodes[k].parentIndex == nodeIndex)
|
if (mShape->mNodes[k].parentIndex == nodeIndex)
|
||||||
// this is our child
|
// this is our child
|
||||||
dumpNode(stream, level+1, k, detailSizes);
|
dumpNode(stream, level+1, k, detailSizes);
|
||||||
}
|
}
|
||||||
|
|
@ -126,9 +126,9 @@ void TSShapeInstance::dump(Stream & stream)
|
||||||
|
|
||||||
dumpLine("\r\n Details:\r\n");
|
dumpLine("\r\n Details:\r\n");
|
||||||
|
|
||||||
for (i=0; i<mShape->details.size(); i++)
|
for (i=0; i<mShape->mDetails.size(); i++)
|
||||||
{
|
{
|
||||||
const TSDetail & detail = mShape->details[i];
|
const TSDetail & detail = mShape->mDetails[i];
|
||||||
name = mShape->getName(detail.nameIndex);
|
name = mShape->getName(detail.nameIndex);
|
||||||
ss = detail.subShapeNum;
|
ss = detail.subShapeNum;
|
||||||
od = detail.objectDetailNum;
|
od = detail.objectDetailNum;
|
||||||
|
|
@ -145,23 +145,23 @@ void TSShapeInstance::dump(Stream & stream)
|
||||||
|
|
||||||
dumpLine("\r\n Subtrees:\r\n");
|
dumpLine("\r\n Subtrees:\r\n");
|
||||||
|
|
||||||
for (i=0; i<mShape->subShapeFirstNode.size(); i++)
|
for (i=0; i<mShape->mSubShapeFirstNode.size(); i++)
|
||||||
{
|
{
|
||||||
S32 a = mShape->subShapeFirstNode[i];
|
S32 a = mShape->mSubShapeFirstNode[i];
|
||||||
S32 b = a + mShape->subShapeNumNodes[i];
|
S32 b = a + mShape->mSubShapeNumNodes[i];
|
||||||
dumpLine(avar(" Subtree %i\r\n",i));
|
dumpLine(avar(" Subtree %i\r\n",i));
|
||||||
|
|
||||||
// compute detail sizes for each subshape
|
// compute detail sizes for each subshape
|
||||||
Vector<S32> detailSizes;
|
Vector<S32> detailSizes;
|
||||||
for (S32 l=0;l<mShape->details.size(); l++)
|
for (S32 l=0;l<mShape->mDetails.size(); l++)
|
||||||
{
|
{
|
||||||
if ((mShape->details[l].subShapeNum==i) || (mShape->details[l].subShapeNum==-1))
|
if ((mShape->mDetails[l].subShapeNum==i) || (mShape->mDetails[l].subShapeNum==-1))
|
||||||
detailSizes.push_back((S32)mShape->details[l].size);
|
detailSizes.push_back((S32)mShape->mDetails[l].size);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j=a; j<b; j++)
|
for (j=a; j<b; j++)
|
||||||
{
|
{
|
||||||
const TSNode & node = mShape->nodes[j];
|
const TSNode & node = mShape->mNodes[j];
|
||||||
// if the node has a parent, it'll get dumped via the parent
|
// if the node has a parent, it'll get dumped via the parent
|
||||||
if (node.parentIndex<0)
|
if (node.parentIndex<0)
|
||||||
dumpNode(stream,3,j,detailSizes);
|
dumpNode(stream,3,j,detailSizes);
|
||||||
|
|
@ -169,22 +169,22 @@ void TSShapeInstance::dump(Stream & stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool foundSkin = false;
|
bool foundSkin = false;
|
||||||
for (i=0; i<mShape->objects.size(); i++)
|
for (i=0; i<mShape->mObjects.size(); i++)
|
||||||
{
|
{
|
||||||
if (mShape->objects[i].nodeIndex<0) // must be a skin
|
if (mShape->mObjects[i].nodeIndex<0) // must be a skin
|
||||||
{
|
{
|
||||||
if (!foundSkin)
|
if (!foundSkin)
|
||||||
dumpLine("\r\n Skins:\r\n");
|
dumpLine("\r\n Skins:\r\n");
|
||||||
foundSkin=true;
|
foundSkin=true;
|
||||||
const char * skinName = "";
|
const char * skinName = "";
|
||||||
S32 nameIndex = mShape->objects[i].nameIndex;
|
S32 nameIndex = mShape->mObjects[i].nameIndex;
|
||||||
if (nameIndex>=0)
|
if (nameIndex>=0)
|
||||||
skinName = mShape->getName(nameIndex);
|
skinName = mShape->getName(nameIndex);
|
||||||
dumpLine(avar(" Skin %s with following details: ",skinName));
|
dumpLine(avar(" Skin %s with following details: ",skinName));
|
||||||
for (S32 num=0; num<mShape->objects[i].numMeshes; num++)
|
for (S32 num=0; num<mShape->mObjects[i].numMeshes; num++)
|
||||||
{
|
{
|
||||||
if (mShape->meshes[mShape->objects[i].startMeshIndex + num])
|
if (mShape->mMeshes[mShape->mObjects[i].startMeshIndex + num])
|
||||||
dumpLine(avar(" %i",(S32)mShape->details[num].size));
|
dumpLine(avar(" %i",(S32)mShape->mDetails[num].size));
|
||||||
}
|
}
|
||||||
dumpLine("\r\n");
|
dumpLine("\r\n");
|
||||||
}
|
}
|
||||||
|
|
@ -193,19 +193,19 @@ void TSShapeInstance::dump(Stream & stream)
|
||||||
dumpLine("\r\n");
|
dumpLine("\r\n");
|
||||||
|
|
||||||
dumpLine("\r\n Sequences:\r\n");
|
dumpLine("\r\n Sequences:\r\n");
|
||||||
for (i = 0; i < mShape->sequences.size(); i++)
|
for (i = 0; i < mShape->mSequences.size(); i++)
|
||||||
{
|
{
|
||||||
const char *name = "(none)";
|
const char *name = "(none)";
|
||||||
if (mShape->sequences[i].nameIndex != -1)
|
if (mShape->mSequences[i].nameIndex != -1)
|
||||||
name = mShape->getName(mShape->sequences[i].nameIndex);
|
name = mShape->getName(mShape->mSequences[i].nameIndex);
|
||||||
dumpLine(avar(" %3d: %s%s%s\r\n", i, name,
|
dumpLine(avar(" %3d: %s%s%s\r\n", i, name,
|
||||||
mShape->sequences[i].isCyclic() ? " (cyclic)" : "",
|
mShape->mSequences[i].isCyclic() ? " (cyclic)" : "",
|
||||||
mShape->sequences[i].isBlend() ? " (blend)" : ""));
|
mShape->mSequences[i].isBlend() ? " (blend)" : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mShape->materialList)
|
if (mShape->mMaterialList)
|
||||||
{
|
{
|
||||||
TSMaterialList * ml = mShape->materialList;
|
TSMaterialList * ml = mShape->mMaterialList;
|
||||||
dumpLine("\r\n Material list:\r\n");
|
dumpLine("\r\n Material list:\r\n");
|
||||||
for (i=0; i<(S32)ml->size(); i++)
|
for (i=0; i<(S32)ml->size(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,8 @@ TSLastDetail::TSLastDetail( TSShape *shape,
|
||||||
mDl = dl;
|
mDl = dl;
|
||||||
mDim = getMax( dim, (S32)32 );
|
mDim = getMax( dim, (S32)32 );
|
||||||
|
|
||||||
mRadius = mShape->radius;
|
mRadius = mShape->mRadius;
|
||||||
mCenter = mShape->center;
|
mCenter = mShape->mCenter;
|
||||||
|
|
||||||
mCachePath = cachePath;
|
mCachePath = cachePath;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,18 +204,18 @@ void MeshFit::initSourceGeometry( const String& target )
|
||||||
{
|
{
|
||||||
// Add all geometry in the highest detail level
|
// Add all geometry in the highest detail level
|
||||||
S32 dl = 0;
|
S32 dl = 0;
|
||||||
S32 ss = mShape->details[dl].subShapeNum;
|
S32 ss = mShape->mDetails[dl].subShapeNum;
|
||||||
if ( ss < 0 )
|
if ( ss < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
S32 od = mShape->details[dl].objectDetailNum;
|
S32 od = mShape->mDetails[dl].objectDetailNum;
|
||||||
S32 start = mShape->subShapeFirstObject[ss];
|
S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = start + mShape->subShapeNumObjects[ss];
|
S32 end = start + mShape->mSubShapeNumObjects[ss];
|
||||||
|
|
||||||
for ( S32 i = start; i < end; i++ )
|
for ( S32 i = start; i < end; i++ )
|
||||||
{
|
{
|
||||||
const TSShape::Object &obj = mShape->objects[i];
|
const TSShape::Object &obj = mShape->mObjects[i];
|
||||||
const TSMesh* mesh = ( od < obj.numMeshes ) ? mShape->meshes[obj.startMeshIndex + od] : NULL;
|
const TSMesh* mesh = ( od < obj.numMeshes ) ? mShape->mMeshes[obj.startMeshIndex + od] : NULL;
|
||||||
if ( mesh )
|
if ( mesh )
|
||||||
addSourceMesh( obj, mesh );
|
addSourceMesh( obj, mesh );
|
||||||
}
|
}
|
||||||
|
|
@ -227,10 +227,10 @@ void MeshFit::initSourceGeometry( const String& target )
|
||||||
if ( objIndex == -1 )
|
if ( objIndex == -1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const TSShape::Object &obj = mShape->objects[objIndex];
|
const TSShape::Object &obj = mShape->mObjects[objIndex];
|
||||||
for ( S32 i = 0; i < obj.numMeshes; i++ )
|
for ( S32 i = 0; i < obj.numMeshes; i++ )
|
||||||
{
|
{
|
||||||
const TSMesh* mesh = mShape->meshes[obj.startMeshIndex + i];
|
const TSMesh* mesh = mShape->mMeshes[obj.startMeshIndex + i];
|
||||||
if ( mesh )
|
if ( mesh )
|
||||||
{
|
{
|
||||||
addSourceMesh( obj, mesh );
|
addSourceMesh( obj, mesh );
|
||||||
|
|
@ -310,13 +310,13 @@ TSMesh* MeshFit::initMeshFromFile( const String& filename ) const
|
||||||
{
|
{
|
||||||
// Open the source shape file and make a copy of the mesh
|
// Open the source shape file and make a copy of the mesh
|
||||||
Resource<TSShape> hShape = ResourceManager::get().load(filename);
|
Resource<TSShape> hShape = ResourceManager::get().load(filename);
|
||||||
if (!bool(hShape) || !((TSShape*)hShape)->meshes.size())
|
if (!bool(hShape) || !((TSShape*)hShape)->mMeshes.size())
|
||||||
{
|
{
|
||||||
Con::errorf("TSShape::createMesh: Could not load source mesh from %s", filename.c_str());
|
Con::errorf("TSShape::createMesh: Could not load source mesh from %s", filename.c_str());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSMesh* srcMesh = ((TSShape*)hShape)->meshes[0];
|
TSMesh* srcMesh = ((TSShape*)hShape)->mMeshes[0];
|
||||||
return mShape->copyMesh( srcMesh );
|
return mShape->copyMesh( srcMesh );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,9 +97,9 @@ void TSPartInstance::updateBounds()
|
||||||
|
|
||||||
void TSPartInstance::breakShape(TSShapeInstance * shape, S32 subShape, Vector<TSPartInstance*> & partList, F32 * probShatter, F32 * probBreak, S32 probDepth)
|
void TSPartInstance::breakShape(TSShapeInstance * shape, S32 subShape, Vector<TSPartInstance*> & partList, F32 * probShatter, F32 * probBreak, S32 probDepth)
|
||||||
{
|
{
|
||||||
AssertFatal(subShape>=0 && subShape<shape->mShape->subShapeFirstNode.size(),"TSPartInstance::breakShape: subShape out of range.");
|
AssertFatal(subShape>=0 && subShape<shape->mShape->mSubShapeFirstNode.size(),"TSPartInstance::breakShape: subShape out of range.");
|
||||||
|
|
||||||
S32 start = shape->mShape->subShapeFirstNode[subShape];
|
S32 start = shape->mShape->mSubShapeFirstNode[subShape];
|
||||||
|
|
||||||
TSPartInstance::breakShape(shape, NULL, start, partList, probShatter, probBreak, probDepth);
|
TSPartInstance::breakShape(shape, NULL, start, partList, probShatter, probBreak, probDepth);
|
||||||
|
|
||||||
|
|
@ -120,7 +120,7 @@ void TSPartInstance::breakShape(TSShapeInstance * shape, TSPartInstance * curren
|
||||||
{
|
{
|
||||||
AssertFatal( !probDepth || (probShatter && probBreak),"TSPartInstance::breakShape: probabilities improperly specified.");
|
AssertFatal( !probDepth || (probShatter && probBreak),"TSPartInstance::breakShape: probabilities improperly specified.");
|
||||||
|
|
||||||
const TSShape::Node * node = &shape->mShape->nodes[currentNode];
|
const TSShape::Node * node = &shape->mShape->mNodes[currentNode];
|
||||||
S32 object = node->firstObject;
|
S32 object = node->firstObject;
|
||||||
S32 child = node->firstChild;
|
S32 child = node->firstChild;
|
||||||
|
|
||||||
|
|
@ -155,14 +155,14 @@ void TSPartInstance::breakShape(TSShapeInstance * shape, TSPartInstance * curren
|
||||||
{
|
{
|
||||||
partList.increment();
|
partList.increment();
|
||||||
partList.last() = new TSPartInstance(shape,object);
|
partList.last() = new TSPartInstance(shape,object);
|
||||||
object = shape->mShape->objects[object].nextSibling;
|
object = shape->mShape->mObjects[object].nextSibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterate through the child nodes, call ourselves on each one with currentPart = NULL
|
// iterate through the child nodes, call ourselves on each one with currentPart = NULL
|
||||||
while (child>=0)
|
while (child>=0)
|
||||||
{
|
{
|
||||||
TSPartInstance::breakShape(shape,NULL,child,partList,probShatter,probBreak,probDepth);
|
TSPartInstance::breakShape(shape,NULL,child,partList,probShatter,probBreak,probDepth);
|
||||||
child = shape->mShape->nodes[child].nextSibling;
|
child = shape->mShape->mNodes[child].nextSibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -184,14 +184,14 @@ void TSPartInstance::breakShape(TSShapeInstance * shape, TSPartInstance * curren
|
||||||
while (object>=0)
|
while (object>=0)
|
||||||
{
|
{
|
||||||
currentPart->addObject(object);
|
currentPart->addObject(object);
|
||||||
object = shape->mShape->objects[object].nextSibling;
|
object = shape->mShape->mObjects[object].nextSibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterate through child nodes, call ourselves on each one with currentPart as is
|
// iterate through child nodes, call ourselves on each one with currentPart as is
|
||||||
while (child>=0)
|
while (child>=0)
|
||||||
{
|
{
|
||||||
TSPartInstance::breakShape(shape,currentPart,child,partList,probShatter,probBreak,probDepth);
|
TSPartInstance::breakShape(shape,currentPart,child,partList,probShatter,probBreak,probDepth);
|
||||||
child = shape->mShape->nodes[child].nextSibling;
|
child = shape->mShape->mNodes[child].nextSibling;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -334,7 +334,7 @@ F32 TSPartInstance::getDetailSize(S32 dl) const
|
||||||
else if (mSizeCutoffs && dl<mNumDetails)
|
else if (mSizeCutoffs && dl<mNumDetails)
|
||||||
return mSizeCutoffs[dl];
|
return mSizeCutoffs[dl];
|
||||||
else if (!mSizeCutoffs && dl<=mSourceShape->getShape()->mSmallestVisibleDL)
|
else if (!mSizeCutoffs && dl<=mSourceShape->getShape()->mSmallestVisibleDL)
|
||||||
return mSourceShape->getShape()->details[dl].size;
|
return mSourceShape->getShape()->mDetails[dl].size;
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -274,25 +274,25 @@ class TSShape
|
||||||
/// @name Shape Vector Data
|
/// @name Shape Vector Data
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
Vector<Node> nodes;
|
Vector<Node> mNodes;
|
||||||
Vector<Object> objects;
|
Vector<Object> mObjects;
|
||||||
Vector<ObjectState> objectStates;
|
Vector<ObjectState> mObjectStates;
|
||||||
Vector<S32> subShapeFirstNode;
|
Vector<S32> mSubShapeFirstNode;
|
||||||
Vector<S32> subShapeFirstObject;
|
Vector<S32> mSubShapeFirstObject;
|
||||||
Vector<S32> detailFirstSkin;
|
Vector<S32> mDetailFirstSkin;
|
||||||
Vector<S32> subShapeNumNodes;
|
Vector<S32> mSubShapeNumNodes;
|
||||||
Vector<S32> subShapeNumObjects;
|
Vector<S32> mSubShapeNumObjects;
|
||||||
Vector<Detail> details;
|
Vector<Detail> mDetails;
|
||||||
Vector<Quat16> defaultRotations;
|
Vector<Quat16> mDefaultRotations;
|
||||||
Vector<Point3F> defaultTranslations;
|
Vector<Point3F> mDefaultTranslations;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// These are set up at load time, but memory is allocated along with loaded data
|
/// These are set up at load time, but memory is allocated along with loaded data
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
Vector<S32> subShapeFirstTranslucentObject;
|
Vector<S32> mSubShapeFirstTranslucentObject;
|
||||||
Vector<TSMesh*> meshes;
|
Vector<TSMesh*> mMeshes;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
@ -306,39 +306,39 @@ class TSShape
|
||||||
/// - intraDL is at 0 when if shape were any farther away we'd be at dl+1
|
/// - intraDL is at 0 when if shape were any farther away we'd be at dl+1
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
Vector<F32> alphaIn;
|
Vector<F32> mAlphaIn;
|
||||||
Vector<F32> alphaOut
|
Vector<F32> mAlphaOut
|
||||||
;
|
;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// @name Resizeable vectors
|
/// @name Resizeable vectors
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
Vector<Sequence> sequences;
|
Vector<Sequence> mSequences;
|
||||||
Vector<Quat16> nodeRotations;
|
Vector<Quat16> mNodeRotations;
|
||||||
Vector<Point3F> nodeTranslations;
|
Vector<Point3F> mNodeTranslations;
|
||||||
Vector<F32> nodeUniformScales;
|
Vector<F32> mNodeUniformScales;
|
||||||
Vector<Point3F> nodeAlignedScales;
|
Vector<Point3F> mNodeAlignedScales;
|
||||||
Vector<Quat16> nodeArbitraryScaleRots;
|
Vector<Quat16> mNodeArbitraryScaleRots;
|
||||||
Vector<Point3F> nodeArbitraryScaleFactors;
|
Vector<Point3F> mNodeArbitraryScaleFactors;
|
||||||
Vector<Quat16> groundRotations;
|
Vector<Quat16> mGroundRotations;
|
||||||
Vector<Point3F> groundTranslations;
|
Vector<Point3F> mGroundTranslations;
|
||||||
Vector<Trigger> triggers;
|
Vector<Trigger> mTriggers;
|
||||||
Vector<TSLastDetail*> billboardDetails;
|
Vector<TSLastDetail*> mBillboardDetails;
|
||||||
Vector<ConvexHullAccelerator*> detailCollisionAccelerators;
|
Vector<ConvexHullAccelerator*> mDetailCollisionAccelerators;
|
||||||
Vector<String> names;
|
Vector<String> mNames;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
TSMaterialList * materialList;
|
TSMaterialList * mMaterialList;
|
||||||
|
|
||||||
/// @name Bounding
|
/// @name Bounding
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
F32 radius;
|
F32 mRadius;
|
||||||
F32 tubeRadius;
|
F32 mTubeRadius;
|
||||||
Point3F center;
|
Point3F mCenter;
|
||||||
Box3F bounds;
|
Box3F mBounds;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
@ -348,7 +348,7 @@ class TSShape
|
||||||
S32 mSmallestVisibleDL; ///< @see mSmallestVisibleSize
|
S32 mSmallestVisibleDL; ///< @see mSmallestVisibleSize
|
||||||
S32 mReadVersion; ///< File version that this shape was read from.
|
S32 mReadVersion; ///< File version that this shape was read from.
|
||||||
U32 mFlags; ///< hasTranslucancy
|
U32 mFlags; ///< hasTranslucancy
|
||||||
U32 data; ///< User-defined data storage.
|
U32 mData; ///< User-defined data storage.
|
||||||
|
|
||||||
/// If enabled detail selection will use the
|
/// If enabled detail selection will use the
|
||||||
/// legacy screen error method for lod.
|
/// legacy screen error method for lod.
|
||||||
|
|
@ -659,34 +659,34 @@ class TSShape
|
||||||
|
|
||||||
inline QuatF & TSShape::getRotation(const Sequence & seq, S32 keyframeNum, S32 rotNum, QuatF * quat) const
|
inline QuatF & TSShape::getRotation(const Sequence & seq, S32 keyframeNum, S32 rotNum, QuatF * quat) const
|
||||||
{
|
{
|
||||||
return nodeRotations[seq.baseRotation + rotNum*seq.numKeyframes + keyframeNum].getQuatF(quat);
|
return mNodeRotations[seq.baseRotation + rotNum*seq.numKeyframes + keyframeNum].getQuatF(quat);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Point3F & TSShape::getTranslation(const Sequence & seq, S32 keyframeNum, S32 tranNum) const
|
inline const Point3F & TSShape::getTranslation(const Sequence & seq, S32 keyframeNum, S32 tranNum) const
|
||||||
{
|
{
|
||||||
return nodeTranslations[seq.baseTranslation + tranNum*seq.numKeyframes + keyframeNum];
|
return mNodeTranslations[seq.baseTranslation + tranNum*seq.numKeyframes + keyframeNum];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline F32 TSShape::getUniformScale(const Sequence & seq, S32 keyframeNum, S32 scaleNum) const
|
inline F32 TSShape::getUniformScale(const Sequence & seq, S32 keyframeNum, S32 scaleNum) const
|
||||||
{
|
{
|
||||||
return nodeUniformScales[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum];
|
return mNodeUniformScales[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Point3F & TSShape::getAlignedScale(const Sequence & seq, S32 keyframeNum, S32 scaleNum) const
|
inline const Point3F & TSShape::getAlignedScale(const Sequence & seq, S32 keyframeNum, S32 scaleNum) const
|
||||||
{
|
{
|
||||||
return nodeAlignedScales[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum];
|
return mNodeAlignedScales[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline TSScale & TSShape::getArbitraryScale(const Sequence & seq, S32 keyframeNum, S32 scaleNum, TSScale * scale) const
|
inline TSScale & TSShape::getArbitraryScale(const Sequence & seq, S32 keyframeNum, S32 scaleNum, TSScale * scale) const
|
||||||
{
|
{
|
||||||
nodeArbitraryScaleRots[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum].getQuatF(&scale->mRotate);
|
mNodeArbitraryScaleRots[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum].getQuatF(&scale->mRotate);
|
||||||
scale->mScale = nodeArbitraryScaleFactors[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum];
|
scale->mScale = mNodeArbitraryScaleFactors[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum];
|
||||||
return *scale;
|
return *scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const TSShape::ObjectState & TSShape::getObjectState(const Sequence & seq, S32 keyframeNum, S32 objectNum) const
|
inline const TSShape::ObjectState & TSShape::getObjectState(const Sequence & seq, S32 keyframeNum, S32 objectNum) const
|
||||||
{
|
{
|
||||||
return objectStates[seq.baseObjectState + objectNum*seq.numKeyframes + keyframeNum];
|
return mObjectStates[seq.baseObjectState + objectNum*seq.numKeyframes + keyframeNum];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -482,7 +482,7 @@ bool TSShapeConstructor::writeField(StringTableEntry fieldname, const char *valu
|
||||||
return ret; \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
TSShape::Node* var = var##Index < 0 ? NULL : &(mShape->nodes[var##Index]); \
|
TSShape::Node* var = var##Index < 0 ? NULL : &(mShape->mNodes[var##Index]); \
|
||||||
TORQUE_UNUSED(var##Index); \
|
TORQUE_UNUSED(var##Index); \
|
||||||
TORQUE_UNUSED(var)
|
TORQUE_UNUSED(var)
|
||||||
|
|
||||||
|
|
@ -495,7 +495,7 @@ bool TSShapeConstructor::writeField(StringTableEntry fieldname, const char *valu
|
||||||
"node '%s'", name); \
|
"node '%s'", name); \
|
||||||
return ret; \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
TSShape::Node* var = &(mShape->nodes[var##Index]); \
|
TSShape::Node* var = &(mShape->mNodes[var##Index]); \
|
||||||
TORQUE_UNUSED(var##Index); \
|
TORQUE_UNUSED(var##Index); \
|
||||||
TORQUE_UNUSED(var)
|
TORQUE_UNUSED(var)
|
||||||
|
|
||||||
|
|
@ -508,7 +508,7 @@ bool TSShapeConstructor::writeField(StringTableEntry fieldname, const char *valu
|
||||||
"object '%s'", name); \
|
"object '%s'", name); \
|
||||||
return ret; \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
TSShape::Object* var = &(mShape->objects[var##Index]); \
|
TSShape::Object* var = &(mShape->mObjects[var##Index]); \
|
||||||
TORQUE_UNUSED(var##Index); \
|
TORQUE_UNUSED(var##Index); \
|
||||||
TORQUE_UNUSED(var)
|
TORQUE_UNUSED(var)
|
||||||
|
|
||||||
|
|
@ -531,7 +531,7 @@ bool TSShapeConstructor::writeField(StringTableEntry fieldname, const char *valu
|
||||||
"sequence named '%s'", name); \
|
"sequence named '%s'", name); \
|
||||||
return ret; \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
TSShape::Sequence* var = &(mShape->sequences[var##Index]); \
|
TSShape::Sequence* var = &(mShape->mSequences[var##Index]); \
|
||||||
TORQUE_UNUSED(var##Index); \
|
TORQUE_UNUSED(var##Index); \
|
||||||
TORQUE_UNUSED(var);
|
TORQUE_UNUSED(var);
|
||||||
|
|
||||||
|
|
@ -695,7 +695,7 @@ DefineTSShapeConstructorMethod( getNodeCount, S32, (),,
|
||||||
"%count = %this.getNodeCount();\n"
|
"%count = %this.getNodeCount();\n"
|
||||||
"@endtsexample\n" )
|
"@endtsexample\n" )
|
||||||
{
|
{
|
||||||
return mShape->nodes.size();
|
return mShape->mNodes.size();
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getNodeIndex, S32, ( const char* name ),,
|
DefineTSShapeConstructorMethod( getNodeIndex, S32, ( const char* name ),,
|
||||||
|
|
@ -723,8 +723,8 @@ DefineTSShapeConstructorMethod( getNodeName, const char*, ( S32 index ),,
|
||||||
" echo(%i SPC %this.getNodeName(%i));\n"
|
" echo(%i SPC %this.getNodeName(%i));\n"
|
||||||
"@endtsexample\n" )
|
"@endtsexample\n" )
|
||||||
{
|
{
|
||||||
CHECK_INDEX_IN_RANGE( getNodeName, index, mShape->nodes.size(), "" );
|
CHECK_INDEX_IN_RANGE( getNodeName, index, mShape->mNodes.size(), "" );
|
||||||
return mShape->getName( mShape->nodes[index].nameIndex );
|
return mShape->getName( mShape->mNodes[index].nameIndex );
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getNodeParentName, const char*, ( const char* name ),,
|
DefineTSShapeConstructorMethod( getNodeParentName, const char*, ( const char* name ),,
|
||||||
|
|
@ -742,7 +742,7 @@ DefineTSShapeConstructorMethod( getNodeParentName, const char*, ( const char* na
|
||||||
if ( node->parentIndex < 0 )
|
if ( node->parentIndex < 0 )
|
||||||
return "";
|
return "";
|
||||||
else
|
else
|
||||||
return mShape->getName( mShape->nodes[node->parentIndex].nameIndex );
|
return mShape->getName( mShape->mNodes[node->parentIndex].nameIndex );
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( setNodeParent, bool, ( const char* name, const char* parentName ),,
|
DefineTSShapeConstructorMethod( setNodeParent, bool, ( const char* name, const char* parentName ),,
|
||||||
|
|
@ -814,7 +814,7 @@ DefineTSShapeConstructorMethod( getNodeChildName, const char*, ( const char* nam
|
||||||
mShape->getNodeChildren( nodeIndex, nodeChildren );
|
mShape->getNodeChildren( nodeIndex, nodeChildren );
|
||||||
CHECK_INDEX_IN_RANGE( getNodeChildName, index, nodeChildren.size(), "" );
|
CHECK_INDEX_IN_RANGE( getNodeChildName, index, nodeChildren.size(), "" );
|
||||||
|
|
||||||
return mShape->getName( mShape->nodes[nodeChildren[index]].nameIndex );
|
return mShape->getName( mShape->mNodes[nodeChildren[index]].nameIndex );
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getNodeObjectCount, S32, ( const char* name ),,
|
DefineTSShapeConstructorMethod( getNodeObjectCount, S32, ( const char* name ),,
|
||||||
|
|
@ -852,7 +852,7 @@ DefineTSShapeConstructorMethod( getNodeObjectName, const char*, ( const char* na
|
||||||
mShape->getNodeObjects( nodeIndex, nodeObjects );
|
mShape->getNodeObjects( nodeIndex, nodeObjects );
|
||||||
CHECK_INDEX_IN_RANGE( getNodeObjectName, index, nodeObjects.size(), "" );
|
CHECK_INDEX_IN_RANGE( getNodeObjectName, index, nodeObjects.size(), "" );
|
||||||
|
|
||||||
return mShape->getName( mShape->objects[nodeObjects[index]].nameIndex );
|
return mShape->getName( mShape->mObjects[nodeObjects[index]].nameIndex );
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getNodeTransform, TransformF, ( const char* name, bool isWorld ), ( false ),
|
DefineTSShapeConstructorMethod( getNodeTransform, TransformF, ( const char* name, bool isWorld ), ( false ),
|
||||||
|
|
@ -884,8 +884,8 @@ DefineTSShapeConstructorMethod( getNodeTransform, TransformF, ( const char* name
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Local transform
|
// Local transform
|
||||||
pos = mShape->defaultTranslations[nodeIndex];
|
pos = mShape->mDefaultTranslations[nodeIndex];
|
||||||
const Quat16& q16 = mShape->defaultRotations[nodeIndex];
|
const Quat16& q16 = mShape->mDefaultRotations[nodeIndex];
|
||||||
aa.set( q16.getQuatF() );
|
aa.set( q16.getQuatF() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1067,7 +1067,7 @@ DefineTSShapeConstructorMethod( getObjectCount, S32, (),, (), 0,
|
||||||
"%count = %this.getObjectCount();\n"
|
"%count = %this.getObjectCount();\n"
|
||||||
"@endtsexample\n" )
|
"@endtsexample\n" )
|
||||||
{
|
{
|
||||||
return mShape->objects.size();
|
return mShape->mObjects.size();
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getObjectName, const char*, ( S32 index ),,
|
DefineTSShapeConstructorMethod( getObjectName, const char*, ( S32 index ),,
|
||||||
|
|
@ -1082,9 +1082,9 @@ DefineTSShapeConstructorMethod( getObjectName, const char*, ( S32 index ),,
|
||||||
" echo( %i SPC %this.getObjectName( %i ) );\n"
|
" echo( %i SPC %this.getObjectName( %i ) );\n"
|
||||||
"@endtsexample\n" )
|
"@endtsexample\n" )
|
||||||
{
|
{
|
||||||
CHECK_INDEX_IN_RANGE( getObjectName, index, mShape->objects.size(), "" );
|
CHECK_INDEX_IN_RANGE( getObjectName, index, mShape->mObjects.size(), "" );
|
||||||
|
|
||||||
return mShape->getName( mShape->objects[index].nameIndex );
|
return mShape->getName( mShape->mObjects[index].nameIndex );
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getObjectIndex, S32, ( const char* name ),,
|
DefineTSShapeConstructorMethod( getObjectIndex, S32, ( const char* name ),,
|
||||||
|
|
@ -1113,7 +1113,7 @@ DefineTSShapeConstructorMethod( getObjectNode, const char*, ( const char* name )
|
||||||
if ( obj->nodeIndex < 0 )
|
if ( obj->nodeIndex < 0 )
|
||||||
return "";
|
return "";
|
||||||
else
|
else
|
||||||
return mShape->getName( mShape->nodes[obj->nodeIndex].nameIndex );
|
return mShape->getName( mShape->mNodes[obj->nodeIndex].nameIndex );
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( setObjectNode, bool, ( const char* objName, const char* nodeName ),,
|
DefineTSShapeConstructorMethod( setObjectNode, bool, ( const char* objName, const char* nodeName ),,
|
||||||
|
|
@ -1217,7 +1217,7 @@ DefineTSShapeConstructorMethod( getMeshName, const char*, ( const char* name, S3
|
||||||
CHECK_INDEX_IN_RANGE( getMeshName, index, objectDetails.size(), "" );
|
CHECK_INDEX_IN_RANGE( getMeshName, index, objectDetails.size(), "" );
|
||||||
|
|
||||||
char* returnBuffer = Con::getReturnBuffer(256);
|
char* returnBuffer = Con::getReturnBuffer(256);
|
||||||
dSprintf(returnBuffer, 256, "%s %d", name, (S32)mShape->details[objectDetails[index]].size);
|
dSprintf(returnBuffer, 256, "%s %d", name, (S32)mShape->mDetails[objectDetails[index]].size);
|
||||||
return returnBuffer;
|
return returnBuffer;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
@ -1242,7 +1242,7 @@ DefineTSShapeConstructorMethod( getMeshSize, S32, ( const char* name, S32 index
|
||||||
|
|
||||||
CHECK_INDEX_IN_RANGE( getMeshName, index, objectDetails.size(), -1 );
|
CHECK_INDEX_IN_RANGE( getMeshName, index, objectDetails.size(), -1 );
|
||||||
|
|
||||||
return (S32)mShape->details[objectDetails[index]].size;
|
return (S32)mShape->mDetails[objectDetails[index]].size;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( setMeshSize, bool, ( const char* name, S32 size ),,
|
DefineTSShapeConstructorMethod( setMeshSize, bool, ( const char* name, S32 size ),,
|
||||||
|
|
@ -1327,8 +1327,8 @@ DefineTSShapeConstructorMethod( getMeshMaterial, const char*, ( const char* name
|
||||||
|
|
||||||
// Return the name of the first material attached to this mesh
|
// Return the name of the first material attached to this mesh
|
||||||
S32 matIndex = mesh->mPrimitives[0].matIndex & TSDrawPrimitive::MaterialMask;
|
S32 matIndex = mesh->mPrimitives[0].matIndex & TSDrawPrimitive::MaterialMask;
|
||||||
if ((matIndex >= 0) && (matIndex < mShape->materialList->size()))
|
if ((matIndex >= 0) && (matIndex < mShape->mMaterialList->size()))
|
||||||
return mShape->materialList->getMaterialName( matIndex );
|
return mShape->mMaterialList->getMaterialName( matIndex );
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
}}
|
}}
|
||||||
|
|
@ -1350,16 +1350,16 @@ DefineTSShapeConstructorMethod( setMeshMaterial, bool, ( const char* meshName, c
|
||||||
|
|
||||||
// Check if this material is already in the shape
|
// Check if this material is already in the shape
|
||||||
S32 matIndex;
|
S32 matIndex;
|
||||||
for ( matIndex = 0; matIndex < mShape->materialList->size(); matIndex++ )
|
for ( matIndex = 0; matIndex < mShape->mMaterialList->size(); matIndex++ )
|
||||||
{
|
{
|
||||||
if ( dStrEqual( matName, mShape->materialList->getMaterialName( matIndex ) ) )
|
if ( dStrEqual( matName, mShape->mMaterialList->getMaterialName( matIndex ) ) )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( matIndex == mShape->materialList->size() )
|
if ( matIndex == mShape->mMaterialList->size() )
|
||||||
{
|
{
|
||||||
// Add a new material to the shape
|
// Add a new material to the shape
|
||||||
U32 flags = TSMaterialList::S_Wrap | TSMaterialList::T_Wrap;
|
U32 flags = TSMaterialList::S_Wrap | TSMaterialList::T_Wrap;
|
||||||
mShape->materialList->push_back( matName, flags );
|
mShape->mMaterialList->push_back( matName, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set this material for all primitives in the mesh
|
// Set this material for all primitives in the mesh
|
||||||
|
|
@ -1431,7 +1431,7 @@ DefineTSShapeConstructorMethod( getBounds, Box3F, (),,
|
||||||
"Get the bounding box for the shape.\n"
|
"Get the bounding box for the shape.\n"
|
||||||
"@return Bounding box \"minX minY minZ maxX maxY maxZ\"" )
|
"@return Bounding box \"minX minY minZ maxX maxY maxZ\"" )
|
||||||
{
|
{
|
||||||
return mShape->bounds;
|
return mShape->mBounds;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),,
|
DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),,
|
||||||
|
|
@ -1443,10 +1443,10 @@ DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),,
|
||||||
// Set shape bounds
|
// Set shape bounds
|
||||||
TSShape* shape = mShape;
|
TSShape* shape = mShape;
|
||||||
|
|
||||||
shape->bounds = bbox;
|
shape->mBounds = bbox;
|
||||||
shape->bounds.getCenter( &shape->center );
|
shape->mBounds.getCenter( &shape->mCenter );
|
||||||
shape->radius = ( shape->bounds.maxExtents - shape->center ).len();
|
shape->mRadius = ( shape->mBounds.maxExtents - shape->mCenter ).len();
|
||||||
shape->tubeRadius = shape->radius;
|
shape->mTubeRadius = shape->mRadius;
|
||||||
|
|
||||||
ADD_TO_CHANGE_SET();
|
ADD_TO_CHANGE_SET();
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1458,7 +1458,7 @@ DefineTSShapeConstructorMethod( getDetailLevelCount, S32, (),, (), 0,
|
||||||
"Get the total number of detail levels in the shape.\n"
|
"Get the total number of detail levels in the shape.\n"
|
||||||
"@return the number of detail levels in the shape\n" )
|
"@return the number of detail levels in the shape\n" )
|
||||||
{
|
{
|
||||||
return mShape->details.size();
|
return mShape->mDetails.size();
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getDetailLevelName, const char*, ( S32 index ),,
|
DefineTSShapeConstructorMethod( getDetailLevelName, const char*, ( S32 index ),,
|
||||||
|
|
@ -1473,9 +1473,9 @@ DefineTSShapeConstructorMethod( getDetailLevelName, const char*, ( S32 index ),,
|
||||||
" echo( %i SPC %this.getDetailLevelName( %i ) );\n"
|
" echo( %i SPC %this.getDetailLevelName( %i ) );\n"
|
||||||
"@endtsexample\n" )
|
"@endtsexample\n" )
|
||||||
{
|
{
|
||||||
CHECK_INDEX_IN_RANGE( getDetailLevelName, index, mShape->details.size(), "" );
|
CHECK_INDEX_IN_RANGE( getDetailLevelName, index, mShape->mDetails.size(), "" );
|
||||||
|
|
||||||
return mShape->getName(mShape->details[index].nameIndex);
|
return mShape->getName(mShape->mDetails[index].nameIndex);
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getDetailLevelSize, S32, ( S32 index),,
|
DefineTSShapeConstructorMethod( getDetailLevelSize, S32, ( S32 index),,
|
||||||
|
|
@ -1490,9 +1490,9 @@ DefineTSShapeConstructorMethod( getDetailLevelSize, S32, ( S32 index),,
|
||||||
" echo( \"Detail\" @ %i @ \" has size \" @ %this.getDetailLevelSize( %i ) );\n"
|
" echo( \"Detail\" @ %i @ \" has size \" @ %this.getDetailLevelSize( %i ) );\n"
|
||||||
"@endtsexample\n" )
|
"@endtsexample\n" )
|
||||||
{
|
{
|
||||||
CHECK_INDEX_IN_RANGE( getDetailLevelSize, index, mShape->details.size(), 0 );
|
CHECK_INDEX_IN_RANGE( getDetailLevelSize, index, mShape->mDetails.size(), 0 );
|
||||||
|
|
||||||
return (S32)mShape->details[index].size;
|
return (S32)mShape->mDetails[index].size;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getDetailLevelIndex, S32, ( S32 size ),,
|
DefineTSShapeConstructorMethod( getDetailLevelIndex, S32, ( S32 size ),,
|
||||||
|
|
@ -1567,9 +1567,9 @@ DefineTSShapeConstructorMethod( getImposterDetailLevel, S32, (),, (), -1,
|
||||||
"@return imposter detail level index, or -1 if the shape does not use "
|
"@return imposter detail level index, or -1 if the shape does not use "
|
||||||
"imposters.\n\n" )
|
"imposters.\n\n" )
|
||||||
{
|
{
|
||||||
for ( S32 i = 0; i < mShape->details.size(); i++ )
|
for ( S32 i = 0; i < mShape->mDetails.size(); i++ )
|
||||||
{
|
{
|
||||||
if ( mShape->details[i].subShapeNum < 0 )
|
if ( mShape->mDetails[i].subShapeNum < 0 )
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -1597,10 +1597,10 @@ DefineTSShapeConstructorMethod( getImposterSettings, const char*, ( S32 index ),
|
||||||
" echo( \"Imposter settings: \" @ %this.getImposterSettings( %index ) );\n"
|
" echo( \"Imposter settings: \" @ %this.getImposterSettings( %index ) );\n"
|
||||||
"@endtsexample\n" )
|
"@endtsexample\n" )
|
||||||
{
|
{
|
||||||
CHECK_INDEX_IN_RANGE( getImposterSettings, index, mShape->details.size(), "" );
|
CHECK_INDEX_IN_RANGE( getImposterSettings, index, mShape->mDetails.size(), "" );
|
||||||
|
|
||||||
// Return information about the detail level
|
// Return information about the detail level
|
||||||
const TSShape::Detail& det = mShape->details[index];
|
const TSShape::Detail& det = mShape->mDetails[index];
|
||||||
|
|
||||||
char* returnBuffer = Con::getReturnBuffer(512);
|
char* returnBuffer = Con::getReturnBuffer(512);
|
||||||
dSprintf(returnBuffer, 512, "%d\t%d\t%d\t%d\t%d\t%d\t%g",
|
dSprintf(returnBuffer, 512, "%d\t%d\t%d\t%d\t%d\t%d\t%g",
|
||||||
|
|
@ -1670,7 +1670,7 @@ DefineTSShapeConstructorMethod( getSequenceCount, S32, (),, (), 0,
|
||||||
"Get the total number of sequences in the shape.\n"
|
"Get the total number of sequences in the shape.\n"
|
||||||
"@return the number of sequences in the shape\n\n" )
|
"@return the number of sequences in the shape\n\n" )
|
||||||
{
|
{
|
||||||
return mShape->sequences.size();
|
return mShape->mSequences.size();
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getSequenceIndex, S32, ( const char* name),,
|
DefineTSShapeConstructorMethod( getSequenceIndex, S32, ( const char* name),,
|
||||||
|
|
@ -1699,9 +1699,9 @@ DefineTSShapeConstructorMethod( getSequenceName, const char*, ( S32 index ),,
|
||||||
" echo( %i SPC %this.getSequenceName( %i ) );\n"
|
" echo( %i SPC %this.getSequenceName( %i ) );\n"
|
||||||
"@endtsexample\n" )
|
"@endtsexample\n" )
|
||||||
{
|
{
|
||||||
CHECK_INDEX_IN_RANGE( getSequenceName, index, mShape->sequences.size(), "" );
|
CHECK_INDEX_IN_RANGE( getSequenceName, index, mShape->mSequences.size(), "" );
|
||||||
|
|
||||||
return mShape->getName( mShape->sequences[index].nameIndex );
|
return mShape->getName( mShape->mSequences[index].nameIndex );
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DefineTSShapeConstructorMethod( getSequenceSource, const char*, ( const char* name ),,
|
DefineTSShapeConstructorMethod( getSequenceSource, const char*, ( const char* name ),,
|
||||||
|
|
@ -1789,12 +1789,12 @@ DefineTSShapeConstructorMethod( getSequenceGroundSpeed, const char*, ( const cha
|
||||||
Point3F trans(0,0,0), rot(0,0,0);
|
Point3F trans(0,0,0), rot(0,0,0);
|
||||||
if ( seq->numGroundFrames > 0 )
|
if ( seq->numGroundFrames > 0 )
|
||||||
{
|
{
|
||||||
const Point3F& p1 = mShape->groundTranslations[seq->firstGroundFrame];
|
const Point3F& p1 = mShape->mGroundTranslations[seq->firstGroundFrame];
|
||||||
const Point3F& p2 = mShape->groundTranslations[seq->firstGroundFrame + 1];
|
const Point3F& p2 = mShape->mGroundTranslations[seq->firstGroundFrame + 1];
|
||||||
trans = p2 - p1;
|
trans = p2 - p1;
|
||||||
|
|
||||||
QuatF r1 = mShape->groundRotations[seq->firstGroundFrame].getQuatF();
|
QuatF r1 = mShape->mGroundRotations[seq->firstGroundFrame].getQuatF();
|
||||||
QuatF r2 = mShape->groundRotations[seq->firstGroundFrame + 1].getQuatF();
|
QuatF r2 = mShape->mGroundRotations[seq->firstGroundFrame + 1].getQuatF();
|
||||||
r2 -= r1;
|
r2 -= r1;
|
||||||
|
|
||||||
MatrixF mat;
|
MatrixF mat;
|
||||||
|
|
@ -2032,7 +2032,7 @@ DefineTSShapeConstructorMethod( getTrigger, const char*, ( const char* name, S32
|
||||||
|
|
||||||
CHECK_INDEX_IN_RANGE( getTrigger, index, seq->numTriggers, "" );
|
CHECK_INDEX_IN_RANGE( getTrigger, index, seq->numTriggers, "" );
|
||||||
|
|
||||||
const TSShape::Trigger& trig = mShape->triggers[seq->firstTrigger + index];
|
const TSShape::Trigger& trig = mShape->mTriggers[seq->firstTrigger + index];
|
||||||
S32 frame = trig.pos * seq->numKeyframes;
|
S32 frame = trig.pos * seq->numKeyframes;
|
||||||
S32 state = getBinLog2(trig.state & TSShape::Trigger::StateMask) + 1;
|
S32 state = getBinLog2(trig.state & TSShape::Trigger::StateMask) + 1;
|
||||||
if (!(trig.state & TSShape::Trigger::StateOn))
|
if (!(trig.state & TSShape::Trigger::StateOn))
|
||||||
|
|
@ -2138,9 +2138,9 @@ void TSShapeConstructor::ChangeSet::write(TSShape* shape, Stream& stream, const
|
||||||
// Remove all __backup__ sequences (used during Shape Editing)
|
// Remove all __backup__ sequences (used during Shape Editing)
|
||||||
if (shape)
|
if (shape)
|
||||||
{
|
{
|
||||||
for (S32 i = 0; i < shape->sequences.size(); i++)
|
for (S32 i = 0; i < shape->mSequences.size(); i++)
|
||||||
{
|
{
|
||||||
const char* seqName = shape->getName( shape->sequences[i].nameIndex );
|
const char* seqName = shape->getName( shape->mSequences[i].nameIndex );
|
||||||
if ( dStrStartsWith( seqName, "__backup__" ) )
|
if ( dStrStartsWith( seqName, "__backup__" ) )
|
||||||
{
|
{
|
||||||
Command cmd( "removeSequence" );
|
Command cmd( "removeSequence" );
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -176,7 +176,7 @@ void TSShapeInstance::buildInstanceData(TSShape * _shape, bool loadMaterials)
|
||||||
mScaleCurrentlyAnimated = false;
|
mScaleCurrentlyAnimated = false;
|
||||||
|
|
||||||
if(loadMaterials)
|
if(loadMaterials)
|
||||||
setMaterialList(mShape->materialList);
|
setMaterialList(mShape->mMaterialList);
|
||||||
|
|
||||||
// set up node data
|
// set up node data
|
||||||
initNodeTransforms();
|
initNodeTransforms();
|
||||||
|
|
@ -185,7 +185,7 @@ void TSShapeInstance::buildInstanceData(TSShape * _shape, bool loadMaterials)
|
||||||
initMeshObjects();
|
initMeshObjects();
|
||||||
|
|
||||||
// set up subtree data
|
// set up subtree data
|
||||||
S32 ss = mShape->subShapeFirstNode.size(); // we have this many subtrees
|
S32 ss = mShape->mSubShapeFirstNode.size(); // we have this many subtrees
|
||||||
mDirtyFlags = new U32[ss];
|
mDirtyFlags = new U32[ss];
|
||||||
|
|
||||||
mGroundThread = NULL;
|
mGroundThread = NULL;
|
||||||
|
|
@ -201,18 +201,18 @@ void TSShapeInstance::buildInstanceData(TSShape * _shape, bool loadMaterials)
|
||||||
void TSShapeInstance::initNodeTransforms()
|
void TSShapeInstance::initNodeTransforms()
|
||||||
{
|
{
|
||||||
// set up node data
|
// set up node data
|
||||||
S32 numNodes = mShape->nodes.size();
|
S32 numNodes = mShape->mNodes.size();
|
||||||
mNodeTransforms.setSize(numNodes);
|
mNodeTransforms.setSize(numNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSShapeInstance::initMeshObjects()
|
void TSShapeInstance::initMeshObjects()
|
||||||
{
|
{
|
||||||
// add objects to trees
|
// add objects to trees
|
||||||
S32 numObjects = mShape->objects.size();
|
S32 numObjects = mShape->mObjects.size();
|
||||||
mMeshObjects.setSize(numObjects);
|
mMeshObjects.setSize(numObjects);
|
||||||
for (S32 i=0; i<numObjects; i++)
|
for (S32 i=0; i<numObjects; i++)
|
||||||
{
|
{
|
||||||
const TSObject * obj = &mShape->objects[i];
|
const TSObject * obj = &mShape->mObjects[i];
|
||||||
MeshObjectInstance * objInst = &mMeshObjects[i];
|
MeshObjectInstance * objInst = &mMeshObjects[i];
|
||||||
|
|
||||||
// hook up the object to it's node and transforms.
|
// hook up the object to it's node and transforms.
|
||||||
|
|
@ -221,7 +221,7 @@ void TSShapeInstance::initMeshObjects()
|
||||||
|
|
||||||
// set up list of meshes
|
// set up list of meshes
|
||||||
if (obj->numMeshes)
|
if (obj->numMeshes)
|
||||||
objInst->meshList = &mShape->meshes[obj->startMeshIndex];
|
objInst->meshList = &mShape->mMeshes[obj->startMeshIndex];
|
||||||
else
|
else
|
||||||
objInst->meshList = NULL;
|
objInst->meshList = NULL;
|
||||||
|
|
||||||
|
|
@ -328,7 +328,7 @@ void TSShapeInstance::renderDebugNormals( F32 normalScalar, S32 dl )
|
||||||
if ( dl < 0 )
|
if ( dl < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AssertFatal( dl >= 0 && dl < mShape->details.size(),
|
AssertFatal( dl >= 0 && dl < mShape->mDetails.size(),
|
||||||
"TSShapeInstance::renderDebugNormals() - Bad detail level!" );
|
"TSShapeInstance::renderDebugNormals() - Bad detail level!" );
|
||||||
|
|
||||||
static GFXStateBlockRef sb;
|
static GFXStateBlockRef sb;
|
||||||
|
|
@ -344,13 +344,13 @@ void TSShapeInstance::renderDebugNormals( F32 normalScalar, S32 dl )
|
||||||
}
|
}
|
||||||
GFX->setStateBlock( sb );
|
GFX->setStateBlock( sb );
|
||||||
|
|
||||||
const TSDetail *detail = &mShape->details[dl];
|
const TSDetail *detail = &mShape->mDetails[dl];
|
||||||
const S32 ss = detail->subShapeNum;
|
const S32 ss = detail->subShapeNum;
|
||||||
if ( ss < 0 )
|
if ( ss < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const S32 start = mShape->subShapeFirstObject[ss];
|
const S32 start = mShape->mSubShapeFirstObject[ss];
|
||||||
const S32 end = start + mShape->subShapeNumObjects[ss];
|
const S32 end = start + mShape->mSubShapeNumObjects[ss];
|
||||||
|
|
||||||
for ( S32 i = start; i < end; i++ )
|
for ( S32 i = start; i < end; i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -446,8 +446,8 @@ void TSShapeInstance::render( const TSRenderState &rdata )
|
||||||
// NOTE:
|
// NOTE:
|
||||||
// intraDL is at 1 when if shape were any closer to us we'd be at dl-1,
|
// intraDL is at 1 when if shape were any closer to us we'd be at dl-1,
|
||||||
// intraDL is at 0 when if shape were any farther away we'd be at dl+1
|
// intraDL is at 0 when if shape were any farther away we'd be at dl+1
|
||||||
F32 alphaOut = mShape->alphaOut[mCurrentDetailLevel];
|
F32 alphaOut = mShape->mAlphaOut[mCurrentDetailLevel];
|
||||||
F32 alphaIn = mShape->alphaIn[mCurrentDetailLevel];
|
F32 alphaIn = mShape->mAlphaIn[mCurrentDetailLevel];
|
||||||
F32 saveAA = mAlphaAlways ? mAlphaAlwaysValue : 1.0f;
|
F32 saveAA = mAlphaAlways ? mAlphaAlwaysValue : 1.0f;
|
||||||
|
|
||||||
/// This first case is the single detail level render.
|
/// This first case is the single detail level render.
|
||||||
|
|
@ -459,7 +459,7 @@ void TSShapeInstance::render( const TSRenderState &rdata )
|
||||||
// alpha=1-(intraDl-alphaOut)/alphaIn
|
// alpha=1-(intraDl-alphaOut)/alphaIn
|
||||||
|
|
||||||
// first draw next detail level
|
// first draw next detail level
|
||||||
if ( mCurrentDetailLevel + 1 < mShape->details.size() && mShape->details[ mCurrentDetailLevel + 1 ].size > 0.0f )
|
if ( mCurrentDetailLevel + 1 < mShape->mDetails.size() && mShape->mDetails[ mCurrentDetailLevel + 1 ].size > 0.0f )
|
||||||
{
|
{
|
||||||
setAlphaAlways( saveAA * ( alphaIn + alphaOut - mCurrentIntraDetailLevel ) / alphaIn );
|
setAlphaAlways( saveAA * ( alphaIn + alphaOut - mCurrentIntraDetailLevel ) / alphaIn );
|
||||||
render( rdata, mCurrentDetailLevel + 1, 0.0f );
|
render( rdata, mCurrentDetailLevel + 1, 0.0f );
|
||||||
|
|
@ -474,7 +474,7 @@ void TSShapeInstance::render( const TSRenderState &rdata )
|
||||||
// alpha = 1-intraDL/alphaOut
|
// alpha = 1-intraDL/alphaOut
|
||||||
|
|
||||||
// first draw next detail level
|
// first draw next detail level
|
||||||
if ( mCurrentDetailLevel + 1 < mShape->details.size() && mShape->details[ mCurrentDetailLevel + 1 ].size > 0.0f )
|
if ( mCurrentDetailLevel + 1 < mShape->mDetails.size() && mShape->mDetails[ mCurrentDetailLevel + 1 ].size > 0.0f )
|
||||||
render( rdata, mCurrentDetailLevel+1, 0.0f );
|
render( rdata, mCurrentDetailLevel+1, 0.0f );
|
||||||
|
|
||||||
setAlphaAlways( saveAA * mCurrentIntraDetailLevel / alphaOut );
|
setAlphaAlways( saveAA * mCurrentIntraDetailLevel / alphaOut );
|
||||||
|
|
@ -489,7 +489,7 @@ void TSShapeInstance::setMeshForceHidden( const char *meshName, bool hidden )
|
||||||
for ( ; iter != mMeshObjects.end(); iter++ )
|
for ( ; iter != mMeshObjects.end(); iter++ )
|
||||||
{
|
{
|
||||||
S32 nameIndex = iter->object->nameIndex;
|
S32 nameIndex = iter->object->nameIndex;
|
||||||
const char *name = mShape->names[ nameIndex ];
|
const char *name = mShape->mNames[ nameIndex ];
|
||||||
|
|
||||||
if ( dStrcmp( meshName, name ) == 0 )
|
if ( dStrcmp( meshName, name ) == 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -509,11 +509,11 @@ void TSShapeInstance::setMeshForceHidden( S32 meshIndex, bool hidden )
|
||||||
|
|
||||||
void TSShapeInstance::render( const TSRenderState &rdata, S32 dl, F32 intraDL )
|
void TSShapeInstance::render( const TSRenderState &rdata, S32 dl, F32 intraDL )
|
||||||
{
|
{
|
||||||
AssertFatal( dl >= 0 && dl < mShape->details.size(),"TSShapeInstance::render" );
|
AssertFatal( dl >= 0 && dl < mShape->mDetails.size(),"TSShapeInstance::render" );
|
||||||
|
|
||||||
S32 i;
|
S32 i;
|
||||||
|
|
||||||
const TSDetail * detail = &mShape->details[dl];
|
const TSDetail * detail = &mShape->mDetails[dl];
|
||||||
S32 ss = detail->subShapeNum;
|
S32 ss = detail->subShapeNum;
|
||||||
S32 od = detail->objectDetailNum;
|
S32 od = detail->objectDetailNum;
|
||||||
|
|
||||||
|
|
@ -523,14 +523,14 @@ void TSShapeInstance::render( const TSRenderState &rdata, S32 dl, F32 intraDL )
|
||||||
PROFILE_SCOPE( TSShapeInstance_RenderBillboards );
|
PROFILE_SCOPE( TSShapeInstance_RenderBillboards );
|
||||||
|
|
||||||
if ( !rdata.isNoRenderTranslucent() && ( TSLastDetail::smCanShadow || !rdata.getSceneState()->isShadowPass() ) )
|
if ( !rdata.isNoRenderTranslucent() && ( TSLastDetail::smCanShadow || !rdata.getSceneState()->isShadowPass() ) )
|
||||||
mShape->billboardDetails[ dl ]->render( rdata, mAlphaAlways ? mAlphaAlwaysValue : 1.0f );
|
mShape->mBillboardDetails[ dl ]->render( rdata, mAlphaAlways ? mAlphaAlwaysValue : 1.0f );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// run through the meshes
|
// run through the meshes
|
||||||
S32 start = rdata.isNoRenderNonTranslucent() ? mShape->subShapeFirstTranslucentObject[ss] : mShape->subShapeFirstObject[ss];
|
S32 start = rdata.isNoRenderNonTranslucent() ? mShape->mSubShapeFirstTranslucentObject[ss] : mShape->mSubShapeFirstObject[ss];
|
||||||
S32 end = rdata.isNoRenderTranslucent() ? mShape->subShapeFirstTranslucentObject[ss] : mShape->subShapeFirstObject[ss] + mShape->subShapeNumObjects[ss];
|
S32 end = rdata.isNoRenderTranslucent() ? mShape->mSubShapeFirstTranslucentObject[ss] : mShape->mSubShapeFirstObject[ss] + mShape->mSubShapeNumObjects[ss];
|
||||||
for (i=start; i<end; i++)
|
for (i=start; i<end; i++)
|
||||||
{
|
{
|
||||||
// following line is handy for debugging, to see what part of the shape that it is rendering
|
// following line is handy for debugging, to see what part of the shape that it is rendering
|
||||||
|
|
@ -613,7 +613,7 @@ S32 TSShapeInstance::setDetailFromDistance( const SceneRenderState *state, F32 s
|
||||||
|
|
||||||
// We're inlining SceneRenderState::projectRadius here to
|
// We're inlining SceneRenderState::projectRadius here to
|
||||||
// skip the unnessasary divide by zero protection.
|
// skip the unnessasary divide by zero protection.
|
||||||
F32 pixelRadius = ( mShape->radius / scaledDistance ) * state->getWorldToScreenScale().y * pixelScale;
|
F32 pixelRadius = ( mShape->mRadius / scaledDistance ) * state->getWorldToScreenScale().y * pixelScale;
|
||||||
F32 pixelSize = pixelRadius * smDetailAdjust;
|
F32 pixelSize = pixelRadius * smDetailAdjust;
|
||||||
|
|
||||||
if ( pixelSize < smSmallestVisiblePixelSize ) {
|
if ( pixelSize < smSmallestVisiblePixelSize ) {
|
||||||
|
|
@ -671,7 +671,7 @@ S32 TSShapeInstance::setDetailFromScreenError( F32 errorTolerance )
|
||||||
if ( mShape->mSmallestVisibleDL < 0 )
|
if ( mShape->mSmallestVisibleDL < 0 )
|
||||||
prevErr = 0.0f;
|
prevErr = 0.0f;
|
||||||
else
|
else
|
||||||
prevErr = 10.0f * mShape->details[mShape->mSmallestVisibleDL].averageError * 20.0f;
|
prevErr = 10.0f * mShape->mDetails[mShape->mSmallestVisibleDL].averageError * 20.0f;
|
||||||
if ( mShape->mSmallestVisibleDL < 0 || prevErr < errorTolerance )
|
if ( mShape->mSmallestVisibleDL < 0 || prevErr < errorTolerance )
|
||||||
{
|
{
|
||||||
// draw last detail
|
// draw last detail
|
||||||
|
|
@ -688,7 +688,7 @@ S32 TSShapeInstance::setDetailFromScreenError( F32 errorTolerance )
|
||||||
// we use the next highest detail (higher error)
|
// we use the next highest detail (higher error)
|
||||||
for (S32 i = mShape->mSmallestVisibleDL; i >= 0; i-- )
|
for (S32 i = mShape->mSmallestVisibleDL; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
F32 err0 = 10.0f * mShape->details[i].averageError;
|
F32 err0 = 10.0f * mShape->mDetails[i].averageError;
|
||||||
if ( err0 < errorTolerance )
|
if ( err0 < errorTolerance )
|
||||||
{
|
{
|
||||||
// ok, stop here
|
// ok, stop here
|
||||||
|
|
@ -776,10 +776,10 @@ void TSShapeInstance::prepCollision()
|
||||||
PROFILE_SCOPE( TSShapeInstance_PrepCollision );
|
PROFILE_SCOPE( TSShapeInstance_PrepCollision );
|
||||||
|
|
||||||
// Iterate over all our meshes and call prepCollision on them...
|
// Iterate over all our meshes and call prepCollision on them...
|
||||||
for(S32 i=0; i<mShape->meshes.size(); i++)
|
for(S32 i=0; i<mShape->mMeshes.size(); i++)
|
||||||
{
|
{
|
||||||
if(mShape->meshes[i])
|
if(mShape->mMeshes[i])
|
||||||
mShape->meshes[i]->prepOpcodeCollision();
|
mShape->mMeshes[i]->prepOpcodeCollision();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -531,7 +531,7 @@ protected:
|
||||||
void deltaGround1(TSThread *, F32 start, F32 end, MatrixF& mat);
|
void deltaGround1(TSThread *, F32 start, F32 end, MatrixF& mat);
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
U32 getNumDetails() const { return mShape ? mShape->details.size() : 0; }
|
U32 getNumDetails() const { return mShape ? mShape->mDetails.size() : 0; }
|
||||||
|
|
||||||
S32 getCurrentDetail() const { return mCurrentDetailLevel; }
|
S32 getCurrentDetail() const { return mCurrentDetailLevel; }
|
||||||
|
|
||||||
|
|
@ -785,7 +785,7 @@ public:
|
||||||
TSShapeInstance * getShapeInstance() { return mShapeInstance; }
|
TSShapeInstance * getShapeInstance() { return mShapeInstance; }
|
||||||
bool hasSequence() const { return sequence >= 0; }
|
bool hasSequence() const { return sequence >= 0; }
|
||||||
U32 getSeqIndex() const { return sequence; }
|
U32 getSeqIndex() const { return sequence; }
|
||||||
const TSSequence* getSequence() const { return &(mShapeInstance->mShape->sequences[sequence]); }
|
const TSSequence* getSequence() const { return &(mShapeInstance->mShape->mSequences[sequence]); }
|
||||||
const String& getSequenceName() const { return mShapeInstance->mShape->getSequenceName(sequence); }
|
const String& getSequenceName() const { return mShapeInstance->mShape->getSequenceName(sequence); }
|
||||||
S32 operator<(const TSThread &) const;
|
S32 operator<(const TSThread &) const;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ void TSShape::fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * d
|
||||||
{
|
{
|
||||||
#if !defined(TORQUE_MAX_LIB)
|
#if !defined(TORQUE_MAX_LIB)
|
||||||
// this method not necessary in exporter, and a couple lines won't compile for exporter
|
// this method not necessary in exporter, and a couple lines won't compile for exporter
|
||||||
if (!objects.address() || !meshes.address() || !numSkins)
|
if (!mObjects.address() || !mMeshes.address() || !numSkins)
|
||||||
// not ready for this yet, will catch it on the next pass
|
// not ready for this yet, will catch it on the next pass
|
||||||
return;
|
return;
|
||||||
S32 numObjects = objects.size();
|
S32 numObjects = mObjects.size();
|
||||||
TSObject * newObjects = objects.address() + objects.size();
|
TSObject * newObjects = mObjects.address() + mObjects.size();
|
||||||
TSSkinMesh ** skins = (TSSkinMesh**)&meshes[numMeshes];
|
TSSkinMesh ** skins = (TSSkinMesh**)&mMeshes[numMeshes];
|
||||||
Vector<TSSkinMesh*> skinsCopy;
|
Vector<TSSkinMesh*> skinsCopy;
|
||||||
// Note: newObjects has as much free space as we need, so we just need to keep track of the
|
// Note: newObjects has as much free space as we need, so we just need to keep track of the
|
||||||
// number of objects we use and then update objects.size
|
// number of objects we use and then update objects.size
|
||||||
|
|
@ -52,7 +52,7 @@ void TSShape::fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * d
|
||||||
while (skinsUsed<numSkins-emptySkins)
|
while (skinsUsed<numSkins-emptySkins)
|
||||||
{
|
{
|
||||||
TSObject & object = newObjects[numSkinObjects++];
|
TSObject & object = newObjects[numSkinObjects++];
|
||||||
objects.increment();
|
mObjects.increment();
|
||||||
object.nameIndex = 0; // no name
|
object.nameIndex = 0; // no name
|
||||||
object.numMeshes = 0;
|
object.numMeshes = 0;
|
||||||
object.startMeshIndex = numMeshes + skinsCopy.size();
|
object.startMeshIndex = numMeshes + skinsCopy.size();
|
||||||
|
|
@ -92,29 +92,29 @@ void TSShape::fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * d
|
||||||
// if no meshes, don't need object
|
// if no meshes, don't need object
|
||||||
if (!object.numMeshes)
|
if (!object.numMeshes)
|
||||||
{
|
{
|
||||||
objects.decrement();
|
mObjects.decrement();
|
||||||
numSkinObjects--;
|
numSkinObjects--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dMemcpy(skins,skinsCopy.address(),skinsCopy.size()*sizeof(TSSkinMesh*));
|
dMemcpy(skins,skinsCopy.address(),skinsCopy.size()*sizeof(TSSkinMesh*));
|
||||||
|
|
||||||
if (subShapeFirstObject.size()==1)
|
if (mSubShapeFirstObject.size()==1)
|
||||||
// as long as only one subshape, we'll now be rendered
|
// as long as only one subshape, we'll now be rendered
|
||||||
subShapeNumObjects[0] += numSkinObjects;
|
mSubShapeNumObjects[0] += numSkinObjects;
|
||||||
|
|
||||||
// now for something ugly -- we've added somoe objects to hold the skins...
|
// now for something ugly -- we've added somoe objects to hold the skins...
|
||||||
// now we have to add default states for those objects
|
// now we have to add default states for those objects
|
||||||
// we also have to increment base states on all the sequences that are loaded
|
// we also have to increment base states on all the sequences that are loaded
|
||||||
dMemmove(objectStates.address()+numObjects+numSkinObjects,objectStates.address()+numObjects,(objectStates.size()-numObjects)*sizeof(ObjectState));
|
dMemmove(mObjectStates.address()+numObjects+numSkinObjects,mObjectStates.address()+numObjects,(mObjectStates.size()-numObjects)*sizeof(ObjectState));
|
||||||
for (i=numObjects; i<numObjects+numSkinObjects; i++)
|
for (i=numObjects; i<numObjects+numSkinObjects; i++)
|
||||||
{
|
{
|
||||||
objectStates[i].vis=1.0f;
|
mObjectStates[i].vis=1.0f;
|
||||||
objectStates[i].frameIndex=0;
|
mObjectStates[i].frameIndex=0;
|
||||||
objectStates[i].matFrameIndex=0;
|
mObjectStates[i].matFrameIndex=0;
|
||||||
}
|
}
|
||||||
for (i=0;i<sequences.size();i++)
|
for (i=0;i<mSequences.size();i++)
|
||||||
{
|
{
|
||||||
sequences[i].baseObjectState += numSkinObjects;
|
mSequences[i].baseObjectState += numSkinObjects;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -197,10 +197,10 @@ void TSShape::exportSequences(Stream * s)
|
||||||
|
|
||||||
// write node names
|
// write node names
|
||||||
// -- this is how we will map imported sequence nodes to shape nodes
|
// -- this is how we will map imported sequence nodes to shape nodes
|
||||||
sz = nodes.size();
|
sz = mNodes.size();
|
||||||
s->write(sz);
|
s->write(sz);
|
||||||
for (i=0;i<nodes.size();i++)
|
for (i=0;i<mNodes.size();i++)
|
||||||
writeName(s,nodes[i].nameIndex);
|
writeName(s,mNodes[i].nameIndex);
|
||||||
|
|
||||||
// legacy write -- write zero objects, don't pretend to support object export anymore
|
// legacy write -- write zero objects, don't pretend to support object export anymore
|
||||||
s->write(0);
|
s->write(0);
|
||||||
|
|
@ -208,71 +208,71 @@ void TSShape::exportSequences(Stream * s)
|
||||||
// on import, we will need to adjust keyframe data based on number of
|
// on import, we will need to adjust keyframe data based on number of
|
||||||
// nodes/objects in this shape...number of nodes can be inferred from
|
// nodes/objects in this shape...number of nodes can be inferred from
|
||||||
// above, but number of objects cannot be. Write that quantity here:
|
// above, but number of objects cannot be. Write that quantity here:
|
||||||
s->write(objects.size());
|
s->write(mObjects.size());
|
||||||
|
|
||||||
// write node states -- skip default node states
|
// write node states -- skip default node states
|
||||||
s->write(nodeRotations.size());
|
s->write(mNodeRotations.size());
|
||||||
for (i=0;i<nodeRotations.size();i++)
|
for (i=0;i<mNodeRotations.size();i++)
|
||||||
{
|
{
|
||||||
s->write(nodeRotations[i].x);
|
s->write(mNodeRotations[i].x);
|
||||||
s->write(nodeRotations[i].y);
|
s->write(mNodeRotations[i].y);
|
||||||
s->write(nodeRotations[i].z);
|
s->write(mNodeRotations[i].z);
|
||||||
s->write(nodeRotations[i].w);
|
s->write(mNodeRotations[i].w);
|
||||||
}
|
}
|
||||||
s->write(nodeTranslations.size());
|
s->write(mNodeTranslations.size());
|
||||||
for (i=0;i<nodeTranslations.size(); i++)
|
for (i=0;i<mNodeTranslations.size(); i++)
|
||||||
{
|
{
|
||||||
s->write(nodeTranslations[i].x);
|
s->write(mNodeTranslations[i].x);
|
||||||
s->write(nodeTranslations[i].y);
|
s->write(mNodeTranslations[i].y);
|
||||||
s->write(nodeTranslations[i].z);
|
s->write(mNodeTranslations[i].z);
|
||||||
}
|
}
|
||||||
s->write(nodeUniformScales.size());
|
s->write(mNodeUniformScales.size());
|
||||||
for (i=0;i<nodeUniformScales.size();i++)
|
for (i=0;i<mNodeUniformScales.size();i++)
|
||||||
s->write(nodeUniformScales[i]);
|
s->write(mNodeUniformScales[i]);
|
||||||
s->write(nodeAlignedScales.size());
|
s->write(mNodeAlignedScales.size());
|
||||||
for (i=0;i<nodeAlignedScales.size();i++)
|
for (i=0;i<mNodeAlignedScales.size();i++)
|
||||||
{
|
{
|
||||||
s->write(nodeAlignedScales[i].x);
|
s->write(mNodeAlignedScales[i].x);
|
||||||
s->write(nodeAlignedScales[i].y);
|
s->write(mNodeAlignedScales[i].y);
|
||||||
s->write(nodeAlignedScales[i].z);
|
s->write(mNodeAlignedScales[i].z);
|
||||||
}
|
}
|
||||||
s->write(nodeArbitraryScaleRots.size());
|
s->write(mNodeArbitraryScaleRots.size());
|
||||||
for (i=0;i<nodeArbitraryScaleRots.size();i++)
|
for (i=0;i<mNodeArbitraryScaleRots.size();i++)
|
||||||
{
|
{
|
||||||
s->write(nodeArbitraryScaleRots[i].x);
|
s->write(mNodeArbitraryScaleRots[i].x);
|
||||||
s->write(nodeArbitraryScaleRots[i].y);
|
s->write(mNodeArbitraryScaleRots[i].y);
|
||||||
s->write(nodeArbitraryScaleRots[i].z);
|
s->write(mNodeArbitraryScaleRots[i].z);
|
||||||
s->write(nodeArbitraryScaleRots[i].w);
|
s->write(mNodeArbitraryScaleRots[i].w);
|
||||||
}
|
}
|
||||||
for (i=0;i<nodeArbitraryScaleFactors.size();i++)
|
for (i=0;i<mNodeArbitraryScaleFactors.size();i++)
|
||||||
{
|
{
|
||||||
s->write(nodeArbitraryScaleFactors[i].x);
|
s->write(mNodeArbitraryScaleFactors[i].x);
|
||||||
s->write(nodeArbitraryScaleFactors[i].y);
|
s->write(mNodeArbitraryScaleFactors[i].y);
|
||||||
s->write(nodeArbitraryScaleFactors[i].z);
|
s->write(mNodeArbitraryScaleFactors[i].z);
|
||||||
}
|
}
|
||||||
s->write(groundTranslations.size());
|
s->write(mGroundTranslations.size());
|
||||||
for (i=0;i<groundTranslations.size();i++)
|
for (i=0;i<mGroundTranslations.size();i++)
|
||||||
{
|
{
|
||||||
s->write(groundTranslations[i].x);
|
s->write(mGroundTranslations[i].x);
|
||||||
s->write(groundTranslations[i].y);
|
s->write(mGroundTranslations[i].y);
|
||||||
s->write(groundTranslations[i].z);
|
s->write(mGroundTranslations[i].z);
|
||||||
}
|
}
|
||||||
for (i=0;i<groundRotations.size();i++)
|
for (i=0;i<mGroundRotations.size();i++)
|
||||||
{
|
{
|
||||||
s->write(groundRotations[i].x);
|
s->write(mGroundRotations[i].x);
|
||||||
s->write(groundRotations[i].y);
|
s->write(mGroundRotations[i].y);
|
||||||
s->write(groundRotations[i].z);
|
s->write(mGroundRotations[i].z);
|
||||||
s->write(groundRotations[i].w);
|
s->write(mGroundRotations[i].w);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write object states -- legacy..no object states
|
// write object states -- legacy..no object states
|
||||||
s->write((S32)0);
|
s->write((S32)0);
|
||||||
|
|
||||||
// write sequences
|
// write sequences
|
||||||
s->write(sequences.size());
|
s->write(mSequences.size());
|
||||||
for (i=0;i<sequences.size();i++)
|
for (i=0;i<mSequences.size();i++)
|
||||||
{
|
{
|
||||||
Sequence & seq = sequences[i];
|
Sequence & seq = mSequences[i];
|
||||||
|
|
||||||
// first write sequence name
|
// first write sequence name
|
||||||
writeName(s,seq.nameIndex);
|
writeName(s,seq.nameIndex);
|
||||||
|
|
@ -282,11 +282,11 @@ void TSShape::exportSequences(Stream * s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// write out all the triggers...
|
// write out all the triggers...
|
||||||
s->write(triggers.size());
|
s->write(mTriggers.size());
|
||||||
for (i=0; i<triggers.size(); i++)
|
for (i=0; i<mTriggers.size(); i++)
|
||||||
{
|
{
|
||||||
s->write(triggers[i].state);
|
s->write(mTriggers[i].state);
|
||||||
s->write(triggers[i].pos);
|
s->write(mTriggers[i].pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -303,9 +303,9 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save
|
||||||
s->write(smVersion);
|
s->write(smVersion);
|
||||||
|
|
||||||
// write node names
|
// write node names
|
||||||
s->write( nodes.size() );
|
s->write( mNodes.size() );
|
||||||
for ( S32 i = 0; i < nodes.size(); i++ )
|
for ( S32 i = 0; i < mNodes.size(); i++ )
|
||||||
writeName( s, nodes[i].nameIndex );
|
writeName( s, mNodes[i].nameIndex );
|
||||||
|
|
||||||
// legacy write -- write zero objects, don't pretend to support object export anymore
|
// legacy write -- write zero objects, don't pretend to support object export anymore
|
||||||
s->write( (S32)0 );
|
s->write( (S32)0 );
|
||||||
|
|
@ -313,26 +313,26 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save
|
||||||
// on import, we will need to adjust keyframe data based on number of
|
// on import, we will need to adjust keyframe data based on number of
|
||||||
// nodes/objects in this shape...number of nodes can be inferred from
|
// nodes/objects in this shape...number of nodes can be inferred from
|
||||||
// above, but number of objects cannot be. Write that quantity here:
|
// above, but number of objects cannot be. Write that quantity here:
|
||||||
s->write( objects.size() );
|
s->write( mObjects.size() );
|
||||||
|
|
||||||
// write node states -- skip default node states
|
// write node states -- skip default node states
|
||||||
S32 count = seq.rotationMatters.count() * seq.numKeyframes;
|
S32 count = seq.rotationMatters.count() * seq.numKeyframes;
|
||||||
s->write( count );
|
s->write( count );
|
||||||
for ( S32 i = seq.baseRotation; i < seq.baseRotation + count; i++ )
|
for ( S32 i = seq.baseRotation; i < seq.baseRotation + count; i++ )
|
||||||
{
|
{
|
||||||
s->write( nodeRotations[i].x );
|
s->write( mNodeRotations[i].x );
|
||||||
s->write( nodeRotations[i].y );
|
s->write( mNodeRotations[i].y );
|
||||||
s->write( nodeRotations[i].z );
|
s->write( mNodeRotations[i].z );
|
||||||
s->write( nodeRotations[i].w );
|
s->write( mNodeRotations[i].w );
|
||||||
}
|
}
|
||||||
|
|
||||||
count = seq.translationMatters.count() * seq.numKeyframes;
|
count = seq.translationMatters.count() * seq.numKeyframes;
|
||||||
s->write( count );
|
s->write( count );
|
||||||
for ( S32 i = seq.baseTranslation; i < seq.baseTranslation + count; i++ )
|
for ( S32 i = seq.baseTranslation; i < seq.baseTranslation + count; i++ )
|
||||||
{
|
{
|
||||||
s->write( nodeTranslations[i].x );
|
s->write( mNodeTranslations[i].x );
|
||||||
s->write( nodeTranslations[i].y );
|
s->write( mNodeTranslations[i].y );
|
||||||
s->write( nodeTranslations[i].z );
|
s->write( mNodeTranslations[i].z );
|
||||||
}
|
}
|
||||||
|
|
||||||
count = seq.scaleMatters.count() * seq.numKeyframes;
|
count = seq.scaleMatters.count() * seq.numKeyframes;
|
||||||
|
|
@ -340,7 +340,7 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save
|
||||||
{
|
{
|
||||||
s->write( count );
|
s->write( count );
|
||||||
for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ )
|
for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ )
|
||||||
s->write( nodeUniformScales[i] );
|
s->write( mNodeUniformScales[i] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
s->write( (S32)0 );
|
s->write( (S32)0 );
|
||||||
|
|
@ -350,9 +350,9 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save
|
||||||
s->write( count );
|
s->write( count );
|
||||||
for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ )
|
for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ )
|
||||||
{
|
{
|
||||||
s->write( nodeAlignedScales[i].x );
|
s->write( mNodeAlignedScales[i].x );
|
||||||
s->write( nodeAlignedScales[i].y );
|
s->write( mNodeAlignedScales[i].y );
|
||||||
s->write( nodeAlignedScales[i].z );
|
s->write( mNodeAlignedScales[i].z );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -363,16 +363,16 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save
|
||||||
s->write( count );
|
s->write( count );
|
||||||
for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ )
|
for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ )
|
||||||
{
|
{
|
||||||
s->write( nodeArbitraryScaleRots[i].x );
|
s->write( mNodeArbitraryScaleRots[i].x );
|
||||||
s->write( nodeArbitraryScaleRots[i].y );
|
s->write( mNodeArbitraryScaleRots[i].y );
|
||||||
s->write( nodeArbitraryScaleRots[i].z );
|
s->write( mNodeArbitraryScaleRots[i].z );
|
||||||
s->write( nodeArbitraryScaleRots[i].w );
|
s->write( mNodeArbitraryScaleRots[i].w );
|
||||||
}
|
}
|
||||||
for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ )
|
for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ )
|
||||||
{
|
{
|
||||||
s->write( nodeArbitraryScaleFactors[i].x );
|
s->write( mNodeArbitraryScaleFactors[i].x );
|
||||||
s->write( nodeArbitraryScaleFactors[i].y );
|
s->write( mNodeArbitraryScaleFactors[i].y );
|
||||||
s->write( nodeArbitraryScaleFactors[i].z );
|
s->write( mNodeArbitraryScaleFactors[i].z );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -381,16 +381,16 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save
|
||||||
s->write( seq.numGroundFrames );
|
s->write( seq.numGroundFrames );
|
||||||
for ( S32 i = seq.firstGroundFrame; i < seq.firstGroundFrame + seq.numGroundFrames; i++ )
|
for ( S32 i = seq.firstGroundFrame; i < seq.firstGroundFrame + seq.numGroundFrames; i++ )
|
||||||
{
|
{
|
||||||
s->write( groundTranslations[i].x );
|
s->write( mGroundTranslations[i].x );
|
||||||
s->write( groundTranslations[i].y );
|
s->write( mGroundTranslations[i].y );
|
||||||
s->write( groundTranslations[i].z );
|
s->write( mGroundTranslations[i].z );
|
||||||
}
|
}
|
||||||
for ( S32 i = seq.firstGroundFrame; i < seq.firstGroundFrame + seq.numGroundFrames; i++ )
|
for ( S32 i = seq.firstGroundFrame; i < seq.firstGroundFrame + seq.numGroundFrames; i++ )
|
||||||
{
|
{
|
||||||
s->write( groundRotations[i].x );
|
s->write( mGroundRotations[i].x );
|
||||||
s->write( groundRotations[i].y );
|
s->write( mGroundRotations[i].y );
|
||||||
s->write( groundRotations[i].z );
|
s->write( mGroundRotations[i].z );
|
||||||
s->write( groundRotations[i].w );
|
s->write( mGroundRotations[i].w );
|
||||||
}
|
}
|
||||||
|
|
||||||
// write object states -- legacy..no object states
|
// write object states -- legacy..no object states
|
||||||
|
|
@ -417,8 +417,8 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save
|
||||||
s->write( seq.numTriggers );
|
s->write( seq.numTriggers );
|
||||||
for ( S32 i = seq.firstTrigger; i < seq.firstTrigger + seq.numTriggers; i++ )
|
for ( S32 i = seq.firstTrigger; i < seq.firstTrigger + seq.numTriggers; i++ )
|
||||||
{
|
{
|
||||||
s->write( triggers[i].state );
|
s->write( mTriggers[i].state );
|
||||||
s->write( triggers[i].pos );
|
s->write( mTriggers[i].pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
smVersion = currentVersion;
|
smVersion = currentVersion;
|
||||||
|
|
@ -460,7 +460,7 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
|
||||||
|
|
||||||
for (i=0;i<sz;i++)
|
for (i=0;i<sz;i++)
|
||||||
{
|
{
|
||||||
U32 startSize = names.size();
|
U32 startSize = mNames.size();
|
||||||
S32 nameIndex = readName(s,true);
|
S32 nameIndex = readName(s,true);
|
||||||
|
|
||||||
nodeMap[i] = findNode(nameIndex);
|
nodeMap[i] = findNode(nameIndex);
|
||||||
|
|
@ -468,12 +468,12 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
|
||||||
if (nodeMap[i] < 0)
|
if (nodeMap[i] < 0)
|
||||||
{
|
{
|
||||||
// node found in sequence but not shape => remove the added node name
|
// node found in sequence but not shape => remove the added node name
|
||||||
if (names.size() != startSize)
|
if (mNames.size() != startSize)
|
||||||
{
|
{
|
||||||
names.decrement();
|
mNames.decrement();
|
||||||
|
|
||||||
if (names.size() != startSize)
|
if (mNames.size() != startSize)
|
||||||
Con::errorf(ConsoleLogEntry::General, "TSShape::importSequence: failed to remove unused node correctly for dsq %s.", names[nameIndex].c_str(), sequencePath.c_str());
|
Con::errorf(ConsoleLogEntry::General, "TSShape::importSequence: failed to remove unused node correctly for dsq %s.", mNames[nameIndex].c_str(), sequencePath.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,9 +487,9 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
|
||||||
s->read(&oldShapeNumObjects);
|
s->read(&oldShapeNumObjects);
|
||||||
|
|
||||||
// adjust all the new keyframes
|
// adjust all the new keyframes
|
||||||
S32 adjNodeRots = smReadVersion<22 ? nodeRotations.size() - nodeMap.size() : nodeRotations.size();
|
S32 adjNodeRots = smReadVersion<22 ? mNodeRotations.size() - nodeMap.size() : mNodeRotations.size();
|
||||||
S32 adjNodeTrans = smReadVersion<22 ? nodeTranslations.size() - nodeMap.size() : nodeTranslations.size();
|
S32 adjNodeTrans = smReadVersion<22 ? mNodeTranslations.size() - nodeMap.size() : mNodeTranslations.size();
|
||||||
S32 adjGroundStates = smReadVersion<22 ? 0 : groundTranslations.size(); // groundTrans==groundRot
|
S32 adjGroundStates = smReadVersion<22 ? 0 : mGroundTranslations.size(); // groundTrans==groundRot
|
||||||
|
|
||||||
// Read the node states into temporary vectors, then use the
|
// Read the node states into temporary vectors, then use the
|
||||||
// nodeMap to discard unused transforms and map others to our nodes
|
// nodeMap to discard unused transforms and map others to our nodes
|
||||||
|
|
@ -551,21 +551,21 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
|
||||||
// ground transforms can be read directly into the shape (none will be
|
// ground transforms can be read directly into the shape (none will be
|
||||||
// discarded)
|
// discarded)
|
||||||
s->read(&sz);
|
s->read(&sz);
|
||||||
S32 oldSz = groundTranslations.size();
|
S32 oldSz = mGroundTranslations.size();
|
||||||
groundTranslations.setSize(sz+oldSz);
|
mGroundTranslations.setSize(sz+oldSz);
|
||||||
for (i=oldSz;i<sz+oldSz;i++)
|
for (i=oldSz;i<sz+oldSz;i++)
|
||||||
{
|
{
|
||||||
s->read(&groundTranslations[i].x);
|
s->read(&mGroundTranslations[i].x);
|
||||||
s->read(&groundTranslations[i].y);
|
s->read(&mGroundTranslations[i].y);
|
||||||
s->read(&groundTranslations[i].z);
|
s->read(&mGroundTranslations[i].z);
|
||||||
}
|
}
|
||||||
groundRotations.setSize(sz+oldSz);
|
mGroundRotations.setSize(sz+oldSz);
|
||||||
for (i=oldSz;i<sz+oldSz;i++)
|
for (i=oldSz;i<sz+oldSz;i++)
|
||||||
{
|
{
|
||||||
s->read(&groundRotations[i].x);
|
s->read(&mGroundRotations[i].x);
|
||||||
s->read(&groundRotations[i].y);
|
s->read(&mGroundRotations[i].y);
|
||||||
s->read(&groundRotations[i].z);
|
s->read(&mGroundRotations[i].z);
|
||||||
s->read(&groundRotations[i].w);
|
s->read(&mGroundRotations[i].w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -590,28 +590,28 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
|
||||||
|
|
||||||
// read sequences
|
// read sequences
|
||||||
s->read(&sz);
|
s->read(&sz);
|
||||||
S32 startSeqNum = sequences.size();
|
S32 startSeqNum = mSequences.size();
|
||||||
for (i=0;i<sz;i++)
|
for (i=0;i<sz;i++)
|
||||||
{
|
{
|
||||||
sequences.increment();
|
mSequences.increment();
|
||||||
Sequence & seq = sequences.last();
|
Sequence & seq = mSequences.last();
|
||||||
|
|
||||||
// read name
|
// read name
|
||||||
seq.nameIndex = readName(s,true);
|
seq.nameIndex = readName(s,true);
|
||||||
|
|
||||||
// read the rest of the sequence
|
// read the rest of the sequence
|
||||||
seq.read(s,false);
|
seq.read(s,false);
|
||||||
seq.baseRotation = nodeRotations.size();
|
seq.baseRotation = mNodeRotations.size();
|
||||||
seq.baseTranslation = nodeTranslations.size();
|
seq.baseTranslation = mNodeTranslations.size();
|
||||||
|
|
||||||
if (smReadVersion > 21)
|
if (smReadVersion > 21)
|
||||||
{
|
{
|
||||||
if (seq.animatesUniformScale())
|
if (seq.animatesUniformScale())
|
||||||
seq.baseScale = nodeUniformScales.size();
|
seq.baseScale = mNodeUniformScales.size();
|
||||||
else if (seq.animatesAlignedScale())
|
else if (seq.animatesAlignedScale())
|
||||||
seq.baseScale = nodeAlignedScales.size();
|
seq.baseScale = mNodeAlignedScales.size();
|
||||||
else if (seq.animatesArbitraryScale())
|
else if (seq.animatesArbitraryScale())
|
||||||
seq.baseScale = nodeArbitraryScaleFactors.size();
|
seq.baseScale = mNodeArbitraryScaleFactors.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// remap the node matters arrays
|
// remap the node matters arrays
|
||||||
|
|
@ -633,18 +633,18 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// resize node transform arrays
|
// resize node transform arrays
|
||||||
nodeTranslations.increment(newTransMembership.count() * seq.numKeyframes);
|
mNodeTranslations.increment(newTransMembership.count() * seq.numKeyframes);
|
||||||
nodeRotations.increment(newRotMembership.count() * seq.numKeyframes);
|
mNodeRotations.increment(newRotMembership.count() * seq.numKeyframes);
|
||||||
if (seq.flags & TSShape::ArbitraryScale)
|
if (seq.flags & TSShape::ArbitraryScale)
|
||||||
{
|
{
|
||||||
S32 scaleCount = newScaleMembership.count() * seq.numKeyframes;
|
S32 scaleCount = newScaleMembership.count() * seq.numKeyframes;
|
||||||
nodeArbitraryScaleRots.increment(scaleCount);
|
mNodeArbitraryScaleRots.increment(scaleCount);
|
||||||
nodeArbitraryScaleFactors.increment(scaleCount);
|
mNodeArbitraryScaleFactors.increment(scaleCount);
|
||||||
}
|
}
|
||||||
else if (seq.flags & TSShape::AlignedScale)
|
else if (seq.flags & TSShape::AlignedScale)
|
||||||
nodeAlignedScales.increment(newScaleMembership.count() * seq.numKeyframes);
|
mNodeAlignedScales.increment(newScaleMembership.count() * seq.numKeyframes);
|
||||||
else
|
else
|
||||||
nodeUniformScales.increment(newScaleMembership.count() * seq.numKeyframes);
|
mNodeUniformScales.increment(newScaleMembership.count() * seq.numKeyframes);
|
||||||
|
|
||||||
// remap node transforms from temporary arrays
|
// remap node transforms from temporary arrays
|
||||||
for (S32 j = 0; j < nodeMap.size(); j++)
|
for (S32 j = 0; j < nodeMap.size(); j++)
|
||||||
|
|
@ -656,13 +656,13 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
|
||||||
{
|
{
|
||||||
S32 src = seq.numKeyframes * seq.translationMatters.count(j);
|
S32 src = seq.numKeyframes * seq.translationMatters.count(j);
|
||||||
S32 dest = seq.baseTranslation + seq.numKeyframes * newTransMembership.count(nodeMap[j]);
|
S32 dest = seq.baseTranslation + seq.numKeyframes * newTransMembership.count(nodeMap[j]);
|
||||||
dCopyArray(&nodeTranslations[dest], &seqTranslations[src], seq.numKeyframes);
|
dCopyArray(&mNodeTranslations[dest], &seqTranslations[src], seq.numKeyframes);
|
||||||
}
|
}
|
||||||
if (newRotMembership.test(nodeMap[j]))
|
if (newRotMembership.test(nodeMap[j]))
|
||||||
{
|
{
|
||||||
S32 src = seq.numKeyframes * seq.rotationMatters.count(j);
|
S32 src = seq.numKeyframes * seq.rotationMatters.count(j);
|
||||||
S32 dest = seq.baseRotation + seq.numKeyframes * newRotMembership.count(nodeMap[j]);
|
S32 dest = seq.baseRotation + seq.numKeyframes * newRotMembership.count(nodeMap[j]);
|
||||||
dCopyArray(&nodeRotations[dest], &seqRotations[src], seq.numKeyframes);
|
dCopyArray(&mNodeRotations[dest], &seqRotations[src], seq.numKeyframes);
|
||||||
}
|
}
|
||||||
if (newScaleMembership.test(nodeMap[j]))
|
if (newScaleMembership.test(nodeMap[j]))
|
||||||
{
|
{
|
||||||
|
|
@ -670,13 +670,13 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
|
||||||
S32 dest = seq.baseScale + seq.numKeyframes * newScaleMembership.count(nodeMap[j]);
|
S32 dest = seq.baseScale + seq.numKeyframes * newScaleMembership.count(nodeMap[j]);
|
||||||
if (seq.flags & TSShape::ArbitraryScale)
|
if (seq.flags & TSShape::ArbitraryScale)
|
||||||
{
|
{
|
||||||
dCopyArray(&nodeArbitraryScaleRots[dest], &seqArbitraryScaleRots[src], seq.numKeyframes);
|
dCopyArray(&mNodeArbitraryScaleRots[dest], &seqArbitraryScaleRots[src], seq.numKeyframes);
|
||||||
dCopyArray(&nodeArbitraryScaleFactors[dest], &seqArbitraryScaleFactors[src], seq.numKeyframes);
|
dCopyArray(&mNodeArbitraryScaleFactors[dest], &seqArbitraryScaleFactors[src], seq.numKeyframes);
|
||||||
}
|
}
|
||||||
else if (seq.flags & TSShape::AlignedScale)
|
else if (seq.flags & TSShape::AlignedScale)
|
||||||
dCopyArray(&nodeAlignedScales[dest], &seqAlignedScales[src], seq.numKeyframes);
|
dCopyArray(&mNodeAlignedScales[dest], &seqAlignedScales[src], seq.numKeyframes);
|
||||||
else
|
else
|
||||||
dCopyArray(&nodeUniformScales[dest], &seqUniformScales[src], seq.numKeyframes);
|
dCopyArray(&mNodeUniformScales[dest], &seqUniformScales[src], seq.numKeyframes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -685,7 +685,7 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
|
||||||
seq.scaleMatters = newScaleMembership;
|
seq.scaleMatters = newScaleMembership;
|
||||||
|
|
||||||
// adjust trigger numbers...we'll read triggers after sequences...
|
// adjust trigger numbers...we'll read triggers after sequences...
|
||||||
seq.firstTrigger += triggers.size();
|
seq.firstTrigger += mTriggers.size();
|
||||||
|
|
||||||
// finally, adjust ground transform's nodes states
|
// finally, adjust ground transform's nodes states
|
||||||
seq.firstGroundFrame += adjGroundStates;
|
seq.firstGroundFrame += adjGroundStates;
|
||||||
|
|
@ -693,30 +693,30 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath)
|
||||||
|
|
||||||
if (smReadVersion<22)
|
if (smReadVersion<22)
|
||||||
{
|
{
|
||||||
for (i=startSeqNum; i<sequences.size(); i++)
|
for (i=startSeqNum; i<mSequences.size(); i++)
|
||||||
{
|
{
|
||||||
// move ground transform data to ground vectors
|
// move ground transform data to ground vectors
|
||||||
Sequence & seq = sequences[i];
|
Sequence & seq = mSequences[i];
|
||||||
S32 oldSz = groundTranslations.size();
|
S32 oldSz = mGroundTranslations.size();
|
||||||
groundTranslations.setSize(oldSz+seq.numGroundFrames);
|
mGroundTranslations.setSize(oldSz+seq.numGroundFrames);
|
||||||
groundRotations.setSize(oldSz+seq.numGroundFrames);
|
mGroundRotations.setSize(oldSz+seq.numGroundFrames);
|
||||||
for (S32 j=0;j<seq.numGroundFrames;j++)
|
for (S32 j=0;j<seq.numGroundFrames;j++)
|
||||||
{
|
{
|
||||||
groundTranslations[j+oldSz] = nodeTranslations[seq.firstGroundFrame+adjNodeTrans+j];
|
mGroundTranslations[j+oldSz] = mNodeTranslations[seq.firstGroundFrame+adjNodeTrans+j];
|
||||||
groundRotations[j+oldSz] = nodeRotations[seq.firstGroundFrame+adjNodeRots+j];
|
mGroundRotations[j+oldSz] = mNodeRotations[seq.firstGroundFrame+adjNodeRots+j];
|
||||||
}
|
}
|
||||||
seq.firstGroundFrame = oldSz;
|
seq.firstGroundFrame = oldSz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the new triggers
|
// add the new triggers
|
||||||
S32 oldSz = triggers.size();
|
S32 oldSz = mTriggers.size();
|
||||||
s->read(&sz);
|
s->read(&sz);
|
||||||
triggers.setSize(oldSz+sz);
|
mTriggers.setSize(oldSz+sz);
|
||||||
for (S32 i=0; i<sz;i++)
|
for (S32 i=0; i<sz;i++)
|
||||||
{
|
{
|
||||||
s->read(&triggers[i+oldSz].state);
|
s->read(&mTriggers[i+oldSz].state);
|
||||||
s->read(&triggers[i+oldSz].pos);
|
s->read(&mTriggers[i+oldSz].pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smInitOnRead)
|
if (smInitOnRead)
|
||||||
|
|
@ -846,7 +846,7 @@ void TSShape::writeName(Stream * s, S32 nameIndex)
|
||||||
{
|
{
|
||||||
const char * name = "";
|
const char * name = "";
|
||||||
if (nameIndex>=0)
|
if (nameIndex>=0)
|
||||||
name = names[nameIndex];
|
name = mNames[nameIndex];
|
||||||
S32 sz = (S32)dStrlen(name);
|
S32 sz = (S32)dStrlen(name);
|
||||||
s->write(sz);
|
s->write(sz);
|
||||||
if (sz)
|
if (sz)
|
||||||
|
|
@ -876,9 +876,9 @@ S32 TSShape::readName(Stream * s, bool addName)
|
||||||
|
|
||||||
if (nameIndex<0 && addName)
|
if (nameIndex<0 && addName)
|
||||||
{
|
{
|
||||||
nameIndex = names.size();
|
nameIndex = mNames.size();
|
||||||
names.increment();
|
mNames.increment();
|
||||||
names.last() = buffer;
|
mNames.last() = buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,8 +139,8 @@ void TSThread::getGround(F32 t, MatrixF * pMat)
|
||||||
// assumed to be ident. and not found in the list.
|
// assumed to be ident. and not found in the list.
|
||||||
if (frame)
|
if (frame)
|
||||||
{
|
{
|
||||||
p1 = &mShapeInstance->mShape->groundTranslations[getSequence()->firstGroundFrame + frame - 1];
|
p1 = &mShapeInstance->mShape->mGroundTranslations[getSequence()->firstGroundFrame + frame - 1];
|
||||||
q1 = &mShapeInstance->mShape->groundRotations[getSequence()->firstGroundFrame + frame - 1].getQuatF(&rot1);
|
q1 = &mShapeInstance->mShape->mGroundRotations[getSequence()->firstGroundFrame + frame - 1].getQuatF(&rot1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -149,8 +149,8 @@ void TSThread::getGround(F32 t, MatrixF * pMat)
|
||||||
}
|
}
|
||||||
|
|
||||||
// similar to above, ground keyframe number 'frame+1' is actually offset by 'frame'
|
// similar to above, ground keyframe number 'frame+1' is actually offset by 'frame'
|
||||||
p2 = &mShapeInstance->mShape->groundTranslations[getSequence()->firstGroundFrame + frame];
|
p2 = &mShapeInstance->mShape->mGroundTranslations[getSequence()->firstGroundFrame + frame];
|
||||||
q2 = &mShapeInstance->mShape->groundRotations[getSequence()->firstGroundFrame + frame].getQuatF(&rot2);
|
q2 = &mShapeInstance->mShape->mGroundRotations[getSequence()->firstGroundFrame + frame].getQuatF(&rot2);
|
||||||
|
|
||||||
QuatF q;
|
QuatF q;
|
||||||
Point3F p;
|
Point3F p;
|
||||||
|
|
@ -163,7 +163,7 @@ void TSThread::setSequence(S32 seq, F32 toPos)
|
||||||
{
|
{
|
||||||
const TSShape * shape = mShapeInstance->mShape;
|
const TSShape * shape = mShapeInstance->mShape;
|
||||||
|
|
||||||
AssertFatal(shape && shape->sequences.size()>seq && toPos>=0.0f && toPos<=1.0f,
|
AssertFatal(shape && shape->mSequences.size()>seq && toPos>=0.0f && toPos<=1.0f,
|
||||||
"TSThread::setSequence: invalid shape handle, sequence number, or position.");
|
"TSThread::setSequence: invalid shape handle, sequence number, or position.");
|
||||||
|
|
||||||
mShapeInstance->clearTransition(this);
|
mShapeInstance->clearTransition(this);
|
||||||
|
|
@ -287,12 +287,12 @@ void TSThread::activateTriggers(F32 a, F32 b)
|
||||||
for (i=firstTrigger; i<numTriggers+firstTrigger; i++)
|
for (i=firstTrigger; i<numTriggers+firstTrigger; i++)
|
||||||
{
|
{
|
||||||
// is a between this trigger and previous one...
|
// is a between this trigger and previous one...
|
||||||
if (a>lastPos && a<=shape->triggers[i].pos)
|
if (a>lastPos && a<=shape->mTriggers[i].pos)
|
||||||
aIndex = i;
|
aIndex = i;
|
||||||
// is b between this trigger and previous one...
|
// is b between this trigger and previous one...
|
||||||
if (b>lastPos && b<=shape->triggers[i].pos)
|
if (b>lastPos && b<=shape->mTriggers[i].pos)
|
||||||
bIndex = i;
|
bIndex = i;
|
||||||
lastPos = shape->triggers[i].pos;
|
lastPos = shape->mTriggers[i].pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
// activate triggers between aIndex and bIndex (depends on direction)
|
// activate triggers between aIndex and bIndex (depends on direction)
|
||||||
|
|
@ -300,7 +300,7 @@ void TSThread::activateTriggers(F32 a, F32 b)
|
||||||
{
|
{
|
||||||
for (i=aIndex; i<bIndex; i++)
|
for (i=aIndex; i<bIndex; i++)
|
||||||
{
|
{
|
||||||
U32 state = shape->triggers[i].state;
|
U32 state = shape->mTriggers[i].state;
|
||||||
bool on = (state & TSShape::Trigger::StateOn)!=0;
|
bool on = (state & TSShape::Trigger::StateOn)!=0;
|
||||||
mShapeInstance->setTriggerStateBit(state & TSShape::Trigger::StateMask, on);
|
mShapeInstance->setTriggerStateBit(state & TSShape::Trigger::StateMask, on);
|
||||||
}
|
}
|
||||||
|
|
@ -309,7 +309,7 @@ void TSThread::activateTriggers(F32 a, F32 b)
|
||||||
{
|
{
|
||||||
for (i=aIndex-1; i>=bIndex; i--)
|
for (i=aIndex-1; i>=bIndex; i--)
|
||||||
{
|
{
|
||||||
U32 state = shape->triggers[i].state;
|
U32 state = shape->mTriggers[i].state;
|
||||||
bool on = (state & TSShape::Trigger::StateOn)!=0;
|
bool on = (state & TSShape::Trigger::StateOn)!=0;
|
||||||
if (state & TSShape::Trigger::InvertOnReverse)
|
if (state & TSShape::Trigger::InvertOnReverse)
|
||||||
on = !on;
|
on = !on;
|
||||||
|
|
@ -354,7 +354,7 @@ void TSThread::advancePos(F32 delta)
|
||||||
{
|
{
|
||||||
// make dirty what this thread changes
|
// make dirty what this thread changes
|
||||||
U32 dirtyFlags = getSequence()->dirtyFlags | (transitionData.inTransition ? TSShapeInstance::TransformDirty : 0);
|
U32 dirtyFlags = getSequence()->dirtyFlags | (transitionData.inTransition ? TSShapeInstance::TransformDirty : 0);
|
||||||
for (S32 i=0; i<mShapeInstance->getShape()->subShapeFirstNode.size(); i++)
|
for (S32 i=0; i<mShapeInstance->getShape()->mSubShapeFirstNode.size(); i++)
|
||||||
mShapeInstance->mDirtyFlags[i] |= dirtyFlags;
|
mShapeInstance->mDirtyFlags[i] |= dirtyFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -500,7 +500,7 @@ S32 TSThread::operator<(const TSThread & th2) const
|
||||||
|
|
||||||
TSThread * TSShapeInstance::addThread()
|
TSThread * TSShapeInstance::addThread()
|
||||||
{
|
{
|
||||||
if (mShape->sequences.empty())
|
if (mShape->mSequences.empty())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
mThreadList.increment();
|
mThreadList.increment();
|
||||||
|
|
@ -656,9 +656,9 @@ void TSShapeInstance::updateTransitions()
|
||||||
updateTransitionNodeTransforms(transitionNodes);
|
updateTransitionNodeTransforms(transitionNodes);
|
||||||
|
|
||||||
S32 i;
|
S32 i;
|
||||||
mNodeReferenceRotations.setSize(mShape->nodes.size());
|
mNodeReferenceRotations.setSize(mShape->mNodes.size());
|
||||||
mNodeReferenceTranslations.setSize(mShape->nodes.size());
|
mNodeReferenceTranslations.setSize(mShape->mNodes.size());
|
||||||
for (i=0; i<mShape->nodes.size(); i++)
|
for (i=0; i<mShape->mNodes.size(); i++)
|
||||||
{
|
{
|
||||||
if (mTransitionRotationNodes.test(i))
|
if (mTransitionRotationNodes.test(i))
|
||||||
mNodeReferenceRotations[i].set(smNodeCurrentRotations[i]);
|
mNodeReferenceRotations[i].set(smNodeCurrentRotations[i]);
|
||||||
|
|
@ -674,8 +674,8 @@ void TSShapeInstance::updateTransitions()
|
||||||
|
|
||||||
if (animatesUniformScale())
|
if (animatesUniformScale())
|
||||||
{
|
{
|
||||||
mNodeReferenceUniformScales.setSize(mShape->nodes.size());
|
mNodeReferenceUniformScales.setSize(mShape->mNodes.size());
|
||||||
for (i=0; i<mShape->nodes.size(); i++)
|
for (i=0; i<mShape->mNodes.size(); i++)
|
||||||
{
|
{
|
||||||
if (mTransitionScaleNodes.test(i))
|
if (mTransitionScaleNodes.test(i))
|
||||||
mNodeReferenceUniformScales[i] = smNodeCurrentUniformScales[i];
|
mNodeReferenceUniformScales[i] = smNodeCurrentUniformScales[i];
|
||||||
|
|
@ -683,8 +683,8 @@ void TSShapeInstance::updateTransitions()
|
||||||
}
|
}
|
||||||
else if (animatesAlignedScale())
|
else if (animatesAlignedScale())
|
||||||
{
|
{
|
||||||
mNodeReferenceScaleFactors.setSize(mShape->nodes.size());
|
mNodeReferenceScaleFactors.setSize(mShape->mNodes.size());
|
||||||
for (i=0; i<mShape->nodes.size(); i++)
|
for (i=0; i<mShape->mNodes.size(); i++)
|
||||||
{
|
{
|
||||||
if (mTransitionScaleNodes.test(i))
|
if (mTransitionScaleNodes.test(i))
|
||||||
mNodeReferenceScaleFactors[i] = smNodeCurrentAlignedScales[i];
|
mNodeReferenceScaleFactors[i] = smNodeCurrentAlignedScales[i];
|
||||||
|
|
@ -692,9 +692,9 @@ void TSShapeInstance::updateTransitions()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mNodeReferenceScaleFactors.setSize(mShape->nodes.size());
|
mNodeReferenceScaleFactors.setSize(mShape->mNodes.size());
|
||||||
mNodeReferenceArbitraryScaleRots.setSize(mShape->nodes.size());
|
mNodeReferenceArbitraryScaleRots.setSize(mShape->mNodes.size());
|
||||||
for (i=0; i<mShape->nodes.size(); i++)
|
for (i=0; i<mShape->mNodes.size(); i++)
|
||||||
{
|
{
|
||||||
if (mTransitionScaleNodes.test(i))
|
if (mTransitionScaleNodes.test(i))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue