CSharpGL.glm.frustum C# (CSharp) Method

frustum() public static method

Creates a frustrum projection matrix.
public static frustum ( float left, float right, float bottom, float top, float nearVal, float farVal ) : CSharpGL.mat4
left float The left.
right float The right.
bottom float The bottom.
top float The top.
nearVal float The near val.
farVal float The far val.
return CSharpGL.mat4
        public static mat4 frustum(float left, float right, float bottom, float top, float nearVal, float farVal)
        {
            var result = mat4.identity();

            result[0, 0] = (2.0f * nearVal) / (right - left);
            result[1, 1] = (2.0f * nearVal) / (top - bottom);
            result[2, 0] = (right + left) / (right - left);
            result[2, 1] = (top + bottom) / (top - bottom);
            result[2, 2] = -(farVal + nearVal) / (farVal - nearVal);
            result[2, 3] = -1.0f;
            result[3, 2] = -(2.0f * farVal * nearVal) / (farVal - nearVal);
            result[3, 3] = 0.0f;

            return result;
        }