header for renderparticles
parent
9d7c544b0e
commit
c0c30d37a6
|
@ -290,21 +290,6 @@ static inline model *loadmapmodel(int n)
|
|||
|
||||
static inline mapmodelinfo *getmminfo(int n) { return mapmodels.inrange(n) ? &mapmodels[n] : NULL; }
|
||||
|
||||
// renderparticles
|
||||
extern int particlelayers;
|
||||
|
||||
enum { PL_ALL = 0, PL_UNDER, PL_OVER, PL_NOLAYER };
|
||||
|
||||
extern void initparticles();
|
||||
extern void clearparticles();
|
||||
extern void clearparticleemitters();
|
||||
extern void seedparticles();
|
||||
extern void updateparticles();
|
||||
extern void debugparticles();
|
||||
extern void renderparticles(int layer = PL_ALL);
|
||||
extern bool printparticles(extentity &e, char *buf, int len);
|
||||
extern void cleanupparticles();
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "blend.hh"
|
||||
#include "movie.hh"
|
||||
#include "rendergl.hh"
|
||||
#include "renderparticles.hh"
|
||||
#include "rendersky.hh"
|
||||
#include "rendertext.hh"
|
||||
#include "renderva.hh"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "grass.hh"
|
||||
#include "material.hh"
|
||||
#include "rendergl.hh"
|
||||
#include "renderparticles.hh"
|
||||
#include "rendersky.hh"
|
||||
#include "renderva.hh"
|
||||
#include "texture.hh"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "material.hh"
|
||||
#include "pvs.hh"
|
||||
#include "rendergl.hh"
|
||||
#include "renderparticles.hh"
|
||||
#include "rendersky.hh"
|
||||
#include "rendertext.hh"
|
||||
#include "renderva.hh"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "material.hh"
|
||||
#include "pvs.hh"
|
||||
#include "rendergl.hh"
|
||||
#include "renderparticles.hh"
|
||||
#include "rendersky.hh"
|
||||
#include "renderva.hh"
|
||||
#include "stain.hh"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// renderparticles.cpp
|
||||
|
||||
#include "renderparticles.hh"
|
||||
#include "pvs.hh"
|
||||
#include "rendergl.hh"
|
||||
#include "rendertext.hh"
|
||||
|
@ -11,6 +12,39 @@
|
|||
|
||||
#include "engine.hh"
|
||||
|
||||
#if 0
|
||||
void regular_particle_flame(int type, const vec &p, float radius, float height, int color, int density = 3, float scale = 2.0f, float speed = 200.0f, float fade = 600.0f, int gravity = -15);
|
||||
void particle_splash(int type, int num, int fade, const vec &p, int color = 0xFFFFFF, float size = 1.0f, int radius = 150, int gravity = 2);
|
||||
void particle_trail(int type, int fade, const vec &from, const vec &to, int color = 0xFFFFFF, float size = 1.0f, int gravity = 20);
|
||||
void particle_text(const vec &s, const char *t, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
|
||||
void particle_icon(const vec &s, int ix, int iy, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
|
||||
void particle_meter(const vec &s, float val, int type, int fade = 1, int color = 0xFFFFFF, int color2 = 0xFFFFF, float size = 2.0f);
|
||||
void particle_flare(const vec &p, const vec &dest, int fade, int type, int color = 0xFFFFFF, float size = 0.28f, physent *owner = NULL);
|
||||
void particle_fireball(const vec &dest, float max, int type, int fade = -1, int color = 0xFFFFFF, float size = 4.0f);
|
||||
void removetrackedparticles(physent *owner = NULL);
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
PART_BLOOD = 0,
|
||||
PART_WATER,
|
||||
PART_SMOKE,
|
||||
PART_STEAM,
|
||||
PART_FLAME,
|
||||
PART_STREAK,
|
||||
PART_RAIL_TRAIL, PART_PULSE_SIDE, PART_PULSE_FRONT,
|
||||
PART_LIGHTNING,
|
||||
PART_EXPLOSION, PART_PULSE_BURST,
|
||||
PART_SPARK, PART_EDIT,
|
||||
PART_SNOW,
|
||||
PART_RAIL_MUZZLE_FLASH, PART_PULSE_MUZZLE_FLASH,
|
||||
PART_HUD_ICON,
|
||||
PART_HUD_ICON_GREY,
|
||||
PART_TEXT,
|
||||
PART_METER, PART_METER_VS,
|
||||
PART_LENS_FLARE
|
||||
};
|
||||
|
||||
Shader *particleshader = NULL, *particlenotextureshader = NULL, *particlesoftshader = NULL, *particletextshader = NULL;
|
||||
|
||||
VARP(particlelayers, 0, 1, 1);
|
||||
|
@ -86,7 +120,7 @@ void clearparticleemitters()
|
|||
regenemitters = true;
|
||||
}
|
||||
|
||||
void addparticleemitters()
|
||||
static void addparticleemitters()
|
||||
{
|
||||
emitters.setsize(0);
|
||||
const vector<extentity *> &ents = entities::getents();
|
||||
|
@ -903,10 +937,12 @@ void cleanupparticles()
|
|||
loopi(sizeof(parts)/sizeof(parts[0])) parts[i]->cleanup();
|
||||
}
|
||||
|
||||
void removetrackedparticles(physent *owner)
|
||||
#if 0
|
||||
static void removetrackedparticles(physent *owner)
|
||||
{
|
||||
loopi(sizeof(parts)/sizeof(parts[0])) parts[i]->resettracked(owner);
|
||||
}
|
||||
#endif
|
||||
|
||||
VARN(debugparticles, dbgparts, 0, 0, 1);
|
||||
|
||||
|
@ -1039,17 +1075,47 @@ static void regularsplash(int type, int color, int radius, int num, int fade, co
|
|||
splash(type, color, radius, num, fade, p, size, gravity);
|
||||
}
|
||||
|
||||
bool canaddparticles()
|
||||
static void regular_particle_splash(int type, int num, int fade, const vec &p, int color = 0xFFFFFF, float size = 1.0f, int radius = 150, int gravity = 2, int delay = 0);
|
||||
static void particle_textcopy(const vec &s, const char *t, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
|
||||
|
||||
static bool canaddparticles()
|
||||
{
|
||||
return !minimized;
|
||||
}
|
||||
|
||||
void regular_particle_splash(int type, int num, int fade, const vec &p, int color, float size, int radius, int gravity, int delay)
|
||||
static void regular_particle_splash(int type, int num, int fade, const vec &p, int color, float size, int radius, int gravity, int delay)
|
||||
{
|
||||
if(!canaddparticles()) return;
|
||||
regularsplash(type, color, radius, num, fade, p, size, gravity, delay);
|
||||
}
|
||||
|
||||
VARP(particletext, 0, 1, 1);
|
||||
VARP(maxparticletextdistance, 0, 128, 10000);
|
||||
|
||||
static void particle_textcopy(const vec &s, const char *t, int type, int fade, int color, float size, int gravity)
|
||||
{
|
||||
if(!canaddparticles()) return;
|
||||
if(!particletext || camera1->o.dist(s) > maxparticletextdistance) return;
|
||||
particle *p = newparticle(s, vec(0, 0, 1), fade, type, color, size, gravity);
|
||||
p->text = newstring(t);
|
||||
p->flags = 1;
|
||||
}
|
||||
|
||||
//dir = 0..6 where 0=up
|
||||
static inline vec offsetvec(vec o, int dir, int dist)
|
||||
{
|
||||
vec v = vec(o);
|
||||
v[(2+dir)%3] += (dir>2)?(-dist):dist;
|
||||
return v;
|
||||
}
|
||||
|
||||
//converts a 16bit color to 24bit
|
||||
static inline int colorfromattr(int attr)
|
||||
{
|
||||
return (((attr&0xF)<<4) | ((attr&0xF0)<<8) | ((attr&0xF00)<<12)) + 0x0F0F0F;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void particle_splash(int type, int num, int fade, const vec &p, int color, float size, int radius, int gravity)
|
||||
{
|
||||
if(!canaddparticles()) return;
|
||||
|
@ -1074,9 +1140,6 @@ void particle_trail(int type, int fade, const vec &s, const vec &e, int color, f
|
|||
}
|
||||
}
|
||||
|
||||
VARP(particletext, 0, 1, 1);
|
||||
VARP(maxparticletextdistance, 0, 128, 10000);
|
||||
|
||||
void particle_text(const vec &s, const char *t, int type, int fade, int color, float size, int gravity)
|
||||
{
|
||||
if(!canaddparticles()) return;
|
||||
|
@ -1085,15 +1148,6 @@ void particle_text(const vec &s, const char *t, int type, int fade, int color, f
|
|||
p->text = t;
|
||||
}
|
||||
|
||||
void particle_textcopy(const vec &s, const char *t, int type, int fade, int color, float size, int gravity)
|
||||
{
|
||||
if(!canaddparticles()) return;
|
||||
if(!particletext || camera1->o.dist(s) > maxparticletextdistance) return;
|
||||
particle *p = newparticle(s, vec(0, 0, 1), fade, type, color, size, gravity);
|
||||
p->text = newstring(t);
|
||||
p->flags = 1;
|
||||
}
|
||||
|
||||
void particle_icon(const vec &s, int ix, int iy, int type, int fade, int color, float size, int gravity)
|
||||
{
|
||||
if(!canaddparticles()) return;
|
||||
|
@ -1124,20 +1178,7 @@ void particle_fireball(const vec &dest, float maxsize, int type, int fade, int c
|
|||
if(fade < 0) fade = int(growth*20);
|
||||
newparticle(dest, vec(0, 0, 1), fade, type, color, size)->val = growth;
|
||||
}
|
||||
|
||||
//dir = 0..6 where 0=up
|
||||
static inline vec offsetvec(vec o, int dir, int dist)
|
||||
{
|
||||
vec v = vec(o);
|
||||
v[(2+dir)%3] += (dir>2)?(-dist):dist;
|
||||
return v;
|
||||
}
|
||||
|
||||
//converts a 16bit color to 24bit
|
||||
static inline int colorfromattr(int attr)
|
||||
{
|
||||
return (((attr&0xF)<<4) | ((attr&0xF0)<<8) | ((attr&0xF00)<<12)) + 0x0F0F0F;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
/* Experiments in shapes...
|
||||
* dir: (where dir%3 is similar to offsetvec with 0=up)
|
||||
|
@ -1263,11 +1304,13 @@ static void regularflame(int type, const vec &p, float radius, float height, int
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void regular_particle_flame(int type, const vec &p, float radius, float height, int color, int density, float scale, float speed, float fade, int gravity)
|
||||
{
|
||||
if(!canaddparticles()) return;
|
||||
regularflame(type, p, radius, height, color, density, scale, speed, fade, gravity);
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
static void makeparticles(entity &e)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef ENGINE_RENDERPARTICLES_HH
|
||||
#define ENGINE_RENDERPARTICLES_HH
|
||||
|
||||
extern int particlelayers;
|
||||
|
||||
struct extentity;
|
||||
|
||||
enum { PL_ALL = 0, PL_UNDER, PL_OVER, PL_NOLAYER };
|
||||
|
||||
void initparticles();
|
||||
void clearparticles();
|
||||
void clearparticleemitters();
|
||||
void seedparticles();
|
||||
void updateparticles();
|
||||
void debugparticles();
|
||||
void renderparticles(int layer = PL_ALL);
|
||||
bool printparticles(extentity &e, char *buf, int len);
|
||||
void cleanupparticles();
|
||||
|
||||
#endif
|
|
@ -5,6 +5,7 @@
|
|||
#include "pvs.hh"
|
||||
#include "rendergl.hh" /* fovy */
|
||||
#include "renderlights.hh"
|
||||
#include "renderparticles.hh"
|
||||
#include "stain.hh"
|
||||
#include "texture.hh"
|
||||
#include "worldio.hh"
|
||||
|
|
|
@ -180,41 +180,6 @@ extern void pushhudscale(float sx, float sy = 0);
|
|||
extern void pushhudtranslate(float tx, float ty, float sx = 0, float sy = 0);
|
||||
extern void resethudshader();
|
||||
|
||||
// renderparticles
|
||||
enum
|
||||
{
|
||||
PART_BLOOD = 0,
|
||||
PART_WATER,
|
||||
PART_SMOKE,
|
||||
PART_STEAM,
|
||||
PART_FLAME,
|
||||
PART_STREAK,
|
||||
PART_RAIL_TRAIL, PART_PULSE_SIDE, PART_PULSE_FRONT,
|
||||
PART_LIGHTNING,
|
||||
PART_EXPLOSION, PART_PULSE_BURST,
|
||||
PART_SPARK, PART_EDIT,
|
||||
PART_SNOW,
|
||||
PART_RAIL_MUZZLE_FLASH, PART_PULSE_MUZZLE_FLASH,
|
||||
PART_HUD_ICON,
|
||||
PART_HUD_ICON_GREY,
|
||||
PART_TEXT,
|
||||
PART_METER, PART_METER_VS,
|
||||
PART_LENS_FLARE
|
||||
};
|
||||
|
||||
extern bool canaddparticles();
|
||||
extern void regular_particle_splash(int type, int num, int fade, const vec &p, int color = 0xFFFFFF, float size = 1.0f, int radius = 150, int gravity = 2, int delay = 0);
|
||||
extern void regular_particle_flame(int type, const vec &p, float radius, float height, int color, int density = 3, float scale = 2.0f, float speed = 200.0f, float fade = 600.0f, int gravity = -15);
|
||||
extern void particle_splash(int type, int num, int fade, const vec &p, int color = 0xFFFFFF, float size = 1.0f, int radius = 150, int gravity = 2);
|
||||
extern void particle_trail(int type, int fade, const vec &from, const vec &to, int color = 0xFFFFFF, float size = 1.0f, int gravity = 20);
|
||||
extern void particle_text(const vec &s, const char *t, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
|
||||
extern void particle_textcopy(const vec &s, const char *t, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
|
||||
extern void particle_icon(const vec &s, int ix, int iy, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
|
||||
extern void particle_meter(const vec &s, float val, int type, int fade = 1, int color = 0xFFFFFF, int color2 = 0xFFFFF, float size = 2.0f);
|
||||
extern void particle_flare(const vec &p, const vec &dest, int fade, int type, int color = 0xFFFFFF, float size = 0.28f, physent *owner = NULL);
|
||||
extern void particle_fireball(const vec &dest, float max, int type, int fade = -1, int color = 0xFFFFFF, float size = 4.0f);
|
||||
extern void removetrackedparticles(physent *owner = NULL);
|
||||
|
||||
// stain
|
||||
enum
|
||||
{
|
||||
|
|
Caricamento…
Fai riferimento in un nuovo problema