Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

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 TypedObject List of all members.

Public Types

typedef TYPENAME ACMatrixSwitchType::ValueType ValueType

Public Member Functions

 AnimChannelMatrixXfmTable (AnimGroup *parent, const string &name)
virtual bool has_changed (int last_frame, int this_frame)
 Returns true if the value has changed since the last call to has_changed().

virtual void get_value (int frame, LMatrix4f &mat)
 Gets the value of the channel at the indicated frame.

virtual void get_value_no_scale (int frame, LMatrix4f &value)
 Gets the value of the channel at the indicated frame, without any scale information.

virtual void get_scale (int frame, float scale[3])
 Gets the scale value at the indicated frame.

void clear_all_tables ()
 Removes all the tables from the channel, and resets it to its initial state.

void set_table (char table_id, const CPTA_float &table)
 Assigns the indicated table.

bool has_table (char table_id) const
 Returns true if the indicated subtable has been assigned.

CPTA_float get_table (char table_id) const
 Returns a pointer to the indicated subtable's data, if it exists, or NULL if it does not.

void clear_table (char table_id)
 Removes the indicated table from the definition.

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.

virtual TypeHandle get_type () const
virtual TypeHandle force_init_type ()
virtual void get_value (int frame, ValueType &value)=0
virtual void get_value_no_scale (int frame, ValueType &value)
virtual TypeHandle get_value_type () const
 Returns the TypeHandle associated with the ValueType we are concerned with.

virtual void output (ostream &out) const
 Writes a one-line description of the channel.

int get_num_children () const
 Returns the number of child nodes of the group.

AnimGroupget_child (int n) const
 Returns the nth child of the group.

AnimGroupfind_child (const string &name) const
 Returns the first descendant found with the indicated name, or NULL if no such descendant exists.

void sort_descendants ()
 Sorts the children nodes at each level of the hierarchy into alphabetical order.

virtual int complete_pointers (TypedWritable **p_list, BamReader *manager)
 Takes in a vector of pointes to TypedWritable objects that correspond to all the requests for pointers that this object made to BamReader.

virtual void finalize ()
 Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.

int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type.

bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.

int get_ref_count () const
 Returns the current reference count.

int ref () const
 Explicitly increments the reference count.

int unref () const
 Explicitly decrements the reference count.

void test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.

void set_name (const string &name)
void clear_name ()
 Resets the Namable's name to empty.

bool has_name () const
 Returns true if the Namable has a nonempty name set, false if the name is empty.

const string & get_name () const

Static Public Member Functions

bool is_valid_id (char table_id)
 Returns true if the given letter is one of the nine valid table id's.

void register_with_read_factory (void)
 Factory method to generate a AnimChannelMatrixXfmTable object.

TypedWritablemake_AnimChannelMatrixXfmTable (const FactoryParams &params)
 Factory method to generate a AnimChannelMatrixXfmTable object.

TypeHandle get_class_type ()
void init_type ()
TypedWritablemake_AnimGroup (const FactoryParams &params)
 Factory method to generate a AnimGroup object.


Static Public Attributes

TypedWritable *const Null = (TypedWritable*)0L

Protected Types

enum  { num_tables = 9 }
typedef pvector< PointerTo<
AnimGroup > > 
Children

Protected Member Functions

 AnimChannelMatrixXfmTable (void)
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.

void write_descendants (ostream &out, int indent_level) const
 Writes a brief description of all of the group's descendants.


Static Protected Member Functions

char get_table_id (int table_index)
 Returns the table ID associated with the indicated table index number.

int get_table_index (char table_id)
 Returns the table index number, a value between 0 and num_tables, that corresponds to the indicate table id.

float get_default_value (int table_index)
 Returns the default value the indicated table is expected to have in the absence of any data.


Protected Attributes

CPTA_float _tables [num_tables]
int _last_frame
Children _children
AnimBundle_root

Static Private Attributes

const char _table_ids [num_tables]
const float _default_values [num_tables]
TypeHandle _type_handle

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 47 of file animChannelMatrixXfmTable.h.


Member Typedef Documentation

typedef pvector< PointerTo< AnimGroup > > AnimGroup::Children [protected, inherited]
 

Definition at line 78 of file animGroup.h.

typedef TYPENAME ACMatrixSwitchType::ValueType AnimChannel< ACMatrixSwitchType >::ValueType [inherited]
 

Definition at line 50 of file animChannel.h.


Member Enumeration Documentation

anonymous enum [protected]
 

Enumeration values:
num_tables 

Definition at line 72 of file animChannelMatrixXfmTable.h.


Constructor & Destructor Documentation

AnimChannelMatrixXfmTable::AnimChannelMatrixXfmTable AnimGroup parent,
const string &  name
 

Definition at line 53 of file animChannelMatrixXfmTable.cxx.

AnimChannelMatrixXfmTable::AnimChannelMatrixXfmTable void   )  [protected]
 


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 176 of file animChannelMatrixXfmTable.cxx.

void Namable::clear_name  )  [inline, inherited]
 

Resets the Namable's name to empty.

Definition at line 82 of file namable.I.

References Namable::_name, and INLINE.

void AnimChannelMatrixXfmTable::clear_table char  table_id  )  [inline]
 

Removes the indicated table from the definition.

Definition at line 85 of file animChannelMatrixXfmTable.I.

int AnimGroup::complete_pointers TypedWritable **  p_list,
BamReader manager
[virtual, inherited]
 

Takes in a vector of pointes to TypedWritable objects that correspond to all the requests for pointers that this object made to BamReader.

Reimplemented from TypedWritable.

Definition at line 281 of file animGroup.cxx.

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

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 355 of file animChannelMatrixXfmTable.cxx.

References _tables, PointerToArray< float >::empty_array(), FFTCompressor::read_reals(), and PointerToArray< float >::v().

void TypedWritable::finalize void   )  [virtual, inherited]
 

Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.

Reimplemented in PartBundle, RenderAttrib, RenderEffect, RenderEffects, RenderState, and TransformState.

Definition at line 112 of file typedWritable.cxx.

Referenced by BamReader::skip_pointer().

AnimGroup * AnimGroup::find_child const string &  name  )  const [inherited]
 

Returns the first descendant found with the indicated name, or NULL if no such descendant exists.

Definition at line 99 of file animGroup.cxx.

References TypeHandle::none().

virtual TypeHandle AnimChannelMatrixXfmTable::force_init_type void   )  [inline, virtual]
 

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 93 of file animChannelMatrixXfmTable.h.

AnimGroup * AnimGroup::get_child int  n  )  const [inherited]
 

Returns the nth child of the group.

Definition at line 83 of file animGroup.cxx.

References AnimGroup::_children.

TypeHandle AnimChannelMatrixXfmTable::get_class_type void   )  [inline, static]
 

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 94 of file animChannelMatrixXfmTable.h.

float 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 122 of file animChannelMatrixXfmTable.I.

Referenced by get_value(), get_value_no_scale(), and has_changed().

const string & Namable::get_name  )  const [inline, inherited]
 

Definition at line 109 of file namable.I.

Referenced by ComputedVerticesMaker::add_normal(), GLGraphicsStateGuardian::begin_bind_clip_planes(), GLGraphicsStateGuardian::begin_bind_lights(), BuilderBucket::BuilderBucket(), EggVertex::clear_grefs(), AnimBundleMaker::create_xfm_channel(), SceneGraphReducer::do_flatten_siblings(), BuilderBucket::done_geom(), DXTextureContext8::DXTextureContext8(), PartGroup::find_child(), EggLoader::find_collision_geometry(), EggGroupUniquifier::get_category(), PartBundle::get_control_effect(), PartGroup::get_num_children(), EggMorph< Parameter >::get_offset(), AnimChannelBase::has_changed(), Namable::has_name(), EggMaterial::is_equivalent_to(), Texture::load(), EggLoader::make_node(), AnimBundleMaker::make_node(), FindApproxPath::Component::matches(), LineSegs::move_to(), MovingPartBase::MovingPartBase(), NodeMap::NodeMap(), EggMorph< Parameter >::operator<(), operator<<(), MouseWatcherRegion::output(), AnimGroup::output(), EggXfmSAnim::r_transform(), Texture::read(), MouseWatcherGroup::remove_region(), EggLoader::reparent_decals(), CRGraphicsStateGuardian::set_blend_mode(), NodePath::set_color(), GLGraphicsStateGuardian::set_draw_buffer(), AnimChannelScalarTable::set_table(), NodePath::set_transparency(), NodePathComponent::uncollapse(), Texture::unprepare(), TextNode::wordwrap_to(), MovingPartBase::write(), CollisionNode::xform(), and EggVertex::~EggVertex().

int AnimGroup::get_num_children  )  const [inherited]
 

Returns the number of child nodes of the group.

Definition at line 69 of file animGroup.cxx.

References AnimGroup::_children, nassertr, and NULL.

Referenced by PartGroup::sort_descendants().

int ReferenceCount::get_ref_count  )  const [inline, inherited]
 

Returns the current reference count.

Definition at line 183 of file referenceCount.I.

Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture().

void AnimChannelMatrixXfmTable::get_scale int  frame,
float  scale[3]
[virtual]
 

Gets the scale value at the indicated frame.

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 154 of file animChannelMatrixXfmTable.cxx.

References AnimGroup::_root, AnimBundle::get_num_frames(), get_table_index(), num_frames, and ConstPointerToArray< float >::size().

CPTA_float 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 68 of file animChannelMatrixXfmTable.I.

References _tables, and NULL.

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', 'h', 'p', 'r', 'x', 'y', or 'z'.

Definition at line 106 of file animChannelMatrixXfmTable.I.

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

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

Returns -1 if the table id is invalid.

Definition at line 265 of file animChannelMatrixXfmTable.cxx.

Referenced by get_scale(), has_table(), and is_valid_id().

virtual TypeHandle AnimChannelMatrixXfmTable::get_type void   )  const [inline, virtual]
 

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 90 of file animChannelMatrixXfmTable.h.

int TypedObject::get_type_index  )  const [inline, inherited]
 

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

Definition at line 71 of file typedObject.I.

References TypeHandle::get_name(), TypedObject::get_type(), and INLINE.

virtual void AnimChannel< ACMatrixSwitchType >::get_value int  frame,
ValueType value
[pure virtual, inherited]
 

void AnimChannelMatrixXfmTable::get_value int  frame,
LMatrix4f &  mat
[virtual]
 

Gets the value of the channel at the indicated frame.

Definition at line 103 of file animChannelMatrixXfmTable.cxx.

References _tables, compose_matrix(), ConstPointerToArray< float >::empty(), get_default_value(), num_tables, and ConstPointerToArray< float >::size().

virtual void AnimChannel< ACMatrixSwitchType >::get_value_no_scale int  frame,
ValueType value
[virtual, inherited]
 

Returns the value associated with the current frame, with no scale components.

This only makes sense for a matrix-type channel, although for fiddly technical reasons the function exists for all channels.

void AnimChannelMatrixXfmTable::get_value_no_scale int  frame,
LMatrix4f &  value
[virtual]
 

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

Definition at line 128 of file animChannelMatrixXfmTable.cxx.

References _tables, ConstPointerToArray< float >::empty(), get_default_value(), and ConstPointerToArray< float >::size().

virtual TypeHandle AnimChannel< ACMatrixSwitchType >::get_value_type  )  const [virtual, inherited]
 

Returns the TypeHandle associated with the ValueType we return.

This is provided to allow a bit of run-time checking that joints and channels are matching properly in type.

Implements AnimChannelBase.

bool AnimChannelMatrixXfmTable::has_changed int  last_frame,
int  this_frame
[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 81 of file animChannelMatrixXfmTable.cxx.

References _tables, compose_matrix(), ConstPointerToArray< float >::empty(), get_default_value(), num_tables, and ConstPointerToArray< float >::size().

bool Namable::has_name  )  const [inline, inherited]
 

Returns true if the Namable has a nonempty name set, false if the name is empty.

Definition at line 97 of file namable.I.

References Namable::get_name(), and INLINE.

Referenced by EggGroupUniquifier::EggGroupUniquifier(), Texture::read(), and Texture::Texture().

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 _tables, CPTA_float, get_table_index(), and INLINE.

void AnimChannelMatrixXfmTable::init_type void   )  [inline, static]
 

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 97 of file animChannelMatrixXfmTable.h.

bool TypedObject::is_exact_type TypeHandle  handle  )  const [inline, inherited]
 

Returns true if the current object is the indicated type exactly.

Definition at line 101 of file typedObject.I.

Referenced by PT(), and CollisionNode::xform().

bool TypedObject::is_of_type TypeHandle  handle  )  const [inline, inherited]
 

Returns true if the current object is or derives from the indicated type.

Definition at line 86 of file typedObject.I.

Referenced by EggMaterialCollection::collapse_equivalent_materials(), EggTextureCollection::collapse_equivalent_textures(), DeferredNodeProperty::compose(), AnimBundleMaker::create_s_channel(), CharacterMaker::create_slider(), ProjectionScreen::cull_callback(), DataNode::define_output(), EggNode::determine_draw_order(), CharacterMaker::egg_to_index(), EggGroupUniquifier::EggGroupUniquifier(), EggPoolUniquifier::EggPoolUniquifier(), EggGroupNode::find_textures(), StaticTextFont::get_glyph(), EggMaterialCollection::insert_materials(), EggTextureCollection::insert_textures(), CharacterJoint::make_copy(), PT(), EggGroupNode::r_flatten_transforms(), EggGroupNode::r_transform_vertices(), EggGroupNode::recompute_polygon_normals(), CollisionLevelState::reserve(), PandaFramework::reset_frame_rate(), PandaFramework::set_texture(), EggGroupNode::steal_children(), and DataGraphTraverser::traverse().

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 34 of file animChannelMatrixXfmTable.I.

References _tables, get_table_index(), INLINE, and NULL.

Referenced by AnimBundleMaker::create_xfm_channel().

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

Factory method to generate a AnimChannelMatrixXfmTable object.

Definition at line 426 of file animChannelMatrixXfmTable.cxx.

TypedWritable * AnimGroup::make_AnimGroup const FactoryParams params  )  [static, inherited]
 

Factory method to generate a AnimGroup object.

Definition at line 309 of file animGroup.cxx.

void AnimChannelBase::output ostream &  out  )  const [virtual, inherited]
 

Writes a one-line description of the channel.

Reimplemented from AnimGroup.

Reimplemented in AnimChannelFixed< SwitchType >.

Definition at line 60 of file animChannelBase.cxx.

References AnimChannelBase::_last_frame, Datagram::add_uint16(), and AnimGroup::write_datagram().

int ReferenceCount::ref  )  const [inline, inherited]
 

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is the new reference count.

Definition at line 225 of file referenceCount.I.

Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering().

void AnimChannelMatrixXfmTable::register_with_read_factory void   )  [static]
 

Factory method to generate a AnimChannelMatrixXfmTable object.

Reimplemented from AnimGroup.

Definition at line 446 of file animChannelMatrixXfmTable.cxx.

void Namable::set_name const string &  name  )  [inline, inherited]
 

Definition at line 69 of file namable.I.

References Namable::_name.

Referenced by BuilderBucket::BuilderBucket(), SceneGraphReducer::do_flatten_siblings(), Texture::read(), PandaNode::reparent(), and Texture::Texture().

void AnimChannelMatrixXfmTable::set_table char  table_id,
const CPTA_float table
 

Assigns the indicated table.

table_id is one of 'i', 'j', 'k', for scale, '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 197 of file animChannelMatrixXfmTable.cxx.

void AnimGroup::sort_descendants  )  [inherited]
 

Sorts the children nodes at each level of the hierarchy into alphabetical order.

This should be done after creating the hierarchy, to guarantee that the correct names will match up together when the AnimBundle is later bound to a PlayerRoot.

Definition at line 160 of file animGroup.cxx.

void ReferenceCount::test_ref_count_integrity  )  const [inline, inherited]
 

Does some easy checks to make sure that the reference count isn't completely bogus.

Definition at line 328 of file referenceCount.I.

References INLINE.

Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount().

int ReferenceCount::unref  )  const [inline, inherited]
 

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is the new reference count.

Definition at line 293 of file referenceCount.I.

References INLINE.

Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds().

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 225 of file animChannelMatrixXfmTable.cxx.

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

Function to write the important information in the particular object to a Datagram.

Reimplemented from AnimChannelBase.

Definition at line 286 of file animChannelMatrixXfmTable.cxx.

References FFTCompressor::write_reals().

void AnimGroup::write_descendants ostream &  out,
int  indent_level
const [protected, inherited]
 

Writes a brief description of all of the group's descendants.

Definition at line 211 of file animGroup.cxx.

References BamReader::read_pointer().

Referenced by AnimChannelScalarTable::set_table().


Member Data Documentation

Children AnimGroup::_children [protected, inherited]
 

Definition at line 79 of file animGroup.h.

Referenced by AnimGroup::AnimGroup(), AnimGroup::get_child(), AnimGroup::get_num_children(), AnimGroup::get_value_type(), AnimGroup::output(), and AnimChannelScalarTable::set_table().

const float AnimChannelMatrixXfmTable::_default_values [static, private]
 

Initial value:

{ 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }

Definition at line 42 of file animChannelMatrixXfmTable.cxx.

int AnimChannelBase::_last_frame [protected, inherited]
 

Definition at line 65 of file animChannelBase.h.

Referenced by AnimChannelBase::AnimChannelBase(), AnimChannelBase::output(), and AnimChannelBase::write_datagram().

AnimBundle* AnimGroup::_root [protected, inherited]
 

Definition at line 80 of file animGroup.h.

Referenced by get_scale(), and AnimChannelScalarTable::get_value().

const char AnimChannelMatrixXfmTable::_table_ids [static, private]
 

Initial value:

{ 'i', 'j', 'k', 'h', 'p', 'r', 'x', 'y', 'z' }

Definition at line 38 of file animChannelMatrixXfmTable.cxx.

CPTA_float AnimChannelMatrixXfmTable::_tables[num_tables] [protected]
 

Definition at line 74 of file animChannelMatrixXfmTable.h.

Referenced by fillin(), get_table(), get_value(), get_value_no_scale(), has_changed(), has_table(), and is_valid_id().

TypeHandle AnimChannelMatrixXfmTable::_type_handle [static, private]
 

Reimplemented from AnimChannel< ACMatrixSwitchType >.

Definition at line 35 of file animChannelMatrixXfmTable.cxx.

TypedWritable *const TypedWritable::Null = (TypedWritable*)0L [static, inherited]
 

Definition at line 25 of file typedWritable.cxx.

Referenced by Child::complete_pointers(), Parent::complete_pointers(), Person::complete_pointers(), LoaderFileTypeBam::get_extension(), PartGroup::pick_channel_index(), BamReader::read_pointer(), and AnimGroup::write_datagram().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:47:24 2003 for Panda by doxygen1.3