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/Ketsji | |
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/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_FontObject.cpp | 5 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.h | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 4 |
4 files changed, 11 insertions, 8 deletions
diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index 420f1f7eb98..13a5ec6c411 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -194,7 +194,10 @@ void KX_FontObject::DrawFontText() /* Get a working copy of the OpenGLMatrix to use */ double mat[16]; - memcpy(mat, this->GetOpenGLMatrix(), sizeof(double)*16); + float *origmat = GetOpenGLMatrix(); + for (unsigned short i = 0; i < 16; ++i) { + mat[i] = (double)origmat[i]; + } /* Account for offset */ MT_Vector3 offset = this->NodeGetWorldOrientation() * m_offset * this->NodeGetWorldScaling(); diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 412a112df6b..38d8a303fe8 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -700,10 +700,10 @@ void KX_GameObject::ApplyRotation(const MT_Vector3& drot,bool local) /** * GetOpenGL Matrix, returns an OpenGL 'compatible' matrix */ -double* KX_GameObject::GetOpenGLMatrix() +float *KX_GameObject::GetOpenGLMatrix() { // todo: optimize and only update if necessary - double* fl = m_OpenGL_4x4Matrix.getPointer(); + float *fl = m_OpenGL_4x4Matrix.getPointer(); if (GetSGNode()) { MT_Transform trans; @@ -742,7 +742,7 @@ void KX_GameObject::AddMeshUser() m_meshes[i]->AddMeshUser(this, &m_meshSlots, GetDeformer()); } // set the part of the mesh slot that never change - double* fl = GetOpenGLMatrixPtr()->getPointer(); + float *fl = GetOpenGLMatrixPtr()->getPointer(); SG_QList::iterator<RAS_MeshSlot> mit(m_meshSlots); // RAS_MeshSlot* ms; @@ -2768,7 +2768,7 @@ PyObject *KX_GameObject::pyattr_get_localTransform(void *self_v, const KX_PYATTR { KX_GameObject* self = static_cast<KX_GameObject*>(self_v); - double mat[16]; + float mat[16]; MT_Transform trans; diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index c2c455dab6a..a25f999026c 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -175,7 +175,7 @@ public: * side effect of storing the result internally. The * memory for the matrix remains the property of this class. */ - double * + float * GetOpenGLMatrix( ); diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 16d1fdd6ea2..350bad0a336 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1557,9 +1557,9 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* rasty,KX_Camera* cam, int planes[5].setValue(cplanes[3].getValue()); // bottom CullingInfo info(layer); - double mvmat[16] = {0}; + float mvmat[16] = {0}; cam->GetModelviewMatrix().getValue(mvmat); - double pmat[16] = {0}; + float pmat[16] = {0}; cam->GetProjectionMatrix().getValue(pmat); dbvt_culling = m_physicsEnvironment->CullingTest(PhysicsCullingCallback,&info,planes,5,m_dbvt_occlusion_res, |