mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- replaced deprecated alpha testing with shader code.
This commit is contained in:
parent
84a49e37ee
commit
ed8a21fd86
19 changed files with 42 additions and 96 deletions
|
@ -383,7 +383,7 @@ void FGLRenderer::DrawTexture(FTexture *img, DCanvas::DrawParms &parms)
|
|||
glScissor(parms.lclip, btm - parms.dclip + space, parms.rclip - parms.lclip, parms.dclip - parms.uclip);
|
||||
|
||||
gl_RenderState.SetColor(color);
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
gl_RenderState.Apply();
|
||||
|
||||
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
|
||||
|
@ -409,8 +409,6 @@ void FGLRenderer::DrawTexture(FTexture *img, DCanvas::DrawParms &parms)
|
|||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
|
||||
}
|
||||
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
|
||||
glScissor(0, 0, screen->GetWidth(), screen->GetHeight());
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
gl_RenderState.SetTextureMode(TM_MODULATE);
|
||||
|
|
|
@ -75,8 +75,6 @@ void FRenderState::Reset()
|
|||
mSrcBlend = GL_SRC_ALPHA;
|
||||
mDstBlend = GL_ONE_MINUS_SRC_ALPHA;
|
||||
glSrcBlend = glDstBlend = -1;
|
||||
glAlphaFunc = -1;
|
||||
mAlphaFunc = GL_GEQUAL;
|
||||
mAlphaThreshold = 0.5f;
|
||||
mBlendEquation = GL_FUNC_ADD;
|
||||
mObjectColor = 0xffffffff;
|
||||
|
@ -151,6 +149,7 @@ bool FRenderState::ApplyShader()
|
|||
activeShader->muInterpolationFactor.Set(mInterpolationFactor);
|
||||
activeShader->muClipHeightTop.Set(mClipHeightTop);
|
||||
activeShader->muClipHeightBottom.Set(mClipHeightBottom);
|
||||
activeShader->muAlphaThreshold.Set(mAlphaThreshold);
|
||||
|
||||
if (mGlowEnabled)
|
||||
{
|
||||
|
@ -269,18 +268,6 @@ void FRenderState::Apply()
|
|||
glDstBlend = mDstBlend;
|
||||
glBlendFunc(mSrcBlend, mDstBlend);
|
||||
}
|
||||
if (mAlphaFunc != glAlphaFunc || mAlphaThreshold != glAlphaThreshold)
|
||||
{
|
||||
glAlphaFunc = mAlphaFunc;
|
||||
glAlphaThreshold = mAlphaThreshold;
|
||||
::glAlphaFunc(mAlphaFunc, mAlphaThreshold);
|
||||
}
|
||||
if (mAlphaTest != glAlphaTest)
|
||||
{
|
||||
glAlphaTest = mAlphaTest;
|
||||
if (mAlphaTest) glEnable(GL_ALPHA_TEST);
|
||||
else glDisable(GL_ALPHA_TEST);
|
||||
}
|
||||
if (mBlendEquation != glBlendEquation)
|
||||
{
|
||||
glBlendEquation = mBlendEquation;
|
||||
|
|
|
@ -53,7 +53,6 @@ class FRenderState
|
|||
int mNumLights[4];
|
||||
float *mLightData;
|
||||
int mSrcBlend, mDstBlend;
|
||||
int mAlphaFunc;
|
||||
float mAlphaThreshold;
|
||||
bool mAlphaTest;
|
||||
int mBlendEquation;
|
||||
|
@ -76,7 +75,6 @@ class FRenderState
|
|||
int mColormapState;
|
||||
|
||||
int glSrcBlend, glDstBlend;
|
||||
int glAlphaFunc;
|
||||
float glAlphaThreshold;
|
||||
bool glAlphaTest;
|
||||
int glBlendEquation;
|
||||
|
@ -281,28 +279,8 @@ public:
|
|||
|
||||
void AlphaFunc(int func, float thresh)
|
||||
{
|
||||
if (!gl_direct_state_change)
|
||||
{
|
||||
mAlphaFunc = func;
|
||||
mAlphaThreshold = thresh;
|
||||
}
|
||||
else
|
||||
{
|
||||
::glAlphaFunc(func, thresh);
|
||||
}
|
||||
}
|
||||
|
||||
void EnableAlphaTest(bool on)
|
||||
{
|
||||
if (!gl_direct_state_change)
|
||||
{
|
||||
mAlphaTest = on;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (on) glEnable(GL_ALPHA_TEST);
|
||||
else glDisable(GL_ALPHA_TEST);
|
||||
}
|
||||
if (func == GL_GREATER) mAlphaThreshold = thresh;
|
||||
else mAlphaThreshold = thresh - 0.001f;
|
||||
}
|
||||
|
||||
void BlendEquation(int eq)
|
||||
|
|
|
@ -333,7 +333,7 @@ void GLWall::DrawDecal(DBaseDecal *decal)
|
|||
|
||||
|
||||
// If srcalpha is one it looks better with a higher alpha threshold
|
||||
if (decal->RenderStyle.SrcAlpha == STYLEALPHA_One) gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
|
||||
if (decal->RenderStyle.SrcAlpha == STYLEALPHA_One) gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
|
||||
else gl_RenderState.AlphaFunc(GL_GREATER, 0.f);
|
||||
|
||||
gl_RenderState.Apply();
|
||||
|
|
|
@ -424,7 +424,7 @@ void GLFlat::Draw(int pass)
|
|||
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
gl_SetColor(lightlevel, rel, Colormap, alpha);
|
||||
gl_SetFog(lightlevel, rel, &Colormap, false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL,gl_mask_threshold*(alpha));
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
|
||||
if (!gltexture)
|
||||
{
|
||||
gl_RenderState.EnableTexture(false);
|
||||
|
|
|
@ -998,7 +998,7 @@ void GLHorizonPortal::DrawContents()
|
|||
gltexture->Bind();
|
||||
|
||||
gl_SetPlaneTextureRotation(sp, gltexture);
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
gl_RenderState.BlendFunc(GL_ONE,GL_ZERO);
|
||||
gl_RenderState.Apply();
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@ void FGLRenderer::RenderScene(int recursion)
|
|||
glDepthFunc(GL_LESS);
|
||||
|
||||
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
|
||||
glDisable(GL_POLYGON_OFFSET_FILL); // just in case
|
||||
|
||||
|
@ -374,8 +374,6 @@ void FGLRenderer::RenderScene(int recursion)
|
|||
gl_drawinfo->drawlists[GLDL_LIGHTFOG].Draw(pass);
|
||||
|
||||
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
|
||||
// Part 2: masked geometry. This is set up so that only pixels with alpha>0.5 will show
|
||||
if (!gl_texture)
|
||||
{
|
||||
|
@ -383,7 +381,7 @@ void FGLRenderer::RenderScene(int recursion)
|
|||
gl_RenderState.SetTextureMode(TM_MASK);
|
||||
}
|
||||
if (pass == GLPASS_BASE) pass = GLPASS_BASE_MASKED;
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL,gl_mask_threshold);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
|
||||
gl_drawinfo->drawlists[GLDL_MASKED].Sort();
|
||||
gl_drawinfo->drawlists[GLDL_MASKED].Draw(pass);
|
||||
gl_drawinfo->drawlists[GLDL_FOGMASKED].Sort();
|
||||
|
@ -440,10 +438,10 @@ void FGLRenderer::RenderScene(int recursion)
|
|||
glDepthFunc(GL_LEQUAL);
|
||||
if (gl_texture)
|
||||
{
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
gl_drawinfo->drawlists[GLDL_LIGHT].Sort();
|
||||
gl_drawinfo->drawlists[GLDL_LIGHT].Draw(GLPASS_TEXTURE);
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
|
||||
gl_drawinfo->drawlists[GLDL_LIGHTBRIGHT].Sort();
|
||||
gl_drawinfo->drawlists[GLDL_LIGHTBRIGHT].Draw(GLPASS_TEXTURE);
|
||||
gl_drawinfo->drawlists[GLDL_LIGHTMASKED].Sort();
|
||||
|
@ -495,10 +493,9 @@ void FGLRenderer::RenderScene(int recursion)
|
|||
|
||||
glDepthMask(false); // don't write to Z-buffer!
|
||||
gl_RenderState.EnableFog(true);
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
gl_RenderState.BlendFunc(GL_ONE,GL_ZERO);
|
||||
gl_drawinfo->DrawUnhandledMissingTextures();
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
glDepthMask(true);
|
||||
|
||||
glPolygonOffset(0.0f, 0.0f);
|
||||
|
@ -523,8 +520,7 @@ void FGLRenderer::RenderTranslucent()
|
|||
gl_RenderState.SetCameraPos(FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz));
|
||||
|
||||
// final pass: translucent stuff
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL,gl_mask_sprite_threshold);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
|
||||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
gl_RenderState.EnableBrightmap(true);
|
||||
|
@ -534,7 +530,7 @@ void FGLRenderer::RenderTranslucent()
|
|||
|
||||
glDepthMask(true);
|
||||
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL,0.5f);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.5f);
|
||||
RenderAll.Unclock();
|
||||
}
|
||||
|
||||
|
@ -577,7 +573,7 @@ void FGLRenderer::DrawScene(bool toscreen)
|
|||
|
||||
static void FillScreen()
|
||||
{
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
gl_RenderState.EnableTexture(false);
|
||||
gl_RenderState.Apply();
|
||||
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
|
||||
|
@ -756,7 +752,6 @@ void FGLRenderer::EndDrawScene(sector_t * viewsector)
|
|||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.EnableTexture(true);
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
|
|
|
@ -472,7 +472,7 @@ void GLSkyPortal::DrawContents()
|
|||
|
||||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.EnableFog(false);
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
gl_MatrixStack.Push(gl_RenderState.mViewMatrix);
|
||||
|
@ -481,7 +481,6 @@ void GLSkyPortal::DrawContents()
|
|||
if (origin->texture[0] && origin->texture[0]->tex->gl_info.bSkybox)
|
||||
{
|
||||
RenderBox(origin->skytexno1, origin->texture[0], origin->x_offset[0], origin->sky2);
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -495,8 +494,7 @@ void GLSkyPortal::DrawContents()
|
|||
gl_RenderState.SetTextureMode(TM_MODULATE);
|
||||
}
|
||||
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL,0.05f);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.05f);
|
||||
|
||||
if (origin->doublesky && origin->texture[1])
|
||||
{
|
||||
|
|
|
@ -137,11 +137,11 @@ void GLSprite::Draw(int pass)
|
|||
|
||||
if (hw_styleflags == STYLEHW_NoAlphaTest)
|
||||
{
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL,trans*gl_mask_sprite_threshold);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
|
||||
}
|
||||
|
||||
if (RenderStyle.BlendOp == STYLEOP_Shadow)
|
||||
|
@ -165,7 +165,7 @@ void GLSprite::Draw(int pass)
|
|||
minalpha*=factor;
|
||||
}
|
||||
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL,minalpha*gl_mask_sprite_threshold);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
|
||||
gl_RenderState.SetColor(0.2f,0.2f,0.2f,fuzzalpha, Colormap.desaturation);
|
||||
additivefog = true;
|
||||
}
|
||||
|
@ -294,16 +294,6 @@ void GLSprite::Draw(int pass)
|
|||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl_RenderState.BlendEquation(GL_FUNC_ADD);
|
||||
gl_RenderState.SetTextureMode(TM_MODULATE);
|
||||
|
||||
// [BB] Restore the alpha test after drawing a smooth particle.
|
||||
if (hw_styleflags == STYLEHW_NoAlphaTest)
|
||||
{
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL,gl_mask_sprite_threshold);
|
||||
}
|
||||
}
|
||||
|
||||
gl_RenderState.SetObjectColor(0xffffffff);
|
||||
|
|
|
@ -301,9 +301,8 @@ void GLWall::RenderFogBoundary()
|
|||
int rel = rellight + getExtraLight();
|
||||
gl_SetFog(lightlevel, rel, &Colormap, false);
|
||||
gl_RenderState.SetEffect(EFF_FOGBOUNDARY);
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
RenderWall(RWF_BLANK);
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
gl_RenderState.SetEffect(EFF_NONE);
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +348,7 @@ void GLWall::RenderMirrorSurface()
|
|||
|
||||
// Restore the defaults for the translucent pass
|
||||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL,0.5f*gl_mask_sprite_threshold);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
|
||||
glDepthFunc(GL_LESS);
|
||||
|
||||
// This is drawn in the translucent pass which is done after the decal pass
|
||||
|
@ -383,8 +382,8 @@ void GLWall::RenderTranslucentWall()
|
|||
// and until that changes I won't fix this code for the new blending modes!
|
||||
bool isadditive = RenderStyle == STYLE_Add;
|
||||
|
||||
if (!transparent) gl_RenderState.AlphaFunc(GL_GEQUAL,gl_mask_threshold*fabs(alpha));
|
||||
else gl_RenderState.EnableAlphaTest(false);
|
||||
if (!transparent) gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
|
||||
else gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
if (isadditive) gl_RenderState.BlendFunc(GL_SRC_ALPHA,GL_ONE);
|
||||
|
||||
int extra;
|
||||
|
@ -408,7 +407,6 @@ void GLWall::RenderTranslucentWall()
|
|||
|
||||
// restore default settings
|
||||
if (isadditive) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
if (transparent) gl_RenderState.EnableAlphaTest(true);
|
||||
|
||||
if (!gltexture)
|
||||
{
|
||||
|
|
|
@ -151,7 +151,7 @@ void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed
|
|||
|
||||
if (tex->GetTransparent() || OverrideShader != 0)
|
||||
{
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
}
|
||||
gl_RenderState.Apply();
|
||||
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
|
||||
|
@ -164,10 +164,7 @@ void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed
|
|||
ptr->Set(x2, y2, 0, fU2, fV2);
|
||||
ptr++;
|
||||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
|
||||
if (tex->GetTransparent() || OverrideShader != 0)
|
||||
{
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
}
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.5f);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -203,6 +203,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
muInterpolationFactor.Init(hShader, "uInterpolationFactor");
|
||||
muClipHeightTop.Init(hShader, "uClipHeightTop");
|
||||
muClipHeightBottom.Init(hShader, "uClipHeightBottom");
|
||||
muAlphaThreshold.Init(hShader, "uAlphaThreshold");
|
||||
|
||||
timer_index = glGetUniformLocation(hShader, "timer");
|
||||
lights_index = glGetUniformLocation(hShader, "lights");
|
||||
|
|
|
@ -195,6 +195,7 @@ class FShader
|
|||
FBufferedUniform1f muInterpolationFactor;
|
||||
FBufferedUniform1f muClipHeightTop;
|
||||
FBufferedUniform1f muClipHeightBottom;
|
||||
FBufferedUniform1f muAlphaThreshold;
|
||||
|
||||
int timer_index;
|
||||
int lights_index;
|
||||
|
|
|
@ -150,7 +150,6 @@ void OpenGLFrameBuffer::InitializeState()
|
|||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glAlphaFunc(GL_GEQUAL,0.5f);
|
||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
||||
|
||||
|
|
|
@ -68,15 +68,13 @@
|
|||
|
||||
//GL headers
|
||||
#include <GL/glew.h>
|
||||
//#include "gl_load.h"
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#elif defined(__unix__)
|
||||
//#include <GL/glxew.h>
|
||||
#else // !__APPLE__ && !__unix__
|
||||
#define DWORD WINDOWS_DWORD // I don't want to depend on this throughout the GL code!
|
||||
#include <GL/wglew.h>
|
||||
#undef DWORD
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -280,7 +280,7 @@ bool OpenGLFrameBuffer::Wiper_Crossfade::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
float vb = fb->GetHeight() / FHardwareTexture::GetTexDimension(fb->GetHeight());
|
||||
|
||||
gl_RenderState.SetTextureMode(TM_OPAQUE);
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.Apply();
|
||||
fb->wipestartscreen->Bind(0);
|
||||
|
@ -302,7 +302,7 @@ bool OpenGLFrameBuffer::Wiper_Crossfade::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
gl_RenderState.SetColorAlpha(0xffffff, clamp(Clock/32.f, 0.f, 1.f));
|
||||
gl_RenderState.Apply();
|
||||
GLRenderer->mVBO->RenderArray(GL_TRIANGLE_STRIP, offset, count);
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.5f);
|
||||
gl_RenderState.SetTextureMode(TM_MODULATE);
|
||||
|
||||
return Clock >= 32;
|
||||
|
@ -490,7 +490,7 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
|
||||
// Put the initial screen back to the buffer.
|
||||
gl_RenderState.SetTextureMode(TM_OPAQUE);
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.Apply();
|
||||
fb->wipestartscreen->Bind(0);
|
||||
|
|
|
@ -223,6 +223,12 @@ void main()
|
|||
#endif
|
||||
|
||||
vec4 frag = ProcessTexel();
|
||||
|
||||
#ifndef NO_DISCARD
|
||||
// alpha testing
|
||||
if (frag.a <= uAlphaThreshold) discard;
|
||||
#endif
|
||||
|
||||
|
||||
switch (uFixedColormap)
|
||||
{
|
||||
|
|
|
@ -52,8 +52,8 @@ void main()
|
|||
|
||||
#ifdef SPHEREMAP
|
||||
vec3 u = normalize(eyeCoordPos.xyz);
|
||||
vec3 n = normalize(TextureMatrix * vec4(tc.x, 0.0, tc.y, 0.0); // use texture matrix and coordinates for our normal. Since this is only used on walls, the normal's y coordinate is always 0.
|
||||
vec3 r = reflect(u, n);
|
||||
vec4 n = normalize(TextureMatrix * vec4(tc.x, 0.0, tc.y, 0.0)); // use texture matrix and coordinates for our normal. Since this is only used on walls, the normal's y coordinate is always 0.
|
||||
vec3 r = reflect(u, n.xyz);
|
||||
float m = 2.0 * sqrt( r.x*r.x + r.y*r.y + (r.z+1.0)*(r.z+1.0) );
|
||||
vec2 sst = vec2(r.x/m + 0.5, r.y/m + 0.5);
|
||||
gl_TexCoord[0].xy = sst;
|
||||
|
|
|
@ -4,6 +4,7 @@ uniform vec4 uCameraPos;
|
|||
uniform float uClipHeightTop, uClipHeightBottom;
|
||||
|
||||
uniform int uTextureMode;
|
||||
uniform float uAlphaThreshold;
|
||||
|
||||
// colors
|
||||
uniform vec4 uObjectColor;
|
||||
|
@ -34,8 +35,7 @@ uniform int uFogEnabled;
|
|||
// dynamic lights
|
||||
uniform ivec4 uLightRange;
|
||||
|
||||
|
||||
// redefine the matrix names to what they actually represent.
|
||||
// matrices
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform mat4 ViewMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
|
Loading…
Reference in a new issue