Panda3D
Loading...
Searching...
No Matches
eggXfmAnimData.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file eggXfmAnimData.I
10 * @author drose
11 * @date 1999-02-19
12 */
13
14/**
15 *
16 */
17INLINE EggXfmAnimData::
18EggXfmAnimData(const std::string &name, CoordinateSystem cs) : EggAnimData(name) {
19 _coordsys = cs;
20}
21
22
23/**
24 *
25 */
26INLINE EggXfmAnimData::
27EggXfmAnimData(const EggXfmAnimData &copy)
28 : EggAnimData(copy),
29 _order(copy._order),
30 _contents(copy._contents),
31 _coordsys(copy._coordsys) {
32}
33
34
35/**
36 *
37 */
38INLINE EggXfmAnimData &EggXfmAnimData::
39operator = (const EggXfmAnimData &copy) {
40 EggAnimData::operator = (copy);
41 _order = copy._order;
42 _contents = copy._contents;
43 _coordsys = copy._coordsys;
44
45 return *this;
46}
47
48
49/**
50 *
51 */
52INLINE void EggXfmAnimData::
53set_order(const std::string &order) {
54 _order = order;
55}
56
57/**
58 *
59 */
60INLINE void EggXfmAnimData::
61clear_order() {
62 _order = "";
63}
64
65/**
66 *
67 */
68INLINE bool EggXfmAnimData::
69has_order() const {
70 return !_order.empty();
71}
72
73/**
74 *
75 */
76INLINE const std::string &EggXfmAnimData::
77get_order() const {
78 if (has_order()) {
79 return _order;
80 } else {
81 return get_standard_order();
82 }
83}
84
85/**
86 * Returns the standard order of matrix component composition. This is what
87 * the order string must be set to in order to use set_value() or add_data()
88 * successfully.
89 */
90INLINE const std::string &EggXfmAnimData::
93}
94
95
96/**
97 *
98 */
99INLINE void EggXfmAnimData::
100set_contents(const std::string &contents) {
101 _contents = contents;
102}
103
104/**
105 *
106 */
107INLINE void EggXfmAnimData::
108clear_contents() {
109 _contents = "";
110}
111
112/**
113 *
114 */
115INLINE bool EggXfmAnimData::
116has_contents() const {
117 return !_contents.empty();
118}
119
120/**
121 *
122 */
123INLINE const std::string &EggXfmAnimData::
124get_contents() const {
125 return _contents;
126}
127
128/**
129 * Returns the coordinate system this table believes it is defined within.
130 * This should always match the coordinate system of the EggData structure
131 * that owns it. It is necessary to store it here because the meaning of the
132 * h, p, and r columns depends on the coordinate system.
133 */
134INLINE CoordinateSystem EggXfmAnimData::
135get_coordinate_system() const {
136 return _coordsys;
137}
138
139
140/**
141 * Returns the number of rows in the table.
142 */
144get_num_rows() const {
145 if (get_num_cols() == 0) {
146 return 0;
147 }
148 return get_size() / get_num_cols();
149}
150
151/**
152 * Returns the number of columns in the table. This is set according to the
153 * "contents" string, which defines the meaning of each column.
154 */
156get_num_cols() const {
157 return _contents.length();
158}
159
160
161/**
162 * Returns the value at the indicated row. Row must be in the range 0 <= row
163 * < get_num_rows(); col must be in the range 0 <= col < get_num_cols().
164 */
165INLINE double EggXfmAnimData::
166get_value(int row, int col) const {
167 nassertr(get_num_cols() != 0, 0.0);
168 nassertr(row >= 0 && row < get_num_rows(), 0.0);
169 nassertr(col >= 0 && col < get_num_cols(), 0.0);
170 return _data[row * get_num_cols() + col];
171}
A base class for EggSAnimData and EggXfmAnimData, which contain rows and columns of numbers.
Definition eggAnimData.h:30
int get_size() const
Returns the number of elements in the table.
Corresponding to an <Xfm$Anim> entry, this stores a two-dimensional table with up to nine columns,...
static const std::string & get_standard_order()
Returns the standard order of matrix component composition.
int get_num_cols() const
Returns the number of columns in the table.
int get_num_rows() const
Returns the number of rows in the table.
double get_value(int row, int col) const
Returns the value at the indicated row.
CoordinateSystem get_coordinate_system() const
Returns the coordinate system this table believes it is defined within.
static const std::string & get_standard_order()
Returns the standard order of matrix component composition.