Ejemplo n.º 1
0
        /// <summary>
        /// Extract the near plane from a model-view-projection matrix.
        /// </summary>
        /// <param name="mvp">
        /// The <see cref="Matrix4x4d"/> that specify the matrix used for drawing the clipped object.
        /// </param>
        /// <returns>
        /// It returns a <see cref="Plane"/> defining the near clipping plane.
        /// </returns>
        public static Plane GetFrustumNearPlane(Matrix4x4d mvp)
        {
            Plane plane = NormalizePlane(NameFar, mvp.Row0 + mvp.Row2);

            plane.Distance = -plane.Distance;
            return(plane);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Extract the far plane from a model-view-projection matrix.
        /// </summary>
        /// <param name="mvp">
        /// The <see cref="Matrix4x4d"/> that specify the matrix used for drawing the clipped object.
        /// </param>
        /// <returns>
        /// It returns a <see cref="Planed"/> defining the far clipping plane.
        /// </returns>
        public static Planed GetFrustumFarPlane(Matrix4x4d mvp)
        {
            Planed plane = NormalizePlane(mvp.Row3 - mvp.Row2);

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