diff options
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.cpp | 49 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Dome.cpp | 10 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Light.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Light.h | 4 |
4 files changed, 32 insertions, 33 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); diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index 5f490747c2b..b2a480e99ca 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -34,6 +34,7 @@ #endif #include <stdio.h> +#include "DNA_scene_types.h" #include "KX_Light.h" #include "KX_Camera.h" @@ -44,7 +45,6 @@ #include "KX_PyMath.h" #include "DNA_object_types.h" -#include "DNA_scene_types.h" #include "DNA_lamp_types.h" #include "BKE_scene.h" diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h index b446acd6e63..469f2d62b76 100644 --- a/source/gameengine/Ketsji/KX_Light.h +++ b/source/gameengine/Ketsji/KX_Light.h @@ -38,7 +38,7 @@ struct GPULamp; struct Scene; -struct Base; +struct BaseLegacy; class KX_Camera; class RAS_IRasterizer; class RAS_ILightObject; @@ -51,7 +51,7 @@ protected: RAS_ILightObject* m_lightobj; class RAS_IRasterizer* m_rasterizer; //needed for registering and replication of lightobj Scene* m_blenderscene; - Base* m_base; + BaseLegacy* m_base; public: KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,RAS_IRasterizer* rasterizer,RAS_ILightObject* lightobj, bool glsl); |