mirror of
https://github.com/ZDoom/gzdoom-last-svn.git
synced 2025-06-04 19:20:53 +00:00
- added gl_fog_shader CVAR to draw all polygons with fog using GLSL shaders. This should eliminate the annoying ATI fog bug if enabled.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@197 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
parent
8c5d9ad60b
commit
3d36a794a5
6 changed files with 21 additions and 12 deletions
|
@ -471,7 +471,7 @@ void STACK_ARGS OpenGLFrameBuffer::DrawTextureV(FTexture *img, int x0, int y0, u
|
|||
}
|
||||
else
|
||||
{
|
||||
gltex->Bind(CM_DEFAULT);
|
||||
gltex->Bind(CM_DEFAULT, 0, 0, true);
|
||||
cx=1.f;
|
||||
cy=-1.f;
|
||||
ox = oy = 0.f;
|
||||
|
@ -615,7 +615,7 @@ void OpenGLFrameBuffer::FlatFill (int left, int top, int right, int bottom, FTex
|
|||
|
||||
if (!gltexture) return;
|
||||
|
||||
const WorldTextureInfo * wti = gltexture->Bind(CM_DEFAULT);
|
||||
const WorldTextureInfo * wti = gltexture->Bind(CM_DEFAULT, 0, 0, true);
|
||||
if (!wti) return;
|
||||
|
||||
if (!local_origin)
|
||||
|
|
|
@ -33,6 +33,7 @@ EXTERN_CVAR(Bool, gl_sprite_blend)
|
|||
EXTERN_CVAR(Bool, gl_fakecontrast)
|
||||
EXTERN_CVAR (Bool, gl_lights_additive)
|
||||
EXTERN_CVAR(Bool, gl_warp_shader)
|
||||
EXTERN_CVAR(Bool, gl_fog_shader)
|
||||
EXTERN_CVAR(Bool, gl_colormap_shader)
|
||||
EXTERN_CVAR(Bool, gl_brightmap_shader)
|
||||
EXTERN_CVAR (Float, gl_light_ambient)
|
||||
|
@ -143,6 +144,7 @@ menuitem_t OpenGLItems[] = {
|
|||
{ discrete, "Particle style", {&gl_particles_style}, {3.0}, {0.0}, {0.0}, {Particles} },
|
||||
{ discrete, "Enable brightness maps", {&gl_brightmap_shader}, {2.0}, {0.0}, {0.0}, {OnOff} },
|
||||
{ discrete, "Shaders for texture warp", {&gl_warp_shader}, {2.0}, {0.0}, {0.0}, {OnOff} },
|
||||
{ discrete, "Shaders for fog", {&gl_fog_shader}, {2.0}, {0.0}, {0.0}, {OnOff} },
|
||||
{ discrete, "Shaders for colormaps", {&gl_colormap_shader}, {2.0}, {0.0}, {0.0}, {OnOff} },
|
||||
{ discrete, "Depth Fog", {&gl_depthfog}, {2.0}, {0.0}, {0.0}, {OnOff} },
|
||||
{ discrete, "Fake contrast", {&gl_fakecontrast}, {2.0}, {0.0}, {0.0}, {OnOff} },
|
||||
|
|
|
@ -1020,7 +1020,7 @@ void gl_RenderTextureView(FCanvasTexture *Texture, AActor * Viewpoint, int FOV)
|
|||
gl.Flush();
|
||||
gl_RenderView(Viewpoint, &bounds, FOV, (float)width/height, (float)width/height, false);
|
||||
gl.Flush();
|
||||
gltex->Bind(CM_DEFAULT);
|
||||
gltex->Bind(CM_DEFAULT, 0, 0, true);
|
||||
gl.CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, bounds.width, bounds.height);
|
||||
gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GLTexture::TexFilter[gl_texture_filter].magfilter);
|
||||
}
|
||||
|
|
|
@ -377,7 +377,7 @@ static void RenderDome(FTextureID texno, FGLTexture * tex, float x_offset, float
|
|||
|
||||
if (tex)
|
||||
{
|
||||
tex->Bind(CM_Index);
|
||||
tex->Bind(CM_Index, 0, 0, true);
|
||||
texw = tex->TextureWidth(FGLTexture::GLUSE_TEXTURE);
|
||||
texh = tex->TextureHeight(FGLTexture::GLUSE_TEXTURE);
|
||||
|
||||
|
|
|
@ -65,6 +65,11 @@ CUSTOM_CVAR(Bool, gl_warp_shader, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOI
|
|||
if (self && !(gl.flags & RFL_GLSL)) self=0;
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Bool, gl_fog_shader, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
||||
{
|
||||
if (self && !(gl.flags & RFL_GLSL)) self=0;
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Bool, gl_colormap_shader, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
||||
{
|
||||
if (self && !(gl.flags & RFL_GLSL)) self=0;
|
||||
|
@ -95,6 +100,7 @@ CUSTOM_CVAR(Bool, gl_texture_usehires, true, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
|||
}
|
||||
|
||||
EXTERN_CVAR(Bool, gl_render_precise)
|
||||
EXTERN_CVAR(Bool, gl_depthfog)
|
||||
|
||||
CVAR(Bool, gl_precache, false, CVAR_ARCHIVE)
|
||||
|
||||
|
@ -566,7 +572,7 @@ void FTexture::PrecacheGL()
|
|||
}
|
||||
else
|
||||
{
|
||||
gltex->Bind (CM_DEFAULT);
|
||||
gltex->Bind (CM_DEFAULT, 0, 0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1172,7 +1178,7 @@ const PatchTextureInfo * FGLTexture::GetPatchTextureInfo()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
const WorldTextureInfo * FGLTexture::Bind(int texunit, int cm, int clampmode, int translation)
|
||||
const WorldTextureInfo * FGLTexture::Bind(int texunit, int cm, int clampmode, int translation, bool is2d)
|
||||
{
|
||||
bool usebright = false;
|
||||
|
||||
|
@ -1184,7 +1190,7 @@ const WorldTextureInfo * FGLTexture::Bind(int texunit, int cm, int clampmode, in
|
|||
{
|
||||
FTexture *brightmap = tex->bm_info.Brightmap;
|
||||
|
||||
if (brightmap && (gl_glsl_renderer || gl_brightmap_shader) && translation >= 0 &&
|
||||
if (brightmap && (gl_glsl_renderer || (gl_brightmap_shader && !is2d)) && translation >= 0 &&
|
||||
cm >= CM_DEFAULT && cm <= CM_DESAT31 && gl_brightmapenabled)
|
||||
{
|
||||
FGLTexture *bmgltex = FGLTexture::ValidateTexture(brightmap);
|
||||
|
@ -1208,6 +1214,7 @@ const WorldTextureInfo * FGLTexture::Bind(int texunit, int cm, int clampmode, in
|
|||
}
|
||||
|
||||
if ((gl_warp_shader && tex->bWarped!=0) ||
|
||||
(gl_fog_shader && !is2d && gl_depthfog) ||
|
||||
(usebright) ||
|
||||
((tex->bHasCanvas || gl_colormap_shader) && cm!=CM_DEFAULT && /*!(cm>=CM_DESAT1 && cm<=CM_DESAT31) &&*/ cm!=CM_SHADE && gl_texturemode != TM_MASK))
|
||||
{
|
||||
|
@ -1264,9 +1271,9 @@ const WorldTextureInfo * FGLTexture::Bind(int texunit, int cm, int clampmode, in
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const WorldTextureInfo * FGLTexture::Bind(int cm, int clampmode, int translation)
|
||||
const WorldTextureInfo * FGLTexture::Bind(int cm, int clampmode, int translation, bool is2d)
|
||||
{
|
||||
return Bind(0, cm, clampmode, translation);
|
||||
return Bind(0, cm, clampmode, translation, is2d);
|
||||
}
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
|
@ -164,7 +164,7 @@ private:
|
|||
|
||||
void CheckForAlpha(const unsigned char * buffer);
|
||||
|
||||
const WorldTextureInfo * Bind(int texunit, int cm, int clamp, int translation);
|
||||
const WorldTextureInfo * Bind(int texunit, int cm, int clamp, int translation, bool is2d);
|
||||
const PatchTextureInfo * BindPatch(int texunit, int cm, int translation);
|
||||
|
||||
public:
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
~FGLTexture();
|
||||
|
||||
unsigned char * CreateTexBuffer(ETexUse use, int cm, int translation, int & w, int & h, bool allowhires=true);
|
||||
const WorldTextureInfo * Bind(int cm, int clamp=0, int translation=0);
|
||||
const WorldTextureInfo * Bind(int cm, int clamp=0, int translation=0, bool is2d = false);
|
||||
const PatchTextureInfo * BindPatch(int cm, int translation=0);
|
||||
|
||||
const WorldTextureInfo * GetWorldTextureInfo();
|
||||
|
@ -254,7 +254,7 @@ public:
|
|||
if (bIsTransparent == -1)
|
||||
{
|
||||
if (tex->UseType==FTexture::TEX_Sprite) BindPatch(CM_DEFAULT);
|
||||
else Bind (CM_DEFAULT);
|
||||
else Bind (CM_DEFAULT, 0, 0, true);
|
||||
}
|
||||
return !!bIsTransparent;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue