From eede24794a5fa88086b9c6a78b7cf12525c008a2 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Tue, 17 Jun 2003 04:42:41 +0000 Subject: [PATCH] output() and write() --- panda/src/particlesystem/baseParticle.cxx | 2 +- panda/src/particlesystem/baseParticle.h | 2 +- .../particlesystem/baseParticleEmitter.cxx | 25 ++- .../src/particlesystem/baseParticleEmitter.h | 5 +- .../particlesystem/baseParticleFactory.cxx | 33 ++++ .../src/particlesystem/baseParticleFactory.h | 3 + .../particlesystem/baseParticleRenderer.cxx | 23 ++- .../src/particlesystem/baseParticleRenderer.h | 5 +- panda/src/particlesystem/boxEmitter.cxx | 29 ++++ panda/src/particlesystem/boxEmitter.h | 6 +- panda/src/particlesystem/discEmitter.cxx | 36 ++++ panda/src/particlesystem/discEmitter.h | 9 +- .../particlesystem/geomParticleRenderer.cxx | 49 ++++++ .../src/particlesystem/geomParticleRenderer.h | 5 +- panda/src/particlesystem/lineEmitter.cxx | 23 ++- panda/src/particlesystem/lineEmitter.h | 8 +- .../particlesystem/lineParticleRenderer.cxx | 29 +++- .../src/particlesystem/lineParticleRenderer.h | 44 ++--- panda/src/particlesystem/orientedParticle.cxx | 27 +++ panda/src/particlesystem/orientedParticle.h | 5 +- .../orientedParticleFactory.cxx | 27 +++ .../particlesystem/orientedParticleFactory.h | 15 +- panda/src/particlesystem/particleSystem.cxx | 159 ++++++++++++++---- panda/src/particlesystem/particleSystem.h | 5 + .../particlesystem/particleSystemManager.cxx | 48 ++++++ .../particlesystem/particleSystemManager.h | 4 + panda/src/particlesystem/pointEmitter.cxx | 28 +++ panda/src/particlesystem/pointEmitter.h | 11 +- panda/src/particlesystem/pointParticle.cxx | 27 +++ panda/src/particlesystem/pointParticle.h | 3 + .../particlesystem/pointParticleFactory.cxx | 27 +++ .../src/particlesystem/pointParticleFactory.h | 3 + .../particlesystem/pointParticleRenderer.cxx | 38 +++++ .../particlesystem/pointParticleRenderer.h | 9 +- panda/src/particlesystem/rectangleEmitter.cxx | 23 ++- panda/src/particlesystem/rectangleEmitter.h | 8 +- panda/src/particlesystem/ringEmitter.cxx | 31 ++++ panda/src/particlesystem/ringEmitter.h | 3 + .../sparkleParticleRenderer.cxx | 38 +++++ .../particlesystem/sparkleParticleRenderer.h | 6 +- .../particlesystem/sphereSurfaceEmitter.cxx | 28 +++ .../src/particlesystem/sphereSurfaceEmitter.h | 3 + .../particlesystem/sphereVolumeEmitter.cxx | 28 +++ .../src/particlesystem/sphereVolumeEmitter.h | 11 +- .../particlesystem/spriteParticleRenderer.cxx | 47 ++++++ .../particlesystem/spriteParticleRenderer.h | 15 +- .../src/particlesystem/tangentRingEmitter.cxx | 30 ++++ panda/src/particlesystem/tangentRingEmitter.h | 6 +- panda/src/particlesystem/zSpinParticle.cxx | 32 ++++ panda/src/particlesystem/zSpinParticle.h | 3 + .../particlesystem/zSpinParticleFactory.cxx | 34 ++++ .../src/particlesystem/zSpinParticleFactory.h | 16 +- 52 files changed, 1016 insertions(+), 118 deletions(-) diff --git a/panda/src/particlesystem/baseParticle.cxx b/panda/src/particlesystem/baseParticle.cxx index db7b9814d9..cc9f9017a8 100644 --- a/panda/src/particlesystem/baseParticle.cxx +++ b/panda/src/particlesystem/baseParticle.cxx @@ -79,7 +79,7 @@ output(ostream &out) const { // . //////////////////////////////////////////////////////////////////// void BaseParticle:: -write(ostream &out, unsigned int indent) const { +write(ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"BaseParticle:\n"; out.width(indent+2); out<<""; out<<"_age "<<_age<<"\n"; diff --git a/panda/src/particlesystem/baseParticle.h b/panda/src/particlesystem/baseParticle.h index 1f5df02141..b72d62677f 100644 --- a/panda/src/particlesystem/baseParticle.h +++ b/panda/src/particlesystem/baseParticle.h @@ -53,7 +53,7 @@ public: virtual PhysicsObject *make_copy() const = 0; virtual void output(ostream &out) const; - virtual void write(ostream &out, unsigned int indent=0) const; + virtual void write(ostream &out, int indent=0) const; protected: BaseParticle(int lifespan = 1, bool alive = false); diff --git a/panda/src/particlesystem/baseParticleEmitter.cxx b/panda/src/particlesystem/baseParticleEmitter.cxx index fd67bc1a63..589eefe0dc 100644 --- a/panda/src/particlesystem/baseParticleEmitter.cxx +++ b/panda/src/particlesystem/baseParticleEmitter.cxx @@ -95,7 +95,26 @@ generate(LPoint3f& pos, LVector3f& vel) { // . //////////////////////////////////////////////////////////////////// void BaseParticleEmitter:: -output(ostream &out, unsigned int indent) const { - out.width(indent); out<<""; out<<"BaseParticleEmitter:\n"; - //ReferenceCount::output(out, indent+2); +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"BaseParticleEmitter"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void BaseParticleEmitter:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"BaseParticleEmitter:\n"; + out.width(indent+2); out<<""; out<<"_emission_type "<<_emission_type<<"\n"; + out.width(indent+2); out<<""; out<<"_amplitude "<<_amplitude<<"\n"; + out.width(indent+2); out<<""; out<<"_amplitude_spread "<<_amplitude_spread<<"\n"; + out.width(indent+2); out<<""; out<<"_offset_force "<<_offset_force<<"\n"; + //ReferenceCount::write(out, indent+2); + #endif //] NDEBUG } diff --git a/panda/src/particlesystem/baseParticleEmitter.h b/panda/src/particlesystem/baseParticleEmitter.h index 6910a961d8..afead58546 100644 --- a/panda/src/particlesystem/baseParticleEmitter.h +++ b/panda/src/particlesystem/baseParticleEmitter.h @@ -58,8 +58,9 @@ PUBLISHED: INLINE LVector3f get_offset_force() const; INLINE LVector3f get_explicit_launch_vector() const; INLINE LPoint3f get_radiate_origin() const; - - virtual void output(ostream &out, unsigned int indent=0) const; + + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; protected: BaseParticleEmitter(); diff --git a/panda/src/particlesystem/baseParticleFactory.cxx b/panda/src/particlesystem/baseParticleFactory.cxx index 40448dfcd1..2a538bc591 100644 --- a/panda/src/particlesystem/baseParticleFactory.cxx +++ b/panda/src/particlesystem/baseParticleFactory.cxx @@ -73,3 +73,36 @@ populate_particle(BaseParticle *bp) { populate_child_particle(bp); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void BaseParticleFactory:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"BaseParticleFactory"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void BaseParticleFactory:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"BaseParticleFactory:\n"; + out.width(indent+2); out<<""; out<<"_lifespan_base "<<_lifespan_base<<"\n"; + out.width(indent+2); out<<""; out<<"_lifespan_spread "<<_lifespan_spread<<"\n"; + out.width(indent+2); out<<""; out<<"_mass_base "<<_mass_base<<"\n"; + out.width(indent+2); out<<""; out<<"_mass_spread "<<_mass_spread<<"\n"; + out.width(indent+2); out<<""; out<<"_terminal_velocity_base "<<_terminal_velocity_base<<"\n"; + out.width(indent+2); out<<""; out<<"_terminal_velocity_spread "<<_terminal_velocity_spread<<"\n"; + //ReferenceCount::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/baseParticleFactory.h b/panda/src/particlesystem/baseParticleFactory.h index eaa9889814..e924902d07 100644 --- a/panda/src/particlesystem/baseParticleFactory.h +++ b/panda/src/particlesystem/baseParticleFactory.h @@ -53,6 +53,9 @@ PUBLISHED: void populate_particle(BaseParticle* bp); + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + protected: BaseParticleFactory(); BaseParticleFactory(const BaseParticleFactory ©); diff --git a/panda/src/particlesystem/baseParticleRenderer.cxx b/panda/src/particlesystem/baseParticleRenderer.cxx index f705286349..1b5f445145 100644 --- a/panda/src/particlesystem/baseParticleRenderer.cxx +++ b/panda/src/particlesystem/baseParticleRenderer.cxx @@ -106,7 +106,24 @@ update_alpha_mode(ParticleRendererAlphaMode am) { // . //////////////////////////////////////////////////////////////////// void BaseParticleRenderer:: -output(ostream &out, unsigned int indent) const { - out.width(indent); out<<""; out<<"BaseParticleRenderer:\n"; - //ReferenceCount::output(out, indent+2); +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"BaseParticleRenderer"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void BaseParticleRenderer:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"BaseParticleRenderer:\n"; + out.width(indent+2); out<<""; out<<"_render_node "<<_render_node<<"\n"; + out.width(indent+2); out<<""; out<<"_user_alpha "<<_user_alpha<<"\n"; + //ReferenceCount::write(out, indent+2); + #endif //] NDEBUG } diff --git a/panda/src/particlesystem/baseParticleRenderer.h b/panda/src/particlesystem/baseParticleRenderer.h index 081d35eda7..9073d42b90 100644 --- a/panda/src/particlesystem/baseParticleRenderer.h +++ b/panda/src/particlesystem/baseParticleRenderer.h @@ -59,8 +59,9 @@ PUBLISHED: INLINE void set_user_alpha(float ua); INLINE float get_user_alpha() const; - - virtual void output(ostream &out, unsigned int indent=0) const; + + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; public: virtual BaseParticleRenderer *make_copy() = 0; diff --git a/panda/src/particlesystem/boxEmitter.cxx b/panda/src/particlesystem/boxEmitter.cxx index 86e762e4e1..d6d86520ff 100644 --- a/panda/src/particlesystem/boxEmitter.cxx +++ b/panda/src/particlesystem/boxEmitter.cxx @@ -90,3 +90,32 @@ void BoxEmitter:: assign_initial_velocity(LVector3f& vel) { vel.set(0,0,0); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void BoxEmitter:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"BoxEmitter"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void BoxEmitter:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"BoxEmitter:\n"; + out.width(indent+2); out<<""; out<<"_vmin "<<_vmin<<"\n"; + out.width(indent+2); out<<""; out<<"_vmax "<<_vmax<<"\n"; + BaseParticleEmitter::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/boxEmitter.h b/panda/src/particlesystem/boxEmitter.h index a621afaa9e..de01bec0bf 100644 --- a/panda/src/particlesystem/boxEmitter.h +++ b/panda/src/particlesystem/boxEmitter.h @@ -40,8 +40,12 @@ PUBLISHED: INLINE LPoint3f get_min_bound() const; INLINE LPoint3f get_max_bound() const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: - LPoint3f _vmin, _vmax; + LPoint3f _vmin; + LPoint3f _vmax; // CUSTOM EMISSION PARAMETERS // none diff --git a/panda/src/particlesystem/discEmitter.cxx b/panda/src/particlesystem/discEmitter.cxx index 4bcb2c40e7..2f6c641f32 100644 --- a/panda/src/particlesystem/discEmitter.cxx +++ b/panda/src/particlesystem/discEmitter.cxx @@ -127,3 +127,39 @@ assign_initial_velocity(LVector3f& vel) { vel.set(vel_x, vel_y, vel_z); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void DiscEmitter:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"DiscEmitter"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void DiscEmitter:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"DiscEmitter:\n"; + out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n"; + out.width(indent+2); out<<""; out<<"_outer_aoe "<<_outer_aoe<<"\n"; + out.width(indent+2); out<<""; out<<"_inner_aoe "<<_inner_aoe<<"\n"; + out.width(indent+2); out<<""; out<<"_outer_magnitude "<<_outer_magnitude<<"\n"; + out.width(indent+2); out<<""; out<<"_inner_magnitude "<<_inner_magnitude<<"\n"; + out.width(indent+2); out<<""; out<<"_cubic_lerping "<<_cubic_lerping<<"\n"; + out.width(indent+2); out<<""; out<<"_distance_from_center "<<_distance_from_center<<"\n"; + out.width(indent+2); out<<""; out<<"_sinf_theta "<<_sinf_theta<<"\n"; + out.width(indent+2); out<<""; out<<"_cosf_theta "<<_cosf_theta<<"\n"; + BaseParticleEmitter::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/discEmitter.h b/panda/src/particlesystem/discEmitter.h index b04e1f52ac..d5833259e4 100644 --- a/panda/src/particlesystem/discEmitter.h +++ b/panda/src/particlesystem/discEmitter.h @@ -48,12 +48,17 @@ PUBLISHED: INLINE float get_inner_magnitude() const; INLINE bool get_cubic_lerping() const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: float _radius; // CUSTOM EMISSION PARAMETERS - float _outer_aoe, _inner_aoe; - float _outer_magnitude, _inner_magnitude; + float _inner_aoe; + float _outer_aoe; + float _inner_magnitude; + float _outer_magnitude; bool _cubic_lerping; /////////////////////////////// diff --git a/panda/src/particlesystem/geomParticleRenderer.cxx b/panda/src/particlesystem/geomParticleRenderer.cxx index b03a103518..3465f1082a 100644 --- a/panda/src/particlesystem/geomParticleRenderer.cxx +++ b/panda/src/particlesystem/geomParticleRenderer.cxx @@ -214,3 +214,52 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { cur_node_iter++; } } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void GeomParticleRenderer:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"GeomParticleRenderer"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write_linear_forces +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void GeomParticleRenderer:: +write_linear_forces(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); + out<<""<<"_node_vector ("<<_node_vector.size()<<" forces)\n"; + for (pvector< PT(PandaNode) >::const_iterator i=_node_vector.begin(); + i != _node_vector.end(); + ++i) { + (*i)->write(out, indent+2); + } + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void GeomParticleRenderer:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"GeomParticleRenderer:\n"; + out.width(indent+2); out<<""; out<<"_geom_node "<<_geom_node<<"\n"; + out.width(indent+2); out<<""; out<<"_pool_size "<<_pool_size<<"\n"; + write_linear_forces(out, indent+2); + BaseParticleRenderer::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/geomParticleRenderer.h b/panda/src/particlesystem/geomParticleRenderer.h index fda43be424..f073e573a8 100644 --- a/panda/src/particlesystem/geomParticleRenderer.h +++ b/panda/src/particlesystem/geomParticleRenderer.h @@ -40,8 +40,11 @@ PUBLISHED: virtual BaseParticleRenderer *make_copy(); -private: + virtual void output(ostream &out) const; + virtual void write_linear_forces(ostream &out, int indent=0) const; + virtual void write(ostream &out, int indent=0) const; +private: PT(PandaNode) _geom_node; pvector< PT(PandaNode) > _node_vector; diff --git a/panda/src/particlesystem/lineEmitter.cxx b/panda/src/particlesystem/lineEmitter.cxx index e360c68144..f60e00ebc9 100644 --- a/panda/src/particlesystem/lineEmitter.cxx +++ b/panda/src/particlesystem/lineEmitter.cxx @@ -96,7 +96,24 @@ assign_initial_velocity(LVector3f& vel) { // . //////////////////////////////////////////////////////////////////// void LineEmitter:: -output(ostream &out, unsigned int indent) const { - out.width(indent); out<<""; out<<"LineEmitter:\n"; - BaseParticleEmitter::output(out, indent+2); +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"LineEmitter"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void LineEmitter:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"LineEmitter:\n"; + out.width(indent+2); out<<""; out<<"_endpoint1 "<<_endpoint1<<"\n"; + out.width(indent+2); out<<""; out<<"_endpoint2 "<<_endpoint2<<"\n"; + BaseParticleEmitter::write(out, indent+2); + #endif //] NDEBUG } diff --git a/panda/src/particlesystem/lineEmitter.h b/panda/src/particlesystem/lineEmitter.h index 12663be386..9ebfd17adc 100644 --- a/panda/src/particlesystem/lineEmitter.h +++ b/panda/src/particlesystem/lineEmitter.h @@ -39,11 +39,13 @@ PUBLISHED: INLINE LPoint3f get_endpoint1() const; INLINE LPoint3f get_endpoint2() const; - - virtual void output(ostream &out, unsigned int indent=0) const; + + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; private: - LPoint3f _endpoint1, _endpoint2; + LPoint3f _endpoint1; + LPoint3f _endpoint2; // CUSTOM EMISSION PARAMETERS // none diff --git a/panda/src/particlesystem/lineParticleRenderer.cxx b/panda/src/particlesystem/lineParticleRenderer.cxx index dde558fb4f..4e8a1133aa 100644 --- a/panda/src/particlesystem/lineParticleRenderer.cxx +++ b/panda/src/particlesystem/lineParticleRenderer.cxx @@ -249,7 +249,30 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { // . //////////////////////////////////////////////////////////////////// void LineParticleRenderer:: -output(ostream &out, unsigned int indent) const { - out.width(indent); out<<""; out<<"LineParticleRenderer:\n"; - BaseParticleRenderer::output(out, indent+2); +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"LineParticleRenderer"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void LineParticleRenderer:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"LineParticleRenderer:\n"; + out.width(indent+2); out<<""; out<<"_head_color "<<_head_color<<"\n"; + out.width(indent+2); out<<""; out<<"_tail_color "<<_tail_color<<"\n"; + out.width(indent+2); out<<""; out<<"_line_primitive "<<_line_primitive<<"\n"; + out.width(indent+2); out<<""; out<<"_vertex_array "<<_vertex_array<<"\n"; + out.width(indent+2); out<<""; out<<"_color_array "<<_color_array<<"\n"; + out.width(indent+2); out<<""; out<<"_max_pool_size "<<_max_pool_size<<"\n"; + out.width(indent+2); out<<""; out<<"_aabb_min "<<_aabb_min<<"\n"; + out.width(indent+2); out<<""; out<<"_aabb_max "<<_aabb_max<<"\n"; + BaseParticleRenderer::write(out, indent+2); + #endif //] NDEBUG } diff --git a/panda/src/particlesystem/lineParticleRenderer.h b/panda/src/particlesystem/lineParticleRenderer.h index e9ee9a8946..2e4fa93247 100644 --- a/panda/src/particlesystem/lineParticleRenderer.h +++ b/panda/src/particlesystem/lineParticleRenderer.h @@ -34,26 +34,6 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS LineParticleRenderer : public BaseParticleRenderer { -private: - Colorf _head_color; - Colorf _tail_color; - - PT(GeomLine) _line_primitive; - - PTA_Vertexf _vertex_array; - PTA_Colorf _color_array; - - int _max_pool_size; - - LPoint3f _aabb_min, _aabb_max; - - 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: LineParticleRenderer(); LineParticleRenderer(const LineParticleRenderer& copy); @@ -71,7 +51,29 @@ PUBLISHED: INLINE const Colorf& get_head_color() const; INLINE const Colorf& get_tail_color() const; - virtual void output(ostream &out, unsigned int indent=0) const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + +private: + Colorf _head_color; + Colorf _tail_color; + + PT(GeomLine) _line_primitive; + + PTA_Vertexf _vertex_array; + PTA_Colorf _color_array; + + int _max_pool_size; + + LPoint3f _aabb_min; + LPoint3f _aabb_max; + + 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 "lineParticleRenderer.I" diff --git a/panda/src/particlesystem/orientedParticle.cxx b/panda/src/particlesystem/orientedParticle.cxx index 872d0d7442..722aaf45f1 100644 --- a/panda/src/particlesystem/orientedParticle.cxx +++ b/panda/src/particlesystem/orientedParticle.cxx @@ -86,3 +86,30 @@ die() { void OrientedParticle:: update() { } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void OrientedParticle:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"OrientedParticle"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void OrientedParticle:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"OrientedParticle:\n"; + BaseParticle::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/orientedParticle.h b/panda/src/particlesystem/orientedParticle.h index ab261a54d8..04546a9eae 100644 --- a/panda/src/particlesystem/orientedParticle.h +++ b/panda/src/particlesystem/orientedParticle.h @@ -40,8 +40,9 @@ public: virtual void init(); virtual void update(); virtual void die(); - - virtual void output(ostream &out, unsigned int indent=0) const; + + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; }; #include "orientedParticle.I" diff --git a/panda/src/particlesystem/orientedParticleFactory.cxx b/panda/src/particlesystem/orientedParticleFactory.cxx index aa7b6ce84d..f9020422e9 100644 --- a/panda/src/particlesystem/orientedParticleFactory.cxx +++ b/panda/src/particlesystem/orientedParticleFactory.cxx @@ -69,3 +69,30 @@ BaseParticle *OrientedParticleFactory:: alloc_particle(void) const { return new OrientedParticle; } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void OrientedParticleFactory:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"OrientedParticleFactory"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void OrientedParticleFactory:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"OrientedParticleFactory:\n"; + BaseParticleFactory::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/orientedParticleFactory.h b/panda/src/particlesystem/orientedParticleFactory.h index 7f587aec23..4f52aaaabf 100644 --- a/panda/src/particlesystem/orientedParticleFactory.h +++ b/panda/src/particlesystem/orientedParticleFactory.h @@ -30,20 +30,21 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS OrientedParticleFactory : public BaseParticleFactory { PUBLISHED: - OrientedParticleFactory(void); + OrientedParticleFactory(); OrientedParticleFactory(const OrientedParticleFactory ©); - virtual ~OrientedParticleFactory(void); + virtual ~OrientedParticleFactory(); INLINE void set_initial_orientation(const LOrientationf &o); INLINE void set_final_orientation(const LOrientationf &o); - INLINE LOrientationf get_initial_orientation(void) const; - INLINE LOrientationf get_final_orientation(void) const; - - virtual void output(ostream &out, unsigned int indent=0) const; + INLINE LOrientationf get_initial_orientation() const; + INLINE LOrientationf get_final_orientation() const; + + virtual void output(ostream &out) const; + virtual void write(ostream &out, unsigned int indent=0) const; private: virtual void populate_child_particle(BaseParticle *bp) const; - virtual BaseParticle *alloc_particle(void) const; + virtual BaseParticle *alloc_particle() const; LOrientationf _initial_orientation; LOrientationf _final_orientation; diff --git a/panda/src/particlesystem/particleSystem.cxx b/panda/src/particlesystem/particleSystem.cxx index 33b5fb70d6..a9083c721b 100644 --- a/panda/src/particlesystem/particleSystem.cxx +++ b/panda/src/particlesystem/particleSystem.cxx @@ -358,17 +358,17 @@ resize_pool(int size) { _physics_objects.push_back(new_particle); } else { -#ifdef PSDEBUG + #ifdef PSDEBUG cout << "Error allocating new particle" << endl; _particle_pool_size--; -#endif + #endif } } } else { -#ifdef PSDEBUG + #ifdef PSDEBUG cout << "physics_object array is too large??" << endl; _particle_pool_size--; -#endif + #endif po_delta = -po_delta; for (i = 0; i < po_delta; i++) { int delete_index = _physics_objects.size()-1; @@ -406,10 +406,10 @@ resize_pool(int size) { _physics_objects.push_back(new_particle); _free_particle_fifo.push_back(free_index); } else { -#ifdef PSDEBUG + #ifdef PSDEBUG cout << "Error allocating new particle" << endl; _particle_pool_size--; -#endif + #endif } } } else { @@ -420,25 +420,25 @@ resize_pool(int size) { BaseParticle *bp = (BaseParticle *) _physics_objects[delete_index].p(); if (bp->get_alive()) { -#ifdef PSDEBUG + #ifdef PSDEBUG cout << "WAS ALIVE" << endl; -#endif + #endif kill_particle(delete_index); _free_particle_fifo.pop_back(); } else { -#ifdef PSDEBUG + #ifdef PSDEBUG cout << "WAS NOT ALIVE" << endl; -#endif + #endif pdeque::iterator i; i = find(_free_particle_fifo.begin(), _free_particle_fifo.end(), delete_index); if (i != _free_particle_fifo.end()) { _free_particle_fifo.erase(i); } -#ifdef PSDEBUG + #ifdef PSDEBUG else { cout << "particle not found in free FIFO!!!!!!!!" << endl; } -#endif + #endif } _physics_objects.pop_back(); @@ -447,9 +447,9 @@ resize_pool(int size) { _renderer->resize_pool(_particle_pool_size); -#ifdef PARTICLE_SYSTEM_RESIZE_POOL_SENTRIES + #ifdef PARTICLE_SYSTEM_RESIZE_POOL_SENTRIES cout << "particle pool resized" << endl; -#endif + #endif } ////////////////////////////////////////////////////////////////////// @@ -467,22 +467,22 @@ update(float dt) { BaseParticle *bp; float age; -#ifdef PSSANITYCHECK + #ifdef PSSANITYCHECK // check up on things if (sanity_check()) return; -#endif + #endif -#ifdef PARTICLE_SYSTEM_UPDATE_SENTRIES + #ifdef PARTICLE_SYSTEM_UPDATE_SENTRIES cout << "UPDATE: pool size: " << _particle_pool_size << ", live particles: " << _living_particles << endl; -#endif + #endif // run through the particle array while (ttl_updates_left) { current_index = index_counter; index_counter++; -#ifdef PSDEBUG + #ifdef PSDEBUG if (current_index >= _particle_pool_size) { cout << "ERROR: _living_particles is out of sync (too large)" << endl; cout << "pool size: " << _particle_pool_size @@ -490,17 +490,17 @@ update(float dt) { << ", updates left: " << ttl_updates_left << endl; break; } -#endif + #endif // get the current particle. bp = (BaseParticle *) _physics_objects[current_index].p(); -#ifdef PSDEBUG + #ifdef PSDEBUG if (!bp) { cout << "NULL ptr at index " << current_index << endl; continue; } -#endif + #endif if (bp->get_alive() == false) continue; @@ -526,9 +526,9 @@ update(float dt) { _tics_since_birth -= _birth_rate; } -#ifdef PARTICLE_SYSTEM_UPDATE_SENTRIES + #ifdef PARTICLE_SYSTEM_UPDATE_SENTRIES cout << "particle update complete" << endl; -#endif + #endif } @@ -565,14 +565,14 @@ static int check_free_live_total_particles(pvector< PT(SC_valuenamepair) > live_ int dead = dead_counts[d]->value; int total = total_counts[t]->value; if ((live + dead) != total) { -#ifdef PSSCVERBOSE + #ifdef PSSCVERBOSE cout << "free/live/total count: " << live_counts[l]->name << " (" << live << ") + " << dead_counts[d]->name << " (" << dead << ") = " << live + dead << ", != " << total_counts[t]->name << " (" << total << ")" << endl; -#endif + #endif val++; } } @@ -592,10 +592,10 @@ sanity_check() { /////////////////////////////////////////////////////////////////// // check pool size if (_particle_pool_size != _physics_objects.size()) { -#ifdef PSSCVERBOSE + #ifdef PSSCVERBOSE cout << "_particle_pool_size (" << _particle_pool_size << ") != particle array size (" << _physics_objects.size() << ")" << endl; -#endif + #endif result++; } pool_size = min(_particle_pool_size, _physics_objects.size()); @@ -616,18 +616,18 @@ sanity_check() { } if (real_live_particle_count != _living_particles) { -#ifdef PSSCVERBOSE + #ifdef PSSCVERBOSE cout << "manually counted live particle count (" << real_live_particle_count << ") != _living_particles (" << _living_particles << ")" << endl; -#endif + #endif result++; } if (real_dead_particle_count != _free_particle_fifo.size()) { -#ifdef PSSCVERBOSE + #ifdef PSSCVERBOSE cout << "manually counted dead particle count (" << real_dead_particle_count << ") != free particle fifo size (" << _free_particle_fifo.size() << ")" << endl; -#endif + #endif result++; } /////////////////////////////////////////////////////////////////// @@ -639,10 +639,10 @@ sanity_check() { // check that we're in bounds if (index >= pool_size) { -#ifdef PSSCVERBOSE + #ifdef PSSCVERBOSE cout << "index from free particle fifo (" << index << ") is too large; pool size is " << pool_size << endl; -#endif + #endif result++; continue; } @@ -650,9 +650,9 @@ sanity_check() { // check that the particle is indeed dead bp = (BaseParticle *) _physics_objects[index].p(); if (true == bp->get_alive()) { -#ifdef PSSCVERBOSE + #ifdef PSSCVERBOSE cout << "particle " << index << " in free fifo is not dead" << endl; -#endif + #endif result++; } } @@ -678,3 +678,90 @@ sanity_check() { return result; } #endif + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ParticleSystem:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"ParticleSystem"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write_free_particle_fifo +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ParticleSystem:: +write_free_particle_fifo(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); + out<<""<<"_free_particle_fifo ("<<_free_particle_fifo.size()<<" forces)\n"; + for (pdeque< int >::const_iterator i=_free_particle_fifo.begin(); + i != _free_particle_fifo.end(); + ++i) { + out.width(indent+2); out<<""; out<<(*i)<<"\n"; + } + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write_spawn_templates +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ParticleSystem:: +write_spawn_templates(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); + out<<""<<"_spawn_templates ("<<_spawn_templates.size()<<" templates)\n"; + for (pvector< PT(ParticleSystem) >::const_iterator i=_spawn_templates.begin(); + i != _spawn_templates.end(); + ++i) { + (*i)->write(out, indent+2); + } + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ParticleSystem:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"ParticleSystem:\n"; + out.width(indent+2); out<<""; out<<"_particle_pool_size "<<_particle_pool_size<<"\n"; + out.width(indent+2); out<<""; out<<"_living_particles "<<_living_particles<<"\n"; + out.width(indent+2); out<<""; out<<"_tics_since_birth "<<_tics_since_birth<<"\n"; + out.width(indent+2); out<<""; out<<"_litter_size "<<_litter_size<<"\n"; + out.width(indent+2); out<<""; out<<"_litter_spread "<<_litter_spread<<"\n"; + out.width(indent+2); out<<""; out<<"_system_age "<<_system_age<<"\n"; + out.width(indent+2); out<<""; out<<"_system_lifespan "<<_system_lifespan<<"\n"; + out.width(indent+2); out<<""; out<<"_factory "<<_factory<<"\n"; + out.width(indent+2); out<<""; out<<"_emitter "<<_emitter<<"\n"; + out.width(indent+2); out<<""; out<<"_renderer "<<_renderer<<"\n"; + out.width(indent+2); out<<""; out<<"_manager "<<_manager<<"\n"; + out.width(indent+2); out<<""; out<<"_template_system_flag "<<_template_system_flag<<"\n"; + out.width(indent+2); out<<""; out<<"_render_parent "<<_render_parent<<"\n"; + out.width(indent+2); out<<""; out<<"_render_node "<<_render_node<<"\n"; + out.width(indent+2); out<<""; out<<"_active_system_flag "<<_active_system_flag<<"\n"; + out.width(indent+2); out<<""; out<<"_local_velocity_flag "<<_local_velocity_flag<<"\n"; + out.width(indent+2); out<<""; out<<"_system_grows_older_flag "<<_system_grows_older_flag<<"\n"; + out.width(indent+2); out<<""; out<<"_spawn_on_death_flag "<<_spawn_on_death_flag<<"\n"; + out.width(indent+2); out<<""; out<<"_spawn_render_node "<<_spawn_render_node<<"\n"; + out.width(indent+2); out<<""; out<<"_i_was_spawned_flag "<<_i_was_spawned_flag<<"\n"; + write_free_particle_fifo(out, indent+2); + write_spawn_templates(out, indent+2); + Physical::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/particleSystem.h b/panda/src/particlesystem/particleSystem.h index 9cf8c51762..bf082e44ca 100644 --- a/panda/src/particlesystem/particleSystem.h +++ b/panda/src/particlesystem/particleSystem.h @@ -99,6 +99,11 @@ PUBLISHED: INLINE void induce_labor(); void update(float dt); + virtual void output(ostream &out) const; + virtual void write_free_particle_fifo(ostream &out, int indent=0) const; + virtual void write_spawn_templates(ostream &out, int indent=0) const; + virtual void write(ostream &out, int indent=0) const; + private: #ifdef PSSANITYCHECK int sanity_check(); diff --git a/panda/src/particlesystem/particleSystemManager.cxx b/panda/src/particlesystem/particleSystemManager.cxx index 0261eccdd1..979f8fcfe5 100644 --- a/panda/src/particlesystem/particleSystemManager.cxx +++ b/panda/src/particlesystem/particleSystemManager.cxx @@ -117,3 +117,51 @@ do_particles(float dt) { // cout << "PSM::do_particles finished." << endl; // cout << "ParticleSystemManager::doparticles exiting." << endl; } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ParticleSystemManager:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"ParticleSystemManager"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write_ps_list +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ParticleSystemManager:: +write_ps_list(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); + out<<""<<"_ps_list ("<<_ps_list.size()<<" systems)\n"; + for (plist< PT(ParticleSystem) >::const_iterator i=_ps_list.begin(); + i != _ps_list.end(); + ++i) { + (*i)->write(out, indent+2); + } + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ParticleSystemManager:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"ParticleSystemManager:\n"; + out.width(indent+2); out<<""; out<<"_nth_frame "<<_nth_frame<<"\n"; + out.width(indent+2); out<<""; out<<"_cur_frame "<<_cur_frame<<"\n"; + write_ps_list(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/particleSystemManager.h b/panda/src/particlesystem/particleSystemManager.h index f835a809de..48865cd263 100644 --- a/panda/src/particlesystem/particleSystemManager.h +++ b/panda/src/particlesystem/particleSystemManager.h @@ -44,6 +44,10 @@ PUBLISHED: void do_particles(float dt); + virtual void output(ostream &out) const; + virtual void write_ps_list(ostream &out, int indent=0) const; + virtual void write(ostream &out, int indent=0) const; + private: plist< PT(ParticleSystem) > _ps_list; diff --git a/panda/src/particlesystem/pointEmitter.cxx b/panda/src/particlesystem/pointEmitter.cxx index 539294ae3a..68e1a23b18 100644 --- a/panda/src/particlesystem/pointEmitter.cxx +++ b/panda/src/particlesystem/pointEmitter.cxx @@ -78,3 +78,31 @@ void PointEmitter:: assign_initial_velocity(LVector3f& vel) { vel.set(0,0,0); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void PointEmitter:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"PointEmitter"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void PointEmitter:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"PointEmitter:\n"; + out.width(indent+2); out<<""; out<<"_location "<<_location<<"\n"; + BaseParticleEmitter::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/pointEmitter.h b/panda/src/particlesystem/pointEmitter.h index ded7a546ce..9d6a7096ad 100644 --- a/panda/src/particlesystem/pointEmitter.h +++ b/panda/src/particlesystem/pointEmitter.h @@ -28,14 +28,17 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS PointEmitter : public BaseParticleEmitter { PUBLISHED: - PointEmitter(void); + PointEmitter(); PointEmitter(const PointEmitter ©); - virtual ~PointEmitter(void); + virtual ~PointEmitter(); - virtual BaseParticleEmitter *make_copy(void); + virtual BaseParticleEmitter *make_copy(); INLINE void set_location(const LPoint3f& p); - INLINE LPoint3f get_location(void) const; + INLINE LPoint3f get_location() const; + + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; private: LPoint3f _location; diff --git a/panda/src/particlesystem/pointParticle.cxx b/panda/src/particlesystem/pointParticle.cxx index a64dd3e314..295a054ad4 100644 --- a/panda/src/particlesystem/pointParticle.cxx +++ b/panda/src/particlesystem/pointParticle.cxx @@ -85,3 +85,30 @@ init() { void PointParticle:: update() { } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void PointParticle:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"PointParticle"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void PointParticle:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"PointParticle:\n"; + BaseParticle::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/pointParticle.h b/panda/src/particlesystem/pointParticle.h index aece5bab23..ec1038331f 100644 --- a/panda/src/particlesystem/pointParticle.h +++ b/panda/src/particlesystem/pointParticle.h @@ -37,6 +37,9 @@ public: virtual void update(); virtual PhysicsObject *make_copy() const; + + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; }; #endif // POINTPARTICLE_H diff --git a/panda/src/particlesystem/pointParticleFactory.cxx b/panda/src/particlesystem/pointParticleFactory.cxx index 3e3451519c..c548059647 100644 --- a/panda/src/particlesystem/pointParticleFactory.cxx +++ b/panda/src/particlesystem/pointParticleFactory.cxx @@ -69,3 +69,30 @@ BaseParticle *PointParticleFactory:: alloc_particle() const { return new PointParticle; } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void PointParticleFactory:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"PointParticleFactory"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void PointParticleFactory:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"PointParticleFactory:\n"; + BaseParticleFactory::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/pointParticleFactory.h b/panda/src/particlesystem/pointParticleFactory.h index 9d21ade6a5..591bb2e550 100644 --- a/panda/src/particlesystem/pointParticleFactory.h +++ b/panda/src/particlesystem/pointParticleFactory.h @@ -32,6 +32,9 @@ PUBLISHED: PointParticleFactory(const PointParticleFactory ©); virtual ~PointParticleFactory(); + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: virtual BaseParticle *alloc_particle() const; virtual void populate_child_particle(BaseParticle *bp) const; diff --git a/panda/src/particlesystem/pointParticleRenderer.cxx b/panda/src/particlesystem/pointParticleRenderer.cxx index d4674181f4..6ccf085e43 100644 --- a/panda/src/particlesystem/pointParticleRenderer.cxx +++ b/panda/src/particlesystem/pointParticleRenderer.cxx @@ -281,3 +281,41 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { _point_primitive->set_bound(BoundingSphere(aabb_center, radius)); get_render_node()->mark_bound_stale(); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void PointParticleRenderer:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"PointParticleRenderer"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void PointParticleRenderer:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"PointParticleRenderer:\n"; + out.width(indent+2); out<<""; out<<"_start_color "<<_start_color<<"\n"; + out.width(indent+2); out<<""; out<<"_end_color "<<_end_color<<"\n"; + out.width(indent+2); out<<""; out<<"_point_size "<<_point_size<<"\n"; + out.width(indent+2); out<<""; out<<"_point_primitive "<<_point_primitive<<"\n"; + out.width(indent+2); out<<""; out<<"_vertex_array "<<_vertex_array<<"\n"; + out.width(indent+2); out<<""; out<<"_color_array "<<_color_array<<"\n"; + out.width(indent+2); out<<""; out<<"_max_pool_size "<<_max_pool_size<<"\n"; + out.width(indent+2); out<<""; out<<"_blend_type "<<_blend_type<<"\n"; + out.width(indent+2); out<<""; out<<"_blend_method "<<_blend_method<<"\n"; + out.width(indent+2); out<<""; out<<"_aabb_min "<<_aabb_min<<"\n"; + out.width(indent+2); out<<""; out<<"_aabb_max "<<_aabb_max<<"\n"; + BaseParticleRenderer::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/pointParticleRenderer.h b/panda/src/particlesystem/pointParticleRenderer.h index f082dd7cf0..9852403b72 100644 --- a/panda/src/particlesystem/pointParticleRenderer.h +++ b/panda/src/particlesystem/pointParticleRenderer.h @@ -67,8 +67,12 @@ PUBLISHED: INLINE PointParticleBlendType get_blend_type() const; INLINE ParticleRendererBlendMethod get_blend_method() const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: - Colorf _start_color, _end_color; + Colorf _start_color; + Colorf _end_color; float _point_size; PT(GeomPoint) _point_primitive; @@ -81,7 +85,8 @@ private: PointParticleBlendType _blend_type; ParticleRendererBlendMethod _blend_method; - LPoint3f _aabb_min, _aabb_max; + LPoint3f _aabb_min; + LPoint3f _aabb_max; Colorf create_color(const BaseParticle *p); diff --git a/panda/src/particlesystem/rectangleEmitter.cxx b/panda/src/particlesystem/rectangleEmitter.cxx index 186cd62bdf..f39f318da3 100644 --- a/panda/src/particlesystem/rectangleEmitter.cxx +++ b/panda/src/particlesystem/rectangleEmitter.cxx @@ -96,7 +96,24 @@ assign_initial_velocity(LVector3f& vel) { // . //////////////////////////////////////////////////////////////////// void RectangleEmitter:: -output(ostream &out, unsigned int indent) const { - out.width(indent); out<<""; out<<"RectangleEmitter:\n"; - BaseParticleEmitter::output(out, indent+2); +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"RectangleEmitter"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void RectangleEmitter:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"RectangleEmitter:\n"; + out.width(indent+2); out<<""; out<<"_vmin "<<_vmin<<"\n"; + out.width(indent+2); out<<""; out<<"_vmax "<<_vmax<<"\n"; + BaseParticleEmitter::write(out, indent+2); + #endif //] NDEBUG } diff --git a/panda/src/particlesystem/rectangleEmitter.h b/panda/src/particlesystem/rectangleEmitter.h index 62542ec382..7e24e46a8a 100644 --- a/panda/src/particlesystem/rectangleEmitter.h +++ b/panda/src/particlesystem/rectangleEmitter.h @@ -39,11 +39,13 @@ PUBLISHED: INLINE LPoint2f get_min_bound() const; INLINE LPoint2f get_max_bound() const; - - virtual void output(ostream &out, unsigned int indent=0) const; + + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; private: - LPoint2f _vmin, _vmax; + LPoint2f _vmin; + LPoint2f _vmax; // CUSTOM EMISSION PARAMETERS // none diff --git a/panda/src/particlesystem/ringEmitter.cxx b/panda/src/particlesystem/ringEmitter.cxx index 10b3a53eab..f87021a087 100644 --- a/panda/src/particlesystem/ringEmitter.cxx +++ b/panda/src/particlesystem/ringEmitter.cxx @@ -102,3 +102,34 @@ assign_initial_velocity(LVector3f& vel) { vel.set(vel_x, vel_y, vel_z); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void RingEmitter:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"RingEmitter"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void RingEmitter:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"RingEmitter:\n"; + out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n"; + out.width(indent+2); out<<""; out<<"_aoe "<<_aoe<<"\n"; + out.width(indent+2); out<<""; out<<"_sin_theta "<<_sin_theta<<"\n"; + out.width(indent+2); out<<""; out<<"_cos_theta "<<_cos_theta<<"\n"; + BaseParticleEmitter::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/ringEmitter.h b/panda/src/particlesystem/ringEmitter.h index 37b71850bd..9e8661c1e6 100644 --- a/panda/src/particlesystem/ringEmitter.h +++ b/panda/src/particlesystem/ringEmitter.h @@ -40,6 +40,9 @@ PUBLISHED: INLINE float get_radius() const; INLINE float get_angle() const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: float _radius; diff --git a/panda/src/particlesystem/sparkleParticleRenderer.cxx b/panda/src/particlesystem/sparkleParticleRenderer.cxx index c1309190ce..3bc84fc3d0 100644 --- a/panda/src/particlesystem/sparkleParticleRenderer.cxx +++ b/panda/src/particlesystem/sparkleParticleRenderer.cxx @@ -262,3 +262,41 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { _line_primitive->set_bound(BoundingSphere(aabb_center, radius)); get_render_node()->mark_bound_stale(); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void SparkleParticleRenderer:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"SparkleParticleRenderer"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void SparkleParticleRenderer:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"SparkleParticleRenderer:\n"; + out.width(indent+2); out<<""; out<<"_center_color "<<_center_color<<"\n"; + out.width(indent+2); out<<""; out<<"_edge_color "<<_edge_color<<"\n"; + out.width(indent+2); out<<""; out<<"_birth_radius "<<_birth_radius<<"\n"; + out.width(indent+2); out<<""; out<<"_death_radius "<<_death_radius<<"\n"; + out.width(indent+2); out<<""; out<<"_line_primitive "<<_line_primitive<<"\n"; + out.width(indent+2); out<<""; out<<"_vertex_array "<<_vertex_array<<"\n"; + out.width(indent+2); out<<""; out<<"_color_array "<<_color_array<<"\n"; + out.width(indent+2); out<<""; out<<"_max_pool_size "<<_max_pool_size<<"\n"; + out.width(indent+2); out<<""; out<<"_life_scale "<<_life_scale<<"\n"; + out.width(indent+2); out<<""; out<<"_aabb_min "<<_aabb_min<<"\n"; + out.width(indent+2); out<<""; out<<"_aabb_max "<<_aabb_max<<"\n"; + BaseParticleRenderer::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/sparkleParticleRenderer.h b/panda/src/particlesystem/sparkleParticleRenderer.h index e75bb05dc2..0213fa92f1 100644 --- a/panda/src/particlesystem/sparkleParticleRenderer.h +++ b/panda/src/particlesystem/sparkleParticleRenderer.h @@ -68,6 +68,9 @@ PUBLISHED: INLINE float get_death_radius() const; INLINE SparkleParticleLifeScale get_life_scale() const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: Colorf _center_color; Colorf _edge_color; @@ -83,7 +86,8 @@ private: int _max_pool_size; SparkleParticleLifeScale _life_scale; - LPoint3f _aabb_min, _aabb_max; + LPoint3f _aabb_min; + LPoint3f _aabb_max; INLINE float get_radius(BaseParticle *bp); diff --git a/panda/src/particlesystem/sphereSurfaceEmitter.cxx b/panda/src/particlesystem/sphereSurfaceEmitter.cxx index 145c5cf3a4..bffc529528 100644 --- a/panda/src/particlesystem/sphereSurfaceEmitter.cxx +++ b/panda/src/particlesystem/sphereSurfaceEmitter.cxx @@ -83,3 +83,31 @@ void SphereSurfaceEmitter:: assign_initial_velocity(LVector3f& vel) { vel.set(0,0,0); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void SphereSurfaceEmitter:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"SphereSurfaceEmitter"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void SphereSurfaceEmitter:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"SphereSurfaceEmitter:\n"; + out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n"; + BaseParticleEmitter::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/sphereSurfaceEmitter.h b/panda/src/particlesystem/sphereSurfaceEmitter.h index e7d77dc8e8..71f4674791 100644 --- a/panda/src/particlesystem/sphereSurfaceEmitter.h +++ b/panda/src/particlesystem/sphereSurfaceEmitter.h @@ -37,6 +37,9 @@ PUBLISHED: INLINE void set_radius(float r); INLINE float get_radius() const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: float _radius; diff --git a/panda/src/particlesystem/sphereVolumeEmitter.cxx b/panda/src/particlesystem/sphereVolumeEmitter.cxx index 6ed2430974..c7f25741e7 100644 --- a/panda/src/particlesystem/sphereVolumeEmitter.cxx +++ b/panda/src/particlesystem/sphereVolumeEmitter.cxx @@ -97,3 +97,31 @@ assign_initial_velocity(LVector3f& vel) { // along vector from center to position vel = _particle_pos / _radius; } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void SphereVolumeEmitter:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"SphereVolumeEmitter"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void SphereVolumeEmitter:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"SphereVolumeEmitter:\n"; + out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n"; + BaseParticleEmitter::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/sphereVolumeEmitter.h b/panda/src/particlesystem/sphereVolumeEmitter.h index 87577c6be1..113af7f2d5 100644 --- a/panda/src/particlesystem/sphereVolumeEmitter.h +++ b/panda/src/particlesystem/sphereVolumeEmitter.h @@ -28,14 +28,17 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS SphereVolumeEmitter : public BaseParticleEmitter { PUBLISHED: - SphereVolumeEmitter(void); + SphereVolumeEmitter(); SphereVolumeEmitter(const SphereVolumeEmitter ©); - virtual ~SphereVolumeEmitter(void); + virtual ~SphereVolumeEmitter(); - virtual BaseParticleEmitter *make_copy(void); + virtual BaseParticleEmitter *make_copy(); INLINE void set_radius(float r); - INLINE float get_radius(void) const; + INLINE float get_radius() const; + + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; private: float _radius; diff --git a/panda/src/particlesystem/spriteParticleRenderer.cxx b/panda/src/particlesystem/spriteParticleRenderer.cxx index 86b9819e2d..d847a62d8c 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.cxx +++ b/panda/src/particlesystem/spriteParticleRenderer.cxx @@ -378,3 +378,50 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { _sprite_primitive->set_bound(BoundingSphere(aabb_center, radius)); get_render_node()->mark_bound_stale(); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void SpriteParticleRenderer:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"SpriteParticleRenderer"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void SpriteParticleRenderer:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"SpriteParticleRenderer:\n"; + out.width(indent+2); out<<""; out<<"_sprite_primitive "<<_sprite_primitive<<"\n"; + out.width(indent+2); out<<""; out<<"_vertex_array "<<_vertex_array<<"\n"; + out.width(indent+2); out<<""; out<<"_color_array "<<_color_array<<"\n"; + out.width(indent+2); out<<""; out<<"_x_texel_array "<<_x_texel_array<<"\n"; + out.width(indent+2); out<<""; out<<"_y_texel_array "<<_y_texel_array<<"\n"; + out.width(indent+2); out<<""; out<<"_theta_array "<<_theta_array<<"\n"; + out.width(indent+2); out<<""; out<<"_color "<<_color<<"\n"; + out.width(indent+2); out<<""; out<<"_initial_x_texel_ratio "<<_initial_x_texel_ratio<<"\n"; + out.width(indent+2); out<<""; out<<"_final_x_texel_ratio "<<_final_x_texel_ratio<<"\n"; + out.width(indent+2); out<<""; out<<"_initial_y_texel_ratio "<<_initial_y_texel_ratio<<"\n"; + out.width(indent+2); out<<""; out<<"_final_y_texel_ratio "<<_final_y_texel_ratio<<"\n"; + out.width(indent+2); out<<""; out<<"_theta "<<_theta<<"\n"; + out.width(indent+2); out<<""; out<<"_animate_x_ratio "<<_animate_x_ratio<<"\n"; + out.width(indent+2); out<<""; out<<"_animate_y_ratio "<<_animate_y_ratio<<"\n"; + out.width(indent+2); out<<""; out<<"_animate_theta "<<_animate_theta<<"\n"; + out.width(indent+2); out<<""; out<<"_blend_method "<<_blend_method<<"\n"; + out.width(indent+2); out<<""; out<<"_aabb_min "<<_aabb_min<<"\n"; + out.width(indent+2); out<<""; out<<"_aabb_max "<<_aabb_max<<"\n"; + out.width(indent+2); out<<""; out<<"_pool_size "<<_pool_size<<"\n"; + out.width(indent+2); out<<""; out<<"_source_type "<<_source_type<<"\n"; + BaseParticleRenderer::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/spriteParticleRenderer.h b/panda/src/particlesystem/spriteParticleRenderer.h index cd93b18ef8..848771796b 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.h +++ b/panda/src/particlesystem/spriteParticleRenderer.h @@ -87,6 +87,9 @@ PUBLISHED: INLINE ParticleRendererBlendMethod get_alpha_blend_method() const; INLINE bool get_alpha_disable() const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: PT(GeomSprite) _sprite_primitive; PTA_Vertexf _vertex_array; @@ -97,16 +100,20 @@ private: Colorf _color; - float _initial_x_texel_ratio, _final_x_texel_ratio; - float _initial_y_texel_ratio, _final_y_texel_ratio; + float _initial_x_texel_ratio; + float _final_x_texel_ratio; + float _initial_y_texel_ratio; + float _final_y_texel_ratio; float _theta; - bool _animate_x_ratio, _animate_y_ratio; + bool _animate_x_ratio; + bool _animate_y_ratio; bool _animate_theta; ParticleRendererBlendMethod _blend_method; - Vertexf _aabb_min, _aabb_max; + Vertexf _aabb_min; + Vertexf _aabb_max; int _pool_size; SourceType _source_type; diff --git a/panda/src/particlesystem/tangentRingEmitter.cxx b/panda/src/particlesystem/tangentRingEmitter.cxx index 4fb0af7722..ce2a148e1c 100644 --- a/panda/src/particlesystem/tangentRingEmitter.cxx +++ b/panda/src/particlesystem/tangentRingEmitter.cxx @@ -82,3 +82,33 @@ void TangentRingEmitter:: assign_initial_velocity(LVector3f& vel) { vel.set(-_y, _x, 0.0f); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void TangentRingEmitter:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"TangentRingEmitter"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void TangentRingEmitter:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"TangentRingEmitter:\n"; + out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n"; + out.width(indent+2); out<<""; out<<"_x "<<_x<<"\n"; + out.width(indent+2); out<<""; out<<"_y "<<_y<<"\n"; + BaseParticleEmitter::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/tangentRingEmitter.h b/panda/src/particlesystem/tangentRingEmitter.h index 7ca68d06f6..ac675d06b0 100644 --- a/panda/src/particlesystem/tangentRingEmitter.h +++ b/panda/src/particlesystem/tangentRingEmitter.h @@ -38,6 +38,9 @@ PUBLISHED: INLINE void set_radius(float r); INLINE float get_radius() const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: float _radius; @@ -46,7 +49,8 @@ private: /////////////////////////////// // scratch variables that carry over from position calc to velocity calc - float _x, _y; + float _x; + float _y; /////////////////////////////// virtual void assign_initial_position(LPoint3f& pos); diff --git a/panda/src/particlesystem/zSpinParticle.cxx b/panda/src/particlesystem/zSpinParticle.cxx index 68ba5778bb..68e6f2d991 100644 --- a/panda/src/particlesystem/zSpinParticle.cxx +++ b/panda/src/particlesystem/zSpinParticle.cxx @@ -122,3 +122,35 @@ float ZSpinParticle:: get_theta() const { return _cur_angle; } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ZSpinParticle:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"ZSpinParticle"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ZSpinParticle:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"ZSpinParticle:\n"; + out.width(indent+2); out<<""; out<<"_initial_angle "<<_initial_angle<<"\n"; + out.width(indent+2); out<<""; out<<"_final_angle "<<_final_angle<<"\n"; + out.width(indent+2); out<<""; out<<"_cur_angle "<<_cur_angle<<"\n"; + out.width(indent+2); out<<""; out<<"_angular_velocity "<<_angular_velocity<<"\n"; + out.width(indent+2); out<<""; out<<"_bUseAngularVelocity "<<_bUseAngularVelocity<<"\n"; + BaseParticle::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/zSpinParticle.h b/panda/src/particlesystem/zSpinParticle.h index 3717316114..aac6dd054b 100644 --- a/panda/src/particlesystem/zSpinParticle.h +++ b/panda/src/particlesystem/zSpinParticle.h @@ -57,6 +57,9 @@ public: INLINE void enable_angular_velocity(bool bEnabled); INLINE bool get_angular_velocity_enabled() const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: float _initial_angle; float _final_angle; diff --git a/panda/src/particlesystem/zSpinParticleFactory.cxx b/panda/src/particlesystem/zSpinParticleFactory.cxx index 3a2425f091..ea89664681 100644 --- a/panda/src/particlesystem/zSpinParticleFactory.cxx +++ b/panda/src/particlesystem/zSpinParticleFactory.cxx @@ -86,3 +86,37 @@ populate_child_particle(BaseParticle *bp) const { zsp->set_angular_velocity(_angular_velocity + SPREAD(_angular_velocity_spread)); zsp->enable_angular_velocity(_bUseAngularVelocity); } + +//////////////////////////////////////////////////////////////////// +// Function : output +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ZSpinParticleFactory:: +output(ostream &out) const { + #ifndef NDEBUG //[ + out<<"ZSpinParticleFactory"; + #endif //] NDEBUG +} + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void ZSpinParticleFactory:: +write(ostream &out, int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""; out<<"ZSpinParticleFactory:\n"; + out.width(indent+2); out<<""; out<<"_initial_angle "<<_initial_angle<<"\n"; + out.width(indent+2); out<<""; out<<"_initial_angle_spread "<<_initial_angle_spread<<"\n"; + out.width(indent+2); out<<""; out<<"_final_angle "<<_final_angle<<"\n"; + out.width(indent+2); out<<""; out<<"_final_angle_spread "<<_final_angle_spread<<"\n"; + out.width(indent+2); out<<""; out<<"_angular_velocity "<<_angular_velocity<<"\n"; + out.width(indent+2); out<<""; out<<"_angular_velocity_spread "<<_angular_velocity_spread<<"\n"; + out.width(indent+2); out<<""; out<<"_bUseAngularVelocity "<<_bUseAngularVelocity<<"\n"; + BaseParticleFactory::write(out, indent+2); + #endif //] NDEBUG +} diff --git a/panda/src/particlesystem/zSpinParticleFactory.h b/panda/src/particlesystem/zSpinParticleFactory.h index b69243274a..f74abd2016 100644 --- a/panda/src/particlesystem/zSpinParticleFactory.h +++ b/panda/src/particlesystem/zSpinParticleFactory.h @@ -50,14 +50,20 @@ PUBLISHED: INLINE void enable_angular_velocity(bool bEnabled); INLINE bool get_angular_velocity_enabled() const; + virtual void output(ostream &out) const; + virtual void write(ostream &out, int indent=0) const; + private: + float _initial_angle; + float _initial_angle_spread; + float _final_angle; + float _final_angle_spread; + float _angular_velocity; + float _angular_velocity_spread; + bool _bUseAngularVelocity; + 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"