diff options
author | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-12-13 04:01:28 +0300 |
---|---|---|
committer | Jorge Bernal <jbernalmartinez@gmail.com> | 2015-12-13 04:09:05 +0300 |
commit | 6329e20cbb64910d0d9de357df76473f93399975 (patch) | |
tree | 66a1d773f654bed3ebe875601980a0b9f22ff451 /source/gameengine/Physics | |
parent | 9df6a539a2c93c2b8fe32d0d5b564c62bbadba9a (diff) |
BGE: Use float as default instead of double in Moto library.
Use float in moto instead of double for MT_Scalar.
This switch allow future optimization like SSE.
Additionally, it changes the OpenGL calls to float versions as they are
very bad with doubles.
Reviewers: campbellbarton, moguri, lordloki
Reviewed By: lordloki
Subscribers: brecht, lordloki
Differential Revision: https://developer.blender.org/D1610
Diffstat (limited to 'source/gameengine/Physics')
4 files changed, 7 insertions, 7 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index d7b043661a0..9f0fc6d9d4d 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -1472,7 +1472,7 @@ struct OcclusionBuffer m[15] = btScalar(m1[3] * m2[12] + m1[7] * m2[13] + m1[11] * m2[14] + m1[15] * m2[15]); } - void setup(int size, const int *view, double modelview[16], double projection[16]) + void setup(int size, const int *view, float modelview[16], float projection[16]) { m_initialized = false; m_occlusion = false; @@ -1519,7 +1519,7 @@ struct OcclusionBuffer m_occlusion = false; } - void SetModelMatrix(double *fl) + void SetModelMatrix(float *fl) { CMmat4mul(m_mtc,m_wtc,fl); if (!m_initialized) { @@ -1969,7 +1969,7 @@ struct DbvtCullingCallback : btDbvt::ICollide KX_GameObject* gameobj = KX_GameObject::GetClientObject(info); if (gameobj && gameobj->GetOccluder()) { - double* fl = gameobj->GetOpenGLMatrixPtr()->getPointer(); + float *fl = gameobj->GetOpenGLMatrixPtr()->getPointer(); // this will create the occlusion buffer if not already done // and compute the transformation from model local space to clip space m_ocb->SetModelMatrix(fl); @@ -2010,7 +2010,7 @@ struct DbvtCullingCallback : btDbvt::ICollide }; static OcclusionBuffer gOcb; -bool CcdPhysicsEnvironment::CullingTest(PHY_CullingCallback callback, void* userData, MT_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, float modelview[16], float projection[16]) { if (!m_cullingTree) return false; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index 86f663959f1..a64d2c8f15f 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -211,7 +211,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, MT_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, float modelview[16], float projection[16]); //Methods for gamelogic collision/physics callbacks diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h index 929345d7161..3e9379dd60d 100644 --- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h +++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h @@ -83,7 +83,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, class MT_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, float modelview[16], float projection[16]) { return false; } //gamelogic callbacks diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h index 4b8d36285be..2997048805f 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h +++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h @@ -183,7 +183,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, MT_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, float modelview[16], float projection[16]) = 0; //Methods for gamelogic collision/physics callbacks //todo: |