Panda3D
 All Classes Functions Variables Enumerations
physicalNode.h
00001 // Filename: physicalNode.h
00002 // Created by:  charles (01Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef PHYSICALNODE_H
00016 #define PHYSICALNODE_H
00017 
00018 #include "pandabase.h"
00019 #include "pandaNode.h"
00020 
00021 #include "pvector.h"
00022 
00023 #include "physical.h"
00024 #include "config_physics.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //        Class : PhysicalNode
00028 //  Description : Graph node that encapsulated a series of physical
00029 //                objects
00030 ////////////////////////////////////////////////////////////////////
00031 class EXPCL_PANDAPHYSICS PhysicalNode : public PandaNode {
00032 PUBLISHED:
00033   PhysicalNode(const string &name);
00034   INLINE void clear();
00035   INLINE Physical *get_physical(int index) const;
00036   INLINE int get_num_physicals() const;
00037   MAKE_SEQ(get_physicals, get_num_physicals, get_physical);
00038   INLINE void add_physical(Physical *physical);
00039 
00040   void add_physicals_from(const PhysicalNode &other);
00041   void remove_physical(Physical *physical);
00042   void remove_physical(int index);
00043   
00044   virtual void write(ostream &out, unsigned int indent=0) const;
00045 
00046 public:
00047   virtual ~PhysicalNode();
00048   virtual bool safe_to_flatten() const { return false; }
00049   virtual PandaNode *make_copy() const;
00050 
00051 protected:
00052   PhysicalNode(const PhysicalNode &copy);
00053 
00054 private:
00055   typedef pvector<PT(Physical)> PhysicalsVector;
00056   PhysicalsVector _physicals;
00057 
00058 public:
00059   static TypeHandle get_class_type() {
00060     return _type_handle;
00061   }
00062   static void init_type() {
00063     PandaNode::init_type();
00064     register_type(_type_handle, "PhysicalNode",
00065                   PandaNode::get_class_type());
00066   }
00067   virtual TypeHandle get_type() const {
00068     return get_class_type();
00069   }
00070   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00071 
00072 private:
00073   static TypeHandle _type_handle;
00074 };
00075 
00076 #include "physicalNode.I"
00077 
00078 #endif // PHYSICALNODE_H
 All Classes Functions Variables Enumerations