Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2013-02-21 22:30:11 +0400
committerMitchell Stokes <mogurijin@gmail.com>2013-02-21 22:30:11 +0400
commit815e00917dcb4137f9687ab602f527920fa8c41d (patch)
tree4c089bc7f19a9249f59428268c8aa99edad1b438 /source
parent6b600d079351fa5490d74d5661c47346196e57f3 (diff)
BGE cleanup: Removing the PHY__Vector classes and replacing them with MT_Vectors. The PHY__Vectors didn't offer anything (not even any real abstraction) and they required annoying MT_Vector <-> PHY_Vector conversions all over the place. No functional changes.
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Converter/KX_ConvertSensors.cpp7
-rw-r--r--source/gameengine/Ketsji/KX_CharacterWrapper.cpp11
-rw-r--r--source/gameengine/Ketsji/KX_RayCast.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_VehicleWrapper.cpp15
-rw-r--r--source/gameengine/Ketsji/KX_VehicleWrapper.h1
-rw-r--r--source/gameengine/Physics/Bullet/CcdGraphicController.cpp2
-rw-r--r--source/gameengine/Physics/Bullet/CcdGraphicController.h2
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp2
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.h2
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp22
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h6
-rw-r--r--source/gameengine/Physics/Dummy/CMakeLists.txt1
-rw-r--r--source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp2
-rw-r--r--source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h6
-rw-r--r--source/gameengine/Physics/common/CMakeLists.txt1
-rw-r--r--source/gameengine/Physics/common/PHY_DynamicTypes.h71
-rw-r--r--source/gameengine/Physics/common/PHY_ICharacter.h4
-rw-r--r--source/gameengine/Physics/common/PHY_IGraphicController.h2
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsController.h4
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h16
-rw-r--r--source/gameengine/Physics/common/PHY_IVehicle.h6
22 files changed, 56 insertions, 141 deletions
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp
index 538f9e2c833..acaf911c26e 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.cpp
+++ b/source/gameengine/Converter/KX_ConvertSensors.cpp
@@ -260,14 +260,9 @@ void BL_ConvertSensors(struct Object* blenderobject,
// this sumoObject is not deleted by a gameobj, so delete it ourself
// later (memleaks)!
float radius = blendernearsensor->dist;
- PHY__Vector3 pos;
const MT_Vector3& wpos = gameobj->NodeGetWorldPosition();
- pos[0] = (float)wpos[0];
- pos[1] = (float)wpos[1];
- pos[2] = (float)wpos[2];
- pos[3] = 0.f;
bool bFindMaterial = false;
- PHY_IPhysicsController* physCtrl = kxscene->GetPhysicsEnvironment()->CreateSphereController(radius,pos);
+ PHY_IPhysicsController* physCtrl = kxscene->GetPhysicsEnvironment()->CreateSphereController(radius,wpos);
//will be done in KX_TouchEventManager::RegisterSensor()
//if (isInActiveLayer)
diff --git a/source/gameengine/Ketsji/KX_CharacterWrapper.cpp b/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
index a669bdd2586..3fbddef89be 100644
--- a/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
@@ -113,10 +113,8 @@ PyObject *KX_CharacterWrapper::pyattr_get_jump_count(void *self_v, const KX_PYAT
PyObject *KX_CharacterWrapper::pyattr_get_walk_dir(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_CharacterWrapper* self = static_cast<KX_CharacterWrapper*>(self_v);
- PHY__Vector3 vec = self->m_character->GetWalkDirection();
- MT_Vector3 retval = MT_Vector3(vec[0], vec[1], vec[2]);
- return PyObjectFrom(retval);
+ return PyObjectFrom(self->m_character->GetWalkDirection());
}
int KX_CharacterWrapper::pyattr_set_walk_dir(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
@@ -128,12 +126,7 @@ int KX_CharacterWrapper::pyattr_set_walk_dir(void *self_v, const KX_PYATTRIBUTE_
return PY_SET_ATTR_FAIL;
}
- PHY__Vector3 vec;
- vec[0] = dir[0];
- vec[1] = dir[1];
- vec[2] = dir[2];
-
- self->m_character->SetWalkDirection(vec);
+ self->m_character->SetWalkDirection(dir);
return PY_SET_ATTR_SUCCESS;
}
diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp
index 2a6b7d122b5..878f9d267dc 100644
--- a/source/gameengine/Ketsji/KX_RayCast.cpp
+++ b/source/gameengine/Ketsji/KX_RayCast.cpp
@@ -51,10 +51,10 @@ KX_RayCast::KX_RayCast(KX_IPhysicsController* ignoreController, bool faceNormal,
void KX_RayCast::reportHit(PHY_RayCastResult* result)
{
m_hitFound = true;
- m_hitPoint.setValue((const float*)result->m_hitPoint);
- m_hitNormal.setValue((const float*)result->m_hitNormal);
+ m_hitPoint = MT_Vector3(result->m_hitPoint);
+ m_hitNormal = MT_Vector3(result->m_hitNormal);
m_hitUVOK = result->m_hitUVOK;
- m_hitUV.setValue((const float*)result->m_hitUV);
+ m_hitUV = MT_Vector2(result->m_hitUV);
m_hitMesh = result->m_meshObject;
m_hitPolygon = result->m_polygon;
}
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index bb2f9a8354a..fec275322e9 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1490,7 +1490,7 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* rasty,KX_Camera* cam, int
if (m_dbvt_culling)
{
// test culling through Bullet
- PHY__Vector4 planes[6];
+ MT_Vector4 planes[6];
// get the clip planes
MT_Vector4* cplanes = cam->GetNormalizedClipPlanes();
// and convert
@@ -1711,13 +1711,11 @@ void KX_Scene::SetGravity(const MT_Vector3& gravity)
MT_Vector3 KX_Scene::GetGravity()
{
- PHY__Vector3 gravity;
- MT_Vector3 vec;
+ MT_Vector3 gravity;
GetPhysicsEnvironment()->getGravity(gravity);
- vec = gravity.m_vec;
- return vec;
+ return gravity;
}
void KX_Scene::SetSceneConverter(class KX_BlenderSceneConverter* sceneConverter)
diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
index 9cc91a33886..f189891bf02 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
@@ -59,19 +59,12 @@ PyObject *KX_VehicleWrapper::PyAddWheel(PyObject *args)
PyVecTo(pylistPos,attachPos);
PyVecTo(pylistDir,attachDir);
PyVecTo(pylistAxleDir,attachAxle);
- PHY__Vector3 aPos,aDir,aAxle;
- aPos[0] = attachPos[0];
- aPos[1] = attachPos[1];
- aPos[2] = attachPos[2];
- aDir[0] = attachDir[0];
- aDir[1] = attachDir[1];
- aDir[2] = attachDir[2];
- aAxle[0] = -attachAxle[0];//someone reverse some conventions inside Bullet (axle winding)
- aAxle[1] = -attachAxle[1];
- aAxle[2] = -attachAxle[2];
+
+ //someone reverse some conventions inside Bullet (axle winding)
+ attachAxle = -attachAxle;
printf("attempt for addWheel: suspensionRestLength%f wheelRadius %f, hasSteering:%d\n",suspensionRestLength,wheelRadius,hasSteering);
- m_vehicle->AddWheel(motionState,aPos,aDir,aAxle,suspensionRestLength,wheelRadius,hasSteering);
+ m_vehicle->AddWheel(motionState,attachPos,attachDir,attachAxle,suspensionRestLength,wheelRadius,hasSteering);
}
} else {
diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.h b/source/gameengine/Ketsji/KX_VehicleWrapper.h
index ccd666e84f3..c38f57d8b9f 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.h
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.h
@@ -7,7 +7,6 @@
#define __KX_VEHICLEWRAPPER_H__
#include "Value.h"
-#include "PHY_DynamicTypes.h"
class PHY_IVehicle;
class PHY_IMotionState;
diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp
index 36e7b0d482f..3cb80e53e12 100644
--- a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp
@@ -55,7 +55,7 @@ void CcdGraphicController::setLocalAabb(const MT_Point3& aabbMin,const MT_Point3
SetGraphicTransform();
}
-void CcdGraphicController::setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax)
+void CcdGraphicController::setLocalAabb(const MT_Vector3& aabbMin,const MT_Vector3& aabbMax)
{
m_localAabbMin.setValue(aabbMin[0],aabbMin[1],aabbMin[2]);
m_localAabbMax.setValue(aabbMax[0],aabbMax[1],aabbMax[2]);
diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.h b/source/gameengine/Physics/Bullet/CcdGraphicController.h
index 72eb699ce5b..064f86040f6 100644
--- a/source/gameengine/Physics/Bullet/CcdGraphicController.h
+++ b/source/gameengine/Physics/Bullet/CcdGraphicController.h
@@ -42,7 +42,7 @@ public:
void setLocalAabb(const btVector3& aabbMin,const btVector3& aabbMax);
void setLocalAabb(const MT_Point3& aabbMin,const MT_Point3& aabbMax);
- virtual void setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax);
+ virtual void setLocalAabb(const MT_Vector3& aabbMin,const MT_Vector3& aabbMax);
virtual void setLocalAabb(const float aabbMin[3],const float aabbMax[3]);
PHY_IMotionState* GetMotionState() { return m_motionState; }
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 0de21e33eff..ef43e094e6d 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -1092,7 +1092,7 @@ void CcdPhysicsController::resolveCombinedVelocities(float linvelX,float linvel
{
}
-void CcdPhysicsController::getPosition(PHY__Vector3& pos) const
+void CcdPhysicsController::getPosition(MT_Vector3& pos) const
{
const btTransform& xform = m_object->getWorldTransform();
pos[0] = xform.getOrigin().x();
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
index b271b9c424f..f1f0ca31419 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
@@ -524,7 +524,7 @@ protected:
virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal);
virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal);
virtual void setPosition(float posX,float posY,float posZ);
- virtual void getPosition(PHY__Vector3& pos) const;
+ virtual void getPosition(MT_Vector3& pos) const;
virtual void setScaling(float scaleX,float scaleY,float scaleZ);
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 254624cd8a0..702452bc77e 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -97,9 +97,9 @@ public:
virtual void AddWheel(
PHY_IMotionState* motionState,
- PHY__Vector3 connectionPoint,
- PHY__Vector3 downDirection,
- PHY__Vector3 axleDirection,
+ MT_Vector3 connectionPoint,
+ MT_Vector3 downDirection,
+ MT_Vector3 axleDirection,
float suspensionRestLength,
float wheelRadius,
bool hasSteering
@@ -311,20 +311,16 @@ public:
return m_controller->getJumpCount();
}
- virtual void SetWalkDirection(PHY__Vector3 dir)
+ virtual void SetWalkDirection(const MT_Vector3& dir)
{
btVector3 vec = btVector3(dir[0], dir[1], dir[2]);
m_controller->setWalkDirection(vec);
}
- virtual PHY__Vector3 GetWalkDirection()
+ virtual MT_Vector3 GetWalkDirection()
{
btVector3 vec = m_controller->getWalkDirection();
- PHY__Vector3 retval;
- retval[0] = vec[0];
- retval[1] = vec[1];
- retval[2] = vec[2];
- return retval;
+ return MT_Vector3(vec[0], vec[1], vec[2]);
}
};
@@ -951,7 +947,7 @@ void CcdPhysicsEnvironment::setSolverType(int solverType)
-void CcdPhysicsEnvironment::getGravity(PHY__Vector3& grav)
+void CcdPhysicsEnvironment::getGravity(MT_Vector3& grav)
{
const btVector3& gravity = m_dynamicsWorld->getGravity();
grav[0] = gravity.getX();
@@ -1851,7 +1847,7 @@ struct DbvtCullingCallback : btDbvt::ICollide
};
static OcclusionBuffer gOcb;
-bool CcdPhysicsEnvironment::cullingTest(PHY_CullingCallback callback, void* userData, PHY__Vector4 *planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16])
+bool CcdPhysicsEnvironment::cullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4 *planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16])
{
if (!m_cullingTree)
return false;
@@ -2362,7 +2358,7 @@ int numController = 0;
-PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radius,const PHY__Vector3& position)
+PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radius,const MT_Vector3& position)
{
CcdConstructionInfo cinfo;
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
index 18ce0550498..8cf88526969 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
@@ -140,7 +140,7 @@ protected:
virtual void setDebugMode(int debugMode);
virtual void setGravity(float x,float y,float z);
- virtual void getGravity(PHY__Vector3& grav);
+ virtual void getGravity(MT_Vector3& grav);
virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
@@ -190,7 +190,7 @@ protected:
btTypedConstraint* getConstraintById(int constraintId);
virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ);
- virtual bool cullingTest(PHY_CullingCallback callback, void* userData, PHY__Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]);
+ virtual bool cullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]);
//Methods for gamelogic collision/physics callbacks
@@ -200,7 +200,7 @@ protected:
virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl);
virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl);
//These two methods are used *solely* to create controllers for Near/Radar sensor! Don't use for anything else
- virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position);
+ virtual PHY_IPhysicsController* CreateSphereController(float radius,const MT_Vector3& position);
virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight);
diff --git a/source/gameengine/Physics/Dummy/CMakeLists.txt b/source/gameengine/Physics/Dummy/CMakeLists.txt
index 6a21fc6fcb7..529a75b2a62 100644
--- a/source/gameengine/Physics/Dummy/CMakeLists.txt
+++ b/source/gameengine/Physics/Dummy/CMakeLists.txt
@@ -26,6 +26,7 @@
set(INC
.
../common
+ ../../../../intern/moto/include
)
set(INC_SYS
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
index d1fabba18f9..72450e4307c 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
@@ -85,7 +85,7 @@ void DummyPhysicsEnvironment::setGravity(float x,float y,float z)
{
}
-void DummyPhysicsEnvironment::getGravity(PHY__Vector3& grav)
+void DummyPhysicsEnvironment::getGravity(class MT_Vector3& grav)
{
}
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
index 5ce34bdf7cf..9f6bc85fced 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
@@ -56,7 +56,7 @@ public:
virtual float getFixedTimeStep();
virtual void setGravity(float x,float y,float z);
- virtual void getGravity(PHY__Vector3& grav);
+ virtual void getGravity(class MT_Vector3& grav);
virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
float pivotX,float pivotY,float pivotZ,
@@ -80,7 +80,7 @@ public:
}
virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ);
- virtual bool cullingTest(PHY_CullingCallback callback, void* userData, PHY__Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) { return false; }
+ virtual bool cullingTest(PHY_CullingCallback callback, void* userData, class MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) { return false; }
//gamelogic callbacks
@@ -91,7 +91,7 @@ public:
}
virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl) { return false; }
virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl) { return false;}
- virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position) {return 0;}
+ virtual PHY_IPhysicsController* CreateSphereController(float radius,const class MT_Vector3& position) {return 0;}
virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight) { return 0;}
virtual void setConstraintParam(int constraintId,int param,float value,float value1)
diff --git a/source/gameengine/Physics/common/CMakeLists.txt b/source/gameengine/Physics/common/CMakeLists.txt
index 400e475f8a2..5e0e5964ca0 100644
--- a/source/gameengine/Physics/common/CMakeLists.txt
+++ b/source/gameengine/Physics/common/CMakeLists.txt
@@ -26,6 +26,7 @@
set(INC
.
../Dummy
+ ../../../../intern/moto/include
)
set(INC_SYS
diff --git a/source/gameengine/Physics/common/PHY_DynamicTypes.h b/source/gameengine/Physics/common/PHY_DynamicTypes.h
index 0fe2533cf93..d10f48ad7a4 100644
--- a/source/gameengine/Physics/common/PHY_DynamicTypes.h
+++ b/source/gameengine/Physics/common/PHY_DynamicTypes.h
@@ -20,69 +20,9 @@ subject to the following restrictions:
#ifndef __PHY_DYNAMICTYPES_H__
#define __PHY_DYNAMICTYPES_H__
-
+#include "MT_Vector3.h"
struct KX_ClientObjectInfo;
-class PHY_Shape;
-
-struct PHY__Vector2
-{
- float m_vec[2];
-
- operator const float* () const
- {
- return &m_vec[0];
- }
- operator float* ()
- {
- return &m_vec[0];
- }
-};
-
-struct PHY__Vector3
-{
- float m_vec[4];
-
- operator const float* () const
- {
- return &m_vec[0];
- }
- operator float* ()
- {
- return &m_vec[0];
- }
-};
-
-struct PHY__Vector4
-{
- float m_vec[4];
- PHY__Vector4() {}
- void setValue(const float *value)
- {
- m_vec[0] = *value++;
- m_vec[1] = *value++;
- m_vec[2] = *value++;
- m_vec[3] = *value++;
- }
- void setValue(const double *value)
- {
- m_vec[0] = (float)(*value++);
- m_vec[1] = (float)(*value++);
- m_vec[2] = (float)(*value++);
- m_vec[3] = (float)(*value++);
- }
-
- operator const float* () const
- {
- return &m_vec[0];
- }
- operator float* ()
- {
- return &m_vec[0];
- }
-};
-
-//typedef float PHY__Vector3[4];
enum
{
@@ -97,9 +37,9 @@ enum
};
typedef struct PHY_CollData {
- PHY__Vector3 m_point1; /* Point in object1 in world coordinates */
- PHY__Vector3 m_point2; /* Point in object2 in world coordinates */
- PHY__Vector3 m_normal; /* point2 - point1 */
+ MT_Vector3 m_point1; /* Point in object1 in world coordinates */
+ MT_Vector3 m_point2; /* Point in object2 in world coordinates */
+ MT_Vector3 m_normal; /* point2 - point1 */
} PHY_CollData;
@@ -148,7 +88,4 @@ typedef enum PHY_ShapeType {
PHY_SHAPE_PROXY
} PHY_ShapeType;
-
-typedef float PHY_Vector3[3];
-
#endif /* __PHY_DYNAMICTYPES_H__ */
diff --git a/source/gameengine/Physics/common/PHY_ICharacter.h b/source/gameengine/Physics/common/PHY_ICharacter.h
index 8a599452816..a3d3000a143 100644
--- a/source/gameengine/Physics/common/PHY_ICharacter.h
+++ b/source/gameengine/Physics/common/PHY_ICharacter.h
@@ -28,8 +28,8 @@ public:
virtual int GetJumpCount()= 0;
- virtual void SetWalkDirection(PHY__Vector3 dir)=0;
- virtual PHY__Vector3 GetWalkDirection()=0;
+ virtual void SetWalkDirection(const class MT_Vector3& dir)=0;
+ virtual MT_Vector3 GetWalkDirection()=0;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_ICharacter")
diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.h b/source/gameengine/Physics/common/PHY_IGraphicController.h
index fb36481ddbc..8c38eebe283 100644
--- a/source/gameengine/Physics/common/PHY_IGraphicController.h
+++ b/source/gameengine/Physics/common/PHY_IGraphicController.h
@@ -48,7 +48,7 @@ class PHY_IGraphicController : public PHY_IController
*/
virtual bool SetGraphicTransform()=0;
virtual void Activate(bool active=true)=0;
- virtual void setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax)=0;
+ virtual void setLocalAabb(const class MT_Vector3& aabbMin,const class MT_Vector3& aabbMax)=0;
virtual void setLocalAabb(const float* aabbMin,const float* aabbMax)=0;
virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate) {return 0;}
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.h b/source/gameengine/Physics/common/PHY_IPhysicsController.h
index 871edeec752..e6f26bc5b1b 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsController.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsController.h
@@ -66,7 +66,7 @@ class PHY_IPhysicsController : public PHY_IController
virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal)=0;
virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal)=0;
virtual void setPosition(float posX,float posY,float posZ)=0;
- virtual void getPosition(PHY__Vector3& pos) const=0;
+ virtual void getPosition(class MT_Vector3& pos) const=0;
virtual void setScaling(float scaleX,float scaleY,float scaleZ)=0;
// physics methods
@@ -100,7 +100,7 @@ class PHY_IPhysicsController : public PHY_IController
virtual float GetLinVelocityMax() const=0;
virtual void SetLinVelocityMax(float val) = 0;
- PHY__Vector3 GetWorldPosition(PHY__Vector3& localpos);
+ class MT_Vector3 GetWorldPosition(class MT_Vector3& localpos);
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
index 6a76745c7ca..e7560ea02cc 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
@@ -32,8 +32,10 @@
#ifndef __PHY_IPHYSICSENVIRONMENT_H__
#define __PHY_IPHYSICSENVIRONMENT_H__
-#include <vector>
#include "PHY_DynamicTypes.h"
+#include "MT_Vector2.h"
+#include "MT_Vector3.h"
+#include "MT_Vector4.h"
#ifdef WITH_CXX_GUARDEDALLOC
#include "MEM_guardedalloc.h"
@@ -50,13 +52,13 @@ class PHY_IPhysicsController;
struct PHY_RayCastResult
{
PHY_IPhysicsController* m_controller;
- PHY__Vector3 m_hitPoint;
- PHY__Vector3 m_hitNormal;
+ MT_Vector3 m_hitPoint;
+ MT_Vector3 m_hitNormal;
const RAS_MeshObject* m_meshObject; // !=NULL for mesh object (only for Bullet controllers)
int m_polygon; // index of the polygon hit by the ray,
// only if m_meshObject != NULL
int m_hitUVOK; // !=0 if UV coordinate in m_hitUV is valid
- PHY__Vector2 m_hitUV; // UV coordinates of hit point
+ MT_Vector2 m_hitUV; // UV coordinates of hit point
};
/**
@@ -144,7 +146,7 @@ class PHY_IPhysicsEnvironment
virtual void setUseEpa(bool epa) {}
virtual void setGravity(float x,float y,float z)=0;
- virtual void getGravity(PHY__Vector3& grav) = 0;
+ virtual void getGravity(MT_Vector3& grav) = 0;
virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
float pivotX,float pivotY,float pivotZ,
@@ -167,7 +169,7 @@ class PHY_IPhysicsEnvironment
//culling based on physical broad phase
// the plane number must be set as follow: near, far, left, right, top, botton
// the near plane must be the first one and must always be present, it is used to get the direction of the view
- virtual bool cullingTest(PHY_CullingCallback callback, void *userData, PHY__Vector4* planeNormals, int planeNumber, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) = 0;
+ virtual bool cullingTest(PHY_CullingCallback callback, void *userData, MT_Vector4* planeNormals, int planeNumber, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) = 0;
//Methods for gamelogic collision/physics callbacks
//todo:
@@ -177,7 +179,7 @@ class PHY_IPhysicsEnvironment
virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl)=0;
virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl)=0;
//These two methods are *solely* used to create controllers for sensor! Don't use for anything else
- virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position) =0;
+ virtual PHY_IPhysicsController* CreateSphereController(float radius,const MT_Vector3& position) =0;
virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight)=0;
virtual void setConstraintParam(int constraintId,int param,float value,float value1) = 0;
diff --git a/source/gameengine/Physics/common/PHY_IVehicle.h b/source/gameengine/Physics/common/PHY_IVehicle.h
index ecf7a87c40f..624f435c9f0 100644
--- a/source/gameengine/Physics/common/PHY_IVehicle.h
+++ b/source/gameengine/Physics/common/PHY_IVehicle.h
@@ -22,9 +22,9 @@ public:
virtual void AddWheel(
PHY_IMotionState* motionState,
- PHY__Vector3 connectionPoint,
- PHY__Vector3 downDirection,
- PHY__Vector3 axleDirection,
+ MT_Vector3 connectionPoint,
+ MT_Vector3 downDirection,
+ MT_Vector3 axleDirection,
float suspensionRestLength,
float wheelRadius,
bool hasSteering