From 248cd826c8e72793da78901863cf31cf96d7324c Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 22 Mar 2002 01:48:52 +0000 Subject: [PATCH] upgrade particles to pgraph (broken at this point) --- .../src/particlesystem/baseParticleRenderer.I | 19 +--- .../particlesystem/baseParticleRenderer.cxx | 29 +++---- .../src/particlesystem/baseParticleRenderer.h | 29 +++---- .../src/particlesystem/geomParticleRenderer.I | 27 ++---- .../particlesystem/geomParticleRenderer.cxx | 86 +++++++++++-------- .../src/particlesystem/geomParticleRenderer.h | 14 ++- .../particlesystem/lineParticleRenderer.cxx | 7 +- panda/src/particlesystem/particleSystem.I | 24 +++--- panda/src/particlesystem/particleSystem.cxx | 70 +++++++-------- panda/src/particlesystem/particleSystem.h | 27 +++--- .../particlesystem/pointParticleRenderer.cxx | 12 +-- .../sparkleParticleRenderer.cxx | 10 ++- .../particlesystem/spriteParticleRenderer.cxx | 44 ++++------ .../particlesystem/spriteParticleRenderer.h | 18 ++-- panda/src/pgraph/qpnodePath.cxx | 23 ++--- panda/src/physics/angularEulerIntegrator.cxx | 2 - panda/src/physics/baseIntegrator.cxx | 25 +++--- panda/src/physics/forceNode.cxx | 21 ++--- panda/src/physics/forceNode.h | 20 +++-- panda/src/physics/linearEulerIntegrator.cxx | 2 - panda/src/physics/linearIntegrator.cxx | 2 - panda/src/physics/physicalNode.cxx | 23 ++--- panda/src/physics/physicalNode.h | 22 ++--- 23 files changed, 245 insertions(+), 311 deletions(-) diff --git a/panda/src/particlesystem/baseParticleRenderer.I b/panda/src/particlesystem/baseParticleRenderer.I index 0876f2d36e..84ed13ede5 100644 --- a/panda/src/particlesystem/baseParticleRenderer.I +++ b/panda/src/particlesystem/baseParticleRenderer.I @@ -21,28 +21,11 @@ // Class : Public // Description : Query the geomnode pointer //////////////////////////////////////////////////////////////////// -INLINE GeomNode *BaseParticleRenderer:: +INLINE qpGeomNode *BaseParticleRenderer:: get_render_node(void) const { return _render_node; } -//////////////////////////////////////////////////////////////////// -// Function : disable_alpha -// Access : Private -// Description : kills the intermediate alpha node/arc -//////////////////////////////////////////////////////////////////// -INLINE void BaseParticleRenderer:: -disable_alpha(void) { - _alpha_node.clear(); - - if (_alpha_arc.is_null() == false) { - remove_arc(_alpha_arc); - _alpha_arc.clear(); - } - - _interface_node = _render_node; -} - //////////////////////////////////////////////////////////////////// // Function : set_alpha_mode // Access : public diff --git a/panda/src/particlesystem/baseParticleRenderer.cxx b/panda/src/particlesystem/baseParticleRenderer.cxx index 685be76b12..5a4d537128 100644 --- a/panda/src/particlesystem/baseParticleRenderer.cxx +++ b/panda/src/particlesystem/baseParticleRenderer.cxx @@ -16,10 +16,10 @@ // //////////////////////////////////////////////////////////////////// -#include -#include +#include "pandabase.h" #include "baseParticleRenderer.h" +#include "transparencyAttrib.h" //////////////////////////////////////////////////////////////////// // Function : BaseParticleRenderer @@ -28,9 +28,8 @@ //////////////////////////////////////////////////////////////////// BaseParticleRenderer:: BaseParticleRenderer(ParticleRendererAlphaMode alpha_mode) : - _alpha_arc((RenderRelation *) NULL), _alpha_mode(PR_NOT_INITIALIZED_YET) { - _render_node = new GeomNode("BaseParticleRenderer render node"); + _render_node = new qpGeomNode("BaseParticleRenderer render node"); _user_alpha = 1.0f; @@ -44,9 +43,8 @@ BaseParticleRenderer(ParticleRendererAlphaMode alpha_mode) : //////////////////////////////////////////////////////////////////// BaseParticleRenderer:: BaseParticleRenderer(const BaseParticleRenderer& copy) : - _alpha_arc((RenderRelation *) NULL), _alpha_mode(PR_ALPHA_NONE) { - _render_node = new GeomNode("BaseParticleRenderer render node"); + _render_node = new qpGeomNode("BaseParticleRenderer render node"); _user_alpha = copy._user_alpha; @@ -60,8 +58,6 @@ BaseParticleRenderer(const BaseParticleRenderer& copy) : //////////////////////////////////////////////////////////////////// BaseParticleRenderer:: ~BaseParticleRenderer(void) { - if(_alpha_mode != PR_ALPHA_NONE) - remove_arc(_alpha_arc); } //////////////////////////////////////////////////////////////////// @@ -72,14 +68,17 @@ BaseParticleRenderer:: //////////////////////////////////////////////////////////////////// void BaseParticleRenderer:: enable_alpha(void) { - _render_node->clear(); + _render_state = RenderState::make(TransparencyAttrib::make(TransparencyAttrib::M_alpha)); +} - _alpha_node = new GeomNode("BaseParticleRenderer alpha node"); - - _alpha_arc = new RenderRelation(_render_node, _alpha_node); - _alpha_arc->set_transition(new TransparencyTransition(TransparencyProperty::M_alpha)); - - _interface_node = _alpha_node; +//////////////////////////////////////////////////////////////////// +// Function : disable_alpha +// Access : Private +// Description : kills the intermediate alpha node/arc +//////////////////////////////////////////////////////////////////// +void BaseParticleRenderer:: +disable_alpha(void) { + _render_state = RenderState::make(TransparencyAttrib::make(TransparencyAttrib::M_none)); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/particlesystem/baseParticleRenderer.h b/panda/src/particlesystem/baseParticleRenderer.h index 50318a3d96..f2e84ed039 100644 --- a/panda/src/particlesystem/baseParticleRenderer.h +++ b/panda/src/particlesystem/baseParticleRenderer.h @@ -19,13 +19,11 @@ #ifndef BASEPARTICLERENDERER_H #define BASEPARTICLERENDERER_H -#include -#include -#include -#include -#include -#include -#include +#include "pandabase.h" +#include "referenceCount.h" +#include "physicsObject.h" +#include "renderState.h" +#include "qpgeomNode.h" #include "particleCommonFuncs.h" #include "baseParticle.h" @@ -38,14 +36,7 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS BaseParticleRenderer : public ReferenceCount { private: - PT(GeomNode) _render_node; - - // children of this class don't know anything about alpha. - // they should just interact with _interface_node, and link geometry - // from/to that. - - PT(GeomNode) _alpha_node; - PT(RenderRelation) _alpha_arc; + PT(qpGeomNode) _render_node; float _user_alpha; @@ -81,7 +72,7 @@ PUBLISHED: virtual ~BaseParticleRenderer(void); - INLINE GeomNode *get_render_node(void) const; + INLINE qpGeomNode *get_render_node(void) const; INLINE void set_alpha_mode(ParticleRendererAlphaMode am); INLINE ParticleRendererAlphaMode get_alpha_mode(void) const; @@ -90,8 +81,6 @@ PUBLISHED: INLINE float get_user_alpha(void) const; protected: - GeomNode *_interface_node; - ParticleRendererAlphaMode _alpha_mode; BaseParticleRenderer(ParticleRendererAlphaMode alpha_decay = PR_ALPHA_NONE); @@ -100,12 +89,14 @@ protected: void update_alpha_mode(ParticleRendererAlphaMode am); void enable_alpha(void); - INLINE void disable_alpha(void); + void disable_alpha(void); INLINE float get_cur_alpha(BaseParticle* bp); virtual void resize_pool(int new_size) = 0; + CPT(RenderState) _render_state; + public: virtual BaseParticleRenderer *make_copy(void) = 0; diff --git a/panda/src/particlesystem/geomParticleRenderer.I b/panda/src/particlesystem/geomParticleRenderer.I index 0ae2f2addf..c290348ad2 100644 --- a/panda/src/particlesystem/geomParticleRenderer.I +++ b/panda/src/particlesystem/geomParticleRenderer.I @@ -21,13 +21,13 @@ // Access : public //////////////////////////////////////////////////////////////////// -// we're forcing a pool resize to remove every arc in the vector. -// this is because arcs are reference-counted, and we have to -// explicitly remove them from the node they were previously -// pointing at. +// we're forcing a pool resize to remove every node in the vector. +// this is because nodes are reference-counted, and we have to +// explicitly remove them from the node they were previously parented +// to. INLINE void GeomParticleRenderer:: -set_geom_node(Node *node) { +set_geom_node(PandaNode *node) { _geom_node = node; resize_pool(_pool_size); } @@ -37,22 +37,7 @@ set_geom_node(Node *node) { // Access : public //////////////////////////////////////////////////////////////////// -INLINE Node *GeomParticleRenderer:: +INLINE PandaNode *GeomParticleRenderer:: get_geom_node(void) { return _geom_node; } - -//////////////////////////////////////////////////////////////////// -// Function : kill_arcs -// Access : private -//////////////////////////////////////////////////////////////////// - -INLINE void GeomParticleRenderer:: -kill_arcs(void) { - pvector< PT(RenderRelation) >::iterator vec_iter = _arc_vector.begin(); - - for (; vec_iter != _arc_vector.end(); vec_iter++) - remove_arc(*vec_iter); - - _arc_vector.erase(_arc_vector.begin(), _arc_vector.end()); -} diff --git a/panda/src/particlesystem/geomParticleRenderer.cxx b/panda/src/particlesystem/geomParticleRenderer.cxx index 6cb0a67e62..87c01cbf90 100644 --- a/panda/src/particlesystem/geomParticleRenderer.cxx +++ b/panda/src/particlesystem/geomParticleRenderer.cxx @@ -19,8 +19,8 @@ #include "geomParticleRenderer.h" #include "baseParticle.h" -#include -#include +#include "transformState.h" +#include "colorAttrib.h" //////////////////////////////////////////////////////////////////// // Function : GeomParticleRenderer @@ -29,13 +29,11 @@ //////////////////////////////////////////////////////////////////// GeomParticleRenderer:: -GeomParticleRenderer(ParticleRendererAlphaMode am, Node *geom_node) : +GeomParticleRenderer(ParticleRendererAlphaMode am, PandaNode *geom_node) : BaseParticleRenderer(am), _geom_node(geom_node), _pool_size(0) { - _dead_particle_parent_node = new Node; - if (_geom_node.is_null()) - _geom_node = _dead_particle_parent_node; + _geom_node = new PandaNode("empty"); } //////////////////////////////////////////////////////////////////// @@ -47,9 +45,6 @@ GeomParticleRenderer(ParticleRendererAlphaMode am, Node *geom_node) : GeomParticleRenderer:: GeomParticleRenderer(const GeomParticleRenderer& copy) : BaseParticleRenderer(copy), _pool_size(0) { - - _dead_particle_parent_node = new Node; - _geom_node = copy._geom_node; } @@ -61,7 +56,7 @@ GeomParticleRenderer(const GeomParticleRenderer& copy) : GeomParticleRenderer:: ~GeomParticleRenderer(void) { - kill_arcs(); + kill_nodes(); } //////////////////////////////////////////////////////////////////// @@ -93,21 +88,39 @@ init_geoms(void) { void GeomParticleRenderer:: resize_pool(int new_size) { - kill_arcs(); + kill_nodes(); - // now repopulate the vector + // now repopulate the vector with a bunch of NULLS, representing + // potential instances of the _geom_node. int i; - RenderRelation *rr; - for (i = 0; i < new_size; i++) { - rr = new RenderRelation(_dead_particle_parent_node, _geom_node); - _arc_vector.push_back(rr); + _node_vector.push_back(NULL); } _pool_size = new_size; } +//////////////////////////////////////////////////////////////////// +// Function : kill_nodes +// Access : private +//////////////////////////////////////////////////////////////////// + +INLINE void GeomParticleRenderer:: +kill_nodes(void) { + pvector< PT(PandaNode) >::iterator vec_iter = _node_vector.begin(); + + PandaNode *render_node = get_render_node(); + for (; vec_iter != _node_vector.end(); vec_iter++) { + PandaNode *node = *vec_iter; + if (node != (PandaNode *)NULL) { + render_node->remove_child(node); + } + } + + _node_vector.erase(_node_vector.begin(), _node_vector.end()); +} + //////////////////////////////////////////////////////////////////// // Function : birth_particle // Access : Private, virtual @@ -116,7 +129,11 @@ resize_pool(int new_size) { void GeomParticleRenderer:: birth_particle(int index) { - _arc_vector[index]->change_parent(_interface_node); + nassertv(_node_vector[index] == (PandaNode *)NULL); + PandaNode *node = new PandaNode(""); + get_render_node()->add_child(node); + node->add_child(_geom_node); + _node_vector[index] = node; } //////////////////////////////////////////////////////////////////// @@ -127,7 +144,8 @@ birth_particle(int index) { void GeomParticleRenderer:: kill_particle(int index) { - _arc_vector[index]->change_parent(_dead_particle_parent_node); + get_render_node()->remove_child(_node_vector[index]); + _node_vector[index] = (PandaNode *)NULL; } //////////////////////////////////////////////////////////////////// @@ -142,41 +160,39 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { LPoint3f pos; int i, remaining_particles = ttl_particles; - pvector< PT(RenderRelation) >::iterator cur_arc_iter = _arc_vector.begin(); + pvector< PT(PandaNode) >::iterator cur_node_iter = _node_vector.begin(); // run through the particle vector for (i = 0; i < (int)po_vector.size(); i++) { - RenderRelation *cur_arc; + PandaNode *cur_node; cur_particle = (BaseParticle *) po_vector[i].p(); - cur_arc = *cur_arc_iter; + cur_node = *cur_node_iter; if (cur_particle->get_alive() == true) { // living particle pos = cur_particle->get_position(); - PT(TransformTransition) xform; - PT(ColorTransition) alpha; - xform = new TransformTransition(LMatrix4f::translate_mat(pos)); + cur_node->set_state(_render_state); if ((_alpha_mode != PR_ALPHA_NONE)) { float alpha_scalar; - if(_alpha_mode == PR_ALPHA_USER) { - alpha_scalar=get_user_alpha(); - } else { - alpha_scalar = cur_particle->get_parameterized_age(); - if (_alpha_mode == PR_ALPHA_OUT) - alpha_scalar = 1.0f - alpha_scalar; + if(_alpha_mode == PR_ALPHA_USER) { + alpha_scalar=get_user_alpha(); + } else { + alpha_scalar = cur_particle->get_parameterized_age(); + if (_alpha_mode == PR_ALPHA_OUT) + alpha_scalar = 1.0f - alpha_scalar; } - - alpha = new ColorTransition(1.0f, 1.0f, 1.0f, alpha_scalar); - cur_arc->set_transition(alpha); + + cur_node->set_attrib(ColorAttrib::make_flat + (Colorf(1.0f, 1.0f, 1.0f, alpha_scalar))); } - cur_arc->set_transition(xform); + cur_node->set_transform(TransformState::make_pos(pos)); // maybe get out early if possible. @@ -186,6 +202,6 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { break; } - cur_arc_iter++; + cur_node_iter++; } } diff --git a/panda/src/particlesystem/geomParticleRenderer.h b/panda/src/particlesystem/geomParticleRenderer.h index aa26d29791..e98d7e2182 100644 --- a/panda/src/particlesystem/geomParticleRenderer.h +++ b/panda/src/particlesystem/geomParticleRenderer.h @@ -32,15 +32,12 @@ class EXPCL_PANDAPHYSICS GeomParticleRenderer : public BaseParticleRenderer { private: - PT(Node) _geom_node; - PT(Node) _dead_particle_parent_node; + PT(PandaNode) _geom_node; - pvector< PT(RenderRelation) > _arc_vector; + pvector< PT(PandaNode) > _node_vector; int _pool_size; - INLINE void kill_arcs(void); - // geomparticlerenderer takes advantage of the birth/death functions virtual void birth_particle(int index); @@ -51,15 +48,16 @@ private: int ttl_particles); virtual void resize_pool(int new_size); + void kill_nodes(void); PUBLISHED: GeomParticleRenderer(ParticleRendererAlphaMode am = PR_ALPHA_NONE, - Node *geom_node = (Node *) NULL); + PandaNode *geom_node = (PandaNode *) NULL); GeomParticleRenderer(const GeomParticleRenderer& copy); virtual ~GeomParticleRenderer(void); - INLINE void set_geom_node(Node *node); - INLINE Node *get_geom_node(void); + INLINE void set_geom_node(PandaNode *node); + INLINE PandaNode *get_geom_node(void); virtual BaseParticleRenderer *make_copy(void); }; diff --git a/panda/src/particlesystem/lineParticleRenderer.cxx b/panda/src/particlesystem/lineParticleRenderer.cxx index 85ac9bc017..1e1fb9dfd0 100644 --- a/panda/src/particlesystem/lineParticleRenderer.cxx +++ b/panda/src/particlesystem/lineParticleRenderer.cxx @@ -138,8 +138,9 @@ void LineParticleRenderer:: init_geoms(void) { _line_primitive->set_num_prims(0); - _interface_node->clear(); - _interface_node->add_geom(_line_primitive); + qpGeomNode *render_node = get_render_node(); + render_node->remove_all_geoms(); + render_node->add_geom(_line_primitive, _render_state); } //////////////////////////////////////////////////////////////////// @@ -237,5 +238,5 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { LPoint3f aabb_center = (_aabb_min + _aabb_max) * 0.5f; float radius = (aabb_center - _aabb_min).length(); - _interface_node->set_bound(BoundingSphere(aabb_center, radius)); + get_render_node()->set_bound(BoundingSphere(aabb_center, radius)); } diff --git a/panda/src/particlesystem/particleSystem.I b/panda/src/particlesystem/particleSystem.I index 9f273d98a8..f0292e230f 100644 --- a/panda/src/particlesystem/particleSystem.I +++ b/panda/src/particlesystem/particleSystem.I @@ -84,10 +84,11 @@ set_renderer(BaseParticleRenderer *r) { _renderer = r; _renderer->resize_pool(_particle_pool_size); - if (_render_arc.is_null() == false) - remove_arc(_render_arc); + if (!_render_node.is_null()) + _render_parent->remove_child(_render_node); - _render_arc = new RenderRelation(_render_parent, r->get_render_node()); + _render_node = _renderer->get_render_node(); + _render_parent->add_child(_render_node); } //////////////////////////////////////////////////////////////////// @@ -180,7 +181,7 @@ set_system_age(float age) { //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: -set_spawn_render_node(Node *node) { +set_spawn_render_node(PandaNode *node) { _spawn_render_node = node; } @@ -190,14 +191,13 @@ set_spawn_render_node(Node *node) { //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: -set_render_parent(Node *node) { - if (_render_arc.is_null() == false) { - remove_arc(_render_arc); - } +set_render_parent(PandaNode *node) { + if (!_render_node.is_null()) + _render_parent->remove_child(_render_node); _render_parent = node; - _render_arc = new RenderRelation(_render_parent, - _renderer->get_render_node()); + _render_node = _renderer->get_render_node(); + _render_parent->add_child(_render_node); } //////////////////////////////////////////////////////////////////// @@ -372,7 +372,7 @@ get_i_was_spawned_flag(void) const { // Function : get_spawn_render_node // Access : public //////////////////////////////////////////////////////////////////// -INLINE Node *ParticleSystem:: +INLINE PandaNode *ParticleSystem:: get_spawn_render_node(void) const { return _spawn_render_node; } @@ -381,7 +381,7 @@ get_spawn_render_node(void) const { // Function : get_render_parent // Access : public //////////////////////////////////////////////////////////////////// -INLINE Node *ParticleSystem:: +INLINE PandaNode *ParticleSystem:: get_render_parent(void) const { return _render_parent; } diff --git a/panda/src/particlesystem/particleSystem.cxx b/panda/src/particlesystem/particleSystem.cxx index 5023c13d29..a6816177c4 100644 --- a/panda/src/particlesystem/particleSystem.cxx +++ b/panda/src/particlesystem/particleSystem.cxx @@ -18,15 +18,14 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "luse.h" +#include "lmat_ops.h" +#include "clockObject.h" +#include "physicsManager.h" +#include "physicalNode.h" +#include "nearly_zero.h" +#include "transformState.h" +#include "qpnodePath.h" #include "config_particlesystem.h" #include "particleSystem.h" @@ -63,8 +62,8 @@ ParticleSystem(int pool_size) : // set_emitter(), etc...) forces them to set themselves up for the // system, keeping the pool sizes consistent. - _render_arc.clear(); - _render_parent = new NamedNode("ParticleSystem default render parent"); + _render_node.clear(); + _render_parent = new PandaNode("ParticleSystem default render parent"); set_emitter(new SphereSurfaceEmitter); @@ -100,9 +99,9 @@ ParticleSystem(const ParticleSystem& copy) : _renderer = copy._renderer->make_copy(); _factory = copy._factory; - _render_arc = copy._render_arc; - _render_parent = copy._render_parent; + _render_node = _renderer->get_render_node(); + _render_parent->add_child(_render_node); _tics_since_birth = _birth_rate; _system_lifespan = copy._system_lifespan; @@ -120,15 +119,12 @@ ParticleSystem:: ~ParticleSystem(void) { set_pool_size(0); - if (_template_system_flag == false) { + if (!_template_system_flag) { _renderer.clear(); - if (_render_arc.is_null() == false) - remove_arc(_render_arc); + if (!_render_node.is_null()) + _render_parent->remove_child(_render_node); } - - if (_i_was_spawned_flag == true) - remove_arc(_physical_node_arc); } //////////////////////////////////////////////////////////////////// @@ -174,14 +170,15 @@ birth_particle(void) { // get the location of the new particle. LPoint3f new_pos, world_pos; LVector3f new_vel; - LMatrix4f birth_to_render_xform; - GeomNode *render_node; + qpGeomNode *render_node; _emitter->generate(new_pos, new_vel); render_node = _renderer->get_render_node(); // go from birth space to render space - get_rel_mat(get_physical_node(), render_node, birth_to_render_xform); + qpNodePath physical_np(get_physical_node()); + qpNodePath render_np(render_node); + const LMatrix4f &birth_to_render_xform = physical_np.get_mat(render_np); world_pos = new_pos * birth_to_render_xform; // cout << "New particle at " << world_pos << endl; @@ -240,17 +237,14 @@ spawn_child_system(BaseParticle *bp) { return; } - if (this_pn->get_num_parents(RenderRelation::get_class_type()) == 0) { + if (this_pn->get_num_parents() == 0) { physics_cat.error() << "ParticleSystem::spawn_child_system: " << "PhysicalNode this system is contained in " << "has no parent, aborting." << endl; return; } - NodeRelation *parent_relation = - this_pn->get_parent(RenderRelation::get_class_type(), 0); - - Node *parent = parent_relation->get_parent(); + PandaNode *parent = this_pn->get_parent(0); // handle the spawn templates int new_ps_index = rand() % _spawn_templates.size(); @@ -262,25 +256,27 @@ spawn_child_system(BaseParticle *bp) { // first, set up the render node info. new_ps->_render_parent = _spawn_render_node; - new_ps->_render_arc = new RenderRelation(new_ps->_render_parent, - new_ps->_renderer->get_render_node()); + new_ps->_render_node = new_ps->_renderer->get_render_node(); + new_ps->_render_parent->add_child(new_ps->_render_node); // now set up the new system's PhysicalNode. - PT(PhysicalNode) new_pn = new PhysicalNode; + PT(PhysicalNode) new_pn = new PhysicalNode("new_pn"); new_pn->add_physical(new_ps); - // the arc from the parent to the new child has to represent the - // transform from the current system up to its parent, and then - // subsequently down to the new child. - PT(RenderRelation) rr = new RenderRelation(parent, new_pn); + // the transform on the new child has to represent the transform + // from the current system up to its parent, and then subsequently + // down to the new child. + parent->add_child(new_pn); - LMatrix4f old_system_to_parent_xform; - get_rel_mat(get_physical_node(), parent, old_system_to_parent_xform); + qpNodePath parent_np(parent); + qpNodePath physical_np(get_physical_node()); + + const LMatrix4f &old_system_to_parent_xform = physical_np.get_mat(parent_np); LMatrix4f child_space_xform = old_system_to_parent_xform * bp->get_lcs(); - rr->set_transition(new TransformTransition(child_space_xform)); + new_pn->set_transform(TransformState::make_mat(child_space_xform)); // tack the new system onto the managers _manager->attach_particlesystem(new_ps); diff --git a/panda/src/particlesystem/particleSystem.h b/panda/src/particlesystem/particleSystem.h index b300d26248..186c5739e5 100644 --- a/panda/src/particlesystem/particleSystem.h +++ b/panda/src/particlesystem/particleSystem.h @@ -25,12 +25,11 @@ #ifndef PARTICLESYSTEM_H #define PARTICLESYSTEM_H -#include -#include -#include -#include -#include -#include +#include "pandabase.h" +#include "pointerTo.h" +#include "physical.h" +#include "pandaNode.h" +#include "referenceCount.h" #include "pdeque.h" @@ -78,8 +77,8 @@ private: // _render_parent is the ALREADY ALLOC'D node under which this // system will render its particles. - PT(Node) _render_parent; - PT(RenderRelation) _render_arc; + PT(PandaNode) _render_parent; + PT(PandaNode) _render_node; bool _active_system_flag; bool _local_velocity_flag; @@ -88,15 +87,13 @@ private: // information for systems that will spawn bool _spawn_on_death_flag; - PT(Node) _spawn_render_node; + PT(PandaNode) _spawn_render_node; pvector< PT(ParticleSystem) > _spawn_templates; void spawn_child_system(BaseParticle *bp); // information for spawned systems - bool _i_was_spawned_flag; - PT(RenderRelation) _physical_node_arc; PUBLISHED: // constructor/destructor @@ -116,9 +113,9 @@ PUBLISHED: INLINE void set_system_age(float age); INLINE void set_active_system_flag(bool a); INLINE void set_spawn_on_death_flag(bool sod); - INLINE void set_spawn_render_node(Node *node); + INLINE void set_spawn_render_node(PandaNode *node); INLINE void set_template_system_flag(bool tsf); - INLINE void set_render_parent(Node *node); + INLINE void set_render_parent(PandaNode *node); INLINE void set_renderer(BaseParticleRenderer *r); INLINE void set_emitter(BaseParticleEmitter *e); INLINE void set_factory(BaseParticleFactory *f); @@ -133,10 +130,10 @@ PUBLISHED: INLINE float get_system_age(void) const; INLINE bool get_active_system_flag(void) const; INLINE bool get_spawn_on_death_flag(void) const; - INLINE Node *get_spawn_render_node(void) const; + INLINE PandaNode *get_spawn_render_node(void) const; INLINE bool get_i_was_spawned_flag(void) const; INLINE int get_living_particles(void) const; - INLINE Node *get_render_parent(void) const; + INLINE PandaNode *get_render_parent(void) const; INLINE BaseParticleRenderer *get_renderer(void) const; INLINE BaseParticleEmitter *get_emitter(void) const; INLINE BaseParticleFactory *get_factory(void) const; diff --git a/panda/src/particlesystem/pointParticleRenderer.cxx b/panda/src/particlesystem/pointParticleRenderer.cxx index e6f948f67f..40dfca2069 100644 --- a/panda/src/particlesystem/pointParticleRenderer.cxx +++ b/panda/src/particlesystem/pointParticleRenderer.cxx @@ -16,8 +16,9 @@ // //////////////////////////////////////////////////////////////////// -#include #include "pointParticleRenderer.h" +#include "boundingSphere.h" +#include "qpgeomNode.h" //////////////////////////////////////////////////////////////////// // Function : PointParticleRenderer @@ -114,9 +115,10 @@ init_geoms(void) { _point_primitive->set_num_prims(0); _point_primitive->set_size(_point_size); - - _interface_node->clear(); - _interface_node->add_geom(_point_primitive); + + qpGeomNode *render_node = get_render_node(); + render_node->remove_all_geoms(); + render_node->add_geom(_point_primitive, _render_state); } //////////////////////////////////////////////////////////////////// @@ -276,5 +278,5 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { LPoint3f aabb_center = _aabb_min + ((_aabb_max - _aabb_min) * 0.5f); float radius = (aabb_center - _aabb_min).length(); - _interface_node->set_bound(BoundingSphere(aabb_center, radius)); + get_render_node()->set_bound(BoundingSphere(aabb_center, radius)); } diff --git a/panda/src/particlesystem/sparkleParticleRenderer.cxx b/panda/src/particlesystem/sparkleParticleRenderer.cxx index b84f2cd2d8..8e391d4bae 100644 --- a/panda/src/particlesystem/sparkleParticleRenderer.cxx +++ b/panda/src/particlesystem/sparkleParticleRenderer.cxx @@ -18,7 +18,8 @@ #include "sparkleParticleRenderer.h" -#include +#include "boundingSphere.h" +#include "qpgeomNode.h" //////////////////////////////////////////////////////////////////// // Function : SparkleParticleRenderer @@ -146,8 +147,9 @@ void SparkleParticleRenderer:: init_geoms(void) { _line_primitive->set_num_prims(0); - _interface_node->clear(); - _interface_node->add_geom(_line_primitive); + qpGeomNode *render_node = get_render_node(); + render_node->remove_all_geoms(); + render_node->add_geom(_line_primitive, _render_state); } //////////////////////////////////////////////////////////////////// @@ -266,5 +268,5 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { LPoint3f aabb_center = _aabb_min + ((_aabb_max - _aabb_min) * 0.5f); float radius = (aabb_center - _aabb_min).length(); - _interface_node->set_bound(BoundingSphere(aabb_center, radius)); + get_render_node()->set_bound(BoundingSphere(aabb_center, radius)); } diff --git a/panda/src/particlesystem/spriteParticleRenderer.cxx b/panda/src/particlesystem/spriteParticleRenderer.cxx index 67d49f2c64..a4a0d67a01 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.cxx +++ b/panda/src/particlesystem/spriteParticleRenderer.cxx @@ -16,12 +16,9 @@ // //////////////////////////////////////////////////////////////////// -#include -#include -#include -#include -#include -#include +#include "boundingSphere.h" +#include "geom.h" +#include "qpnodePath.h" #include "spriteParticleRenderer.h" @@ -99,36 +96,24 @@ make_copy(void) { // Texture and UV range from the GeomNode. //////////////////////////////////////////////////////////////////// void SpriteParticleRenderer:: -set_from_node(const NodePath &node_path) { +set_from_node(const qpNodePath &node_path) { nassertv(!node_path.is_empty()); // The bottom node must be a GeomNode. If it is not, find the first // GeomNode beneath it. - NodePath geom_node_path = node_path; - if (!geom_node_path.node()->is_of_type(GeomNode::get_class_type())) { + qpNodePath geom_node_path = node_path; + if (!geom_node_path.node()->is_geom_node()) { geom_node_path = node_path.find("**/+GeomNode"); - if (geom_node_path.empty()) { + if (geom_node_path.is_empty()) { particlesystem_cat.error() << node_path << " does not contain a GeomNode.\n"; return; } } - GeomNode *gnode = DCAST(GeomNode, geom_node_path.node()); + qpGeomNode *gnode = DCAST(qpGeomNode, geom_node_path.node()); - // Get the texture off the node. We use wrt() to determine the net - // texture that's applied, based on all the arcs from the root; not - // just the bottom arc. - Texture *tex = (Texture *)NULL; - - NodeTransitionWrapper ntw(TextureTransition::get_class_type()); - wrt(gnode, geom_node_path.begin(), geom_node_path.end(), - (Node *)NULL, ntw, RenderRelation::get_class_type()); - const TextureTransition *tt; - if (get_transition_into(tt, ntw)) { - if (tt->is_on()) { - tex = tt->get_texture(); - } - } + // Get the texture off the node. We'll take just the first texture. + Texture *tex = geom_node_path.find_texture("*"); if (tex == (Texture *)NULL) { particlesystem_cat.error() @@ -138,7 +123,7 @@ set_from_node(const NodePath &node_path) { // Now examine the UV's of the first Geom within the GeomNode. nassertv(gnode->get_num_geoms() > 0); - Geom *geom = DCAST(Geom, gnode->get_geom(0)); + Geom *geom = gnode->get_geom(0); PTA_TexCoordf texcoords; GeomBindType bind; @@ -248,8 +233,9 @@ void SpriteParticleRenderer:: init_geoms(void) { _sprite_primitive->set_num_prims(0); - _interface_node->clear(); - _interface_node->add_geom(_sprite_primitive); + qpGeomNode *render_node = get_render_node(); + render_node->remove_all_geoms(); + render_node->add_geom(_sprite_primitive, _render_state); } //////////////////////////////////////////////////////////////////// @@ -388,5 +374,5 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { LPoint3f aabb_center = _aabb_min + ((_aabb_max - _aabb_min) * 0.5f); float radius = (aabb_center - _aabb_min).length(); - _interface_node->set_bound(BoundingSphere(aabb_center, radius)); + get_render_node()->set_bound(BoundingSphere(aabb_center, radius)); } diff --git a/panda/src/particlesystem/spriteParticleRenderer.h b/panda/src/particlesystem/spriteParticleRenderer.h index 275d61f428..9849f09fbc 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.h +++ b/panda/src/particlesystem/spriteParticleRenderer.h @@ -19,18 +19,18 @@ #ifndef SPRITEPARTICLERENDERER_H #define SPRITEPARTICLERENDERER_H -#include -#include -#include -#include -#include -#include -#include +#include "pandabase.h" +#include "texture.h" +#include "pointerTo.h" +#include "pointerToArray.h" +#include "pta_float.h" +#include "geom.h" +#include "geomSprite.h" #include "baseParticleRenderer.h" #include "baseParticle.h" -class NodePath; +class qpNodePath; //////////////////////////////////////////////////////////////////// // Class : SpriteParticleRenderer @@ -88,7 +88,7 @@ PUBLISHED: INLINE SourceType get_source_type() const; - void set_from_node(const NodePath &node_path); + void set_from_node(const qpNodePath &node_path); INLINE void set_texture(Texture *tex); INLINE void set_ll_uv(const TexCoordf &ll_uv); diff --git a/panda/src/pgraph/qpnodePath.cxx b/panda/src/pgraph/qpnodePath.cxx index 6f33fcaab0..c7911a86c5 100644 --- a/panda/src/pgraph/qpnodePath.cxx +++ b/panda/src/pgraph/qpnodePath.cxx @@ -1463,7 +1463,7 @@ get_texture() const { Texture *qpNodePath:: find_texture(const string &name) const { GlobPattern glob(name); - return r_find_texture(node(), RenderState::make_empty(), glob); + return r_find_texture(node(), get_net_state(), glob); } //////////////////////////////////////////////////////////////////// @@ -1475,7 +1475,7 @@ find_texture(const string &name) const { TextureCollection qpNodePath:: find_all_textures() const { Textures textures; - r_find_all_textures(node(), RenderState::make_empty(), textures); + r_find_all_textures(node(), get_net_state(), textures); TextureCollection tc; Textures::iterator ti; @@ -1495,7 +1495,7 @@ find_all_textures() const { TextureCollection qpNodePath:: find_all_textures(const string &name) const { Textures textures; - r_find_all_textures(node(), RenderState::make_empty(), textures); + r_find_all_textures(node(), get_net_state(), textures); GlobPattern glob(name); @@ -2919,8 +2919,6 @@ r_calc_tight_bounds(PandaNode *node, LPoint3f &min_point, LPoint3f &max_point, Texture * qpNodePath:: r_find_texture(PandaNode *node, const RenderState *state, const GlobPattern &glob) const { - CPT(RenderState) next_state = state->compose(node->get_state()); - if (node->is_geom_node()) { qpGeomNode *gnode; DCAST_INTO_R(gnode, node, NULL); @@ -2928,7 +2926,7 @@ r_find_texture(PandaNode *node, const RenderState *state, int num_geoms = gnode->get_num_geoms(); for (int i = 0; i < num_geoms; i++) { CPT(RenderState) geom_state = - next_state->compose(gnode->get_geom_state(i)); + state->compose(gnode->get_geom_state(i)); // Look for a TextureAttrib on the state. const RenderAttrib *attrib = @@ -2949,7 +2947,10 @@ r_find_texture(PandaNode *node, const RenderState *state, PandaNode::Children cr = node->get_children(); int num_children = cr.get_num_children(); for (int i = 0; i < num_children; i++) { - Texture *result = r_find_texture(cr.get_child(i), next_state, glob); + PandaNode *child = cr.get_child(i); + CPT(RenderState) next_state = state->compose(child->get_state()); + + Texture *result = r_find_texture(child, next_state, glob); if (result != (Texture *)NULL) { return result; } @@ -2966,8 +2967,6 @@ r_find_texture(PandaNode *node, const RenderState *state, void qpNodePath:: r_find_all_textures(PandaNode *node, const RenderState *state, qpNodePath::Textures &textures) const { - CPT(RenderState) next_state = state->compose(node->get_state()); - if (node->is_geom_node()) { qpGeomNode *gnode; DCAST_INTO_V(gnode, node); @@ -2975,7 +2974,7 @@ r_find_all_textures(PandaNode *node, const RenderState *state, int num_geoms = gnode->get_num_geoms(); for (int i = 0; i < num_geoms; i++) { CPT(RenderState) geom_state = - next_state->compose(gnode->get_geom_state(i)); + state->compose(gnode->get_geom_state(i)); // Look for a TextureAttrib on the state. const RenderAttrib *attrib = @@ -2994,7 +2993,9 @@ r_find_all_textures(PandaNode *node, const RenderState *state, PandaNode::Children cr = node->get_children(); int num_children = cr.get_num_children(); for (int i = 0; i < num_children; i++) { - r_find_all_textures(cr.get_child(i), next_state, textures); + PandaNode *child = cr.get_child(i); + CPT(RenderState) next_state = state->compose(child->get_state()); + r_find_all_textures(child, next_state, textures); } } diff --git a/panda/src/physics/angularEulerIntegrator.cxx b/panda/src/physics/angularEulerIntegrator.cxx index 2362cacc90..8c53214192 100644 --- a/panda/src/physics/angularEulerIntegrator.cxx +++ b/panda/src/physics/angularEulerIntegrator.cxx @@ -21,8 +21,6 @@ #include "physicalNode.h" #include "config_physics.h" -#include - //////////////////////////////////////////////////////////////////// // Function : AngularEulerIntegrator // Access : Public diff --git a/panda/src/physics/baseIntegrator.cxx b/panda/src/physics/baseIntegrator.cxx index 65afaec560..56146e1635 100644 --- a/panda/src/physics/baseIntegrator.cxx +++ b/panda/src/physics/baseIntegrator.cxx @@ -19,8 +19,7 @@ #include "baseIntegrator.h" #include "physicalNode.h" #include "forceNode.h" - -#include +#include "qpnodePath.h" //////////////////////////////////////////////////////////////////// // Function : BaseIntegrator @@ -62,20 +61,21 @@ precompute_linear_matrices(Physical *physical, int local_force_vec_size = physical->get_linear_forces().size(); int i; - LMatrix4f current_xform; ForceNode *force_node; // prepare the vector _precomputed_linear_matrices.clear(); _precomputed_linear_matrices.reserve(global_force_vec_size + local_force_vec_size); + qpNodePath physical_np(physical_node); + // tally the global xforms for (i = 0; i < global_force_vec_size; i++) { force_node = forces[i]->get_force_node(); nassertv(force_node != (ForceNode *) NULL); - get_rel_mat(physical_node, force_node, current_xform); - _precomputed_linear_matrices.push_back(current_xform); + qpNodePath force_np(force_node); + _precomputed_linear_matrices.push_back(physical_np.get_mat(force_node)); } const pvector< PT(LinearForce) > &force_vector = @@ -86,8 +86,8 @@ precompute_linear_matrices(Physical *physical, force_node = force_vector[i]->get_force_node(); nassertv(force_node != (ForceNode *) NULL); - get_rel_mat(physical_node, force_node, current_xform); - _precomputed_linear_matrices.push_back(current_xform); + qpNodePath force_np(force_node); + _precomputed_linear_matrices.push_back(physical_np.get_mat(force_node)); } } @@ -113,20 +113,21 @@ precompute_angular_matrices(Physical *physical, int local_force_vec_size = physical->get_angular_forces().size(); int i; - LMatrix4f current_xform; ForceNode *force_node; // prepare the vector _precomputed_angular_matrices.clear(); _precomputed_angular_matrices.reserve(global_force_vec_size + local_force_vec_size); + qpNodePath physical_np(physical_node); + // tally the global xforms for (i = 0; i < global_force_vec_size; i++) { force_node = forces[i]->get_force_node(); nassertv(force_node != (ForceNode *) NULL); - get_rel_mat(physical_node, force_node, current_xform); - _precomputed_angular_matrices.push_back(current_xform); + qpNodePath force_np(force_node); + _precomputed_angular_matrices.push_back(physical_np.get_mat(force_node)); } const pvector< PT(AngularForce) > &force_vector = @@ -137,7 +138,7 @@ precompute_angular_matrices(Physical *physical, force_node = force_vector[i]->get_force_node(); nassertv(force_node != (ForceNode *) NULL); - get_rel_mat(physical_node, force_node, current_xform); - _precomputed_angular_matrices.push_back(current_xform); + qpNodePath force_np(force_node); + _precomputed_angular_matrices.push_back(physical_np.get_mat(force_node)); } } diff --git a/panda/src/physics/forceNode.cxx b/panda/src/physics/forceNode.cxx index bbabee2744..d6d9fd2fad 100644 --- a/panda/src/physics/forceNode.cxx +++ b/panda/src/physics/forceNode.cxx @@ -28,17 +28,18 @@ TypeHandle ForceNode::_type_handle; //////////////////////////////////////////////////////////////////// ForceNode:: ForceNode(const string &name) : - NamedNode(name) { + PandaNode(name) +{ } //////////////////////////////////////////////////////////////////// // Function : ForceNode -// Access : public +// Access : protected // Description : copy constructor //////////////////////////////////////////////////////////////////// ForceNode:: ForceNode(const ForceNode ©) : - NamedNode(copy), _forces(copy._forces) { + PandaNode(copy), _forces(copy._forces) { } //////////////////////////////////////////////////////////////////// @@ -50,24 +51,12 @@ ForceNode:: ~ForceNode(void) { } -//////////////////////////////////////////////////////////////////// -// Function : operator = -// Access : public -// Description : assignment operator -//////////////////////////////////////////////////////////////////// -ForceNode &ForceNode:: -operator =(const ForceNode ©) { - NamedNode::operator =(copy); - _forces = copy._forces; - return *this; -} - //////////////////////////////////////////////////////////////////// // Function : make_copy // Access : public, virtual // Description : dynamic child copy //////////////////////////////////////////////////////////////////// -Node *ForceNode:: +PandaNode *ForceNode:: make_copy(void) const { return new ForceNode(*this); } diff --git a/panda/src/physics/forceNode.h b/panda/src/physics/forceNode.h index 0e5ebd4f56..d9f0da1b7b 100644 --- a/panda/src/physics/forceNode.h +++ b/panda/src/physics/forceNode.h @@ -19,7 +19,7 @@ #ifndef FORCENODE_H #define FORCENODE_H -#include +#include "pandaNode.h" #include "pvector.h" #include "baseForce.h" @@ -31,20 +31,22 @@ // An example of this would be simulating gravity // in a rotating space station. or something. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDAPHYSICS ForceNode : public NamedNode { +class EXPCL_PANDAPHYSICS ForceNode : public PandaNode { private: pvector< PT(BaseForce) > _forces; PUBLISHED: - ForceNode(const string &name = ""); + ForceNode(const string &name); + +protected: ForceNode(const ForceNode ©); + +public: virtual ~ForceNode(void); - - ForceNode &operator =(const ForceNode ©); - virtual bool safe_to_flatten(void) const { return false; } - virtual Node *make_copy(void) const; + virtual PandaNode *make_copy(void) const; +PUBLISHED: INLINE void clear(void); INLINE BaseForce *get_force(int index) const; INLINE int get_num_forces(void) const; @@ -59,9 +61,9 @@ public: return _type_handle; } static void init_type(void) { - NamedNode::init_type(); + PandaNode::init_type(); register_type(_type_handle, "ForceNode", - NamedNode::get_class_type()); + PandaNode::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearEulerIntegrator.cxx b/panda/src/physics/linearEulerIntegrator.cxx index 333a337f0d..ce3ef80048 100644 --- a/panda/src/physics/linearEulerIntegrator.cxx +++ b/panda/src/physics/linearEulerIntegrator.cxx @@ -21,8 +21,6 @@ #include "physicalNode.h" #include "config_physics.h" -#include - //////////////////////////////////////////////////////////////////// // Function : LinearEulerIntegrator // Access : Public diff --git a/panda/src/physics/linearIntegrator.cxx b/panda/src/physics/linearIntegrator.cxx index e7f06117ef..35f646db3f 100644 --- a/panda/src/physics/linearIntegrator.cxx +++ b/panda/src/physics/linearIntegrator.cxx @@ -16,8 +16,6 @@ // //////////////////////////////////////////////////////////////////// -#include - #include "linearIntegrator.h" #include "config_physics.h" #include "physicalNode.h" diff --git a/panda/src/physics/physicalNode.cxx b/panda/src/physics/physicalNode.cxx index e61e6494f9..1bafa624fe 100644 --- a/panda/src/physics/physicalNode.cxx +++ b/panda/src/physics/physicalNode.cxx @@ -28,46 +28,35 @@ TypeHandle PhysicalNode::_type_handle; //////////////////////////////////////////////////////////////////// PhysicalNode:: PhysicalNode(const string &name) : - NamedNode(name) { + PandaNode(name) +{ } //////////////////////////////////////////////////////////////////// // Function : PhysicalNode -// Access : public +// Access : protected // Description : copy constructor //////////////////////////////////////////////////////////////////// PhysicalNode:: PhysicalNode(const PhysicalNode ©) : - NamedNode(copy), _physicals(copy._physicals) { + PandaNode(copy), _physicals(copy._physicals) { } //////////////////////////////////////////////////////////////////// // Function : ~PhysicalNode -// Access : public, virtual +// Access : protected, virtual // Description : destructor //////////////////////////////////////////////////////////////////// PhysicalNode:: ~PhysicalNode(void) { } -//////////////////////////////////////////////////////////////////// -// Function : operator = -// Access : public -// Description : assignment operator -//////////////////////////////////////////////////////////////////// -PhysicalNode &PhysicalNode:: -operator =(const PhysicalNode ©) { - NamedNode::operator =(copy); - _physicals = copy._physicals; - return *this; -} - //////////////////////////////////////////////////////////////////// // Function : make_copy // Access : public, virtual // Description : dynamic child copy //////////////////////////////////////////////////////////////////// -Node *PhysicalNode:: +PandaNode *PhysicalNode:: make_copy(void) const { return new PhysicalNode(*this); } diff --git a/panda/src/physics/physicalNode.h b/panda/src/physics/physicalNode.h index b9e169ccaa..62a46e55b9 100644 --- a/panda/src/physics/physicalNode.h +++ b/panda/src/physics/physicalNode.h @@ -19,8 +19,8 @@ #ifndef PHYSICALNODE_H #define PHYSICALNODE_H -#include -#include +#include "pandabase.h" +#include "pandaNode.h" #include "pvector.h" @@ -32,20 +32,22 @@ // Description : Graph node that encapsulated a series of physical // objects //////////////////////////////////////////////////////////////////// -class EXPCL_PANDAPHYSICS PhysicalNode : public NamedNode { +class EXPCL_PANDAPHYSICS PhysicalNode : public PandaNode { private: pvector< PT(Physical) > _physicals; PUBLISHED: - PhysicalNode(const string &name = ""); + PhysicalNode(const string &name); + +protected: PhysicalNode(const PhysicalNode ©); + +public: virtual ~PhysicalNode(void); - - PhysicalNode &operator =(const PhysicalNode ©); - virtual bool safe_to_flatten(void) const { return false; } - virtual Node *make_copy(void) const; + virtual PandaNode *make_copy(void) const; +PUBLISHED: INLINE void clear(void); INLINE Physical *get_physical(int index) const; INLINE int get_num_physicals(void) const; @@ -60,9 +62,9 @@ public: return _type_handle; } static void init_type(void) { - NamedNode::init_type(); + PandaNode::init_type(); register_type(_type_handle, "PhysicalNode", - NamedNode::get_class_type()); + PandaNode::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type();