39 static int Particles_enabled = 1;
100 DCF_BOOL2(particles, Particles_enabled,
"Turns particles on/off",
"Usage: particles [bool]\nTurns particle system on/off. If nothing passed, then toggles it.\n");
107 if ( !Particles_enabled )
115 new_particle->
pos = pinfo->
pos;
117 new_particle->
age = 0.0f;
128 switch (pinfo->
type) {
139 if ( new_particle->
nframes > 1 ) {
189 Particles.push_back( new_particle );
199 return Particles.back();
231 pinfo.
reverse = reverse? 1 : 0;
243 if ( !Particles_enabled )
246 if ( Particles.empty() )
252 if (part->
age == 0.0f) {
253 part->
age = 0.00001f;
255 part->
age += frametime;
258 bool remove_particle =
false;
263 if ( (part->
age > frametime) || (part->
max_life > 0.0f) ) {
264 remove_particle =
true;
272 remove_particle =
true;
282 if (
p + 1 == Particles.end())
284 Particles.pop_back();
289 *
p = Particles.back();
290 Particles.pop_back();
320 static
float get_current_alpha(
vec3d *
pos)
325 const float inner_radius = 30.0f;
326 const float magic_num = 2.75f;
334 if (dist <= inner_radius) {
336 alpha = 0.99999f / (inner_radius - magic_num);
339 alpha *= (dist - magic_num);
340 return (alpha < 0.05
f) ? 0.0f :
alpha;
354 int framenum, cur_frame;
355 bool render_batch =
false;
358 if ( !Particles_enabled )
363 if ( Particles.empty() )
383 alpha = get_current_alpha(&p_pos);
421 framenum =
fl2i(pct_complete * part->
nframes + 0.5);
424 cur_frame = part->
reverse ? (part->
nframes - framenum - 1) : framenum;
435 Assert( cur_frame < part->nframes );
482 static inline int get_percent(
int count)
490 return ( 50 + (25 * (count-1)) );
499 if ( !Particles_enabled )
508 float min_dist = 125.0f;
510 if ( dist > min_dist ) {
511 percent =
fl2i(
i2fl(percent)*min_dist / dist );
518 n1 = (pe->
num_low*percent)/100;
522 n = (rand() % (n2-n1+1)) + n1;
527 for (i=0; i<
n; i++ ) {
#define OGL_EXT_GEOMETRY_SHADER4
float vm_vec_dot_to_point(const vec3d *dir, const vec3d *p1, const vec3d *p2)
#define TMAP_FLAG_SOFT_QUAD
void vm_vec_scale_add(vec3d *dest, const vec3d *src1, const vec3d *src2, float k)
int Anim_num_frames_smoke
ubyte g3_transfer_vertex(vertex *dest, const vec3d *src)
float vm_vec_normalize_quick(vec3d *src)
int Particle_buffer_object
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
struct vec3d::@225::@227 xyz
#define TMAP_HTL_3D_UNLIT
#define TMAP_FLAG_VERTEX_GEN
void vm_vec_scale_add2(vec3d *dest, const vec3d *src, float k)
float batch_add_laser(int texture, vec3d *p0, float width1, vec3d *p1, float width2, int r, int g, int b)
void profile_begin(const char *name)
DCF_BOOL2(particles, Particles_enabled,"Turns particles on/off","Usage: particles [bool]\nTurns particle system on/off. If nothing passed, then toggles it.\n")
int Anim_num_frames_smoke2
void particle_emit(particle_emitter *pe, int type, int optional_data, float range)
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads a bitmap sequance so we can draw with it.
#define CLAMP(x, min, max)
void gr_set_color(int r, int g, int b)
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
void batch_render_all(int stream_buffer)
void vm_vec_add2(vec3d *dest, const vec3d *src)
struct matrix::@228::@230 vec
int Geometry_shader_buffer_object
ubyte g3_rotate_vertex(vertex *dest, const vec3d *src)
#define MONITOR(function_name)
float vm_vec_normalize_safe(vec3d *v)
vec3d * vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m)
#define Is_Extension_Enabled(x)
object Objects[MAX_OBJECTS]
#define MONITOR_INC(function_name, inc)
typedef void(APIENTRY *PFNGLARRAYELEMENTEXTPROC)(GLint i)
void particle_move_all(float frametime)
void profile_end(const char *name)
int Anim_bitmap_id_smoke2
float vm_vec_dist_quick(const vec3d *v0, const vec3d *v1)
float frand()
Return random value in range 0.0..1.0- (1.0- means the closest number less than 1.0)
void particle_render_all()
void bm_page_in_texture(int bitmapnum, int nframes)
Marks a texture as being used for this level.
#define PARTICLE_BITMAP_PERSISTENT
int batch_add_bitmap(int texture, int tmap_flags, vertex *pnt, int orient, float rad, float alpha, float depth)
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
#define TMAP_FLAG_TEXTURED
void geometry_batch_render(int stream_buffer)
#define NUM_PARTICLE_TYPES
#define gr_create_stream_buffer
bool Cmdline_no_geo_sdr_effects
int g3_draw_sphere_ez(const vec3d *pnt, float rad)
particle * particle_create(particle_info *pinfo)
GLclampf GLclampf GLclampf alpha