public static void frustumM ( float [ ] m , int offset , float left , float right , float bottom , float top , float near , float far ) { if ( left == right ) { throw new IllegalArgumentException ( "left == right" ) ; } if ( top == bottom ) { throw new IllegalArgumentException ( "top == bottom" ) ; } if ( near == far ) { throw new IllegalArgumentException ( "near == far" ) ; } if ( near <= 0.0f ) { throw new IllegalArgumentException ( "near <= 0.0f" ) ; } if ( far <= 0.0f ) { throw new IllegalArgumentException ( "far <= 0.0f" ) ; } final float r_width = 1.0f / ( right - left ) ; final float r_height = 1.0f / ( top - bottom ) ; final float r_depth = 1.0f / ( near - far ) ; final float x = 2.0f * ( near * r_width ) ; final float y = 2.0f * ( near * r_height ) ; final float A = ( right + left ) * r_width ; final float B = ( top + bottom ) * r_height ; final float C = ( far + near ) * r_depth ; final float D = 2.0f * ( far * near * r_depth ) ; m [ offset + 0 ] = x ; m [ offset + 5 ] = y ; m [ offset + 8 ] = A ; m [ offset + 9 ] = B ; m [ offset + 10 ] = C ; m [ offset + 14 ] = D ; m [ offset + 11 ] = - 1.0f ; m [ offset + 1 ] = 0.0f ; m [ offset + 2 ] = 0.0f ; m [ offset + 3 ] = 0.0f ; m [ offset + 4 ] = 0.0f ; m [ offset + 6 ] = 0.0f ; m [ offset + 7 ] = 0.0f ; m [ offset + 12 ] = 0.0f ; m [ offset + 13 ] = 0.0f ; m [ offset + 15 ] = 0.0f ; }
Define a projection matrix in terms of six clip planes