/// <summary> /// Extract the far plane from a model-view-projection matrix. /// </summary> /// <param name="mvp"> /// The <see cref="Matrix4x4f"/> that specify the matrix used for drawing the clipped object. /// </param> /// <returns> /// It returns a <see cref="Planef"/> defining the far clipping plane. /// </returns> public static Planef GetFrustumFarPlane(Matrix4x4f mvp) { Planef plane = NormalizePlane(mvp.Row3 - mvp.Row2); plane.Distance = -plane.Distance; return(plane); }
/// <summary> /// Extract all six planes from a model-view-projection matrix. /// </summary> /// <param name="mvp"> /// The <see cref="Matrix4x4f"/> that specify the matrix used for drawing the clipped object. /// </param> /// <returns> /// It returns a <see cref="IEnumerable{Planef}"/> containing all six clipping planes defined /// by <paramref name="mvp"/>. /// </returns> public static IEnumerable <Planef> GetFrustumPlanes(Matrix4x4f mvp) { return(new List <Planef>(6) { GetFrustumLeftPlane(mvp), GetFrustumRightPlane(mvp), GetFrustumNearPlane(mvp), GetFrustumFarPlane(mvp), GetFrustumBottomPlane(mvp), GetFrustumTopPlane(mvp) }); }
/// <summary> /// Extract the top plane from a model-view-projection matrix. /// </summary> /// <param name="mvp"> /// The <see cref="Matrix4x4f"/> that specify the matrix used for drawing the clipped object. /// </param> /// <returns> /// It returns a <see cref="Planef"/> defining the top clipping plane. /// </returns> public static Planef GetFrustumTopPlane(Matrix4x4f mvp) { return(NormalizePlane(mvp.Row0 - mvp.Row1)); }
/// <summary> /// Extract the bottom plane from a model-view-projection matrix. /// </summary> /// <param name="mvp"> /// The <see cref="Matrix4x4f"/> that specify the matrix used for drawing the clipped object. /// </param> /// <returns> /// It returns a <see cref="Planef"/> defining the bottom clipping plane. /// </returns> public static Planef GetFrustumBottomPlane(Matrix4x4f mvp) { return(NormalizePlane(mvp.Row0 + mvp.Row1)); }
/// <summary> /// Extract the right plane from a model-view-projection matrix. /// </summary> /// <param name="mvp"> /// The <see cref="Matrix4x4f"/> that specify the matrix used for drawing the clipped object. /// </param> /// <returns> /// It returns a <see cref="Planef"/> defining the right clipping plane. /// </returns> public static Planef GetFrustumRightPlane(Matrix4x4f mvp) { return(NormalizePlane(mvp.Row3 - mvp.Row0)); }