# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

# vl::Transform Class Reference

Implements a 4x4 matrix transform usually used to define the position and orientation of an Actor. More...

`#include <Transform.hpp>`

Inheritance diagram for vl::Transform:

List of all members.

## Public Member Functions

virtual const char * | className ()
| Returns the name of the class.
| Transform ()
| Transform (const mat4 &matrix)
virtual | ~Transform ()
void | addChild (Transform *child)
void | setChild (int index, Transform *child)
int | childCount () const
Transform * | child (int i)
Transform * | lastChild ()
void | eraseChild (Transform *child)
void | eraseChildren (int index, int count)
void | eraseAllChildren ()
void | eraseAllChildrenRecursive ()
const Transform * | parent () const
Transform * | parent ()
mat4 | getComputedWorldMatrix ()
| Returns the matrix computed concatenating this transform's matrix with its parents'.
void | setLocalMatrix (const mat4 &matrix)
| Sets the local matrix. After calling this you might want to call computeWorldMatrix() or computeWorldMatrixRecursive().
const mat4 & | localMatrix () const
| Returns the local matrix.
void | translate (Real x, Real y, Real z)
| Utility function equivalent to `setLocalMatrix`( mat4::translation(x,y,z)*localMatrix() ).
void | translate (const vec3 &t)
| Utility function equivalent to `setLocalMatrix`( mat4::translation(t)*localMatrix() ).
void | scale (Real x, Real y, Real z)
| Utility function equivalent to `setLocalMatrix`( mat4::scaling(x,y,z)*localMatrix() ).
void | rotate (Real degrees, Real x, Real y, Real z)
| Utility function equivalent to `setLocalMatrix`( mat4::rotation(degrees,x,y,z)*localMatrix() ).
void | rotate (const vec3 &from, const vec3 &to)
| Utility function equivalent to `setLocalMatrix`( mat4::rotation(from,to)*localMatrix() ).
virtual void | computeWorldMatrix (Camera *camera=NULL)
void | computeWorldMatrixRecursive (Camera *camera=NULL)
const mat4 & | worldMatrix () const
long long | worldMatrixUpdateTick () const
void | setAlwaysIdentityWorldMatrix (bool assume_I)
| If set to true the world matrix of this transform will always be considered and identity.
bool | alwaysIdentityWorldMatrix ()
| If set to true the world matrix of this transform will always be considered and identity.

## Protected Member Functions

void | setWorldMatrix (const mat4 &matrix)

## Protected Attributes

mat4 | mWorldMatrix
mat4 | mLocalMatrix
std::vector< ref< Transform > > | mChildren
Transform * | mParent
long long | mWorldMatrixUpdateTick
bool | mAssumeIdentityWorldMatrix

## Detailed Description

Implements a 4x4 matrix transform usually used to define the position and orientation of an Actor.

Transforms can be linked together to create a tree-like hierarchy.

See also:
  Actor, Effect, Renderable, Geometry

## Constructor & Destructor Documentation

vl::Transform::Transform | ( |  | ) | `[inline]`

vl::Transform::Transform | ( | const mat4 & | matrix | ) | `[inline]`

Transform::~Transform | ( |  | ) | `[virtual]`

## Member Function Documentation

virtual const char* vl::Transform::className | ( |  | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::Object.

Reimplemented in vl::Billboard.

void Transform::addChild | ( | Transform * | child | ) |

void Transform::setChild | ( | int | index,
|  | Transform * | child |
| ) |  |  |

int Transform::childCount | ( |  | ) | const

Transform * Transform::child | ( | int | i | ) |

Transform * Transform::lastChild | ( |  | ) |

void Transform::eraseChild | ( | Transform * | child | ) |

void Transform::eraseChildren | ( | int | index,
|  | int | count |
| ) |  |  |

void Transform::eraseAllChildren | ( |  | ) |

void Transform::eraseAllChildrenRecursive | ( |  | ) |

const Transform* vl::Transform::parent | ( |  | ) | const`[inline]`

Transform* vl::Transform::parent | ( |  | ) | `[inline]`

mat4 Transform::getComputedWorldMatrix | ( |  | ) |

Returns the matrix computed concatenating this transform's matrix with its parents'.

void Transform::setLocalMatrix | ( | const mat4 & | matrix | ) |

Sets the local matrix. After calling this you might want to call computeWorldMatrix() or computeWorldMatrixRecursive().

const mat4 & Transform::localMatrix | ( |  | ) | const

Returns the local matrix.

void Transform::translate | ( | Real | x,
|  | Real | y,
|  | Real | z |
| ) |  |  |

Utility function equivalent to `setLocalMatrix`( mat4::translation(x,y,z)*localMatrix() ).

void Transform::translate | ( | const vec3 & | t | ) |

Utility function equivalent to `setLocalMatrix`( mat4::translation(t)*localMatrix() ).

void Transform::scale | ( | Real | x,
|  | Real | y,
|  | Real | z |
| ) |  |  |

Utility function equivalent to `setLocalMatrix`( mat4::scaling(x,y,z)*localMatrix() ).

void Transform::rotate | ( | Real | degrees,
|  | Real | x,
|  | Real | y,
|  | Real | z |
| ) |  |  |

Utility function equivalent to `setLocalMatrix`( mat4::rotation(degrees,x,y,z)*localMatrix() ).

void Transform::rotate | ( | const vec3 & | from,
|  | const vec3 & | to |
| ) |  |  |

Utility function equivalent to `setLocalMatrix`( mat4::rotation(from,to)*localMatrix() ).

void Transform::computeWorldMatrix | ( | Camera * | camera = `NULL` | ) | `[virtual]`

Reimplemented in vl::Billboard.

void Transform::computeWorldMatrixRecursive | ( | Camera * | camera = `NULL` | ) |

const mat4 & Transform::worldMatrix | ( |  | ) | const

long long vl::Transform::worldMatrixUpdateTick | ( |  | ) | const`[inline]`

void vl::Transform::setAlwaysIdentityWorldMatrix | ( | bool | assume_I | ) | `[inline]`

If set to true the world matrix of this transform will always be considered and identity.

Is usually used to save calculations for top Transforms with many sub-Transforms.

bool vl::Transform::alwaysIdentityWorldMatrix | ( |  | ) | `[inline]`

If set to true the world matrix of this transform will always be considered and identity.

Is usually used to save calculations for top Transforms with many sub-Transforms.

void Transform::setWorldMatrix | ( | const mat4 & | matrix | ) | `[protected]`

## Member Data Documentation

mat4 vl::Transform::mWorldMatrix`[protected]`

mat4 vl::Transform::mLocalMatrix`[protected]`

std::vector< ref<Transform> > vl::Transform::mChildren`[protected]`

Transform* vl::Transform::mParent`[protected]`

long long vl::Transform::mWorldMatrixUpdateTick`[protected]`

bool vl::Transform::mAssumeIdentityWorldMatrix`[protected]`

The documentation for this class was generated from the following files:

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/Transform.hpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/Transform.cpp

Visualization Library v2009.07 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Mon Aug 10 21:41:44 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.