00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CHARACTERJOINT_H
00020 #define CHARACTERJOINT_H
00021
00022 #include "pandabase.h"
00023
00024 #include "movingPartMatrix.h"
00025 #include "pandaNode.h"
00026
00027
00028
00029
00030
00031
00032 class EXPCL_PANDA CharacterJoint : public MovingPartMatrix {
00033 protected:
00034 CharacterJoint();
00035 CharacterJoint(const CharacterJoint ©);
00036
00037 public:
00038 CharacterJoint(PartGroup *parent, const string &name,
00039 const LMatrix4f &initial_value);
00040
00041 virtual PartGroup *make_copy() const;
00042
00043 virtual bool update_internals(PartGroup *parent, bool self_changed,
00044 bool parent_changed);
00045
00046 PUBLISHED:
00047 bool add_net_transform(PandaNode *node);
00048 bool remove_net_transform(PandaNode *node);
00049 bool has_net_transform(PandaNode *node) const;
00050 void clear_net_transforms();
00051
00052 bool add_local_transform(PandaNode *node);
00053 bool remove_local_transform(PandaNode *node);
00054 bool has_local_transform(PandaNode *node) const;
00055 void clear_local_transforms();
00056
00057 void get_transform(LMatrix4f &transform) const;
00058
00059 private:
00060 typedef pset< PT(PandaNode) > NodeList;
00061 NodeList _net_transform_nodes;
00062 NodeList _local_transform_nodes;
00063
00064 public:
00065 static void register_with_read_factory(void);
00066 virtual void write_datagram(BamWriter* manager, Datagram &me);
00067 virtual int complete_pointers(TypedWritable **p_list,
00068 BamReader *manager);
00069
00070 static TypedWritable *make_CharacterJoint(const FactoryParams ¶ms);
00071
00072 protected:
00073 void fillin(DatagramIterator& scan, BamReader* manager);
00074
00075 private:
00076 int _num_net_nodes, _num_local_nodes;
00077
00078 public:
00079
00080
00081
00082
00083 PT(PandaNode) _geom_node;
00084
00085
00086 LMatrix4f _net_transform;
00087 LMatrix4f _initial_net_transform_inverse;
00088
00089 public:
00090 virtual TypeHandle get_type() const {
00091 return get_class_type();
00092 }
00093 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00094 static TypeHandle get_class_type() {
00095 return _type_handle;
00096 }
00097 static void init_type() {
00098 MovingPartMatrix::init_type();
00099 register_type(_type_handle, "CharacterJoint",
00100 MovingPartMatrix::get_class_type());
00101 }
00102
00103 private:
00104 static TypeHandle _type_handle;
00105
00106 friend class Character;
00107 };
00108
00109 #endif
00110
00111