Cleanup unused/commented out code, compiler warnings, coding standards etc.

This commit is contained in:
Kester Maddock
2004-05-16 13:10:10 +00:00
parent d5fde6c48b
commit bab6e5ce36
10 changed files with 29 additions and 65 deletions

View 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];
};
}

View 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;

View 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);

View 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.

View File

@@ -50,10 +50,6 @@
#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();
}

View 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

View 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()
{

View 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;
};

View 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.
*/

View 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(