- first round of fixes to abandoned commit.

This commit is contained in:
Christoph Oelckers 2016-01-01 13:35:49 +01:00
parent a5e1228cec
commit ad960ab052
13 changed files with 29 additions and 27 deletions

View file

@ -411,9 +411,9 @@ unsigned int FShaderManager::GetShaderIndex(FName coord, FName tex, FName lite)
return i;
}
}
for (unsigned int i = 0; i < CoordinateShaders.Size(); i++)
for (unsigned int k = 0; k < CoordinateShaders.Size(); k++)
{
if (CoordinateShaders[i]->mName == coord)
if (CoordinateShaders[k]->mName == coord)
{
for (unsigned int i = 0; i < TexelShaders.Size(); i++)
@ -434,18 +434,18 @@ unsigned int FShaderManager::GetShaderIndex(FName coord, FName tex, FName lite)
unsigned int ndx = mShaders.Reserve(1);
FShaderContainer *cont = &mShaders[ndx];
shname << CoordinateShaders[i]->mName << "::" << TexelShaders[i]->mName << "::" << LightShaders[j]->mName;
shname << CoordinateShaders[k]->mName << "::" << TexelShaders[i]->mName << "::" << LightShaders[j]->mName;
DPrintf("Compiling shader %s\n", shname);
cont->mCoordinateName = coord;
cont->mTexelName = tex;
cont->mLightName = lite;
cont->mShader = cont->mShaderNAT = NULL;
cont->mShader = Compile(shname, CoordinateShaders[i], TexelShaders[i], LightShaders[j], true);
cont->mShader = Compile(shname, CoordinateShaders[k], TexelShaders[i], LightShaders[j], true);
if (!TexelShaders[i]->bRequireAlphaTest)
{
cont->mShaderNAT = Compile(shname, CoordinateShaders[i], TexelShaders[i], LightShaders[j], false);
cont->mShaderNAT = Compile(shname, CoordinateShaders[k], TexelShaders[i], LightShaders[j], false);
}
return ndx;
}
@ -681,6 +681,7 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump)
def->mName = nm;
def->mCoreLump = false;
def->mNoLightShader = true;
def->mNoCoordinateShader = false;
def->mSourceFile = maplumpname;
TexelShaders.Push(def);
}
@ -690,6 +691,7 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump)
def->mName = nm;
def->mCoreLump = false;
def->mNoLightShader = true;
def->mNoCoordinateShader = false;
def->mSourceFile = maplumpname;
}
tex->gl_info.texelFunction = nm;
@ -758,10 +760,14 @@ void gl_ParseShaderDef(FScanner &sc, int functiontype)
}
}
}
else if (sc.Compare("nolightshader"))
else if (sc.Compare("nolightfunction"))
{
def->mNoLightShader = true;
}
else if (sc.Compare("nocoordinatefunction"))
{
def->mNoCoordinateShader = true;
}
else if (sc.Compare("requirealphatest"))
{
def->bRequireAlphaTest = true;

View file

@ -121,6 +121,7 @@ struct FShaderDefinition
FName mName;
FString mSourceFile;
bool mNoLightShader;
bool mNoCoordinateShader;
bool mCoreLump;
bool bRequireAlphaTest;
TArray<FString> mTextureUnitNames;
@ -128,6 +129,7 @@ struct FShaderDefinition
FShaderDefinition()
{
mNoCoordinateShader = false;
mNoLightShader = false;
mCoreLump = false;
bRequireAlphaTest = false;

View file

@ -41,6 +41,7 @@ TexelFunction "No Texture"
{
source "shaders/glsl/func_texel_notexture.fp", corelump
noLightFunction
noCoordinateFunction
}
TexelFunction "Fuzz Jagged"

View file

@ -1,7 +1,7 @@
uniform sampler2D BrightmapTexture;
vec4 ProcessLight(vec4 color)
vec4 ProcessLight(vec2 coord, vec4 color)
{
vec4 brightpix = desaturate(texture(BrightmapTexture, vTexCoord.st));
vec4 brightpix = desaturate(texture(BrightmapTexture, coord));
return vec4(min (color.rgb + brightpix.rgb, 1.0), color.a);
}

View file

@ -1,5 +1,5 @@
vec4 ProcessLight(vec4 color)
vec4 ProcessLight(vec2 coord, vec4 color)
{
return color;
}

View file

@ -1,9 +1,7 @@
//created by Evil Space Tomato
vec4 ProcessTexel()
vec4 ProcessTexel(vec2 texCoord)
{
vec2 texCoord = vTexCoord.st;
vec2 texSplat;
const float pi = 3.14159265358979323846;
texSplat.x = texCoord.x + mod(sin(pi * 2.0 * (texCoord.y + uTimer * 2.0)),0.1) * 0.1;

View file

@ -1,8 +1,7 @@
//created by Evil Space Tomato
vec4 ProcessTexel()
vec4 ProcessTexel(vec2 texCoord)
{
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
texCoord.x = float( int(texCoord.x * 128.0) ) / 128.0;

View file

@ -1,8 +1,7 @@
//created by Evil Space Tomato
vec4 ProcessTexel()
vec4 ProcessTexel(vec2 texCoord)
{
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
float texX = texCoord.x / 3.0 + 0.66;

View file

@ -1,8 +1,7 @@
//created by Evil Space Tomato
vec4 ProcessTexel()
vec4 ProcessTexel(vec2 texCoord)
{
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
float texX = sin(mod(texCoord.x * 100.0 + uTimer*5.0, 3.489)) + texCoord.x / 4.0;

View file

@ -1,8 +1,7 @@
//created by Evil Space Tomato
vec4 ProcessTexel()
vec4 ProcessTexel(vec2 texCoord)
{
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
float texX = sin(texCoord.x * 100.0 + uTimer*5.0);

View file

@ -1,8 +1,7 @@
//created by Evil Space Tomato
vec4 ProcessTexel()
vec4 ProcessTexel(vec2 texCoord)
{
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
texCoord.x = float( int(texCoord.x * 128.0) ) / 128.0;

View file

@ -1,8 +1,7 @@
//created by Evil Space Tomato
vec4 ProcessTexel()
vec4 ProcessTexel(vec2 texCoord)
{
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
float texX = sin(texCoord.x * 100.0 + uTimer*5.0);

View file

@ -21,9 +21,10 @@ out vec4 FragColor;
uniform sampler2D tex;
vec2 ProcessCoordinate();
vec4 Process(vec4 color);
vec4 ProcessTexel();
vec4 ProcessLight(vec4 color);
vec4 ProcessTexel(vec2 coord);
vec4 ProcessLight(vec2 coord, vec4 color);
//===========================================================================
@ -171,7 +172,7 @@ vec4 getLightColor(vec2 coord, float fogdist, float fogfactor)
color = min(color, 1.0);
//
// apply brightmaps (or other light manipulation by custom shaders.
// apply brightmaps (or other light manipulation by custom shaders.)
//
color = ProcessLight(coord, color);