00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CHARACTER_H
00020 #define CHARACTER_H
00021
00022 #include "pandabase.h"
00023
00024 #include "computedVertices.h"
00025
00026 #include "partBundleNode.h"
00027 #include "vector_PartGroupStar.h"
00028 #include "pointerTo.h"
00029 #include "geom.h"
00030 #include "pStatCollector.h"
00031
00032 class CharacterJointBundle;
00033 class ComputedVertices;
00034
00035
00036
00037
00038
00039
00040 class EXPCL_PANDA Character : public PartBundleNode {
00041 protected:
00042 Character(const Character ©);
00043
00044 public:
00045 Character(const string &name);
00046 virtual ~Character();
00047
00048 virtual PandaNode *make_copy() const;
00049
00050 virtual bool safe_to_transform() const;
00051 virtual bool has_cull_callback() const;
00052 virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
00053
00054 PUBLISHED:
00055 INLINE CharacterJointBundle *get_bundle() const;
00056
00057 INLINE ComputedVertices *get_computed_vertices() const;
00058 INLINE int get_num_parts() const;
00059 INLINE PartGroup *get_part(int n) const;
00060
00061 INLINE void write_parts(ostream &out) const;
00062 INLINE void write_part_values(ostream &out) const;
00063
00064 void update_to_now();
00065 void update();
00066 void force_update();
00067
00068 private:
00069 void copy_joints(PartGroup *copy, PartGroup *orig);
00070
00071 typedef pmap<const PandaNode *, PandaNode *> NodeMap;
00072
00073 virtual void r_copy_children(const PandaNode *from, InstanceMap &inst_map);
00074 void r_copy_char(PandaNode *dest, const PandaNode *source,
00075 const Character *from, NodeMap &node_map);
00076 PT(Geom) copy_geom(Geom *source, const Character *from);
00077 void copy_node_pointers(const Character *from, const NodeMap &node_map);
00078
00079
00080
00081
00082
00083
00084 DynamicVertices _cv;
00085
00086
00087
00088 PT(ComputedVertices) _computed_vertices;
00089
00090
00091
00092 typedef vector_PartGroupStar Parts;
00093 Parts _parts;
00094
00095
00096 PStatCollector _char_pcollector;
00097 static PStatCollector _anim_pcollector;
00098
00099 public:
00100 static void register_with_read_factory();
00101 virtual void write_datagram(BamWriter *manager, Datagram &dg);
00102 virtual int complete_pointers(TypedWritable **plist,
00103 BamReader *manager);
00104
00105 protected:
00106 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00107 void fillin(DatagramIterator &scan, BamReader *manager);
00108
00109 public:
00110 virtual TypeHandle get_type() const {
00111 return get_class_type();
00112 }
00113 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00114 static TypeHandle get_class_type() {
00115 return _type_handle;
00116 }
00117 static void init_type() {
00118 PartBundleNode::init_type();
00119 register_type(_type_handle, "Character",
00120 PartBundleNode::get_class_type());
00121 }
00122
00123 private:
00124 static TypeHandle _type_handle;
00125
00126 friend class CharacterMaker;
00127 friend class ComputedVerticesMaker;
00128 friend class ComputedVertices;
00129 };
00130
00131 #include "character.I"
00132
00133 #endif
00134