Exemplo n.º 1
0
 /// <summary>
 /// Checks whether the current BoundingBox intersects a BoundingFrustum.
 /// </summary>
 /// <param name="frustum">The BoundingFrustum to check for intersection with.</param>
 /// <param name="result">[OutAttribute] A boolean indicating whether the BoundingBox intersects the BoundingFrustum.</param>
 public void Intersects(ref BoundingFrustum frustum, out bool result)
 {
     result = frustum.Intersects(this);
 }
Exemplo n.º 2
0
 public bool Intersects(BoundingFrustum frustum)
 {
     bool result;
     Intersects(ref frustum, out result);
     return result;
 }
Exemplo n.º 3
0
		public static void AddBoundingFrustum(BoundingFrustum frustum, Color color, float life = 0f)
        {
            // Get a DebugShape we can use to draw the frustum
            DebugShape shape = GetShapeForLines(12, life);

            // Get the corners of the frustum
			frustum.GetCorners(_corners);

            // Fill in the vertices for the bottom of the frustum
            shape.Vertices[0] = new VertexPositionColor(_corners[0].ToXNA(), color);
            shape.Vertices[1] = new VertexPositionColor(_corners[1].ToXNA(), color);
            shape.Vertices[2] = new VertexPositionColor(_corners[1].ToXNA(), color);
            shape.Vertices[3] = new VertexPositionColor(_corners[2].ToXNA(), color);
            shape.Vertices[4] = new VertexPositionColor(_corners[2].ToXNA(), color);
            shape.Vertices[5] = new VertexPositionColor(_corners[3].ToXNA(), color);
            shape.Vertices[6] = new VertexPositionColor(_corners[3].ToXNA(), color);
            shape.Vertices[7] = new VertexPositionColor(_corners[0].ToXNA(), color);

            // Fill in the vertices for the top of the frustum
            shape.Vertices[8] = new VertexPositionColor(_corners[4].ToXNA(), color);
            shape.Vertices[9] = new VertexPositionColor(_corners[5].ToXNA(), color);
            shape.Vertices[10] = new VertexPositionColor(_corners[5].ToXNA(), color);
            shape.Vertices[11] = new VertexPositionColor(_corners[6].ToXNA(), color);
            shape.Vertices[12] = new VertexPositionColor(_corners[6].ToXNA(), color);
            shape.Vertices[13] = new VertexPositionColor(_corners[7].ToXNA(), color);
            shape.Vertices[14] = new VertexPositionColor(_corners[7].ToXNA(), color);
            shape.Vertices[15] = new VertexPositionColor(_corners[4].ToXNA(), color);

            // Fill in the vertices for the vertical sides of the frustum
            shape.Vertices[16] = new VertexPositionColor(_corners[0].ToXNA(), color);
            shape.Vertices[17] = new VertexPositionColor(_corners[4].ToXNA(), color);
            shape.Vertices[18] = new VertexPositionColor(_corners[1].ToXNA(), color);
            shape.Vertices[19] = new VertexPositionColor(_corners[5].ToXNA(), color);
            shape.Vertices[20] = new VertexPositionColor(_corners[2].ToXNA(), color);
            shape.Vertices[21] = new VertexPositionColor(_corners[6].ToXNA(), color);
            shape.Vertices[22] = new VertexPositionColor(_corners[3].ToXNA(), color);
            shape.Vertices[23] = new VertexPositionColor(_corners[7].ToXNA(), color);
		}
 /// <summary>
 /// Determines whether the specified BoundingFrustum is equal to the current BoundingFrustum.
 /// </summary>
 /// <param name="other">The BoundingFrustum to compare with the current BoundingFrustum.</param>
 public bool Equals(BoundingFrustum other)
 {
     return this == other;
 }
 /// <summary>
 /// Creates the smallest BoundingSphere that can contain a specified BoundingFrustum.
 /// </summary>
 /// <param name="frustum">The BoundingFrustum to create the BoundingSphere with.</param>
 public static BoundingSphere CreateFromFrustum(BoundingFrustum frustum)
 {
     return CreateFromPoints(frustum.GetCorners());
 }
 /// <summary>
 /// Checks whether the current BoundingSphere intersects with a specified BoundingFrustum.
 /// </summary>
 /// <param name="frustum">The BoundingFrustum to check for intersection with the current BoundingSphere.</param>
 /// <param name="result"></param>
 public void Intersects(ref BoundingFrustum frustum, out bool result)
 {
     frustum.Intersects(ref this, out result);
 }