diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-02-21 22:30:11 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-02-21 22:30:11 +0400 |
commit | 815e00917dcb4137f9687ab602f527920fa8c41d (patch) | |
tree | 4c089bc7f19a9249f59428268c8aa99edad1b438 /source/gameengine/Ketsji | |
parent | 6b600d079351fa5490d74d5661c47346196e57f3 (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/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_CharacterWrapper.cpp | 11 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_RayCast.cpp | 6 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_VehicleWrapper.cpp | 15 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_VehicleWrapper.h | 1 |
5 files changed, 12 insertions, 29 deletions
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; |