Panda3D
|
00001 // Filename: animChannelMatrixXfmTable.I 00002 // Created by: drose (21Feb99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: AnimChannelMatrixXfmTable::is_valid_id 00018 // Access: Public, Static 00019 // Description: Returns true if the given letter is one of the nine 00020 // valid table id's. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE bool AnimChannelMatrixXfmTable:: 00023 is_valid_id(char table_id) { 00024 return get_table_index(table_id) >= 0; 00025 } 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: AnimChannelMatrixXfmTable::get_table 00029 // Access: Public 00030 // Description: Returns a pointer to the indicated subtable's data, 00031 // if it exists, or NULL if it does not. 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE CPTA_stdfloat AnimChannelMatrixXfmTable:: 00034 get_table(char table_id) const { 00035 int table_index = get_table_index(table_id); 00036 if (table_index < 0) { 00037 return CPTA_stdfloat(get_class_type()); 00038 } 00039 return _tables[table_index]; 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: AnimChannelMatrixXfmTable::has_table 00044 // Access: Published 00045 // Description: Returns true if the indicated subtable has been 00046 // assigned. 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE bool AnimChannelMatrixXfmTable:: 00049 has_table(char table_id) const { 00050 int table_index = get_table_index(table_id); 00051 if (table_index < 0) { 00052 return false; 00053 } 00054 return !(_tables[table_index] == (const PN_stdfloat *)NULL); 00055 } 00056 00057 //////////////////////////////////////////////////////////////////// 00058 // Function: AnimChannelMatrixXfmTable::clear_table 00059 // Access: Published 00060 // Description: Removes the indicated table from the definition. 00061 //////////////////////////////////////////////////////////////////// 00062 INLINE void AnimChannelMatrixXfmTable:: 00063 clear_table(char table_id) { 00064 int table_index = get_table_index(table_id); 00065 if (table_index >= 0) { 00066 _tables[table_index] = NULL; 00067 } 00068 } 00069 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: AnimChannelMatrixXfmTable::get_table_id 00073 // Access: Protected, Static 00074 // Description: Returns the table ID associated with the indicated 00075 // table index number. This is the letter 'i', 'j', 00076 // 'k', 'a', 'b', 'c', 'h', 'p', 'r', 'x', 'y', or 'z'. 00077 //////////////////////////////////////////////////////////////////// 00078 INLINE char AnimChannelMatrixXfmTable:: 00079 get_table_id(int table_index) { 00080 nassertr(table_index >= 0 && table_index < num_matrix_components, '\0'); 00081 return matrix_component_letters[table_index]; 00082 } 00083 00084 00085 //////////////////////////////////////////////////////////////////// 00086 // Function: AnimChannelMatrixXfmTable::get_default_value 00087 // Access: Protected, Static 00088 // Description: Returns the default value the indicated table is 00089 // expected to have in the absence of any data. 00090 //////////////////////////////////////////////////////////////////// 00091 INLINE PN_stdfloat AnimChannelMatrixXfmTable:: 00092 get_default_value(int table_index) { 00093 nassertr(table_index >= 0 && table_index < num_matrix_components, 0.0); 00094 return matrix_component_defaults[table_index]; 00095 } 00096