Panda3D
animChannelMatrixXfmTable.I
1 // Filename: animChannelMatrixXfmTable.I
2 // Created by: drose (21Feb99)
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: AnimChannelMatrixXfmTable::is_valid_id
18 // Access: Public, Static
19 // Description: Returns true if the given letter is one of the nine
20 // valid table id's.
21 ////////////////////////////////////////////////////////////////////
23 is_valid_id(char table_id) {
24  return get_table_index(table_id) >= 0;
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: AnimChannelMatrixXfmTable::get_table
29 // Access: Public
30 // Description: Returns a pointer to the indicated subtable's data,
31 // if it exists, or NULL if it does not.
32 ////////////////////////////////////////////////////////////////////
34 get_table(char table_id) const {
35  int table_index = get_table_index(table_id);
36  if (table_index < 0) {
37  return CPTA_stdfloat(get_class_type());
38  }
39  return _tables[table_index];
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: AnimChannelMatrixXfmTable::has_table
44 // Access: Published
45 // Description: Returns true if the indicated subtable has been
46 // assigned.
47 ////////////////////////////////////////////////////////////////////
49 has_table(char table_id) const {
50  int table_index = get_table_index(table_id);
51  if (table_index < 0) {
52  return false;
53  }
54  return !(_tables[table_index] == (const PN_stdfloat *)NULL);
55 }
56 
57 ////////////////////////////////////////////////////////////////////
58 // Function: AnimChannelMatrixXfmTable::clear_table
59 // Access: Published
60 // Description: Removes the indicated table from the definition.
61 ////////////////////////////////////////////////////////////////////
63 clear_table(char table_id) {
64  int table_index = get_table_index(table_id);
65  if (table_index >= 0) {
66  _tables[table_index] = NULL;
67  }
68 }
69 
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: AnimChannelMatrixXfmTable::get_table_id
73 // Access: Protected, Static
74 // Description: Returns the table ID associated with the indicated
75 // table index number. This is the letter 'i', 'j',
76 // 'k', 'a', 'b', 'c', 'h', 'p', 'r', 'x', 'y', or 'z'.
77 ////////////////////////////////////////////////////////////////////
78 INLINE char AnimChannelMatrixXfmTable::
79 get_table_id(int table_index) {
80  nassertr(table_index >= 0 && table_index < num_matrix_components, '\0');
81  return matrix_component_letters[table_index];
82 }
83 
84 
85 ////////////////////////////////////////////////////////////////////
86 // Function: AnimChannelMatrixXfmTable::get_default_value
87 // Access: Protected, Static
88 // Description: Returns the default value the indicated table is
89 // expected to have in the absence of any data.
90 ////////////////////////////////////////////////////////////////////
91 INLINE PN_stdfloat AnimChannelMatrixXfmTable::
92 get_default_value(int table_index) {
93  nassertr(table_index >= 0 && table_index < num_matrix_components, 0.0);
94  return matrix_component_defaults[table_index];
95 }
96 
static bool is_valid_id(char table_id)
Returns true if the given letter is one of the nine valid table id&#39;s.
bool has_table(char table_id) const
Returns true if the indicated subtable has been assigned.
void clear_table(char table_id)
Removes the indicated table from the definition.
CPTA_stdfloat get_table(char table_id) const
Returns a pointer to the indicated subtable&#39;s data, if it exists, or NULL if it does not...
Similar to PointerToArray, except that its contents may not be modified.