Panda3D
|
Corresponding to an <Xfm$Anim> entry, this stores a two-dimensional table with up to nine columns, one for each component of a transformation. More...
#include "eggXfmAnimData.h"
Public Member Functions | |
EggXfmAnimData (const string &name="", CoordinateSystem cs=CS_default) | |
EggXfmAnimData (const EggXfmSAnim &convert_from) | |
Converts the newer-style XfmSAnim table to the older-style XfmAnim table. | |
EggXfmAnimData (const EggXfmAnimData ©) | |
void | clear_contents () |
void | clear_order () |
virtual TypeHandle | force_init_type () |
const string & | get_contents () const |
CoordinateSystem | get_coordinate_system () const |
Returns the coordinate system this table believes it is defined within. | |
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. | |
const string & | get_order () const |
virtual TypeHandle | get_type () const |
double | get_value (int row, int col) const |
Returns the value at the indicated row. | |
void | get_value (int row, LMatrix4d &mat) const |
Returns the value of the aggregate row of the table as a matrix. | |
bool | has_contents () const |
bool | has_order () const |
virtual bool | is_anim_matrix () const |
Returns true if this node represents a table of animation transformation data, false otherwise. | |
EggXfmAnimData & | operator= (const EggXfmAnimData ©) |
void | set_contents (const string &contents) |
void | set_order (const string &order) |
virtual void | write (ostream &out, int indent_level) const |
Writes the data to the indicated output stream in Egg format. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static const string & | get_standard_order () |
Returns the standard order of matrix component composition. | |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. | |
Protected Member Functions | |
virtual void | r_mark_coordsys (CoordinateSystem cs) |
This is only called immediately after loading an egg file from disk, to propagate the value found in the CoordinateSystem entry (or the default Y-up coordinate system) to all nodes that care about what the coordinate system is. | |
virtual void | r_transform (const LMatrix4d &mat, const LMatrix4d &inv, CoordinateSystem to_cs) |
Applies the indicated transform to all the rows of the table. |
Corresponding to an <Xfm$Anim> entry, this stores a two-dimensional table with up to nine columns, one for each component of a transformation.
This is an older syntax of egg anim table, not often used currently--it's replaced by EggXfmSAnim.
Definition at line 32 of file eggXfmAnimData.h.
EggXfmAnimData::EggXfmAnimData | ( | const EggXfmSAnim & | convert_from | ) |
Converts the newer-style XfmSAnim table to the older-style XfmAnim table.
Definition at line 37 of file eggXfmAnimData.cxx.
References EggAnimData::add_data(), EggXfmSAnim::get_coordinate_system(), EggXfmSAnim::get_fps(), EggSAnimData::get_num_rows(), get_num_rows(), EggXfmSAnim::get_num_rows(), and EggSAnimData::get_value().
CoordinateSystem EggXfmAnimData::get_coordinate_system | ( | ) | const [inline] |
Returns the coordinate system this table believes it is defined within.
This should always match the coordinate system of the EggData structure that owns it. It is necessary to store it here because the meaning of the h, p, and r columns depends on the coordinate system.
Definition at line 166 of file eggXfmAnimData.I.
Referenced by EggXfmSAnim::EggXfmSAnim().
int EggXfmAnimData::get_num_cols | ( | ) | const [inline] |
Returns the number of columns in the table.
This is set according to the "contents" string, which defines the meaning of each column.
Definition at line 192 of file eggXfmAnimData.I.
Referenced by EggXfmSAnim::EggXfmSAnim(), get_num_rows(), and get_value().
int EggXfmAnimData::get_num_rows | ( | ) | const [inline] |
Returns the number of rows in the table.
Definition at line 177 of file eggXfmAnimData.I.
References get_num_cols(), and EggAnimData::get_size().
Referenced by EggXfmAnimData(), EggXfmSAnim::EggXfmSAnim(), get_value(), and r_transform().
const string & EggXfmAnimData::get_standard_order | ( | ) | [inline, static] |
Returns the standard order of matrix component composition.
This is what the order string must be set to in order to use set_value() or add_data() successfully.
Definition at line 110 of file eggXfmAnimData.I.
Referenced by r_transform().
double EggXfmAnimData::get_value | ( | int | row, |
int | col | ||
) | const [inline] |
Returns the value at the indicated row.
Row must be in the range 0 <= row < get_num_rows(); col must be in the range 0 <= col < get_num_cols().
Definition at line 205 of file eggXfmAnimData.I.
References get_num_cols(), and get_num_rows().
Referenced by EggXfmSAnim::EggXfmSAnim(), get_value(), and r_transform().
void EggXfmAnimData::get_value | ( | int | row, |
LMatrix4d & | mat | ||
) | const |
Returns the value of the aggregate row of the table as a matrix.
This is a convenience function that treats the 2-d table as if it were a single table of matrices.
Definition at line 92 of file eggXfmAnimData.cxx.
References EggXfmSAnim::compose_with_order(), get_num_cols(), and get_value().
static void EggXfmAnimData::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from EggAnimData.
Definition at line 78 of file eggXfmAnimData.h.
References EggAnimData::init_type().
bool EggXfmAnimData::is_anim_matrix | ( | ) | const [virtual] |
Returns true if this node represents a table of animation transformation data, false otherwise.
Reimplemented from EggNode.
Definition at line 168 of file eggXfmAnimData.cxx.
void EggXfmAnimData::r_mark_coordsys | ( | CoordinateSystem | cs | ) | [protected, virtual] |
This is only called immediately after loading an egg file from disk, to propagate the value found in the CoordinateSystem entry (or the default Y-up coordinate system) to all nodes that care about what the coordinate system is.
Reimplemented from EggNode.
Definition at line 290 of file eggXfmAnimData.cxx.
void EggXfmAnimData::r_transform | ( | const LMatrix4d & | mat, |
const LMatrix4d & | inv, | ||
CoordinateSystem | to_cs | ||
) | [protected, virtual] |
Applies the indicated transform to all the rows of the table.
This actually forces the generation of a totally new set of rows.
Reimplemented from EggNode.
Definition at line 212 of file eggXfmAnimData.cxx.
References EggXfmSAnim::add_data(), EggAnimData::get_fps(), get_num_rows(), get_standard_order(), get_value(), EggXfmSAnim::optimize(), and LMatrix4d::set_row().
void EggXfmAnimData::write | ( | ostream & | out, |
int | indent_level | ||
) | const [virtual] |
Writes the data to the indicated output stream in Egg format.
Implements EggNode.
Definition at line 179 of file eggXfmAnimData.cxx.
References EggAnimData::get_fps(), and EggNamedObject::write_header().