BGE BugFix [#25711]render.setBackgroundColor() does not work:

Since rev.2 (hans ftw) we have a strange situation where horizon color was being used at Convert time for the WorldInfo background color (and for the fog). However through the Python API only the Rasterizer background color was being updated. On top of that the KX_KetsjiEngine.cpp::SetBackGround was using the WorldInfo bgcolor when render mode was the potato one (TEXTURED). Bottomline, when in potato mode the glClearColor used was the original one in worldinfo, not the API updated one in Rasterized.
This commit is contained in:
Dalai Felinto 2011-01-18 22:27:18 +00:00
parent 3b0c2accc6
commit eff0e29cba
4 changed files with 18 additions and 0 deletions

@ -188,6 +188,12 @@ float BlenderWorldInfo::getMistColorBlue()
return m_mistcolor[2];
}
void BlenderWorldInfo::setBackColor(float r, float g, float b)
{
m_backgroundcolor[0] = r;
m_backgroundcolor[1] = g;
m_backgroundcolor[2] = b;
}
void
BlenderWorldInfo::setMistStart(

@ -64,6 +64,12 @@ public:
float getMistColorGreen();
float getMistColorBlue();
void
setBackColor(
float r,
float g,
float b
);
void
setMistStart(
float d

@ -923,6 +923,11 @@ static PyObject* gPySetBackgroundColor(PyObject*, PyObject* value)
{
gp_Rasterizer->SetBackColor(vec[0], vec[1], vec[2], vec[3]);
}
KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
if (wi->hasWorld())
wi->setBackColor(vec[0], vec[1], vec[2]);
Py_RETURN_NONE;
}

@ -58,6 +58,7 @@ public:
virtual float getAmbientColorGreen()=0;
virtual float getAmbientColorBlue()=0;
virtual void setBackColor(float,float,float)=0;
virtual void setMistStart(float)=0;
virtual void setMistDistance(float)=0;
virtual void setMistColorRed(float)=0;