mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 16:07:45 +00:00
- added option to disable alpha testing for user shaders.
This commit is contained in:
parent
40da1dbfbc
commit
91df3f8c73
5 changed files with 23 additions and 12 deletions
|
@ -43,8 +43,6 @@
|
||||||
#include "gl/renderer/gl_renderer.h"
|
#include "gl/renderer/gl_renderer.h"
|
||||||
#include "gl/shaders/gl_shader.h"
|
#include "gl/shaders/gl_shader.h"
|
||||||
|
|
||||||
extern TArray<UserShaderDesc> usershaders;
|
|
||||||
|
|
||||||
namespace OpenGLRenderer
|
namespace OpenGLRenderer
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -104,10 +104,8 @@ void GLSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
||||||
{
|
{
|
||||||
state.AlphaFunc(Alpha_GEqual, 0.f);
|
state.AlphaFunc(Alpha_GEqual, 0.f);
|
||||||
}
|
}
|
||||||
else
|
else if (!gltexture->tex->GetTranslucency()) state.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
|
||||||
{
|
else state.AlphaFunc(Alpha_Greater, 0.f);
|
||||||
state.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RenderStyle.BlendOp == STYLEOP_Shadow)
|
if (RenderStyle.BlendOp == STYLEOP_Shadow)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, gl_texture_usehires)
|
EXTERN_CVAR(Bool, gl_texture_usehires)
|
||||||
|
|
||||||
extern TArray<UserShaderDesc> usershaders;
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// Quick'n dirty image rescaling.
|
// Quick'n dirty image rescaling.
|
||||||
|
|
|
@ -1154,6 +1154,15 @@ class GLDefsParser
|
||||||
tex->bDisableFullbright = disable_fullbright;
|
tex->bDisableFullbright = disable_fullbright;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetShaderIndex(FTexture *tex, unsigned index)
|
||||||
|
{
|
||||||
|
auto desc = usershaders[index - FIRST_USER_SHADER];
|
||||||
|
if (desc.disablealphatest)
|
||||||
|
{
|
||||||
|
tex->bTranslucent = true;
|
||||||
|
}
|
||||||
|
tex->shaderindex = index;
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -1370,11 +1379,11 @@ class GLDefsParser
|
||||||
usershaders[i].shaderType == usershader.shaderType &&
|
usershaders[i].shaderType == usershader.shaderType &&
|
||||||
!usershaders[i].defines.Compare(usershader.defines))
|
!usershaders[i].defines.Compare(usershader.defines))
|
||||||
{
|
{
|
||||||
tex->shaderindex = i + FIRST_USER_SHADER;
|
SetShaderIndex(tex, i + FIRST_USER_SHADER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tex->shaderindex = usershaders.Push(usershader) + FIRST_USER_SHADER;
|
SetShaderIndex(tex, usershaders.Push(usershader) + FIRST_USER_SHADER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1570,6 +1579,10 @@ class GLDefsParser
|
||||||
}
|
}
|
||||||
desc.defines.AppendFormat("#define %s %s\n", defineName.GetChars(), defineValue.GetChars());
|
desc.defines.AppendFormat("#define %s %s\n", defineName.GetChars(), defineValue.GetChars());
|
||||||
}
|
}
|
||||||
|
else if (sc.Compare("disablealphatest"))
|
||||||
|
{
|
||||||
|
desc.disablealphatest = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!tex)
|
if (!tex)
|
||||||
{
|
{
|
||||||
|
@ -1607,11 +1620,11 @@ class GLDefsParser
|
||||||
usershaders[i].shaderType == desc.shaderType &&
|
usershaders[i].shaderType == desc.shaderType &&
|
||||||
!usershaders[i].defines.Compare(desc.defines))
|
!usershaders[i].defines.Compare(desc.defines))
|
||||||
{
|
{
|
||||||
tex->shaderindex = i + FIRST_USER_SHADER;
|
SetShaderIndex(tex, i + FIRST_USER_SHADER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tex->shaderindex = usershaders.Push(desc) + FIRST_USER_SHADER;
|
SetShaderIndex(tex, usershaders.Push(desc) + FIRST_USER_SHADER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,12 @@ struct UserShaderDesc
|
||||||
FString shader;
|
FString shader;
|
||||||
MaterialShaderIndex shaderType;
|
MaterialShaderIndex shaderType;
|
||||||
FString defines;
|
FString defines;
|
||||||
|
bool disablealphatest = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern TArray<UserShaderDesc> usershaders;
|
||||||
|
|
||||||
|
|
||||||
struct FloatRect
|
struct FloatRect
|
||||||
{
|
{
|
||||||
float left,top;
|
float left,top;
|
||||||
|
|
Loading…
Reference in a new issue