output() and write()

This commit is contained in:
Dave Schuyler 2003-06-17 04:42:41 +00:00
parent 422c370c6b
commit eede24794a
52 changed files with 1016 additions and 118 deletions

View File

@ -79,7 +79,7 @@ output(ostream &out) const {
// <out>.
////////////////////////////////////////////////////////////////////
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";

View File

@ -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);

View File

@ -95,7 +95,26 @@ generate(LPoint3f& pos, LVector3f& vel) {
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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();

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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 &copy);

View File

@ -106,7 +106,24 @@ update_alpha_mode(ParticleRendererAlphaMode am) {
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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;

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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;
///////////////////////////////

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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;

View File

@ -96,7 +96,24 @@ assign_initial_velocity(LVector3f& vel) {
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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

View File

@ -249,7 +249,30 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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"

View File

@ -86,3 +86,30 @@ die() {
void OrientedParticle::
update() {
}
////////////////////////////////////////////////////////////////////
// Function : output
// Access : Public
// Description : Write a string representation of this instance to
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
void OrientedParticle::
write(ostream &out, int indent) const {
#ifndef NDEBUG //[
out.width(indent); out<<""; out<<"OrientedParticle:\n";
BaseParticle::write(out, indent+2);
#endif //] NDEBUG
}

View File

@ -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"

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
void OrientedParticleFactory::
write(ostream &out, int indent) const {
#ifndef NDEBUG //[
out.width(indent); out<<""; out<<"OrientedParticleFactory:\n";
BaseParticleFactory::write(out, indent+2);
#endif //] NDEBUG
}

View File

@ -30,20 +30,21 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS OrientedParticleFactory : public BaseParticleFactory {
PUBLISHED:
OrientedParticleFactory(void);
OrientedParticleFactory();
OrientedParticleFactory(const OrientedParticleFactory &copy);
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;

View File

@ -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<int>::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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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();

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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;

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -28,14 +28,17 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS PointEmitter : public BaseParticleEmitter {
PUBLISHED:
PointEmitter(void);
PointEmitter();
PointEmitter(const PointEmitter &copy);
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;

View File

@ -85,3 +85,30 @@ init() {
void PointParticle::
update() {
}
////////////////////////////////////////////////////////////////////
// Function : output
// Access : Public
// Description : Write a string representation of this instance to
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
void PointParticle::
write(ostream &out, int indent) const {
#ifndef NDEBUG //[
out.width(indent); out<<""; out<<"PointParticle:\n";
BaseParticle::write(out, indent+2);
#endif //] NDEBUG
}

View File

@ -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

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
void PointParticleFactory::
write(ostream &out, int indent) const {
#ifndef NDEBUG //[
out.width(indent); out<<""; out<<"PointParticleFactory:\n";
BaseParticleFactory::write(out, indent+2);
#endif //] NDEBUG
}

View File

@ -32,6 +32,9 @@ PUBLISHED:
PointParticleFactory(const PointParticleFactory &copy);
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;

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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);

View File

@ -96,7 +96,24 @@ assign_initial_velocity(LVector3f& vel) {
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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;

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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);

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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;

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -28,14 +28,17 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAPHYSICS SphereVolumeEmitter : public BaseParticleEmitter {
PUBLISHED:
SphereVolumeEmitter(void);
SphereVolumeEmitter();
SphereVolumeEmitter(const SphereVolumeEmitter &copy);
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;

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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;

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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);

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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;

View File

@ -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
// <out>.
////////////////////////////////////////////////////////////////////
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
// <out>.
////////////////////////////////////////////////////////////////////
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
}

View File

@ -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"