00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef MOVINGPARTBASE_H
00016 #define MOVINGPARTBASE_H
00017
00018 #include "pandabase.h"
00019
00020 #include "partGroup.h"
00021 #include "partBundle.h"
00022 #include "animChannelBase.h"
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class EXPCL_PANDA_CHAN MovingPartBase : public PartGroup {
00035 protected:
00036 INLINE MovingPartBase(const MovingPartBase ©);
00037
00038 public:
00039 MovingPartBase(PartGroup *parent, const string &name);
00040
00041 PUBLISHED:
00042 INLINE int get_max_bound() const;
00043 INLINE AnimChannelBase *get_bound(int n) const;
00044
00045 public:
00046 virtual TypeHandle get_value_type() const=0;
00047 virtual AnimChannelBase *make_default_channel() const=0;
00048
00049 PUBLISHED:
00050 virtual bool clear_forced_channel();
00051 virtual AnimChannelBase *get_forced_channel() const;
00052
00053 virtual void write(ostream &out, int indent_level) const;
00054 virtual void write_with_value(ostream &out, int indent_level) const;
00055 virtual void output_value(ostream &out) const=0;
00056
00057 public:
00058 virtual bool do_update(PartBundle *root, const CycleData *root_cdata,
00059 PartGroup *parent, bool parent_changed,
00060 bool anim_changed, Thread *current_thread);
00061
00062 virtual void get_blend_value(const PartBundle *root)=0;
00063 virtual bool update_internals(PartBundle *root, PartGroup *parent,
00064 bool self_changed, bool parent_changed,
00065 Thread *current_thread);
00066
00067 protected:
00068 MovingPartBase();
00069
00070 virtual void pick_channel_index(plist<int> &holes, int &next) const;
00071 virtual void bind_hierarchy(AnimGroup *anim, int channel_index,
00072 int &joint_index, bool is_included,
00073 BitArray &bound_joints,
00074 const PartSubset &subset);
00075 virtual void find_bound_joints(int &joint_index, bool is_included,
00076 BitArray &bound_joints,
00077 const PartSubset &subset);
00078 virtual void determine_effective_channels(const CycleData *root_cdata);
00079
00080
00081 typedef pvector< PT(AnimChannelBase) > Channels;
00082 Channels _channels;
00083
00084
00085
00086 int _num_effective_channels;
00087
00088
00089
00090
00091
00092
00093 AnimControl *_effective_control;
00094 PT(AnimChannelBase) _effective_channel;
00095
00096
00097
00098 PT(AnimChannelBase) _forced_channel;
00099
00100 public:
00101 virtual void write_datagram(BamWriter *manager, Datagram &dg);
00102 virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
00103
00104 protected:
00105 void fillin(DatagramIterator &scan, BamReader *manager);
00106
00107 public:
00108 virtual TypeHandle get_type() const {
00109 return get_class_type();
00110 }
00111 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00112 PUBLISHED:
00113 static TypeHandle get_class_type() {
00114 return _type_handle;
00115 }
00116 public:
00117 static void init_type() {
00118 PartGroup::init_type();
00119 register_type(_type_handle, "MovingPartBase",
00120 PartGroup::get_class_type());
00121 }
00122
00123 private:
00124 static TypeHandle _type_handle;
00125 };
00126
00127 #include "movingPartBase.I"
00128
00129 #endif
00130
00131
00132
00133