// 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;
delete []m_transnors;
};
+/**
+ * @warning This function is expensive!
+ */
void BL_MeshDeformer::RecalcNormals()
{
int v, f;
}
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];
};
}
{
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;
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);
}
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.
#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,
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;
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();
}
// 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
#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
//#include <SOLID/SOLID.h>
-const MT_Scalar UpperBoundForFuzzicsIntegrator = 0.01;
-// At least 100Hz (isn't this CPU hungry ?)
-
SumoPhysicsEnvironment::SumoPhysicsEnvironment()
{
#ifndef _SUMOPhysicsEnvironment
#define _SUMOPhysicsEnvironment
+#include "MT_Scalar.h"
+
#include "PHY_IPhysicsEnvironment.h"
/**
return m_sumoScene;
}
-private:
-
-
-
+protected:
+ // At least 100Hz (isn't this CPU hungry ?)
+ static const MT_Scalar UpperBoundForFuzzicsIntegrator = 0.01;
};
* 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.
*/
RAS_TEXT_RENDER_NODEF = 0,
RAS_TEXT_NORMAL,
RAS_TEXT_PADDED,
- RAS_TEXT_MAX,
+ RAS_TEXT_MAX
};
RAS_IRenderTools(