mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-02-17 01:11:18 +00:00
improved beams
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@626 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
933cd63cd3
commit
2af9590002
1 changed files with 102 additions and 2 deletions
|
@ -1503,6 +1503,8 @@ int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum)
|
|||
j = 0;
|
||||
m = 0;
|
||||
break;
|
||||
default: //others don't need intitialisation
|
||||
break;
|
||||
}
|
||||
|
||||
// particle spawning loop
|
||||
|
@ -1720,6 +1722,8 @@ int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum)
|
|||
VectorSubtract(ofsvec, arsvec, bfirst->dir);
|
||||
VectorNormalize(bfirst->dir);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
b->flags |= BS_NODRAW;
|
||||
|
@ -2022,6 +2026,12 @@ int R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
|||
{
|
||||
stop = ts->lastdist + len; //when to stop
|
||||
len = ts->lastdist;
|
||||
|
||||
if (!len)
|
||||
{
|
||||
len = particletime;
|
||||
stop += len;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2389,7 +2399,7 @@ void GL_DrawTexturedParticle(particle_t *p, part_type_t *type)
|
|||
glShadeModel(GL_FLAT);
|
||||
glBegin(GL_QUADS);
|
||||
}
|
||||
|
||||
|
||||
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];
|
||||
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
||||
|
@ -2423,6 +2433,61 @@ void GL_DrawTexturedParticle(particle_t *p, part_type_t *type)
|
|||
glVertex3f (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]);
|
||||
}
|
||||
|
||||
|
||||
void GL_DrawSketchParticle(particle_t *p, part_type_t *type)
|
||||
{
|
||||
float x,y;
|
||||
float scale;
|
||||
|
||||
int quant;
|
||||
|
||||
if (lasttype != type)
|
||||
{
|
||||
lasttype = type;
|
||||
glEnd();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
GL_Bind(type->texturenum);
|
||||
// if (type->blendmode == BM_ADD) //addative
|
||||
// glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
// else if (type->blendmode == BM_SUBTRACT) //subtractive
|
||||
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
// else
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glBegin(GL_LINES);
|
||||
}
|
||||
|
||||
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];
|
||||
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
||||
if (scale < 20)
|
||||
scale = 0.25;
|
||||
else
|
||||
scale = 0.25 + scale * 0.001;
|
||||
|
||||
glColor4f ( p->rgb[0]/2,
|
||||
p->rgb[1]/2,
|
||||
p->rgb[2]/2,
|
||||
p->alpha*2);
|
||||
|
||||
quant = scale;
|
||||
|
||||
if (p->angle)
|
||||
{
|
||||
x = sin(p->angle)*scale;
|
||||
y = cos(p->angle)*scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = scale;
|
||||
}
|
||||
glVertex3f (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]);
|
||||
glVertex3f (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]);
|
||||
glVertex3f (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]);
|
||||
glVertex3f (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]);
|
||||
}
|
||||
|
||||
void GL_DrawTrifanParticle(particle_t *p, part_type_t *type)
|
||||
{
|
||||
int i;
|
||||
|
@ -2508,6 +2573,37 @@ void GL_DrawSparkedParticle(particle_t *p, part_type_t *type)
|
|||
|
||||
}
|
||||
|
||||
void GL_DrawSketchSparkParticle(particle_t *p, part_type_t *type)
|
||||
{
|
||||
if (lasttype != type)
|
||||
{
|
||||
lasttype = type;
|
||||
glEnd();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
GL_Bind(type->texturenum);
|
||||
if (type->blendmode == BM_ADD) //addative
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
// else if (type->blendmode == BM_SUBTRACT) //subtractive
|
||||
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
else
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glBegin(GL_LINES);
|
||||
}
|
||||
|
||||
glColor4f ( p->rgb[0],
|
||||
p->rgb[1],
|
||||
p->rgb[2],
|
||||
p->alpha);
|
||||
glVertex3f (p->org[0], p->org[1], p->org[2]);
|
||||
|
||||
glColor4f ( p->rgb[0],
|
||||
p->rgb[1],
|
||||
p->rgb[2],
|
||||
0);
|
||||
glVertex3f (p->org[0]-p->vel[0]/10, p->org[1]-p->vel[1]/10, p->org[2]-p->vel[2]/10);
|
||||
}
|
||||
|
||||
void GL_DrawParticleBeam_Textured(beamseg_t *b, part_type_t *type)
|
||||
{
|
||||
vec3_t v, point;
|
||||
|
@ -2738,6 +2834,7 @@ void SWD_DrawParticleBlob(particle_t *p, part_type_t *type)
|
|||
D_DrawParticleTrans(p);
|
||||
}
|
||||
#endif
|
||||
|
||||
void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void sparkparticles(particle_t*,part_type_t*), void beamparticlest(beamseg_t*,part_type_t*), void beamparticlesut(beamseg_t*,part_type_t*))
|
||||
{
|
||||
qboolean (*tr) (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal);
|
||||
|
@ -3103,6 +3200,7 @@ void R_DrawParticles (void)
|
|||
#if defined(RGLQUAKE)
|
||||
if (qrenderer == QR_OPENGL)
|
||||
{
|
||||
extern cvar_t r_drawflat;
|
||||
glDepthMask(0);
|
||||
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
|
@ -3112,7 +3210,9 @@ void R_DrawParticles (void)
|
|||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
if (gl_part_trifansparks.value)
|
||||
if (r_drawflat.value == 2)
|
||||
DrawParticleTypes(GL_DrawSketchParticle, GL_DrawSketchSparkParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured);//GL_DrawParticleBeam_Sketched, GL_DrawParticleBeam_Sketched);
|
||||
else if (gl_part_trifansparks.value)
|
||||
DrawParticleTypes(GL_DrawTexturedParticle, GL_DrawTrifanParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured);
|
||||
else
|
||||
DrawParticleTypes(GL_DrawTexturedParticle, GL_DrawSparkedParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured);
|
||||
|
|
Loading…
Reference in a new issue