diff --git a/src/gl/shaders/gl_shader.cpp b/src/gl/shaders/gl_shader.cpp index e73ff2aeb..3fa890811 100644 --- a/src/gl/shaders/gl_shader.cpp +++ b/src/gl/shaders/gl_shader.cpp @@ -600,6 +600,7 @@ static const FDefaultShader defaultshaders[]= }; TArray usershaders; +TArray 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); } diff --git a/src/r_data/gldefs.cpp b/src/r_data/gldefs.cpp index 4bed65fac..3ae3ed152 100644 --- a/src/r_data/gldefs.cpp +++ b/src/r_data/gldefs.cpp @@ -57,6 +57,7 @@ void AddLightAssociation(const char *actor, const char *frame, const char *light void InitializeActorLights(TArray &LightAssociations); extern TArray usershaders; +extern TArray usermaterials; extern TDeletingArray 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); } } }