open_toontown_panda3d/panda/src/chan/animChannelMatrixXfmTable.I

97 lines
3.7 KiB
Plaintext

// Filename: animChannelMatrixXfmTable.I
// Created by: drose (21Feb99)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: AnimChannelMatrixXfmTable::is_valid_id
// Access: Public, Static
// Description: Returns true if the given letter is one of the nine
// valid table id's.
////////////////////////////////////////////////////////////////////
INLINE bool AnimChannelMatrixXfmTable::
is_valid_id(char table_id) {
return get_table_index(table_id) >= 0;
}
////////////////////////////////////////////////////////////////////
// Function: AnimChannelMatrixXfmTable::get_table
// Access: Public
// Description: Returns a pointer to the indicated subtable's data,
// if it exists, or NULL if it does not.
////////////////////////////////////////////////////////////////////
INLINE CPTA_stdfloat AnimChannelMatrixXfmTable::
get_table(char table_id) const {
int table_index = get_table_index(table_id);
if (table_index < 0) {
return CPTA_stdfloat(get_class_type());
}
return _tables[table_index];
}
////////////////////////////////////////////////////////////////////
// Function: AnimChannelMatrixXfmTable::has_table
// Access: Published
// Description: Returns true if the indicated subtable has been
// assigned.
////////////////////////////////////////////////////////////////////
INLINE bool AnimChannelMatrixXfmTable::
has_table(char table_id) const {
int table_index = get_table_index(table_id);
if (table_index < 0) {
return false;
}
return !(_tables[table_index] == (const PN_stdfloat *)NULL);
}
////////////////////////////////////////////////////////////////////
// Function: AnimChannelMatrixXfmTable::clear_table
// Access: Published
// Description: Removes the indicated table from the definition.
////////////////////////////////////////////////////////////////////
INLINE void AnimChannelMatrixXfmTable::
clear_table(char table_id) {
int table_index = get_table_index(table_id);
if (table_index >= 0) {
_tables[table_index] = NULL;
}
}
////////////////////////////////////////////////////////////////////
// Function: AnimChannelMatrixXfmTable::get_table_id
// Access: Protected, Static
// Description: Returns the table ID associated with the indicated
// table index number. This is the letter 'i', 'j',
// 'k', 'a', 'b', 'c', 'h', 'p', 'r', 'x', 'y', or 'z'.
////////////////////////////////////////////////////////////////////
INLINE char AnimChannelMatrixXfmTable::
get_table_id(int table_index) {
nassertr(table_index >= 0 && table_index < num_matrix_components, '\0');
return matrix_component_letters[table_index];
}
////////////////////////////////////////////////////////////////////
// Function: AnimChannelMatrixXfmTable::get_default_value
// Access: Protected, Static
// Description: Returns the default value the indicated table is
// expected to have in the absence of any data.
////////////////////////////////////////////////////////////////////
INLINE PN_stdfloat AnimChannelMatrixXfmTable::
get_default_value(int table_index) {
nassertr(table_index >= 0 && table_index < num_matrix_components, 0.0);
return matrix_component_defaults[table_index];
}