summaryrefslogtreecommitdiffstats
path: root/src/graphics/engine/engine.cpp
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-29 19:35:14 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-29 19:35:14 +0200
commit5a751d9c0da79b38d4104bbe0cc1b5feec3d6ecc (patch)
tree16a2632dd25115570dcd2c0e21e7b9d0a19c8161 /src/graphics/engine/engine.cpp
parent1fa7053ac0763721bd6dd2ad56b256ecc2643021 (diff)
downloadcolobot-5a751d9c0da79b38d4104bbe0cc1b5feec3d6ecc.tar.gz
colobot-5a751d9c0da79b38d4104bbe0cc1b5feec3d6ecc.tar.bz2
colobot-5a751d9c0da79b38d4104bbe0cc1b5feec3d6ecc.zip
Fixed texture regression
There was a bug in texture modesetting but only visible after certain mode changes.
Diffstat (limited to 'src/graphics/engine/engine.cpp')
-rw-r--r--src/graphics/engine/engine.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp
index e34034d..c094c63 100644
--- a/src/graphics/engine/engine.cpp
+++ b/src/graphics/engine/engine.cpp
@@ -1851,8 +1851,6 @@ void CEngine::SetState(int state, const Color& color)
m_device->SetRenderState(RENDER_STATE_BLENDING, true);
m_device->SetBlendFunc(BLEND_ONE, BLEND_INV_SRC_COLOR);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, true);
-
m_device->SetTextureFactor(color);
TextureStageParams params;
@@ -1873,8 +1871,6 @@ void CEngine::SetState(int state, const Color& color)
m_device->SetRenderState(RENDER_STATE_BLENDING, true);
m_device->SetBlendFunc(BLEND_DST_COLOR, BLEND_ZERO);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, true);
-
m_device->SetTextureFactor(color.Inverse());
TextureStageParams params;
@@ -1891,20 +1887,22 @@ void CEngine::SetState(int state, const Color& color)
m_device->SetRenderState(RENDER_STATE_FOG, false);
m_device->SetRenderState(RENDER_STATE_DEPTH_WRITE, false);
m_device->SetRenderState(RENDER_STATE_ALPHA_TEST, false);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, false);
m_device->SetRenderState(RENDER_STATE_BLENDING, true);
m_device->SetBlendFunc(BLEND_ONE, BLEND_INV_SRC_COLOR);
+
+ m_device->SetTextureEnabled(0, false);
}
else if (state & ENG_RSTATE_TCOLOR_WHITE) // transparent white color?
{
m_device->SetRenderState(RENDER_STATE_FOG, false);
m_device->SetRenderState(RENDER_STATE_DEPTH_WRITE, false);
m_device->SetRenderState(RENDER_STATE_ALPHA_TEST, false);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, false);
m_device->SetRenderState(RENDER_STATE_BLENDING, true);
m_device->SetBlendFunc(BLEND_DST_COLOR, BLEND_ZERO);
+
+ m_device->SetTextureEnabled(0, false);
}
else if (state & ENG_RSTATE_TDIFFUSE) // diffuse color as transparent?
{
@@ -1915,8 +1913,6 @@ void CEngine::SetState(int state, const Color& color)
m_device->SetRenderState(RENDER_STATE_BLENDING, true);
m_device->SetBlendFunc(BLEND_SRC_ALPHA, BLEND_DST_ALPHA);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, true);
-
TextureStageParams params;
params.colorOperation = TEX_MIX_OPER_REPLACE;
params.colorArg1 = TEX_MIX_ARG_TEXTURE;
@@ -1932,7 +1928,6 @@ void CEngine::SetState(int state, const Color& color)
m_device->SetRenderState(RENDER_STATE_ALPHA_TEST, false);
m_device->SetRenderState(RENDER_STATE_BLENDING, false);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, true);
m_device->SetTextureEnabled(0, true);
m_device->SetTextureStageParams(0, TextureStageParams()); // default operation
}
@@ -1942,7 +1937,8 @@ void CEngine::SetState(int state, const Color& color)
m_device->SetRenderState(RENDER_STATE_DEPTH_WRITE, false);
m_device->SetRenderState(RENDER_STATE_ALPHA_TEST, false);
m_device->SetRenderState(RENDER_STATE_BLENDING, false);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, false);
+
+ m_device->SetTextureEnabled(0, false);
}
else if (state & ENG_RSTATE_TEXT) // font rendering?
{
@@ -1953,7 +1949,6 @@ void CEngine::SetState(int state, const Color& color)
m_device->SetRenderState(RENDER_STATE_BLENDING, true);
m_device->SetBlendFunc(BLEND_SRC_ALPHA, BLEND_INV_SRC_ALPHA);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, true);
m_device->SetTextureEnabled(0, true);
m_device->SetTextureStageParams(0, TextureStageParams()); // default operation
}
@@ -1968,8 +1963,6 @@ void CEngine::SetState(int state, const Color& color)
m_device->SetAlphaTestFunc(COMP_FUNC_GREATER, 0.5f);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, true);
-
m_device->SetTextureFactor(color);
TextureStageParams params;
@@ -1990,8 +1983,6 @@ void CEngine::SetState(int state, const Color& color)
m_device->SetRenderState(RENDER_STATE_DEPTH_WRITE, true);
m_device->SetRenderState(RENDER_STATE_FOG, true);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, true);
-
TextureStageParams params;
params.colorOperation = TEX_MIX_OPER_DEFAULT; // default modulate
params.alphaOperation = TEX_MIX_OPER_DEFAULT; // TODO: replace with src color ?
@@ -2063,9 +2054,7 @@ void CEngine::SetState(int state, const Color& color)
// In interface mode, disable lighting
if (m_interfaceMode)
- {
m_device->SetRenderState(RENDER_STATE_LIGHTING, false);
- }
}
void CEngine::SetMaterial(const Material& mat)
@@ -3584,7 +3573,6 @@ void CEngine::DrawOverColor()
m_device->SetRenderState(RENDER_STATE_DEPTH_WRITE, false);
m_device->SetRenderState(RENDER_STATE_LIGHTING, false);
m_device->SetRenderState(RENDER_STATE_FOG, false);
- m_device->SetRenderState(RENDER_STATE_TEXTURING, false);
m_device->SetTransform(TRANSFORM_VIEW, m_matViewInterface);
m_device->SetTransform(TRANSFORM_PROJECTION, m_matProjInterface);