mirror of
https://git.code.sf.net/p/quake/nuq
synced 2025-02-14 16:10:50 +00:00
*** empty log message ***
This commit is contained in:
parent
d2708c4bc1
commit
18aa60183d
1 changed files with 33 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
r_part.c
|
gl_part.c
|
||||||
|
|
||||||
@description@
|
OpenGL particle rendering
|
||||||
|
|
||||||
Copyright (C) 1996-1997 Id Software, Inc.
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
@ -58,9 +58,21 @@ void R_DrawParticles (void)
|
||||||
vec3_t up, right;
|
vec3_t up, right;
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
|
unsigned char *at;
|
||||||
|
unsigned char theAlpha;
|
||||||
|
qboolean alphaTestEnabled;
|
||||||
|
qboolean blendEnabled;
|
||||||
|
|
||||||
glBindTexture (GL_TEXTURE_2D, particletexture);
|
glBindTexture (GL_TEXTURE_2D, particletexture);
|
||||||
glEnable (GL_BLEND);
|
// LordHavoc: particles should not affect zbuffer
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glDepthMask (0);
|
||||||
|
|
||||||
|
if (!(blendEnabled = glIsEnabled (GL_BLEND))) {
|
||||||
|
glEnable (GL_BLEND);
|
||||||
|
}
|
||||||
|
if ((alphaTestEnabled = glIsEnabled (GL_ALPHA_TEST))) {
|
||||||
|
glDisable (GL_ALPHA_TEST);
|
||||||
|
}
|
||||||
glBegin (GL_TRIANGLES);
|
glBegin (GL_TRIANGLES);
|
||||||
|
|
||||||
VectorScale (vup, 1.5, up);
|
VectorScale (vup, 1.5, up);
|
||||||
|
@ -71,7 +83,7 @@ void R_DrawParticles (void)
|
||||||
time2 = frametime * 10; // 15;
|
time2 = frametime * 10; // 15;
|
||||||
time1 = frametime * 5;
|
time1 = frametime * 5;
|
||||||
grav = frametime * sv_gravity->value * 0.05;
|
grav = frametime * sv_gravity->value * 0.05;
|
||||||
dvel = 4*frametime;
|
dvel = frametime * 4;
|
||||||
|
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
|
@ -108,7 +120,15 @@ void R_DrawParticles (void)
|
||||||
scale = 1;
|
scale = 1;
|
||||||
else
|
else
|
||||||
scale = 1 + scale * 0.004;
|
scale = 1 + scale * 0.004;
|
||||||
glColor3ubv ((byte *)&d_8to24table[(int)p->color]);
|
at = (byte *)&d_8to24table[(int)p->color];
|
||||||
|
if (p->type==pt_fire)
|
||||||
|
theAlpha = 255*(6-p->ramp)/6;
|
||||||
|
else
|
||||||
|
theAlpha = 255;
|
||||||
|
if (lighthalf)
|
||||||
|
glColor4ub((byte) ((int) at[0] >> 1), (byte) ((int) at[1] >> 1), (byte) ((int) at[2] >> 1), theAlpha);
|
||||||
|
else
|
||||||
|
glColor4ub(at[0], at[1], at[2], theAlpha);
|
||||||
glTexCoord2f (0,0);
|
glTexCoord2f (0,0);
|
||||||
glVertex3fv (p->org);
|
glVertex3fv (p->org);
|
||||||
glTexCoord2f (1,0);
|
glTexCoord2f (1,0);
|
||||||
|
@ -179,8 +199,13 @@ void R_DrawParticles (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnd ();
|
glEnd ();
|
||||||
glDisable (GL_BLEND);
|
if (alphaTestEnabled) {
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glEnable (GL_ALPHA_TEST);
|
||||||
|
}
|
||||||
|
if (!blendEnabled) {
|
||||||
|
glDisable (GL_BLEND);
|
||||||
|
}
|
||||||
|
glDepthMask (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue