Minor speedup to particles, by not copying around redundant information.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-12-31 21:54:10 +00:00
parent d40e209c3e
commit b6acf44cbd
2 changed files with 8 additions and 7 deletions

View File

@ -347,7 +347,7 @@ void GL_TextureSolidMode( char *string );
/* /*
** GL extension emulation functions ** GL extension emulation functions
*/ */
void GL_DrawParticles( int n, const particle_t particles[], const unsigned colortable[768] ); void GL_DrawParticles (void);
/* /*
** GL config stuff ** GL config stuff

View File

@ -409,7 +409,7 @@ void R_DrawEntitiesOnList (void)
** GL_DrawParticles ** GL_DrawParticles
** **
*/ */
void GL_DrawParticles( int num_particles, const particle_t particles[], const unsigned colortable[768] ) void GL_DrawParticles (void)
{ {
const particle_t *p; const particle_t *p;
int i; int i;
@ -426,7 +426,8 @@ void GL_DrawParticles( int num_particles, const particle_t particles[], const un
VectorScale (vup, 1.5, up); VectorScale (vup, 1.5, up);
VectorScale (vright, 1.5, right); VectorScale (vright, 1.5, right);
for ( p = particles, i=0 ; i < num_particles ; i++,p++) for (p = r_newrefdef.particles, i = 0; i < r_newrefdef.num_particles;
i++, p++)
{ {
// hack a scale up to keep particles from disapearing // hack a scale up to keep particles from disapearing
scale = ( p->origin[0] - r_origin[0] ) * vpn[0] + scale = ( p->origin[0] - r_origin[0] ) * vpn[0] +
@ -438,7 +439,7 @@ void GL_DrawParticles( int num_particles, const particle_t particles[], const un
else else
scale = 1 + scale * 0.004; scale = 1 + scale * 0.004;
*(int *)color = colortable[p->color]; *(int *)color = d_8to24table[p->color];
color[3] = p->alpha*255; color[3] = p->alpha*255;
qglColor4ubv( color ); qglColor4ubv( color );
@ -503,7 +504,7 @@ void R_DrawParticles (void)
} }
else else
{ {
GL_DrawParticles( r_newrefdef.num_particles, r_newrefdef.particles, d_8to24table ); GL_DrawParticles ();
} }
} }
@ -1496,8 +1497,8 @@ void R_BeginFrame( float camera_separation )
qglDisable (GL_BLEND); qglDisable (GL_BLEND);
qglEnable (GL_ALPHA_TEST); qglEnable (GL_ALPHA_TEST);
qglDisable (GL_TEXTURE_2D); //WTF? why do I need to toggle this? // qglDisable (GL_TEXTURE_2D); //WTF? why do I need to toggle this?
qglEnable (GL_TEXTURE_2D); // qglEnable (GL_TEXTURE_2D);
qglColor4f (1,1,1,1); qglColor4f (1,1,1,1);
/* /*