Merge branch 'master' into modern

# Conflicts:
#	src/gl/renderer/gl_renderer.cpp
#	src/gl/renderer/gl_renderer.h
#	src/gl/renderer/gl_renderstate.h
#	src/gl/system/gl_framebuffer.cpp
#	src/gl/system/gl_framebuffer.h
This commit is contained in:
Christoph Oelckers 2018-07-14 13:18:34 +02:00
commit 33ee0f3c27
15 changed files with 205 additions and 138 deletions

View file

@ -51,6 +51,8 @@ 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 TArray<FString> usershaderdefs;
extern TDeletingArray<FLightDefaults *> LightDefaults;
@ -1378,6 +1380,9 @@ class GLDefsParser
bool iwad = false;
int maplump = -1;
FString maplumpname;
FString materiallumpname = "shaders/glsl/material_normal.fp";
FString texnameDefs = "";
TArray<FString> texNameList;
float speed = 1.f;
sc.MustGetString();
@ -1393,11 +1398,62 @@ class GLDefsParser
sc.MustGetString();
maplumpname = sc.String;
}
else if (sc.Compare("material"))
{
sc.MustGetString();
materiallumpname = sc.String;
}
else if (sc.Compare("speed"))
{
sc.MustGetFloat();
speed = float(sc.Float);
}
else if (sc.Compare("texture"))
{
sc.MustGetString();
FString textureName = sc.String;
for(FString &texName : texNameList)
{
if(!texName.Compare(textureName))
{
sc.ScriptError("Trying to redefine custom hardware shader texture '%s' in texture '%s'\n", textureName.GetChars(), tex? tex->Name.GetChars() : "(null)");
}
}
texNameList.Push(textureName);
sc.MustGetString();
bool okay = false;
for (int i = 0; i < MAX_CUSTOM_HW_SHADER_TEXTURES; i++)
{
if (!tex->CustomShaderTextures[i])
{
tex->CustomShaderTextures[i] = TexMan.FindTexture(sc.String, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
if (!tex->CustomShaderTextures[i])
{
sc.ScriptError("Custom hardware shader texture '%s' not found in texture '%s'\n", sc.String, tex? tex->Name.GetChars() : "(null)");
}
texnameDefs.AppendFormat("#define %s texture%d\n", textureName.GetChars(), i + 2);
okay = true;
break;
}
}
if(!okay)
{
sc.ScriptError("Error: out of texture units in texture '%s'", tex? tex->Name.GetChars() : "(null)");
}
}
else if(sc.Compare("define"))
{
sc.MustGetString();
FString defineName = sc.String;
FString defineValue = "";
if(sc.CheckToken('='))
{
sc.MustGetString();
defineValue = sc.String;
}
texnameDefs.AppendFormat("#define %s %s\n", defineName.GetChars(), defineValue.GetChars());
}
}
if (!tex)
{
@ -1414,13 +1470,17 @@ 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) &&
!usershaderdefs[i].Compare(texnameDefs))
{
tex->shaderindex = i + FIRST_USER_SHADER;
return;
}
}
tex->shaderindex = usershaders.Push(maplumpname) + FIRST_USER_SHADER;
usermaterials.Push(materiallumpname);
usershaderdefs.Push(texnameDefs);
}
}
}