Indicates a coordinate-system transform on vertices. TransformStates are the primary means for storing transformations on the scene graph.
More...
|
| cacheRef () |
| Overrides this method to update PStats appropriately. More...
|
|
bool | cacheUnref () |
| Overrides this method to update PStats appropriately. More...
|
|
int | compareTo (const TransformState other) |
| 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. More...
|
|
int | compareTo (const TransformState other, bool uniquify_matrix) |
| 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. More...
|
|
bool | componentsGiven () |
| 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. More...
|
|
const TransformState | compose (const TransformState other) |
| Returns a new TransformState object that represents the composition of this state with the other state. More...
|
|
object | getCompositionCache () |
|
int | getCompositionCacheNumEntries () |
| Returns the number of entries in the composition cache for this TransformState. This is the number of other TransformStates whose composition with this one has been cached. This number is not useful for any practical reason other than performance analysis. More...
|
|
const TransformState | getCompositionCacheResult (int n) |
| Returns the result TransformState of the nth element in the composition cache. Returns NULL if there doesn't happen to be an entry in the nth element. More...
|
|
int | getCompositionCacheSize () |
| Returns the number of slots in the composition cache for this TransformState. You may use this as an upper bound when walking through all of the composition cache results via get_composition_cache_source() or result(). More...
|
|
const TransformState | getCompositionCacheSource (int n) |
| Returns the source TransformState of the nth element in the composition cache. Returns NULL if there doesn't happen to be an entry in the nth element. See get_composition_cache_result(). More...
|
|
int | getGeomRendering (int geom_rendering) |
| Returns the union of the Geom::GeomRendering bits that will be required once this TransformState is applied to a geom which includes the indicated geom_rendering bits. The RenderState's get_geom_rendering() should already have been applied. More...
|
|
size_t | getHash () |
| Returns a suitable hash value for phash_map. More...
|
|
const LVecBase3 | getHpr () |
| 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. More...
|
|
const TransformState | getInverse () |
| Returns the inverse of this transform. If you are going to immediately compose this result with another TransformState, it is faster to do it in one operation with invert_compose(). More...
|
|
object | getInvertCompositionCache () |
|
int | getInvertCompositionCacheNumEntries () |
| Returns the number of entries in the invert_composition cache for this TransformState. This is similar to the composition cache, but it records cache entries for the invert_compose() operation. See get_composition_cache_num_entries(). More...
|
|
const TransformState | getInvertCompositionCacheResult (int n) |
| Returns the result TransformState of the nth element in the invert composition cache. Returns NULL if there doesn't happen to be an entry in the nth element. More...
|
|
int | getInvertCompositionCacheSize () |
| Returns the number of slots in the composition cache for this TransformState. You may use this as an upper bound when walking through all of the composition cache results via get_invert_composition_cache_source() or result(). More...
|
|
const TransformState | getInvertCompositionCacheSource (int n) |
| Returns the source TransformState of the nth element in the invert composition cache. Returns NULL if there doesn't happen to be an entry in the nth element. See get_invert_composition_cache_result(). More...
|
|
const LMatrix4 | getMat () |
| Returns the matrix that describes the transform. More...
|
|
LMatrix3 | getMat3 () |
| Returns the 3x3 matrix that describes the 2-d transform. It is an error to call this if is_2d() returned false. More...
|
|
const LQuaternion | getNormQuat () |
| Returns the rotation component of the transform as a quaternion. Unlike the result of get_quat(), the return value of this method is guaranteed to be normalized. It is an error to call this if has_components() returned false. More...
|
|
const LPoint3 | getPos () |
| Returns the pos component of the transform. It is an error to call this if has_pos() returned false. More...
|
|
LVecBase2 | getPos2d () |
| Returns the pos component of the 2-d transform. It is an error to call this if has_pos() or is_2d() returned false. More...
|
|
const LQuaternion | getQuat () |
| Returns the rotation component of the transform as a quaternion. The return value will be normalized if a normalized quaternion was given to the constructor (or if the quaternion was computed implicitly); it will be non-normalized if a non-normalized quaternion was given to the constructor. See also get_norm_quat(). More...
|
|
float | getRotate2d () |
| Returns the rotation component of the 2-d transform as an angle in degrees clockwise about the origin. It is an error to call this if has_components() or is_2d() returned false. More...
|
|
const LVecBase3 | getScale () |
| Returns the scale component of the transform. It is an error to call this if has_components() returned false. More...
|
|
LVecBase2 | getScale2d () |
| Returns the scale component of the 2-d transform. It is an error to call this if has_components() or is_2d() returned false. More...
|
|
const LVecBase3 | getShear () |
| Returns the shear component of the transform. It is an error to call this if has_components() returned false. More...
|
|
float | getShear2d () |
| Returns the shear component of the 2-d transform. It is an error to call this if has_components() or is_2d() returned false. More...
|
|
float | getUniformScale () |
| Returns the scale component of the transform, as a single number. It is an error to call this if has_uniform_scale() returned false. More...
|
|
const TransformState | getUnique () |
| Returns the pointer to the unique TransformState in the cache that is equivalent to this one. This may be the same pointer as this object, or it may be a different pointer; but it will be an equivalent object, and it will be a shared pointer. This may be called from time to time to improve cache benefits. More...
|
|
bool | hasComponents () |
| 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. More...
|
|
bool | hasHpr () |
| 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. More...
|
|
bool | hasIdentityScale () |
| Returns true if the scale is uniform 1.0, or false if the scale has some real value. More...
|
|
bool | hasMat () |
| Returns true if the transform can be described as a matrix. This is generally always true, unless is_invalid() is true. More...
|
|
bool | hasNonzeroShear () |
| Returns true if the shear component is non-zero, false if it is zero or if the matrix cannot be decomposed. More...
|
|
bool | hasPos () |
| 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). More...
|
|
bool | hasQuat () |
| 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. More...
|
|
bool | hasScale () |
| Returns true if the transform's scale component can be extracted out separately. This is generally true only when has_components() is true. More...
|
|
bool | hasShear () |
| Returns true if the transform's shear component can be extracted out separately. This is generally true only when has_components() is true. More...
|
|
bool | hasUniformScale () |
| 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. More...
|
|
bool | hprGiven () |
| 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. More...
|
|
const TransformState | invertCompose (const TransformState other) |
| Returns a new TransformState object that represents the composition of this state's inverse with the other state. More...
|
|
bool | is2d () |
| Returns true if the transform has been constructed entirely using the 2-d transform operations, e.g. make_pos2d(), and therefore operates strictly in two-dimensional space on X and Y only. More...
|
|
bool | isIdentity () |
| Returns true if the transform represents the identity matrix, false otherwise. More...
|
|
bool | isInvalid () |
| 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. More...
|
|
bool | isSingular () |
| Returns true if the transform represents a singular transform (that is, it has a zero scale, and it cannot be inverted), or false otherwise. More...
|
|
| nodeRef () |
| Overrides this method to update PStats appropriately. More...
|
|
bool | nodeUnref () |
| Overrides this method to update PStats appropriately. More...
|
|
bool | operator!= (const TransformState other) |
|
bool | operator== (const TransformState other) |
|
| output (Ostream out) |
|
bool | quatGiven () |
| 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. More...
|
|
const TransformState | setHpr (const LVecBase3 hpr) |
| Returns a new TransformState object that represents the original TransformState with its rotation component replaced with the indicated value, if possible. More...
|
|
const TransformState | setPos (const LVecBase3 pos) |
| Returns a new TransformState object that represents the original TransformState with its pos component replaced with the indicated value. More...
|
|
const TransformState | setPos2d (const LVecBase2 pos) |
| Returns a new TransformState object that represents the original 2-d TransformState with its pos component replaced with the indicated value. More...
|
|
const TransformState | setQuat (const LQuaternion quat) |
| Returns a new TransformState object that represents the original TransformState with its rotation component replaced with the indicated value, if possible. More...
|
|
const TransformState | setRotate2d (float rotate) |
| Returns a new TransformState object that represents the original 2-d TransformState with its rotation component replaced with the indicated value, if possible. More...
|
|
const TransformState | setScale (const LVecBase3 scale) |
| Returns a new TransformState object that represents the original TransformState with its scale component replaced with the indicated value, if possible. More...
|
|
const TransformState | setScale2d (const LVecBase2 scale) |
| Returns a new TransformState object that represents the original 2-d TransformState with its scale component replaced with the indicated value, if possible. More...
|
|
const TransformState | setShear (const LVecBase3 shear) |
| Returns a new TransformState object that represents the original TransformState with its shear component replaced with the indicated value, if possible. More...
|
|
const TransformState | setShear2d (float shear) |
| Returns a new TransformState object that represents the original 2-d TransformState with its shear component replaced with the indicated value, if possible. More...
|
|
bool | validateCompositionCache () |
| Returns true if the composition cache and invert composition cache for this particular TransformState are self-consistent and valid, false otherwise. More...
|
|
| write (Ostream out, int indent_level) |
|
| writeCompositionCache (Ostream out, int indent_level) |
| Writes a brief description of the composition cache and invert composition cache to the indicated ostream. This is not useful except for performance analysis, to examine the cache structure. More...
|
|
Public Member Functions inherited from NodeCachedReferenceCount |
int | getNodeRefCount () |
| Returns the current reference count. More...
|
|
int | getReferencedBits () |
| Returns the union of the values defined in the Referenced enum that represents the various things that appear to be holding a pointer to this object. More...
|
|
| nodeRef () |
| Explicitly increments the reference count. More...
|
|
bool | nodeUnref () |
| Explicitly decrements the node reference count and the normal reference count simultaneously. More...
|
|
bool | testRefCountIntegrity () |
| Does some easy checks to make sure that the reference count isn't completely bogus. More...
|
|
Public Member Functions inherited from CachedTypedWritableReferenceCount |
| cacheRef () |
| Explicitly increments the cache reference count and the normal reference count simultaneously. More...
|
|
bool | cacheUnref () |
| Explicitly decrements the cache reference count and the normal reference count simultaneously. More...
|
|
int | getCacheRefCount () |
| Returns the current reference count. More...
|
|
bool | testRefCountIntegrity () |
| Does some easy checks to make sure that the reference count isn't completely bogus. More...
|
|
Public Member Functions inherited from TypedWritable |
object | __reduce__ () |
|
object | __reduce_persist__ (object pickler) |
|
str | encodeToBamStream () |
| Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. Returns empty string on failure. More...
|
|
bool | encodeToBamStream (String data, BamWriter writer) |
| Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. Returns true on success, false on failure. More...
|
|
UpdateSeq | getBamModified () |
| Returns the current bam_modified counter. This counter is normally incremented automatically whenever the object is modified. More...
|
|
| markBamModified () |
| Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. This should normally not need to be called by user code; it should be called internally when the object has been changed in a way that legitimately requires its retransmission to any connected clients. More...
|
|
Public Member Functions inherited from TypedObject |
TypeHandle | getType () |
| Derived classes should override this function to return get_class_type(). More...
|
|
int | getTypeIndex () |
| 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(). More...
|
|
bool | isExactType (TypeHandle handle) |
| Returns true if the current object is the indicated type exactly. More...
|
|
bool | isOfType (TypeHandle handle) |
| Returns true if the current object is or derives from the indicated type. More...
|
|
Public Member Functions inherited from ReferenceCount |
int | getRefCount () |
| Returns the current reference count. More...
|
|
| ref () |
| 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. More...
|
|
bool | testRefCountIntegrity () |
| Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise. More...
|
|
bool | testRefCountNonzero () |
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise. More...
|
|
bool | unref () |
| 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.) However, see the helper function unref_delete(). More...
|
|
|
static int | clearCache () |
| Empties the cache of composed TransformStates. This makes every TransformState forget what results when it is composed with other TransformStates. More...
|
|
static int | garbageCollect () |
| Performs a garbage-collection cycle. This must be called periodically if garbage-collect-states is true to ensure that TransformStates get cleaned up appropriately. It does no harm to call it even if this variable is not true, but there is probably no advantage in that case. More...
|
|
static TypeHandle | getClassType () |
|
static int | getNumStates () |
| Returns the total number of unique TransformState objects allocated in the world. This will go up and down during normal operations. More...
|
|
static int | getNumUnusedStates () |
| Returns the total number of TransformState objects that have been allocated but have no references outside of the internal TransformState cache. More...
|
|
static object | getStates () |
|
static object | getUnusedStates () |
|
static | listCycles (Ostream out) |
| Detects all of the reference-count cycles in the cache and reports them to standard output. More...
|
|
static | listStates (Ostream out) |
| Lists all of the TransformStates in the cache to the output stream, one per line. This can be quite a lot of output if the cache is large, so be prepared. More...
|
|
static const TransformState | makeHpr (const LVecBase3 hpr) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makeIdentity () |
| Constructs an identity transform. More...
|
|
static const TransformState | makeInvalid () |
| Constructs an invalid transform; for instance, the result of inverting a singular matrix. More...
|
|
static const TransformState | makeMat (const LMatrix4 mat) |
| Makes a new TransformState with the specified transformation matrix. More...
|
|
static const TransformState | makeMat3 (const LMatrix3 mat) |
| Makes a new two-dimensional TransformState with the specified 3x3 transformation matrix. More...
|
|
static const TransformState | makePos (const LVecBase3 pos) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makePos2d (const LVecBase2 pos) |
| Makes a new 2-d TransformState with the specified components. More...
|
|
static const TransformState | makePosHpr (const LVecBase3 pos, const LVecBase3 hpr) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makePosHprScale (const LVecBase3 pos, const LVecBase3 hpr, const LVecBase3 scale) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makePosHprScaleShear (const LVecBase3 pos, const LVecBase3 hpr, const LVecBase3 scale, const LVecBase3 shear) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makePosQuatScale (const LVecBase3 pos, const LQuaternion quat, const LVecBase3 scale) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makePosQuatScaleShear (const LVecBase3 pos, const LQuaternion quat, const LVecBase3 scale, const LVecBase3 shear) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makePosRotate2d (const LVecBase2 pos, float rotate) |
| Makes a new 2-d TransformState with the specified components. More...
|
|
static const TransformState | makePosRotateScale2d (const LVecBase2 pos, float rotate, const LVecBase2 scale) |
| Makes a new 2-d TransformState with the specified components. More...
|
|
static const TransformState | makePosRotateScaleShear2d (const LVecBase2 pos, float rotate, const LVecBase2 scale, float shear) |
| Makes a new two-dimensional TransformState with the specified components. More...
|
|
static const TransformState | makeQuat (const LQuaternion quat) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makeRotate2d (float rotate) |
| Makes a new 2-d TransformState with the specified components. More...
|
|
static const TransformState | makeScale (const LVecBase3 scale) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makeScale (float scale) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makeScale2d (const LVecBase2 scale) |
| Makes a new 2-d TransformState with the specified components. More...
|
|
static const TransformState | makeScale2d (float scale) |
| Makes a new 2-d TransformState with the specified components. More...
|
|
static const TransformState | makeShear (const LVecBase3 shear) |
| Makes a new TransformState with the specified components. More...
|
|
static const TransformState | makeShear2d (float shear) |
| Makes a new 2-d TransformState with the specified components. More...
|
|
static bool | validateStates () |
| Ensures that the cache is still stored in sorted order, and that none of the cache elements have been inadvertently deleted. Returns true if so, false if there is a problem (which implies someone has modified one of the supposedly-const TransformState objects). More...
|
|
Static Public Member Functions inherited from NodeCachedReferenceCount |
static TypeHandle | getClassType () |
|
Static Public Member Functions inherited from CachedTypedWritableReferenceCount |
static TypeHandle | getClassType () |
|
Static Public Member Functions inherited from TypedWritableReferenceCount |
static TypedWritableReferenceCount | decodeFromBamStream (str data, BamReader reader) |
| Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string. Returns NULL on error. More...
|
|
static TypeHandle | getClassType () |
|
Static Public Member Functions inherited from TypedWritable |
static TypeHandle | getClassType () |
|
Static Public Member Functions inherited from TypedObject |
static TypeHandle | getClassType () |
|
Static Public Member Functions inherited from ReferenceCount |
static TypeHandle | getClassType () |
|
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.