Convert particles to use byte colors instead of float. Roughly breaks even on Mesa on my machine. Should be a speedup under other drivers.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-09-14 12:11:54 +00:00
parent a474c7ad2f
commit 431ac4eedb
6 changed files with 18 additions and 19 deletions

View file

@ -81,7 +81,7 @@ QFGL_DONT_NEED (void, glColor4i, (GLint red, GLint green, GLint blue, GLint alph
QFGL_DONT_NEED (void, glColor4iv, (const GLint * v));
QFGL_DONT_NEED (void, glColor4s, (GLshort red, GLshort green, GLshort blue, GLshort alpha));
QFGL_DONT_NEED (void, glColor4sv, (const GLshort * v));
QFGL_DONT_NEED (void, glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha));
QFGL_NEED (void, glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha));
QFGL_NEED (void, glColor4ubv, (const GLubyte * v));
QFGL_DONT_NEED (void, glColor4ui, (GLuint red, GLuint green, GLuint blue, GLuint alpha));
QFGL_DONT_NEED (void, glColor4uiv, (const GLuint * v));

View file

@ -59,6 +59,6 @@ typedef struct varray_t2f_c4f_n3f_v3f_s {
} varray_t2f_c4f_n3f_v3f_t;
#define MAX_VARRAY_VERTS 10000
extern varray_t2f_c4f_v3f_t varray[MAX_VARRAY_VERTS];
extern varray_t2f_c4ub_v3f_t varray[MAX_VARRAY_VERTS];
#endif // __qf_varrays_h

View file

@ -608,7 +608,7 @@ void
Draw_FadeScreen (void)
{
qfglDisable (GL_TEXTURE_2D);
qfglColor4f (0, 0, 0, 0.7);
qfglColor4ub (0, 0, 0, 179);
qfglBegin (GL_QUADS);
qfglVertex2f (0, 0);

View file

@ -655,12 +655,12 @@ R_VoorTrail (entity_t *ent)
void
R_DrawParticles (void)
{
byte alpha, i;
unsigned char *at;
float dvel, grav, fast_grav, minparticledist, scale;
int activeparticles, maxparticle, j, k;
particle_t *part;
vec3_t up_scale, right_scale, up_right_scale, down_right_scale;
byte i;
unsigned char *at;
float dvel, grav, fast_grav, minparticledist, scale;
int activeparticles, maxparticle, j, k;
particle_t *part;
vec3_t up_scale, right_scale, up_right_scale, down_right_scale;
if (!r_particles->int_val)
return;
@ -697,12 +697,11 @@ R_DrawParticles (void)
// Note, we must still do physics and such on them.
if (!(DotProduct (part->org, vpn) < minparticledist)) {
at = (byte *) & d_8to24table[(byte) part->color];
alpha = part->alpha;
varray[0].color[0] = (float) at[0] / 255;
varray[0].color[1] = (float) at[1] / 255;
varray[0].color[2] = (float) at[2] / 255;
varray[0].color[3] = (float) alpha / 255;
varray[0].color[0] = at[0];
varray[0].color[1] = at[1];
varray[0].color[2] = at[2];
varray[0].color[3] = part->alpha;
memcpy(varray[1].color, varray[0].color, sizeof(varray[0].color));
memcpy(varray[2].color, varray[0].color, sizeof(varray[0].color));

View file

@ -57,7 +57,7 @@
#include "r_local.h"
#include "varrays.h"
varray_t2f_c4f_v3f_t varray[MAX_VARRAY_VERTS];
varray_t2f_c4ub_v3f_t varray[MAX_VARRAY_VERTS];
qboolean VID_Is8bit (void);
void R_InitBubble (void);
@ -169,7 +169,7 @@ R_Init (void)
// qfglInterleavedArrays(GL_T2F_C4F_N3F_V3F, 0, varray);
qfglTexCoordPointer (2, GL_FLOAT, sizeof(varray[0]), varray[0].texcoord);
qfglColorPointer (4, GL_FLOAT, sizeof(varray[0]), varray[0].color);
qfglColorPointer (4, GL_UNSIGNED_BYTE, sizeof(varray[0]), varray[0].color);
qfglVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex);
}

View file

@ -793,7 +793,7 @@ R_DrawSkyChain (msurface_t *sky_chain)
#if 0
qfglDisable (GL_TEXTURE_2D);
sc = sky_chain;
qfglColor3f (1, 1, 1);
qfglColor3ubv (255, 255, 255);
while (sc) {
glpoly_t *p = sc->polys;
while (p) {
@ -808,7 +808,7 @@ R_DrawSkyChain (msurface_t *sky_chain)
sc = sc->texturechain;
}
sc = sky_chain;
qfglColor3f (0, 1, 0);
qfglColor3ubv (0, 255, 0);
qfglBegin (GL_POINTS);
while (sc) {
glpoly_t *p = sc->polys;
@ -829,7 +829,7 @@ R_DrawSkyChain (msurface_t *sky_chain)
qfglEnd ();
if (skyloaded) {
int i, j;
qfglColor3f (1, 0, 0);
qfglColor3ubv (255, 0, 0);
for (i = 0; i < 6; i++) {
vec3_t v;
qfglBegin (GL_LINE_LOOP);