BGE Rasterizer Cleanup: Removing the need to reference KX_BlenderMaterial or KX_PolygonMaterial in RAS_OpenGLRasterizer.

This commit is contained in:
Mitchell Stokes
2013-11-04 19:21:32 +00:00
parent 5348682f3a
commit c1e617d26b
6 changed files with 18 additions and 23 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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
{

View File

@@ -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;

View File

@@ -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();
}