Tiny tiny boost.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3282 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
85f9b6bc0e
commit
fb2b58979b
1 changed files with 51 additions and 22 deletions
|
@ -55,6 +55,18 @@ static int pe_size2 = P_INVALID;
|
||||||
static int pe_size3 = P_INVALID;
|
static int pe_size3 = P_INVALID;
|
||||||
static int pe_defaulttrail = P_INVALID;
|
static int pe_defaulttrail = P_INVALID;
|
||||||
|
|
||||||
|
static float psintable[64];
|
||||||
|
|
||||||
|
static void buildsintable(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 64; i++)
|
||||||
|
psintable[i] = sin((i*M_PI)/32);
|
||||||
|
}
|
||||||
|
#define sin(x) (psintable[(int)(x*(64/M_PI)) & 63])
|
||||||
|
#define cos(x) (psintable[((int)(x*(64/M_PI)) + 16) & 63])
|
||||||
|
|
||||||
|
|
||||||
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
|
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
|
||||||
typedef struct particle_s
|
typedef struct particle_s
|
||||||
{
|
{
|
||||||
|
@ -1308,6 +1320,8 @@ static void PScript_InitParticles (void)
|
||||||
if (r_numparticles) //already inited
|
if (r_numparticles) //already inited
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
buildsintable();
|
||||||
|
|
||||||
i = COM_CheckParm ("-particles");
|
i = COM_CheckParm ("-particles");
|
||||||
|
|
||||||
if (i)
|
if (i)
|
||||||
|
@ -3202,6 +3216,8 @@ static void GL_DrawTexturedParticle(int count, particle_t **plist, plooks_t *typ
|
||||||
{
|
{
|
||||||
p = *plist++;
|
p = *plist++;
|
||||||
|
|
||||||
|
if (type->scalefactor == 1)
|
||||||
|
{
|
||||||
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
|
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
|
||||||
+ (p->org[2] - r_origin[2])*vpn[2];
|
+ (p->org[2] - r_origin[2])*vpn[2];
|
||||||
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
||||||
|
@ -3209,6 +3225,9 @@ static void GL_DrawTexturedParticle(int count, particle_t **plist, plooks_t *typ
|
||||||
scale = 0.25;
|
scale = 0.25;
|
||||||
else
|
else
|
||||||
scale = 0.25 + scale * 0.001;
|
scale = 0.25 + scale * 0.001;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
scale = 1;
|
||||||
|
|
||||||
qglColor4f (p->rgb[0],
|
qglColor4f (p->rgb[0],
|
||||||
p->rgb[1],
|
p->rgb[1],
|
||||||
|
@ -3219,12 +3238,7 @@ static void GL_DrawTexturedParticle(int count, particle_t **plist, plooks_t *typ
|
||||||
{
|
{
|
||||||
x = sin(p->angle)*scale;
|
x = sin(p->angle)*scale;
|
||||||
y = cos(p->angle)*scale;
|
y = cos(p->angle)*scale;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x = 0;
|
|
||||||
y = scale;
|
|
||||||
}
|
|
||||||
qglTexCoord2f(p->s1,p->t1);
|
qglTexCoord2f(p->s1,p->t1);
|
||||||
qglVertex3f (p->org[0] - x*pright[0] - y*pup[0], p->org[1] - x*pright[1] - y*pup[1], p->org[2] - x*pright[2] - y*pup[2]);
|
qglVertex3f (p->org[0] - x*pright[0] - y*pup[0], p->org[1] - x*pright[1] - y*pup[1], p->org[2] - x*pright[2] - y*pup[2]);
|
||||||
qglTexCoord2f(p->s1,p->t2);
|
qglTexCoord2f(p->s1,p->t2);
|
||||||
|
@ -3234,6 +3248,18 @@ static void GL_DrawTexturedParticle(int count, particle_t **plist, plooks_t *typ
|
||||||
qglTexCoord2f(p->s2,p->t1);
|
qglTexCoord2f(p->s2,p->t1);
|
||||||
qglVertex3f (p->org[0] + y*pright[0] - x*pup[0], p->org[1] + y*pright[1] - x*pup[1], p->org[2] + y*pright[2] - x*pup[2]);
|
qglVertex3f (p->org[0] + y*pright[0] - x*pup[0], p->org[1] + y*pright[1] - x*pup[1], p->org[2] + y*pright[2] - x*pup[2]);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qglTexCoord2f(p->s1,p->t1);
|
||||||
|
qglVertex3f (p->org[0] - scale*pup[0], p->org[1] - scale*pup[1], p->org[2] - scale*pup[2]);
|
||||||
|
qglTexCoord2f(p->s1,p->t2);
|
||||||
|
qglVertex3f (p->org[0] - scale*pright[0], p->org[1] - scale*pright[1], p->org[2] - scale*pright[2]);
|
||||||
|
qglTexCoord2f(p->s2,p->t2);
|
||||||
|
qglVertex3f (p->org[0] + scale*pup[0], p->org[1] + scale*pup[1], p->org[2] + scale*pup[2]);
|
||||||
|
qglTexCoord2f(p->s2,p->t1);
|
||||||
|
qglVertex3f (p->org[0] + scale*pright[0], p->org[1] + scale*pright[1], p->org[2] + scale*pright[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
qglEnd();
|
qglEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3279,17 +3305,20 @@ static void GL_DrawSketchParticle(int count, particle_t **plist, plooks_t *type)
|
||||||
{
|
{
|
||||||
x = sin(p->angle)*scale;
|
x = sin(p->angle)*scale;
|
||||||
y = cos(p->angle)*scale;
|
y = cos(p->angle)*scale;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x = 0;
|
|
||||||
y = scale;
|
|
||||||
}
|
|
||||||
qglVertex3f (p->org[0] - x*pright[0] - y*pup[0], p->org[1] - x*pright[1] - y*pup[1], p->org[2] - x*pright[2] - y*pup[2]);
|
qglVertex3f (p->org[0] - x*pright[0] - y*pup[0], p->org[1] - x*pright[1] - y*pup[1], p->org[2] - x*pright[2] - y*pup[2]);
|
||||||
qglVertex3f (p->org[0] + x*pright[0] + y*pup[0], p->org[1] + x*pright[1] + y*pup[1], p->org[2] + x*pright[2] + y*pup[2]);
|
qglVertex3f (p->org[0] + x*pright[0] + y*pup[0], p->org[1] + x*pright[1] + y*pup[1], p->org[2] + x*pright[2] + y*pup[2]);
|
||||||
qglVertex3f (p->org[0] + y*pright[0] - x*pup[0], p->org[1] + y*pright[1] - x*pup[1], p->org[2] + y*pright[2] - x*pup[2]);
|
qglVertex3f (p->org[0] + y*pright[0] - x*pup[0], p->org[1] + y*pright[1] - x*pup[1], p->org[2] + y*pright[2] - x*pup[2]);
|
||||||
qglVertex3f (p->org[0] - y*pright[0] + x*pup[0], p->org[1] - y*pright[1] + x*pup[1], p->org[2] - y*pright[2] + x*pup[2]);
|
qglVertex3f (p->org[0] - y*pright[0] + x*pup[0], p->org[1] - y*pright[1] + x*pup[1], p->org[2] - y*pright[2] + x*pup[2]);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qglVertex3f (p->org[0] - scale*pup[0], p->org[1] - scale*pup[1], p->org[2] - scale*pup[2]);
|
||||||
|
qglVertex3f (p->org[0] + scale*pup[0], p->org[1] + scale*pup[1], p->org[2] + scale*pup[2]);
|
||||||
|
qglVertex3f (p->org[0] + scale*pright[0], p->org[1] + scale*pright[1], p->org[2] + scale*pright[2]);
|
||||||
|
qglVertex3f (p->org[0] - scale*pright[0], p->org[1] - scale*pright[1], p->org[2] - scale*pright[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
qglEnd();
|
qglEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue