- fixed: non-tiled mid textures on a fog boundary require some special clamping to be performed in the shader.

This commit is contained in:
Christoph Oelckers 2014-09-21 11:08:17 +02:00
parent da87a34a6f
commit 4682736585
4 changed files with 34 additions and 3 deletions

View file

@ -177,6 +177,11 @@ public:
mTextureMode = mode; mTextureMode = mode;
} }
int GetTextureMode()
{
return mTextureMode;
}
void EnableTexture(bool on) void EnableTexture(bool on)
{ {
mTextureEnabled = on; mTextureEnabled = on;

View file

@ -338,10 +338,18 @@ void GLWall::RenderTranslucentWall()
gl_RenderState.EnableTexture(false); gl_RenderState.EnableTexture(false);
extra = 0; extra = 0;
} }
int tmode = gl_RenderState.GetTextureMode();
gl_SetColor(lightlevel, extra, Colormap, fabsf(alpha)); gl_SetColor(lightlevel, extra, Colormap, fabsf(alpha));
if (type!=RENDERWALL_M2SNF) gl_SetFog(lightlevel, extra, &Colormap, isadditive); if (type!=RENDERWALL_M2SNF) gl_SetFog(lightlevel, extra, &Colormap, isadditive);
else gl_SetFog(255, 0, NULL, false); else
{
if (flags & GLT_CLAMPY)
{
if (tmode == TM_MODULATE) gl_RenderState.SetTextureMode(TM_CLAMPY);
}
gl_SetFog(255, 0, NULL, false);
}
RenderWall(RWF_TEXTURED|RWF_NOSPLIT); RenderWall(RWF_TEXTURED|RWF_NOSPLIT);
@ -353,6 +361,7 @@ void GLWall::RenderTranslucentWall()
gl_RenderState.EnableTexture(true); gl_RenderState.EnableTexture(true);
} }
gl_RenderState.EnableGlow(false); gl_RenderState.EnableGlow(false);
gl_RenderState.SetTextureMode(tmode);
} }
//========================================================================== //==========================================================================
@ -363,6 +372,7 @@ void GLWall::RenderTranslucentWall()
void GLWall::Draw(int pass) void GLWall::Draw(int pass)
{ {
int rel; int rel;
int tmode;
#ifdef _DEBUG #ifdef _DEBUG
if (seg->linedef-lines==879) if (seg->linedef-lines==879)
@ -384,13 +394,21 @@ void GLWall::Draw(int pass)
case GLPASS_PLAIN: case GLPASS_PLAIN:
rel = rellight + getExtraLight(); rel = rellight + getExtraLight();
gl_SetColor(lightlevel, rel, Colormap,1.0f); gl_SetColor(lightlevel, rel, Colormap,1.0f);
tmode = gl_RenderState.GetTextureMode();
if (type!=RENDERWALL_M2SNF) gl_SetFog(lightlevel, rel, &Colormap, false); if (type!=RENDERWALL_M2SNF) gl_SetFog(lightlevel, rel, &Colormap, false);
else gl_SetFog(255, 0, NULL, false); else
{
if (flags & GLT_CLAMPY)
{
if (tmode == TM_MODULATE) gl_RenderState.SetTextureMode(TM_CLAMPY);
}
gl_SetFog(255, 0, NULL, false);
}
gl_RenderState.EnableGlow(!!(flags & GLWF_GLOW)); gl_RenderState.EnableGlow(!!(flags & GLWF_GLOW));
gl_RenderState.SetMaterial(gltexture, flags & 3, false, -1, false); gl_RenderState.SetMaterial(gltexture, flags & 3, false, -1, false);
RenderWall(RWF_TEXTURED|RWF_GLOW); RenderWall(RWF_TEXTURED|RWF_GLOW);
gl_RenderState.EnableGlow(false); gl_RenderState.EnableGlow(false);
gl_RenderState.SetTextureMode(tmode);
break; break;
case GLPASS_TRANSLUCENT: case GLPASS_TRANSLUCENT:

View file

@ -20,6 +20,7 @@ enum TexMode
TM_OPAQUE, // (r, g, b, 1) TM_OPAQUE, // (r, g, b, 1)
TM_INVERSE, // (1-r, 1-g, 1-b, a) TM_INVERSE, // (1-r, 1-g, 1-b, a)
TM_REDTOALPHA, // (1, 1, 1, r) TM_REDTOALPHA, // (1, 1, 1, r)
TM_CLAMPY, // (r, g, b, (t >= 0.0 && t <= 1.0)? a:0)
}; };
struct RenderContext struct RenderContext

View file

@ -75,6 +75,13 @@ vec4 getTexel(vec2 st)
case 4: // TM_REDTOALPHA case 4: // TM_REDTOALPHA
texel = vec4(1.0, 1.0, 1.0, texel.r); texel = vec4(1.0, 1.0, 1.0, texel.r);
break; break;
case 5: // TM_CLAMPY
if (st.t < 0.0 || st.t > 1.0)
{
texel.a = 0.0;
}
break;
} }
texel *= uObjectColor; texel *= uObjectColor;