mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-01 05:30:58 +00:00
Füge Overbrightbits ein
This commit is contained in:
parent
40a91572e0
commit
95d7d43695
5 changed files with 185 additions and 7 deletions
|
@ -174,6 +174,7 @@ extern cvar_t *gl_nocull;
|
|||
extern cvar_t *gl_lerpmodels;
|
||||
|
||||
extern cvar_t *gl_lightlevel;
|
||||
extern cvar_t *gl_overbrightbits;
|
||||
|
||||
extern cvar_t *gl_vertex_arrays;
|
||||
|
||||
|
@ -182,6 +183,7 @@ extern cvar_t *gl_ext_palettedtexture;
|
|||
extern cvar_t *gl_ext_multitexture;
|
||||
extern cvar_t *gl_ext_pointparameters;
|
||||
extern cvar_t *gl_ext_compiled_vertex_array;
|
||||
extern cvar_t *gl_ext_mtexcombine;
|
||||
|
||||
extern cvar_t *gl_particle_min_size;
|
||||
extern cvar_t *gl_particle_max_size;
|
||||
|
@ -340,6 +342,7 @@ typedef struct
|
|||
const char *extensions_string;
|
||||
|
||||
qboolean allow_cds;
|
||||
qboolean mtexcombine;
|
||||
} glconfig_t;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -409,5 +409,49 @@ void Fake_glColorTableEXT ( GLenum target, GLenum internalformat, GLsizei width,
|
|||
|
||||
extern int QGL_TEXTURE0, QGL_TEXTURE1;
|
||||
|
||||
#ifndef GL_EXT_texture_env_combine
|
||||
#define GL_COMBINE_EXT 0x8570
|
||||
#define GL_COMBINE_RGB_EXT 0x8571
|
||||
#define GL_COMBINE_ALPHA_EXT 0x8572
|
||||
#define GL_RGB_SCALE_EXT 0x8573
|
||||
#define GL_ADD_SIGNED_EXT 0x8574
|
||||
#define GL_INTERPOLATE_EXT 0x8575
|
||||
#define GL_CONSTANT_EXT 0x8576
|
||||
#define GL_PRIMARY_COLOR_EXT 0x8577
|
||||
#define GL_PREVIOUS_EXT 0x8578
|
||||
#define GL_SOURCE0_RGB_EXT 0x8580
|
||||
#define GL_SOURCE1_RGB_EXT 0x8581
|
||||
#define GL_SOURCE2_RGB_EXT 0x8582
|
||||
#define GL_SOURCE3_RGB_EXT 0x8583
|
||||
#define GL_SOURCE4_RGB_EXT 0x8584
|
||||
#define GL_SOURCE5_RGB_EXT 0x8585
|
||||
#define GL_SOURCE6_RGB_EXT 0x8586
|
||||
#define GL_SOURCE7_RGB_EXT 0x8587
|
||||
#define GL_SOURCE0_ALPHA_EXT 0x8588
|
||||
#define GL_SOURCE1_ALPHA_EXT 0x8589
|
||||
#define GL_SOURCE2_ALPHA_EXT 0x858A
|
||||
#define GL_SOURCE3_ALPHA_EXT 0x858B
|
||||
#define GL_SOURCE4_ALPHA_EXT 0x858C
|
||||
#define GL_SOURCE5_ALPHA_EXT 0x858D
|
||||
#define GL_SOURCE6_ALPHA_EXT 0x858E
|
||||
#define GL_SOURCE7_ALPHA_EXT 0x858F
|
||||
#define GL_OPERAND0_RGB_EXT 0x8590
|
||||
#define GL_OPERAND1_RGB_EXT 0x8591
|
||||
#define GL_OPERAND2_RGB_EXT 0x8592
|
||||
#define GL_OPERAND3_RGB_EXT 0x8593
|
||||
#define GL_OPERAND4_RGB_EXT 0x8594
|
||||
#define GL_OPERAND5_RGB_EXT 0x8595
|
||||
#define GL_OPERAND6_RGB_EXT 0x8596
|
||||
#define GL_OPERAND7_RGB_EXT 0x8597
|
||||
#define GL_OPERAND0_ALPHA_EXT 0x8598
|
||||
#define GL_OPERAND1_ALPHA_EXT 0x8599
|
||||
#define GL_OPERAND2_ALPHA_EXT 0x859A
|
||||
#define GL_OPERAND3_ALPHA_EXT 0x859B
|
||||
#define GL_OPERAND4_ALPHA_EXT 0x859C
|
||||
#define GL_OPERAND5_ALPHA_EXT 0x859D
|
||||
#define GL_OPERAND6_ALPHA_EXT 0x859E
|
||||
#define GL_OPERAND7_ALPHA_EXT 0x859F
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1143,7 +1143,14 @@ R_InitImages ( void )
|
|||
registration_sequence = 1;
|
||||
|
||||
/* init intensity conversions */
|
||||
intensity = ri.Cvar_Get( "intensity", "2", 0 );
|
||||
if ( gl_config.mtexcombine )
|
||||
{
|
||||
intensity = ri.Cvar_Get( "intensity", "3", CVAR_ARCHIVE );
|
||||
}
|
||||
else
|
||||
{
|
||||
intensity = ri.Cvar_Get( "intensity", "2", CVAR_ARCHIVE );
|
||||
}
|
||||
|
||||
if ( intensity->value <= 1 )
|
||||
{
|
||||
|
|
|
@ -100,6 +100,7 @@ cvar_t *gl_lerpmodels;
|
|||
cvar_t *r_lefthand;
|
||||
|
||||
cvar_t *gl_lightlevel;
|
||||
cvar_t *gl_overbrightbits;
|
||||
|
||||
cvar_t *gl_nosubimage;
|
||||
cvar_t *gl_allow_software;
|
||||
|
@ -118,6 +119,7 @@ cvar_t *gl_ext_palettedtexture;
|
|||
cvar_t *gl_ext_multitexture;
|
||||
cvar_t *gl_ext_pointparameters;
|
||||
cvar_t *gl_ext_compiled_vertex_array;
|
||||
cvar_t *gl_ext_mtexcombine;
|
||||
|
||||
cvar_t *gl_log;
|
||||
cvar_t *gl_bitdepth;
|
||||
|
@ -941,6 +943,7 @@ R_Register ( void )
|
|||
gl_speeds = ri.Cvar_Get( "gl_speeds", "0", 0 );
|
||||
|
||||
gl_lightlevel = ri.Cvar_Get( "gl_lightlevel", "0", 0 );
|
||||
gl_overbrightbits = ri.Cvar_Get( "gl_overbrightbits", "2", CVAR_ARCHIVE );
|
||||
|
||||
gl_nosubimage = ri.Cvar_Get( "gl_nosubimage", "0", 0 );
|
||||
gl_allow_software = ri.Cvar_Get( "gl_allow_software", "0", 0 );
|
||||
|
@ -985,6 +988,7 @@ R_Register ( void )
|
|||
gl_ext_multitexture = ri.Cvar_Get( "gl_ext_multitexture", "1", CVAR_ARCHIVE );
|
||||
gl_ext_pointparameters = ri.Cvar_Get( "gl_ext_pointparameters", "1", CVAR_ARCHIVE );
|
||||
gl_ext_compiled_vertex_array = ri.Cvar_Get( "gl_ext_compiled_vertex_array", "1", CVAR_ARCHIVE );
|
||||
gl_ext_mtexcombine = ri.Cvar_Get( "gl_ext_mtexcombine", "1", CVAR_ARCHIVE );
|
||||
|
||||
gl_drawbuffer = ri.Cvar_Get( "gl_drawbuffer", "GL_BACK", 0 );
|
||||
gl_swapinterval = ri.Cvar_Get( "gl_swapinterval", "1", CVAR_ARCHIVE );
|
||||
|
@ -1132,7 +1136,7 @@ R_Init ( void *hinstance, void *hWnd )
|
|||
ri.Cvar_Set( "scr_drawall", "0" );
|
||||
gl_config.allow_cds = true;
|
||||
|
||||
ri.Con_Printf( PRINT_ALL, "\nProbing for OpenGL extensions:\n");
|
||||
ri.Con_Printf( PRINT_ALL, "\n\nProbing for OpenGL extensions:\n" );
|
||||
|
||||
/* grab extensions */
|
||||
if ( strstr( gl_config.extensions_string, "GL_EXT_compiled_vertex_array" ) ||
|
||||
|
@ -1231,6 +1235,45 @@ R_Init ( void *hinstance, void *hWnd )
|
|||
ri.Con_Printf( PRINT_ALL, "...GL_SGIS_multitexture not found\n" );
|
||||
}
|
||||
|
||||
gl_config.mtexcombine = false;
|
||||
|
||||
if ( strstr( gl_config.extensions_string, "GL_ARB_texture_env_combine" ) )
|
||||
{
|
||||
if ( gl_ext_mtexcombine->value )
|
||||
{
|
||||
Com_Printf( "...using GL_ARB_texture_env_combine\n" );
|
||||
gl_config.mtexcombine = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_Printf( "...ignoring GL_ARB_texture_env_combine\n" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_Printf( "...GL_ARB_texture_env_combine not found\n" );
|
||||
}
|
||||
|
||||
if ( !gl_config.mtexcombine )
|
||||
{
|
||||
if ( strstr( gl_config.extensions_string, "GL_EXT_texture_env_combine" ) )
|
||||
{
|
||||
if ( gl_ext_mtexcombine->value )
|
||||
{
|
||||
Com_Printf( "...using GL_EXT_texture_env_combine\n" );
|
||||
gl_config.mtexcombine = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_Printf( "...ignoring GL_EXT_texture_env_combine\n" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_Printf( "...GL_EXT_texture_env_combine not found\n" );
|
||||
}
|
||||
}
|
||||
|
||||
R_SetDefaultState();
|
||||
|
||||
R_InitImages();
|
||||
|
|
|
@ -926,10 +926,53 @@ R_DrawBrushModel ( entity_t *e )
|
|||
R_SelectTexture( QGL_TEXTURE0 );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
R_SelectTexture( QGL_TEXTURE1 );
|
||||
R_TexEnv( GL_MODULATE );
|
||||
|
||||
R_DrawInlineBModel();
|
||||
R_EnableMultitexture( false );
|
||||
if ( !gl_config.mtexcombine )
|
||||
{
|
||||
R_TexEnv( GL_REPLACE );
|
||||
R_SelectTexture( GL_TEXTURE1 );
|
||||
|
||||
if ( gl_lightmap->value )
|
||||
{
|
||||
R_TexEnv( GL_REPLACE );
|
||||
}
|
||||
else
|
||||
{
|
||||
R_TexEnv( GL_MODULATE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
R_TexEnv( GL_COMBINE_EXT );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE );
|
||||
R_SelectTexture( GL_TEXTURE1 );
|
||||
R_TexEnv( GL_COMBINE_EXT );
|
||||
|
||||
if ( gl_lightmap->value )
|
||||
{
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE );
|
||||
}
|
||||
else
|
||||
{
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, GL_PREVIOUS_EXT );
|
||||
}
|
||||
|
||||
if ( gl_overbrightbits->value )
|
||||
{
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl_overbrightbits->value );
|
||||
}
|
||||
}
|
||||
|
||||
qglPopMatrix();
|
||||
}
|
||||
|
@ -1105,13 +1148,51 @@ R_DrawWorld ( void )
|
|||
R_TexEnv( GL_REPLACE );
|
||||
R_SelectTexture( QGL_TEXTURE1 );
|
||||
|
||||
if ( gl_lightmap->value )
|
||||
if ( !gl_config.mtexcombine )
|
||||
{
|
||||
R_TexEnv( GL_REPLACE );
|
||||
R_SelectTexture( GL_TEXTURE1 );
|
||||
|
||||
if ( gl_lightmap->value )
|
||||
{
|
||||
R_TexEnv( GL_REPLACE );
|
||||
}
|
||||
else
|
||||
{
|
||||
R_TexEnv( GL_MODULATE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
R_TexEnv( GL_MODULATE );
|
||||
R_TexEnv( GL_COMBINE_EXT );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE );
|
||||
R_SelectTexture( GL_TEXTURE1 );
|
||||
R_TexEnv( GL_COMBINE_EXT );
|
||||
|
||||
if ( gl_lightmap->value )
|
||||
{
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE );
|
||||
}
|
||||
else
|
||||
{
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, GL_PREVIOUS_EXT );
|
||||
}
|
||||
|
||||
if ( gl_overbrightbits->value )
|
||||
{
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl_overbrightbits->value );
|
||||
}
|
||||
}
|
||||
|
||||
R_RecursiveWorldNode( r_worldmodel->nodes );
|
||||
|
|
Loading…
Reference in a new issue