mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 20:51:31 +00:00
Entferne spezielle Lightmaps für 90er Jahre Grafikkarten
This commit is contained in:
parent
fdae318fba
commit
4d0c89c728
5 changed files with 59 additions and 238 deletions
|
@ -478,7 +478,6 @@ R_BuildLightMap ( msurface_t *surf, byte *dest, int stride )
|
|||
int nummaps;
|
||||
float *bl;
|
||||
lightstyle_t *style;
|
||||
int monolightmap;
|
||||
|
||||
if ( surf->texinfo->flags & ( SURF_SKY | SURF_TRANS33 | SURF_TRANS66 | SURF_WARP ) )
|
||||
{
|
||||
|
@ -612,165 +611,69 @@ store:
|
|||
stride -= ( smax << 2 );
|
||||
bl = s_blocklights;
|
||||
|
||||
monolightmap = gl_monolightmap->string [ 0 ];
|
||||
|
||||
if ( monolightmap == '0' )
|
||||
for ( i = 0; i < tmax; i++, dest += stride )
|
||||
{
|
||||
for ( i = 0; i < tmax; i++, dest += stride )
|
||||
for ( j = 0; j < smax; j++ )
|
||||
{
|
||||
for ( j = 0; j < smax; j++ )
|
||||
r = Q_ftol( bl [ 0 ] );
|
||||
g = Q_ftol( bl [ 1 ] );
|
||||
b = Q_ftol( bl [ 2 ] );
|
||||
|
||||
/* catch negative lights */
|
||||
if ( r < 0 )
|
||||
{
|
||||
r = Q_ftol( bl [ 0 ] );
|
||||
g = Q_ftol( bl [ 1 ] );
|
||||
b = Q_ftol( bl [ 2 ] );
|
||||
|
||||
/* catch negative lights */
|
||||
if ( r < 0 )
|
||||
{
|
||||
r = 0;
|
||||
}
|
||||
|
||||
if ( g < 0 )
|
||||
{
|
||||
g = 0;
|
||||
}
|
||||
|
||||
if ( b < 0 )
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
|
||||
/* determine the brightest of the three color components */
|
||||
if ( r > g )
|
||||
{
|
||||
max = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
max = g;
|
||||
}
|
||||
|
||||
if ( b > max )
|
||||
{
|
||||
max = b;
|
||||
}
|
||||
|
||||
/* alpha is ONLY used for the mono lightmap case. For this reason
|
||||
we set it to the brightest of the color components so that
|
||||
things don't get too dim. */
|
||||
a = max;
|
||||
|
||||
/* rescale all the color components if the intensity of the greatest
|
||||
channel exceeds 1.0 */
|
||||
if ( max > 255 )
|
||||
{
|
||||
float t = 255.0F / max;
|
||||
|
||||
r = r * t;
|
||||
g = g * t;
|
||||
b = b * t;
|
||||
a = a * t;
|
||||
}
|
||||
|
||||
dest [ 0 ] = r;
|
||||
dest [ 1 ] = g;
|
||||
dest [ 2 ] = b;
|
||||
dest [ 3 ] = a;
|
||||
|
||||
bl += 3;
|
||||
dest += 4;
|
||||
r = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( i = 0; i < tmax; i++, dest += stride )
|
||||
{
|
||||
for ( j = 0; j < smax; j++ )
|
||||
|
||||
if ( g < 0 )
|
||||
{
|
||||
r = Q_ftol( bl [ 0 ] );
|
||||
g = Q_ftol( bl [ 1 ] );
|
||||
b = Q_ftol( bl [ 2 ] );
|
||||
|
||||
/* catch negative lights */
|
||||
if ( r < 0 )
|
||||
{
|
||||
r = 0;
|
||||
}
|
||||
|
||||
if ( g < 0 )
|
||||
{
|
||||
g = 0;
|
||||
}
|
||||
|
||||
if ( b < 0 )
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
|
||||
/* determine the brightest of the three color components */
|
||||
if ( r > g )
|
||||
{
|
||||
max = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
max = g;
|
||||
}
|
||||
|
||||
if ( b > max )
|
||||
{
|
||||
max = b;
|
||||
}
|
||||
|
||||
/* alpha is ONLY used for the mono lightmap case. For this reason
|
||||
we set it to the brightest of the color components so that
|
||||
things don't get too dim. */
|
||||
a = max;
|
||||
|
||||
/* rescale all the color components if the intensity of the greatest
|
||||
channel exceeds 1.0 */
|
||||
if ( max > 255 )
|
||||
{
|
||||
float t = 255.0F / max;
|
||||
|
||||
r = r * t;
|
||||
g = g * t;
|
||||
b = b * t;
|
||||
a = a * t;
|
||||
}
|
||||
|
||||
/* So if we are doing alpha lightmaps we need to set the R, G, and B
|
||||
components to 0 and we need to set alpha to 1-alpha. */
|
||||
switch ( monolightmap )
|
||||
{
|
||||
case 'L':
|
||||
case 'I':
|
||||
r = a;
|
||||
g = b = 0;
|
||||
break;
|
||||
case 'C':
|
||||
/* try faking colored lighting */
|
||||
a = 255 - ( ( r + g + b ) / 3 );
|
||||
r *= a / 255.0;
|
||||
g *= a / 255.0;
|
||||
b *= a / 255.0;
|
||||
break;
|
||||
case 'A':
|
||||
default:
|
||||
r = g = b = 0;
|
||||
a = 255 - a;
|
||||
break;
|
||||
}
|
||||
|
||||
dest [ 0 ] = r;
|
||||
dest [ 1 ] = g;
|
||||
dest [ 2 ] = b;
|
||||
dest [ 3 ] = a;
|
||||
|
||||
bl += 3;
|
||||
dest += 4;
|
||||
g = 0;
|
||||
}
|
||||
|
||||
if ( b < 0 )
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
|
||||
/* determine the brightest of the three color components */
|
||||
if ( r > g )
|
||||
{
|
||||
max = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
max = g;
|
||||
}
|
||||
|
||||
if ( b > max )
|
||||
{
|
||||
max = b;
|
||||
}
|
||||
|
||||
/* alpha is ONLY used for the mono lightmap case. For this reason
|
||||
we set it to the brightest of the color components so that
|
||||
things don't get too dim. */
|
||||
a = max;
|
||||
|
||||
/* rescale all the color components if the intensity of the greatest
|
||||
channel exceeds 1.0 */
|
||||
if ( max > 255 )
|
||||
{
|
||||
float t = 255.0F / max;
|
||||
|
||||
r = r * t;
|
||||
g = g * t;
|
||||
b = b * t;
|
||||
a = a * t;
|
||||
}
|
||||
|
||||
dest [ 0 ] = r;
|
||||
dest [ 1 ] = g;
|
||||
dest [ 2 ] = b;
|
||||
dest [ 3 ] = a;
|
||||
|
||||
bl += 3;
|
||||
dest += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -620,25 +620,6 @@ R_DrawAliasModel ( entity_t *e )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( gl_monolightmap->string [ 0 ] != '0' )
|
||||
{
|
||||
float s = shadelight [ 0 ];
|
||||
|
||||
if ( s < shadelight [ 1 ] )
|
||||
{
|
||||
s = shadelight [ 1 ];
|
||||
}
|
||||
|
||||
if ( s < shadelight [ 2 ] )
|
||||
{
|
||||
s = shadelight [ 2 ];
|
||||
}
|
||||
|
||||
shadelight [ 0 ] = s;
|
||||
shadelight [ 1 ] = s;
|
||||
shadelight [ 2 ] = s;
|
||||
}
|
||||
}
|
||||
|
||||
if ( currententity->flags & RF_MINLIGHT )
|
||||
|
|
|
@ -124,7 +124,6 @@ cvar_t *gl_customwidth;
|
|||
cvar_t *gl_customheight;
|
||||
|
||||
cvar_t *gl_dynamic;
|
||||
cvar_t *gl_monolightmap;
|
||||
cvar_t *gl_modulate;
|
||||
cvar_t *gl_nobind;
|
||||
cvar_t *gl_round_down;
|
||||
|
@ -965,7 +964,6 @@ R_Register ( void )
|
|||
gl_polyblend = ri.Cvar_Get( "gl_polyblend", "1", 0 );
|
||||
gl_flashblend = ri.Cvar_Get( "gl_flashblend", "0", 0 );
|
||||
gl_playermip = ri.Cvar_Get( "gl_playermip", "0", 0 );
|
||||
gl_monolightmap = ri.Cvar_Get( "gl_monolightmap", "0", 0 );
|
||||
gl_driver = ri.Cvar_Get( "gl_driver", "libGL.so.1", CVAR_ARCHIVE );
|
||||
gl_texturemode = ri.Cvar_Get( "gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE );
|
||||
gl_texturealphamode = ri.Cvar_Get( "gl_texturealphamode", "default", CVAR_ARCHIVE );
|
||||
|
@ -1121,11 +1119,6 @@ R_Init ( void *hinstance, void *hWnd )
|
|||
vendor_buffer [ sizeof ( vendor_buffer ) - 1 ] = 0;
|
||||
strlwr( vendor_buffer );
|
||||
|
||||
if ( toupper( gl_monolightmap->string [ 1 ] ) != 'F' )
|
||||
{
|
||||
ri.Cvar_Set( "gl_monolightmap", "0" );
|
||||
}
|
||||
|
||||
ri.Cvar_Set( "scr_drawall", "0" );
|
||||
gl_config.allow_cds = true;
|
||||
|
||||
|
|
|
@ -254,26 +254,7 @@ R_BlendLightmaps ( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( gl_monolightmap->string [ 0 ] != '0' )
|
||||
{
|
||||
switch ( toupper( gl_monolightmap->string [ 0 ] ) )
|
||||
{
|
||||
case 'I':
|
||||
qglBlendFunc( GL_ZERO, GL_SRC_COLOR );
|
||||
break;
|
||||
case 'L':
|
||||
qglBlendFunc( GL_ZERO, GL_SRC_COLOR );
|
||||
break;
|
||||
case 'A':
|
||||
default:
|
||||
qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qglBlendFunc( GL_ZERO, GL_SRC_COLOR );
|
||||
}
|
||||
qglBlendFunc( GL_ZERO, GL_SRC_COLOR );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1225,43 +1206,7 @@ GL_BeginBuildingLightmaps ( model_t *m )
|
|||
}
|
||||
|
||||
gl_lms.current_lightmap_texture = 1;
|
||||
|
||||
/* if mono lightmaps are enabled and we want to use alpha
|
||||
** blending (a,1-a) then we're likely running on a 3DLabs
|
||||
** Permedia2. In a perfect world we'd use a GL_ALPHA lightmap
|
||||
** in order to conserve space and maximize bandwidth, however
|
||||
** this isn't a perfect world.
|
||||
**
|
||||
** So we have to use alpha lightmaps, but stored in GL_RGBA format,
|
||||
** which means we only get 1/16th the color resolution we should when
|
||||
** using alpha lightmaps. If we find another board that supports
|
||||
** only alpha lightmaps but that can at least support the GL_ALPHA
|
||||
** format then we should change this code to use real alpha maps.
|
||||
*/
|
||||
if ( toupper( gl_monolightmap->string [ 0 ] ) == 'A' )
|
||||
{
|
||||
gl_lms.internal_format = gl_tex_alpha_format;
|
||||
}
|
||||
|
||||
/*
|
||||
** try to do hacked colored lighting with a blended texture
|
||||
*/
|
||||
else if ( toupper( gl_monolightmap->string [ 0 ] ) == 'C' )
|
||||
{
|
||||
gl_lms.internal_format = gl_tex_alpha_format;
|
||||
}
|
||||
else if ( toupper( gl_monolightmap->string [ 0 ] ) == 'I' )
|
||||
{
|
||||
gl_lms.internal_format = GL_INTENSITY8;
|
||||
}
|
||||
else if ( toupper( gl_monolightmap->string [ 0 ] ) == 'L' )
|
||||
{
|
||||
gl_lms.internal_format = GL_LUMINANCE8;
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_lms.internal_format = gl_tex_solid_format;
|
||||
}
|
||||
gl_lms.internal_format = gl_tex_solid_format;
|
||||
|
||||
/* initialize the dynamic lightmap texture */
|
||||
GL_Bind( gl_state.lightmap_textures + 0 );
|
||||
|
|
|
@ -208,7 +208,6 @@ extern cvar_t *gl_lightmap;
|
|||
extern cvar_t *gl_shadows;
|
||||
extern cvar_t *gl_stencilshadow;
|
||||
extern cvar_t *gl_dynamic;
|
||||
extern cvar_t *gl_monolightmap;
|
||||
extern cvar_t *gl_nobind;
|
||||
extern cvar_t *gl_round_down;
|
||||
extern cvar_t *gl_picmip;
|
||||
|
|
Loading…
Reference in a new issue