fixed incorrect state bits for shaders when loading a map with no lighting

This commit is contained in:
myT 2019-09-25 05:35:45 +02:00
parent 0087c2bf14
commit 7939488266
4 changed files with 10 additions and 1 deletions

View file

@ -107,6 +107,8 @@ chg: r_fullbright is now latched again
chg: negative r_swapInterval values will request adaptive v-sync when using an OpenGL back-end
fix: incorrect shader state when loading a map with no lighting
fix: fog-only non-sky shaders were incorrectly handled as sky shaders, which broke fog on many maps
fix: r_monitor on Linux is now 0-based and the value doesn't change incorrectly on its own anymore

View file

@ -226,6 +226,8 @@ static void R_GetLightmapTransform( int* number, vec2_t scale, vec2_t bias )
scale[1] = 1.0f;
bias[0] = 0.0f;
bias[1] = 0.0f;
if ( *number <= LIGHTMAP_2D || *number >= tr.numLightmaps )
*number = LIGHTMAP_BROKEN;
}
}

View file

@ -328,6 +328,7 @@ typedef struct {
} shaderStage_t;
#define LIGHTMAP_BROKEN -4 // invalid data in the .bsp file
#define LIGHTMAP_2D -3 // shader is for 2D rendering
#define LIGHTMAP_BY_VERTEX -2 // pre-lit triangle models
#define LIGHTMAP_NONE -1

View file

@ -2351,7 +2351,11 @@ shader_t* R_FindShader( const char *name, int lightmapIndex, qbool mipRawImage )
stages[0].type = ST_DIFFUSE;
stages[0].bundle.image[0] = image;
if ( shader.lightmapIndex == LIGHTMAP_NONE ) {
if ( shader.lightmapIndex == LIGHTMAP_BROKEN ) {
stages[0].rgbGen = CGEN_VERTEX;
stages[0].alphaGen = AGEN_VERTEX;
stages[0].stateBits = GLS_DEFAULT;
} else if ( shader.lightmapIndex == LIGHTMAP_NONE ) {
// dynamic colors at vertexes
stages[0].rgbGen = CGEN_LIGHTING_DIFFUSE;
stages[0].stateBits = GLS_DEFAULT;