diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-12-13 10:33:35 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-12-13 10:33:35 +0300 |
commit | ef2aecf2db981b5344e0d14e7f074f1742b0b2f7 (patch) | |
tree | d016e95050f10eda7bc44e1bdfa2f7c4fc0fc024 /source/gameengine | |
parent | cf8980559fdc2e9731d9229512a554212173ea4f (diff) | |
parent | d9ee88d126ddb59b68d2561694b522a99e4923b6 (diff) |
Merge branch 'master' into GPencil_Editing_Stage3GPencil_Editing_Stage3
Diffstat (limited to 'source/gameengine')
20 files changed, 111 insertions, 108 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, 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: diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index cedc27c3b92..82b26749fd1 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -495,10 +495,10 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glBegin(GL_QUADS); glColor4f(1.f, 1.f, 1.f, 1.f); - glTexCoord2f(1.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[3]); glVertex2f(1,1); - glTexCoord2f(0.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[3]); glVertex2f(-1,1); - glTexCoord2f(0.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[2]); glVertex2f(-1,-1); - glTexCoord2f(1.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[2]); glVertex2f(1,-1); + glTexCoord2f(1.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[3]); glVertex2f(1.0f,1.0f); + glTexCoord2f(0.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[3]); glVertex2f(-1.0f,1.0f); + glTexCoord2f(0.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[2]); glVertex2f(-1.0f,-1.0f); + glTexCoord2f(1.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[2]); glVertex2f(1.0f,-1.0f); glEnd(); } } diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp index f90b5959f76..d131891cb90 100644 --- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp +++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp @@ -282,7 +282,7 @@ void RAS_BucketManager::OptimizeBuckets(MT_Scalar distance) { BucketList::iterator bit; - distance = 10.0; + distance = 10.0f; for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) (*bit)->Optimize(distance); diff --git a/source/gameengine/Rasterizer/RAS_CameraData.h b/source/gameengine/Rasterizer/RAS_CameraData.h index e2024a4a55d..bc8433afd05 100644 --- a/source/gameengine/Rasterizer/RAS_CameraData.h +++ b/source/gameengine/Rasterizer/RAS_CameraData.h @@ -51,10 +51,10 @@ struct RAS_CameraData int m_viewporttop; float m_focallength; - RAS_CameraData(float lens = 35.0, float scale = 6.0, float sensor_x = 32.0, float sensor_y = 18.0, short sensor_fit = 0, - float shift_x = 0.0, float shift_y = 0.0, - float clipstart = 0.1, float clipend = 5000.0, bool perspective = true, - float focallength = 3.0, bool viewport = false, int viewportleft = 0, int viewportbottom = 0, + RAS_CameraData(float lens = 35.0f, float scale = 6.0f, float sensor_x = 32.0f, float sensor_y = 18.0f, short sensor_fit = 0, + float shift_x = 0.0f, float shift_y = 0.0f, + float clipstart = 0.1f, float clipend = 5000.0f, bool perspective = true, + float focallength = 3.0f, bool viewport = false, int viewportleft = 0, int viewportbottom = 0, int viewportright = 0, int viewporttop = 0) : m_lens(lens), m_scale(scale), diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp index c5f15c9ad21..8b0ec22fde3 100644 --- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp +++ b/source/gameengine/Rasterizer/RAS_FramingManager.cpp @@ -283,14 +283,14 @@ ComputeFrustum( switch (sensor_fit) { case RAS_SENSORFIT_HOR: { - x_scale = 1.0; + x_scale = 1.0f; y_scale = float(viewport.GetHeight()) / float(viewport.GetWidth()); break; } case RAS_SENSORFIT_VERT: { x_scale = float(viewport.GetWidth()) / float(viewport.GetHeight()); - y_scale = 1.0; + y_scale = 1.0f; break; } case RAS_SENSORFIT_AUTO: @@ -377,14 +377,14 @@ RAS_FramingManager:: switch (sensor_fit) { case RAS_SENSORFIT_HOR: { - x_scale = 1.0; + x_scale = 1.0f; y_scale = float(viewport.GetHeight()) / float(viewport.GetWidth()); break; } case RAS_SENSORFIT_VERT: { x_scale = float(viewport.GetWidth()) / float(viewport.GetHeight()); - y_scale = 1.0; + y_scale = 1.0f; break; } case RAS_SENSORFIT_AUTO: diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp index d07b4910968..2a736aa7deb 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp @@ -62,10 +62,10 @@ void RAS_IPolyMaterial::Initialize( m_polymatid = m_newpolymatid++; m_flag = 0; m_multimode = 0; - m_shininess = 35.0; - m_specular.setValue(0.5,0.5,0.5); - m_specularity = 1.0; - m_diffuse.setValue(0.5,0.5,0.5); + m_shininess = 35.0f; + m_specular.setValue(0.5f,0.5f,0.5f); + m_specularity = 1.0f; + m_diffuse.setValue(0.5f,0.5f,0.5f); m_drawingmode = ConvertFaceMode(game, image); } @@ -85,10 +85,10 @@ RAS_IPolyMaterial::RAS_IPolyMaterial() m_flag(0), m_multimode(0) { - m_shininess = 35.0; - m_specular = MT_Vector3(0.5,0.5,0.5); - m_specularity = 1.0; - m_diffuse = MT_Vector3(0.5,0.5,0.5); + m_shininess = 35.0f; + m_specular = MT_Vector3(0.5f,0.5f,0.5f); + m_specularity = 1.0f; + m_diffuse = MT_Vector3(0.5f,0.5f,0.5f); } RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname, @@ -113,10 +113,10 @@ RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname, m_flag(0), m_multimode(0) { - m_shininess = 35.0; - m_specular = MT_Vector3(0.5,0.5,0.5); - m_specularity = 1.0; - m_diffuse = MT_Vector3(0.5,0.5,0.5); + m_shininess = 35.0f; + m_specular = MT_Vector3(0.5f,0.5f,0.5f); + m_specularity = 1.0f; + m_diffuse = MT_Vector3(0.5f,0.5f,0.5f); } diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index e960131c1fb..aa32f625475 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -422,7 +422,7 @@ public: /** * Render Tools */ - virtual void applyTransform(double *oglmatrix, int drawingmode) = 0; + virtual void applyTransform(float *oglmatrix, int drawingmode) = 0; /** * Renders 2D boxes. diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp index 13d49c53423..9cd8f77adfd 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp @@ -58,7 +58,7 @@ RAS_MeshSlot::RAS_MeshSlot() : SG_QList() m_bVisible = false; m_bCulled = true; m_bObjectColor = false; - m_RGBAcolor = MT_Vector4(0.0, 0.0, 0.0, 0.0); + m_RGBAcolor = MT_Vector4(0.0f, 0.0f, 0.0f, 0.0f); m_DisplayList = NULL; m_bDisplayList = true; m_joinSlot = NULL; diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h index 1eee99f896b..75cc382c78c 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h @@ -128,7 +128,7 @@ public: void* m_clientObj; RAS_Deformer* m_pDeformer; DerivedMesh* m_pDerivedMesh; - double* m_OpenGLMatrix; + float* m_OpenGLMatrix; // visibility bool m_bVisible; bool m_bCulled; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp index 4ac1c9c4ebb..8319b75331f 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp @@ -100,13 +100,13 @@ bool RAS_OpenGLLight::ApplyFixedFunctionLighting(KX_Scene *kxscene, int oblayer, //vec[0] = base->object->obmat[2][0]; //vec[1] = base->object->obmat[2][1]; //vec[2] = base->object->obmat[2][2]; - vec[3] = 0.0; + vec[3] = 0.0f; glLightfv((GLenum)(GL_LIGHT0+slot), GL_POSITION, vec); } else { - //vec[3] = 1.0; + //vec[3] = 1.0f; glLightfv((GLenum)(GL_LIGHT0+slot), GL_POSITION, vec); - glLightf((GLenum)(GL_LIGHT0+slot), GL_CONSTANT_ATTENUATION, 1.0); + glLightf((GLenum)(GL_LIGHT0+slot), GL_CONSTANT_ATTENUATION, 1.0f); glLightf((GLenum)(GL_LIGHT0+slot), GL_LINEAR_ATTENUATION, m_att1/m_distance); // without this next line it looks backward compatible. //attennuation still is acceptable @@ -124,30 +124,30 @@ bool RAS_OpenGLLight::ApplyFixedFunctionLighting(KX_Scene *kxscene, int oblayer, glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_EXPONENT, 128.0f * m_spotblend); } else { - glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, 180.0); + glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, 180.0f); } } if (m_nodiffuse) { - vec[0] = vec[1] = vec[2] = vec[3] = 0.0; + vec[0] = vec[1] = vec[2] = vec[3] = 0.0f; } else { vec[0] = m_energy*m_color[0]; vec[1] = m_energy*m_color[1]; vec[2] = m_energy*m_color[2]; - vec[3] = 1.0; + vec[3] = 1.0f; } glLightfv((GLenum)(GL_LIGHT0+slot), GL_DIFFUSE, vec); if (m_nospecular) { - vec[0] = vec[1] = vec[2] = vec[3] = 0.0; + vec[0] = vec[1] = vec[2] = vec[3] = 0.0f; } else if (m_nodiffuse) { vec[0] = m_energy*m_color[0]; vec[1] = m_energy*m_color[1]; vec[2] = m_energy*m_color[2]; - vec[3] = 1.0; + vec[3] = 1.0f; } glLightfv((GLenum)(GL_LIGHT0+slot), GL_SPECULAR, vec); @@ -262,7 +262,7 @@ void RAS_OpenGLLight::Update() // lights don't get their openGL matrix updated, do it now if (kxlight->GetSGNode()->IsDirty()) kxlight->GetOpenGLMatrix(); - double *dobmat = kxlight->GetOpenGLMatrixPtr()->getPointer(); + float *dobmat = kxlight->GetOpenGLMatrixPtr()->getPointer(); for (int i=0; i<4; i++) for (int j=0; j<4; j++, dobmat++) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index bbdf17b5bc4..e7b5bebd5e8 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -89,17 +89,17 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas, RAS_STORAGE_TYPE :RAS_IRasterizer(canvas), m_2DCanvas(canvas), m_fogenabled(false), - m_time(0.0), + m_time(0.0f), m_campos(0.0f, 0.0f, 0.0f), m_camortho(false), m_stereomode(RAS_STEREO_NOSTEREO), m_curreye(RAS_STEREO_LEFTEYE), - m_eyeseparation(0.0), - m_focallength(0.0), + m_eyeseparation(0.0f), + m_focallength(0.0f), m_setfocallength(false), m_noOfScanlines(32), m_motionblur(0), - m_motionblurvalue(-1.0), + m_motionblurvalue(-1.0f), m_usingoverrideshader(false), m_clientobject(NULL), m_auxilaryClientInfo(NULL), @@ -171,10 +171,10 @@ bool RAS_OpenGLRasterizer::Init() glFrontFace(GL_CCW); m_last_frontface = true; - m_redback = 0.4375; - m_greenback = 0.4375; - m_blueback = 0.4375; - m_alphaback = 0.0; + m_redback = 0.4375f; + m_greenback = 0.4375f; + m_blueback = 0.4375f; + m_alphaback = 0.0f; glClearColor(m_redback,m_greenback,m_blueback,m_alphaback); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); @@ -249,7 +249,7 @@ void RAS_OpenGLRasterizer::Exit() glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); - glClearDepth(1.0); + glClearDepth(1.0f); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glClearColor(m_redback, m_greenback, m_blueback, m_alphaback); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -371,8 +371,8 @@ void RAS_OpenGLRasterizer::FlushDebugShapes(SCA_IScene *scene) glColor4f(debugShapes[i].m_color[0], debugShapes[i].m_color[1], debugShapes[i].m_color[2], 1.0f); const MT_Scalar *fromPtr = &debugShapes[i].m_pos.x(); const MT_Scalar *toPtr= &debugShapes[i].m_param.x(); - glVertex3dv(fromPtr); - glVertex3dv(toPtr); + glVertex3fv(fromPtr); + glVertex3fv(toPtr); } glEnd(); @@ -383,7 +383,7 @@ void RAS_OpenGLRasterizer::FlushDebugShapes(SCA_IScene *scene) glBegin(GL_LINE_LOOP); glColor4f(debugShapes[i].m_color[0], debugShapes[i].m_color[1], debugShapes[i].m_color[2], 1.0f); - static const MT_Vector3 worldUp(0.0, 0.0, 1.0); + static const MT_Vector3 worldUp(0.0f, 0.0f, 1.0f); MT_Vector3 norm = debugShapes[i].m_param; MT_Matrix3x3 tr; if (norm.fuzzyZero() || norm == worldUp) @@ -403,12 +403,12 @@ void RAS_OpenGLRasterizer::FlushDebugShapes(SCA_IScene *scene) int n = (int)debugShapes[i].m_param2.y(); for (int j = 0; j<n; j++) { - MT_Scalar theta = j*M_PI*2/n; - MT_Vector3 pos(cos(theta) * rad, sin(theta) * rad, 0.0); + MT_Scalar theta = j*(float)M_PI*2/n; + MT_Vector3 pos(cos(theta) * rad, sin(theta) * rad, 0.0f); pos = pos*tr; pos += debugShapes[i].m_pos; const MT_Scalar* posPtr = &pos.x(); - glVertex3dv(posPtr); + glVertex3fv(posPtr); } glEnd(); } @@ -546,7 +546,7 @@ void RAS_OpenGLRasterizer::SetEye(const StereoEye eye) glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); } else { - //glAccum(GL_LOAD, 1.0); + //glAccum(GL_LOAD, 1.0f); glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE); ClearDepthBuffer(); } @@ -823,22 +823,22 @@ void RAS_OpenGLRasterizer::DrawDerivedMesh(class RAS_MeshSlot &ms) void RAS_OpenGLRasterizer::SetProjectionMatrix(MT_CmMatrix4x4 &mat) { glMatrixMode(GL_PROJECTION); - double* matrix = &mat(0, 0); - glLoadMatrixd(matrix); + float* matrix = &mat(0, 0); + glLoadMatrixf(matrix); - m_camortho = (mat(3, 3) != 0.0); + m_camortho = (mat(3, 3) != 0.0f); } void RAS_OpenGLRasterizer::SetProjectionMatrix(const MT_Matrix4x4 & mat) { glMatrixMode(GL_PROJECTION); - double matrix[16]; + float matrix[16]; /* Get into argument. Looks a bit dodgy, but it's ok. */ mat.getValue(matrix); /* Internally, MT_Matrix4x4 uses doubles (MT_Scalar). */ - glLoadMatrixd(matrix); + glLoadMatrixf(matrix); - m_camortho= (mat[3][3] != 0.0); + m_camortho= (mat[3][3] != 0.0f); } MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( @@ -852,7 +852,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( bool ) { MT_Matrix4x4 result; - double mat[16]; + float mat[16]; // correction for stereo if (Stereo()) @@ -891,7 +891,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( glLoadIdentity(); glFrustum(left, right, bottom, top, frustnear, frustfar); - glGetDoublev(GL_PROJECTION_MATRIX, mat); + glGetFloatv(GL_PROJECTION_MATRIX, mat); result.setValue(mat); return result; @@ -906,14 +906,14 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetOrthoMatrix( float frustfar ) { MT_Matrix4x4 result; - double mat[16]; + float mat[16]; // stereo is meaning less for orthographic, disable it glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(left, right, bottom, top, frustnear, frustfar); - glGetDoublev(GL_PROJECTION_MATRIX, mat); + glGetFloatv(GL_PROJECTION_MATRIX, mat); result.setValue(mat); return result; @@ -931,8 +931,8 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, // correction for stereo if (Stereo() && perspective) { - MT_Vector3 unitViewDir(0.0, -1.0, 0.0); // minus y direction, Blender convention - MT_Vector3 unitViewupVec(0.0, 0.0, 1.0); + MT_Vector3 unitViewDir(0.0f, -1.0f, 0.0f); // minus y direction, Blender convention + MT_Vector3 unitViewupVec(0.0f, 0.0f, 1.0f); MT_Vector3 viewDir, viewupVec; MT_Vector3 eyeline; @@ -950,7 +950,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, // translate to left by half the eye distance MT_Transform transform; transform.setIdentity(); - transform.translate(-(eyeline * m_eyeseparation / 2.0)); + transform.translate(-(eyeline * m_eyeseparation / 2.0f)); m_viewmatrix *= transform; } break; @@ -959,7 +959,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, // translate to right by half the eye distance MT_Transform transform; transform.setIdentity(); - transform.translate(eyeline * m_eyeseparation / 2.0); + transform.translate(eyeline * m_eyeseparation / 2.0f); m_viewmatrix *= transform; } break; @@ -974,7 +974,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, m_viewmatrix.getValue(glviewmat); glMatrixMode(GL_MODELVIEW); - glLoadMatrixd(glviewmat); + glLoadMatrixf(glviewmat); m_campos = pos; } @@ -1066,7 +1066,7 @@ void RAS_OpenGLRasterizer::EnableMotionBlur(float motionblurvalue) void RAS_OpenGLRasterizer::DisableMotionBlur() { m_motionblur = 0; - m_motionblurvalue = -1.0; + m_motionblurvalue = -1.0f; } void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend) @@ -1287,7 +1287,7 @@ void RAS_OpenGLRasterizer::RemoveLight(RAS_ILightObject* lightobject) m_lights.erase(lit); } -bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast *result, double *oglmatrix) +bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast *result, float *oglmatrix) { if (result->m_hitMesh) { @@ -1301,14 +1301,14 @@ bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast left = (dir.cross(resultnormal)).safe_normalized(); // for the up vector, we take the 'resultnormal' returned by the physics - double maat[16] = {left[0], left[1], left[2], 0, + float maat[16] = {left[0], left[1], left[2], 0, dir[0], dir[1], dir[2], 0, resultnormal[0], resultnormal[1], resultnormal[2], 0, 0, 0, 0, 1}; - glTranslated(oglmatrix[12],oglmatrix[13],oglmatrix[14]); + glTranslatef(oglmatrix[12],oglmatrix[13],oglmatrix[14]); //glMultMatrixd(oglmatrix); - glMultMatrixd(maat); + glMultMatrixf(maat); return true; } else { @@ -1316,7 +1316,7 @@ bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast } } -void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode ) +void RAS_OpenGLRasterizer::applyTransform(float* oglmatrix,int objectdrawmode ) { /* FIXME: blender: intern/moto/include/MT_Vector3.inl:42: MT_Vector3 operator/(const @@ -1337,14 +1337,14 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode ) //page 360/361 3D Game Engine Design, David Eberly for a discussion // on screen aligned and axis aligned billboards // assumed is that the preprocessor transformed all billboard polygons - // so that their normal points into the positive x direction (1.0, 0.0, 0.0) + // so that their normal points into the positive x direction (1.0f, 0.0f, 0.0f) // when new parenting for objects is done, this rotation // will be moved into the object MT_Point3 objpos (oglmatrix[12],oglmatrix[13],oglmatrix[14]); MT_Point3 campos = GetCameraPosition(); MT_Vector3 dir = (campos - objpos).safe_normalized(); - MT_Vector3 up(0,0,1.0); + MT_Vector3 up(0,0,1.0f); KX_GameObject* gameobj = (KX_GameObject*)m_clientobject; // get scaling of halo object @@ -1369,13 +1369,13 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode ) dir *= size[1]; up *= size[2]; - double maat[16] = {left[0], left[1], left[2], 0, + float maat[16] = {left[0], left[1], left[2], 0, dir[0], dir[1], dir[2], 0, up[0], up[1], up[2], 0, 0, 0, 0, 1}; glTranslatef(objpos[0],objpos[1],objpos[2]); - glMultMatrixd(maat); + glMultMatrixf(maat); } else { @@ -1399,11 +1399,11 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode ) if (!physics_controller && parent) physics_controller = parent->GetPhysicsController(); - KX_RayCast::Callback<RAS_OpenGLRasterizer, double> callback(this, physics_controller, oglmatrix); + KX_RayCast::Callback<RAS_OpenGLRasterizer, float> callback(this, physics_controller, oglmatrix); if (!KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback)) { // couldn't find something to cast the shadow on... - glMultMatrixd(oglmatrix); + glMultMatrixf(oglmatrix); } else { // we found the "ground", but the cast matrix doesn't take @@ -1415,7 +1415,7 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode ) { // 'normal' object - glMultMatrixd(oglmatrix); + glMultMatrixf(oglmatrix); } } } @@ -1591,13 +1591,13 @@ void RAS_OpenGLRasterizer::MotionBlur() if (state==1) { //bugfix:load color buffer into accum buffer for the first time(state=1) - glAccum(GL_LOAD, 1.0); + glAccum(GL_LOAD, 1.0f); SetMotionBlurState(2); } else if (motionblurvalue >= 0.0f && motionblurvalue <= 1.0f) { glAccum(GL_MULT, motionblurvalue); glAccum(GL_ACCUM, 1-motionblurvalue); - glAccum(GL_RETURN, 1.0); + glAccum(GL_RETURN, 1.0f); glFlush(); } } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index 1b012a61355..d6b2c3c8a30 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -301,13 +301,13 @@ public: void RenderText2D(RAS_TEXT_RENDER_MODE mode, const char *text, int xco, int yco, int width, int height); - void applyTransform(double *oglmatrix, int objectdrawmode); + void applyTransform(float *oglmatrix, int objectdrawmode); void PushMatrix(); void PopMatrix(); /// \see KX_RayCast - bool RayHit(struct KX_ClientObjectInfo *client, class KX_RayCast *result, double *oglmatrix); + bool RayHit(struct KX_ClientObjectInfo *client, class KX_RayCast *result, float *oglmatrix); /// \see KX_RayCast bool NeedRayCast(struct KX_ClientObjectInfo *, void *UNUSED(data)) { return true; } diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp index e6edc064200..2e176360d61 100644 --- a/source/gameengine/Rasterizer/RAS_TexVert.cpp +++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp @@ -66,10 +66,10 @@ const MT_Point3& RAS_TexVert::xyz() void RAS_TexVert::SetRGBA(const MT_Vector4& rgba) { unsigned char *colp = (unsigned char*) &m_rgba; - colp[0] = (unsigned char) (rgba[0] * 255.0); - colp[1] = (unsigned char) (rgba[1] * 255.0); - colp[2] = (unsigned char) (rgba[2] * 255.0); - colp[3] = (unsigned char) (rgba[3] * 255.0); + colp[0] = (unsigned char) (rgba[0] * 255.0f); + colp[1] = (unsigned char) (rgba[1] * 255.0f); + colp[2] = (unsigned char) (rgba[2] * 255.0f); + colp[3] = (unsigned char) (rgba[3] * 255.0f); } @@ -153,12 +153,12 @@ unsigned int RAS_TexVert::getUnit() const void RAS_TexVert::Transform(const MT_Matrix4x4& mat, const MT_Matrix4x4& nmat) { - SetXYZ((mat * MT_Vector4(m_localxyz[0], m_localxyz[1], m_localxyz[2], 1.0)).getValue()); - SetNormal((nmat * MT_Vector4(m_normal[0], m_normal[1], m_normal[2], 1.0)).getValue()); - SetTangent((nmat * MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0)).getValue()); + SetXYZ((mat * MT_Vector4(m_localxyz[0], m_localxyz[1], m_localxyz[2], 1.0f)).getValue()); + SetNormal((nmat * MT_Vector4(m_normal[0], m_normal[1], m_normal[2], 1.0f)).getValue()); + SetTangent((nmat * MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0f)).getValue()); } void RAS_TexVert::TransformUV(int index, const MT_Matrix4x4& mat) { - SetUV(index, (mat * MT_Vector4(m_uvs[index][0], m_uvs[index][1], 0.0, 1.0)).getValue()); + SetUV(index, (mat * MT_Vector4(m_uvs[index][0], m_uvs[index][1], 0.0f, 1.0f)).getValue()); } |