00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef XFILEANIMATIONSET_H
00016 #define XFILEANIMATIONSET_H
00017
00018 #include "pandatoolbase.h"
00019 #include "pmap.h"
00020 #include "pvector.h"
00021 #include "luse.h"
00022 #include "namable.h"
00023
00024 class XFileToEggConverter;
00025 class EggGroup;
00026 class EggTable;
00027 class EggXfmSAnim;
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 class XFileAnimationSet : public Namable {
00038 public:
00039 XFileAnimationSet();
00040 ~XFileAnimationSet();
00041
00042 bool create_hierarchy(XFileToEggConverter *converter);
00043 EggXfmSAnim *get_table(const string &joint_name) const;
00044
00045 enum FrameDataFlags {
00046 FDF_scale = 0x01,
00047 FDF_rot = 0x02,
00048 FDF_trans = 0x04,
00049 FDF_mat = 0x08,
00050 };
00051
00052 class FrameEntry {
00053 public:
00054 INLINE FrameEntry();
00055 INLINE const LMatrix4d &get_mat(int flags) const;
00056
00057 LVecBase3d _scale;
00058 LQuaterniond _rot;
00059 LVector3d _trans;
00060 LMatrix4d _mat;
00061 };
00062
00063 typedef epvector<FrameEntry> FrameEntries;
00064
00065 class FrameData {
00066 public:
00067 INLINE FrameData();
00068 FrameEntries _entries;
00069 int _flags;
00070 };
00071
00072 FrameData &create_frame_data(const string &joint_name);
00073
00074 public:
00075 double _frame_rate;
00076
00077 private:
00078 void mirror_table(XFileToEggConverter *converter,
00079 EggGroup *model_node, EggTable *anim_node);
00080
00081 typedef pmap<string, FrameData> JointData;
00082 JointData _joint_data;
00083
00084 class TablePair {
00085 public:
00086 EggGroup *_joint;
00087 EggXfmSAnim *_table;
00088 };
00089
00090 typedef pmap<string, TablePair> Tables;
00091 Tables _tables;
00092 };
00093
00094 #include "xFileAnimationSet.I"
00095
00096 #endif
00097