Panda3D
 All Classes Functions Variables Enumerations
xFileAnimationSet.h
1 // Filename: xFileAnimationSet.h
2 // Created by: drose (02Oct04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef XFILEANIMATIONSET_H
16 #define XFILEANIMATIONSET_H
17 
18 #include "pandatoolbase.h"
19 #include "pmap.h"
20 #include "epvector.h"
21 #include "luse.h"
22 #include "namable.h"
23 
25 class EggGroup;
26 class EggTable;
27 class EggXfmSAnim;
28 
29 ////////////////////////////////////////////////////////////////////
30 // Class : XFileAnimationSet
31 // Description : This represents a tree of EggTables, corresponding to
32 // Animation entries in the X file. There is one
33 // EggTable for each joint in the character's joint
34 // set, and the whole tree is structured as a
35 // mirror of the joint set.
36 ////////////////////////////////////////////////////////////////////
37 class XFileAnimationSet : public Namable {
38 public:
41 
42  bool create_hierarchy(XFileToEggConverter *converter);
43  EggXfmSAnim *get_table(const string &joint_name) const;
44 
45  enum FrameDataFlags {
46  FDF_scale = 0x01,
47  FDF_rot = 0x02,
48  FDF_trans = 0x04,
49  FDF_mat = 0x08,
50  };
51 
52  class FrameEntry {
53  public:
54  INLINE FrameEntry();
55  INLINE const LMatrix4d &get_mat(int flags) const;
56 
57  LVecBase3d _scale;
58  LQuaterniond _rot;
59  LVector3d _trans;
60  LMatrix4d _mat;
61  };
62 
63  typedef epvector<FrameEntry> FrameEntries;
64 
65  class FrameData {
66  public:
67  INLINE FrameData();
68  FrameEntries _entries;
69  int _flags;
70  };
71 
72  FrameData &create_frame_data(const string &joint_name);
73 
74 public:
75  double _frame_rate;
76 
77 private:
78  void mirror_table(XFileToEggConverter *converter,
79  EggGroup *model_node, EggTable *anim_node);
80 
82  JointData _joint_data;
83 
84  class TablePair {
85  public:
86  EggGroup *_joint;
87  EggXfmSAnim *_table;
88  };
89 
90  typedef pmap<string, TablePair> Tables;
91  Tables _tables;
92 };
93 
94 #include "xFileAnimationSet.I"
95 
96 #endif
97 
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:4716
FrameData & create_frame_data(const string &joint_name)
Returns a reference to a new FrameData table corresponding to the indicated joint.
bool create_hierarchy(XFileToEggConverter *converter)
Sets up the hierarchy of EggTables corresponding to this AnimationSet.
This is the base quaternion class.
Definition: lquaternion.h:974
This represents a tree of EggTables, corresponding to Animation entries in the X file.
The main glue of the egg hierarchy, this corresponds to the &lt;Group&gt;, &lt;Instance&gt;, and &lt;Joint&gt; type nod...
Definition: eggGroup.h:36
EggXfmSAnim * get_table(const string &joint_name) const
Returns the table associated with the indicated joint name.
A base class for all things which can have a name.
Definition: namable.h:29
This corresponds to an &lt;Xfm$Anim_S$&gt; entry, which is a collection of up to nine &lt;S$Anim&gt; entries that...
Definition: eggXfmSAnim.h:33
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:1455
This corresponds to a.
Definition: eggTable.h:31
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:746
const LMatrix4d & get_mat(int flags) const
Returns the frame&#39;s data as a matrix, composing the matrix first if necessary, as indicated by the Fr...