de.jreality.util
Class DefaultMatrixSupport

java.lang.Object
  extended by de.jreality.util.DefaultMatrixSupport

public class DefaultMatrixSupport
extends Object

Utility to store default matrices for Transformations. For convienience, there is one shared instance.

Author:
weissman

Constructor Summary
DefaultMatrixSupport()
           
 
Method Summary
static DefaultMatrixSupport getSharedInstance()
           
 void restoreDefault(Transformation trafo, boolean clear)
          Restores the default matrix if there is any, otherwise assigns the identity matrix or does nothing, depending on the clear flag.
 void restoreDefaultMatrices(SceneGraphComponent root, boolean clear)
           
 void storeAsDefault(Transformation trafo)
          Stores the current matrix of trafo as its default matrix.
 void storeDefault(Transformation trafo, double[] defMatrix)
          Stores the given array as default matrix for trafo.
 void storeDefaultMatrices(SceneGraphComponent root)
          Traverses thetree from the given root and calls storeDefault for all Transformations.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMatrixSupport

public DefaultMatrixSupport()
Method Detail

getSharedInstance

public static DefaultMatrixSupport getSharedInstance()

storeDefault

public void storeDefault(Transformation trafo,
                         double[] defMatrix)
Stores the given array as default matrix for trafo.

Parameters:
trafo - the trafo for which to set the default matrix
defMatrix - the default matrix for trafo

storeAsDefault

public void storeAsDefault(Transformation trafo)
Stores the current matrix of trafo as its default matrix.

Parameters:
trafo - the trafo

restoreDefault

public void restoreDefault(Transformation trafo,
                           boolean clear)
Restores the default matrix if there is any, otherwise assigns the identity matrix or does nothing, depending on the clear flag.

Parameters:
trafo - the trafo to restore
clear - determines the behaviour for Transformations without a default matrix: if true, set to the indentity - if false, do nothing.

restoreDefaultMatrices

public void restoreDefaultMatrices(SceneGraphComponent root,
                                   boolean clear)

storeDefaultMatrices

public void storeDefaultMatrices(SceneGraphComponent root)
Traverses thetree from the given root and calls storeDefault for all Transformations.

Parameters:
root - the root of the subgraph to traverse