diff options
author | Mike Erwin <significant.bit@gmail.com> | 2017-03-23 03:58:53 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2017-03-23 04:33:53 +0300 |
commit | 559bfd973eb7285bae17f831e456070efa687145 (patch) | |
tree | 3895eb4bec1d0f46fa2d012d11138c125a05af33 /source | |
parent | cd37248f90df468a95eb15226554f73aa27e501e (diff) |
convert last remaining GLU calls in BGE
Focus is on getting rid of GLU. We expect UPBGE to replace current BGE.
Part of T49042
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.cpp | 49 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Dome.cpp | 10 |
2 files changed, 29 insertions, 30 deletions
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 89aea80bb67..4a97dc09f62 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -31,7 +31,7 @@ */ -#include "glew-mx.h" +#include "GPU_matrix.h" #include "KX_Camera.h" #include "KX_Scene.h" #include "KX_PythonInit.h" @@ -1048,19 +1048,21 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, getScreenPosition, } const GLint *viewport; - GLdouble win[3]; - GLdouble modelmatrix[16]; - GLdouble projmatrix[16]; + GLfloat vec[3]; + GLfloat win[3]; + GLfloat modelmatrix[4][4]; + GLfloat projmatrix[4][4]; MT_Matrix4x4 m_modelmatrix = this->GetWorldToCamera(); MT_Matrix4x4 m_projmatrix = this->GetProjectionMatrix(); - m_modelmatrix.getValue(modelmatrix); - m_projmatrix.getValue(projmatrix); + vect.getValue(vec); + m_modelmatrix.getValue((float*) modelmatrix); + m_projmatrix.getValue((float*) projmatrix); viewport = KX_GetActiveEngine()->GetCanvas()->GetViewPort(); - gluProject(vect[0], vect[1], vect[2], modelmatrix, projmatrix, viewport, &win[0], &win[1], &win[2]); + gpuProject(vec, modelmatrix, projmatrix, viewport, win); vect[0] = (win[0] - viewport[0]) / viewport[2]; vect[1] = (win[1] - viewport[1]) / viewport[3]; @@ -1087,36 +1089,33 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenVect, y = 1.0 - y; //to follow Blender window coordinate system (Top-Down) - MT_Vector3 vect; - MT_Point3 campos, screenpos; - const GLint *viewport; - GLdouble win[3]; - GLdouble modelmatrix[16]; - GLdouble projmatrix[16]; + GLfloat vec[3]; + GLfloat win[3]; + GLfloat modelmatrix[4][4]; + GLfloat projmatrix[4][4]; MT_Matrix4x4 m_modelmatrix = this->GetWorldToCamera(); MT_Matrix4x4 m_projmatrix = this->GetProjectionMatrix(); - m_modelmatrix.getValue(modelmatrix); - m_projmatrix.getValue(projmatrix); + m_modelmatrix.getValue((float*) modelmatrix); + m_projmatrix.getValue((float*) projmatrix); viewport = KX_GetActiveEngine()->GetCanvas()->GetViewPort(); - vect[0] = x * viewport[2]; - vect[1] = y * viewport[3]; - - vect[0] += viewport[0]; - vect[1] += viewport[1]; + vec[0] = x * viewport[2]; + vec[1] = y * viewport[3]; - vect[2] = 0.f; + vec[0] += viewport[0]; + vec[1] += viewport[1]; - gluUnProject(vect[0], vect[1], vect[2], modelmatrix, projmatrix, viewport, &win[0], &win[1], &win[2]); + vec[2] = 0.f; - campos = this->GetCameraLocation(); - screenpos = MT_Point3(win[0], win[1], win[2]); - vect = campos-screenpos; + gpuUnProject(vec, modelmatrix, projmatrix, viewport, win); + MT_Point3 campos = this->GetCameraLocation(); + MT_Point3 screenpos(win[0], win[1], win[2]); + MT_Vector3 vect = campos - screenpos; vect.normalize(); return PyObjectFrom(vect); } diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index d08372e47d4..7abff85d39c 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -41,7 +41,7 @@ #include "RAS_CameraData.h" #include "BLI_math.h" -#include "glew-mx.h" +#include "GPU_matrix.h" // constructor KX_Dome::KX_Dome ( @@ -1685,7 +1685,7 @@ void KX_Dome::DrawEnvMap(void) glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0.0f,0.0f,1.0f, 0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f); + gpuLookAt(0.0f,0.0f,1.0f, 0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f); glPolygonMode(GL_FRONT, GL_FILL); glShadeModel(GL_SMOOTH); @@ -1830,7 +1830,7 @@ void KX_Dome::DrawDomeFisheye(void) glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0.0f,-1.0f,0.0f, 0.0f,0.0f,0.0f, 0.0f,0.0f,1.0f); + gpuLookAt(0.0f,-1.0f,0.0f, 0.0f,0.0f,0.0f, 0.0f,0.0f,1.0f); if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) glPolygonMode(GL_FRONT, GL_LINE); @@ -1913,7 +1913,7 @@ void KX_Dome::DrawPanorama(void) glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0.0f,-1.0f,0.0f, 0.0f,0.0f,0.0f, 0.0f,0.0f,1.0f); + gpuLookAt(0.0f,-1.0f,0.0f, 0.0f,0.0f,0.0f, 0.0f,0.0f,1.0f); if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) glPolygonMode(GL_FRONT, GL_LINE); @@ -1981,7 +1981,7 @@ void KX_Dome::DrawDomeWarped(void) glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0.0f, 0.0f, 1.0f, 0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f); + gpuLookAt(0.0f, 0.0f, 1.0f, 0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f); if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) glPolygonMode(GL_FRONT, GL_LINE); |