DD::Image::MatrixArray Class Reference

List of all members.

Public Member Functions

 MatrixArray (const MatrixArray &)
 MatrixArray (const Matrix4 &object, const Matrix4 &camera, const Matrix4 &projection, const Matrix4 &format)
int num_matrices () const
const Matrix4object_matrix () const
void set_object_matrix (const Matrix4 &m)
const Matrix4camera_matrix () const
void set_camera_matrix (const Matrix4 &m)
const Matrix4projection_matrix () const
void set_projection_matrix (const Matrix4 &m)
void set_format_matrix (const Matrix4 &m)
const Matrix4format_matrix () const
const Matrix4matrix (int n)
const Matrix4matrix (int from, int to)
const Matrix4inverse_matrix (int n)
const Matrix4inverse_matrix (int from, int to)
const Matrix4operator[] (int n)
void reset ()
void calculate_all_now ()
void print_info (const char *title)

Detailed Description

An array of Matrix4 transformation matrices organized into a square matrix for constructing fast from/to transform-space conversions. This structure keeps track of the dependencies between the transform matrices so that if one changes which others depend on, the dependent matrices are automatically recalculated when they are next accessed. This mechanism reduces the overhead required in keeping all the transforms up-to-date, specifically keeping the number of expensive matrix inversions at a minimum.


Member Function Documentation

void MatrixArray::set_object_matrix ( const Matrix4 m)

Update the transform matrix array with a new object matrix. The matrices that are dependant upon it are marked invalid.

Referenced by DD::Image::Scene::evaluate_lights(), DD::Image::ParticlesSprite::tessellate(), and DD::Image::Scene::validate().

void MatrixArray::set_camera_matrix ( const Matrix4 m)

Update the transform matrix array with a new camera matrix. The matrices that are dependant upon it are marked invalid.

Referenced by DD::Image::Render::_validate(), and DD::Image::Scene::evaluate_lights().

void MatrixArray::set_projection_matrix ( const Matrix4 m)

Update the transform matrix array with a new projection matrix. The matrices that are dependant upon it are marked invalid.

Referenced by DD::Image::Render::_validate(), and DD::Image::Scene::evaluate_lights().

void MatrixArray::set_format_matrix ( const Matrix4 m)

Update the transform matrix array with a new format matrix. The matrices that are dependant upon it are marked invalid.

Referenced by DD::Image::Render::_validate(), and DD::Image::Scene::evaluate_lights().

const Matrix4 & MatrixArray::matrix ( int  n)

Return the 4x4 matrix at entry 'n'. Check if it's been calculated yet(validated.) If not, call matrix() on the dependency matrix until we can return a result (a dependency matrix may in turn have a dependency it must also resolve, so this can be a recursive call.)

References DD::Image::CLIP_SPACE, DD::Image::EYE_SPACE, and DD::Image::WORLD_SPACE.

Referenced by DD::Image::rPoint::add_to_render(), DD::Image::MBParticleSpriteGenerator::getSprite(), DD::Image::SpriteGenerator::getSprite(), and DD::Image::Scene::validate().

void MatrixArray::reset ( )

Reset all matrices to their identity.

Referenced by DD::Image::Scene::Scene().

void MatrixArray::calculate_all_now ( )

Calculate all invalid matrices for testing purposes. Only use this for testing as it will calculate all the inverses!

References DD::Image::LOCAL_SPACE, and DD::Image::SCREEN_SPACE.