Panda3D
|
Indicates a coordinate-system transform on vertices. More...
Public Types | |
enum | Referenced { RNode = 1, RCache = 2 } |
Public Member Functions | |
cacheRef () | |
Overrides this method to update PStats appropriately. | |
bool | cacheUnref () |
Overrides this method to update PStats appropriately. | |
bool | componentsGiven () |
Returns true if the transform was specified componentwise, or false if it was specified with a general 4x4 matrix. | |
TransformState const | compose (TransformState const other) |
Returns a new TransformState object that represents the composition of this state with the other state. | |
string | encodeToBamStream () |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. | |
bool | encodeToBamStream (basic_stringchar data, BamWriter writer) |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. | |
bool | encodeToBamStream (basic_stringchar data) |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. | |
UpdateSeq | getBamModified () |
Returns the current bam_modified counter. | |
int | getCacheRefCount () |
Returns the current reference count. | |
PyObject | getCompositionCache () |
Returns a list of 2-tuples that represents the composition cache. | |
int | getCompositionCacheNumEntries () |
Returns the number of entries in the composition cache for this TransformState. | |
TransformState const | getCompositionCacheResult (int n) |
Returns the result TransformState of the nth element in the composition cache. | |
int | getCompositionCacheSize () |
Returns the number of slots in the composition cache for this TransformState. | |
TransformState const | getCompositionCacheSource (int n) |
Returns the source TransformState of the nth element in the composition cache. | |
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. | |
unsigned int | getHash () |
Returns a suitable hash value for phash_map. | |
VBase3 const | getHpr () |
Returns the rotation component of the transform as a trio of Euler angles. | |
TransformState const | getInverse () |
Returns the inverse of this transform. | |
PyObject | getInvertCompositionCache () |
Returns a list of 2-tuples that represents the invert_composition cache. | |
int | getInvertCompositionCacheNumEntries () |
Returns the number of entries in the invert_composition cache for this TransformState. | |
TransformState const | getInvertCompositionCacheResult (int n) |
Returns the result TransformState of the nth element in the invert composition cache. | |
int | getInvertCompositionCacheSize () |
Returns the number of slots in the composition cache for this TransformState. | |
TransformState const | getInvertCompositionCacheSource (int n) |
Returns the source TransformState of the nth element in the invert composition cache. | |
Mat4 const | getMat () |
Returns the matrix that describes the transform. | |
Mat3 | getMat3 () |
Returns the 3x3 matrix that describes the 2-d transform. | |
int | getNodeRefCount () |
Returns the current reference count. | |
Quat const | getNormQuat () |
Returns the rotation component of the transform as a quaternion. | |
Point3 const | getPos () |
Returns the pos component of the transform. | |
VBase2 | getPos2d () |
Returns the pos component of the 2-d transform. | |
Quat const | getQuat () |
Returns the rotation component of the transform as a quaternion. | |
int | getRefCount () |
Returns the current reference count. | |
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. | |
float | getRotate2d () |
Returns the rotation component of the 2-d transform as an angle in degrees clockwise about the origin. | |
VBase3 const | getScale () |
Returns the scale component of the transform. | |
VBase2 | getScale2d () |
Returns the scale component of the 2-d transform. | |
VBase3 const | getShear () |
Returns the shear component of the transform. | |
float | getShear2d () |
Returns the shear component of the 2-d transform. | |
TypeHandle | getType () |
int | getTypeIndex () |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
float | getUniformScale () |
Returns the scale component of the transform, as a single number. | |
TransformState const | getUnique () |
Returns the pointer to the unique TransformState in the cache that is equivalent to this one. | |
bool | hasComponents () |
Returns true if the transform can be described by separate pos, hpr, and scale components. | |
bool | hasHpr () |
Returns true if the transform's rotation component can be extracted out separately and described as a set of Euler angles. | |
bool | hasIdentityScale () |
Returns true if the scale is uniform 1.0, or false if the scale has some real value. | |
bool | hasMat () |
Returns true if the transform can be described as a matrix. | |
bool | hasNonzeroShear () |
Returns true if the shear component is non-zero, false if it is zero or if the matrix cannot be decomposed. | |
bool | hasPos () |
Returns true if the transform's pos component can be extracted out separately. | |
bool | hasQuat () |
Returns true if the transform's rotation component can be extracted out separately and described as a quaternion. | |
bool | hasScale () |
Returns true if the transform's scale component can be extracted out separately. | |
bool | hasShear () |
Returns true if the transform's shear component can be extracted out separately. | |
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. | |
bool | hprGiven () |
Returns true if the rotation was specified via a trio of Euler angles, false otherwise. | |
TransformState const | invertCompose (TransformState const other) |
Returns a new TransformState object that represents the composition of this state's inverse with the other state. | |
bool | is2d () |
Returns true if the transform has been constructed entirely using the 2-d transform operations, e.g. | |
bool | isExactType (TypeHandle handle) |
Returns true if the current object is the indicated type exactly. | |
bool | isIdentity () |
Returns true if the transform represents the identity matrix, false otherwise. | |
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. | |
bool | isOfType (TypeHandle handle) |
Returns true if the current object is or derives from the indicated type. | |
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. | |
markBamModified () | |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. | |
nodeRef () | |
Overrides this method to update PStats appropriately. | |
bool | nodeUnref () |
Overrides this method to update PStats appropriately. | |
bool | operator< (TransformState const 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. | |
output (ostream out) | |
bool | quatGiven () |
Returns true if the rotation was specified via a quaternion, false otherwise. | |
PyObject | reduce (PyObject self) |
This special Python method is implement to provide support for the pickle module. | |
PyObject | reducePersist (PyObject self, PyObject pickler) |
This special Python method is implement to provide support for the pickle module. | |
ref () | |
Explicitly increments the reference count. | |
TransformState const | setHpr (VBase3 const hpr) |
Returns a new TransformState object that represents the original TransformState with its rotation component replaced with the indicated value, if possible. | |
TransformState const | setPos (VBase3 const pos) |
Returns a new TransformState object that represents the original TransformState with its pos component replaced with the indicated value. | |
TransformState const | setPos2d (VBase2 const pos) |
Returns a new TransformState object that represents the original 2-d TransformState with its pos component replaced with the indicated value. | |
TransformState const | setQuat (Quat const quat) |
Returns a new TransformState object that represents the original TransformState with its rotation component replaced with the indicated value, if possible. | |
TransformState const | 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. | |
TransformState const | setScale (VBase3 const scale) |
Returns a new TransformState object that represents the original TransformState with its scale component replaced with the indicated value, if possible. | |
TransformState const | setScale2d (VBase2 const scale) |
Returns a new TransformState object that represents the original 2-d TransformState with its scale component replaced with the indicated value, if possible. | |
TransformState const | setShear (VBase3 const shear) |
Returns a new TransformState object that represents the original TransformState with its shear component replaced with the indicated value, if possible. | |
TransformState const | 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. | |
bool | sortsLess (TransformState const 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. | |
bool | testRefCountIntegrity () |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | testRefCountNonzero () |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
bool | unref () |
Explicitly decrements the reference count. | |
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. | |
Static Public Member Functions | |
static int | clearCache () |
Empties the cache of composed TransformStates. | |
static TypedWritableReferenceCount | decodeFromBamStream (string 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. | |
static TypedWritableReferenceCount | decodeFromBamStream (string data) |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string. | |
static TypeHandle | getClassType () |
static int | getNumStates () |
Returns the total number of unique TransformState objects allocated in the world. | |
static int | getNumUnusedStates () |
Returns the total number of TransformState objects that have been allocated but have no references outside of the internal TransformState cache. | |
static PyObject | getStates () |
Returns a list of all of the TransformState objects in the state cache. | |
static | listCycles (ostream out) |
Detects all of the reference-count cycles in the cache and reports them to standard output. | |
static | listStates (ostream out) |
Lists all of the TransformStates in the cache to the output stream, one per line. | |
static TransformState const | makeHpr (VBase3 const hpr) |
Makes a new TransformState with the specified components. | |
static TransformState const | makeIdentity () |
Constructs an identity transform. | |
static TransformState const | makeInvalid () |
Constructs an invalid transform; for instance, the result of inverting a singular matrix. | |
static TransformState const | makeMat (Mat4 const mat) |
Makes a new TransformState with the specified transformation matrix. | |
static TransformState const | makeMat3 (Mat3 const mat) |
Makes a new two-dimensional TransformState with the specified 3x3 transformation matrix. | |
static TransformState const | makePos (VBase3 const pos) |
Makes a new TransformState with the specified components. | |
static TransformState const | makePos2d (VBase2 const pos) |
Makes a new 2-d TransformState with the specified components. | |
static TransformState const | makePosHpr (VBase3 const pos, VBase3 const hpr) |
Makes a new TransformState with the specified components. | |
static TransformState const | makePosHprScale (VBase3 const pos, VBase3 const hpr, VBase3 const scale) |
Makes a new TransformState with the specified components. | |
static TransformState const | makePosHprScaleShear (VBase3 const pos, VBase3 const hpr, VBase3 const scale, VBase3 const shear) |
Makes a new TransformState with the specified components. | |
static TransformState const | makePosQuatScale (VBase3 const pos, Quat const quat, VBase3 const scale) |
Makes a new TransformState with the specified components. | |
static TransformState const | makePosQuatScaleShear (VBase3 const pos, Quat const quat, VBase3 const scale, VBase3 const shear) |
Makes a new TransformState with the specified components. | |
static TransformState const | makePosRotate2d (VBase2 const pos, float rotate) |
Makes a new 2-d TransformState with the specified components. | |
static TransformState const | makePosRotateScale2d (VBase2 const pos, float rotate, VBase2 const scale) |
Makes a new 2-d TransformState with the specified components. | |
static TransformState const | makePosRotateScaleShear2d (VBase2 const pos, float rotate, VBase2 const scale, float shear) |
Makes a new two-dimensional TransformState with the specified components. | |
static TransformState const | makeQuat (Quat const quat) |
Makes a new TransformState with the specified components. | |
static TransformState const | makeRotate2d (float rotate) |
Makes a new 2-d TransformState with the specified components. | |
static TransformState const | makeScale (float scale) |
Makes a new TransformState with the specified components. | |
static TransformState const | makeScale (VBase3 const scale) |
Makes a new TransformState with the specified components. | |
static TransformState const | makeScale2d (VBase2 const scale) |
Makes a new 2-d TransformState with the specified components. | |
static TransformState const | makeScale2d (float scale) |
Makes a new 2-d TransformState with the specified components. | |
static TransformState const | makeShear (VBase3 const shear) |
Makes a new TransformState with the specified components. | |
static TransformState const | makeShear2d (float shear) |
Makes a new 2-d TransformState with the specified components. | |
static bool | validateStates () |
Ensures that the cache is still stored in sorted order, and that none of the cache elements have been inadvertently deleted. |
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.
enum Referenced [inherited] |
cacheRef | ( | ) |
Overrides this method to update PStats appropriately.
Reimplemented from CachedTypedWritableReferenceCount.
bool cacheUnref | ( | ) |
Overrides this method to update PStats appropriately.
Reimplemented from CachedTypedWritableReferenceCount.
static int clearCache | ( | ) | [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.
Nowadays, this method should not be necessary, as reference-count cycles in the composition cache should be automatically detected and broken.
The return value is the number of TransformStates freed by this operation.
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.
TransformState const compose | ( | TransformState const | other | ) |
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.
static TypedWritableReferenceCount decodeFromBamStream | ( | string | data, |
BamReader | reader | ||
) | [static, inherited] |
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.
This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.
static TypedWritableReferenceCount decodeFromBamStream | ( | string | data | ) | [static, inherited] |
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.
This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.
string encodeToBamStream | ( | ) | [inherited] |
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.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
bool encodeToBamStream | ( | basic_stringchar | data, |
BamWriter | writer | ||
) | [inherited] |
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.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
bool encodeToBamStream | ( | basic_stringchar | data | ) | [inherited] |
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.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
UpdateSeq getBamModified | ( | ) | [inherited] |
Returns the current bam_modified counter.
This counter is normally incremented automatically whenever the object is modified.
int getCacheRefCount | ( | ) | [inherited] |
Returns the current reference count.
static TypeHandle getClassType | ( | ) | [static] |
Reimplemented from NodeCachedReferenceCount.
PyObject getCompositionCache | ( | ) |
Returns a list of 2-tuples that represents the composition cache.
For each tuple in the list, the first element is the source transform, and the second is the result transform. If both are None, there is no entry in the cache at that slot.
In general, a->compose(source) == result.
This has no practical value other than for examining the cache for performance analysis.
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.
TransformState const 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.
In general, a->compose(a->get_composition_cache_source(n)) == a->get_composition_cache_result(n).
This has no practical value other than for examining the cache for performance analysis.
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().
This has no practical value other than for examining the cache for performance analysis.
TransformState const 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().
This has no practical value other than for examining the cache for performance analysis.
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.
unsigned int getHash | ( | ) |
Returns a suitable hash value for phash_map.
VBase3 const 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.
TransformState const 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().
PyObject getInvertCompositionCache | ( | ) |
Returns a list of 2-tuples that represents the invert_composition cache.
For each tuple in the list, the first element is the source transform, and the second is the result transform. If both are None, there is no entry in the cache at that slot.
In general, a->invert_compose(source) == result.
This has no practical value other than for examining the cache for performance analysis.
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().
TransformState const 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.
In general, a->invert_compose(a->get_invert_composition_cache_source(n)) == a->get_invert_composition_cache_result(n).
This has no practical value other than for examining the cache for performance analysis.
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().
This has no practical value other than for examining the cache for performance analysis.
TransformState const 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().
This has no practical value other than for examining the cache for performance analysis.
Mat4 const getMat | ( | ) |
Returns the matrix that describes the transform.
Mat3 getMat3 | ( | ) |
Returns the 3x3 matrix that describes the 2-d transform.
It is an error to call this if is_2d() returned false.
int getNodeRefCount | ( | ) | [inherited] |
Returns the current reference count.
Quat const 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.
static int getNumStates | ( | ) | [static] |
Returns the total number of unique TransformState objects allocated in the world.
This will go up and down during normal operations.
static int getNumUnusedStates | ( | ) | [static] |
Returns the total number of TransformState objects that have been allocated but have no references outside of the internal TransformState cache.
A nonzero return value is not necessarily indicative of leaked references; it is normal for two TransformState objects, both of which have references held outside the cache, to have the result of their composition stored within the cache. This result will be retained within the cache until one of the base TransformStates is released.
Use list_cycles() to get an idea of the number of actual "leaked" TransformState objects.
Point3 const getPos | ( | ) |
Returns the pos component of the transform.
It is an error to call this if has_pos() returned false.
VBase2 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.
Quat const 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().
It is an error to call this if has_components() returned false.
int getRefCount | ( | ) | [inherited] |
Returns the current reference count.
int getReferencedBits | ( | ) | [inherited] |
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.
If R_node is included, at least one node is holding a pointer; if R_cache is included, at least one cache element is.
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.
VBase3 const getScale | ( | ) |
Returns the scale component of the transform.
It is an error to call this if has_components() returned false.
VBase2 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.
VBase3 const getShear | ( | ) |
Returns the shear component of the transform.
It is an error to call this if has_components() returned false.
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.
static PyObject getStates | ( | ) | [static] |
Returns a list of all of the TransformState objects in the state cache.
The order of elements in this cache is arbitrary.
TypeHandle getType | ( | ) | [inherited] |
Reimplemented in AnimChannelBase.
int getTypeIndex | ( | ) | [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().
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.
TransformState const 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.
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.
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.)
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.
bool hasIdentityScale | ( | ) |
Returns true if the scale is uniform 1.0, or false if the scale has some real value.
bool hasMat | ( | ) |
Returns true if the transform can be described as a matrix.
This is generally always true, unless is_invalid() is true.
bool hasNonzeroShear | ( | ) |
Returns true if the shear component is non-zero, false if it is zero or if the matrix cannot be decomposed.
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).
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.
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.
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.
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.
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.
TransformState const invertCompose | ( | TransformState const | other | ) |
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.
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.
bool isExactType | ( | TypeHandle | handle | ) | [inherited] |
Returns true if the current object is the indicated type exactly.
bool isIdentity | ( | ) |
Returns true if the transform represents the identity matrix, false otherwise.
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.
bool isOfType | ( | TypeHandle | handle | ) | [inherited] |
Returns true if the current object is or derives from the indicated type.
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.
static listCycles | ( | ostream | out | ) | [static] |
Detects all of the reference-count cycles in the cache and reports them to standard output.
These cycles may be inadvertently created when state compositions cycle back to a starting point. Nowadays, these cycles should be automatically detected and broken, so this method should never list any cycles unless there is a bug in that detection logic.
The cycles listed here are not leaks in the strictest sense of the word, since they can be reclaimed by a call to clear_cache(); but they will not be reclaimed automatically.
static listStates | ( | ostream | out | ) | [static] |
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.
static TransformState const makeHpr | ( | VBase3 const | hpr | ) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makeIdentity | ( | ) | [static] |
Constructs an identity transform.
static TransformState const makeInvalid | ( | ) | [static] |
Constructs an invalid transform; for instance, the result of inverting a singular matrix.
static TransformState const makeMat | ( | Mat4 const | mat | ) | [static] |
Makes a new TransformState with the specified transformation matrix.
static TransformState const makeMat3 | ( | Mat3 const | mat | ) | [static] |
Makes a new two-dimensional TransformState with the specified 3x3 transformation matrix.
static TransformState const makePos | ( | VBase3 const | pos | ) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makePos2d | ( | VBase2 const | pos | ) | [static] |
Makes a new 2-d TransformState with the specified components.
static TransformState const makePosHpr | ( | VBase3 const | pos, |
VBase3 const | hpr | ||
) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makePosHprScale | ( | VBase3 const | pos, |
VBase3 const | hpr, | ||
VBase3 const | scale | ||
) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makePosHprScaleShear | ( | VBase3 const | pos, |
VBase3 const | hpr, | ||
VBase3 const | scale, | ||
VBase3 const | shear | ||
) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makePosQuatScale | ( | VBase3 const | pos, |
Quat const | quat, | ||
VBase3 const | scale | ||
) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makePosQuatScaleShear | ( | VBase3 const | pos, |
Quat const | quat, | ||
VBase3 const | scale, | ||
VBase3 const | shear | ||
) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makePosRotate2d | ( | VBase2 const | pos, |
float | rotate | ||
) | [static] |
Makes a new 2-d TransformState with the specified components.
static TransformState const makePosRotateScale2d | ( | VBase2 const | pos, |
float | rotate, | ||
VBase2 const | scale | ||
) | [static] |
Makes a new 2-d TransformState with the specified components.
static TransformState const makePosRotateScaleShear2d | ( | VBase2 const | pos, |
float | rotate, | ||
VBase2 const | scale, | ||
float | shear | ||
) | [static] |
Makes a new two-dimensional TransformState with the specified components.
static TransformState const makeQuat | ( | Quat const | quat | ) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makeRotate2d | ( | float | rotate | ) | [static] |
Makes a new 2-d TransformState with the specified components.
static TransformState const makeScale | ( | VBase3 const | scale | ) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makeScale | ( | float | scale | ) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makeScale2d | ( | VBase2 const | scale | ) | [static] |
Makes a new 2-d TransformState with the specified components.
static TransformState const makeScale2d | ( | float | scale | ) | [static] |
Makes a new 2-d TransformState with the specified components.
static TransformState const makeShear | ( | VBase3 const | shear | ) | [static] |
Makes a new TransformState with the specified components.
static TransformState const makeShear2d | ( | float | shear | ) | [static] |
Makes a new 2-d TransformState with the specified components.
markBamModified | ( | ) | [inherited] |
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.
nodeRef | ( | ) |
Overrides this method to update PStats appropriately.
Reimplemented from NodeCachedReferenceCount.
bool nodeUnref | ( | ) |
Overrides this method to update PStats appropriately.
Reimplemented from NodeCachedReferenceCount.
bool operator< | ( | TransformState const | 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.
This is the same as sorts_less(), except the uniquify_matrix value is implicit from the Config.prc file.
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.
PyObject reduce | ( | PyObject | self | ) | [inherited] |
This special Python method is implement to provide support for the pickle module.
This hooks into the native pickle and cPickle modules, but it cannot properly handle self-referential BAM objects.
PyObject reducePersist | ( | PyObject | self, |
PyObject | pickler | ||
) | [inherited] |
This special Python method is implement to provide support for the pickle module.
This is similar to __reduce__, but it provides additional support for the missing persistent-state object needed to properly support self-referential BAM objects written to the pickle stream. This hooks into the pickle and cPickle modules implemented in direct/src/stdpy.
ref | ( | ) | [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.
TransformState const setHpr | ( | VBase3 const | hpr | ) |
Returns a new TransformState object that represents the original TransformState with its rotation component replaced with the indicated value, if possible.
TransformState const setPos | ( | VBase3 const | pos | ) |
Returns a new TransformState object that represents the original TransformState with its pos component replaced with the indicated value.
TransformState const setPos2d | ( | VBase2 const | pos | ) |
Returns a new TransformState object that represents the original 2-d TransformState with its pos component replaced with the indicated value.
TransformState const setQuat | ( | Quat const | quat | ) |
Returns a new TransformState object that represents the original TransformState with its rotation component replaced with the indicated value, if possible.
TransformState const 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.
TransformState const setScale | ( | VBase3 const | scale | ) |
Returns a new TransformState object that represents the original TransformState with its scale component replaced with the indicated value, if possible.
TransformState const setScale2d | ( | VBase2 const | scale | ) |
Returns a new TransformState object that represents the original 2-d TransformState with its scale component replaced with the indicated value, if possible.
TransformState const setShear | ( | VBase3 const | shear | ) |
Returns a new TransformState object that represents the original TransformState with its shear component replaced with the indicated value, if possible.
TransformState const 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.
bool sortsLess | ( | TransformState const | 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.
If uniquify_matrix is true, then matrix-defined TransformStates are also uniqified. If uniquify_matrix is false, then only component-defined TransformStates are uniquified, which is less expensive.
bool testRefCountIntegrity | ( | ) | [inherited] |
Does some easy checks to make sure that the reference count isn't completely bogus.
Reimplemented from CachedTypedWritableReferenceCount.
bool testRefCountNonzero | ( | ) | [inherited] |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
Returns true if ok, false otherwise.
bool unref | ( | ) | [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.) 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 true if the new reference count is nonzero, false if it is zero.
Reimplemented in GeomVertexArrayFormat, and GeomVertexFormat.
static bool validateStates | ( | ) | [static] |
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).