mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 23:12:24 +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
|
// Todo: implement shader selection here
|
||||||
RenderStyle = LegacyRenderStyles[STYLE_Translucent];
|
RenderStyle = LegacyRenderStyles[STYLE_Translucent];
|
||||||
OverrideShader = gl_fuzztype + 4;
|
OverrideShader = SHADER_NoTexture + gl_fuzztype;
|
||||||
trans = 0.99f; // trans may not be 1 here
|
trans = 0.99f; // trans may not be 1 here
|
||||||
hw_styleflags = STYLEHW_NoAlphaTest;
|
hw_styleflags = STYLEHW_NoAlphaTest;
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,7 +355,7 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
||||||
{
|
{
|
||||||
// Todo: implement shader selection here
|
// Todo: implement shader selection here
|
||||||
RenderStyle = LegacyRenderStyles[STYLE_Translucent];
|
RenderStyle = LegacyRenderStyles[STYLE_Translucent];
|
||||||
OverrideShader = gl_fuzztype + 4;
|
OverrideShader = SHADER_NoTexture + gl_fuzztype;
|
||||||
trans = 0.99f; // trans may not be 1 here
|
trans = 0.99f; // trans may not be 1 here
|
||||||
}
|
}
|
||||||
else
|
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;
|
FString defines;
|
||||||
|
defines += shaderdefines;
|
||||||
// this can't be in the shader code due to ATI strangeness.
|
// this can't be in the shader code due to ATI strangeness.
|
||||||
if (gl.MaxLights() == 128) defines += "#define MAXLIGHTS128\n";
|
if (gl.MaxLights() == 128) defines += "#define MAXLIGHTS128\n";
|
||||||
if (!usediscard) defines += "#define NO_ALPHATEST\n";
|
if (!usediscard) defines += "#define NO_ALPHATEST\n";
|
||||||
|
@ -374,24 +375,29 @@ struct FDefaultShader
|
||||||
{
|
{
|
||||||
const char * ShaderName;
|
const char * ShaderName;
|
||||||
const char * gettexelfunc;
|
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[]=
|
static const FDefaultShader defaultshaders[]=
|
||||||
{
|
{
|
||||||
{"Default", "shaders/glsl/func_normal.fp"},
|
{"Default", "shaders/glsl/func_normal.fp", ""},
|
||||||
{"Warp 1", "shaders/glsl/func_warp1.fp"},
|
{"Warp 1", "shaders/glsl/func_warp1.fp", ""},
|
||||||
{"Warp 2", "shaders/glsl/func_warp2.fp"},
|
{"Warp 2", "shaders/glsl/func_warp2.fp", ""},
|
||||||
{"Brightmap","shaders/glsl/func_brightmap.fp"},
|
{"Brightmap","shaders/glsl/func_brightmap.fp", ""},
|
||||||
{"No Texture", "shaders/glsl/func_notexture.fp"},
|
{"Specular","shaders/glsl/func_normal.fp", "#define SPECULAR\n"},
|
||||||
{"Basic Fuzz", "shaders/glsl/fuzz_standard.fp"},
|
{"SpecularBrightmap","shaders/glsl/func_brightmap.fp", "#define SPECULAR\n"},
|
||||||
{"Smooth Fuzz", "shaders/glsl/fuzz_smooth.fp"},
|
{"PBR","shaders/glsl/func_normal.fp", "#define PBR\n"},
|
||||||
{"Swirly Fuzz", "shaders/glsl/fuzz_swirly.fp"},
|
{"PBRBrightmap","shaders/glsl/func_brightmap.fp", "#define PBR\n"},
|
||||||
{"Translucent Fuzz", "shaders/glsl/fuzz_smoothtranslucent.fp"},
|
{"No Texture", "shaders/glsl/func_notexture.fp", ""},
|
||||||
{"Jagged Fuzz", "shaders/glsl/fuzz_jagged.fp"},
|
{"Basic Fuzz", "shaders/glsl/fuzz_standard.fp", ""},
|
||||||
{"Noise Fuzz", "shaders/glsl/fuzz_noise.fp"},
|
{"Smooth Fuzz", "shaders/glsl/fuzz_smooth.fp", ""},
|
||||||
{"Smooth Noise Fuzz", "shaders/glsl/fuzz_smoothnoise.fp"},
|
{"Swirly Fuzz", "shaders/glsl/fuzz_swirly.fp", ""},
|
||||||
{NULL,NULL}
|
{"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;
|
static TArray<FString> usershaders;
|
||||||
|
@ -530,11 +536,11 @@ void FShaderCollection::CompileShaders(EPassType passType)
|
||||||
|
|
||||||
for(int i=0;defaultshaders[i].ShaderName != NULL;i++)
|
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);
|
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);
|
mMaterialShadersNAT.Push(shc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -544,7 +550,7 @@ void FShaderCollection::CompileShaders(EPassType passType)
|
||||||
FString name = ExtractFileBase(usershaders[i]);
|
FString name = ExtractFileBase(usershaders[i]);
|
||||||
FName sfn = name;
|
FName sfn = name;
|
||||||
|
|
||||||
FShader *shc = Compile(sfn, usershaders[i], true, passType);
|
FShader *shc = Compile(sfn, usershaders[i], "", true, passType);
|
||||||
mMaterialShaders.Push(shc);
|
mMaterialShaders.Push(shc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,7 @@ class FShaderCollection
|
||||||
public:
|
public:
|
||||||
FShaderCollection(EPassType passType);
|
FShaderCollection(EPassType passType);
|
||||||
~FShaderCollection();
|
~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);
|
int Find(const char *mame);
|
||||||
FShader *BindEffect(int effect);
|
FShader *BindEffect(int effect);
|
||||||
void ApplyMatrices(VSMatrix *proj, VSMatrix *view);
|
void ApplyMatrices(VSMatrix *proj, VSMatrix *view);
|
||||||
|
@ -399,19 +399,23 @@ public:
|
||||||
|
|
||||||
enum MaterialShaderIndex
|
enum MaterialShaderIndex
|
||||||
{
|
{
|
||||||
SHADER_Default = 0,
|
SHADER_Default,
|
||||||
SHADER_Warp1 = 1,
|
SHADER_Warp1,
|
||||||
SHADER_Warp2 = 2,
|
SHADER_Warp2,
|
||||||
SHADER_Brightmap = 3,
|
SHADER_Brightmap,
|
||||||
SHADER_NoTexture = 4,
|
SHADER_Specular,
|
||||||
SHADER_BasicFuzz = 5,
|
SHADER_SpecularBrightmap,
|
||||||
SHADER_SmoothFuzz = 6,
|
SHADER_PBR,
|
||||||
SHADER_SwirlyFuzz = 7,
|
SHADER_PBRBrightmap,
|
||||||
SHADER_TranslucentFuzz = 8,
|
SHADER_NoTexture,
|
||||||
SHADER_JaggedFuzz = 9,
|
SHADER_BasicFuzz,
|
||||||
SHADER_NoiseFuzz = 10,
|
SHADER_SmoothFuzz,
|
||||||
SHADER_SmoothNoiseFuzz = 11,
|
SHADER_SwirlyFuzz,
|
||||||
FIRST_USER_SHADER = 12
|
SHADER_TranslucentFuzz,
|
||||||
|
SHADER_JaggedFuzz,
|
||||||
|
SHADER_NoiseFuzz,
|
||||||
|
SHADER_SmoothNoiseFuzz,
|
||||||
|
FIRST_USER_SHADER
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
Loading…
Reference in a new issue