summaryrefslogtreecommitdiff
path: root/src/renderergl2/tr_shader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderergl2/tr_shader.c')
-rw-r--r--src/renderergl2/tr_shader.c50
1 files changed, 18 insertions, 32 deletions
diff --git a/src/renderergl2/tr_shader.c b/src/renderergl2/tr_shader.c
index 5057b436..36e159b4 100644
--- a/src/renderergl2/tr_shader.c
+++ b/src/renderergl2/tr_shader.c
@@ -1110,10 +1110,6 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
shader.portalRange = atof( token );
}
}
- else if ( !Q_stricmp( token, "fresnel" ) )
- {
- stage->alphaGen = AGEN_FRESNEL;
- }
else
{
ri.Printf( PRINT_WARNING, "WARNING: unknown alphaGen parameter '%s' in shader '%s'\n", token, shader.name );
@@ -2012,7 +2008,6 @@ static void ComputeVertexAttribs(void)
switch(pStage->alphaGen)
{
case AGEN_LIGHTING_SPECULAR:
- case AGEN_FRESNEL:
shader.vertexAttribs |= ATTR_NORMAL;
break;
@@ -2248,15 +2243,6 @@ static void CollapseStagesToLightall(shaderStage_t *diffuse,
defs |= LIGHTDEF_USE_PARALLAXMAP;
}
}
-
- if (!diffuse->bundle[TB_NORMALMAP].image[0])
- {
- // use 0x80 image, shader will interpret as (0,0,1)
- diffuse->bundle[TB_NORMALMAP] = diffuse->bundle[0];
- diffuse->bundle[TB_NORMALMAP].numImageAnimations = 0;
- diffuse->bundle[TB_NORMALMAP].image[0] = tr.greyImage;
- //ri.Printf(PRINT_ALL, ", normalmap %s", diffuse->bundle[TB_NORMALMAP].image[0]->imgName);
- }
}
if (r_specularMapping->integer)
@@ -2268,18 +2254,6 @@ static void CollapseStagesToLightall(shaderStage_t *diffuse,
diffuse->materialInfo[0] = specular->materialInfo[0];
diffuse->materialInfo[1] = specular->materialInfo[1];
}
- else if (lightmap || useLightVector || useLightVertex)
- {
- // use a white image, materialinfo will do the rest
- diffuse->bundle[TB_SPECULARMAP] = diffuse->bundle[0];
- diffuse->bundle[TB_SPECULARMAP].numImageAnimations = 0;
- diffuse->bundle[TB_SPECULARMAP].image[0] = tr.whiteImage;
- if (!diffuse->materialInfo[0])
- diffuse->materialInfo[0] = r_baseSpecular->value;
- if (!diffuse->materialInfo[1])
- diffuse->materialInfo[1] = r_baseGloss->value;
- //ri.Printf(PRINT_ALL, ", specularmap %s", diffuse->bundle[TB_SPECULARMAP].image[0]->imgName);
- }
}
if (tcgen || diffuse->bundle[0].numTexMods)
@@ -2373,7 +2347,6 @@ static qboolean CollapseStagesToGLSL(void)
{
case AGEN_LIGHTING_SPECULAR:
case AGEN_PORTAL:
- case AGEN_FRESNEL:
skip = qtrue;
break;
default:
@@ -2582,7 +2555,7 @@ static qboolean CollapseStagesToGLSL(void)
}
}
- // convert any remaining lightingdiffuse stages to a lighting pass
+ // insert default normal and specular textures if necessary
for (i = 0; i < MAX_SHADER_STAGES; i++)
{
shaderStage_t *pStage = &stages[i];
@@ -2590,13 +2563,26 @@ static qboolean CollapseStagesToGLSL(void)
if (!pStage->active)
continue;
- if (pStage->rgbGen == CGEN_LIGHTING_DIFFUSE)
+ if (pStage->glslShaderGroup != tr.lightallShader)
+ continue;
+
+ if ((pStage->glslShaderIndex & LIGHTDEF_LIGHTTYPE_MASK) == 0)
+ continue;
+
+ if (!pStage->bundle[TB_NORMALMAP].image[0] && r_normalMapping->integer)
{
- pStage->glslShaderGroup = tr.lightallShader;
- pStage->glslShaderIndex = LIGHTDEF_USE_LIGHT_VECTOR;
+ pStage->bundle[TB_NORMALMAP].image[0] = tr.greyImage;
}
- }
+ if (!pStage->bundle[TB_SPECULARMAP].image[0] && r_specularMapping->integer)
+ {
+ pStage->bundle[TB_SPECULARMAP].image[0] = tr.whiteImage;
+ if (!pStage->materialInfo[0])
+ pStage->materialInfo[0] = r_baseSpecular->value;
+ if (!pStage->materialInfo[1])
+ pStage->materialInfo[1] = r_baseGloss->value;
+ }
+ }
return numStages;
}