Panda3D
 All Classes Functions Variables Enumerations
eggXfmSAnim.I
1 // Filename: eggXfmSAnim.I
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 
16 ////////////////////////////////////////////////////////////////////
17 // Function: EggXfmSAnim::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE EggXfmSAnim::
22 EggXfmSAnim(const string &name, CoordinateSystem cs) : EggGroupNode(name) {
23  _has_fps = false;
24  _coordsys = cs;
25 }
26 
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: EggXfmSAnim::Copy constructor
30 // Access: Public
31 // Description:
32 ////////////////////////////////////////////////////////////////////
33 INLINE EggXfmSAnim::
34 EggXfmSAnim(const EggXfmSAnim &copy)
35  : EggGroupNode(copy),
36  _fps(copy._fps),
37  _has_fps(copy._has_fps),
38  _order(copy._order),
39  _coordsys(copy._coordsys) {
40 }
41 
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: EggXfmSAnim::Copy assignment operator
45 // Access: Public
46 // Description:
47 ////////////////////////////////////////////////////////////////////
48 INLINE EggXfmSAnim &EggXfmSAnim::
49 operator = (const EggXfmSAnim &copy) {
50  EggGroupNode::operator = (copy);
51  _fps = copy._fps;
52  _has_fps = copy._has_fps;
53  _order = copy._order;
54  _coordsys = copy._coordsys;
55 
56  return *this;
57 }
58 
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: EggXfmSAnim::set_fps
62 // Access: Public
63 // Description:
64 ////////////////////////////////////////////////////////////////////
65 INLINE void EggXfmSAnim::
66 set_fps(double fps) {
67  _fps = fps;
68  _has_fps = true;
69 }
70 
71 
72 ////////////////////////////////////////////////////////////////////
73 // Function: EggXfmSAnim::clear_fps
74 // Access: Public
75 // Description:
76 ////////////////////////////////////////////////////////////////////
77 INLINE void EggXfmSAnim::
78 clear_fps() {
79  _has_fps = false;
80 }
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function: EggXfmSAnim::has_fps
84 // Access: Public
85 // Description:
86 ////////////////////////////////////////////////////////////////////
87 INLINE bool EggXfmSAnim::
88 has_fps() const {
89  return _has_fps;
90 }
91 
92 ////////////////////////////////////////////////////////////////////
93 // Function: EggXfmSAnim::get_fps
94 // Access: Public
95 // Description: This is only valid if has_fps() returns true.
96 ////////////////////////////////////////////////////////////////////
97 INLINE double EggXfmSAnim::
98 get_fps() const {
99  nassertr(has_fps(), 0.0);
100  return _fps;
101 }
102 
103 ////////////////////////////////////////////////////////////////////
104 // Function: EggXfmSAnim::set_order
105 // Access: Public
106 // Description:
107 ////////////////////////////////////////////////////////////////////
108 INLINE void EggXfmSAnim::
109 set_order(const string &order) {
110  _order = order;
111 }
112 
113 ////////////////////////////////////////////////////////////////////
114 // Function: EggXfmSAnim::clear_order
115 // Access: Public
116 // Description:
117 ////////////////////////////////////////////////////////////////////
118 INLINE void EggXfmSAnim::
119 clear_order() {
120  _order = "";
121 }
122 
123 ////////////////////////////////////////////////////////////////////
124 // Function: EggXfmSAnim::has_order
125 // Access: Public
126 // Description:
127 ////////////////////////////////////////////////////////////////////
128 INLINE bool EggXfmSAnim::
129 has_order() const {
130  return !_order.empty();
131 }
132 
133 ////////////////////////////////////////////////////////////////////
134 // Function: EggXfmSAnim::get_order
135 // Access: Public
136 // Description:
137 ////////////////////////////////////////////////////////////////////
138 INLINE const string &EggXfmSAnim::
139 get_order() const {
140  if (has_order()) {
141  return _order;
142  } else {
143  return get_standard_order();
144  }
145 }
146 
147 ////////////////////////////////////////////////////////////////////
148 // Function: EggXfmSAnim::get_standard_order
149 // Access: Public, Static
150 // Description: Returns the standard order of matrix component
151 // composition. This is what the order string must be
152 // set to in order to use set_value() or add_data()
153 // successfully.
154 ////////////////////////////////////////////////////////////////////
155 INLINE const string &EggXfmSAnim::
157  if (temp_hpr_fix) {
158  return _standard_order_hpr_fix;
159  } else {
160  return _standard_order_legacy;
161  }
162 }
163 
164 ////////////////////////////////////////////////////////////////////
165 // Function: EggXfmSAnim::get_coordinate_system
166 // Access: Public
167 // Description: Returns the coordinate system this table believes it
168 // is defined within. This should always match the
169 // coordinate system of the EggData structure that owns
170 // it. It is necessary to store it here because the
171 // meaning of the h, p, and r columns depends on the
172 // coordinate system.
173 ////////////////////////////////////////////////////////////////////
174 INLINE CoordinateSystem EggXfmSAnim::
176  return _coordsys;
177 }
178 
179 ////////////////////////////////////////////////////////////////////
180 // Function: EggXfmSAnim::clear_data
181 // Access: Public
182 // Description: Removes all data from the table. It does this by
183 // removing all of its children.
184 ////////////////////////////////////////////////////////////////////
185 INLINE void EggXfmSAnim::
187  EggGroupNode::clear();
188 }
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:51
static const string & get_standard_order()
Returns the standard order of matrix component composition.
Definition: eggXfmSAnim.I:156
CoordinateSystem get_coordinate_system() const
Returns the coordinate system this table believes it is defined within.
Definition: eggXfmSAnim.I:175
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
Definition: eggXfmSAnim.h:33
void clear_data()
Removes all data from the table.
Definition: eggXfmSAnim.I:186
double get_fps() const
This is only valid if has_fps() returns true.
Definition: eggXfmSAnim.I:98