Skip to content

Commit a045e47

Browse files
committed
output() and write() changes
1 parent 03204e5 commit a045e47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+815
-287
lines changed

panda/src/particlesystem/baseParticle.cxx

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ BaseParticle(const BaseParticle &copy) {
4646
// Description : Default Destructor
4747
////////////////////////////////////////////////////////////////////
4848
BaseParticle::
49-
~BaseParticle(void) {
49+
~BaseParticle() {
5050
}
5151

5252
////////////////////////////////////////////////////////////////////
@@ -55,6 +55,38 @@ BaseParticle::
5555
// Description : for spriteParticleRenderer
5656
////////////////////////////////////////////////////////////////////
5757
float BaseParticle::
58-
get_theta(void) const {
58+
get_theta() const {
5959
return 0.0f;
6060
}
61+
62+
////////////////////////////////////////////////////////////////////
63+
// Function : output
64+
// Access : Public
65+
// Description : Write a string representation of this instance to
66+
// <out>.
67+
////////////////////////////////////////////////////////////////////
68+
void BaseParticle::
69+
output(ostream &out) const {
70+
#ifndef NDEBUG //[
71+
out<<"BaseParticle";
72+
#endif //] NDEBUG
73+
}
74+
75+
////////////////////////////////////////////////////////////////////
76+
// Function : write
77+
// Access : Public
78+
// Description : Write a string representation of this instance to
79+
// <out>.
80+
////////////////////////////////////////////////////////////////////
81+
void BaseParticle::
82+
write(ostream &out, unsigned int indent) const {
83+
#ifndef NDEBUG //[
84+
out.width(indent); out<<""; out<<"BaseParticle:\n";
85+
out.width(indent+2); out<<""; out<<"_age "<<_age<<"\n";
86+
out.width(indent+2); out<<""; out<<"_lifespan "<<_lifespan<<"\n";
87+
out.width(indent+2); out<<""; out<<"_alive "<<_alive<<"\n";
88+
out.width(indent+2); out<<""; out<<"_last_position "<<_last_position<<"\n";
89+
PhysicsObject::write(out, indent+2);
90+
#endif //] NDEBUG
91+
}
92+

panda/src/particlesystem/baseParticle.h

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,43 +28,45 @@
2828
// abstract base class.
2929
////////////////////////////////////////////////////////////////////
3030
class EXPCL_PANDAPHYSICS BaseParticle : public PhysicsObject {
31-
private:
32-
// NOTE: age and lifespan are in seconds.
33-
float _age;
34-
float _lifespan;
35-
bool _alive;
36-
37-
LPoint3f _last_position;
38-
39-
protected:
40-
BaseParticle(int lifespan = 1, bool alive = false);
41-
BaseParticle(const BaseParticle &copy);
42-
virtual ~BaseParticle(void);
43-
4431
public:
45-
4632
// local methods
4733
INLINE void set_age(float age);
4834
INLINE void set_lifespan(float lifespan);
4935
INLINE void set_alive(bool alive);
5036

51-
INLINE float get_age(void) const;
52-
INLINE float get_lifespan(void) const;
53-
INLINE bool get_alive(void) const;
37+
INLINE float get_age() const;
38+
INLINE float get_lifespan() const;
39+
INLINE bool get_alive() const;
5440

55-
INLINE float get_parameterized_age(void) const;
56-
INLINE float get_parameterized_vel(void) const;
41+
INLINE float get_parameterized_age() const;
42+
INLINE float get_parameterized_vel() const;
5743

5844
// child methods
59-
virtual void init(void) = 0;
60-
virtual void die(void) = 0;
61-
virtual void update(void) = 0;
45+
virtual void init() = 0;
46+
virtual void die() = 0;
47+
virtual void update() = 0;
6248

6349
// for spriteParticleRenderer
64-
virtual float get_theta(void) const;
50+
virtual float get_theta() const;
6551

6652
// from PhysicsObject
67-
virtual PhysicsObject *make_copy(void) const = 0;
53+
virtual PhysicsObject *make_copy() const = 0;
54+
55+
virtual void output(ostream &out) const;
56+
virtual void write(ostream &out, unsigned int indent=0) const;
57+
58+
protected:
59+
BaseParticle(int lifespan = 1, bool alive = false);
60+
BaseParticle(const BaseParticle &copy);
61+
virtual ~BaseParticle();
62+
63+
private:
64+
// NOTE: age and lifespan are in seconds.
65+
float _age;
66+
float _lifespan;
67+
bool _alive;
68+
69+
LPoint3f _last_position;
6870
};
6971

7072
#include "baseParticle.I"

panda/src/particlesystem/baseParticleRenderer.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ BaseParticleRenderer(const BaseParticleRenderer& copy) :
5757
// Description : Destructor
5858
////////////////////////////////////////////////////////////////////
5959
BaseParticleRenderer::
60-
~BaseParticleRenderer(void) {
60+
~BaseParticleRenderer() {
6161
}
6262

6363
////////////////////////////////////////////////////////////////////
@@ -67,7 +67,7 @@ BaseParticleRenderer::
6767
// enables alpha channeling.
6868
////////////////////////////////////////////////////////////////////
6969
void BaseParticleRenderer::
70-
enable_alpha(void) {
70+
enable_alpha() {
7171
_render_state = RenderState::make(TransparencyAttrib::make(TransparencyAttrib::M_alpha));
7272
}
7373

@@ -77,7 +77,7 @@ enable_alpha(void) {
7777
// Description : kills the intermediate alpha node/arc
7878
////////////////////////////////////////////////////////////////////
7979
void BaseParticleRenderer::
80-
disable_alpha(void) {
80+
disable_alpha() {
8181
_render_state = RenderState::make(TransparencyAttrib::make(TransparencyAttrib::M_none));
8282
}
8383

panda/src/particlesystem/baseParticleRenderer.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ class EXPCL_PANDAPHYSICS BaseParticleRenderer : public ReferenceCount {
5050
PP_BLEND_CUBIC
5151
};
5252

53-
virtual ~BaseParticleRenderer(void);
53+
virtual ~BaseParticleRenderer();
5454

55-
INLINE GeomNode *get_render_node(void) const;
55+
INLINE GeomNode *get_render_node() const;
5656

5757
INLINE void set_alpha_mode(ParticleRendererAlphaMode am);
58-
INLINE ParticleRendererAlphaMode get_alpha_mode(void) const;
58+
INLINE ParticleRendererAlphaMode get_alpha_mode() const;
5959

6060
INLINE void set_user_alpha(float ua);
6161
INLINE float get_user_alpha(void) const;
@@ -70,8 +70,8 @@ class EXPCL_PANDAPHYSICS BaseParticleRenderer : public ReferenceCount {
7070

7171
void update_alpha_mode(ParticleRendererAlphaMode am);
7272

73-
void enable_alpha(void);
74-
void disable_alpha(void);
73+
void enable_alpha();
74+
void disable_alpha();
7575

7676
INLINE float get_cur_alpha(BaseParticle* bp);
7777

@@ -95,12 +95,12 @@ class EXPCL_PANDAPHYSICS BaseParticleRenderer : public ReferenceCount {
9595
virtual void kill_particle(int index) = 0;
9696

9797

98-
virtual void init_geoms(void) = 0;
98+
virtual void init_geoms() = 0;
9999
virtual void render(pvector< PT(PhysicsObject) >& po_vector,
100100
int ttl_particles) = 0;
101101

102102
public:
103-
virtual BaseParticleRenderer *make_copy(void) = 0;
103+
virtual BaseParticleRenderer *make_copy() = 0;
104104

105105
friend class ParticleSystem;
106106
};

panda/src/particlesystem/config_particlesystem.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@ NotifyCategoryDecl(particlesystem, EXPCL_PANDAPHYSICS, EXPTP_PANDAPHYSICS);
2828

2929
extern EXPCL_PANDAPHYSICS void init_libparticlesystem();
3030

31+
#ifndef NDEBUG //[
32+
// Non-release build:
33+
#define PARTICLE_SYSTEM_DEBUG
34+
#else //][
35+
// Release build:
36+
#undef PARTICLE_SYSTEM_DEBUG
37+
#endif //]
38+
3139
#endif // CONFIG_PARTICLESYSTEM_H

panda/src/physics/actorNode.cxx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ActorNode(const ActorNode &copy) :
5656
// Description : destructor
5757
////////////////////////////////////////////////////////////////////
5858
ActorNode::
59-
~ActorNode(void) {
59+
~ActorNode() {
6060
}
6161

6262
////////////////////////////////////////////////////////////////////
@@ -66,7 +66,7 @@ ActorNode::
6666
// Physical, moving the node and subsequent geometry.
6767
////////////////////////////////////////////////////////////////////
6868
void ActorNode::
69-
update_transform(void) {
69+
update_transform() {
7070
LMatrix4f lcs = _mass_center->get_lcs();
7171

7272
// lock the callback so that this doesn't call transform_changed.
@@ -93,7 +93,6 @@ transform_changed() {
9393
CPT(TransformState) transform = get_transform();
9494

9595
// extract the position
96-
9796
LPoint3f pos;
9897
transform->get_mat().get_row3(pos,3);
9998

@@ -114,7 +113,24 @@ transform_changed() {
114113
// <out>.
115114
////////////////////////////////////////////////////////////////////
116115
void ActorNode::
117-
output(ostream &out, unsigned int indent) const {
116+
output(ostream &out) const {
117+
#ifndef NDEBUG //[
118+
out<<"ActorNode";
119+
#endif //] NDEBUG
120+
}
121+
122+
////////////////////////////////////////////////////////////////////
123+
// Function : write
124+
// Access : Public
125+
// Description : Write a string representation of this instance to
126+
// <out>.
127+
////////////////////////////////////////////////////////////////////
128+
void ActorNode::
129+
write(ostream &out, unsigned int indent) const {
130+
#ifndef NDEBUG //[
118131
out.width(indent); out<<""; out<<"ActorNode:\n";
119-
PhysicalNode::output(out, indent+2);
132+
out.width(indent+2); out<<""; out<<"_mass_center "<<_mass_center<<"\n";
133+
out.width(indent+2); out<<""; out<<"_ok_to_callback "<<_ok_to_callback<<"\n";
134+
PhysicalNode::write(out, indent+2);
135+
#endif //] NDEBUG
120136
}

panda/src/physics/actorNode.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class EXPCL_PANDAPHYSICS ActorNode : public PhysicalNode {
4040
// update the parent arc with PhysicsObject information
4141
void update_transform();
4242

43-
virtual void output(ostream &out, unsigned int indent=0) const;
43+
virtual void output(ostream &out) const;
44+
virtual void write(ostream &out, unsigned int indent=0) const;
4445

4546
private:
4647
// node hook if the client changes the node's transform.

panda/src/physics/angularEulerIntegrator.cxx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,22 @@ child_integrate(Physical *physical,
162162
// <out>.
163163
////////////////////////////////////////////////////////////////////
164164
void AngularEulerIntegrator::
165-
output(ostream &out, unsigned int indent) const {
165+
output(ostream &out) const {
166+
#ifndef NDEBUG //[
167+
out<<"AngularEulerIntegrator";
168+
#endif //] NDEBUG
169+
}
170+
171+
////////////////////////////////////////////////////////////////////
172+
// Function : write
173+
// Access : Public
174+
// Description : Write a string representation of this instance to
175+
// <out>.
176+
////////////////////////////////////////////////////////////////////
177+
void AngularEulerIntegrator::
178+
write(ostream &out, unsigned int indent) const {
179+
#ifndef NDEBUG //[
166180
out.width(indent); out<<""; out<<"AngularEulerIntegrator:\n";
167-
AngularIntegrator::output(out, indent+2);
181+
AngularIntegrator::write(out, indent+2);
182+
#endif //] NDEBUG
168183
}

panda/src/physics/angularEulerIntegrator.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@
2727
// physically modelable objects given a quantum dt.
2828
////////////////////////////////////////////////////////////////////
2929
class EXPCL_PANDAPHYSICS AngularEulerIntegrator : public AngularIntegrator {
30+
PUBLISHED:
31+
AngularEulerIntegrator();
32+
virtual ~AngularEulerIntegrator();
33+
34+
virtual void output(ostream &out) const;
35+
virtual void write(ostream &out, unsigned int indent=0) const;
36+
3037
private:
3138
virtual void child_integrate(Physical *physical,
3239
pvector< PT(AngularForce) >& forces,
3340
float dt);
34-
35-
virtual void output(ostream &out, unsigned int indent=0) const;
36-
37-
PUBLISHED:
38-
AngularEulerIntegrator(void);
39-
virtual ~AngularEulerIntegrator(void);
4041
};
4142

4243
#endif // EULERINTEGRATOR_H

panda/src/physics/angularForce.cxx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TypeHandle AngularForce::_type_handle;
2626
// Description : constructor
2727
////////////////////////////////////////////////////////////////////
2828
AngularForce::
29-
AngularForce(void) :
29+
AngularForce() :
3030
BaseForce() {
3131
}
3232

@@ -46,7 +46,7 @@ AngularForce(const AngularForce &copy) :
4646
// Description : destructor
4747
////////////////////////////////////////////////////////////////////
4848
AngularForce::
49-
~AngularForce(void) {
49+
~AngularForce() {
5050
}
5151

5252
////////////////////////////////////////////////////////////////////
@@ -66,7 +66,7 @@ get_vector(const PhysicsObject *po) {
6666
// Description : access query
6767
////////////////////////////////////////////////////////////////////
6868
bool AngularForce::
69-
is_linear(void) const {
69+
is_linear() const {
7070
return false;
7171
}
7272

@@ -77,7 +77,22 @@ is_linear(void) const {
7777
// <out>.
7878
////////////////////////////////////////////////////////////////////
7979
void AngularForce::
80-
output(ostream &out, unsigned int indent) const {
80+
output(ostream &out) const {
81+
#ifndef NDEBUG //[
82+
out<<"AngularForce";
83+
#endif //] NDEBUG
84+
}
85+
86+
////////////////////////////////////////////////////////////////////
87+
// Function : write
88+
// Access : Public
89+
// Description : Write a string representation of this instance to
90+
// <out>.
91+
////////////////////////////////////////////////////////////////////
92+
void AngularForce::
93+
write(ostream &out, unsigned int indent) const {
94+
#ifndef NDEBUG //[
8195
out.width(indent); out<<""; out<<"AngularForce:\n";
82-
BaseForce::output(out, indent+2);
96+
BaseForce::write(out, indent+2);
97+
#endif //] NDEBUG
8398
}

0 commit comments

Comments
 (0)