aboutsummaryrefslogtreecommitdiffstats
path: root/code/renderer
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-04-06 16:29:22 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-04-06 16:29:22 +0000
commitd4db696130f0b585743777fdf6952e220d618326 (patch)
treee2beb5316e39ff9f4393d3736a01306f3c0d26b0 /code/renderer
parent9826eeddf3b87b7da83e0ef6c6a1e6d7784267e0 (diff)
downloadioquake3-aero-d4db696130f0b585743777fdf6952e220d618326.tar.gz
ioquake3-aero-d4db696130f0b585743777fdf6952e220d618326.zip
Handle detail textures correctly when r_detailedTextures is set to 0.
git-svn-id: svn://svn.icculus.org/quake3/trunk@1301 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/renderer')
-rw-r--r--code/renderer/tr_shader.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/code/renderer/tr_shader.c b/code/renderer/tr_shader.c
index dfbea62..a714873 100644
--- a/code/renderer/tr_shader.c
+++ b/code/renderer/tr_shader.c
@@ -2152,7 +2152,7 @@ static shader_t *FinishShader( void ) {
//
// set appropriate stage information
//
- for ( stage = 0; stage < MAX_SHADER_STAGES; stage++ ) {
+ for ( stage = 0; stage < MAX_SHADER_STAGES; ) {
shaderStage_t *pStage = &stages[stage];
if ( !pStage->active ) {
@@ -2163,17 +2163,33 @@ static shader_t *FinishShader( void ) {
if ( !pStage->bundle[0].image[0] ) {
ri.Printf( PRINT_WARNING, "Shader %s has a stage with no image\n", shader.name );
pStage->active = qfalse;
+ stage++;
continue;
}
//
// ditch this stage if it's detail and detail textures are disabled
//
- if ( pStage->isDetail && !r_detailTextures->integer ) {
- if ( stage < ( MAX_SHADER_STAGES - 1 ) ) {
- memmove( pStage, pStage + 1, sizeof( *pStage ) * ( MAX_SHADER_STAGES - stage - 1 ) );
- Com_Memset( pStage + 1, 0, sizeof( *pStage ) );
+ if ( pStage->isDetail && !r_detailTextures->integer )
+ {
+ int index;
+
+ for(index = stage + 1; index < MAX_SHADER_STAGES; index++)
+ {
+ if(!stages[index].active)
+ break;
+ }
+
+ if(index < MAX_SHADER_STAGES)
+ memmove(pStage, pStage + 1, sizeof(*pStage) * (index - stage));
+ else
+ {
+ if(stage + 1 < MAX_SHADER_STAGES)
+ memmove(pStage, pStage + 1, sizeof(*pStage) * (index - stage - 1));
+
+ Com_Memset(&stages[index - 1], 0, sizeof(*stages));
}
+
continue;
}
@@ -2242,6 +2258,8 @@ static shader_t *FinishShader( void ) {
}
}
}
+
+ stage++;
}
// there are times when you will need to manually apply a sort to