BGE Rasterizer clean up: double-promotion warnings
authorJorge Bernal <jbernalmartinez@gmail.com>
Sun, 13 Dec 2015 02:17:19 +0000 (03:17 +0100)
committerJorge Bernal <jbernalmartinez@gmail.com>
Sun, 13 Dec 2015 02:20:27 +0000 (03:20 +0100)
source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
source/gameengine/Rasterizer/RAS_BucketManager.cpp
source/gameengine/Rasterizer/RAS_CameraData.h
source/gameengine/Rasterizer/RAS_FramingManager.cpp
source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
source/gameengine/Rasterizer/RAS_TexVert.cpp

index cedc27c3b9213adf79fe97eb2f25ba7150c7e09a..82b26749fd1256cfc957e7a4a7ac05434fc618ae 100644 (file)
@@ -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();
                }
        }
index f90b5959f762d696c3b3717abb6b70ff18ed0129..d131891cb9074e902cb51b86abc5677012d5f934 100644 (file)
@@ -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);
index e2024a4a55d0805d0b8b7b9114c9db44c60b9fbb..bc8433afd0550a602ad3eaeb82e9c9fa23dd3340 100644 (file)
@@ -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),
index c5f15c9ad21c9e37b860928a3c707ed8ecdf05a8..8b0ec22fde3cb1f277a44645ed44ceb96d3bd350 100644 (file)
@@ -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:
index d07b4910968b0986820aaeb947983572f43b65fb..2a736aa7deba6adfe47f01a6095899462ec68398 100644 (file)
@@ -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);
 }
 
 
index 13d49c53423bb1dbfcd7d254e285546ff108f835..9cd8f77adfdb99f5709e4ace2c77ce65b0cf0de8 100644 (file)
@@ -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;
index c6d9981cb3cf10f06f7877ad6bb1796332447f58..8319b75331f1341a53c9bacdd064c398732ac3dc 100644 (file)
@@ -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);
index 54cffcc3c18769de1058f8ed8d757fa91a10c6ba..e7b5bebd5e8735a3299f560386975086d8e2e6eb 100644 (file)
@@ -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);
@@ -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,8 +403,8 @@ 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();
@@ -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();
                        }
@@ -826,7 +826,7 @@ void RAS_OpenGLRasterizer::SetProjectionMatrix(MT_CmMatrix4x4 &mat)
        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)
@@ -838,7 +838,7 @@ void RAS_OpenGLRasterizer::SetProjectionMatrix(const MT_Matrix4x4 & mat)
        /* Internally, MT_Matrix4x4 uses doubles (MT_Scalar). */
        glLoadMatrixf(matrix);
 
-       m_camortho= (mat[3][3] != 0.0);
+       m_camortho= (mat[3][3] != 0.0f);
 }
 
 MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
@@ -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;
@@ -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)
@@ -1337,14 +1337,14 @@ void RAS_OpenGLRasterizer::applyTransform(float* 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
@@ -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();
                }
        }
index e6edc0642008b9ca0d9ec8f611fcdfa7c4385e4d..2e176360d61fba9d263060d23f8e5d1fbd2c7c95 100644 (file)
@@ -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());
 }