mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- Add new material shader entries for specular and PBR light modes
This commit is contained in:
parent
4dd2d789f4
commit
0f69778e23
4 changed files with 45 additions and 35 deletions
|
@ -991,7 +991,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
|||
{
|
||||
// Todo: implement shader selection here
|
||||
RenderStyle = LegacyRenderStyles[STYLE_Translucent];
|
||||
OverrideShader = gl_fuzztype + 4;
|
||||
OverrideShader = SHADER_NoTexture + gl_fuzztype;
|
||||
trans = 0.99f; // trans may not be 1 here
|
||||
hw_styleflags = STYLEHW_NoAlphaTest;
|
||||
}
|
||||
|
|
|
@ -355,7 +355,7 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
{
|
||||
// Todo: implement shader selection here
|
||||
RenderStyle = LegacyRenderStyles[STYLE_Translucent];
|
||||
OverrideShader = gl_fuzztype + 4;
|
||||
OverrideShader = SHADER_NoTexture + gl_fuzztype;
|
||||
trans = 0.99f; // trans may not be 1 here
|
||||
}
|
||||
else
|
||||
|
|
|
@ -325,9 +325,10 @@ bool FShader::Bind()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FShader *FShaderCollection::Compile (const char *ShaderName, const char *ShaderPath, bool usediscard, EPassType passType)
|
||||
FShader *FShaderCollection::Compile (const char *ShaderName, const char *ShaderPath, const char *shaderdefines, bool usediscard, EPassType passType)
|
||||
{
|
||||
FString defines;
|
||||
defines += shaderdefines;
|
||||
// this can't be in the shader code due to ATI strangeness.
|
||||
if (gl.MaxLights() == 128) defines += "#define MAXLIGHTS128\n";
|
||||
if (!usediscard) defines += "#define NO_ALPHATEST\n";
|
||||
|
@ -374,24 +375,29 @@ struct FDefaultShader
|
|||
{
|
||||
const char * ShaderName;
|
||||
const char * gettexelfunc;
|
||||
const char * Defines;
|
||||
};
|
||||
|
||||
// Note: the ShaderIndex enum in gl_shader.h needs to be updated whenever this array is modified.
|
||||
// Note: the MaterialShaderIndex enum in gl_shader.h needs to be updated whenever this array is modified.
|
||||
static const FDefaultShader defaultshaders[]=
|
||||
{
|
||||
{"Default", "shaders/glsl/func_normal.fp"},
|
||||
{"Warp 1", "shaders/glsl/func_warp1.fp"},
|
||||
{"Warp 2", "shaders/glsl/func_warp2.fp"},
|
||||
{"Brightmap","shaders/glsl/func_brightmap.fp"},
|
||||
{"No Texture", "shaders/glsl/func_notexture.fp"},
|
||||
{"Basic Fuzz", "shaders/glsl/fuzz_standard.fp"},
|
||||
{"Smooth Fuzz", "shaders/glsl/fuzz_smooth.fp"},
|
||||
{"Swirly Fuzz", "shaders/glsl/fuzz_swirly.fp"},
|
||||
{"Translucent Fuzz", "shaders/glsl/fuzz_smoothtranslucent.fp"},
|
||||
{"Jagged Fuzz", "shaders/glsl/fuzz_jagged.fp"},
|
||||
{"Noise Fuzz", "shaders/glsl/fuzz_noise.fp"},
|
||||
{"Smooth Noise Fuzz", "shaders/glsl/fuzz_smoothnoise.fp"},
|
||||
{NULL,NULL}
|
||||
{"Default", "shaders/glsl/func_normal.fp", ""},
|
||||
{"Warp 1", "shaders/glsl/func_warp1.fp", ""},
|
||||
{"Warp 2", "shaders/glsl/func_warp2.fp", ""},
|
||||
{"Brightmap","shaders/glsl/func_brightmap.fp", ""},
|
||||
{"Specular","shaders/glsl/func_normal.fp", "#define SPECULAR\n"},
|
||||
{"SpecularBrightmap","shaders/glsl/func_brightmap.fp", "#define SPECULAR\n"},
|
||||
{"PBR","shaders/glsl/func_normal.fp", "#define PBR\n"},
|
||||
{"PBRBrightmap","shaders/glsl/func_brightmap.fp", "#define PBR\n"},
|
||||
{"No Texture", "shaders/glsl/func_notexture.fp", ""},
|
||||
{"Basic Fuzz", "shaders/glsl/fuzz_standard.fp", ""},
|
||||
{"Smooth Fuzz", "shaders/glsl/fuzz_smooth.fp", ""},
|
||||
{"Swirly Fuzz", "shaders/glsl/fuzz_swirly.fp", ""},
|
||||
{"Translucent Fuzz", "shaders/glsl/fuzz_smoothtranslucent.fp", ""},
|
||||
{"Jagged Fuzz", "shaders/glsl/fuzz_jagged.fp", ""},
|
||||
{"Noise Fuzz", "shaders/glsl/fuzz_noise.fp", ""},
|
||||
{"Smooth Noise Fuzz", "shaders/glsl/fuzz_smoothnoise.fp", ""},
|
||||
{NULL,NULL,NULL}
|
||||
};
|
||||
|
||||
static TArray<FString> usershaders;
|
||||
|
@ -530,11 +536,11 @@ void FShaderCollection::CompileShaders(EPassType passType)
|
|||
|
||||
for(int i=0;defaultshaders[i].ShaderName != NULL;i++)
|
||||
{
|
||||
FShader *shc = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, true, passType);
|
||||
FShader *shc = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].Defines, true, passType);
|
||||
mMaterialShaders.Push(shc);
|
||||
if (i <= SHADER_Brightmap)
|
||||
if (i < SHADER_NoTexture)
|
||||
{
|
||||
FShader *shc = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, false, passType);
|
||||
FShader *shc = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].Defines, false, passType);
|
||||
mMaterialShadersNAT.Push(shc);
|
||||
}
|
||||
}
|
||||
|
@ -544,7 +550,7 @@ void FShaderCollection::CompileShaders(EPassType passType)
|
|||
FString name = ExtractFileBase(usershaders[i]);
|
||||
FName sfn = name;
|
||||
|
||||
FShader *shc = Compile(sfn, usershaders[i], true, passType);
|
||||
FShader *shc = Compile(sfn, usershaders[i], "", true, passType);
|
||||
mMaterialShaders.Push(shc);
|
||||
}
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ class FShaderCollection
|
|||
public:
|
||||
FShaderCollection(EPassType passType);
|
||||
~FShaderCollection();
|
||||
FShader *Compile(const char *ShaderName, const char *ShaderPath, bool usediscard, EPassType passType);
|
||||
FShader *Compile(const char *ShaderName, const char *ShaderPath, const char *shaderdefines, bool usediscard, EPassType passType);
|
||||
int Find(const char *mame);
|
||||
FShader *BindEffect(int effect);
|
||||
void ApplyMatrices(VSMatrix *proj, VSMatrix *view);
|
||||
|
@ -399,19 +399,23 @@ public:
|
|||
|
||||
enum MaterialShaderIndex
|
||||
{
|
||||
SHADER_Default = 0,
|
||||
SHADER_Warp1 = 1,
|
||||
SHADER_Warp2 = 2,
|
||||
SHADER_Brightmap = 3,
|
||||
SHADER_NoTexture = 4,
|
||||
SHADER_BasicFuzz = 5,
|
||||
SHADER_SmoothFuzz = 6,
|
||||
SHADER_SwirlyFuzz = 7,
|
||||
SHADER_TranslucentFuzz = 8,
|
||||
SHADER_JaggedFuzz = 9,
|
||||
SHADER_NoiseFuzz = 10,
|
||||
SHADER_SmoothNoiseFuzz = 11,
|
||||
FIRST_USER_SHADER = 12
|
||||
SHADER_Default,
|
||||
SHADER_Warp1,
|
||||
SHADER_Warp2,
|
||||
SHADER_Brightmap,
|
||||
SHADER_Specular,
|
||||
SHADER_SpecularBrightmap,
|
||||
SHADER_PBR,
|
||||
SHADER_PBRBrightmap,
|
||||
SHADER_NoTexture,
|
||||
SHADER_BasicFuzz,
|
||||
SHADER_SmoothFuzz,
|
||||
SHADER_SwirlyFuzz,
|
||||
SHADER_TranslucentFuzz,
|
||||
SHADER_JaggedFuzz,
|
||||
SHADER_NoiseFuzz,
|
||||
SHADER_SmoothNoiseFuzz,
|
||||
FIRST_USER_SHADER
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
Loading…
Reference in a new issue