From 87fac9a81623d4856e5325718501423abfbcbbe5 Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Sun, 13 Dec 2015 21:19:45 -0500 Subject: [PATCH] use float (not double) for font matrix Following up on recent double --> float commits in the game engine. --- source/blender/blenfont/BLF_api.h | 2 +- source/blender/blenfont/intern/blf.c | 4 ++-- source/blender/blenfont/intern/blf_internal_types.h | 2 +- source/gameengine/Ketsji/KX_FontObject.cpp | 6 +----- source/gameengine/Rasterizer/RAS_IRasterizer.h | 2 +- .../RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 2 +- .../Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h | 2 +- 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 9527c4edcf0..e565ffe3cc1 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -73,7 +73,7 @@ void BLF_size(int fontid, int size, int dpi); * | m[3] m[7] m[11] m[15] | * */ -void BLF_matrix(int fontid, const double m[16]); +void BLF_matrix(int fontid, const float m[16]); /* Draw the string using the default font, size and dpi. */ void BLF_draw_default(float x, float y, float z, const char *str, size_t len) ATTR_NONNULL(); diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 6c3fd090d4a..a387b26ec3e 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -384,7 +384,7 @@ void BLF_aspect(int fontid, float x, float y, float z) } } -void BLF_matrix(int fontid, const double m[16]) +void BLF_matrix(int fontid, const float m[16]) { FontBLF *font = blf_get(fontid); @@ -511,7 +511,7 @@ static void blf_draw_gl__start(FontBLF *font, GLint *mode) glPushMatrix(); if (font->flags & BLF_MATRIX) - glMultMatrixd((GLdouble *)&font->m); + glMultMatrixf(font->m); glTranslate3fv(font->pos); diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index f17401a9991..0fac576a8cc 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -194,7 +194,7 @@ typedef struct FontBLF { /* Multiplied this matrix with the current one before * draw the text! see blf_draw__start. */ - double m[16]; + float m[16]; /* clipping rectangle. */ rctf clip_rec; diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index 13a5ec6c411..32ac8c594d2 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -193,11 +193,7 @@ void KX_FontObject::DrawFontText() const float aspect = m_fsize / size; /* Get a working copy of the OpenGLMatrix to use */ - double mat[16]; - float *origmat = GetOpenGLMatrix(); - for (unsigned short i = 0; i < 16; ++i) { - mat[i] = (double)origmat[i]; - } + float *mat = GetOpenGLMatrix(); /* Account for offset */ MT_Vector3 offset = this->NodeGetWorldOrientation() * m_offset * this->NodeGetWorldScaling(); diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index aa32f625475..a92b87773c7 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -446,7 +446,7 @@ public: */ virtual void RenderText3D( int fontid, const char *text, int size, int dpi, - const float color[4], const double mat[16], float aspect) = 0; + const float color[4], const float mat[16], float aspect) = 0; /** * Renders 2D text string. diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index e7b5bebd5e8..604b6a6b59b 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -1504,7 +1504,7 @@ void RAS_OpenGLRasterizer::RenderBox2D(int xco, void RAS_OpenGLRasterizer::RenderText3D( int fontid, const char *text, int size, int dpi, - const float color[4], const double mat[16], float aspect) + const float color[4], const float mat[16], float aspect) { /* gl prepping */ DisableForText(); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index d6b2c3c8a30..4c22d1de611 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -297,7 +297,7 @@ public: void RenderBox2D(int xco, int yco, int width, int height, float percentage); void RenderText3D(int fontid, const char *text, int size, int dpi, - const float color[4], const double mat[16], float aspect); + const float color[4], const float mat[16], float aspect); void RenderText2D(RAS_TEXT_RENDER_MODE mode, const char *text, int xco, int yco, int width, int height);