Change meaning of gl_lightmap_components a bit. Setting 4 changed to reduce texture memory waste by a bit. Really only an optimization for nvidia drivers anyways. This also should fix a quality issue in 16bpp with it set to 4.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-05-20 04:36:20 +00:00
parent cf2e098434
commit f7330f078e
2 changed files with 10 additions and 2 deletions

View File

@ -55,6 +55,7 @@ int skytexturenum;
extern vec3_t shadecolor; // Ender (Extend) Colormod extern vec3_t shadecolor; // Ender (Extend) Colormod
int gl_internalformat;
int lightmap_bytes; // 1, 3, or 4 int lightmap_bytes; // 1, 3, or 4
int lightmap_textures; int lightmap_textures;
@ -366,7 +367,7 @@ GL_UploadLightmap (int i, int x, int y, int w, int h)
GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE,
lightmaps[i] + (y * BLOCK_WIDTH) * lightmap_bytes); lightmaps[i] + (y * BLOCK_WIDTH) * lightmap_bytes);
*/ */
glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH, glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, BLOCK_WIDTH,
BLOCK_HEIGHT, 0, gl_lightmap_format, BLOCK_HEIGHT, 0, gl_lightmap_format,
GL_UNSIGNED_BYTE, lightmaps[i]); GL_UNSIGNED_BYTE, lightmaps[i]);
} }
@ -1154,15 +1155,18 @@ GL_BuildLightmaps (void)
switch (gl_lightmap_components->int_val) { switch (gl_lightmap_components->int_val) {
case 1: case 1:
gl_internalformat = 1;
gl_lightmap_format = GL_LUMINANCE; gl_lightmap_format = GL_LUMINANCE;
lightmap_bytes = 1; lightmap_bytes = 1;
break; break;
case 3: case 3:
gl_internalformat = 3;
gl_lightmap_format = GL_RGB; gl_lightmap_format = GL_RGB;
lightmap_bytes = 3; lightmap_bytes = 3;
break; break;
case 4: case 4:
default: default:
gl_internalformat = 3;
gl_lightmap_format = GL_RGBA; gl_lightmap_format = GL_RGBA;
lightmap_bytes = 4; lightmap_bytes = 4;
break; break;

View File

@ -55,6 +55,7 @@ int skytexturenum;
extern vec3_t shadecolor; // Ender (Extend) Colormod extern vec3_t shadecolor; // Ender (Extend) Colormod
int gl_internalformat;
int lightmap_bytes; // 1, 3, or 4 int lightmap_bytes; // 1, 3, or 4
int lightmap_textures; int lightmap_textures;
@ -366,7 +367,7 @@ GL_UploadLightmap (int i, int x, int y, int w, int h)
GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE,
lightmaps[i] + (y * BLOCK_WIDTH) * lightmap_bytes); lightmaps[i] + (y * BLOCK_WIDTH) * lightmap_bytes);
*/ */
glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH, glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, BLOCK_WIDTH,
BLOCK_HEIGHT, 0, gl_lightmap_format, BLOCK_HEIGHT, 0, gl_lightmap_format,
GL_UNSIGNED_BYTE, lightmaps[i]); GL_UNSIGNED_BYTE, lightmaps[i]);
} }
@ -1154,15 +1155,18 @@ GL_BuildLightmaps (void)
switch (gl_lightmap_components->int_val) { switch (gl_lightmap_components->int_val) {
case 1: case 1:
gl_internalformat = 1;
gl_lightmap_format = GL_LUMINANCE; gl_lightmap_format = GL_LUMINANCE;
lightmap_bytes = 1; lightmap_bytes = 1;
break; break;
case 3: case 3:
gl_internalformat = 3;
gl_lightmap_format = GL_RGB; gl_lightmap_format = GL_RGB;
lightmap_bytes = 3; lightmap_bytes = 3;
break; break;
case 4: case 4:
default: default:
gl_internalformat = 3;
gl_lightmap_format = GL_RGBA; gl_lightmap_format = GL_RGBA;
lightmap_bytes = 4; lightmap_bytes = 4;
break; break;