Panda3D
eggXfmSAnim.h
1 // Filename: eggXfmSAnim.h
2 // Created by: drose (19Feb99)
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 EGGXFMSANIM_H
16 #define EGGXFMSANIM_H
17 
18 
19 #include "pandabase.h"
20 #include "eggGroupNode.h"
21 #include "config_linmath.h" // for temp_hpr_fix
22 
23 class EggXfmAnimData;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : EggXfmSAnim
27 // Description : This corresponds to an <Xfm$Anim_S$> entry, which is
28 // a collection of up to nine <S$Anim> entries that
29 // specify the nine components of a transformation.
30 // It's implemented as a group that can contain
31 // any number of EggSAnimData children.
32 ////////////////////////////////////////////////////////////////////
33 class EXPCL_PANDAEGG EggXfmSAnim : public EggGroupNode {
34 PUBLISHED:
35  INLINE EggXfmSAnim(const string &name = "",
36  CoordinateSystem cs = CS_default);
37  EggXfmSAnim(const EggXfmAnimData &convert_from);
38 
39  INLINE EggXfmSAnim(const EggXfmSAnim &copy);
40  INLINE EggXfmSAnim &operator = (const EggXfmSAnim &copy);
41 
42  INLINE void set_fps(double fps);
43  INLINE void clear_fps();
44  INLINE bool has_fps() const;
45  INLINE double get_fps() const;
46 
47  INLINE void set_order(const string &order);
48  INLINE void clear_order();
49  INLINE bool has_order() const;
50  INLINE const string &get_order() const;
51  INLINE static const string &get_standard_order();
52 
53  INLINE CoordinateSystem get_coordinate_system() const;
54 
55  void optimize();
56  void optimize_to_standard_order();
57  void normalize();
58 
59  int get_num_rows() const;
60  void get_value(int row, LMatrix4d &mat) const;
61  bool set_value(int row, const LMatrix4d &mat);
62 
63  INLINE void clear_data();
64  bool add_data(const LMatrix4d &mat);
65  void add_component_data(const string &component_name, double value);
66  void add_component_data(int component, double value);
67 
68  virtual bool is_anim_matrix() const;
69  virtual void write(ostream &out, int indent_level) const;
70 
71  static void compose_with_order(LMatrix4d &mat,
72  const LVecBase3d &scale,
73  const LVecBase3d &shear,
74  const LVecBase3d &hpr,
75  const LVecBase3d &trans,
76  const string &order,
77  CoordinateSystem cs);
78 
79 protected:
80  virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv,
81  CoordinateSystem to_cs);
82  virtual void r_mark_coordsys(CoordinateSystem cs);
83 
84 private:
85  void normalize_by_rebuilding();
86  void normalize_by_expanding();
87 
88 
89 private:
90  double _fps;
91  bool _has_fps;
92  string _order;
93  CoordinateSystem _coordsys;
94 
95  static const string _standard_order_legacy;
96  static const string _standard_order_hpr_fix;
97 
98 public:
99 
100  static TypeHandle get_class_type() {
101  return _type_handle;
102  }
103  static void init_type() {
104  EggGroupNode::init_type();
105  register_type(_type_handle, "EggXfmSAnim",
106  EggGroupNode::get_class_type());
107  }
108  virtual TypeHandle get_type() const {
109  return get_class_type();
110  }
111  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
112 
113 private:
114  static TypeHandle _type_handle;
115 };
116 
117 #include "eggXfmSAnim.I"
118 
119 #endif
120 
121 
virtual void write(ostream &out, int indent_level) const
Writes the group and all of its children to the indicated output stream in Egg format.
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:4716
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:51
virtual bool is_anim_matrix() const
Returns true if this node represents a table of animation transformation data, false otherwise...
Definition: eggNode.cxx:86
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
Definition: eggXfmSAnim.h:33
Corresponding to an <Xfm$Anim> entry, this stores a two-dimensional table with up to nine columns...
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:1471
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85