CSharpGL.glm.tweakedInfinitePerspective C# (CSharp) Method

tweakedInfinitePerspective() public static method

Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
public static tweakedInfinitePerspective ( float fovy, float aspect, float zNear ) : CSharpGL.mat4
fovy float The fovy.
aspect float The aspect.
zNear float The z near.
return CSharpGL.mat4
        public static mat4 tweakedInfinitePerspective(float fovy, float aspect, float zNear)
        {
            float range = tan(fovy / (2)) * zNear;
            float left = -range * aspect;
            float right = range * aspect;
            float bottom = -range;
            float top = range;

            mat4 Result = new mat4((0f));
            Result[0, 0] = ((2) * zNear) / (right - left);
            Result[1, 1] = ((2) * zNear) / (top - bottom);
            Result[2, 2] = (0.0001f) - (1f);
            Result[2, 3] = (-1);
            Result[3, 2] = -((0.0001f) - (2)) * zNear;
            return Result;
        }