mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
Made ability to define custom material shaders for ProcessMaterial function
This commit is contained in:
parent
292458ee2d
commit
fa51a54042
2 changed files with 11 additions and 2 deletions
|
@ -496,6 +496,7 @@ static const FDefaultShader defaultshaders[]=
|
|||
};
|
||||
|
||||
TArray<FString> usershaders;
|
||||
TArray<FString> usermaterials;
|
||||
|
||||
struct FEffectShader
|
||||
{
|
||||
|
@ -647,7 +648,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,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;
|
||||
|
||||
|
||||
|
@ -1378,6 +1379,7 @@ class GLDefsParser
|
|||
bool iwad = false;
|
||||
int maplump = -1;
|
||||
FString maplumpname;
|
||||
FString materiallumpname = "shaders/glsl/material_normal.fp";
|
||||
float speed = 1.f;
|
||||
|
||||
sc.MustGetString();
|
||||
|
@ -1393,6 +1395,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();
|
||||
|
@ -1432,13 +1439,14 @@ class GLDefsParser
|
|||
tex->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->shaderindex = i + FIRST_USER_SHADER;
|
||||
return;
|
||||
}
|
||||
}
|
||||
tex->shaderindex = usershaders.Push(maplumpname) + FIRST_USER_SHADER;
|
||||
usermaterials.Push(materiallumpname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue