Class GLMatrix

java.lang.Object
org.oscim.renderer.GLMatrix

public class GLMatrix extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addDepthOffset(int delta)
    add some offset (similar to glDepthOffset)
    void
    Copy values from mat
    void
    Free native object
    static void
    frustumM(float[] m, int offset, float left, float right, float bottom, float top, float near, float far)
    Define a projection matrix in terms of six clip planes
    void
    get(float[] m)
    Get the Matrix as float array
    static boolean
    invertM(float[] mInv, int mInvOffset, float[] m, int mOffset)
    Inverts a 4 x 4 matrix.
    static void
    lookAt(float[] m, int offset, float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz)
     
    void
    Use this matrix as rhs, multiply it on lhs and store result.
    void
    Multiply rhs onto lhs and store result in Matrix.
    void
    Multiply rhs onto Matrix.
    static void
    orthoM(float[] m, int offset, float left, float right, float bottom, float top, float near, float far)
     
    void
    prj(float[] vec3)
    Project Vector with Matrix
    void
    prj2D(float[] src, int src_offset, float[] dst, int dst_offset, int length)
    Project Vectors with Matrix
    void
    prj2D(float[] vec2, int offset, int length)
    Project Vectors with Matrix
    void
    prj3D(float[] vec3, int offset, int length)
    Project Vectors with Matrix
    void
    set(float[] m)
    Set the Matrix from float array
    void
    setAsUniform(int location)
    Set Matrix with glUniformMatrix
    void
    Set identity matrix
    void
    setRotation(float a, float x, float y, float z)
    Set rotation
    void
    setScale(float x, float y, float z)
    Set scale factor
    void
    setTranslation(float x, float y, float z)
    Set translation
    void
    setTransScale(float tx, float ty, float scale)
    Set translation and x,y scale
    void
    setValue(int pos, float value)
    Set single value
    void
    Transpose mat and store result in Matrix

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GLMatrix

      public GLMatrix()
  • Method Details

    • set

      public void set(float[] m)
      Set the Matrix from float array
      Parameters:
      m - float array to copy
    • get

      public void get(float[] m)
      Get the Matrix as float array
      Parameters:
      m - float array to store Matrix
    • copy

      public void copy(GLMatrix mat)
      Copy values from mat
      Parameters:
      mat - Matrix to copy
    • prj

      public void prj(float[] vec3)
      Project Vector with Matrix
      Parameters:
      vec3 - Vector to project
    • prj3D

      public void prj3D(float[] vec3, int offset, int length)
      Project Vectors with Matrix
      Parameters:
      vec3 - Vector to project
    • prj2D

      public void prj2D(float[] vec2, int offset, int length)
      Project Vectors with Matrix
      Parameters:
      vec2 - Vector to project
    • prj2D

      public void prj2D(float[] src, int src_offset, float[] dst, int dst_offset, int length)
      Project Vectors with Matrix
      Parameters:
      vec2 - Vector to project
    • multiplyRhs

      public void multiplyRhs(GLMatrix rhs)
      Multiply rhs onto Matrix.
      Parameters:
      rhs - right hand side
    • multiplyLhs

      public void multiplyLhs(GLMatrix lhs)
      Use this matrix as rhs, multiply it on lhs and store result.
      Parameters:
      lhs - right hand side
    • multiplyMM

      public void multiplyMM(GLMatrix lhs, GLMatrix rhs)
      Multiply rhs onto lhs and store result in Matrix.

      This matrix MUST be different from lhs and rhs!

      when combining matrices for vector projection this has the same effect first as applying rhs then lhs.

      Parameters:
      lhs - left hand side
      rhs - right hand side
    • transposeM

      public void transposeM(GLMatrix mat)
      Transpose mat and store result in Matrix
      Parameters:
      mat - to transpose
    • setRotation

      public void setRotation(float a, float x, float y, float z)
      Set rotation
      Parameters:
      a - angle in degree
      x - around x-axis
      y - around y-axis
      z - around z-axis
    • setTranslation

      public void setTranslation(float x, float y, float z)
      Set translation
      Parameters:
      x - along x-axis
      y - along y-axis
      z - along z-axis
    • setScale

      public void setScale(float x, float y, float z)
      Set scale factor
      Parameters:
      x - axis
      y - axis
      z - axis
    • setTransScale

      public void setTransScale(float tx, float ty, float scale)
      Set translation and x,y scale
      Parameters:
      tx - translate x
      ty - translate y
      scale - factor x,y
    • setAsUniform

      public void setAsUniform(int location)
      Set Matrix with glUniformMatrix
      Parameters:
      location - GL location id
    • setValue

      public void setValue(int pos, float value)
      Set single value
      Parameters:
      pos - at position
      value - value to set
    • addDepthOffset

      public void addDepthOffset(int delta)
      add some offset (similar to glDepthOffset)
      Parameters:
      delta - offset
    • setIdentity

      public void setIdentity()
      Set identity matrix
    • finalize

      public void finalize()
      Free native object
      Overrides:
      finalize in class Object
    • frustumM

      public static void frustumM(float[] m, int offset, float left, float right, float bottom, float top, float near, float far)
      Define a projection matrix in terms of six clip planes
      Parameters:
      m - the float array that holds the perspective matrix
      offset - the offset into float array m where the perspective matrix data is written
    • invertM

      public static boolean invertM(float[] mInv, int mInvOffset, float[] m, int mOffset)
      Inverts a 4 x 4 matrix.
      Parameters:
      mInv - the array that holds the output inverted matrix
      mInvOffset - an offset into mInv where the inverted matrix is stored.
      m - the input array
      mOffset - an offset into m where the matrix is stored.
      Returns:
      true if the matrix could be inverted, false if it could not.
    • lookAt

      public static void lookAt(float[] m, int offset, float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz)
    • orthoM

      public static void orthoM(float[] m, int offset, float left, float right, float bottom, float top, float near, float far)