mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Benenne alle GL_ Funktionen in gl_images.c in R_ um
This commit is contained in:
parent
3989b43035
commit
7563c221f4
14 changed files with 145 additions and 143 deletions
1
TODO
1
TODO
|
@ -3,6 +3,7 @@ Allgemein:
|
|||
- ====InitGame=== in allen Spielen ändern
|
||||
|
||||
- Header in unix/ und system/ mit Guards ausstatten
|
||||
- Alle anderen auf Guards prüfen
|
||||
|
||||
- Dateien im Refresher umbenennen
|
||||
- Im Refresher für Funktionen konstant R_* statt GL_*
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "../header/local.h"
|
||||
|
||||
void
|
||||
Mod_LoadAliasModel ( model_t *mod, void *buffer )
|
||||
LoadMD2 ( model_t *mod, void *buffer )
|
||||
{
|
||||
int i, j;
|
||||
dmdl_t *pinmodel, *pheader;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
extern int modfilelen;
|
||||
|
||||
void
|
||||
Mod_LoadSpriteModel ( model_t *mod, void *buffer )
|
||||
LoadSP2 ( model_t *mod, void *buffer )
|
||||
{
|
||||
dsprite_t *sprin, *sprout;
|
||||
int i;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "../header/local.h"
|
||||
|
||||
image_t *
|
||||
R_LoadWal ( char *name )
|
||||
LoadWal ( char *name )
|
||||
{
|
||||
miptex_t *mt;
|
||||
int width, height, ofs;
|
||||
|
|
|
@ -39,8 +39,8 @@ cvar_t *intensity;
|
|||
|
||||
unsigned d_8to24table [ 256 ];
|
||||
|
||||
qboolean GL_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sky );
|
||||
qboolean GL_Upload32 ( unsigned *data, int width, int height, qboolean mipmap );
|
||||
qboolean R_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sky );
|
||||
qboolean R_Upload32 ( unsigned *data, int width, int height, qboolean mipmap );
|
||||
|
||||
int gl_solid_format = 3;
|
||||
int gl_alpha_format = 4;
|
||||
|
@ -51,8 +51,9 @@ int gl_tex_alpha_format = 4;
|
|||
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
|
||||
int gl_filter_max = GL_LINEAR;
|
||||
|
||||
image_t * R_LoadWal ( char *name );
|
||||
image_t * LoadWal ( char *name );
|
||||
void LoadTGA ( char *name, byte **pic, int *width, int *height );
|
||||
int Draw_GetPalette ( void );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -127,7 +128,7 @@ int upload_width, upload_height;
|
|||
qboolean uploaded_paletted;
|
||||
|
||||
void
|
||||
GL_TexEnv ( GLenum mode )
|
||||
R_TexEnv ( GLenum mode )
|
||||
{
|
||||
static int lastmodes [ 2 ] = { -1, -1 };
|
||||
|
||||
|
@ -139,7 +140,7 @@ GL_TexEnv ( GLenum mode )
|
|||
}
|
||||
|
||||
void
|
||||
GL_Bind ( int texnum )
|
||||
R_Bind ( int texnum )
|
||||
{
|
||||
extern image_t *draw_chars;
|
||||
|
||||
|
@ -158,7 +159,7 @@ GL_Bind ( int texnum )
|
|||
}
|
||||
|
||||
void
|
||||
GL_MBind ( GLenum target, int texnum )
|
||||
R_MBind ( GLenum target, int texnum )
|
||||
{
|
||||
if ( target == QGL_TEXTURE0 )
|
||||
{
|
||||
|
@ -175,11 +176,11 @@ GL_MBind ( GLenum target, int texnum )
|
|||
}
|
||||
}
|
||||
|
||||
GL_Bind( texnum );
|
||||
R_Bind( texnum );
|
||||
}
|
||||
|
||||
void
|
||||
GL_TextureMode ( char *string )
|
||||
R_TextureMode ( char *string )
|
||||
{
|
||||
int i;
|
||||
image_t *glt;
|
||||
|
@ -206,7 +207,7 @@ GL_TextureMode ( char *string )
|
|||
{
|
||||
if ( ( glt->type != it_pic ) && ( glt->type != it_sky ) )
|
||||
{
|
||||
GL_Bind( glt->texnum );
|
||||
R_Bind( glt->texnum );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
||||
}
|
||||
|
@ -214,7 +215,7 @@ GL_TextureMode ( char *string )
|
|||
}
|
||||
|
||||
void
|
||||
GL_TextureAlphaMode ( char *string )
|
||||
R_TextureAlphaMode ( char *string )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -236,7 +237,7 @@ GL_TextureAlphaMode ( char *string )
|
|||
}
|
||||
|
||||
void
|
||||
GL_TextureSolidMode ( char *string )
|
||||
R_TextureSolidMode ( char *string )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -258,7 +259,7 @@ GL_TextureSolidMode ( char *string )
|
|||
}
|
||||
|
||||
void
|
||||
GL_ImageList_f ( void )
|
||||
R_ImageList_f ( void )
|
||||
{
|
||||
int i;
|
||||
image_t *image;
|
||||
|
@ -375,7 +376,7 @@ R_FloodFillSkin ( byte *skin, int skinwidth, int skinheight )
|
|||
}
|
||||
|
||||
void
|
||||
GL_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight )
|
||||
R_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight )
|
||||
{
|
||||
int i, j;
|
||||
unsigned *inrow, *inrow2;
|
||||
|
@ -427,7 +428,7 @@ GL_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, in
|
|||
* lighting range
|
||||
*/
|
||||
void
|
||||
GL_LightScaleTexture ( unsigned *in, int inwidth, int inheight, qboolean only_gamma )
|
||||
R_LightScaleTexture ( unsigned *in, int inwidth, int inheight, qboolean only_gamma )
|
||||
{
|
||||
if ( only_gamma )
|
||||
{
|
||||
|
@ -467,7 +468,7 @@ GL_LightScaleTexture ( unsigned *in, int inwidth, int inheight, qboolean only_ga
|
|||
* Operates in place, quartering the size of the texture
|
||||
*/
|
||||
void
|
||||
GL_MipMap ( byte *in, int width, int height )
|
||||
R_MipMap ( byte *in, int width, int height )
|
||||
{
|
||||
int i, j;
|
||||
byte *out;
|
||||
|
@ -492,7 +493,7 @@ GL_MipMap ( byte *in, int width, int height )
|
|||
* Returns has_alpha
|
||||
*/
|
||||
void
|
||||
GL_BuildPalettedTexture ( unsigned char *paletted_texture, unsigned char *scaled, int scaled_width, int scaled_height )
|
||||
R_BuildPalettedTexture ( unsigned char *paletted_texture, unsigned char *scaled, int scaled_width, int scaled_height )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -513,7 +514,7 @@ GL_BuildPalettedTexture ( unsigned char *paletted_texture, unsigned char *scaled
|
|||
}
|
||||
|
||||
qboolean
|
||||
GL_Upload32 ( unsigned *data, int width, int height, qboolean mipmap )
|
||||
R_Upload32 ( unsigned *data, int width, int height, qboolean mipmap )
|
||||
{
|
||||
int samples;
|
||||
unsigned scaled [ 256 * 256 ];
|
||||
|
@ -575,7 +576,7 @@ GL_Upload32 ( unsigned *data, int width, int height, qboolean mipmap )
|
|||
|
||||
if ( scaled_width * scaled_height > sizeof ( scaled ) / 4 )
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "GL_Upload32: too big" );
|
||||
ri.Sys_Error( ERR_DROP, "R_Upload32: too big" );
|
||||
}
|
||||
|
||||
/* scan the texture for any non-255 alpha */
|
||||
|
@ -620,10 +621,10 @@ GL_Upload32 ( unsigned *data, int width, int height, qboolean mipmap )
|
|||
}
|
||||
else
|
||||
{
|
||||
GL_ResampleTexture( data, width, height, scaled, scaled_width, scaled_height );
|
||||
R_ResampleTexture( data, width, height, scaled, scaled_width, scaled_height );
|
||||
}
|
||||
|
||||
GL_LightScaleTexture( scaled, scaled_width, scaled_height, !mipmap );
|
||||
R_LightScaleTexture( scaled, scaled_width, scaled_height, !mipmap );
|
||||
qglTexImage2D( GL_TEXTURE_2D, 0, comp, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled );
|
||||
|
||||
if ( mipmap )
|
||||
|
@ -634,7 +635,7 @@ GL_Upload32 ( unsigned *data, int width, int height, qboolean mipmap )
|
|||
|
||||
while ( scaled_width > 1 || scaled_height > 1 )
|
||||
{
|
||||
GL_MipMap( (byte *) scaled, scaled_width, scaled_height );
|
||||
R_MipMap( (byte *) scaled, scaled_width, scaled_height );
|
||||
scaled_width >>= 1;
|
||||
scaled_height >>= 1;
|
||||
|
||||
|
@ -673,7 +674,7 @@ done:
|
|||
* Returns has_alpha
|
||||
*/
|
||||
qboolean
|
||||
GL_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sky )
|
||||
R_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sky )
|
||||
{
|
||||
unsigned trans [ 512 * 256 ];
|
||||
int i, s;
|
||||
|
@ -683,7 +684,7 @@ GL_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sk
|
|||
|
||||
if ( s > sizeof ( trans ) / 4 )
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "GL_Upload8: too large" );
|
||||
ri.Sys_Error( ERR_DROP, "R_Upload8: too large" );
|
||||
}
|
||||
|
||||
for ( i = 0; i < s; i++ )
|
||||
|
@ -723,14 +724,14 @@ GL_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sk
|
|||
}
|
||||
}
|
||||
|
||||
return ( GL_Upload32( trans, width, height, mipmap ) );
|
||||
return ( R_Upload32( trans, width, height, mipmap ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* This is also used as an entry point for the generated r_notexture
|
||||
*/
|
||||
image_t *
|
||||
GL_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int bits )
|
||||
R_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int bits )
|
||||
{
|
||||
image_t *image;
|
||||
int i;
|
||||
|
@ -814,16 +815,16 @@ GL_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int
|
|||
nonscrap:
|
||||
image->scrap = false;
|
||||
image->texnum = TEXNUM_IMAGES + ( image - gltextures );
|
||||
GL_Bind( image->texnum );
|
||||
R_Bind( image->texnum );
|
||||
|
||||
if ( bits == 8 )
|
||||
{
|
||||
image->has_alpha = GL_Upload8( pic, width, height, ( image->type != it_pic && image->type != it_sky ),
|
||||
image->has_alpha = R_Upload8( pic, width, height, ( image->type != it_pic && image->type != it_sky ),
|
||||
image->type == it_sky );
|
||||
}
|
||||
else
|
||||
{
|
||||
image->has_alpha = GL_Upload32( (unsigned *) pic, width, height, ( image->type != it_pic && image->type != it_sky ) );
|
||||
image->has_alpha = R_Upload32( (unsigned *) pic, width, height, ( image->type != it_pic && image->type != it_sky ) );
|
||||
}
|
||||
|
||||
image->upload_width = upload_width; /* after power of 2 and scales */
|
||||
|
@ -842,7 +843,7 @@ GL_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int
|
|||
* Finds or loads the given image
|
||||
*/
|
||||
image_t *
|
||||
GL_FindImage ( char *name, imagetype_t type )
|
||||
R_FindImage ( char *name, imagetype_t type )
|
||||
{
|
||||
image_t *image;
|
||||
int i, len;
|
||||
|
@ -891,11 +892,11 @@ GL_FindImage ( char *name, imagetype_t type )
|
|||
return ( NULL );
|
||||
}
|
||||
|
||||
image = GL_LoadPic( name, pic, width, height, type, 8 );
|
||||
image = R_LoadPic( name, pic, width, height, type, 8 );
|
||||
}
|
||||
else if ( !strcmp( name + len - 4, ".wal" ) )
|
||||
{
|
||||
image = R_LoadWal( name );
|
||||
image = LoadWal( name );
|
||||
}
|
||||
else if ( !strcmp( name + len - 4, ".tga" ) )
|
||||
{
|
||||
|
@ -906,7 +907,7 @@ GL_FindImage ( char *name, imagetype_t type )
|
|||
return ( NULL );
|
||||
}
|
||||
|
||||
image = GL_LoadPic( name, pic, width, height, type, 32 );
|
||||
image = R_LoadPic( name, pic, width, height, type, 32 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -929,7 +930,7 @@ GL_FindImage ( char *name, imagetype_t type )
|
|||
struct image_s *
|
||||
R_RegisterSkin ( char *name )
|
||||
{
|
||||
return ( GL_FindImage( name, it_skin ) );
|
||||
return ( R_FindImage( name, it_skin ) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -938,7 +939,7 @@ R_RegisterSkin ( char *name )
|
|||
* will be freed.
|
||||
*/
|
||||
void
|
||||
GL_FreeUnusedImages ( void )
|
||||
R_FreeUnusedImages ( void )
|
||||
{
|
||||
int i;
|
||||
image_t *image;
|
||||
|
@ -970,43 +971,8 @@ GL_FreeUnusedImages ( void )
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
Draw_GetPalette ( void )
|
||||
{
|
||||
int i;
|
||||
int r, g, b;
|
||||
unsigned v;
|
||||
byte *pic, *pal;
|
||||
int width, height;
|
||||
|
||||
/* get the palette */
|
||||
LoadPCX( "pics/colormap.pcx", &pic, &pal, &width, &height );
|
||||
|
||||
if ( !pal )
|
||||
{
|
||||
ri.Sys_Error( ERR_FATAL, "Couldn't load pics/colormap.pcx" );
|
||||
}
|
||||
|
||||
for ( i = 0; i < 256; i++ )
|
||||
{
|
||||
r = pal [ i * 3 + 0 ];
|
||||
g = pal [ i * 3 + 1 ];
|
||||
b = pal [ i * 3 + 2 ];
|
||||
|
||||
v = ( 255 << 24 ) + ( r << 0 ) + ( g << 8 ) + ( b << 16 );
|
||||
d_8to24table [ i ] = LittleLong( v );
|
||||
}
|
||||
|
||||
d_8to24table [ 255 ] &= LittleLong( 0xffffff ); /* 255 is transparent */
|
||||
|
||||
free( pic );
|
||||
free( pal );
|
||||
|
||||
return ( 0 );
|
||||
}
|
||||
|
||||
void
|
||||
GL_InitImages ( void )
|
||||
R_InitImages ( void )
|
||||
{
|
||||
int i, j;
|
||||
float g = vid_gamma->value;
|
||||
|
@ -1075,7 +1041,7 @@ GL_InitImages ( void )
|
|||
}
|
||||
|
||||
void
|
||||
GL_ShutdownImages ( void )
|
||||
R_ShutdownImages ( void )
|
||||
{
|
||||
int i;
|
||||
image_t *image;
|
||||
|
|
|
@ -732,12 +732,12 @@ R_DrawAliasModel ( entity_t *e )
|
|||
skin = r_notexture; /* fallback... */
|
||||
}
|
||||
|
||||
GL_Bind( skin->texnum );
|
||||
R_Bind( skin->texnum );
|
||||
|
||||
/* draw it */
|
||||
qglShadeModel( GL_SMOOTH );
|
||||
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
R_TexEnv( GL_MODULATE );
|
||||
|
||||
if ( currententity->flags & RF_TRANSLUCENT )
|
||||
{
|
||||
|
@ -769,7 +769,7 @@ R_DrawAliasModel ( entity_t *e )
|
|||
|
||||
GL_DrawAliasFrameLerp( paliashdr, currententity->backlerp );
|
||||
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
qglShadeModel( GL_FLAT );
|
||||
|
||||
qglPopMatrix();
|
||||
|
|
|
@ -466,7 +466,7 @@ Mod_LoadTexinfo ( lump_t *l )
|
|||
|
||||
Com_sprintf( name, sizeof ( name ), "textures/%s.wal", in->texture );
|
||||
|
||||
out->image = GL_FindImage( name, it_wall );
|
||||
out->image = R_FindImage( name, it_wall );
|
||||
|
||||
if ( !out->image )
|
||||
{
|
||||
|
@ -988,7 +988,7 @@ R_RegisterModel ( char *name )
|
|||
|
||||
for ( i = 0; i < sprout->numframes; i++ )
|
||||
{
|
||||
mod->skins [ i ] = GL_FindImage( sprout->frames [ i ].name, it_sprite );
|
||||
mod->skins [ i ] = R_FindImage( sprout->frames [ i ].name, it_sprite );
|
||||
}
|
||||
}
|
||||
else if ( mod->type == mod_alias )
|
||||
|
@ -997,7 +997,7 @@ R_RegisterModel ( char *name )
|
|||
|
||||
for ( i = 0; i < pheader->num_skins; i++ )
|
||||
{
|
||||
mod->skins [ i ] = GL_FindImage( (char *) pheader + pheader->ofs_skins + i * MAX_SKINNAME, it_skin );
|
||||
mod->skins [ i ] = R_FindImage( (char *) pheader + pheader->ofs_skins + i * MAX_SKINNAME, it_skin );
|
||||
}
|
||||
|
||||
mod->numframes = pheader->num_frames;
|
||||
|
@ -1034,7 +1034,7 @@ R_EndRegistration ( void )
|
|||
}
|
||||
}
|
||||
|
||||
GL_FreeUnusedImages();
|
||||
R_FreeUnusedImages();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -217,9 +217,9 @@ R_DrawSpriteModel ( entity_t *e )
|
|||
|
||||
qglColor4f( 1, 1, 1, alpha );
|
||||
|
||||
GL_Bind( currentmodel->skins [ e->frame ]->texnum );
|
||||
R_Bind( currentmodel->skins [ e->frame ]->texnum );
|
||||
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
R_TexEnv( GL_MODULATE );
|
||||
|
||||
if ( alpha == 1.0 )
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ R_DrawSpriteModel ( entity_t *e )
|
|||
qglEnd();
|
||||
|
||||
qglDisable( GL_ALPHA_TEST );
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
|
||||
if ( alpha != 1.0F )
|
||||
{
|
||||
|
@ -421,10 +421,10 @@ GL_DrawParticles ( int num_particles, const particle_t particles[], const unsign
|
|||
float scale;
|
||||
byte color [ 4 ];
|
||||
|
||||
GL_Bind( r_particletexture->texnum );
|
||||
R_Bind( r_particletexture->texnum );
|
||||
qglDepthMask( GL_FALSE ); /* no z buffering */
|
||||
qglEnable( GL_BLEND );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
R_TexEnv( GL_MODULATE );
|
||||
qglBegin( GL_TRIANGLES );
|
||||
|
||||
VectorScale( vup, 1.5, up );
|
||||
|
@ -469,7 +469,7 @@ GL_DrawParticles ( int num_particles, const particle_t particles[], const unsign
|
|||
qglDisable( GL_BLEND );
|
||||
qglColor4f( 1, 1, 1, 1 );
|
||||
qglDepthMask( 1 ); /* back to normal Z buffering */
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -988,7 +988,7 @@ R_Register ( void )
|
|||
gl_customwidth = ri.Cvar_Get( "gl_customwidth", "1024", CVAR_ARCHIVE );
|
||||
gl_customheight = ri.Cvar_Get( "gl_customheight", "768", CVAR_ARCHIVE );
|
||||
|
||||
ri.Cmd_AddCommand( "imagelist", GL_ImageList_f );
|
||||
ri.Cmd_AddCommand( "imagelist", R_ImageList_f );
|
||||
ri.Cmd_AddCommand( "screenshot", GL_ScreenShot_f );
|
||||
ri.Cmd_AddCommand( "modellist", Mod_Modellist_f );
|
||||
ri.Cmd_AddCommand( "gl_strings", GL_Strings_f );
|
||||
|
@ -1156,7 +1156,7 @@ R_Init ( void *hinstance, void *hWnd )
|
|||
|
||||
GL_SetDefaultState();
|
||||
|
||||
GL_InitImages();
|
||||
R_InitImages();
|
||||
Mod_Init();
|
||||
R_InitParticleTexture();
|
||||
Draw_InitLocal();
|
||||
|
@ -1181,7 +1181,7 @@ R_Shutdown ( void )
|
|||
|
||||
Mod_FreeAll();
|
||||
|
||||
GL_ShutdownImages();
|
||||
R_ShutdownImages();
|
||||
|
||||
/* shut down OS specific OpenGL stuff like contexts, etc. */
|
||||
GLimp_Shutdown();
|
||||
|
@ -1261,19 +1261,19 @@ R_BeginFrame ( float camera_separation )
|
|||
/* texturemode stuff */
|
||||
if ( gl_texturemode->modified )
|
||||
{
|
||||
GL_TextureMode( gl_texturemode->string );
|
||||
R_TextureMode( gl_texturemode->string );
|
||||
gl_texturemode->modified = false;
|
||||
}
|
||||
|
||||
if ( gl_texturealphamode->modified )
|
||||
{
|
||||
GL_TextureAlphaMode( gl_texturealphamode->string );
|
||||
R_TextureAlphaMode( gl_texturealphamode->string );
|
||||
gl_texturealphamode->modified = false;
|
||||
}
|
||||
|
||||
if ( gl_texturesolidmode->modified )
|
||||
{
|
||||
GL_TextureSolidMode( gl_texturesolidmode->string );
|
||||
R_TextureSolidMode( gl_texturesolidmode->string );
|
||||
gl_texturesolidmode->modified = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ R_InitParticleTexture ( void )
|
|||
}
|
||||
}
|
||||
|
||||
r_particletexture = GL_LoadPic( "***particle***", (byte *) data, 8, 8, it_sprite, 32 );
|
||||
r_particletexture = R_LoadPic( "***particle***", (byte *) data, 8, 8, it_sprite, 32 );
|
||||
|
||||
/* also use this for bad textures, but without alpha */
|
||||
for ( x = 0; x < 8; x++ )
|
||||
|
@ -74,7 +74,7 @@ R_InitParticleTexture ( void )
|
|||
}
|
||||
}
|
||||
|
||||
r_notexture = GL_LoadPic( "***r_notexture***", (byte *) data, 8, 8, it_wall, 32 );
|
||||
r_notexture = R_LoadPic( "***r_notexture***", (byte *) data, 8, 8, it_wall, 32 );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -171,9 +171,9 @@ GL_SetDefaultState ( void )
|
|||
qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
||||
qglShadeModel( GL_FLAT );
|
||||
|
||||
GL_TextureMode( gl_texturemode->string );
|
||||
GL_TextureAlphaMode( gl_texturealphamode->string );
|
||||
GL_TextureSolidMode( gl_texturesolidmode->string );
|
||||
R_TextureMode( gl_texturemode->string );
|
||||
R_TextureAlphaMode( gl_texturealphamode->string );
|
||||
R_TextureSolidMode( gl_texturesolidmode->string );
|
||||
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
||||
|
@ -183,7 +183,7 @@ GL_SetDefaultState ( void )
|
|||
|
||||
qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
|
||||
if ( qglPointParameterfEXT )
|
||||
{
|
||||
|
|
|
@ -273,7 +273,7 @@ R_BlendLightmaps ( void )
|
|||
c_visible_lightmaps++;
|
||||
}
|
||||
|
||||
GL_Bind( gl_state.lightmap_textures + i );
|
||||
R_Bind( gl_state.lightmap_textures + i );
|
||||
|
||||
for ( surf = gl_lms.lightmap_surfaces [ i ]; surf != 0; surf = surf->lightmapchain )
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ R_BlendLightmaps ( void )
|
|||
{
|
||||
LM_InitBlock();
|
||||
|
||||
GL_Bind( gl_state.lightmap_textures + 0 );
|
||||
R_Bind( gl_state.lightmap_textures + 0 );
|
||||
|
||||
if ( currentmodel == r_worldmodel )
|
||||
{
|
||||
|
@ -385,24 +385,24 @@ R_RenderBrushPoly ( msurface_t *fa )
|
|||
|
||||
if ( fa->flags & SURF_DRAWTURB )
|
||||
{
|
||||
GL_Bind( image->texnum );
|
||||
R_Bind( image->texnum );
|
||||
|
||||
/* warp texture, no lightmaps */
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
R_TexEnv( GL_MODULATE );
|
||||
qglColor4f( gl_state.inverse_intensity,
|
||||
gl_state.inverse_intensity,
|
||||
gl_state.inverse_intensity,
|
||||
1.0F );
|
||||
EmitWaterPolys( fa );
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_Bind( image->texnum );
|
||||
R_Bind( image->texnum );
|
||||
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
}
|
||||
|
||||
if ( fa->texinfo->flags & SURF_FLOWING )
|
||||
|
@ -450,7 +450,7 @@ R_RenderBrushPoly ( msurface_t *fa )
|
|||
R_BuildLightMap( fa, (void *) temp, smax * 4 );
|
||||
R_SetCacheState( fa );
|
||||
|
||||
GL_Bind( gl_state.lightmap_textures + fa->lightmaptexturenum );
|
||||
R_Bind( gl_state.lightmap_textures + fa->lightmaptexturenum );
|
||||
|
||||
qglTexSubImage2D( GL_TEXTURE_2D, 0,
|
||||
fa->light_s, fa->light_t,
|
||||
|
@ -489,7 +489,7 @@ R_DrawAlphaSurfaces ( void )
|
|||
qglLoadMatrixf( r_world_matrix );
|
||||
|
||||
qglEnable( GL_BLEND );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
R_TexEnv( GL_MODULATE );
|
||||
|
||||
/* the textures are prescaled up for a better lighting range,
|
||||
so scale it back down */
|
||||
|
@ -497,7 +497,7 @@ R_DrawAlphaSurfaces ( void )
|
|||
|
||||
for ( s = r_alpha_surfaces; s; s = s->texturechain )
|
||||
{
|
||||
GL_Bind( s->texinfo->image->texnum );
|
||||
R_Bind( s->texinfo->image->texnum );
|
||||
c_brush_polys++;
|
||||
|
||||
if ( s->texinfo->flags & SURF_TRANS33 )
|
||||
|
@ -527,7 +527,7 @@ R_DrawAlphaSurfaces ( void )
|
|||
}
|
||||
}
|
||||
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
qglColor4f( 1, 1, 1, 1 );
|
||||
qglDisable( GL_BLEND );
|
||||
|
||||
|
@ -567,7 +567,7 @@ DrawTextureChains ( void )
|
|||
image->texturechain = NULL;
|
||||
}
|
||||
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -596,7 +596,7 @@ R_DrawInlineBModel ( void )
|
|||
{
|
||||
qglEnable( GL_BLEND );
|
||||
qglColor4f( 1, 1, 1, 0.25 );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
R_TexEnv( GL_MODULATE );
|
||||
}
|
||||
|
||||
/* draw texture */
|
||||
|
@ -632,7 +632,7 @@ R_DrawInlineBModel ( void )
|
|||
{
|
||||
qglDisable( GL_BLEND );
|
||||
qglColor4f( 1, 1, 1, 1 );
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -697,8 +697,8 @@ R_DrawBrushModel ( entity_t *e )
|
|||
e->angles [ 0 ] = -e->angles [ 0 ];
|
||||
e->angles [ 2 ] = -e->angles [ 2 ];
|
||||
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
R_TexEnv( GL_REPLACE );
|
||||
R_TexEnv( GL_MODULATE );
|
||||
|
||||
R_DrawInlineBModel();
|
||||
|
||||
|
@ -983,7 +983,7 @@ LM_UploadBlock ( qboolean dynamic )
|
|||
texture = gl_lms.current_lightmap_texture;
|
||||
}
|
||||
|
||||
GL_Bind( gl_state.lightmap_textures + texture );
|
||||
R_Bind( gl_state.lightmap_textures + texture );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
||||
|
@ -1209,7 +1209,7 @@ GL_BeginBuildingLightmaps ( model_t *m )
|
|||
gl_lms.internal_format = gl_tex_solid_format;
|
||||
|
||||
/* initialize the dynamic lightmap texture */
|
||||
GL_Bind( gl_state.lightmap_textures + 0 );
|
||||
R_Bind( gl_state.lightmap_textures + 0 );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
qglTexImage2D( GL_TEXTURE_2D,
|
||||
|
|
|
@ -88,8 +88,8 @@ void
|
|||
Scrap_Upload ( void )
|
||||
{
|
||||
scrap_uploads++;
|
||||
GL_Bind( TEXNUM_SCRAPS );
|
||||
GL_Upload8( scrap_texels [ 0 ], BLOCK_WIDTH, BLOCK_HEIGHT, false, false );
|
||||
R_Bind( TEXNUM_SCRAPS );
|
||||
R_Upload8( scrap_texels [ 0 ], BLOCK_WIDTH, BLOCK_HEIGHT, false, false );
|
||||
scrap_dirty = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -663,7 +663,7 @@ R_DrawSkyBox ( void )
|
|||
continue;
|
||||
}
|
||||
|
||||
GL_Bind( sky_images [ skytexorder [ i ] ]->texnum );
|
||||
R_Bind( sky_images [ skytexorder [ i ] ]->texnum );
|
||||
|
||||
qglBegin( GL_QUADS );
|
||||
MakeSkyVec( skymins [ 0 ] [ i ], skymins [ 1 ] [ i ], i );
|
||||
|
@ -690,7 +690,7 @@ R_SetSky ( char *name, float rotate, vec3_t axis )
|
|||
{
|
||||
Com_sprintf( pathname, sizeof ( pathname ), "env/%s%s.tga", skyname, suf [ i ] );
|
||||
|
||||
sky_images [ i ] = GL_FindImage( pathname, it_sky );
|
||||
sky_images [ i ] = R_FindImage( pathname, it_sky );
|
||||
|
||||
if ( !sky_images [ i ] )
|
||||
{
|
||||
|
|
|
@ -238,9 +238,9 @@ extern int c_visible_textures;
|
|||
extern float r_world_matrix [ 16 ];
|
||||
|
||||
void R_TranslatePlayerSkin ( int playernum );
|
||||
void GL_Bind ( int texnum );
|
||||
void GL_MBind ( GLenum target, int texnum );
|
||||
void GL_TexEnv ( GLenum value );
|
||||
void R_Bind ( int texnum );
|
||||
void R_MBind ( GLenum target, int texnum );
|
||||
void R_TexEnv ( GLenum value );
|
||||
|
||||
void R_LightPoint ( vec3_t p, vec3_t color );
|
||||
void R_PushDlights ( void );
|
||||
|
@ -294,23 +294,23 @@ void R_SetPalette ( const unsigned char *palette );
|
|||
|
||||
int Draw_GetPalette ( void );
|
||||
|
||||
void GL_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight );
|
||||
void R_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight );
|
||||
|
||||
struct image_s *R_RegisterSkin ( char *name );
|
||||
|
||||
void LoadPCX ( char *filename, byte **pic, byte **palette, int *width, int *height );
|
||||
image_t *GL_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int bits );
|
||||
image_t *GL_FindImage ( char *name, imagetype_t type );
|
||||
void GL_TextureMode ( char *string );
|
||||
void GL_ImageList_f ( void );
|
||||
image_t *R_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int bits );
|
||||
image_t *R_FindImage ( char *name, imagetype_t type );
|
||||
void R_TextureMode ( char *string );
|
||||
void R_ImageList_f ( void );
|
||||
|
||||
void GL_InitImages ( void );
|
||||
void GL_ShutdownImages ( void );
|
||||
void R_InitImages ( void );
|
||||
void R_ShutdownImages ( void );
|
||||
|
||||
void GL_FreeUnusedImages ( void );
|
||||
void R_FreeUnusedImages ( void );
|
||||
|
||||
void GL_TextureAlphaMode ( char *string );
|
||||
void GL_TextureSolidMode ( char *string );
|
||||
void R_TextureAlphaMode ( char *string );
|
||||
void R_TextureSolidMode ( char *string );
|
||||
int Scrap_AllocBlock ( int w, int h, int *x, int *y );
|
||||
|
||||
/* GL extension emulation functions */
|
||||
|
|
|
@ -36,8 +36,8 @@ void
|
|||
Draw_InitLocal ( void )
|
||||
{
|
||||
/* load console characters (don't bilerp characters) */
|
||||
draw_chars = GL_FindImage( "pics/conchars.pcx", it_pic );
|
||||
GL_Bind( draw_chars->texnum );
|
||||
draw_chars = R_FindImage( "pics/conchars.pcx", it_pic );
|
||||
R_Bind( draw_chars->texnum );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ Draw_Char ( int x, int y, int num )
|
|||
fcol = col * 0.0625;
|
||||
size = 0.0625;
|
||||
|
||||
GL_Bind( draw_chars->texnum );
|
||||
R_Bind( draw_chars->texnum );
|
||||
|
||||
qglBegin( GL_QUADS );
|
||||
qglTexCoord2f( fcol, frow );
|
||||
|
@ -95,11 +95,11 @@ Draw_FindPic ( char *name )
|
|||
if ( ( name [ 0 ] != '/' ) && ( name [ 0 ] != '\\' ) )
|
||||
{
|
||||
Com_sprintf( fullname, sizeof ( fullname ), "pics/%s.pcx", name );
|
||||
gl = GL_FindImage( fullname, it_pic );
|
||||
gl = R_FindImage( fullname, it_pic );
|
||||
}
|
||||
else
|
||||
{
|
||||
gl = GL_FindImage( name + 1, it_pic );
|
||||
gl = R_FindImage( name + 1, it_pic );
|
||||
}
|
||||
|
||||
return ( gl );
|
||||
|
@ -140,7 +140,7 @@ Draw_StretchPic ( int x, int y, int w, int h, char *pic )
|
|||
Scrap_Upload();
|
||||
}
|
||||
|
||||
GL_Bind( gl->texnum );
|
||||
R_Bind( gl->texnum );
|
||||
qglBegin( GL_QUADS );
|
||||
qglTexCoord2f( gl->sl, gl->tl );
|
||||
qglVertex2f( x, y );
|
||||
|
@ -171,7 +171,7 @@ Draw_Pic ( int x, int y, char *pic )
|
|||
Scrap_Upload();
|
||||
}
|
||||
|
||||
GL_Bind( gl->texnum );
|
||||
R_Bind( gl->texnum );
|
||||
qglBegin( GL_QUADS );
|
||||
qglTexCoord2f( gl->sl, gl->tl );
|
||||
qglVertex2f( x, y );
|
||||
|
@ -202,7 +202,7 @@ Draw_TileClear ( int x, int y, int w, int h, char *pic )
|
|||
return;
|
||||
}
|
||||
|
||||
GL_Bind( image->texnum );
|
||||
R_Bind( image->texnum );
|
||||
qglBegin( GL_QUADS );
|
||||
qglTexCoord2f( x / 64.0, y / 64.0 );
|
||||
qglVertex2f( x, y );
|
||||
|
@ -283,7 +283,7 @@ Draw_StretchRaw ( int x, int y, int w, int h, int cols, int rows, byte *data )
|
|||
int row;
|
||||
float t;
|
||||
|
||||
GL_Bind( 0 );
|
||||
R_Bind( 0 );
|
||||
|
||||
if ( rows <= 256 )
|
||||
{
|
||||
|
@ -375,3 +375,38 @@ Draw_StretchRaw ( int x, int y, int w, int h, int cols, int rows, byte *data )
|
|||
qglEnd();
|
||||
}
|
||||
|
||||
int
|
||||
Draw_GetPalette ( void )
|
||||
{
|
||||
int i;
|
||||
int r, g, b;
|
||||
unsigned v;
|
||||
byte *pic, *pal;
|
||||
int width, height;
|
||||
|
||||
/* get the palette */
|
||||
LoadPCX( "pics/colormap.pcx", &pic, &pal, &width, &height );
|
||||
|
||||
if ( !pal )
|
||||
{
|
||||
ri.Sys_Error( ERR_FATAL, "Couldn't load pics/colormap.pcx" );
|
||||
}
|
||||
|
||||
for ( i = 0; i < 256; i++ )
|
||||
{
|
||||
r = pal [ i * 3 + 0 ];
|
||||
g = pal [ i * 3 + 1 ];
|
||||
b = pal [ i * 3 + 2 ];
|
||||
|
||||
v = ( 255 << 24 ) + ( r << 0 ) + ( g << 8 ) + ( b << 16 );
|
||||
d_8to24table [ i ] = LittleLong( v );
|
||||
}
|
||||
|
||||
d_8to24table [ 255 ] &= LittleLong( 0xffffff ); /* 255 is transparent */
|
||||
|
||||
free( pic );
|
||||
free( pal );
|
||||
|
||||
return ( 0 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue