Cleanup unused/commented out code, compiler warnings, coding standards etc.
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>
Sun, 16 May 2004 13:10:10 +0000 (13:10 +0000)
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>
Sun, 16 May 2004 13:10:10 +0000 (13:10 +0000)
source/gameengine/Converter/BL_MeshDeformer.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.h
source/gameengine/Ketsji/KX_TouchEventManager.h
source/gameengine/Physics/Sumo/Fuzzics/include/SM_Object.h
source/gameengine/Physics/Sumo/Fuzzics/src/SM_Object.cpp
source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h
source/gameengine/Rasterizer/RAS_IRasterizer.h
source/gameengine/Rasterizer/RAS_IRenderTools.h

index e9aeb547409efe63af4a063644e951ceccd3aa01..f7df35af21d484d89d2d77e7a3dfc553d0a39ab7 100644 (file)
@@ -73,21 +73,10 @@ bool BL_MeshDeformer::Apply(RAS_IPolyMaterial *mat)
                //      For each vertex
                for (j=0; j<array[i]->size(); j++){
                        tv = &((*array[i])[j]);
-                       MT_Point3 pt = tv->xyz();
-                       
                        index = ((*diarray[i])[j]);
 
                        mvert = &(m_bmesh->mvert[((*mvarray[i])[index])]);
-                       //      Do the nasty (in this case, copy the untransformed data from the blender mesh)
-                       co[0]=mvert->co[0];
-                       co[1]=mvert->co[1];
-                       co[2]=mvert->co[2];
-                       
-                       pt[0] = co[0];
-                       pt[1] = co[1];
-                       pt[2] = co[2];
-                       
-                       tv->SetXYZ(pt);
+                       tv->SetXYZ(MT_Point3(mvert->co));
                }
        }
        return true;
@@ -101,6 +90,9 @@ BL_MeshDeformer::~BL_MeshDeformer()
                delete []m_transnors;
 };
 
+/**
+ * @warning This function is expensive!
+ */
 void BL_MeshDeformer::RecalcNormals()
 {
        int v, f;
@@ -143,12 +135,12 @@ void BL_MeshDeformer::RecalcNormals()
        }
        
        for (v =0; v<m_bmesh->totvert; v++){
-               float nor[3];
+//             float nor[3];
 
                m_transnors[v]=m_transnors[v].safe_normalized();
-               nor[0]=m_transnors[v][0];
-               nor[1]=m_transnors[v][1];
-               nor[2]=m_transnors[v][2];
+//             nor[0]=m_transnors[v][0];
+//             nor[1]=m_transnors[v][1];
+//             nor[2]=m_transnors[v][2];
                
        };
 }
index 83e0fe229d759aa87b22ccb9561ae3c26d39d50c..79baf09f597690e9f1c9f1c27adbadf6b3790d29 100644 (file)
@@ -67,14 +67,14 @@ class KX_KetsjiEngine
 {
 
 private:
-       class RAS_ICanvas*                                      m_canvas; // 2D Canvas (2D Rendering Device Context)
+       class RAS_ICanvas*                              m_canvas; // 2D Canvas (2D Rendering Device Context)
        class RAS_IRasterizer*                          m_rasterizer;  // 3D Rasterizer (3D Rendering)
-       class KX_ISystem*                                       m_kxsystem;
+       class KX_ISystem*                               m_kxsystem;
        class RAS_IRenderTools*                         m_rendertools;
        class KX_ISceneConverter*                       m_sceneconverter;
-       class NG_NetworkDeviceInterface*        m_networkdevice;
+       class NG_NetworkDeviceInterface*                m_networkdevice;
        class SND_IAudioDevice*                         m_audiodevice;
-       PyObject*                                                       m_pythondictionary;
+       PyObject*                                       m_pythondictionary;
        class SCA_IInputDevice*                         m_keyboarddevice;
        class SCA_IInputDevice*                         m_mousedevice;
 
index e53dc2644946ed33aef1608da54360840e9e244b..4439ba6f3bdee81ffd84b01a205621867e4bf2ff 100644 (file)
@@ -43,7 +43,7 @@ class KX_TouchEventManager : public SCA_EventManager
        class SCA_LogicManager* m_logicmgr;
        SM_Scene *m_scene;
 
-       static DT_Bool KX_TouchEventManager::collisionResponse(void *client_data, 
+       static DT_Bool collisionResponse(void *client_data, 
                                                        void *object1,
                                                        void *object2,
                                                        const DT_CollData *coll_data);
index a0475c39bbb8b8e1d7c54f21de08322aa507035c..571e1cf71ccd16e5ceecc1747b7d5f14922ecd02 100644 (file)
@@ -266,6 +266,11 @@ public:
        }
 private:
 
+       // Tweak parameters
+       static const MT_Scalar ImpulseThreshold = -10.;
+       static const MT_Scalar FixThreshold = 0.01;
+       static const MT_Scalar FixVelocity = 0.01;
+
        // return the actual linear_velocity of this object this 
        // is the addition of m_combined_lin_vel and m_lin_vel.
 
index 6609279acb50bfb7a46ee7bca07190a97f76d39a..b86d7ccdcdd6d44b486383efa12bd6cdf953378e 100644 (file)
 #include "MT_MinMax.h"
 
 
-// Tweak parameters
-static const MT_Scalar ImpulseThreshold = -10.;
-static const MT_Scalar FixThreshold = 0.01;
-static const MT_Scalar FixVelocity = 0.01;
 SM_Object::SM_Object(
        DT_ShapeHandle shape, 
        const SM_MaterialProps *materialProps,
@@ -459,28 +455,10 @@ DT_Bool SM_Object::fix(
                MT_Vector3 error = normal * 0.5f;
                obj1->m_error += error;
                obj2->m_error -= error;
-               // Remove the velocity component in the normal direction
-               // Calculate collision parameters
-               /*MT_Vector3 rel_vel = obj1->getLinearVelocity() - obj2->getLinearVelocity();
-               if (normal.length() > FixThreshold && rel_vel.length() < FixVelocity) {
-                       normal.normalize();
-                       MT_Scalar  rel_vel_normal = 0.49*(normal.dot(rel_vel));
-
-                       obj1->addLinearVelocity(-rel_vel_normal*normal);
-                       obj2->addLinearVelocity(rel_vel_normal*normal);
-               }*/
        }
        else {
                // Same again but now obj1 is non-dynamic
                obj2->m_error -= normal;
-               /*MT_Vector3 rel_vel = obj2->getLinearVelocity();
-               if (normal.length() > FixThreshold && rel_vel.length() < FixVelocity) {
-                       // Calculate collision parameters
-                       normal.normalize();
-                       MT_Scalar  rel_vel_normal = -0.99*(normal.dot(rel_vel));
-
-                       obj2->addLinearVelocity(rel_vel_normal*normal);
-               }*/ 
        }
        
        return DT_CONTINUE;
@@ -494,10 +472,6 @@ void SM_Object::relax(void)
        
        m_pos += m_error; 
        m_error.setValue(0., 0., 0.); 
-/*     m_pos.getValue(pos);
-       DT_SetPosition(m_object, pos); 
-       m_xform.setOrigin(m_pos); 
-       m_xform.getValue(m_ogl_matrix); */
        calcXform();
        notifyClient();
 }
index f7057fecb6ec67f19eecb86f272b68826635b00d..8034cfdc86dcf179a02858f5413332068e681a1e 100644 (file)
@@ -175,22 +175,20 @@ void SM_Scene::proceed(MT_Scalar timeStep, MT_Scalar subSampling) {
        // Apply a forcefield (such as gravity)
        for (i = m_objectList.begin(); i != m_objectList.end(); ++i) {
                (*i)->applyForceField(m_forceField);
-               //(*i)->integrateForces(subStep);
-               //(*i)->integrateMomentum(subStep);
+               //(*i)->setTimeStep(timeStep);
        }
        
        // Do the integration steps per object.
        int step;
        for (step = 0; step != num_samples; ++step) {
 
-
                for (i = m_objectList.begin(); i != m_objectList.end(); ++i) {
                        (*i)->integrateForces(subStep);
-                       //(*i)->backup();
-               // And second we update the object positions by performing
-               // an integration step for each object
+                       // And second we update the object positions by performing
+                       // an integration step for each object
                        (*i)->integrateMomentum(subStep);
                }
+               
                // I changed the order of the next 2 statements.
                // Originally objects were first integrated with a call
                // to proceed(). However if external objects were 
@@ -208,9 +206,6 @@ void SM_Scene::proceed(MT_Scalar timeStep, MT_Scalar subSampling) {
 #if 0
        clearObjectCombinedVelocities();
 #endif
-/*     if (DT_Test(m_scene, m_fixRespTable))
-               for (i = m_objectList.begin(); i != m_objectList.end(); ++i)
-                       (*i)->relax();  */
        DT_Test(m_scene, m_fixRespTable);
        
        // Finish this timestep by saving al state information for the next
index 78e902ce2215fa7897970ccec94e5cb50f7b9a36..e9a2148bedda63173119eeee0a10a8f712a4c153 100644 (file)
@@ -40,9 +40,6 @@
 
 //#include <SOLID/SOLID.h>
 
-const MT_Scalar UpperBoundForFuzzicsIntegrator = 0.01;
-// At least 100Hz (isn't this CPU hungry ?)
-
 
 SumoPhysicsEnvironment::SumoPhysicsEnvironment()
 {
index 1f175df6ec9490625513eddb4b7f5f3929060a9e..683257a8310a08433384a3b7ef6deef146979ed4 100644 (file)
@@ -32,6 +32,8 @@
 #ifndef _SUMOPhysicsEnvironment
 #define _SUMOPhysicsEnvironment
 
+#include "MT_Scalar.h"
+
 #include "PHY_IPhysicsEnvironment.h"
 
 /**
@@ -64,10 +66,9 @@ public:
                return m_sumoScene;
        }
 
-private:
-
-
-
+protected:
+       // At least 100Hz (isn't this CPU hungry ?)
+       static const MT_Scalar UpperBoundForFuzzicsIntegrator = 0.01;
 
 };
 
index 448238364506326096e14441ba770b81969f83b3..815c095e58318b5f260ee5e845d59a0b5ad9b33c 100644 (file)
@@ -216,7 +216,7 @@ public:
         * from camera coordinates to window coordinates.
         * @param mat The projection matrix.
         */
-       virtual void    SetProjectionMatrix(MT_Matrix4x4 & mat)=0;
+       virtual void    SetProjectionMatrix(const MT_Matrix4x4 & mat)=0;
        /**
         * Sets the modelview matrix.
         */
index 91b8fab5d18cf3a2c10b368b72c80b12f90f2ee8..47246d60c5c461f85ebe99c46abc50ffd098a09b 100644 (file)
@@ -59,7 +59,7 @@ public:
                RAS_TEXT_RENDER_NODEF = 0,
                RAS_TEXT_NORMAL,
                RAS_TEXT_PADDED,
-               RAS_TEXT_MAX,
+               RAS_TEXT_MAX
        };
        
        RAS_IRenderTools(