Panda3D
animChannelMatrixXfmTable.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 animChannelMatrixXfmTable.I
10  * @author drose
11  * @date 1999-02-21
12  */
13 
14 /**
15  * Returns true if the given letter is one of the nine valid table id's.
16  */
18 is_valid_id(char table_id) {
19  return get_table_index(table_id) >= 0;
20 }
21 
22 /**
23  * Returns a pointer to the indicated subtable's data, if it exists, or NULL
24  * if it does not.
25  */
27 get_table(char table_id) const {
28  int table_index = get_table_index(table_id);
29  if (table_index < 0) {
30  return CPTA_stdfloat(get_class_type());
31  }
32  return _tables[table_index];
33 }
34 
35 /**
36  * Returns true if the indicated subtable has been assigned.
37  */
39 has_table(char table_id) const {
40  int table_index = get_table_index(table_id);
41  if (table_index < 0) {
42  return false;
43  }
44  return !(_tables[table_index] == nullptr);
45 }
46 
47 /**
48  * Removes the indicated table from the definition.
49  */
51 clear_table(char table_id) {
52  int table_index = get_table_index(table_id);
53  if (table_index >= 0) {
54  _tables[table_index] = nullptr;
55  }
56 }
57 
58 
59 /**
60  * Returns the table ID associated with the indicated table index number.
61  * This is the letter 'i', 'j', 'k', 'a', 'b', 'c', 'h', 'p', 'r', 'x', 'y',
62  * or 'z'.
63  */
64 INLINE char AnimChannelMatrixXfmTable::
65 get_table_id(int table_index) {
66  nassertr(table_index >= 0 && table_index < num_matrix_components, '\0');
67  return matrix_component_letters[table_index];
68 }
69 
70 
71 /**
72  * Returns the default value the indicated table is expected to have in the
73  * absence of any data.
74  */
75 INLINE PN_stdfloat AnimChannelMatrixXfmTable::
76 get_default_value(int table_index) {
77  nassertr(table_index >= 0 && table_index < num_matrix_components, 0.0);
78  return matrix_component_defaults[table_index];
79 }
static bool is_valid_id(char table_id)
Returns true if the given letter is one of the nine valid table id's.
has_table
Returns true if the indicated subtable has been assigned.
clear_table
Removes the indicated table from the definition.
get_table
Returns a pointer to the indicated subtable's data, if it exists, or NULL if it does not.
Similar to PointerToArray, except that its contents may not be modified.