mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-14 00:41:03 +00:00
GL1 multitexture combine removed
Applied too many OpenGL calls for an effect that could not be told apart from normal GL_MODULATE; explains its absence from Q3A code. Also, removed calls to glPixelStorei when no dynamic lights present.
This commit is contained in:
parent
c68ffec274
commit
6869d7dddd
5 changed files with 16 additions and 73 deletions
|
@ -234,47 +234,14 @@ R_EnableMultitexture(qboolean enable)
|
||||||
{
|
{
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
if (gl_config.mtexcombine)
|
if (gl_lightmap->value)
|
||||||
{
|
{
|
||||||
R_TexEnv(GL_COMBINE);
|
R_TexEnv(GL_REPLACE);
|
||||||
|
|
||||||
if (gl_lightmap->value)
|
|
||||||
{
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PREVIOUS);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SelectTexture(GL_TEXTURE0);
|
|
||||||
R_TexEnv(GL_COMBINE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gl_lightmap->value)
|
R_TexEnv(GL_MODULATE);
|
||||||
{
|
|
||||||
R_TexEnv(GL_REPLACE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
R_TexEnv(GL_MODULATE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else // disable multitexturing
|
else // disable multitexturing
|
||||||
{
|
{
|
||||||
|
|
|
@ -1220,7 +1220,7 @@ R_Register(void)
|
||||||
|
|
||||||
gl1_palettedtexture = ri.Cvar_Get("r_palettedtextures", "0", CVAR_ARCHIVE);
|
gl1_palettedtexture = ri.Cvar_Get("r_palettedtextures", "0", CVAR_ARCHIVE);
|
||||||
gl1_pointparameters = ri.Cvar_Get("gl1_pointparameters", "1", CVAR_ARCHIVE);
|
gl1_pointparameters = ri.Cvar_Get("gl1_pointparameters", "1", CVAR_ARCHIVE);
|
||||||
gl1_multitexture = ri.Cvar_Get("gl1_multitexture", "2", CVAR_ARCHIVE);
|
gl1_multitexture = ri.Cvar_Get("gl1_multitexture", "1", CVAR_ARCHIVE);
|
||||||
gl1_biglightmaps = ri.Cvar_Get("gl1_biglightmaps", "1", CVAR_ARCHIVE);
|
gl1_biglightmaps = ri.Cvar_Get("gl1_biglightmaps", "1", CVAR_ARCHIVE);
|
||||||
|
|
||||||
gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0);
|
gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0);
|
||||||
|
@ -1586,7 +1586,7 @@ RI_Init(void)
|
||||||
// ----
|
// ----
|
||||||
|
|
||||||
/* Multitexturing */
|
/* Multitexturing */
|
||||||
gl_config.multitexture = gl_config.mtexcombine = false;
|
gl_config.multitexture = false;
|
||||||
|
|
||||||
R_Printf(PRINT_ALL, " - Multitexturing: ");
|
R_Printf(PRINT_ALL, " - Multitexturing: ");
|
||||||
|
|
||||||
|
@ -1621,29 +1621,6 @@ RI_Init(void)
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
|
|
||||||
/* Multi texturing combine */
|
|
||||||
R_Printf(PRINT_ALL, " - Multitexturing combine: ");
|
|
||||||
|
|
||||||
if ( ( strstr(gl_config.extensions_string, "GL_ARB_texture_env_combine")
|
|
||||||
|| strstr(gl_config.extensions_string, "GL_EXT_texture_env_combine") ) )
|
|
||||||
{
|
|
||||||
if (gl_config.multitexture && gl1_multitexture->value > 1)
|
|
||||||
{
|
|
||||||
gl_config.mtexcombine = true;
|
|
||||||
R_Printf(PRINT_ALL, "Okay\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
R_Printf(PRINT_ALL, "Disabled\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
R_Printf(PRINT_ALL, "Failed\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----
|
|
||||||
|
|
||||||
/* Big lightmaps */
|
/* Big lightmaps */
|
||||||
R_Printf(PRINT_ALL, " - Big lightmaps: ");
|
R_Printf(PRINT_ALL, " - Big lightmaps: ");
|
||||||
|
|
||||||
|
|
|
@ -746,7 +746,7 @@ static void
|
||||||
R_RegenAllLightmaps()
|
R_RegenAllLightmaps()
|
||||||
{
|
{
|
||||||
int i, map, smax, tmax, top, bottom, left, right, bt, bb, bl, br;
|
int i, map, smax, tmax, top, bottom, left, right, bt, bb, bl, br;
|
||||||
qboolean affected_lightmap;
|
qboolean affected_lightmap, pixelstore_set = false;
|
||||||
msurface_t *surf;
|
msurface_t *surf;
|
||||||
byte *base;
|
byte *base;
|
||||||
|
|
||||||
|
@ -755,8 +755,6 @@ R_RegenAllLightmaps()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, gl_state.block_width);
|
|
||||||
|
|
||||||
for (i = 1; i < gl_state.max_lightmaps; i++)
|
for (i = 1; i < gl_state.max_lightmaps; i++)
|
||||||
{
|
{
|
||||||
if (!gl_lms.lightmap_surfaces[i] || !gl_lms.lightmap_buffer[i])
|
if (!gl_lms.lightmap_surfaces[i] || !gl_lms.lightmap_buffer[i])
|
||||||
|
@ -816,6 +814,12 @@ R_RegenAllLightmaps()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pixelstore_set)
|
||||||
|
{
|
||||||
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, gl_state.block_width);
|
||||||
|
pixelstore_set = true;
|
||||||
|
}
|
||||||
|
|
||||||
base = gl_lms.lightmap_buffer[i];
|
base = gl_lms.lightmap_buffer[i];
|
||||||
base += (bt * gl_state.block_width + bl) * LIGHTMAP_BYTES;
|
base += (bt * gl_state.block_width + bl) * LIGHTMAP_BYTES;
|
||||||
|
|
||||||
|
@ -825,7 +829,10 @@ R_RegenAllLightmaps()
|
||||||
GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, base);
|
GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
if (pixelstore_set)
|
||||||
|
{
|
||||||
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -365,7 +365,6 @@ typedef struct
|
||||||
qboolean palettedtexture;
|
qboolean palettedtexture;
|
||||||
qboolean pointparameters;
|
qboolean pointparameters;
|
||||||
qboolean multitexture;
|
qboolean multitexture;
|
||||||
qboolean mtexcombine;
|
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
|
|
||||||
|
|
|
@ -57,14 +57,7 @@
|
||||||
#define GL_TEXTURE1 0x84C1
|
#define GL_TEXTURE1 0x84C1
|
||||||
#define GL_MULTISAMPLE 0x809D
|
#define GL_MULTISAMPLE 0x809D
|
||||||
#define GL_COMBINE 0x8570
|
#define GL_COMBINE 0x8570
|
||||||
#define GL_COMBINE_RGB 0x8571
|
|
||||||
#define GL_COMBINE_ALPHA 0x8572
|
|
||||||
#define GL_SOURCE0_RGB 0x8580
|
|
||||||
#define GL_SOURCE1_RGB 0x8581
|
|
||||||
#define GL_SOURCE0_ALPHA 0x8588
|
|
||||||
#define GL_SOURCE1_ALPHA 0x8589
|
|
||||||
#define GL_RGB_SCALE 0x8573
|
#define GL_RGB_SCALE 0x8573
|
||||||
#define GL_PREVIOUS 0x8578
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GL_EXT_shared_texture_palette
|
#ifndef GL_EXT_shared_texture_palette
|
||||||
|
|
Loading…
Reference in a new issue