mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-03-02 07:32:08 +00:00
fixed r_lightmap affecting non-opaque surfaces
This commit is contained in:
parent
9366ee5130
commit
f36392c128
1 changed files with 12 additions and 2 deletions
|
@ -2128,10 +2128,20 @@ static shader_t* FinishShader()
|
|||
stages[i].bundle.image[0] = tr.whiteImage;
|
||||
}
|
||||
}
|
||||
} else if ( r_lightmap->integer ) {
|
||||
} else if (
|
||||
r_lightmap->integer &&
|
||||
( shader.contentFlags & CONTENTS_TRANSLUCENT ) == 0 &&
|
||||
shader.sort <= SS_OPAQUE ) {
|
||||
// we reduce it down to a single lightmap stage with the same state bits as
|
||||
// the current first stage (if the shader uses a lightmap at all)
|
||||
|
||||
// @NOTE: we ignore all surfaces that aren't fully opaque because:
|
||||
// a) it's hard to know what level of uniform opacity would emulate the original look best
|
||||
// b) alpha-tested surfaces that have been turned into alpha-blended ones can't just use any given sort key:
|
||||
// you can always find or design a case that won't work correctly
|
||||
// for decals entirely pressed against opaque surfaces, we could use a keyword ("polygonoffset" or something new)
|
||||
// to know that we should not draw them at all, but we just shouldn't trust level designers
|
||||
|
||||
// look for "real" lightmaps first (straight from the .bsp file itself)
|
||||
int stageIndex = -1;
|
||||
for ( int i = 0; i < shader.numStages; ++i ) {
|
||||
|
|
Loading…
Reference in a new issue