From 6972e19fd55470700618174bbba5893d53b1deaa Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Aug 2012 22:12:57 +0000 Subject: code cleanup: - replace (strcmp(vfont->name, FO_BUILTIN_NAME) == 0) with (BKE_vfont_is_builtin(vfont)). - reduce some double promotions. --- source/gameengine/Ketsji/KX_FontObject.cpp | 16 ++++++++-------- .../RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 10 +++++----- source/gameengine/VideoTexture/ImageRender.cpp | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index 308154d8ebc..931eac7a974 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -117,25 +117,25 @@ void KX_FontObject::ProcessReplica() KX_GetActiveScene()->AddFont(this); } -int GetFontId (VFont *font) +int GetFontId (VFont *vfont) { PackedFile *packedfile=NULL; int fontid = -1; - if (font->packedfile) { - packedfile= font->packedfile; - fontid= BLF_load_mem(font->name, (unsigned char*)packedfile->data, packedfile->size); + if (vfont->packedfile) { + packedfile= vfont->packedfile; + fontid= BLF_load_mem(vfont->name, (unsigned char*)packedfile->data, packedfile->size); if (fontid == -1) { - printf("ERROR: packed font \"%s\" could not be loaded.\n", font->name); + printf("ERROR: packed font \"%s\" could not be loaded.\n", vfont->name); fontid = BLF_load("default"); } return fontid; } - /* once we have packed working we can load the FO_BUILTIN_NAME font */ - const char *filepath = font->name; - if (strcmp(FO_BUILTIN_NAME, filepath) == 0) { + /* once we have packed working we can load the builtin font */ + const char *filepath = vfont->name; + if (BKE_vfont_is_builtin(vfont)) { fontid = BLF_load("default"); /* XXX the following code is supposed to work (after you add get_builtin_packedfile to BKE_font.h ) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 76d1a64a4c0..b769fc4b703 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -962,10 +962,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi) void RAS_OpenGLRasterizer::SetProjectionMatrix(MT_CmMatrix4x4 &mat) { glMatrixMode(GL_PROJECTION); - double* matrix = &mat(0,0); + double* matrix = &mat(0, 0); glLoadMatrixd(matrix); - m_camortho= (mat(3, 3) != 0.0f); + m_camortho = (mat(3, 3) != 0.0); } void RAS_OpenGLRasterizer::SetProjectionMatrix(const MT_Matrix4x4 & mat) @@ -977,7 +977,7 @@ void RAS_OpenGLRasterizer::SetProjectionMatrix(const MT_Matrix4x4 & mat) /* Internally, MT_Matrix4x4 uses doubles (MT_Scalar). */ glLoadMatrixd(matrix); - m_camortho= (mat[3][3] != 0.0f); + m_camortho= (mat[3][3] != 0.0); } MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( @@ -1002,11 +1002,11 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( // if Rasterizer.setFocalLength is not called we use the camera focallength if (!m_setfocallength) // if focallength is null we use a value known to be reasonable - m_focallength = (focallength == 0.f) ? m_eyeseparation * 30.0 + m_focallength = (focallength == 0.f) ? m_eyeseparation * 30.0f : focallength; near_div_focallength = frustnear / m_focallength; - offset = 0.5 * m_eyeseparation * near_div_focallength; + offset = 0.5f * m_eyeseparation * near_div_focallength; switch(m_curreye) { case RAS_STEREO_LEFTEYE: diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index 9fdd0cd393b..c8763671dd1 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -138,7 +138,7 @@ void ImageRender::Render() // compute distance of observer to mirror = D - observerPos . normal MT_Scalar observerDistance = mirrorPlaneDTerm - observerWorldPos.dot(mirrorWorldZ); // if distance < 0.01 => observer is on wrong side of mirror, don't render - if (observerDistance < 0.01f) + if (observerDistance < 0.01) return; // set camera world position = observerPos + normal * 2 * distance MT_Point3 cameraWorldPos = observerWorldPos + (MT_Scalar(2.0)*observerDistance)*mirrorWorldZ; -- cgit v1.2.3