00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef FORCENODE_H
00016 #define FORCENODE_H
00017
00018 #include "pandaNode.h"
00019 #include "pvector.h"
00020
00021 #include "baseForce.h"
00022
00023
00024
00025
00026
00027
00028
00029
00030 class EXPCL_PANDAPHYSICS ForceNode : public PandaNode {
00031 PUBLISHED:
00032 ForceNode(const string &name);
00033 INLINE void clear();
00034 INLINE BaseForce *get_force(int index) const;
00035 INLINE int get_num_forces() const;
00036 MAKE_SEQ(get_forces, get_num_forces, get_force);
00037 INLINE void add_force(BaseForce *force);
00038
00039 void add_forces_from(const ForceNode &other);
00040 void remove_force(BaseForce *f);
00041 void remove_force(int index);
00042
00043 virtual void output(ostream &out) const;
00044 virtual void write_forces(ostream &out, unsigned int indent=0) const;
00045 virtual void write(ostream &out, unsigned int indent=0) const;
00046
00047 public:
00048 virtual ~ForceNode();
00049 virtual bool safe_to_flatten() const { return false; }
00050 virtual PandaNode *make_copy() const;
00051
00052 protected:
00053 ForceNode(const ForceNode ©);
00054
00055 private:
00056 typedef pvector< PT(BaseForce) > ForceVector;
00057 ForceVector _forces;
00058
00059 public:
00060 static TypeHandle get_class_type() {
00061 return _type_handle;
00062 }
00063 static void init_type() {
00064 PandaNode::init_type();
00065 register_type(_type_handle, "ForceNode",
00066 PandaNode::get_class_type());
00067 }
00068 virtual TypeHandle get_type() 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