Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSShapeLoader

This commit is contained in:
bank 2014-05-13 12:15:47 +04:00
parent 9aeb4389f3
commit 1778a8d7f2
7 changed files with 284 additions and 284 deletions

View file

@ -58,7 +58,7 @@ static char* TrimFirstWord(char* str)
ColladaAppNode::ColladaAppNode(const domNode* node, ColladaAppNode* parent) ColladaAppNode::ColladaAppNode(const domNode* node, ColladaAppNode* parent)
: p_domNode(node), appParent(parent), nodeExt(new ColladaExtension_node(node)), : p_domNode(node), appParent(parent), nodeExt(new ColladaExtension_node(node)),
lastTransformTime(TSShapeLoader::DefaultTime-1), defaultTransformValid(false), lastTransformTime(TSShapeLoader::smDefaultTime-1), defaultTransformValid(false),
invertMeshes(false) invertMeshes(false)
{ {
mName = dStrdup(_GetNameOrId(node)); mName = dStrdup(_GetNameOrId(node));
@ -178,7 +178,7 @@ bool ColladaAppNode::animatesTransform(const AppSequence* appSeq)
MatrixF ColladaAppNode::getNodeTransform(F32 time) MatrixF ColladaAppNode::getNodeTransform(F32 time)
{ {
// Avoid re-computing the default transform if possible // Avoid re-computing the default transform if possible
if (defaultTransformValid && time == TSShapeLoader::DefaultTime) if (defaultTransformValid && time == TSShapeLoader::smDefaultTime)
{ {
return defaultNodeTransform; return defaultNodeTransform;
} }
@ -198,7 +198,7 @@ MatrixF ColladaAppNode::getNodeTransform(F32 time)
} }
// Cache the default transform // Cache the default transform
if (time == TSShapeLoader::DefaultTime) if (time == TSShapeLoader::smDefaultTime)
{ {
defaultTransformValid = true; defaultTransformValid = true;
defaultNodeTransform = nodeTransform; defaultNodeTransform = nodeTransform;

View file

@ -157,7 +157,7 @@ public:
public: public:
ColladaExtension_effect(const domEffect* effect) ColladaExtension_effect(const domEffect* effect)
: mLastAnimTime(TSShapeLoader::DefaultTime-1), mTextureTransform(true), mBumpSampler(0) : mLastAnimTime(TSShapeLoader::smDefaultTime-1), mTextureTransform(true), mBumpSampler(0)
{ {
//---------------------------------- //----------------------------------
// <effect> // <effect>

View file

@ -116,7 +116,7 @@ static void processNodeLights(AppNode* appNode, const MatrixF& offset, SimGroup*
Con::printf("Adding <%s> light \"%s\" as a %s", lightType, lightName.c_str(), pLight->getClassName()); Con::printf("Adding <%s> light \"%s\" as a %s", lightType, lightName.c_str(), pLight->getClassName());
MatrixF mat(offset); MatrixF mat(offset);
mat.mul(appNode->getNodeTransform(TSShapeLoader::DefaultTime)); mat.mul(appNode->getNodeTransform(TSShapeLoader::smDefaultTime));
pLight->setDataField(StringTable->insert("color"), 0, pLight->setDataField(StringTable->insert("color"), 0,
avar("%f %f %f %f", color.red, color.green, color.blue, color.alpha)); avar("%f %f %f %f", color.red, color.green, color.blue, color.alpha));

View file

@ -230,14 +230,14 @@ void ColladaShapeLoader::enumerateScene()
for (S32 iClipLib = 0; iClipLib < root->getLibrary_animation_clips_array().getCount(); iClipLib++) { for (S32 iClipLib = 0; iClipLib < root->getLibrary_animation_clips_array().getCount(); iClipLib++) {
const domLibrary_animation_clips* libraryClips = root->getLibrary_animation_clips_array()[iClipLib]; const domLibrary_animation_clips* libraryClips = root->getLibrary_animation_clips_array()[iClipLib];
for (S32 iClip = 0; iClip < libraryClips->getAnimation_clip_array().getCount(); iClip++) for (S32 iClip = 0; iClip < libraryClips->getAnimation_clip_array().getCount(); iClip++)
appSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); mAppSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip]));
} }
// Process all animations => this attaches animation channels to the targeted // Process all animations => this attaches animation channels to the targeted
// Collada elements, and determines the length of the sequence if it is not // Collada elements, and determines the length of the sequence if it is not
// already specified in the Collada <animation_clip> element // already specified in the Collada <animation_clip> element
for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) { for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) {
ColladaAppSequence* appSeq = dynamic_cast<ColladaAppSequence*>(appSequences[iSeq]); ColladaAppSequence* appSeq = dynamic_cast<ColladaAppSequence*>(mAppSequences[iSeq]);
F32 maxEndTime = 0; F32 maxEndTime = 0;
F32 minFrameTime = 1000.0f; F32 minFrameTime = 1000.0f;
for (S32 iAnim = 0; iAnim < appSeq->getClip()->getInstance_animation_array().getCount(); iAnim++) { for (S32 iAnim = 0; iAnim < appSeq->getClip()->getInstance_animation_array().getCount(); iAnim++) {
@ -251,7 +251,7 @@ void ColladaShapeLoader::enumerateScene()
// Collada animations can be stored as sampled frames or true keyframes. For // Collada animations can be stored as sampled frames or true keyframes. For
// sampled frames, use the same frame rate as the DAE file. For true keyframes, // sampled frames, use the same frame rate as the DAE file. For true keyframes,
// resample at a fixed frame rate. // resample at a fixed frame rate.
appSeq->fps = mClamp(1.0f / minFrameTime + 0.5f, TSShapeLoader::MinFrameRate, TSShapeLoader::MaxFrameRate); appSeq->fps = mClamp(1.0f / minFrameTime + 0.5f, TSShapeLoader::smMinFrameRate, TSShapeLoader::smMaxFrameRate);
} }
// First grab all of the top-level nodes // First grab all of the top-level nodes
@ -308,7 +308,7 @@ void ColladaShapeLoader::enumerateScene()
} }
// Make sure that the scene has a bounds node (for getting the root scene transform) // Make sure that the scene has a bounds node (for getting the root scene transform)
if (!boundsNode) if (!mBoundsNode)
{ {
domVisual_scene* visualScene = root->getLibrary_visual_scenes_array()[0]->getVisual_scene_array()[0]; domVisual_scene* visualScene = root->getLibrary_visual_scenes_array()[0]->getVisual_scene_array()[0];
domNode* dombounds = daeSafeCast<domNode>( visualScene->createAndPlace( "node" ) ); domNode* dombounds = daeSafeCast<domNode>( visualScene->createAndPlace( "node" ) );
@ -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 < shape->nodes.size(); iNode++) for (S32 iNode = 0; iNode < mShape->nodes.size(); iNode++)
{ {
if ( !appNodes[iNode]->isParentRoot() ) if ( !mAppNodes[iNode]->isParentRoot() )
continue; continue;
// Adjust default translation // Adjust default translation
shape->defaultTranslations[iNode] += shapeOffset; mShape->defaultTranslations[iNode] += shapeOffset;
// Adjust animated translations // Adjust animated translations
for (S32 iSeq = 0; iSeq < shape->sequences.size(); iSeq++) for (S32 iSeq = 0; iSeq < mShape->sequences.size(); iSeq++)
{ {
const TSShape::Sequence& seq = shape->sequences[iSeq]; const TSShape::Sequence& seq = mShape->sequences[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;
shape->nodeTranslations[index] += shapeOffset; mShape->nodeTranslations[index] += shapeOffset;
} }
} }
} }

View file

@ -47,7 +47,7 @@ void AppMesh::computeBounds(Box3F& bounds)
boneTransforms.setSize( mNodeIndex.size() ); boneTransforms.setSize( mNodeIndex.size() );
for (S32 iBone = 0; iBone < boneTransforms.size(); iBone++) for (S32 iBone = 0; iBone < boneTransforms.size(); iBone++)
{ {
MatrixF nodeMat = mBones[iBone]->getNodeTransform( TSShapeLoader::DefaultTime ); MatrixF nodeMat = mBones[iBone]->getNodeTransform( TSShapeLoader::smDefaultTime );
TSShapeLoader::zapScale(nodeMat); TSShapeLoader::zapScale(nodeMat);
boneTransforms[iBone].mul( nodeMat, mInitialTransforms[iBone] ); boneTransforms[iBone].mul( nodeMat, mInitialTransforms[iBone] );
} }
@ -74,7 +74,7 @@ void AppMesh::computeBounds(Box3F& bounds)
} }
else else
{ {
MatrixF transform = getMeshTransform(TSShapeLoader::DefaultTime); MatrixF transform = getMeshTransform(TSShapeLoader::smDefaultTime);
TSShapeLoader::zapScale(transform); TSShapeLoader::zapScale(transform);
for (S32 iVert = 0; iVert < mPoints.size(); iVert++) for (S32 iVert = 0; iVert < mPoints.size(); iVert++)

File diff suppressed because it is too large Load diff

View file

@ -81,31 +81,31 @@ protected:
}; };
public: public:
static const F32 DefaultTime; static const F32 smDefaultTime;
static const F64 MinFrameRate; static const F64 smMinFrameRate;
static const F64 MaxFrameRate; static const F64 smMaxFrameRate;
static const F64 AppGroundFrameRate; static const F64 smAppGroundFrameRate;
protected: protected:
// Variables used during loading that must be held until the shape is deleted // Variables used during loading that must be held until the shape is deleted
TSShape* shape; TSShape* mShape;
Vector<AppMesh*> appMeshes; Vector<AppMesh*> mAppMeshes;
// Variables used during loading, but that can be discarded afterwards // Variables used during loading, but that can be discarded afterwards
static Torque::Path shapePath; static Torque::Path smShapePath;
AppNode* boundsNode; AppNode* mBoundsNode;
Vector<AppNode*> appNodes; ///< Nodes in the loaded shape Vector<AppNode*> mAppNodes; ///< Nodes in the loaded shape
Vector<AppSequence*> appSequences; Vector<AppSequence*> mAppSequences;
Vector<Subshape*> subshapes; Vector<Subshape*> mSubShapes;
Vector<QuatF*> nodeRotCache; Vector<QuatF*> mNodeRotCache;
Vector<Point3F*> nodeTransCache; Vector<Point3F*> mNodeTransCache;
Vector<QuatF*> nodeScaleRotCache; Vector<QuatF*> mNodeScaleRotCache;
Vector<Point3F*> nodeScaleCache; Vector<Point3F*> mNodeScaleCache;
Point3F shapeOffset; ///< Offset used to translate the shape origin Point3F mShapeOffset; ///< Offset used to translate the shape origin
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -170,10 +170,10 @@ protected:
void install(); void install();
public: public:
TSShapeLoader() : boundsNode(0) { } TSShapeLoader() : mBoundsNode(0) { }
virtual ~TSShapeLoader(); virtual ~TSShapeLoader();
static const Torque::Path& getShapePath() { return shapePath; } static const Torque::Path& getShapePath() { return smShapePath; }
static void zapScale(MatrixF& mat); static void zapScale(MatrixF& mat);