Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

AnimChannelMatrixXfmTable Class Reference

An animation channel that issues a matrix each frame, read from a table such as might have been read from an egg file. More...

#include "animChannelMatrixXfmTable.h"

Inheritance diagram for AnimChannelMatrixXfmTable:
AnimChannel< ACMatrixSwitchType > AnimChannelBase AnimGroup TypedWritableReferenceCount Namable TypedWritable ReferenceCount MemoryBase TypedObject MemoryBase MemoryBase

List of all members.

Public Member Functions

 AnimChannelMatrixXfmTable (AnimGroup *parent, const string &name)
void clear_all_tables ()
 Removes all the tables from the channel, and resets it to its initial state.
void clear_table (char table_id)
 Removes the indicated table from the definition.
virtual TypeHandle force_init_type ()
virtual void get_hpr (int frame, LVecBase3 &hpr)
 Returns the h, p, and r components associated with the current frame.
virtual void get_pos (int frame, LVecBase3 &pos)
 Returns the x, y, and z translation components associated with the current frame.
virtual void get_quat (int frame, LQuaternion &quat)
 Returns the rotation component associated with the current frame, expressed as a quaternion.
virtual void get_scale (int frame, LVecBase3 &scale)
 Gets the scale value at the indicated frame.
virtual void get_shear (int frame, LVecBase3 &shear)
 Returns the a, b, and c shear components associated with the current frame.
CPTA_stdfloat get_table (char table_id) const
 Returns a pointer to the indicated subtable's data, if it exists, or NULL if it does not.
virtual TypeHandle get_type () const
virtual void get_value (int frame, LMatrix4 &mat)
 Gets the value of the channel at the indicated frame.
virtual void get_value_no_scale_shear (int frame, LMatrix4 &value)
 Gets the value of the channel at the indicated frame, without any scale or shear information.
virtual bool has_changed (int last_frame, double last_frac, int this_frame, double this_frac)
 Returns true if the value has changed since the last call to has_changed().
bool has_table (char table_id) const
 Returns true if the indicated subtable has been assigned.
void set_table (char table_id, const CPTA_stdfloat &table)
 Assigns the indicated table.
virtual void write (ostream &out, int indent_level) const
 Writes a brief description of the table and all of its descendants.
virtual void write_datagram (BamWriter *manager, Datagram &me)
 Function to write the important information in the particular object to a Datagram.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
static bool is_valid_id (char table_id)
 Returns true if the given letter is one of the nine valid table id's.
static TypedWritablemake_AnimChannelMatrixXfmTable (const FactoryParams &params)
 Factory method to generate an AnimChannelMatrixXfmTable object.
static void register_with_read_factory ()
 Factory method to generate an AnimChannelMatrixXfmTable object.

Protected Member Functions

 AnimChannelMatrixXfmTable ()
 Used only for bam loader.
 AnimChannelMatrixXfmTable (AnimGroup *parent, const AnimChannelMatrixXfmTable &copy)
 Creates a new AnimChannelMatrixXfmTable, just like this one, without copying any children.
void fillin (DatagramIterator &scan, BamReader *manager)
 Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.
virtual AnimGroupmake_copy (AnimGroup *parent) const
 Returns a copy of this object, and attaches it to the indicated parent (which may be NULL only if this is an AnimBundle).

Static Protected Member Functions

static PN_stdfloat get_default_value (int table_index)
 Returns the default value the indicated table is expected to have in the absence of any data.
static char get_table_id (int table_index)
 Returns the table ID associated with the indicated table index number.
static int get_table_index (char table_id)
 Returns the table index number, a value between 0 and num_matrix_components, that corresponds to the indicated table id.

Protected Attributes

CPTA_stdfloat _tables [num_matrix_components]

Detailed Description

An animation channel that issues a matrix each frame, read from a table such as might have been read from an egg file.

The table actually consists of nine sub-tables, each representing one component of the transform: scale, rotate, translate.

Definition at line 34 of file animChannelMatrixXfmTable.h.


Constructor & Destructor Documentation

AnimChannelMatrixXfmTable::AnimChannelMatrixXfmTable ( ) [protected]

Used only for bam loader.

Definition at line 37 of file animChannelMatrixXfmTable.cxx.

Referenced by make_AnimChannelMatrixXfmTable(), and make_copy().

AnimChannelMatrixXfmTable::AnimChannelMatrixXfmTable ( AnimGroup parent,
const AnimChannelMatrixXfmTable copy 
) [protected]

Creates a new AnimChannelMatrixXfmTable, just like this one, without copying any children.

The new copy is added to the indicated parent. Intended to be called by make_copy() only.

Definition at line 52 of file animChannelMatrixXfmTable.cxx.


Member Function Documentation

void AnimChannelMatrixXfmTable::clear_all_tables ( )

Removes all the tables from the channel, and resets it to its initial state.

Definition at line 296 of file animChannelMatrixXfmTable.cxx.

Referenced by fillin().

void AnimChannelMatrixXfmTable::clear_table ( char  table_id) [inline]

Removes the indicated table from the definition.

Definition at line 63 of file animChannelMatrixXfmTable.I.

References get_table_index().

void AnimChannelMatrixXfmTable::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual]

Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.

Reimplemented from AnimChannelBase.

Definition at line 441 of file animChannelMatrixXfmTable.cxx.

References clear_all_tables(), DatagramIterator::get_bool(), BamReader::get_file_minor_ver(), DatagramIterator::get_stdfloat(), DatagramIterator::get_uint16(), FFTCompressor::read_header(), FFTCompressor::read_hprs(), and FFTCompressor::read_reals().

Referenced by make_AnimChannelMatrixXfmTable().

PN_stdfloat AnimChannelMatrixXfmTable::get_default_value ( int  table_index) [inline, static, protected]

Returns the default value the indicated table is expected to have in the absence of any data.

Definition at line 92 of file animChannelMatrixXfmTable.I.

Referenced by get_value(), and get_value_no_scale_shear().

void AnimChannelMatrixXfmTable::get_hpr ( int  frame,
LVecBase3 hpr 
) [virtual]

Returns the h, p, and r components associated with the current frame.

As above, this only makes sense for a matrix-type channel.

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 193 of file animChannelMatrixXfmTable.cxx.

void AnimChannelMatrixXfmTable::get_pos ( int  frame,
LVecBase3 pos 
) [virtual]

Returns the x, y, and z translation components associated with the current frame.

As above, this only makes sense for a matrix-type channel.

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 232 of file animChannelMatrixXfmTable.cxx.

void AnimChannelMatrixXfmTable::get_quat ( int  frame,
LQuaternion quat 
) [virtual]

Returns the rotation component associated with the current frame, expressed as a quaternion.

As above, this only makes sense for a matrix-type channel.

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 211 of file animChannelMatrixXfmTable.cxx.

References LQuaternionf::set_hpr().

void AnimChannelMatrixXfmTable::get_scale ( int  frame,
LVecBase3 scale 
) [virtual]

Gets the scale value at the indicated frame.

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 175 of file animChannelMatrixXfmTable.cxx.

void AnimChannelMatrixXfmTable::get_shear ( int  frame,
LVecBase3 shear 
) [virtual]

Returns the a, b, and c shear components associated with the current frame.

As above, this only makes sense for a matrix-type channel.

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 250 of file animChannelMatrixXfmTable.cxx.

CPTA_stdfloat AnimChannelMatrixXfmTable::get_table ( char  table_id) const [inline]

Returns a pointer to the indicated subtable's data, if it exists, or NULL if it does not.

Definition at line 34 of file animChannelMatrixXfmTable.I.

References get_table_index().

char AnimChannelMatrixXfmTable::get_table_id ( int  table_index) [inline, static, protected]

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'.

Definition at line 79 of file animChannelMatrixXfmTable.I.

Referenced by get_table_index(), and write().

int AnimChannelMatrixXfmTable::get_table_index ( char  table_id) [static, protected]

Returns the table index number, a value between 0 and num_matrix_components, that corresponds to the indicated table id.

Returns -1 if the table id is invalid.

Definition at line 357 of file animChannelMatrixXfmTable.cxx.

References get_table_id().

Referenced by clear_table(), get_table(), has_table(), is_valid_id(), and set_table().

void AnimChannelMatrixXfmTable::get_value ( int  frame,
LMatrix4 mat 
) [virtual]

Gets the value of the channel at the indicated frame.

Implements AnimChannel< ACMatrixSwitchType >.

Definition at line 128 of file animChannelMatrixXfmTable.cxx.

References get_default_value().

void AnimChannelMatrixXfmTable::get_value_no_scale_shear ( int  frame,
LMatrix4 value 
) [virtual]

Gets the value of the channel at the indicated frame, without any scale or shear information.

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 149 of file animChannelMatrixXfmTable.cxx.

References get_default_value().

bool AnimChannelMatrixXfmTable::has_changed ( int  last_frame,
double  last_frac,
int  this_frame,
double  this_frac 
) [virtual]

Returns true if the value has changed since the last call to has_changed().

last_frame is the frame number of the last call; this_frame is the current frame number.

Reimplemented from AnimChannelBase.

Definition at line 93 of file animChannelMatrixXfmTable.cxx.

bool AnimChannelMatrixXfmTable::has_table ( char  table_id) const [inline]

Returns true if the indicated subtable has been assigned.

Definition at line 49 of file animChannelMatrixXfmTable.I.

References get_table_index().

bool AnimChannelMatrixXfmTable::is_valid_id ( char  table_id) [inline, static]

Returns true if the given letter is one of the nine valid table id's.

Definition at line 23 of file animChannelMatrixXfmTable.I.

References get_table_index().

TypedWritable * AnimChannelMatrixXfmTable::make_AnimChannelMatrixXfmTable ( const FactoryParams params) [static]

Factory method to generate an AnimChannelMatrixXfmTable object.

Definition at line 569 of file animChannelMatrixXfmTable.cxx.

References AnimChannelMatrixXfmTable(), and fillin().

Referenced by register_with_read_factory().

AnimGroup * AnimChannelMatrixXfmTable::make_copy ( AnimGroup parent) const [protected, virtual]

Returns a copy of this object, and attaches it to the indicated parent (which may be NULL only if this is an AnimBundle).

Intended to be called by copy_subtree() only.

Reimplemented from AnimGroup.

Definition at line 344 of file animChannelMatrixXfmTable.cxx.

References AnimChannelMatrixXfmTable().

void AnimChannelMatrixXfmTable::register_with_read_factory ( ) [static]
void AnimChannelMatrixXfmTable::set_table ( char  table_id,
const CPTA_stdfloat table 
)

Assigns the indicated table.

table_id is one of 'i', 'j', 'k', for scale, 'a', 'b', 'c' for shear, 'h', 'p', 'r', for rotation, and 'x', 'y', 'z', for translation. The new table must have either zero, one, or get_num_frames() frames.

Definition at line 270 of file animChannelMatrixXfmTable.cxx.

References AnimBundle::get_num_frames(), and get_table_index().

void AnimChannelMatrixXfmTable::write ( ostream &  out,
int  indent_level 
) const [virtual]

Writes a brief description of the table and all of its descendants.

Reimplemented from AnimGroup.

Definition at line 309 of file animChannelMatrixXfmTable.cxx.

References get_table_id(), and AnimGroup::write_descendants().

void AnimChannelMatrixXfmTable::write_datagram ( BamWriter manager,
Datagram me 
) [virtual]

The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations