瀏覽代碼

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

bank 11 年之前
父節點
當前提交
9aeb4389f3

+ 4 - 4
Engine/source/ts/collada/colladaAppMaterial.cpp

@@ -82,9 +82,9 @@ ColladaAppMaterial::ColladaAppMaterial(const domMaterial *pMat)
    const domCommon_color_or_texture_type_complexType* domSpecular = findEffectSpecular(effect);
 
    // Wrap flags
-   if (effectExt->wrapU)
+   if (effectExt->mWrapU)
       flags |= TSMaterialList::S_Wrap;
-   if (effectExt->wrapV)
+   if (effectExt->mWrapV)
       flags |= TSMaterialList::T_Wrap;
 
    // Set material attributes
@@ -146,13 +146,13 @@ ColladaAppMaterial::ColladaAppMaterial(const domMaterial *pMat)
    }
 
    // Double-sided flag
-   doubleSided = effectExt->double_sided;
+   doubleSided = effectExt->mDoubleSided;
 
    // Get the paths for the various textures => Collada indirection at its finest!
    // <texture>.<newparam>.<sampler2D>.<source>.<newparam>.<surface>.<init_from>.<image>.<init_from>
    diffuseMap = getSamplerImagePath(effect, getTextureSampler(effect, domDiffuse));
    specularMap = getSamplerImagePath(effect, getTextureSampler(effect, domSpecular));
-   normalMap = getSamplerImagePath(effect, effectExt->bumpSampler);
+   normalMap = getSamplerImagePath(effect, effectExt->mBumpSampler);
 
    // Set the material name
    name = ColladaUtils::getOptions().mMatNamePrefix;

+ 4 - 4
Engine/source/ts/collada/colladaAppMesh.cpp

@@ -354,7 +354,7 @@ MatrixF ColladaAppMesh::getMeshTransform(F32 time)
 bool ColladaAppMesh::animatesVis(const AppSequence* appSeq)
 {
    #define IS_VIS_ANIMATED(node)    \
-      (dynamic_cast<const ColladaAppNode*>(node)->nodeExt->visibility.isAnimated(appSeq->getStart(), appSeq->getEnd()))
+      (dynamic_cast<const ColladaAppNode*>(node)->nodeExt->mVisibility.isAnimated(appSeq->getStart(), appSeq->getEnd()))
 
    // Check if the node visibility is animated within the sequence interval
    return IS_VIS_ANIMATED(mAppNode) || (mAppNode->appParent ? IS_VIS_ANIMATED(mAppNode->appParent) : false);
@@ -418,7 +418,7 @@ bool ColladaAppMesh::animatesFrame(const AppSequence* appSeq)
 F32 ColladaAppMesh::getVisValue(F32 t)
 {
    #define GET_VIS(node)   \
-      (dynamic_cast<const ColladaAppNode*>(node)->nodeExt->visibility.getValue(t))
+      (dynamic_cast<const ColladaAppNode*>(node)->nodeExt->mVisibility.getValue(t))
 
    // Get the visibility of the mesh's node at time, 't'
    return GET_VIS(mAppNode) * (mAppNode->appParent ? GET_VIS(mAppNode->appParent) : 1.0f);
@@ -529,8 +529,8 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry)
          appMat = static_cast<ColladaAppMaterial*>(mAppMaterials[primitive.matIndex & TSDrawPrimitive::MaterialMask]);
 
       // Force the material to be double-sided if this geometry is double-sided.
-      if (mGeomExt->double_sided && appMat && appMat->effectExt)
-         appMat->effectExt->double_sided = true;
+      if (mGeomExt->mDoubleSided && appMat && appMat->effectExt)
+         appMat->effectExt->mDoubleSided = true;
 
       // Pre-allocate triangle indices
       primitive.numElements = numTriangles * 3;

+ 1 - 1
Engine/source/ts/collada/colladaAppNode.cpp

@@ -66,7 +66,7 @@ ColladaAppNode::ColladaAppNode(const domNode* node, ColladaAppNode* parent)
 
    // Extract user properties from the <node> extension as whitespace separated
    // "name=value" pairs
-   char* properties = dStrdup(nodeExt->user_properties);
+   char* properties = dStrdup(nodeExt->mUserProperties);
    char* pos = properties;
    char* end = properties + dStrlen( properties );
    while ( pos < end )

+ 7 - 7
Engine/source/ts/collada/colladaAppSequence.cpp

@@ -45,31 +45,31 @@ const char* ColladaAppSequence::getName() const
 
 S32 ColladaAppSequence::getNumTriggers()
 {
-   return clipExt->triggers.size();
+   return clipExt->mTriggers.size();
 }
 
 void ColladaAppSequence::getTrigger(S32 index, TSShape::Trigger& trigger)
 {
-   trigger.pos = clipExt->triggers[index].time;
-   trigger.state = clipExt->triggers[index].state;
+   trigger.pos = clipExt->mTriggers[index].time;
+   trigger.state = clipExt->mTriggers[index].state;
 }
 
 U32 ColladaAppSequence::getFlags() const
 {
    U32 flags = 0;
-   if (clipExt->cyclic) flags |= TSShape::Cyclic;
-   if (clipExt->blend)  flags |= TSShape::Blend;
+   if (clipExt->mCyclic) flags |= TSShape::Cyclic;
+   if (clipExt->mBlend)  flags |= TSShape::Blend;
    return flags;
 }
 
 F32 ColladaAppSequence::getPriority()
 {
-   return clipExt->priority;
+   return clipExt->mPriority;
 }
 
 F32 ColladaAppSequence::getBlendRefTime()
 {
-   return clipExt->blendReferenceTime;
+   return clipExt->mBlendReferenceTime;
 }
 
 void ColladaAppSequence::setActive(bool active)

+ 12 - 12
Engine/source/ts/collada/colladaExtensions.cpp

@@ -29,10 +29,10 @@
 /// the interval
 bool ColladaExtension_effect::animatesTextureTransform(F32 start, F32 end)
 {
-   return repeatU.isAnimated(start, end)           || repeatV.isAnimated(start, end)         ||
-          offsetU.isAnimated(start, end)           || offsetV.isAnimated(start, end)         ||
-          rotateUV.isAnimated(start, end)          || noiseU.isAnimated(start, end)          ||
-          noiseV.isAnimated(start, end);
+   return mRepeatU.isAnimated(start, end)           || mRepeatV.isAnimated(start, end)         ||
+          mOffsetU.isAnimated(start, end)           || mOffsetV.isAnimated(start, end)         ||
+          mRotateUV.isAnimated(start, end)          || mNoiseU.isAnimated(start, end)          ||
+          mNoiseV.isAnimated(start, end);
 }
 
 /// Apply the MAYA texture transform to the given UV coordinates
@@ -41,21 +41,21 @@ void ColladaExtension_effect::applyTextureTransform(Point2F& uv, F32 time)
    // This function will be called for every tvert, every frame. So cache the
    // texture transform parameters to avoid interpolating them every call (since
    // they are constant for all tverts for a given 't')
-   if (time != lastAnimTime) {
+   if (time != mLastAnimTime) {
       // Update texture transform
-      textureTransform.set(EulerF(0, 0, rotateUV.getValue(time)));
-      textureTransform.setPosition(Point3F(
-         offsetU.getValue(time) + noiseU.getValue(time)*gRandGen.randF(),
-         offsetV.getValue(time) + noiseV.getValue(time)*gRandGen.randF(),
+      mTextureTransform.set(EulerF(0, 0, mRotateUV.getValue(time)));
+      mTextureTransform.setPosition(Point3F(
+         mOffsetU.getValue(time) + mNoiseU.getValue(time)*gRandGen.randF(),
+         mOffsetV.getValue(time) + mNoiseV.getValue(time)*gRandGen.randF(),
          0));
-      textureTransform.scale(Point3F(repeatU.getValue(time), repeatV.getValue(time), 1.0f));
+      mTextureTransform.scale(Point3F(mRepeatU.getValue(time), mRepeatV.getValue(time), 1.0f));
 
-      lastAnimTime = time;
+      mLastAnimTime = time;
    }
 
    // Apply texture transform
    Point3F result;
-   textureTransform.mulP(Point3F(uv.x, uv.y, 0), &result);
+   mTextureTransform.mulP(Point3F(uv.x, uv.y, 0), &result);
 
    uv.x = result.x;
    uv.y = result.y;

+ 73 - 73
Engine/source/ts/collada/colladaExtensions.h

@@ -53,7 +53,7 @@ class ColladaExtension
       get(#param, param, defaultVal)
 
 protected:
-   const domTechnique* pTechnique;
+   const domTechnique* mTechnique;
 
    /// Find the technique with the named profile
    template<class T> const domTechnique* findExtraTechnique(const T* element, const char* name) const
@@ -86,10 +86,10 @@ protected:
    /// Find the parameter with the given name
    const domAny* findParam(const char* name)
    {
-      if (pTechnique) {
+      if (mTechnique) {
          // search the technique contents for the desired parameter
-         for (S32 iParam = 0; iParam < pTechnique->getContents().getCount(); iParam++) {
-            const domAny* param = daeSafeCast<domAny>(pTechnique->getContents()[iParam]);
+         for (S32 iParam = 0; iParam < mTechnique->getContents().getCount(); iParam++) {
+            const domAny* param = daeSafeCast<domAny>(mTechnique->getContents()[iParam]);
             if (param && !dStrcmp(param->getElementName(), name))
                return param;
          }
@@ -114,7 +114,7 @@ protected:
    }
 
 public:
-   ColladaExtension() : pTechnique(0) { }
+   ColladaExtension() : mTechnique(0) { }
    virtual ~ColladaExtension() { }
 };
 
@@ -122,14 +122,14 @@ public:
 class ColladaExtension_effect : public ColladaExtension
 {
    // Cached texture transform
-   F32            lastAnimTime;
-   MatrixF        textureTransform;
+   F32            mLastAnimTime;
+   MatrixF        mTextureTransform;
 
 public:
    //----------------------------------
    // <effect>
    // MAX3D profile elements
-   bool double_sided;
+   bool mDoubleSided;
 
    //----------------------------------
    // <effect>.<profile_COMMON>
@@ -139,39 +139,39 @@ public:
    //----------------------------------
    // <effect>.<profile_COMMON>.<technique>.<blinn/phong/lambert>.<diffuse>.<texture>
    // MAYA profile elements
-   bool           wrapU, wrapV;
-   bool           mirrorU, mirrorV;
-   AnimatedFloat  coverageU, coverageV;
-   AnimatedFloat  translateFrameU, translateFrameV;
-   AnimatedFloat  rotateFrame;
-   AnimatedBool   stagger;       // @todo: not supported yet
-   AnimatedFloat  repeatU, repeatV;
-   AnimatedFloat  offsetU, offsetV;
-   AnimatedFloat  rotateUV;
-   AnimatedFloat  noiseU, noiseV;
+   bool           mWrapU, mWrapV;
+   bool           mMirrorU, mMirrorV;
+   AnimatedFloat  mCoverageU, mCoverageV;
+   AnimatedFloat  mTranslateFrameU, mTranslateFrameV;
+   AnimatedFloat  mRotateFrame;
+   AnimatedBool   mStagger;       // @todo: not supported yet
+   AnimatedFloat  mRepeatU, mRepeatV;
+   AnimatedFloat  mOffsetU, mOffsetV;
+   AnimatedFloat  mRotateUV;
+   AnimatedFloat  mNoiseU, mNoiseV;
 
    //----------------------------------
    // <effect>.<profile_COMMON>.<technique>
    // FCOLLADA profile elements
-   domFx_sampler2D_common_complexType*   bumpSampler;
+   domFx_sampler2D_common_complexType*   mBumpSampler;
 
 public:
    ColladaExtension_effect(const domEffect* effect)
-      : lastAnimTime(TSShapeLoader::DefaultTime-1), textureTransform(true), bumpSampler(0)
+      : mLastAnimTime(TSShapeLoader::DefaultTime-1), mTextureTransform(true), mBumpSampler(0)
    {
       //----------------------------------
       // <effect>
       // MAX3D profile
-      pTechnique = findExtraTechnique(effect, "MAX3D");
-      GET_EXTRA_PARAM(double_sided, false);
+      mTechnique = findExtraTechnique(effect, "MAX3D");
+      GET_EXTRA_PARAM(mDoubleSided, false);
 
       //----------------------------------
       // <effect>.<profile_COMMON>
       const domProfile_COMMON* profileCommon = ColladaUtils::findEffectCommonProfile(effect);
 
       // GOOGLEEARTH profile (same double_sided element)
-      pTechnique = findExtraTechnique(profileCommon, "GOOGLEEARTH");
-      GET_EXTRA_PARAM(double_sided, double_sided);
+      mTechnique = findExtraTechnique(profileCommon, "GOOGLEEARTH");
+      GET_EXTRA_PARAM(mDoubleSided, mDoubleSided);
 
       //----------------------------------
       // <effect>.<profile_COMMON>.<technique>.<blinn/phong/lambert>.<diffuse>.<texture>
@@ -179,43 +179,43 @@ public:
       const domFx_sampler2D_common_complexType* sampler2D = ColladaUtils::getTextureSampler(effect, domDiffuse);
 
       // Use the sampler2D to set default values for wrap/mirror flags
-      wrapU = wrapV = true;
-      mirrorU = mirrorV = false;
+      mWrapU = mWrapV = true;
+      mMirrorU = mMirrorV = false;
       if (sampler2D) {
          domFx_sampler2D_common_complexType::domWrap_s* wrap_s = sampler2D->getWrap_s();
          domFx_sampler2D_common_complexType::domWrap_t* wrap_t = sampler2D->getWrap_t();
 
-         mirrorU = (wrap_s && wrap_s->getValue() == FX_SAMPLER_WRAP_COMMON_MIRROR);
-         wrapU = (mirrorU || !wrap_s || (wrap_s->getValue() == FX_SAMPLER_WRAP_COMMON_WRAP));
-         mirrorV = (wrap_t && wrap_t->getValue() == FX_SAMPLER_WRAP_COMMON_MIRROR);
-         wrapV = (mirrorV || !wrap_t || (wrap_t->getValue() == FX_SAMPLER_WRAP_COMMON_WRAP));
+         mMirrorU = (wrap_s && wrap_s->getValue() == FX_SAMPLER_WRAP_COMMON_MIRROR);
+         mWrapU = (mMirrorU || !wrap_s || (wrap_s->getValue() == FX_SAMPLER_WRAP_COMMON_WRAP));
+         mMirrorV = (wrap_t && wrap_t->getValue() == FX_SAMPLER_WRAP_COMMON_MIRROR);
+         mWrapV = (mMirrorV || !wrap_t || (wrap_t->getValue() == FX_SAMPLER_WRAP_COMMON_WRAP));
       }
 
       // MAYA profile
-      pTechnique = findExtraTechnique(domDiffuse ? domDiffuse->getTexture() : 0, "MAYA");
-      GET_EXTRA_PARAM(wrapU, wrapU);            GET_EXTRA_PARAM(wrapV, wrapV);
-      GET_EXTRA_PARAM(mirrorU, mirrorU);        GET_EXTRA_PARAM(mirrorV, mirrorV);
-      GET_EXTRA_PARAM(coverageU, 1.0);          GET_EXTRA_PARAM(coverageV, 1.0);
-      GET_EXTRA_PARAM(translateFrameU, 0.0);    GET_EXTRA_PARAM(translateFrameV, 0.0);
-      GET_EXTRA_PARAM(rotateFrame, 0.0);
-      GET_EXTRA_PARAM(stagger, false);
-      GET_EXTRA_PARAM(repeatU, 1.0);            GET_EXTRA_PARAM(repeatV, 1.0);
-      GET_EXTRA_PARAM(offsetU, 0.0);            GET_EXTRA_PARAM(offsetV, 0.0);
-      GET_EXTRA_PARAM(rotateUV, 0.0);
-      GET_EXTRA_PARAM(noiseU, 0.0);             GET_EXTRA_PARAM(noiseV, 0.0);
+      mTechnique = findExtraTechnique(domDiffuse ? domDiffuse->getTexture() : 0, "MAYA");
+      GET_EXTRA_PARAM(mWrapU, mWrapU);            GET_EXTRA_PARAM(mWrapV, mWrapV);
+      GET_EXTRA_PARAM(mMirrorU, mMirrorU);        GET_EXTRA_PARAM(mMirrorV, mMirrorV);
+      GET_EXTRA_PARAM(mCoverageU, 1.0);          GET_EXTRA_PARAM(mCoverageV, 1.0);
+      GET_EXTRA_PARAM(mTranslateFrameU, 0.0);    GET_EXTRA_PARAM(mTranslateFrameV, 0.0);
+      GET_EXTRA_PARAM(mRotateFrame, 0.0);
+      GET_EXTRA_PARAM(mStagger, false);
+      GET_EXTRA_PARAM(mRepeatU, 1.0);            GET_EXTRA_PARAM(mRepeatV, 1.0);
+      GET_EXTRA_PARAM(mOffsetU, 0.0);            GET_EXTRA_PARAM(mOffsetV, 0.0);
+      GET_EXTRA_PARAM(mRotateUV, 0.0);
+      GET_EXTRA_PARAM(mNoiseU, 0.0);             GET_EXTRA_PARAM(mNoiseV, 0.0);
 
       // FCOLLADA profile
       if (profileCommon) {
-         pTechnique = findExtraTechnique((const domProfile_COMMON::domTechnique*)profileCommon->getTechnique(), "FCOLLADA");
-         if (pTechnique) {
-            domAny* bump = daeSafeCast<domAny>(const_cast<domTechnique*>(pTechnique)->getChild("bump"));
+         mTechnique = findExtraTechnique((const domProfile_COMMON::domTechnique*)profileCommon->getTechnique(), "FCOLLADA");
+         if (mTechnique) {
+            domAny* bump = daeSafeCast<domAny>(const_cast<domTechnique*>(mTechnique)->getChild("bump"));
             if (bump) {
                domAny* bumpTexture = daeSafeCast<domAny>(bump->getChild("texture"));
                if (bumpTexture) {
                   daeSIDResolver resolver(const_cast<domEffect*>(effect), bumpTexture->getAttribute("texture").c_str());
                   domCommon_newparam_type* param = daeSafeCast<domCommon_newparam_type>(resolver.getElement());
                   if (param)
-                     bumpSampler = param->getSampler2D();
+                     mBumpSampler = param->getSampler2D();
                }
             }
          }
@@ -235,21 +235,21 @@ class ColladaExtension_node : public ColladaExtension
 {
 public:
    // FCOLLADA or OpenCOLLADA profile elements
-   AnimatedFloat visibility;
-   const char* user_properties;
+   AnimatedFloat mVisibility;
+   const char* mUserProperties;
 
    ColladaExtension_node(const domNode* node)
    {
       // FCOLLADA profile
-      pTechnique = findExtraTechnique(node, "FCOLLADA");
-      GET_EXTRA_PARAM(visibility, 1.0);
-      GET_EXTRA_PARAM(user_properties, "");
+      mTechnique = findExtraTechnique(node, "FCOLLADA");
+      GET_EXTRA_PARAM(mVisibility, 1.0);
+      GET_EXTRA_PARAM(mUserProperties, "");
 
       // OpenCOLLADA profile
-      pTechnique = findExtraTechnique(node, "OpenCOLLADA");
-      if (!visibility.mElement)
-         GET_EXTRA_PARAM(visibility, 1.0);
-      GET_EXTRA_PARAM(user_properties, user_properties);
+      mTechnique = findExtraTechnique(node, "OpenCOLLADA");
+      if (!mVisibility.mElement)
+         GET_EXTRA_PARAM(mVisibility, 1.0);
+      GET_EXTRA_PARAM(mUserProperties, mUserProperties);
    }
 };
 
@@ -258,13 +258,13 @@ class ColladaExtension_geometry : public ColladaExtension
 {
 public:
    // MAYA profile elements
-   bool double_sided;
+   bool mDoubleSided;
 
    ColladaExtension_geometry(const domGeometry* geometry)
    {
       // MAYA profile
-      pTechnique = findExtraTechnique(geometry, "MAYA");
-      GET_EXTRA_PARAM(double_sided, false);
+      mTechnique = findExtraTechnique(geometry, "MAYA");
+      GET_EXTRA_PARAM(mDoubleSided, false);
    }
 };
 
@@ -278,27 +278,27 @@ public:
    };
 
    // Torque profile elements (none of these are animatable)
-   S32 num_triggers;
-   Vector<Trigger> triggers;
-   bool cyclic;
-   bool blend;
-   F32 blendReferenceTime;
-   F32 priority;
+   S32 mNumTriggers;
+   Vector<Trigger> mTriggers;
+   bool mCyclic;
+   bool mBlend;
+   F32 mBlendReferenceTime;
+   F32 mPriority;
 
    ColladaExtension_animation_clip(const domAnimation_clip* clip)
    {
       // Torque profile
-      pTechnique = findExtraTechnique(clip, "Torque");
-      GET_EXTRA_PARAM(num_triggers, 0);
-      for (S32 iTrigger = 0; iTrigger < num_triggers; iTrigger++) {
-         triggers.increment();
-         get(avar("trigger_time%d", iTrigger), triggers.last().time, 0.0f);
-         get(avar("trigger_state%d", iTrigger), triggers.last().state, 0);
+      mTechnique = findExtraTechnique(clip, "Torque");
+      GET_EXTRA_PARAM(mNumTriggers, 0);
+      for (S32 iTrigger = 0; iTrigger < mNumTriggers; iTrigger++) {
+         mTriggers.increment();
+         get(avar("trigger_time%d", iTrigger), mTriggers.last().time, 0.0f);
+         get(avar("trigger_state%d", iTrigger), mTriggers.last().state, 0);
       }
-      GET_EXTRA_PARAM(cyclic, false);
-      GET_EXTRA_PARAM(blend, false);
-      GET_EXTRA_PARAM(blendReferenceTime, 0.0f);
-      GET_EXTRA_PARAM(priority, 5.0f);
+      GET_EXTRA_PARAM(mCyclic, false);
+      GET_EXTRA_PARAM(mBlend, false);
+      GET_EXTRA_PARAM(mBlendReferenceTime, 0.0f);
+      GET_EXTRA_PARAM(mPriority, 5.0f);
    }
 };