mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-11 07:37:52 +00:00
ref: remove shared textures enum, instead use hardcoded texture names
This commit is contained in:
parent
2d968cf328
commit
5be982cc72
@ -633,7 +633,7 @@ void CL_DrawScreenFade( void )
|
|||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||||
else ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
else ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||||
ref.dllFuncs.R_DrawStretchPic( 0, 0, refState.width, refState.height, 0, 0, 1, 1,
|
ref.dllFuncs.R_DrawStretchPic( 0, 0, refState.width, refState.height, 0, 0, 1, 1,
|
||||||
ref.dllFuncs.R_GetBuiltinTexture( REF_WHITE_TEXTURE ));
|
R_GetBuiltinTexture( REF_WHITE_TEXTURE ));
|
||||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ static void pfnFillRGBA( int x, int y, int width, int height, int r, int g, int
|
|||||||
a = bound( 0, a, 255 );
|
a = bound( 0, a, 255 );
|
||||||
ref.dllFuncs.Color4ub( r, g, b, a );
|
ref.dllFuncs.Color4ub( r, g, b, a );
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, ref.dllFuncs.R_GetBuiltinTexture( REF_WHITE_TEXTURE ) );
|
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, R_GetBuiltinTexture( REF_WHITE_TEXTURE ) );
|
||||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2387,8 +2387,8 @@ void Con_VidInit( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// missed console image will be replaced as gray background like X-Ray or Crysis
|
// missed console image will be replaced as gray background like X-Ray or Crysis
|
||||||
if( con.background == ref.dllFuncs.R_GetBuiltinTexture( REF_DEFAULT_TEXTURE ) || con.background == 0 )
|
if( con.background == R_GetBuiltinTexture( REF_DEFAULT_TEXTURE ) || con.background == 0 )
|
||||||
con.background = ref.dllFuncs.R_GetBuiltinTexture( REF_GRAY_TEXTURE );
|
con.background = R_GetBuiltinTexture( REF_GRAY_TEXTURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -34,8 +34,9 @@ extern ref_globals_t refState;
|
|||||||
// handy API wrappers
|
// handy API wrappers
|
||||||
void R_GetTextureParms( int *w, int *h, int texnum );
|
void R_GetTextureParms( int *w, int *h, int texnum );
|
||||||
#define REF_GET_PARM( parm, arg ) ref.dllFuncs.RefGetParm( (parm), (arg) )
|
#define REF_GET_PARM( parm, arg ) ref.dllFuncs.RefGetParm( (parm), (arg) )
|
||||||
#define GL_LoadTextureInternal( name, pic, flags ) ref.dllFuncs.GL_LoadTextureFromBuffer( name, pic, flags, false )
|
#define GL_LoadTextureInternal( name, pic, flags ) ref.dllFuncs.GL_LoadTextureFromBuffer( (name), (pic), (flags), false )
|
||||||
#define GL_UpdateTextureInternal( name, pic, flags ) ref.dllFuncs.GL_LoadTextureFromBuffer( name, pic, flags, true )
|
#define GL_UpdateTextureInternal( name, pic, flags ) ref.dllFuncs.GL_LoadTextureFromBuffer( (name), (pic), (flags), true )
|
||||||
|
#define R_GetBuiltinTexture( name ) ref.dllFuncs.GL_LoadTexture( (name), 0, 0, 0 )
|
||||||
|
|
||||||
int GL_RenderFrame( const struct ref_viewpass_s *rvp );
|
int GL_RenderFrame( const struct ref_viewpass_s *rvp );
|
||||||
|
|
||||||
|
@ -1803,8 +1803,8 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
|
|||||||
// release old sky layers first
|
// release old sky layers first
|
||||||
if( !Host_IsDedicated() )
|
if( !Host_IsDedicated() )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.R_FreeSharedTexture( REF_ALPHASKY_TEXTURE );
|
ref.dllFuncs.GL_FreeTexture( R_GetBuiltinTexture( REF_ALPHASKY_TEXTURE ));
|
||||||
ref.dllFuncs.R_FreeSharedTexture( REF_SOLIDSKY_TEXTURE );
|
ref.dllFuncs.GL_FreeTexture( R_GetBuiltinTexture( REF_SOLIDSKY_TEXTURE ));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1832,7 +1832,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
|
|||||||
#ifndef XASH_DEDICATED
|
#ifndef XASH_DEDICATED
|
||||||
if( !Host_IsDedicated() )
|
if( !Host_IsDedicated() )
|
||||||
{
|
{
|
||||||
tx->gl_texturenum = ref.dllFuncs.R_GetBuiltinTexture( REF_DEFAULT_TEXTURE );
|
tx->gl_texturenum = R_GetBuiltinTexture( REF_DEFAULT_TEXTURE );
|
||||||
tx->width = tx->height = 16;
|
tx->width = tx->height = 16;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1882,8 +1882,8 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
|
|||||||
{
|
{
|
||||||
ref.dllFuncs.R_InitSkyClouds( mt, tx, custom_palette ); // load quake sky
|
ref.dllFuncs.R_InitSkyClouds( mt, tx, custom_palette ); // load quake sky
|
||||||
|
|
||||||
if( ref.dllFuncs.R_GetBuiltinTexture( REF_SOLIDSKY_TEXTURE ) &&
|
if( R_GetBuiltinTexture( REF_SOLIDSKY_TEXTURE ) &&
|
||||||
ref.dllFuncs.R_GetBuiltinTexture( REF_ALPHASKY_TEXTURE ) )
|
R_GetBuiltinTexture( REF_ALPHASKY_TEXTURE ) )
|
||||||
SetBits( world.flags, FWORLD_SKYSPHERE );
|
SetBits( world.flags, FWORLD_SKYSPHERE );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1928,7 +1928,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
|
|||||||
{
|
{
|
||||||
if( host.type != HOST_DEDICATED )
|
if( host.type != HOST_DEDICATED )
|
||||||
Con_DPrintf( S_ERROR "unable to find %s.mip\n", mt->name );
|
Con_DPrintf( S_ERROR "unable to find %s.mip\n", mt->name );
|
||||||
tx->gl_texturenum = ref.dllFuncs.R_GetBuiltinTexture( REF_DEFAULT_TEXTURE );
|
tx->gl_texturenum = R_GetBuiltinTexture( REF_DEFAULT_TEXTURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for luma texture
|
// check for luma texture
|
||||||
|
@ -124,14 +124,13 @@ enum // r_speeds counters
|
|||||||
RS_ACTIVE_TENTS = 0,
|
RS_ACTIVE_TENTS = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ref_shared_texture_e
|
// refdll must expose this default textures using this names
|
||||||
{
|
#define REF_DEFAULT_TEXTURE "*default"
|
||||||
REF_DEFAULT_TEXTURE,
|
#define REF_GRAY_TEXTURE "*gray"
|
||||||
REF_GRAY_TEXTURE,
|
#define REF_WHITE_TEXTURE "*white"
|
||||||
REF_WHITE_TEXTURE,
|
#define REF_BLACK_TEXTURE "*black"
|
||||||
REF_SOLIDSKY_TEXTURE,
|
#define REF_SOLIDSKY_TEXTURE "solid_sky"
|
||||||
REF_ALPHASKY_TEXTURE,
|
#define REF_ALPHASKY_TEXTURE "alpha_sky"
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum connstate_e
|
typedef enum connstate_e
|
||||||
{
|
{
|
||||||
@ -472,8 +471,6 @@ typedef struct ref_interface_s
|
|||||||
// texture management
|
// texture management
|
||||||
const byte *(*R_GetTextureOriginalBuffer)( unsigned int idx ); // not always available
|
const byte *(*R_GetTextureOriginalBuffer)( unsigned int idx ); // not always available
|
||||||
int (*GL_LoadTextureFromBuffer)( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update );
|
int (*GL_LoadTextureFromBuffer)( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update );
|
||||||
int (*R_GetBuiltinTexture)( enum ref_shared_texture_e type );
|
|
||||||
void (*R_FreeSharedTexture)( enum ref_shared_texture_e type );
|
|
||||||
void (*GL_ProcessTexture)( int texnum, float gamma, int topColor, int bottomColor );
|
void (*GL_ProcessTexture)( int texnum, float gamma, int topColor, int bottomColor );
|
||||||
void (*R_SetupSky)( const char *skyname );
|
void (*R_SetupSky)( const char *skyname );
|
||||||
|
|
||||||
|
@ -47,45 +47,6 @@ static const byte *R_GetTextureOriginalBuffer( unsigned int idx )
|
|||||||
return glt->original->buffer;
|
return glt->original->buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int R_GetBuiltinTexture( enum ref_shared_texture_e type )
|
|
||||||
{
|
|
||||||
switch( type )
|
|
||||||
{
|
|
||||||
case REF_DEFAULT_TEXTURE: return tr.defaultTexture;
|
|
||||||
case REF_GRAY_TEXTURE: return tr.grayTexture;
|
|
||||||
case REF_WHITE_TEXTURE: return tr.whiteTexture;
|
|
||||||
case REF_SOLIDSKY_TEXTURE: return tr.solidskyTexture;
|
|
||||||
case REF_ALPHASKY_TEXTURE: return tr.alphaskyTexture;
|
|
||||||
default: gEngfuncs.Host_Error( "R_GetBuiltinTexture: unsupported type %d\n", type );
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void R_FreeSharedTexture( enum ref_shared_texture_e type )
|
|
||||||
{
|
|
||||||
int num = 0;
|
|
||||||
|
|
||||||
switch( type )
|
|
||||||
{
|
|
||||||
case REF_SOLIDSKY_TEXTURE:
|
|
||||||
num = tr.solidskyTexture;
|
|
||||||
tr.solidskyTexture = 0;
|
|
||||||
break;
|
|
||||||
case REF_ALPHASKY_TEXTURE:
|
|
||||||
num = tr.alphaskyTexture;
|
|
||||||
tr.alphaskyTexture = 0;
|
|
||||||
break;
|
|
||||||
case REF_DEFAULT_TEXTURE:
|
|
||||||
case REF_GRAY_TEXTURE:
|
|
||||||
case REF_WHITE_TEXTURE:
|
|
||||||
gEngfuncs.Host_Error( "R_FreeSharedTexture: invalid type %d\n", type );
|
|
||||||
default: gEngfuncs.Host_Error( "R_FreeSharedTexture: unsupported type %d\n", type );
|
|
||||||
}
|
|
||||||
|
|
||||||
GL_FreeTexture( num );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
CL_FillRGBA
|
CL_FillRGBA
|
||||||
@ -413,8 +374,6 @@ ref_interface_t gReffuncs =
|
|||||||
|
|
||||||
R_GetTextureOriginalBuffer,
|
R_GetTextureOriginalBuffer,
|
||||||
GL_LoadTextureFromBuffer,
|
GL_LoadTextureFromBuffer,
|
||||||
R_GetBuiltinTexture,
|
|
||||||
R_FreeSharedTexture,
|
|
||||||
GL_ProcessTexture,
|
GL_ProcessTexture,
|
||||||
R_SetupSky,
|
R_SetupSky,
|
||||||
|
|
||||||
|
@ -1910,7 +1910,7 @@ static void GL_CreateInternalTextures( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.defaultTexture = GL_LoadTextureInternal( "*default", pic, TF_COLORMAP );
|
tr.defaultTexture = GL_LoadTextureInternal( REF_DEFAULT_TEXTURE, pic, TF_COLORMAP );
|
||||||
|
|
||||||
// particle texture from quake1
|
// particle texture from quake1
|
||||||
pic = GL_FakeImage( 16, 16, 1, IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA );
|
pic = GL_FakeImage( 16, 16, 1, IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA );
|
||||||
@ -1934,19 +1934,19 @@ static void GL_CreateInternalTextures( void )
|
|||||||
pic = GL_FakeImage( 4, 4, 1, IMAGE_HAS_COLOR );
|
pic = GL_FakeImage( 4, 4, 1, IMAGE_HAS_COLOR );
|
||||||
for( x = 0; x < 16; x++ )
|
for( x = 0; x < 16; x++ )
|
||||||
((uint *)pic->buffer)[x] = 0xFFFFFFFF;
|
((uint *)pic->buffer)[x] = 0xFFFFFFFF;
|
||||||
tr.whiteTexture = GL_LoadTextureInternal( "*white", pic, TF_COLORMAP );
|
tr.whiteTexture = GL_LoadTextureInternal( REF_WHITE_TEXTURE, pic, TF_COLORMAP );
|
||||||
|
|
||||||
// gray texture
|
// gray texture
|
||||||
pic = GL_FakeImage( 4, 4, 1, IMAGE_HAS_COLOR );
|
pic = GL_FakeImage( 4, 4, 1, IMAGE_HAS_COLOR );
|
||||||
for( x = 0; x < 16; x++ )
|
for( x = 0; x < 16; x++ )
|
||||||
((uint *)pic->buffer)[x] = 0xFF7F7F7F;
|
((uint *)pic->buffer)[x] = 0xFF7F7F7F;
|
||||||
tr.grayTexture = GL_LoadTextureInternal( "*gray", pic, TF_COLORMAP );
|
tr.grayTexture = GL_LoadTextureInternal( REF_GRAY_TEXTURE, pic, TF_COLORMAP );
|
||||||
|
|
||||||
// black texture
|
// black texture
|
||||||
pic = GL_FakeImage( 4, 4, 1, IMAGE_HAS_COLOR );
|
pic = GL_FakeImage( 4, 4, 1, IMAGE_HAS_COLOR );
|
||||||
for( x = 0; x < 16; x++ )
|
for( x = 0; x < 16; x++ )
|
||||||
((uint *)pic->buffer)[x] = 0xFF000000;
|
((uint *)pic->buffer)[x] = 0xFF000000;
|
||||||
tr.blackTexture = GL_LoadTextureInternal( "*black", pic, TF_COLORMAP );
|
tr.blackTexture = GL_LoadTextureInternal( REF_BLACK_TEXTURE, pic, TF_COLORMAP );
|
||||||
|
|
||||||
// cinematic dummy
|
// cinematic dummy
|
||||||
pic = GL_FakeImage( 640, 100, 1, IMAGE_HAS_COLOR );
|
pic = GL_FakeImage( 640, 100, 1, IMAGE_HAS_COLOR );
|
||||||
|
@ -716,7 +716,7 @@ void R_InitSkyClouds( mip_t *mt, texture_t *tx, qboolean custom_palette )
|
|||||||
r_temp.palette = NULL;
|
r_temp.palette = NULL;
|
||||||
|
|
||||||
// load it in
|
// load it in
|
||||||
tr.solidskyTexture = GL_LoadTextureInternal( "solid_sky", &r_temp, TF_NOMIPMAP );
|
tr.solidskyTexture = GL_LoadTextureInternal( REF_SOLIDSKY_TEXTURE, &r_temp, TF_NOMIPMAP );
|
||||||
|
|
||||||
for( i = 0; i < r_sky->width >> 1; i++ )
|
for( i = 0; i < r_sky->width >> 1; i++ )
|
||||||
{
|
{
|
||||||
@ -739,7 +739,7 @@ void R_InitSkyClouds( mip_t *mt, texture_t *tx, qboolean custom_palette )
|
|||||||
r_temp.flags = IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA;
|
r_temp.flags = IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA;
|
||||||
|
|
||||||
// load it in
|
// load it in
|
||||||
tr.alphaskyTexture = GL_LoadTextureInternal( "alpha_sky", &r_temp, TF_NOMIPMAP );
|
tr.alphaskyTexture = GL_LoadTextureInternal( REF_ALPHASKY_TEXTURE, &r_temp, TF_NOMIPMAP );
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
gEngfuncs.FS_FreeImage( r_sky );
|
gEngfuncs.FS_FreeImage( r_sky );
|
||||||
|
Loading…
Reference in New Issue
Block a user