Class SoModelMatrixElement

Direct Known Subclasses:
SoBBoxModelMatrixElement, SoModelScaleElement

public class SoModelMatrixElement extends SoAccumulatedElement
Stores the current model matrix. This element stores the current model matrix - the cumulative transformation applied to subsequent shapes. Because the matrix is cumulative, this class is derived from SoAccumulatedElement. The set() method replaces the current matrix, while all the others (mult(), translateBy(), etc.) multiply into it. Node id's of the nodes that affect the element are accumulated properly.

This element also stores the current view-volume culling transformation, which is normally the view*projection matrices (set by cameras), but which may be modified by sophisticated culling schemes.

See Also:
  • Method Details

    • set

      public static void set(SoState state, SoNode node, SbMatrix matrix)
      Calls set(state, node, matrix, true).
    • getClassStackIndex

      @Deprecated(since="9.3.0.0") public static int getClassStackIndex()
      Deprecated.
      As of Open Inventor 9.3.0.0. replaced by SoElement.getClassStackIndex(Class)
      Returns the stack id for this element. ] *
    • push

      public void push(SoState state)
      Overrides push() method to copy values from next instance in the stack.
      Overrides:
      push in class SoAccumulatedElement
    • setCullMatrix

      public static void setCullMatrix(SoState state, SoNode node, SbMatrix matrix)
      Sets the transformation that defines the volume that view-volume culling should be tested against.
    • makeIdentity

      public static void makeIdentity(SoState state, SoNode node)
      Sets the model matrix to the identity matrix.
    • popMatrix

      public static void popMatrix(SoState state, SbMatrix m)
      This method is used by the TransformSeparator node. WARNING! For proper caching behavior, the matrix returned by .pushMatrix() must be used ONLY as a later argument to .popMatrix(), and you must NOT modify the matrix between the push and the pop. If you need the matrix for any other reason, you MUST use the .get() routine.
    • pushMatrix

      public static SbMatrix pushMatrix(SoState state)
      This method is used by the TransformSeparator node. WARNING! For proper caching behavior, the matrix returned by .pushMatrix() must be used ONLY as a later argument to .popMatrix(), and you must NOT modify the matrix between the push and the pop. If you need the matrix for any other reason, you MUST use the .get() routine.
    • getCombinedCullMatrix

      public static SbMatrix getCombinedCullMatrix(SoState state)
      This method gets the model*cullMatrix combined matrix (which is cached by this element).
    • get

      public static SbMatrix get(SoState state)
      Returns current model matrix from the state.
    • mult

      public static void mult(SoState state, SoNode node, SbMatrix matrix)
      Multiplies the given matrix into the model matrix.
    • set

      public static void set(SoState state, SoNode node, SbMatrix matrix, boolean sendToGL)
      Sets the model matrix to the given matrix. This method will (indirectly) call glLoadMatrix with the new matrix unless the 'sendToGL' parameter is explicitly false.
    • translateBy

      public static void translateBy(SoState state, SoNode node, SbVec3f translation)
      This multiplies a matrix that performs the specified transformation into the model matrix.
    • scaleBy

      public static void scaleBy(SoState state, SoNode node, SbVec3f scaleFactor)
      This multiplies a matrix that performs the specified transformation into the model matrix.
    • rotateBy

      public static void rotateBy(SoState state, SoNode node, SbRotation rotation)
      This multiplies a matrix that performs the specified transformation into the model matrix.