Dynamically generate particle texture. Even better looking, too!

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-01-24 07:36:36 +00:00
parent 37ba8cabb3
commit ee8cd32c0c

View file

@ -48,29 +48,10 @@ GDT_Init (void)
GDT_InitSmokeParticleTexture (); GDT_InitSmokeParticleTexture ();
} }
byte dottexture[16][16] = {
{0, 0, 0, 0, 56, 151, 217, 250, 250, 217, 151, 56, 0, 0, 0, 0},
{0, 0, 0, 151, 255, 255, 255, 255, 255, 255, 255, 255, 151, 0, 0, 0},
{0, 0, 184, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 184, 0, 0},
{0, 151, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 151, 0},
{56, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 56},
{151, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 151},
{217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 217},
{250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 250},
{250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 250},
{217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 217},
{151, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 151},
{56, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 56},
{0, 151, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 151, 0},
{0, 0, 184, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 184, 0, 0},
{0, 0, 0, 151, 255, 255, 255, 255, 255, 255, 255, 255, 151, 0, 0, 0},
{0, 0, 0, 0, 56, 151, 217, 250, 250, 217, 151, 56, 0, 0, 0, 0},
};
static void static void
GDT_InitDotParticleTexture (void) GDT_InitDotParticleTexture (void)
{ {
int x, y; int x, y, dx, dy, d;
byte data[16][16][4]; byte data[16][16][4];
// //
@ -84,7 +65,12 @@ GDT_InitDotParticleTexture (void)
data[y][x][0] = 244; data[y][x][0] = 244;
data[y][x][1] = 244; data[y][x][1] = 244;
data[y][x][2] = 244; data[y][x][2] = 244;
data[y][x][3] = dottexture[x][y]; dx = x - 8;
dy = y - 8;
d = 255 - 4 * (dx * dx + dy * dy);
if (d<0) d = 0;
if (d>255) d = 255;
data[y][x][3] = (byte) d;
} }
} }
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 16, 16, 0, GL_RGBA, glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 16, 16, 0, GL_RGBA,