Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/physics/forceNode.h

Go to the documentation of this file.
00001 // Filename: forceNode.h
00002 // Created by:  charles (02Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef FORCENODE_H
00020 #define FORCENODE_H
00021 
00022 #include "pandaNode.h"
00023 #include "pvector.h"
00024 
00025 #include "baseForce.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //        Class : ForceNode
00029 //  Description : A force that lives in the scene graph and is
00030 //                therefore subject to local coordinate systems.
00031 //                An example of this would be simulating gravity
00032 //                in a rotating space station.  or something.
00033 ////////////////////////////////////////////////////////////////////
00034 class EXPCL_PANDAPHYSICS ForceNode : public PandaNode {
00035 private:
00036   pvector< PT(BaseForce) > _forces;
00037 
00038 PUBLISHED:
00039   ForceNode(const string &name);
00040 
00041 protected:
00042   ForceNode(const ForceNode &copy);
00043 
00044 public:
00045   virtual ~ForceNode(void);
00046   virtual bool safe_to_flatten(void) const { return false; }
00047   virtual PandaNode *make_copy(void) const;
00048 
00049 PUBLISHED:
00050   INLINE void clear(void);
00051   INLINE BaseForce *get_force(int index) const;
00052   INLINE int get_num_forces(void) const;
00053   INLINE void add_force(BaseForce *force);
00054 
00055   void add_forces_from(const ForceNode &other);
00056   void remove_force(BaseForce *f);
00057   void remove_force(int index);
00058 
00059 public:
00060   static TypeHandle get_class_type(void) {
00061     return _type_handle;
00062   }
00063   static void init_type(void) {
00064     PandaNode::init_type();
00065     register_type(_type_handle, "ForceNode",
00066                   PandaNode::get_class_type());
00067   }
00068   virtual TypeHandle get_type(void) const {
00069     return get_class_type();
00070   }
00071   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00072 
00073 private:
00074   static TypeHandle _type_handle;
00075 };
00076 
00077 #include "forceNode.I"
00078 
00079 #endif // FORCENODE_H

Generated on Fri May 2 00:42:52 2003 for Panda by doxygen1.3