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:

vl::Object vl::Billboard

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
Transformchild (int i)
TransformlastChild ()
void eraseChild (Transform *child)
void eraseChildren (int index, int count)
void eraseAllChildren ()
void eraseAllChildrenRecursive ()
const Transformparent () const
Transformparent ()
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 mat4localMatrix () 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 mat4worldMatrix () 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
TransformmParent
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

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


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

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Tue Dec 29 13:57:03 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.