changed includes; rearranged private and public members

This commit is contained in:
Dave Schuyler 2003-06-17 02:33:12 +00:00
parent b46fbf10db
commit 422c370c6b
23 changed files with 263 additions and 270 deletions

View File

@ -19,8 +19,8 @@
#ifndef BASEPARTICLE_H
#define BASEPARTICLE_H
#include <pandabase.h>
#include <physicsObject.h>
#include "pandabase.h"
#include "physicsObject.h"
////////////////////////////////////////////////////////////////////
// Class : BaseParticle

View File

@ -19,15 +19,15 @@
#ifndef BASEPARTICLEEMITTER_H
#define BASEPARTICLEEMITTER_H
#include <pandabase.h>
#include <referenceCount.h>
#include <luse.h>
#include "pandabase.h"
#include "referenceCount.h"
#include "luse.h"
#include "particleCommonFuncs.h"
#include <mathNumbers.h>
#include "mathNumbers.h"
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////// //////
// Class : BaseParticleEmitter
// Description : Describes a physical region in space in which
// particles are randomly generated.

View File

@ -19,8 +19,8 @@
#ifndef BASEPARTICLEFACTORY_H
#define BASEPARTICLEFACTORY_H
#include <pandabase.h>
#include <referenceCount.h>
#include "pandabase.h"
#include "referenceCount.h"
#include "baseParticle.h"
#include "particleCommonFuncs.h"
@ -32,22 +32,6 @@
// Description : Pure Virtual base class for creating particles
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS BaseParticleFactory : public ReferenceCount {
private:
float _lifespan_base;
float _lifespan_spread;
float _mass_base;
float _mass_spread;
float _terminal_velocity_base;
float _terminal_velocity_spread;
virtual void populate_child_particle(BaseParticle *bp) const = 0;
protected:
BaseParticleFactory();
BaseParticleFactory(const BaseParticleFactory &copy);
PUBLISHED:
virtual ~BaseParticleFactory();
@ -68,6 +52,22 @@ PUBLISHED:
virtual BaseParticle *alloc_particle() const = 0;
void populate_particle(BaseParticle* bp);
protected:
BaseParticleFactory();
BaseParticleFactory(const BaseParticleFactory &copy);
private:
float _lifespan_base;
float _lifespan_spread;
float _mass_base;
float _mass_spread;
float _terminal_velocity_base;
float _terminal_velocity_spread;
virtual void populate_child_particle(BaseParticle *bp) const = 0;
};
#include "baseParticleFactory.I"

View File

@ -62,6 +62,11 @@ PUBLISHED:
virtual void output(ostream &out, unsigned int indent=0) const;
public:
virtual BaseParticleRenderer *make_copy() = 0;
friend class ParticleSystem;
protected:
ParticleRendererAlphaMode _alpha_mode;
@ -98,11 +103,6 @@ private:
virtual void init_geoms() = 0;
virtual void render(pvector< PT(PhysicsObject) >& po_vector,
int ttl_particles) = 0;
public:
virtual BaseParticleRenderer *make_copy() = 0;
friend class ParticleSystem;
};
#include "baseParticleRenderer.I"

View File

@ -27,15 +27,6 @@
// particles are generated.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS BoxEmitter : public BaseParticleEmitter {
private:
LPoint3f _vmin, _vmax;
// CUSTOM EMISSION PARAMETERS
// none
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
PUBLISHED:
BoxEmitter();
BoxEmitter(const BoxEmitter &copy);
@ -48,6 +39,15 @@ PUBLISHED:
INLINE LPoint3f get_min_bound() const;
INLINE LPoint3f get_max_bound() const;
private:
LPoint3f _vmin, _vmax;
// CUSTOM EMISSION PARAMETERS
// none
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
};
#include "boxEmitter.I"

View File

@ -19,9 +19,9 @@
#ifndef CONFIG_PARTICLESYSTEM_H
#define CONFIG_PARTICLESYSTEM_H
#include <pandabase.h>
#include <notifyCategoryProxy.h>
#include <dconfig.h>
#include "pandabase.h"
#include "notifyCategoryProxy.h"
#include "dconfig.h"
ConfigureDecl(config_particlesystem, EXPCL_PANDAPHYSICS, EXPTP_PANDAPHYSICS);
NotifyCategoryDecl(particlesystem, EXPCL_PANDAPHYSICS, EXPTP_PANDAPHYSICS);

View File

@ -27,24 +27,6 @@
// are generated
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS DiscEmitter : public BaseParticleEmitter {
private:
float _radius;
// CUSTOM EMISSION PARAMETERS
float _outer_aoe, _inner_aoe;
float _outer_magnitude, _inner_magnitude;
bool _cubic_lerping;
///////////////////////////////
// scratch variables that carry over from position calc to velocity calc
float _distance_from_center;
float _sinf_theta;
float _cosf_theta;
///////////////////////////////
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
PUBLISHED:
DiscEmitter();
DiscEmitter(const DiscEmitter &copy);
@ -65,6 +47,24 @@ PUBLISHED:
INLINE float get_outer_magnitude() const;
INLINE float get_inner_magnitude() const;
INLINE bool get_cubic_lerping() const;
private:
float _radius;
// CUSTOM EMISSION PARAMETERS
float _outer_aoe, _inner_aoe;
float _outer_magnitude, _inner_magnitude;
bool _cubic_lerping;
///////////////////////////////
// scratch variables that carry over from position calc to velocity calc
float _distance_from_center;
float _sinf_theta;
float _cosf_theta;
///////////////////////////////
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
};
#include "discEmitter.I"

View File

@ -29,6 +29,17 @@
#include "pvector.h"
class EXPCL_PANDAPHYSICS GeomParticleRenderer : public BaseParticleRenderer {
PUBLISHED:
GeomParticleRenderer(ParticleRendererAlphaMode am = PR_ALPHA_NONE,
PandaNode *geom_node = (PandaNode *) NULL);
GeomParticleRenderer(const GeomParticleRenderer& copy);
virtual ~GeomParticleRenderer();
INLINE void set_geom_node(PandaNode *node);
INLINE PandaNode *get_geom_node();
virtual BaseParticleRenderer *make_copy();
private:
PT(PandaNode) _geom_node;
@ -48,17 +59,6 @@ private:
virtual void resize_pool(int new_size);
void kill_nodes();
PUBLISHED:
GeomParticleRenderer(ParticleRendererAlphaMode am = PR_ALPHA_NONE,
PandaNode *geom_node = (PandaNode *) NULL);
GeomParticleRenderer(const GeomParticleRenderer& copy);
virtual ~GeomParticleRenderer();
INLINE void set_geom_node(PandaNode *node);
INLINE PandaNode *get_geom_node();
virtual BaseParticleRenderer *make_copy();
};
#include "geomParticleRenderer.I"

View File

@ -22,10 +22,10 @@
#include "baseParticle.h"
#include "baseParticleRenderer.h"
#include <pointerTo.h>
#include <pointerToArray.h>
#include <geom.h>
#include <geomLine.h>
#include "pointerTo.h"
#include "pointerToArray.h"
#include "geom.h"
#include "geomLine.h"
////////////////////////////////////////////////////////////////////
// Class : LineParticleRenderer
@ -34,25 +34,6 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS LineParticleRenderer : public BaseParticleRenderer {
PUBLISHED:
LineParticleRenderer();
LineParticleRenderer(const LineParticleRenderer& copy);
LineParticleRenderer(const Colorf& head,
const Colorf& tail,
ParticleRendererAlphaMode alpha_mode);
virtual ~LineParticleRenderer();
virtual BaseParticleRenderer *make_copy();
INLINE void set_head_color(const Colorf& c);
INLINE void set_tail_color(const Colorf& c);
INLINE const Colorf& get_head_color() const;
INLINE const Colorf& get_tail_color() const;
virtual void output(ostream &out, unsigned int indent=0) const;
private:
Colorf _head_color;
Colorf _tail_color;
@ -72,6 +53,25 @@ private:
virtual void render(pvector< PT(PhysicsObject) >& po_vector,
int ttl_particles);
virtual void resize_pool(int new_size);
PUBLISHED:
LineParticleRenderer();
LineParticleRenderer(const LineParticleRenderer& copy);
LineParticleRenderer(const Colorf& head,
const Colorf& tail,
ParticleRendererAlphaMode alpha_mode);
virtual ~LineParticleRenderer();
virtual BaseParticleRenderer *make_copy();
INLINE void set_head_color(const Colorf& c);
INLINE void set_tail_color(const Colorf& c);
INLINE const Colorf& get_head_color() const;
INLINE const Colorf& get_tail_color() const;
virtual void output(ostream &out, unsigned int indent=0) const;
};
#include "lineParticleRenderer.I"

View File

@ -21,7 +21,7 @@
#include "baseParticleFactory.h"
#include <luse.h>
#include "luse.h"
////////////////////////////////////////////////////////////////////
// Class : OrientedParticleFactory

View File

@ -45,56 +45,6 @@ class ParticleSystemManager;
// Description : Contains and manages a particle system.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS ParticleSystem : public Physical {
private:
#ifdef PSSANITYCHECK
int sanity_check();
#endif
bool birth_particle();
void kill_particle(int pool_index);
void birth_litter();
void resize_pool(int size);
pdeque< int > _free_particle_fifo;
int _particle_pool_size;
int _living_particles;
float _birth_rate;
float _tics_since_birth;
int _litter_size;
int _litter_spread;
float _system_age;
float _system_lifespan;
PT(BaseParticleFactory) _factory;
PT(BaseParticleEmitter) _emitter;
PT(BaseParticleRenderer) _renderer;
ParticleSystemManager *_manager;
bool _template_system_flag;
// _render_parent is the ALREADY ALLOC'D node under which this
// system will render its particles.
PT(PandaNode) _render_parent;
PT(PandaNode) _render_node;
bool _active_system_flag;
bool _local_velocity_flag;
bool _system_grows_older_flag;
// information for systems that will spawn
bool _spawn_on_death_flag;
PT(PandaNode) _spawn_render_node;
pvector< PT(ParticleSystem) > _spawn_templates;
void spawn_child_system(BaseParticle *bp);
// information for spawned systems
bool _i_was_spawned_flag;
PUBLISHED:
// constructor/destructor
@ -149,6 +99,55 @@ PUBLISHED:
INLINE void induce_labor();
void update(float dt);
private:
#ifdef PSSANITYCHECK
int sanity_check();
#endif
bool birth_particle();
void kill_particle(int pool_index);
void birth_litter();
void resize_pool(int size);
pdeque< int > _free_particle_fifo;
int _particle_pool_size;
int _living_particles;
float _birth_rate;
float _tics_since_birth;
int _litter_size;
int _litter_spread;
float _system_age;
float _system_lifespan;
PT(BaseParticleFactory) _factory;
PT(BaseParticleEmitter) _emitter;
PT(BaseParticleRenderer) _renderer;
ParticleSystemManager *_manager;
bool _template_system_flag;
// _render_parent is the ALREADY ALLOC'D node under which this
// system will render its particles.
PT(PandaNode) _render_parent;
PT(PandaNode) _render_node;
bool _active_system_flag;
bool _local_velocity_flag;
bool _system_grows_older_flag;
// information for systems that will spawn
bool _spawn_on_death_flag;
PT(PandaNode) _spawn_render_node;
pvector< PT(ParticleSystem) > _spawn_templates;
void spawn_child_system(BaseParticle *bp);
// information for spawned systems
bool _i_was_spawned_flag;
public:
friend class ParticleSystemManager;
};

View File

@ -19,7 +19,7 @@
#ifndef PARTICLESYSTEMMANAGER_H
#define PARTICLESYSTEMMANAGER_H
#include <pandabase.h>
#include "pandabase.h"
#include "plist.h"
#include "particleSystem.h"
@ -32,13 +32,6 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS ParticleSystemManager {
private:
plist< PT(ParticleSystem) > _ps_list;
int _nth_frame;
int _cur_frame;
PUBLISHED:
ParticleSystemManager(int every_nth_frame = 1);
@ -50,6 +43,12 @@ PUBLISHED:
INLINE void clear();
void do_particles(float dt);
private:
plist< PT(ParticleSystem) > _ps_list;
int _nth_frame;
int _cur_frame;
};
#include "particleSystemManager.I"

View File

@ -27,15 +27,6 @@
// particles are generated.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS PointEmitter : public BaseParticleEmitter {
private:
LPoint3f _location;
// CUSTOM EMISSION PARAMETERS
// none
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
PUBLISHED:
PointEmitter(void);
PointEmitter(const PointEmitter &copy);
@ -45,6 +36,15 @@ PUBLISHED:
INLINE void set_location(const LPoint3f& p);
INLINE LPoint3f get_location(void) const;
private:
LPoint3f _location;
// CUSTOM EMISSION PARAMETERS
// none
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
};
#include "pointEmitter.I"

View File

@ -27,14 +27,14 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS PointParticleFactory : public BaseParticleFactory {
private:
virtual BaseParticle *alloc_particle() const;
virtual void populate_child_particle(BaseParticle *bp) const;
PUBLISHED:
PointParticleFactory();
PointParticleFactory(const PointParticleFactory &copy);
virtual ~PointParticleFactory();
private:
virtual BaseParticle *alloc_particle() const;
virtual void populate_child_particle(BaseParticle *bp) const;
};
#endif // POINTPARTICLEFACTORY_H

View File

@ -22,11 +22,11 @@
#include "baseParticleRenderer.h"
#include "baseParticle.h"
#include <pointerTo.h>
#include <pointerToArray.h>
#include <luse.h>
#include <geom.h>
#include <geomPoint.h>
#include "pointerTo.h"
#include "pointerToArray.h"
#include "luse.h"
#include "geom.h"
#include "geomPoint.h"
////////////////////////////////////////////////////////////////////
// Class : PointParticleRenderer

View File

@ -27,6 +27,19 @@
// particles are generated.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS RingEmitter : public BaseParticleEmitter {
PUBLISHED:
RingEmitter();
RingEmitter(const RingEmitter &copy);
virtual ~RingEmitter();
virtual BaseParticleEmitter *make_copy();
INLINE void set_radius(float r);
INLINE void set_angle(float angle);
INLINE float get_radius() const;
INLINE float get_angle() const;
private:
float _radius;
@ -41,19 +54,6 @@ private:
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
PUBLISHED:
RingEmitter();
RingEmitter(const RingEmitter &copy);
virtual ~RingEmitter();
virtual BaseParticleEmitter *make_copy();
INLINE void set_radius(float r);
INLINE void set_angle(float angle);
INLINE float get_radius() const;
INLINE float get_angle() const;
};
#include "ringEmitter.I"

View File

@ -22,10 +22,10 @@
#include "baseParticle.h"
#include "baseParticleRenderer.h"
#include <pointerTo.h>
#include <pointerToArray.h>
#include <geom.h>
#include <geomLine.h>
#include "pointerTo.h"
#include "pointerToArray.h"
#include "geom.h"
#include "geomLine.h"
enum SparkleParticleLifeScale {
SP_NO_SCALE,
@ -69,7 +69,6 @@ PUBLISHED:
INLINE SparkleParticleLifeScale get_life_scale() const;
private:
Colorf _center_color;
Colorf _edge_color;

View File

@ -27,15 +27,6 @@
// particles are generated.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS SphereSurfaceEmitter : public BaseParticleEmitter {
private:
float _radius;
// CUSTOM EMISSION PARAMETERS
// none
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
PUBLISHED:
SphereSurfaceEmitter();
SphereSurfaceEmitter(const SphereSurfaceEmitter &copy);
@ -45,6 +36,15 @@ PUBLISHED:
INLINE void set_radius(float r);
INLINE float get_radius() const;
private:
float _radius;
// CUSTOM EMISSION PARAMETERS
// none
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
};
#include "sphereSurfaceEmitter.I"

View File

@ -27,6 +27,16 @@
// particles are generated.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS SphereVolumeEmitter : public BaseParticleEmitter {
PUBLISHED:
SphereVolumeEmitter(void);
SphereVolumeEmitter(const SphereVolumeEmitter &copy);
virtual ~SphereVolumeEmitter(void);
virtual BaseParticleEmitter *make_copy(void);
INLINE void set_radius(float r);
INLINE float get_radius(void) const;
private:
float _radius;
@ -40,16 +50,6 @@ private:
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
PUBLISHED:
SphereVolumeEmitter(void);
SphereVolumeEmitter(const SphereVolumeEmitter &copy);
virtual ~SphereVolumeEmitter(void);
virtual BaseParticleEmitter *make_copy(void);
INLINE void set_radius(float r);
INLINE float get_radius(void) const;
};
#include "sphereVolumeEmitter.I"

View File

@ -38,7 +38,6 @@ class NodePath;
// trick sprites.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS SpriteParticleRenderer : public BaseParticleRenderer {
PUBLISHED:
// This enumerated type indicates the source of the sprite texture:
// whether it came from an explicit call to set_texture(), or
@ -48,38 +47,6 @@ PUBLISHED:
ST_from_node,
};
private:
PT(GeomSprite) _sprite_primitive;
PTA_Vertexf _vertex_array;
PTA_Colorf _color_array;
PTA_float _x_texel_array;
PTA_float _y_texel_array;
PTA_float _theta_array;
Colorf _color;
float _initial_x_texel_ratio, _final_x_texel_ratio;
float _initial_y_texel_ratio, _final_y_texel_ratio;
float _theta;
bool _animate_x_ratio, _animate_y_ratio;
bool _animate_theta;
ParticleRendererBlendMethod _blend_method;
Vertexf _aabb_min, _aabb_max;
int _pool_size;
SourceType _source_type;
virtual void birth_particle(int index);
virtual void kill_particle(int index);
virtual void init_geoms();
virtual void render(pvector< PT(PhysicsObject) > &po_vector,
int ttl_particles);
virtual void resize_pool(int new_size);
PUBLISHED:
SpriteParticleRenderer(Texture *tex = (Texture *) NULL);
SpriteParticleRenderer(const SpriteParticleRenderer &copy);
virtual ~SpriteParticleRenderer();
@ -119,6 +86,37 @@ PUBLISHED:
INLINE float get_nonanimated_theta() const;
INLINE ParticleRendererBlendMethod get_alpha_blend_method() const;
INLINE bool get_alpha_disable() const;
private:
PT(GeomSprite) _sprite_primitive;
PTA_Vertexf _vertex_array;
PTA_Colorf _color_array;
PTA_float _x_texel_array;
PTA_float _y_texel_array;
PTA_float _theta_array;
Colorf _color;
float _initial_x_texel_ratio, _final_x_texel_ratio;
float _initial_y_texel_ratio, _final_y_texel_ratio;
float _theta;
bool _animate_x_ratio, _animate_y_ratio;
bool _animate_theta;
ParticleRendererBlendMethod _blend_method;
Vertexf _aabb_min, _aabb_max;
int _pool_size;
SourceType _source_type;
virtual void birth_particle(int index);
virtual void kill_particle(int index);
virtual void init_geoms();
virtual void render(pvector< PT(PhysicsObject) > &po_vector,
int ttl_particles);
virtual void resize_pool(int new_size);
};
#include "spriteParticleRenderer.I"

View File

@ -28,6 +28,16 @@
// fly off tangential to the ring.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS TangentRingEmitter : public BaseParticleEmitter {
PUBLISHED:
TangentRingEmitter();
TangentRingEmitter(const TangentRingEmitter &copy);
virtual ~TangentRingEmitter();
virtual BaseParticleEmitter *make_copy();
INLINE void set_radius(float r);
INLINE float get_radius() const;
private:
float _radius;
@ -41,16 +51,6 @@ private:
virtual void assign_initial_position(LPoint3f& pos);
virtual void assign_initial_velocity(LVector3f& vel);
PUBLISHED:
TangentRingEmitter();
TangentRingEmitter(const TangentRingEmitter &copy);
virtual ~TangentRingEmitter();
virtual BaseParticleEmitter *make_copy();
INLINE void set_radius(float r);
INLINE float get_radius() const;
};
#include "tangentRingEmitter.I"

View File

@ -30,13 +30,6 @@
// oriented (i.e. angry quat math), use this.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS ZSpinParticle : public BaseParticle {
private:
float _initial_angle;
float _final_angle;
float _cur_angle;
float _angular_velocity;
bool _bUseAngularVelocity;
public:
ZSpinParticle();
ZSpinParticle(const ZSpinParticle &copy);
@ -63,6 +56,13 @@ public:
INLINE void enable_angular_velocity(bool bEnabled);
INLINE bool get_angular_velocity_enabled() const;
private:
float _initial_angle;
float _final_angle;
float _cur_angle;
float _angular_velocity;
bool _bUseAngularVelocity;
};
#include "zSpinParticle.I"

View File

@ -25,18 +25,7 @@
// Class : ZSpinParticleFactory
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS ZSpinParticleFactory :
public BaseParticleFactory {
private:
virtual void populate_child_particle(BaseParticle *bp) const;
virtual BaseParticle *alloc_particle() const;
float _initial_angle,_initial_angle_spread;
float _final_angle,_final_angle_spread;
float _angular_velocity,_angular_velocity_spread;
bool _bUseAngularVelocity;
class EXPCL_PANDAPHYSICS ZSpinParticleFactory : public BaseParticleFactory {
PUBLISHED:
ZSpinParticleFactory();
ZSpinParticleFactory(const ZSpinParticleFactory &copy);
@ -60,6 +49,15 @@ PUBLISHED:
INLINE void enable_angular_velocity(bool bEnabled);
INLINE bool get_angular_velocity_enabled() const;
private:
virtual void populate_child_particle(BaseParticle *bp) const;
virtual BaseParticle *alloc_particle() const;
float _initial_angle,_initial_angle_spread;
float _final_angle,_final_angle_spread;
float _angular_velocity,_angular_velocity_spread;
bool _bUseAngularVelocity;
};
#include "zSpinParticleFactory.I"