|
|
|
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...
#include "eggTransform.h"
List of all members.
Classes |
| class | Component |
Public Types |
| enum | ComponentType {
CT_invalid,
CT_translate2d,
CT_translate3d,
CT_rotate2d,
CT_rotx,
CT_roty,
CT_rotz,
CT_rotate3d,
CT_scale2d,
CT_scale3d,
CT_uniform_scale,
CT_matrix3,
CT_matrix4
} |
Public Member Functions |
|
| EggTransform (const EggTransform ©) |
| void | add_matrix3 (const LMatrix3d &mat) |
| | Appends an arbitrary 3x3 matrix to the current transform.
|
| void | add_matrix4 (const LMatrix4d &mat) |
| | Appends an arbitrary 4x4 matrix to the current transform.
|
| void | add_rotate2d (double angle) |
| | Appends a 2-d rotation to the current transform.
|
| void | add_rotate3d (double angle, const LVector3d &axis) |
| | Appends a 3-d rotation about an arbitrary axis to the current transform.
|
| void | add_rotate3d (const LQuaterniond &quat) |
| | Appends an arbitrary 3-d rotation to the current transform, expressed as a quaternion.
|
| void | add_rotx (double angle) |
| | Appends a rotation about the X axis to the current transform.
|
| void | add_roty (double angle) |
| | Appends a rotation about the Y axis to the current transform.
|
| void | add_rotz (double angle) |
| | Appends a rotation about the Z axis to the current transform.
|
| void | add_scale2d (const LVecBase2d &scale) |
| | Appends a possibly non-uniform scale to the current transform.
|
| void | add_scale3d (const LVecBase3d &scale) |
| | Appends a possibly non-uniform scale to the current transform.
|
| void | add_translate2d (const LVector2d &translate) |
| | Appends a 2-d translation operation to the current transform.
|
| void | add_translate3d (const LVector3d &translate) |
| | Appends a 3-d translation operation to the current transform.
|
| void | add_uniform_scale (double scale) |
| | Appends a uniform scale to the current transform.
|
| void | clear_transform () |
| | Resets the transform to empty, identity.
|
| const LMatrix3d & | get_component_mat3 (int n) const |
| | Returns the 3x3 matrix associated with the nth component.
|
| const LMatrix4d & | get_component_mat4 (int n) const |
| | Returns the 4x4 matrix associated with the nth component.
|
| double | get_component_number (int n) const |
| | Returns the solitary number associated with the nth component.
|
| ComponentType | get_component_type (int n) const |
| | Returns the type of the nth component.
|
| const LVecBase2d & | get_component_vec2 (int n) const |
| | Returns the 2-component vector associated with the nth component.
|
| const LVecBase3d & | get_component_vec3 (int n) const |
| | Returns the 3-component vector associated with the nth component.
|
| int | get_num_components () const |
| | Returns the number of components that make up the transform.
|
| LMatrix3d | get_transform2d () const |
| | Returns the overall transform as a 3x3 matrix.
|
| const LMatrix4d & | get_transform3d () const |
| | Returns the overall transform as a 4x4 matrix.
|
| bool | has_transform () const |
| | Returns true if the transform is nonempty, false if it is empty (no transform components have been added).
|
| bool | has_transform2d () const |
| | Returns true if the transform is specified as a 2-d transform, e.g.
|
| bool | has_transform3d () const |
| | Returns true if the transform is specified as a 3-d transform, e.g.
|
|
EggTransform & | operator= (const EggTransform ©) |
| void | set_transform2d (const LMatrix3d &mat) |
| | Sets the overall transform as a 3x3 matrix.
|
| void | set_transform3d (const LMatrix4d &mat) |
| | Sets the overall transform as a 4x4 matrix.
|
| bool | transform_is_identity () const |
| | Returns true if the described transform is identity, false otherwise.
|
| void | write (ostream &out, int indent_level, const string &label) const |
| | Writes the transform to the indicated stream in Egg format.
|
Protected Member Functions |
| void | internal_add_matrix (const LMatrix3d &mat) |
| | Appends an arbitrary 4x4 matrix to the current transform, without calling transform_changed().
|
| void | internal_add_matrix (const LMatrix4d &mat) |
| | Appends an arbitrary 4x4 matrix to the current transform, without calling transform_changed().
|
| void | internal_clear_transform () |
| | Resets the transform to empty without calling transform_changed().
|
| void | internal_set_transform (const LMatrix3d &mat) |
| | Sets the overall transform without calling transform_changed().
|
| void | internal_set_transform (const LMatrix4d &mat) |
| | Sets the overall transform without calling transform_changed().
|
| virtual void | transform_changed () |
| | This virtual method is called whenever the transform is changed; it is intended to provide a hook for derived classes (e.g.
|
Detailed Description
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.
Definition at line 33 of file eggTransform.h.
Member Function Documentation
| void EggTransform::add_matrix3 |
( |
const LMatrix3d & |
mat | ) |
[inline] |
| void EggTransform::add_matrix4 |
( |
const LMatrix4d & |
mat | ) |
[inline] |
| void EggTransform::add_rotate2d |
( |
double |
angle | ) |
|
| void EggTransform::add_rotate3d |
( |
double |
angle, |
|
|
const LVector3d & |
axis |
|
) |
| |
| void EggTransform::add_rotate3d |
( |
const LQuaterniond & |
quat | ) |
|
| void EggTransform::add_rotx |
( |
double |
angle | ) |
|
| void EggTransform::add_roty |
( |
double |
angle | ) |
|
| void EggTransform::add_rotz |
( |
double |
angle | ) |
|
| void EggTransform::add_scale2d |
( |
const LVecBase2d & |
scale | ) |
|
| void EggTransform::add_scale3d |
( |
const LVecBase3d & |
scale | ) |
|
| void EggTransform::add_translate2d |
( |
const LVector2d & |
translate | ) |
|
| void EggTransform::add_translate3d |
( |
const LVector3d & |
translate | ) |
|
| void EggTransform::add_uniform_scale |
( |
double |
scale | ) |
|
| void EggTransform::clear_transform |
( |
| ) |
[inline] |
| const LMatrix3d & EggTransform::get_component_mat3 |
( |
int |
n | ) |
const [inline] |
Returns the 3x3 matrix associated with the nth component.
It is an error to call this if the component type is not CT_matrix3.
Definition at line 344 of file eggTransform.I.
References LMatrix3d::ident_mat().
Referenced by write().
| const LMatrix4d & EggTransform::get_component_mat4 |
( |
int |
n | ) |
const [inline] |
Returns the 4x4 matrix associated with the nth component.
It is an error to call this if the component type is not CT_matrix4.
Definition at line 358 of file eggTransform.I.
References LMatrix4d::ident_mat().
Referenced by write().
| double EggTransform::get_component_number |
( |
int |
n | ) |
const [inline] |
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.
Definition at line 299 of file eggTransform.I.
Referenced by write().
| EggTransform::ComponentType EggTransform::get_component_type |
( |
int |
n | ) |
const [inline] |
| const LVecBase2d & EggTransform::get_component_vec2 |
( |
int |
n | ) |
const [inline] |
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.
Definition at line 314 of file eggTransform.I.
References LVector2d::zero().
Referenced by write().
| const LVecBase3d & EggTransform::get_component_vec3 |
( |
int |
n | ) |
const [inline] |
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.
Definition at line 330 of file eggTransform.I.
References LVector3d::zero().
Referenced by write().
| int EggTransform::get_num_components |
( |
| ) |
const [inline] |
Returns the number of components that make up the transform.
Definition at line 274 of file eggTransform.I.
Referenced by write().
| LMatrix3d EggTransform::get_transform2d |
( |
| ) |
const [inline] |
| const LMatrix4d & EggTransform::get_transform3d |
( |
| ) |
const [inline] |
| bool EggTransform::has_transform |
( |
| ) |
const [inline] |
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.
Definition at line 163 of file eggTransform.I.
Referenced by EggGroup::adjust_under(), EggRenderState::fill_state(), has_transform2d(), has_transform3d(), EggTexture::is_equivalent_to(), EggPrimitive::r_apply_texmats(), EggGroup::r_transform(), EggTexture::sorts_less_than(), EggTexture::write(), and EggGroup::write().
| bool EggTransform::has_transform2d |
( |
| ) |
const [inline] |
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.
Definition at line 180 of file eggTransform.I.
References has_transform().
Referenced by TextureReference::from_egg(), and XFileVertex::set_from_egg().
| bool EggTransform::has_transform3d |
( |
| ) |
const [inline] |
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.
Definition at line 210 of file eggTransform.I.
References has_transform().
Referenced by get_transform2d(), and EggPrimitive::r_apply_texmats().
| void EggTransform::internal_add_matrix |
( |
const LMatrix3d & |
mat | ) |
[protected] |
| void EggTransform::internal_add_matrix |
( |
const LMatrix4d & |
mat | ) |
[protected] |
| void EggTransform::internal_clear_transform |
( |
| ) |
[protected] |
| void EggTransform::internal_set_transform |
( |
const LMatrix3d & |
mat | ) |
[inline, protected] |
| void EggTransform::internal_set_transform |
( |
const LMatrix4d & |
mat | ) |
[inline, protected] |
| void EggTransform::set_transform2d |
( |
const LMatrix3d & |
mat | ) |
[inline] |
| void EggTransform::set_transform3d |
( |
const LMatrix4d & |
mat | ) |
[inline] |
| void EggTransform::transform_changed |
( |
| ) |
[protected, virtual] |
This virtual method is called whenever the transform is changed; it is intended to provide a hook for derived classes (e.g.
EggGroup) to update their internal cache appropriately.
Reimplemented in EggGroup.
Definition at line 364 of file eggTransform.cxx.
Referenced by add_matrix3(), add_matrix4(), add_rotate2d(), add_rotate3d(), add_rotx(), add_roty(), add_rotz(), add_scale2d(), add_scale3d(), add_translate2d(), add_translate3d(), add_uniform_scale(), clear_transform(), set_transform2d(), and set_transform3d().
| bool EggTransform::transform_is_identity |
( |
| ) |
const [inline] |
| void EggTransform::write |
( |
ostream & |
out, |
|
|
int |
indent_level, |
|
|
const string & |
label |
|
) |
| const |
The documentation for this class was generated from the following files:
| | |