BGE: Multitexture world (mist, ambient) fix

This patch fix the existing word API for mist and global ambient lighting.
Add deprecated message to disableMist()
Add setUseMist(enable).

Reviewers: dfelinto, campbellbarton, moguri

Reviewed By: moguri

Subscribers: solarlune, jta, brecht

Projects: #bf_blender:_next

Differential Revision: https://developer.blender.org/D148
This commit is contained in:
Thomas Szepe
2015-03-23 21:36:08 +01:00
parent 38321faa8d
commit 2affbb437b
10 changed files with 111 additions and 107 deletions

View File

@@ -302,7 +302,7 @@ public:
virtual void SetFogStart(float start) = 0;
virtual void SetFogEnd(float end) = 0;
virtual void DisplayFog() = 0;
virtual void DisableFog() = 0;
virtual void EnableFog(bool enable) = 0;
virtual bool IsFogEnabled() = 0;
virtual void SetBackColor(float red, float green, float blue, float alpha) = 0;

View File

@@ -229,7 +229,6 @@ void RAS_OpenGLRasterizer::SetFogColor(float r,
m_fogr = r;
m_fogg = g;
m_fogb = b;
m_fogenabled = true;
}
@@ -237,7 +236,6 @@ void RAS_OpenGLRasterizer::SetFogColor(float r,
void RAS_OpenGLRasterizer::SetFogStart(float start)
{
m_fogstart = start;
m_fogenabled = true;
}
@@ -245,7 +243,6 @@ void RAS_OpenGLRasterizer::SetFogStart(float start)
void RAS_OpenGLRasterizer::SetFogEnd(float fogend)
{
m_fogdist = fogend;
m_fogenabled = true;
}
@@ -261,14 +258,13 @@ void RAS_OpenGLRasterizer::SetFog(float start,
m_fogr = r;
m_fogg = g;
m_fogb = b;
m_fogenabled = true;
}
void RAS_OpenGLRasterizer::DisableFog()
void RAS_OpenGLRasterizer::EnableFog(bool enable)
{
m_fogenabled = false;
m_fogenabled = enable;
}
bool RAS_OpenGLRasterizer::IsFogEnabled()
@@ -281,16 +277,12 @@ void RAS_OpenGLRasterizer::DisplayFog()
{
if ((m_drawingmode >= KX_SOLID) && m_fogenabled)
{
float params[5];
float params[4] = {m_fogr, m_fogg, m_fogb, 1.0f};
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogf(GL_FOG_DENSITY, 0.1f);
glFogf(GL_FOG_START, m_fogstart);
glFogf(GL_FOG_END, m_fogstart + m_fogdist);
params[0] = m_fogr;
params[1] = m_fogg;
params[2] = m_fogb;
params[3] = 0.0;
glFogfv(GL_FOG_COLOR, params);
glFogfv(GL_FOG_COLOR, params);
glEnable(GL_FOG);
}
else

View File

@@ -202,7 +202,7 @@ public:
virtual void SetFogColor(float r, float g, float b);
virtual void SetFogStart(float fogstart);
virtual void SetFogEnd(float fogend);
void DisableFog();
virtual void EnableFog(bool enable);
virtual void DisplayFog();
virtual bool IsFogEnabled();