diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-11-04 23:21:32 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-11-04 23:21:32 +0400 |
commit | c1e617d26bf72f6fe2682c14e31b84864b465e85 (patch) | |
tree | 13a85d9d469fb679a0f025260bda32c93c48537d /source | |
parent | 5348682f3aad87c1c598af04d407a91a50b71e7e (diff) |
BGE Rasterizer Cleanup: Removing the need to reference KX_BlenderMaterial or KX_PolygonMaterial in RAS_OpenGLRasterizer.
Diffstat (limited to 'source')
6 files changed, 18 insertions, 23 deletions
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index e5b8159753b..efaaed7b567 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -129,13 +129,13 @@ KX_BlenderMaterial::~KX_BlenderMaterial() OnExit(); } -MTFace* KX_BlenderMaterial::GetMTFace(void) const +MTFace* KX_BlenderMaterial::GetMTFace() const { // fonts on polys return &mMaterial->tface; } -unsigned int* KX_BlenderMaterial::GetMCol(void) const +unsigned int* KX_BlenderMaterial::GetMCol() const { // fonts on polys return mMaterial->rgb; diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h index 0a2675f04a8..b7c64215eaf 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.h +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h @@ -79,8 +79,8 @@ public: Material* GetBlenderMaterial() const; Image* GetBlenderImage() const; - MTFace* GetMTFace(void) const; - unsigned int* GetMCol(void) const; + MTFace* GetMTFace() const; + unsigned int* GetMCol() const; BL_Texture * getTex (unsigned int idx) { return (idx < MAXTEX) ? mTextures + idx : NULL; } diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h index 89bfb4ff9fb..380ac5f523d 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.h +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.h @@ -118,12 +118,12 @@ public: * Returns the Blender texture face structure that is used for this material. * \return The material's texture face. */ - MTFace* GetMTFace(void) const + MTFace* GetMTFace() const { return &m_tface; } - unsigned int* GetMCol(void) const + unsigned int* GetMCol() const { return &m_mcol; } diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp index ddadd97b567..9d55fde20c3 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp @@ -235,6 +235,15 @@ Image *RAS_IPolyMaterial::GetBlenderImage() const { return NULL; } +MTFace *RAS_IPolyMaterial::GetMTFace() const +{ + return NULL; +} + +unsigned int *RAS_IPolyMaterial::GetMCol() const +{ + return NULL; +} Scene* RAS_IPolyMaterial::GetBlenderScene() const { diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h index 7aeeb364b47..67e74dfaa3b 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h @@ -167,6 +167,8 @@ public: virtual Material* GetBlenderMaterial() const; virtual Image* GetBlenderImage() const; + virtual MTFace* GetMTFace() const; + virtual unsigned int* GetMCol() const; virtual Scene* GetBlenderScene() const; virtual void ReleaseMaterial(); virtual void GetMaterialRGBAColor(unsigned char *rgba) const; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index aada984ef76..cdfeac5ce9c 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -65,8 +65,6 @@ extern "C"{ // XXX Clean these up <<< #include "Value.h" -#include "KX_BlenderMaterial.h" -#include "KX_PolygonMaterial.h" #include "KX_Light.h" #include "KX_Scene.h" #include "KX_RayCast.h" @@ -680,13 +678,9 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms, bool obcolor = ms.m_bObjectColor; MT_Vector4& rgba = ms.m_RGBAcolor; RAS_MeshSlot::iterator it; - struct MTFace* tface = 0; const STR_String& mytext = ((CValue*)m_clientobject)->GetPropertyText("Text"); - const unsigned int flag = polymat->GetFlag(); - unsigned int *col = 0; - // handle object color if (obcolor) { glDisableClientState(GL_COLOR_ARRAY); @@ -738,17 +732,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms, if (m_attrib[unit] == RAS_TEXCO_UV) glattrib = unit; - if (flag & RAS_BLENDERMAT) { - KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat); - tface = bl_mat->GetMTFace(); - col = bl_mat->GetMCol(); - } else { - KX_PolygonMaterial* blenderpoly = static_cast<KX_PolygonMaterial*>(polymat); - tface = blenderpoly->GetMTFace(); - col = blenderpoly->GetMCol(); - } - - GPU_render_text(tface, polymat->GetDrawingMode(), mytext, mytext.Length(), col, v[1], v[2], v[3], v[4], glattrib); + GPU_render_text(polymat->GetMTFace(), polymat->GetDrawingMode(), mytext, mytext.Length(), polymat->GetMCol(), v[1], v[2], v[3], v[4], glattrib); ClearCachingInfo(); } |