ref_gl: use GoldSrc particle texture

This commit is contained in:
Alibek Omarov 2022-01-27 03:32:21 +03:00
parent 0fa1b4f944
commit 0891356ec5
1 changed files with 19 additions and 9 deletions

View File

@ -22,6 +22,19 @@ static gl_texture_t gl_textures[MAX_TEXTURES];
static gl_texture_t* gl_texturesHashTable[TEXTURES_HASH_SIZE]; static gl_texture_t* gl_texturesHashTable[TEXTURES_HASH_SIZE];
static uint gl_numTextures; static uint gl_numTextures;
static byte dottexture[8][8] =
{
{0,1,1,0,0,0,0,0},
{1,1,1,1,0,0,0,0},
{1,1,1,1,0,0,0,0},
{0,1,1,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
};
#define IsLightMap( tex ) ( FBitSet(( tex )->flags, TF_ATLAS_PAGE )) #define IsLightMap( tex ) ( FBitSet(( tex )->flags, TF_ATLAS_PAGE ))
/* /*
================= =================
@ -1986,18 +1999,15 @@ static void GL_CreateInternalTextures( void )
tr.defaultTexture = GL_LoadTextureInternal( REF_DEFAULT_TEXTURE, 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( 8, 8, 1, IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA );
for( x = 0; x < 16; x++ ) for( x = 0; x < 8; x++ )
{ {
dx2 = x - 8; for( y = 0; y < 8; y++ )
dx2 = dx2 * dx2;
for( y = 0; y < 16; y++ )
{ {
dy = y - 8; if( dottexture[x][y] )
d = 255 - 35 * sqrt( dx2 + dy * dy ); pic->buffer[( y * 8 + x ) * 4 + 3] = 255;
pic->buffer[( y * 16 + x ) * 4 + 3] = bound( 0, d, 255 ); else pic->buffer[( y * 8 + x ) * 4 + 3] = 0;
} }
} }