summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/renderergl2/glsl/generic_fp.glsl33
-rw-r--r--src/renderergl2/glsl/generic_vp.glsl9
-rw-r--r--src/renderergl2/tr_glsl.c12
-rw-r--r--src/renderergl2/tr_local.h8
-rw-r--r--src/renderergl2/tr_shade.c12
-rw-r--r--src/renderergl2/tr_shader.c167
6 files changed, 3 insertions, 238 deletions
diff --git a/src/renderergl2/glsl/generic_fp.glsl b/src/renderergl2/glsl/generic_fp.glsl
index aefa33c3..50db0785 100644
--- a/src/renderergl2/glsl/generic_fp.glsl
+++ b/src/renderergl2/glsl/generic_fp.glsl
@@ -1,45 +1,12 @@
uniform sampler2D u_DiffuseMap;
-#if defined(USE_LIGHTMAP)
-uniform sampler2D u_LightMap;
-
-uniform int u_Texture1Env;
-#endif
-
varying vec2 var_DiffuseTex;
-#if defined(USE_LIGHTMAP)
-varying vec2 var_LightTex;
-#endif
-
varying vec4 var_Color;
void main()
{
vec4 color = texture2D(u_DiffuseMap, var_DiffuseTex);
-#if defined(USE_LIGHTMAP)
- vec4 color2 = texture2D(u_LightMap, var_LightTex);
- #if defined(RGBM_LIGHTMAP)
- color2.rgb *= color2.a;
- color2.a = 1.0;
- #endif
-
- if (u_Texture1Env == TEXENV_MODULATE)
- {
- color *= color2;
- }
- else if (u_Texture1Env == TEXENV_ADD)
- {
- color += color2;
- }
- else if (u_Texture1Env == TEXENV_REPLACE)
- {
- color = color2;
- }
-
- //color = color * (u_Texture1Env.xxxx + color2 * u_Texture1Env.z) + color2 * u_Texture1Env.y;
-#endif
-
gl_FragColor = color * var_Color;
}
diff --git a/src/renderergl2/glsl/generic_vp.glsl b/src/renderergl2/glsl/generic_vp.glsl
index 859b4363..bbe08e84 100644
--- a/src/renderergl2/glsl/generic_vp.glsl
+++ b/src/renderergl2/glsl/generic_vp.glsl
@@ -9,7 +9,7 @@ attribute vec3 attr_Normal2;
attribute vec4 attr_Color;
attribute vec4 attr_TexCoord0;
-#if defined(USE_LIGHTMAP) || defined(USE_TCGEN)
+#if defined(USE_TCGEN)
attribute vec4 attr_TexCoord1;
#endif
@@ -57,9 +57,6 @@ uniform float u_VertexLerp;
#endif
varying vec2 var_DiffuseTex;
-#if defined(USE_LIGHTMAP)
-varying vec2 var_LightTex;
-#endif
varying vec4 var_Color;
#if defined(USE_DEFORM_VERTEXES)
@@ -230,10 +227,6 @@ void main()
var_DiffuseTex = tex;
#endif
-#if defined(USE_LIGHTMAP)
- var_LightTex = attr_TexCoord1.st;
-#endif
-
#if defined(USE_RGBAGEN)
var_Color = CalcColor(position, normal);
#else
diff --git a/src/renderergl2/tr_glsl.c b/src/renderergl2/tr_glsl.c
index 757bab38..7dfea6a6 100644
--- a/src/renderergl2/tr_glsl.c
+++ b/src/renderergl2/tr_glsl.c
@@ -90,7 +90,6 @@ static uniformInfo_t uniformsInfo[] =
{ "u_DiffuseTexMatrix", GLSL_VEC4 },
{ "u_DiffuseTexOffTurb", GLSL_VEC4 },
- { "u_Texture1Env", GLSL_INT },
{ "u_TCGen0", GLSL_INT },
{ "u_TCGen0Vector0", GLSL_VEC3 },
@@ -919,12 +918,6 @@ void GLSL_InitGPUShaders(void)
if (i & GENERICDEF_USE_RGBAGEN)
Q_strcat(extradefines, 1024, "#define USE_RGBAGEN\n");
- if (i & GENERICDEF_USE_LIGHTMAP)
- Q_strcat(extradefines, 1024, "#define USE_LIGHTMAP\n");
-
- if (r_hdr->integer && !glRefConfig.floatLightmap)
- Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n");
-
if (!GLSL_InitGPUShader(&tr.genericShader[i], "generic", attribs, qtrue, extradefines, qtrue, fallbackShader_generic_vp, fallbackShader_generic_fp))
{
ri.Error(ERR_FATAL, "Could not load generic shader!");
@@ -1495,11 +1488,6 @@ shaderProgram_t *GLSL_GetGenericShaderProgram(int stage)
shaderAttribs |= GENERICDEF_USE_FOG;
}
- if (pStage->bundle[1].image[0] && tess.shader->multitextureEnv)
- {
- shaderAttribs |= GENERICDEF_USE_LIGHTMAP;
- }
-
switch (pStage->rgbGen)
{
case CGEN_LIGHTING_DIFFUSE:
diff --git a/src/renderergl2/tr_local.h b/src/renderergl2/tr_local.h
index 2bb9e618..9e76404c 100644
--- a/src/renderergl2/tr_local.h
+++ b/src/renderergl2/tr_local.h
@@ -452,8 +452,6 @@ typedef struct shader_s {
float portalRange; // distance to fog out at
qboolean isPortal;
- int multitextureEnv; // 0, GL_MODULATE, GL_ADD (FIXME: put in stage)
-
cullType_t cullType; // CT_FRONT_SIDED, CT_BACK_SIDED, or CT_TWO_SIDED
qboolean polygonOffset; // set for decals and other items that must be offset
qboolean noMipMaps; // for console fonts, 2D elements, etc.
@@ -564,9 +562,8 @@ enum
GENERICDEF_USE_VERTEX_ANIMATION = 0x0004,
GENERICDEF_USE_FOG = 0x0008,
GENERICDEF_USE_RGBAGEN = 0x0010,
- GENERICDEF_USE_LIGHTMAP = 0x0020,
- GENERICDEF_ALL = 0x003F,
- GENERICDEF_COUNT = 0x0040,
+ GENERICDEF_ALL = 0x001F,
+ GENERICDEF_COUNT = 0x0020,
};
enum
@@ -638,7 +635,6 @@ typedef enum
UNIFORM_DIFFUSETEXMATRIX,
UNIFORM_DIFFUSETEXOFFTURB,
- UNIFORM_TEXTURE1ENV,
UNIFORM_TCGEN0,
UNIFORM_TCGEN0VECTOR0,
diff --git a/src/renderergl2/tr_shade.c b/src/renderergl2/tr_shade.c
index f5778ea0..da293cb8 100644
--- a/src/renderergl2/tr_shade.c
+++ b/src/renderergl2/tr_shade.c
@@ -1352,16 +1352,6 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
else if ( pStage->bundle[1].image[0] != 0 )
{
R_BindAnimatedImageToTMU( &pStage->bundle[0], 0 );
-
- //
- // lightmap/secondary pass
- //
- if ( r_lightmap->integer ) {
- GLSL_SetUniformInt(sp, UNIFORM_TEXTURE1ENV, GL_REPLACE);
- } else {
- GLSL_SetUniformInt(sp, UNIFORM_TEXTURE1ENV, tess.shader->multitextureEnv);
- }
-
R_BindAnimatedImageToTMU( &pStage->bundle[1], 1 );
}
else
@@ -1370,8 +1360,6 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
// set state
//
R_BindAnimatedImageToTMU( &pStage->bundle[0], 0 );
-
- GLSL_SetUniformInt(sp, UNIFORM_TEXTURE1ENV, 0);
}
//
diff --git a/src/renderergl2/tr_shader.c b/src/renderergl2/tr_shader.c
index 689df052..a4b31484 100644
--- a/src/renderergl2/tr_shader.c
+++ b/src/renderergl2/tr_shader.c
@@ -2123,161 +2123,6 @@ static void ComputeVertexAttribs(void)
}
}
-typedef struct {
- int blendA;
- int blendB;
-
- int multitextureEnv;
- int multitextureBlend;
-} collapse_t;
-
-static collapse_t collapse[] = {
- { 0, GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO,
- GL_MODULATE, 0 },
-
- { 0, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR,
- GL_MODULATE, 0 },
-
- { GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR,
- GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
- { GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR,
- GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
- { GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR, GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO,
- GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
- { GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO, GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO,
- GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
- { 0, GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE,
- GL_ADD, 0 },
-
- { GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE, GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE,
- GL_ADD, GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE },
-#if 0
- { 0, GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA | GLS_SRCBLEND_SRC_ALPHA,
- GL_DECAL, 0 },
-#endif
- { -1 }
-};
-
-/*
-================
-CollapseMultitexture
-
-Attempt to combine two stages into a single multitexture stage
-FIXME: I think modulated add + modulated add collapses incorrectly
-=================
-*/
-static qboolean CollapseMultitexture( void ) {
- int abits, bbits;
- int i;
- textureBundle_t tmpBundle;
-
- if ( !qglActiveTextureARB ) {
- return qfalse;
- }
-
- // make sure both stages are active
- if ( !stages[0].active || !stages[1].active ) {
- return qfalse;
- }
-
- // on voodoo2, don't combine different tmus
- if ( glConfig.driverType == GLDRV_VOODOO ) {
- if ( stages[0].bundle[0].image[0]->TMU ==
- stages[1].bundle[0].image[0]->TMU ) {
- return qfalse;
- }
- }
-
- abits = stages[0].stateBits;
- bbits = stages[1].stateBits;
-
- // make sure that both stages have identical state other than blend modes
- if ( ( abits & ~( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS | GLS_DEPTHMASK_TRUE ) ) !=
- ( bbits & ~( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS | GLS_DEPTHMASK_TRUE ) ) ) {
- return qfalse;
- }
-
- abits &= ( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
- bbits &= ( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
-
- // search for a valid multitexture blend function
- for ( i = 0; collapse[i].blendA != -1 ; i++ ) {
- if ( abits == collapse[i].blendA
- && bbits == collapse[i].blendB ) {
- break;
- }
- }
-
- // nothing found
- if ( collapse[i].blendA == -1 ) {
- return qfalse;
- }
-
- // GL_ADD is a separate extension
- if ( collapse[i].multitextureEnv == GL_ADD && !glConfig.textureEnvAddAvailable ) {
- return qfalse;
- }
-
- // make sure waveforms have identical parameters
- if ( ( stages[0].rgbGen != stages[1].rgbGen ) ||
- ( stages[0].alphaGen != stages[1].alphaGen ) ) {
- return qfalse;
- }
-
- // an add collapse can only have identity colors
- if ( collapse[i].multitextureEnv == GL_ADD && stages[0].rgbGen != CGEN_IDENTITY ) {
- return qfalse;
- }
-
- if ( stages[0].rgbGen == CGEN_WAVEFORM )
- {
- if ( memcmp( &stages[0].rgbWave,
- &stages[1].rgbWave,
- sizeof( stages[0].rgbWave ) ) )
- {
- return qfalse;
- }
- }
- if ( stages[0].alphaGen == AGEN_WAVEFORM )
- {
- if ( memcmp( &stages[0].alphaWave,
- &stages[1].alphaWave,
- sizeof( stages[0].alphaWave ) ) )
- {
- return qfalse;
- }
- }
-
-
- // make sure that lightmaps are in bundle 1 for 3dfx
- if ( stages[0].bundle[0].isLightmap )
- {
- tmpBundle = stages[0].bundle[0];
- stages[0].bundle[0] = stages[1].bundle[0];
- stages[0].bundle[1] = tmpBundle;
- }
- else
- {
- stages[0].bundle[1] = stages[1].bundle[0];
- }
-
- // set the new blend state bits
- shader.multitextureEnv = collapse[i].multitextureEnv;
- stages[0].stateBits &= ~( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
- stages[0].stateBits |= collapse[i].multitextureBlend;
-
- //
- // move down subsequent shaders
- //
- memmove( &stages[1], &stages[2], sizeof( stages[0] ) * ( MAX_SHADER_STAGES - 2 ) );
- Com_Memset( &stages[MAX_SHADER_STAGES-1], 0, sizeof( stages[0] ) );
-
- return qtrue;
-}
static void CollapseStagesToLightall(shaderStage_t *diffuse,
shaderStage_t *normal, shaderStage_t *specular, shaderStage_t *lightmap,
@@ -2608,9 +2453,6 @@ static int CollapseStagesToGLSL(void)
numStages++;
}
- if (numStages == i && i >= 2 && CollapseMultitexture())
- numStages--;
-
// convert any remaining lightmap stages to a lighting pass with a white texture
// only do this with r_sunlightMode non-zero, as it's only for correct shadows.
if (r_sunlightMode->integer && shader.numDeforms == 0)
@@ -3648,15 +3490,6 @@ void R_ShaderList_f (void) {
} else {
ri.Printf (PRINT_ALL, " ");
}
- if ( shader->multitextureEnv == GL_ADD ) {
- ri.Printf( PRINT_ALL, "MT(a) " );
- } else if ( shader->multitextureEnv == GL_MODULATE ) {
- ri.Printf( PRINT_ALL, "MT(m) " );
- } else if ( shader->multitextureEnv == GL_DECAL ) {
- ri.Printf( PRINT_ALL, "MT(d) " );
- } else {
- ri.Printf( PRINT_ALL, " " );
- }
if ( shader->explicitlyDefined ) {
ri.Printf( PRINT_ALL, "E " );
} else {