Panda3D
|
This represents the <Transform> entry of a group or texture node: a list of component transform operations, applied in order, that describe a net transform matrix. More...
Public Types | |
enum | ComponentType { CT_invalid = 0, CT_translate2d = 1, CT_translate3d = 2, CT_rotate2d = 3, CT_rotx = 4, CT_roty = 5, CT_rotz = 6, CT_rotate3d = 7, CT_scale2d = 8, CT_scale3d = 9, CT_uniform_scale = 10, CT_matrix3 = 11, CT_matrix4 = 12 } |
Public Member Functions | |
__init__ () | |
__init__ (const EggTransform copy) | |
addMatrix3 (const LMatrix3d mat) | |
Appends an arbitrary 3x3 matrix to the current transform. More... | |
addMatrix4 (const LMatrix4d mat) | |
Appends an arbitrary 4x4 matrix to the current transform. More... | |
addRotate2d (double angle) | |
Appends a 2-d rotation to the current transform. More... | |
addRotate3d (const LQuaterniond quat) | |
Appends an arbitrary 3-d rotation to the current transform, expressed as a quaternion. More... | |
addRotate3d (double angle, const LVector3d axis) | |
Appends a 3-d rotation about an arbitrary axis to the current transform. More... | |
addRotx (double angle) | |
Appends a rotation about the X axis to the current transform. More... | |
addRoty (double angle) | |
Appends a rotation about the Y axis to the current transform. More... | |
addRotz (double angle) | |
Appends a rotation about the Z axis to the current transform. More... | |
addScale2d (const LVecBase2d scale) | |
Appends a possibly non-uniform scale to the current transform. More... | |
addScale3d (const LVecBase3d scale) | |
Appends a possibly non-uniform scale to the current transform. More... | |
addTranslate2d (const LVector2d translate) | |
Appends a 2-d translation operation to the current transform. More... | |
addTranslate3d (const LVector3d translate) | |
Appends a 3-d translation operation to the current transform. More... | |
addUniformScale (double scale) | |
Appends a uniform scale to the current transform. More... | |
clearTransform () | |
Resets the transform to empty, identity. More... | |
const LMatrix3d | getComponentMat3 (int n) |
Returns the 3x3 matrix associated with the nth component. More... | |
const LMatrix4d | getComponentMat4 (int n) |
Returns the 4x4 matrix associated with the nth component. More... | |
double | getComponentNumber (int n) |
Returns the solitary number associated with the nth component. More... | |
EggTransform::ComponentType | getComponentType (int n) |
Returns the type of the nth component. More... | |
const LVecBase2d | getComponentVec2 (int n) |
Returns the 2-component vector associated with the nth component. More... | |
const LVecBase3d | getComponentVec3 (int n) |
Returns the 3-component vector associated with the nth component. More... | |
int | getNumComponents () |
Returns the number of components that make up the transform. More... | |
LMatrix3d | getTransform2d () |
Returns the overall transform as a 3x3 matrix. More... | |
const LMatrix4d | getTransform3d () |
Returns the overall transform as a 4x4 matrix. More... | |
bool | hasTransform () |
Returns true if the transform is nonempty, false if it is empty (no transform components have been added). More... | |
bool | hasTransform2d () |
Returns true if the transform is specified as a 2-d transform, e.g. More... | |
bool | hasTransform3d () |
Returns true if the transform is specified as a 3-d transform, e.g. More... | |
EggTransform | operator= (const EggTransform copy) |
setTransform2d (const LMatrix3d mat) | |
Sets the overall transform as a 3x3 matrix. More... | |
setTransform3d (const LMatrix4d mat) | |
Sets the overall transform as a 4x4 matrix. More... | |
bool | transformIsIdentity () |
Returns true if the described transform is identity, false otherwise. More... | |
write (Ostream out, int indent_level, str label) | |
Writes the transform to the indicated stream in Egg format. More... | |
This represents the <Transform> entry of a group or texture node: a list of component transform operations, applied in order, that describe a net transform matrix.
This may be either a 3-d transform, and therefore described by a 4x4 matrix, or a 2-d transform, described by a 3x3 matrix.
enum ComponentType |
__init__ | ( | ) |
__init__ | ( | const EggTransform | copy | ) |
addMatrix3 | ( | const LMatrix3d | mat | ) |
Appends an arbitrary 3x3 matrix to the current transform.
addMatrix4 | ( | const LMatrix4d | mat | ) |
Appends an arbitrary 4x4 matrix to the current transform.
addRotate2d | ( | double | angle | ) |
Appends a 2-d rotation to the current transform.
The rotation angle is specified in degrees counterclockwise about the origin.
addRotate3d | ( | const LQuaterniond | quat | ) |
Appends an arbitrary 3-d rotation to the current transform, expressed as a quaternion.
This is converted to axis-angle notation for the egg file.
addRotate3d | ( | double | angle, |
const LVector3d | axis | ||
) |
Appends a 3-d rotation about an arbitrary axis to the current transform.
The rotation angle is specified in degrees counterclockwise about the axis.
addRotx | ( | double | angle | ) |
Appends a rotation about the X axis to the current transform.
The rotation angle is specified in degrees counterclockwise about the axis.
addRoty | ( | double | angle | ) |
Appends a rotation about the Y axis to the current transform.
The rotation angle is specified in degrees counterclockwise about the axis.
addRotz | ( | double | angle | ) |
Appends a rotation about the Z axis to the current transform.
The rotation angle is specified in degrees counterclockwise about the axis.
addScale2d | ( | const LVecBase2d | scale | ) |
Appends a possibly non-uniform scale to the current transform.
addScale3d | ( | const LVecBase3d | scale | ) |
Appends a possibly non-uniform scale to the current transform.
addTranslate2d | ( | const LVector2d | translate | ) |
Appends a 2-d translation operation to the current transform.
addTranslate3d | ( | const LVector3d | translate | ) |
Appends a 3-d translation operation to the current transform.
addUniformScale | ( | double | scale | ) |
Appends a uniform scale to the current transform.
clearTransform | ( | ) |
Resets the transform to empty, identity.
const LMatrix3d getComponentMat3 | ( | int | n | ) |
Returns the 3x3 matrix associated with the nth component.
It is an error to call this if the component type is not CT_matrix3.
const LMatrix4d getComponentMat4 | ( | int | n | ) |
Returns the 4x4 matrix associated with the nth component.
It is an error to call this if the component type is not CT_matrix4.
double getComponentNumber | ( | int | n | ) |
Returns the solitary number associated with the nth component.
In the case of a rotation, this is the angle in degrees to rotate; in the case of uniform scale, this is the amount of the scale. Other types do not use this property.
EggTransform::ComponentType getComponentType | ( | int | n | ) |
Returns the type of the nth component.
const LVecBase2d getComponentVec2 | ( | int | n | ) |
Returns the 2-component vector associated with the nth component.
This may be the translate vector, rotate axis, or non-uniform scale. It is an error to call this if the component type does not use a 2-d vector property.
const LVecBase3d getComponentVec3 | ( | int | n | ) |
Returns the 3-component vector associated with the nth component.
This may be the translate vector, rotate axis, or non-uniform scale. It is an error to call this if the component type does not use a 3-d vector property.
int getNumComponents | ( | ) |
Returns the number of components that make up the transform.
LMatrix3d getTransform2d | ( | ) |
Returns the overall transform as a 3x3 matrix.
It is an error to call this if has_transform3d() is true.
const LMatrix4d getTransform3d | ( | ) |
Returns the overall transform as a 4x4 matrix.
It is valid to call this even if has_transform2d() is true; in this case, the 3x3 transform will be expanded to a 4x4 matrix.
bool hasTransform | ( | ) |
Returns true if the transform is nonempty, false if it is empty (no transform components have been added).
This is true for either a 2-d or a 3-d transform.
bool hasTransform2d | ( | ) |
Returns true if the transform is specified as a 2-d transform, e.g.
with a 3x3 matrix, or false if it is specified as a 3-d transform (with a 4x4 matrix), or not specified at all.
Normally, EggTextures have a 2-d matrix (but occasionally they use a 3-d matrix), and EggGroups always have a 3-d matrix.
bool hasTransform3d | ( | ) |
Returns true if the transform is specified as a 3-d transform, e.g.
with a 4x4 matrix, or false if it is specified as a 2-d transform (with a 2x2 matrix), or not specified at all.
Normally, EggTextures have a 3-d matrix (but occasionally they use a 3-d matrix), and EggGroups always have a 3-d matrix.
EggTransform operator= | ( | const EggTransform | copy | ) |
setTransform2d | ( | const LMatrix3d | mat | ) |
Sets the overall transform as a 3x3 matrix.
This completely replaces whatever componentwise transform may have been defined.
setTransform3d | ( | const LMatrix4d | mat | ) |
Sets the overall transform as a 4x4 matrix.
This completely replaces whatever componentwise transform may have been defined.
bool transformIsIdentity | ( | ) |
Returns true if the described transform is identity, false otherwise.
write | ( | Ostream | out, |
int | indent_level, | ||
str | label | ||
) |
Writes the transform to the indicated stream in Egg format.