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

TransformState Class Reference

Indicates a coordinate-system transform on vertices. More...

#include <transformState.h>

Inheritance diagram for TransformState:

TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject List of all members.

Public Member Functions

virtual ~TransformState ()
 The destructor is responsible for removing the TransformState from the global set if it is there.

bool operator< (const TransformState &other) const
 Provides an arbitrary ordering among all unique TransformStates, so we can store the essentially different ones in a big set and throw away the rest.

bool is_identity () const
 Returns true if the transform represents the identity matrix, false otherwise.

bool is_invalid () const
 Returns true if the transform represents an invalid matrix, for instance the result of inverting a singular matrix, or false if the transform is valid.

bool is_singular () const
 Returns true if the transform represents a singular transform (that is, it has a zero scale, and it cannot be inverted), or false otherwise.

bool has_components () const
 Returns true if the transform can be described by separate pos, hpr, and scale components.

bool components_given () const
 Returns true if the transform was specified componentwise, or false if it was specified with a general 4x4 matrix.

bool hpr_given () const
 Returns true if the rotation was specified via a trio of Euler angles, false otherwise.

bool quat_given () const
 Returns true if the rotation was specified via a quaternion, false otherwise.

bool has_pos () const
 Returns true if the transform's pos component can be extracted out separately.

bool has_hpr () const
 Returns true if the transform's rotation component can be extracted out separately and described as a set of Euler angles.

bool has_quat () const
 Returns true if the transform's rotation component can be extracted out separately and described as a quaternion.

bool has_scale () const
 Returns true if the transform's scale component can be extracted out separately.

bool has_uniform_scale () const
 Returns true if the scale is uniform across all three axes (and therefore can be expressed as a single number), or false if the transform has a different scale in different dimensions.

bool has_mat () const
 Returns true if the transform can be described as a matrix.

const LVecBase3f & get_pos () const
 Returns the pos component of the transform.

const LVecBase3f & get_hpr () const
 Returns the rotation component of the transform as a trio of Euler angles.

const LQuaternionf & get_quat () const
 Returns the rotation component of the transform as a quaternion.

const LVecBase3f & get_scale () const
 Returns the scale component of the transform.

float get_uniform_scale () const
 Returns the scale component of the transform, as a single number.

const LMatrix4f & get_mat () const
 Returns the matrix that describes the transform.

ConstPointerTo< TransformState > set_pos (const LVecBase3f &pos) const
 Returns a new TransformState object that represents the original TransformState with its pos component replaced with the indicated value.

ConstPointerTo< TransformState > set_hpr (const LVecBase3f &hpr) const
 Returns a new TransformState object that represents the original TransformState with its rotation component replaced with the indicated value, if possible.

ConstPointerTo< TransformState > set_quat (const LQuaternionf &quat) const
 Returns a new TransformState object that represents the original TransformState with its rotation component replaced with the indicated value, if possible.

ConstPointerTo< TransformState > set_scale (const LVecBase3f &scale) const
 Returns a new TransformState object that represents the original TransformState with its scale component replaced with the indicated value, if possible.

ConstPointerTo< TransformState > compose (const TransformState *other) const
 Returns a new TransformState object that represents the composition of this state with the other state.

ConstPointerTo< TransformState > invert_compose (const TransformState *other) const
 Returns a new TransformState object that represents the composition of this state's inverse with the other state.

void output (ostream &out) const
void write (ostream &out, int indent_level) const
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file.

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.

virtual TypeHandle get_type () const
virtual TypeHandle force_init_type ()
virtual int complete_pointers (TypedWritable **p_list, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

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.


Static Public Member Functions

ConstPointerTo< TransformState > make_identity ()
 Constructs an identity transform.

ConstPointerTo< TransformState > make_invalid ()
 Constructs an invalid transform; for instance, the result of inverting a singular matrix.

ConstPointerTo< TransformState > make_pos (const LVecBase3f &pos)
ConstPointerTo< TransformState > make_hpr (const LVecBase3f &hpr)
ConstPointerTo< TransformState > make_quat (const LQuaternionf &quat)
ConstPointerTo< TransformState > make_pos_hpr (const LVecBase3f &pos, const LVecBase3f &hpr)
ConstPointerTo< TransformState > make_scale (float scale)
ConstPointerTo< TransformState > make_scale (const LVecBase3f &scale)
ConstPointerTo< TransformState > make_pos_hpr_scale (const LVecBase3f &pos, const LVecBase3f &hpr, const LVecBase3f &scale)
 Makes a new TransformState with the specified components.

ConstPointerTo< TransformState > make_pos_quat_scale (const LVecBase3f &pos, const LQuaternionf &quat, const LVecBase3f &scale)
 Makes a new TransformState with the specified components.

ConstPointerTo< TransformState > make_mat (const LMatrix4f &mat)
 Makes a new TransformState with the specified transformation matrix.

int get_num_states ()
 Returns the total number of unique TransformState objects allocated in the world.

int get_num_unused_states ()
 Returns the total number of TransformState objects that have been allocated but have no references outside of the internal TransformState map.

int clear_cache ()
 Empties the cache of composed TransformStates.

void register_with_read_factory ()
 Tells the BamReader how to create objects of type TransformState.

TypedWritablechange_this (TypedWritable *old_ptr, BamReader *manager)
 Called immediately after complete_pointers(), this gives the object a chance to adjust its own pointer if desired.

TypeHandle get_class_type ()
void init_type ()

Static Public Attributes

TypedWritable *const Null = (TypedWritable*)0L

Protected Member Functions

 TransformState ()
 Actually, this could be a private constructor, since no one inherits from TransformState, but gcc gives us a spurious warning if all constructors are private.

void fillin (DatagramIterator &scan, BamReader *manager)
 This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new TransformState.


Static Protected Member Functions

TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type TransformState is encountered in the Bam file.


Private Types

typedef pset< const TransformState *,
IndirectLess< TransformState > > 
States
typedef pmap< const TransformState *,
Composition
CompositionCache
enum  Flags {
  F_is_identity = 0x0001, F_is_singular = 0x0002, F_singular_known = 0x0004, F_components_given = 0x0008,
  F_components_known = 0x0010, F_has_components = 0x0020, F_mat_known = 0x0040, F_is_invalid = 0x0080,
  F_quat_given = 0x0100, F_quat_known = 0x0200, F_hpr_given = 0x0400, F_hpr_known = 0x0800,
  F_uniform_scale = 0x1000, F_is_destructing = 0x8000
}

Private Member Functions

 TransformState (const TransformState &copy)
 TransformStates are not meant to be copied.

void operator= (const TransformState &copy)
 TransformStates are not meant to be copied.

ConstPointerTo< TransformState > do_compose (const TransformState *other) const
 The private implemention of compose(); this actually composes two TransformStates, without bothering with the cache.

ConstPointerTo< TransformState > do_invert_compose (const TransformState *other) const
 The private implemention of invert_compose().

void check_singular () const
 Ensures that we know whether the matrix is singular.

void check_components () const
 Ensures that we know the components of the transform (or that we know they cannot be derived).

void check_hpr () const
 Ensures that we know the hpr of the transform (or that we know they cannot be derived).

void check_quat () const
 Ensures that we know the quat of the transform (or that we know they cannot be derived).

void check_mat () const
 Ensures that we know the overall matrix.

void calc_singular ()
 Determines whether the transform is singular (i.e.

void calc_components ()
 Derives the components from the matrix, if possible.

void calc_hpr ()
 Derives the hpr, from the matrix if necessary, or from the quat.

void calc_quat ()
 Derives the quat from the hpr.

void calc_mat ()
 Computes the matrix from the components.

void check_uniform_scale ()
 Should be called immediately after _scale (and F_has_components) is set, this checks for a uniform scale and sets the bit appropriately.

void set_destructing ()
 This function should only be called from the destructor; it indicates that this TransformState object is beginning destruction.

bool is_destructing () const
 Returns true if the TransformState object is currently within its destructor (i.e.


Static Private Member Functions

ConstPointerTo< TransformState > return_new (TransformState *state)
 This function is used to share a common TransformState pointer for all equivalent TransformState objects.


Private Attributes

States::iterator _saved_entry
CompositionCache _composition_cache
CompositionCache _invert_composition_cache
const TransformState * _self_compose
LVecBase3f _pos
LVecBase3f _hpr
LVecBase3f _scale
LQuaternionf _quat
LMatrix4f _mat
LMatrix4f * _inv_mat
unsigned short _flags

Static Private Attributes

States_states = NULL
ConstPointerTo< TransformState > _identity_state
TypeHandle _type_handle

Detailed Description

Indicates a coordinate-system transform on vertices.

TransformStates are the primary means for storing transformations on the scene graph.

Transforms may be specified in one of two ways: componentwise, with a pos-hpr-scale, or with an arbitrary transform matrix. If you specify a transform componentwise, it will remember its original components.

TransformState objects are managed very much like RenderState objects. They are immutable and reference-counted automatically.

You should not attempt to create or modify a TransformState object directly. Instead, call one of the make() functions to create one for you. And instead of modifying a TransformState object, create a new one.

Definition at line 80 of file transformState.h.


Member Typedef Documentation

typedef pmap<const TransformState *, Composition> TransformState::CompositionCache [private]
 

Definition at line 174 of file transformState.h.

typedef pset<const TransformState *, IndirectLess<TransformState> > TransformState::States [private]
 

Definition at line 152 of file transformState.h.


Member Enumeration Documentation

enum TransformState::Flags [private]
 

Enumeration values:
F_is_identity 
F_is_singular 
F_singular_known 
F_components_given 
F_components_known 
F_has_components 
F_mat_known 
F_is_invalid 
F_quat_given 
F_quat_known 
F_hpr_given 
F_hpr_known 
F_uniform_scale 
F_is_destructing 

Definition at line 201 of file transformState.h.


Constructor & Destructor Documentation

TransformState::TransformState  )  [protected]
 

Actually, this could be a private constructor, since no one inherits from TransformState, but gcc gives us a spurious warning if all constructors are private.

Definition at line 48 of file transformState.cxx.

TransformState::TransformState const TransformState &  copy  )  [private]
 

TransformStates are not meant to be copied.

Definition at line 72 of file transformState.cxx.

TransformState::~TransformState  )  [virtual]
 

The destructor is responsible for removing the TransformState from the global set if it is there.

Definition at line 100 of file transformState.cxx.

References _composition_cache, and nassertv.


Member Function Documentation

void TransformState::calc_components  )  [private]
 

Derives the components from the matrix, if possible.

Definition at line 1189 of file transformState.cxx.

References CPT, DCAST, BamReader::register_finalize(), and return_new().

void TransformState::calc_hpr  )  [private]
 

Derives the hpr, from the matrix if necessary, or from the quat.

Definition at line 1233 of file transformState.cxx.

void TransformState::calc_mat  )  [private]
 

Computes the matrix from the components.

Definition at line 1275 of file transformState.cxx.

References _flags, _pos, _quat, and F_quat_given.

void TransformState::calc_quat  )  [private]
 

Derives the quat from the hpr.

Definition at line 1254 of file transformState.cxx.

void TransformState::calc_singular  )  [private]
 

Determines whether the transform is singular (i.e.

it scales to zero, and has no inverse).

Definition at line 1159 of file transformState.cxx.

TypedWritable * TransformState::change_this TypedWritable old_ptr,
BamReader manager
[static]
 

Called immediately after complete_pointers(), this gives the object a chance to adjust its own pointer if desired.

Most objects don't change pointers after completion, but some need to.

Once this function has been called, the old pointer will no longer be accessed.

Definition at line 1377 of file transformState.cxx.

void TransformState::check_components  )  const [inline, private]
 

Ensures that we know the components of the transform (or that we know they cannot be derived).

Definition at line 559 of file transformState.I.

Referenced by do_invert_compose(), has_hpr(), has_quat(), is_identity(), and quat_given().

void TransformState::check_hpr  )  const [inline, private]
 

Ensures that we know the hpr of the transform (or that we know they cannot be derived).

Definition at line 578 of file transformState.I.

void TransformState::check_mat  )  const [inline, private]
 

Ensures that we know the overall matrix.

Definition at line 614 of file transformState.I.

void TransformState::check_quat  )  const [inline, private]
 

Ensures that we know the quat of the transform (or that we know they cannot be derived).

Definition at line 597 of file transformState.I.

void TransformState::check_singular  )  const [inline, private]
 

Ensures that we know whether the matrix is singular.

Definition at line 540 of file transformState.I.

void TransformState::check_uniform_scale  )  [inline, private]
 

Should be called immediately after _scale (and F_has_components) is set, this checks for a uniform scale and sets the bit appropriately.

Definition at line 635 of file transformState.I.

Referenced by make_identity().

int TransformState::clear_cache  )  [static]
 

Empties the cache of composed TransformStates.

This makes every TransformState forget what results when it is composed with other TransformStates.

This will eliminate any TransformState objects that have been allocated but have no references outside of the internal TransformState map. It will not eliminate TransformState objects that are still in use.

Normally, TransformState objects will remove themselves from the interal map when their reference counts go to 0, but since circular references are possible there may be some cycles that cannot remove themselves. Calling this function from time to time will ensure there is no wasteful memory leakage, but calling it too often may result in decreased performance as the cache is forced to be recomputed.

The return value is the number of TransformStates freed by this operation.

Definition at line 913 of file transformState.cxx.

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

Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

Returns the number of pointers processed.

This is the callback function that is made by the BamReader at some later point, after all of the required pointers have been filled in. It is necessary because there might be forward references in a bam file; when we call read_pointer() in fillin(), the object may not have been read from the file yet, so we do not have a pointer available at that time. Thus, instead of returning a pointer, read_pointer() simply reserves a later callback. This function provides that callback. The calling object is responsible for keeping track of the number of times it called read_pointer() and extracting the same number of pointers out of the supplied vector, and storing them appropriately within the object.

Reimplemented in AnimBundleNode, AnimGroup, PartBundleNode, PartGroup, Character, CharacterJoint, CollisionNode, GeomSprite, PiecewiseCurve, ClipPlaneAttrib, FogAttrib, LensNode, LightAttrib, MaterialAttrib, RenderEffects, RenderState, TextureAttrib, Person, and Child.

Definition at line 94 of file typedWritable.cxx.

Referenced by RenderState::do_invert_compose().

bool TransformState::components_given  )  const [inline]
 

Returns true if the transform was specified componentwise, or false if it was specified with a general 4x4 matrix.

If this is true, the components returned by get_pos() and get_scale() will be exactly those that were set; otherwise, these functions will return computed values. If this is true, the rotation may have been set either with a hpr trio or with a quaternion; hpr_given() or quat_given() can resolve the difference.

Definition at line 267 of file transformState.I.

References has_components(), and INLINE.

Referenced by make_pos_quat_scale().

ConstPointerTo< TransformState > TransformState::compose const TransformState *  other  )  const
 

Returns a new TransformState object that represents the composition of this state with the other state.

The result of this operation is cached, and will be retained as long as both this TransformState object and the other TransformState object continue to exist. Should one of them destruct, the cached entry will be removed, and its pointer will be allowed to destruct as well.

Definition at line 529 of file transformState.cxx.

References _invert_composition_cache, TransformState::Composition::_result, CPT, do_invert_compose(), is_identity(), is_invalid(), make_identity(), and NULL.

Referenced by PandaNode::preserve_name().

ConstPointerTo< TransformState > TransformState::do_compose const TransformState *  other  )  const [private]
 

The private implemention of compose(); this actually composes two TransformStates, without bothering with the cache.

Definition at line 1016 of file transformState.cxx.

References _flags, _inv_mat, F_is_singular, and NULL.

ConstPointerTo< TransformState > TransformState::do_invert_compose const TransformState *  other  )  const [private]
 

The private implemention of invert_compose().

Definition at line 1072 of file transformState.cxx.

References _flags, _hpr, _quat, check_components(), F_hpr_known, F_is_invalid, F_quat_known, and nassertv.

Referenced by compose().

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

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new TransformState.

Reimplemented from TypedWritable.

Definition at line 1462 of file transformState.cxx.

void TransformState::finalize void   )  [virtual]
 

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 from TypedWritable.

Definition at line 1410 of file transformState.cxx.

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

Reimplemented from TypedWritableReferenceCount.

Definition at line 246 of file transformState.h.

References EventStoreValueBase::get_class_type().

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

Reimplemented from TypedWritableReferenceCount.

Definition at line 235 of file transformState.h.

const LVecBase3f & TransformState::get_hpr  )  const [inline]
 

Returns the rotation component of the transform as a trio of Euler angles.

It is an error to call this if has_components() returned false.

Definition at line 450 of file transformState.I.

References _flags, and F_mat_known.

Referenced by make_pos_quat_scale(), set_pos(), and NodePath::set_z().

const LMatrix4f & TransformState::get_mat  )  const [inline]
 

Returns the matrix that describes the transform.

Definition at line 525 of file transformState.I.

References INLINE.

Referenced by make_pos_quat_scale().

int TransformState::get_num_states  )  [static]
 

Returns the total number of unique TransformState objects allocated in the world.

This will go up and down during normal operations.

Definition at line 766 of file transformState.cxx.

int TransformState::get_num_unused_states  )  [static]
 

Returns the total number of TransformState objects that have been allocated but have no references outside of the internal TransformState map.

Definition at line 786 of file transformState.cxx.

References _composition_cache, _invert_composition_cache, _self_compose, _states, NULL, and unref_delete().

const LVecBase3f & TransformState::get_pos  )  const [inline]
 

Returns the pos component of the transform.

It is an error to call this if has_pos() returned false.

Definition at line 431 of file transformState.I.

References _flags, F_quat_known, and INLINE.

Referenced by NodePath::get_state(), make_mat(), set_pos(), NodePath::set_pos_hpr_scale(), and NodePath::set_z().

const LQuaternionf & TransformState::get_quat  )  const [inline]
 

Returns the rotation component of the transform as a quaternion.

It is an error to call this if has_components() returned false.

Definition at line 470 of file transformState.I.

References _flags, F_is_destructing, and INLINE.

Referenced by make_pos_quat_scale(), and set_pos().

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

const LVecBase3f & TransformState::get_scale  )  const [inline]
 

Returns the scale component of the transform.

It is an error to call this if has_components() returned false.

Definition at line 490 of file transformState.I.

References _flags, F_is_destructing, and INLINE.

Referenced by make_mat(), and make_pos_quat_scale().

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

Reimplemented from TypedWritableReferenceCount.

Definition at line 243 of file transformState.h.

References INLINE.

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.

float TransformState::get_uniform_scale  )  const [inline]
 

Returns the scale component of the transform, as a single number.

It is an error to call this if has_uniform_scale() returned false.

Definition at line 510 of file transformState.I.

References INLINE.

bool TransformState::has_components  )  const [inline]
 

Returns true if the transform can be described by separate pos, hpr, and scale components.

Most transforms we use in everyday life can be so described, but some kinds of transforms (for instance, those involving a skew) cannot.

This is not related to whether the transform was originally described componentwise. Even a transform that was constructed with a 4x4 may return true here if the matrix is a simple affine matrix with no skew.

If this returns true, you may safely call get_hpr() and get_scale() to retrieve the components. (You may always safely call get_pos() whether this returns true or false.)

Definition at line 237 of file transformState.I.

References INLINE.

Referenced by components_given(), and NodePath::set_z().

bool TransformState::has_hpr  )  const [inline]
 

Returns true if the transform's rotation component can be extracted out separately and described as a set of Euler angles.

This is generally true only when has_components() is true.

Definition at line 343 of file transformState.I.

References _scale, check_components(), INLINE, is_invalid(), and nassertr.

bool TransformState::has_mat  )  const [inline]
 

Returns true if the transform can be described as a matrix.

This is generally always true, unless is_invalid() is true.

Definition at line 416 of file transformState.I.

References _flags, F_hpr_known, and INLINE.

bool TransformState::has_pos  )  const [inline]
 

Returns true if the transform's pos component can be extracted out separately.

This is generally always true, unless the transform is invalid (i.e. is_invalid() returns true).

Definition at line 324 of file transformState.I.

References _hpr.

Referenced by quat_given().

bool TransformState::has_quat  )  const [inline]
 

Returns true if the transform's rotation component can be extracted out separately and described as a quaternion.

This is generally true only when has_components() is true.

Definition at line 362 of file transformState.I.

References _scale, check_components(), has_uniform_scale(), INLINE, and nassertr.

bool TransformState::has_scale  )  const [inline]
 

Returns true if the transform's scale component can be extracted out separately.

This is generally true only when has_components() is true.

Definition at line 379 of file transformState.I.

References _mat.

bool TransformState::has_uniform_scale  )  const [inline]
 

Returns true if the scale is uniform across all three axes (and therefore can be expressed as a single number), or false if the transform has a different scale in different dimensions.

Definition at line 398 of file transformState.I.

References _flags, F_components_known, and INLINE.

Referenced by has_quat().

bool TransformState::hpr_given  )  const [inline]
 

Returns true if the rotation was specified via a trio of Euler angles, false otherwise.

If this is true, get_hpr() will be exactly as set; otherwise, it will return a computed value.

Definition at line 286 of file transformState.I.

References INLINE, and is_invalid().

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

Reimplemented from TypedWritableReferenceCount.

Definition at line 238 of file transformState.h.

References EXPCL_PANDA, and INLINE.

ConstPointerTo< TransformState > TransformState::invert_compose const TransformState *  other  )  const
 

Returns a new TransformState object that represents the composition of this state's inverse with the other state.

This is similar to compose(), but is particularly useful for computing the relative state of a node as viewed from some other node.

Definition at line 622 of file transformState.cxx.

Referenced by Fog::output(), and LODNode::xform().

bool TransformState::is_destructing  )  const [inline, private]
 

Returns true if the TransformState object is currently within its destructor (i.e.

set_destructing() has been called). This is only used as a sanity check, and is only meaningful when NDEBUG is not defined.

Definition at line 682 of file transformState.I.

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 TransformState::is_identity  )  const [inline]
 

Returns true if the transform represents the identity matrix, false otherwise.

Definition at line 161 of file transformState.I.

References _flags, check_components(), F_has_components, and INLINE.

Referenced by compose(), make_pos_quat_scale(), and NodePath::set_transform().

bool TransformState::is_invalid  )  const [inline]
 

Returns true if the transform represents an invalid matrix, for instance the result of inverting a singular matrix, or false if the transform is valid.

Definition at line 178 of file transformState.I.

References _flags, F_components_given, and INLINE.

Referenced by compose(), has_hpr(), hpr_given(), make_mat(), make_pos_quat_scale(), set_pos(), and CullTraverserData::~CullTraverserData().

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 TransformState::is_singular  )  const [inline]
 

Returns true if the transform represents a singular transform (that is, it has a zero scale, and it cannot be inverted), or false otherwise.

Definition at line 195 of file transformState.I.

References _flags, F_hpr_given, and INLINE.

TypedWritable * TransformState::make_from_bam const FactoryParams params  )  [static, protected]
 

This function is called by the BamReader's factory when a new object of type TransformState is encountered in the Bam file.

It should create the TransformState and extract its information from the file.

Definition at line 1437 of file transformState.cxx.

ConstPointerTo< TransformState > TransformState::make_hpr const LVecBase3f &  hpr  )  [inline, static]
 

ConstPointerTo< TransformState > TransformState::make_identity  )  [static]
 

Constructs an identity transform.

Definition at line 302 of file transformState.cxx.

References _flags, _hpr, _pos, _scale, check_uniform_scale(), F_components_given, F_components_known, F_has_components, F_hpr_given, F_hpr_known, and return_new().

Referenced by NodePath::clear_depth_test(), compose(), NodePath::do_billboard_point_world(), make_invalid(), PandaNode::set_effect(), and GraphicsStateGuardian::~GraphicsStateGuardian().

ConstPointerTo< TransformState > TransformState::make_invalid  )  [static]
 

Constructs an invalid transform; for instance, the result of inverting a singular matrix.

Definition at line 324 of file transformState.cxx.

References _flags, _pos, _quat, _scale, F_components_given, F_components_known, F_has_components, F_quat_given, F_quat_known, and make_identity().

ConstPointerTo< TransformState > TransformState::make_mat const LMatrix4f &  mat  )  [static]
 

Makes a new TransformState with the specified transformation matrix.

Definition at line 399 of file transformState.cxx.

References get_pos(), get_scale(), is_invalid(), make_pos_hpr_scale(), and nassertr.

Referenced by Trackball::apply(), ChanConfig::chan_eval(), NodePath::get_hpr(), CharacterJoint::make_copy(), make_pos_quat_scale(), move_gridded_stuff(), and TrackerNode::~TrackerNode().

ConstPointerTo< TransformState > TransformState::make_pos const LVecBase3f &  pos  )  [inline, static]
 

Referenced by CollisionNode::combine_with(), and MouseWatcher::global_keyboard_press().

ConstPointerTo< TransformState > TransformState::make_pos_hpr const LVecBase3f &  pos,
const LVecBase3f &  hpr
[inline, static]
 

Referenced by DriveInterface::set_mat().

ConstPointerTo< TransformState > TransformState::make_pos_hpr_scale const LVecBase3f &  pos,
const LVecBase3f &  hpr,
const LVecBase3f &  scale
[static]
 

Makes a new TransformState with the specified components.

Definition at line 341 of file transformState.cxx.

Referenced by TransformState::Composition::Composition(), NodePath::get_pos(), make_mat(), make_pos_quat_scale(), NodePath::set_h(), NodePath::set_hpr(), NodePath::set_p(), set_pos(), and NodePath::set_z().

ConstPointerTo< TransformState > TransformState::make_pos_quat_scale const LVecBase3f &  pos,
const LQuaternionf &  quat,
const LVecBase3f &  scale
[static]
 

Makes a new TransformState with the specified components.

Definition at line 370 of file transformState.cxx.

References components_given(), get_hpr(), get_mat(), get_quat(), get_scale(), is_identity(), is_invalid(), make_mat(), make_pos_hpr_scale(), nassertr, and quat_given().

Referenced by set_pos(), and NodePath::set_r().

ConstPointerTo< TransformState > TransformState::make_quat const LQuaternionf &  quat  )  [inline, static]
 

ConstPointerTo< TransformState > TransformState::make_scale const LVecBase3f &  scale  )  [inline, static]
 

ConstPointerTo< TransformState > TransformState::make_scale float  scale  )  [inline, static]
 

bool TransformState::operator< const TransformState &  other  )  const
 

Provides an arbitrary ordering among all unique TransformStates, so we can store the essentially different ones in a big set and throw away the rest.

This method is not needed outside of the TransformState class because all equivalent TransformState objects are guaranteed to share the same pointer; thus, a pointer comparison is always sufficient.

Definition at line 236 of file transformState.cxx.

void TransformState::operator= const TransformState &  copy  )  [private]
 

TransformStates are not meant to be copied.

Definition at line 85 of file transformState.cxx.

References _inv_mat, and NULL.

void TransformState::output ostream &  out  )  const
 

Definition at line 685 of file transformState.cxx.

bool TransformState::quat_given  )  const [inline]
 

Returns true if the rotation was specified via a quaternion, false otherwise.

If this is true, get_quat() will be exactly as set; otherwise, it will return a computed value.

Definition at line 305 of file transformState.I.

References _pos, check_components(), has_pos(), INLINE, and nassertr.

Referenced by make_pos_quat_scale(), and set_pos().

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 TransformState::register_with_read_factory void   )  [static]
 

Tells the BamReader how to create objects of type TransformState.

Definition at line 1300 of file transformState.cxx.

ConstPointerTo< TransformState > TransformState::return_new TransformState *  state  )  [static, private]
 

This function is used to share a common TransformState pointer for all equivalent TransformState objects.

See the similar logic in RenderState. The idea is to create a new TransformState object and pass it through this function, which will share the pointer with a previously-created TransformState object if it is equivalent.

Definition at line 979 of file transformState.cxx.

Referenced by calc_components(), and make_identity().

void TransformState::set_destructing  )  [inline, private]
 

This function should only be called from the destructor; it indicates that this TransformState object is beginning destruction.

It is only used as a sanity check, and is only meaningful when NDEBUG is not defined.

Definition at line 659 of file transformState.I.

ConstPointerTo< TransformState > TransformState::set_hpr const LVecBase3f &  hpr  )  const
 

Returns a new TransformState object that represents the original TransformState with its rotation component replaced with the indicated value, if possible.

Definition at line 456 of file transformState.cxx.

ConstPointerTo< TransformState > TransformState::set_pos const LVecBase3f &  pos  )  const
 

Returns a new TransformState object that represents the original TransformState with its pos component replaced with the indicated value.

Definition at line 424 of file transformState.cxx.

References get_hpr(), get_pos(), get_quat(), is_invalid(), make_pos_hpr_scale(), make_pos_quat_scale(), nassertr, and quat_given().

ConstPointerTo< TransformState > TransformState::set_quat const LQuaternionf &  quat  )  const
 

Returns a new TransformState object that represents the original TransformState with its rotation component replaced with the indicated value, if possible.

Definition at line 475 of file transformState.cxx.

References _self_compose, and NULL.

ConstPointerTo< TransformState > TransformState::set_scale const LVecBase3f &  scale  )  const
 

Returns a new TransformState object that represents the original TransformState with its scale component replaced with the indicated value, if possible.

Definition at line 494 of file transformState.cxx.

References _composition_cache, and NULL.

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 TransformState::write ostream &  out,
int  indent_level
const
 

Definition at line 749 of file transformState.cxx.

void TransformState::write_datagram BamWriter manager,
Datagram dg
[virtual]
 

Writes the contents of this object to the datagram for shipping out to a Bam file.

Implements TypedWritableReferenceCount.

Definition at line 1315 of file transformState.cxx.


Member Data Documentation

CompositionCache TransformState::_composition_cache [private]
 

Definition at line 175 of file transformState.h.

Referenced by get_num_unused_states(), set_scale(), and ~TransformState().

unsigned short TransformState::_flags [private]
 

Definition at line 222 of file transformState.h.

Referenced by calc_mat(), do_compose(), do_invert_compose(), get_hpr(), get_pos(), get_quat(), get_scale(), has_mat(), has_uniform_scale(), is_identity(), is_invalid(), is_singular(), make_identity(), and make_invalid().

LVecBase3f TransformState::_hpr [private]
 

Definition at line 217 of file transformState.h.

Referenced by do_invert_compose(), has_pos(), and make_identity().

ConstPointerTo< TransformState > TransformState::_identity_state [static, private]
 

Definition at line 31 of file transformState.cxx.

LMatrix4f* TransformState::_inv_mat [private]
 

Definition at line 220 of file transformState.h.

Referenced by do_compose(), and operator=().

CompositionCache TransformState::_invert_composition_cache [private]
 

Definition at line 176 of file transformState.h.

Referenced by compose(), and get_num_unused_states().

LMatrix4f TransformState::_mat [private]
 

Definition at line 219 of file transformState.h.

Referenced by has_scale().

LVecBase3f TransformState::_pos [private]
 

Definition at line 217 of file transformState.h.

Referenced by calc_mat(), make_identity(), make_invalid(), and quat_given().

LQuaternionf TransformState::_quat [private]
 

Definition at line 218 of file transformState.h.

Referenced by calc_mat(), do_invert_compose(), and make_invalid().

States::iterator TransformState::_saved_entry [private]
 

Definition at line 159 of file transformState.h.

LVecBase3f TransformState::_scale [private]
 

Definition at line 217 of file transformState.h.

Referenced by has_hpr(), has_quat(), make_identity(), and make_invalid().

const TransformState* TransformState::_self_compose [private]
 

Definition at line 181 of file transformState.h.

Referenced by get_num_unused_states(), and set_quat().

TransformState::States * TransformState::_states = NULL [static, private]
 

Definition at line 30 of file transformState.cxx.

Referenced by get_num_unused_states().

TypeHandle TransformState::_type_handle [static, private]
 

Reimplemented from TypedWritableReferenceCount.

Definition at line 32 of file transformState.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:55:48 2003 for Panda by doxygen1.3