mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 09:31:14 +00:00
Made ability to define custom material shaders for ProcessMaterial function
# Conflicts: # src/r_data/gldefs.cpp
This commit is contained in:
parent
4c106de5d7
commit
5cddbe4a16
2 changed files with 11 additions and 2 deletions
|
@ -600,6 +600,7 @@ static const FDefaultShader defaultshaders[]=
|
|||
};
|
||||
|
||||
TArray<FString> usershaders;
|
||||
TArray<FString> usermaterials;
|
||||
|
||||
struct FEffectShader
|
||||
{
|
||||
|
@ -750,7 +751,7 @@ void FShaderCollection::CompileShaders(EPassType passType)
|
|||
FString name = ExtractFileBase(usershaders[i]);
|
||||
FName sfn = name;
|
||||
|
||||
FShader *shc = Compile(sfn, usershaders[i], "shaders/glsl/material_normal.fp", "", true, passType);
|
||||
FShader *shc = Compile(sfn, usershaders[i], usermaterials[i], "", true, passType);
|
||||
mMaterialShaders.Push(shc);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ void AddLightAssociation(const char *actor, const char *frame, const char *light
|
|||
void InitializeActorLights(TArray<FLightAssociation> &LightAssociations);
|
||||
|
||||
extern TArray<FString> usershaders;
|
||||
extern TArray<FString> usermaterials;
|
||||
extern TDeletingArray<FLightDefaults *> LightDefaults;
|
||||
|
||||
|
||||
|
@ -1384,6 +1385,7 @@ class GLDefsParser
|
|||
bool iwad = false;
|
||||
int maplump = -1;
|
||||
FString maplumpname;
|
||||
FString materiallumpname = "shaders/glsl/material_normal.fp";
|
||||
float speed = 1.f;
|
||||
|
||||
sc.MustGetString();
|
||||
|
@ -1399,6 +1401,11 @@ class GLDefsParser
|
|||
sc.MustGetString();
|
||||
maplumpname = sc.String;
|
||||
}
|
||||
else if (sc.Compare("material"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
materiallumpname = sc.String;
|
||||
}
|
||||
else if (sc.Compare("speed"))
|
||||
{
|
||||
sc.MustGetFloat();
|
||||
|
@ -1438,13 +1445,14 @@ class GLDefsParser
|
|||
tex->gl_info.shaderspeed = speed;
|
||||
for (unsigned i = 0; i < usershaders.Size(); i++)
|
||||
{
|
||||
if (!usershaders[i].CompareNoCase(maplumpname))
|
||||
if (!usershaders[i].CompareNoCase(maplumpname) && !usermaterials[i].CompareNoCase(materiallumpname))
|
||||
{
|
||||
tex->gl_info.shaderindex = i + FIRST_USER_SHADER;
|
||||
return;
|
||||
}
|
||||
}
|
||||
tex->gl_info.shaderindex = usershaders.Push(maplumpname) + FIRST_USER_SHADER;
|
||||
usermaterials.Push(materiallumpname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue