New generated texture for spark particles.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-04-06 04:27:39 +00:00
parent b7ee9ba07d
commit 1f25ab9ec2
3 changed files with 47 additions and 15 deletions

View File

@ -80,8 +80,9 @@ extern qboolean lighthalf;
extern cvar_t *cl_max_particles;
extern int part_tex_smoke[8];
extern int part_tex_dot;
extern int part_tex_spark;
extern int part_tex_smoke[8];
int ramp[8] = { 0x6d, 0x6b, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
@ -282,7 +283,7 @@ R_RunSparkEffect (vec3_t org, int count, int ofuzz)
(ofuzz / 8) * .75, vec3_origin, cl.time + 99,
12 + (rand () & 3), 96);
while (count--)
particle_new_random (pt_fallfadespark, part_tex_dot, org, ofuzz * .75,
particle_new_random (pt_fallfadespark, part_tex_spark, org, ofuzz * .75,
1, 96, cl.time + 5, ramp[rand () % 6],
lhrandom (0, 255));
}
@ -444,7 +445,7 @@ R_TeleportSplash (vec3_t org)
VectorNormalize (dir);
vel = 50 + (rand () & 63);
VectorScale (dir, vel, pvel);
particle_new (pt_grav, part_tex_dot, porg, 0.6, pvel,
particle_new (pt_grav, part_tex_spark, porg, 0.6, pvel,
(cl.time + 0.2 + (rand () & 7) * 0.02),
(7 + (rand () & 7)), 255);
}

View File

@ -38,15 +38,18 @@ extern void noise_diamondsquare(unsigned char *noise, int size);
extern void noise_plasma(unsigned char *noise, int size);
static void GDT_InitDotParticleTexture (void);
static void GDT_InitSparkParticleTexture (void);
static void GDT_InitSmokeParticleTexture (void);
int part_tex_smoke[8];
int part_tex_dot;
int part_tex_spark;
int part_tex_smoke[8];
void
GDT_Init (void)
{
GDT_InitDotParticleTexture ();
GDT_InitSparkParticleTexture ();
GDT_InitSmokeParticleTexture ();
}
@ -56,18 +59,12 @@ GDT_InitDotParticleTexture (void)
int x, y, dx2, dy, d;
byte data[16][16][2];
//
// particle texture
//
part_tex_dot = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, part_tex_dot);
for (x = 0; x < 16; x++) {
dx2 = x - 8;
dx2 *= dx2;
for (y = 0; y < 16; y++) {
dy = y - 8;
d = 255 - 4 * (dx2 + dy * dy);
d = 255 - 4 * (dx2 + (dy * dy));
if (d<=0) {
d = 0;
data[y][x][0] = 0;
@ -77,13 +74,47 @@ GDT_InitDotParticleTexture (void)
data[y][x][1] = (byte) d;
}
}
glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data);
part_tex_dot = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, part_tex_dot);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data);
}
static void
GDT_InitSparkParticleTexture (void)
{
int x, y, dx2, dy, d;
byte data[16][16][2];
for (x = 0; x < 16; x++) {
dx2 = 8 - abs(x - 8);
dx2 *= dx2;
for (y = 0; y < 16; y++) {
dy = 8 - abs(y - 8);
d = 3 * (dx2 + dy * dy) - 100;
if (d>255)
d = 255;
if (d<1) {
d = 0;
data[y][x][0] = 0;
} else
data[y][x][0] = 255;
data[y][x][1] = (byte) d;
}
}
part_tex_spark = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, part_tex_spark);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data);
}
static void
GDT_InitSmokeParticleTexture (void)
{

View File

@ -73,8 +73,8 @@ static glmode_t modes[] = {
{"GL_NEAREST", GL_NEAREST, GL_NEAREST},
{"GL_LINEAR", GL_LINEAR, GL_LINEAR},
{"GL_NEAREST_MIPMAP_NEAREST", GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST},
{"GL_LINEAR_MIPMAP_NEAREST", GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR},
{"GL_NEAREST_MIPMAP_LINEAR", GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST},
{"GL_LINEAR_MIPMAP_NEAREST", GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR},
{"GL_LINEAR_MIPMAP_LINEAR", GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR}
};