com.threed.jpct
Class BufferedMatrix

java.lang.Object
  extended bycom.threed.jpct.BufferedMatrix
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Camera

public class BufferedMatrix
extends java.lang.Object
implements java.io.Serializable

A BufferedMatrix is a kind of double buffered Matrix. It is used for implementing the Camera, so that the Camera could be manipulated in a Thread without affecting the current rendering taking place in another Thread.
A buffered matrix contains a frontbuffer matrix (used for rendering) and a backbuffer matrix (used for manipulation). In case of the Camera, the backbuffer matrix will automatically be copied into the frontbuffer matrix before the rendering starts.

See Also:
Serialized Form

Method Summary
 void copyBackToFront()
          Copy the backbuffer matrix into the frontbuffer matrix.
 Matrix getBack()
          Returns the Matrix that is used as the backbuffer matrix.
 Matrix getFront()
          Returns the Matrix that is used as the frontbuffer matrix.
 void matMul(Matrix mat2)
          Multiplies the backbuffer matrix with another one.
 void rotateAxis(SimpleVector axis, float angle)
          Rotates the backbuffer matrix around an arbitrary axis.
 void rotateX(float angle)
          Rotates the backbuffer matrix around the x-axis.
 void rotateY(float angle)
          Rotates the backbuffer matrix around the y-axis.
 void rotateZ(float angle)
          Rotates the backbuffer matrix around the z-axis.
 void setBack(Matrix mat)
          Sets the backbuffer matrix.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

rotateAxis

public void rotateAxis(SimpleVector axis,
                       float angle)
Rotates the backbuffer matrix around an arbitrary axis. The method is more powerful than the normal rotate-around-an-axis methods, but also a bit slower. The resulting matrix will be orthonormalized to ensure numerical accuracy.

Parameters:
axis - a direction-vector pointing into the axis direction
angle - the angle of the rotation

rotateX

public void rotateX(float angle)
Rotates the backbuffer matrix around the x-axis.

Parameters:
angle - the angle

rotateY

public void rotateY(float angle)
Rotates the backbuffer matrix around the y-axis.

Parameters:
angle - the angle

rotateZ

public void rotateZ(float angle)
Rotates the backbuffer matrix around the z-axis.

Parameters:
angle - the angle

matMul

public void matMul(Matrix mat2)
Multiplies the backbuffer matrix with another one.

Parameters:
mat2 - the matrix to multiply with

copyBackToFront

public void copyBackToFront()
Copy the backbuffer matrix into the frontbuffer matrix. For the Camera, this is done automatically.


getFront

public Matrix getFront()
Returns the Matrix that is used as the frontbuffer matrix. Shouldn't be required in normal application use.

Returns:
the frontbuffer matrix

getBack

public Matrix getBack()
Returns the Matrix that is used as the backbuffer matrix.

Returns:
the backbuffer matrix

setBack

public void setBack(Matrix mat)
Sets the backbuffer matrix.

Parameters:
mat - the new backbuffer matrix