Class ShadowOpenGLMatrix

java.lang.Object
org.robolectric.shadows.ShadowOpenGLMatrix

@Implements(android.opengl.Matrix.class) public class ShadowOpenGLMatrix extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static void
    multiplyMM(float[] result, int resultOffset, float[] lhs, int lhsOffset, float[] rhs, int rhsOffset)
    Multiplies two 4x4 matrices together and stores the result in a third 4x4 matrix.
    protected static void
    multiplyMV(float[] resultVec, int resultVecOffset, float[] lhsMat, int lhsMatOffset, float[] rhsVec, int rhsVecOffset)
    Multiplies a 4 element vector by a 4x4 matrix and stores the result in a 4-element column vector.

    Methods inherited from class java.lang.Object

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

    • ShadowOpenGLMatrix

      public ShadowOpenGLMatrix()
  • Method Details

    • multiplyMM

      @Implementation(maxSdk=33) protected static void multiplyMM(float[] result, int resultOffset, float[] lhs, int lhsOffset, float[] rhs, int rhsOffset)
      Multiplies two 4x4 matrices together and stores the result in a third 4x4 matrix. In matrix notation: result = lhs x rhs. Due to the way matrix multiplication works, the result matrix will have the same effect as first multiplying by the rhs matrix, then multiplying by the lhs matrix. This is the opposite of what you might expect.

      The same float array may be passed for result, lhs, and/or rhs. However, the result element values are undefined if the result elements overlap either the lhs or rhs elements.

      Parameters:
      result - The float array that holds the result.
      resultOffset - The offset into the result array where the result is stored.
      lhs - The float array that holds the left-hand-side matrix.
      lhsOffset - The offset into the lhs array where the lhs is stored
      rhs - The float array that holds the right-hand-side matrix.
      rhsOffset - The offset into the rhs array where the rhs is stored.
      Throws:
      IllegalArgumentException - if result, lhs, or rhs are null, or if resultOffset + 16 > result.length or lhsOffset + 16 > lhs.length or rhsOffset + 16 > rhs.length.
    • multiplyMV

      @Implementation(maxSdk=33) protected static void multiplyMV(float[] resultVec, int resultVecOffset, float[] lhsMat, int lhsMatOffset, float[] rhsVec, int rhsVecOffset)
      Multiplies a 4 element vector by a 4x4 matrix and stores the result in a 4-element column vector. In matrix notation: result = lhs x rhs

      The same float array may be passed for resultVec, lhsMat, and/or rhsVec. However, the resultVec element values are undefined if the resultVec elements overlap either the lhsMat or rhsVec elements.

      Parameters:
      resultVec - The float array that holds the result vector.
      resultVecOffset - The offset into the result array where the result vector is stored.
      lhsMat - The float array that holds the left-hand-side matrix.
      lhsMatOffset - The offset into the lhs array where the lhs is stored
      rhsVec - The float array that holds the right-hand-side vector.
      rhsVecOffset - The offset into the rhs vector where the rhs vector is stored.
      Throws:
      IllegalArgumentException - if resultVec, lhsMat, or rhsVec are null, or if resultVecOffset + 4 > resultVec.length or lhsMatOffset + 16 > lhsMat.length or rhsVecOffset + 4 > rhsVec.length.