示例#1
0
            public bool Intersects(ref Bounds bounds)
            {
                if (Bounds != null && Planes != null)
                {
                    //Planes + Bounds
                    if (Bounds.Value.Intersects(ref bounds) || BoundsPlanesIntersects(bounds, Planes))
                    {
                        return(true);
                    }
                }
                else if (Planes != null)
                {
                    //Planes
                    if (BoundsPlanesIntersects(bounds, Planes))
                    {
                        return(true);
                    }
                }
                else if (Frustum != null)
                {
                    //Frustum
                    Bounds frustumBounds = new Bounds(Frustum.Points[0]);
                    for (int n = 1; n < 8; n++)
                    {
                        frustumBounds.Add(Frustum.Points[n]);
                    }
                    if (frustumBounds.Intersects(ref bounds) || BoundsPlanesIntersects(bounds, Frustum.Planes))
                    {
                        return(true);
                    }
                }
                else if (Bounds != null)
                {
                    //Bounds
                    if (Bounds.Value.Intersects(ref bounds))
                    {
                        return(true);
                    }
                }
                else if (Box != null)
                {
                    //Box
                    if (Box.Value.Intersects(ref bounds))
                    {
                        return(true);
                    }
                }
                else if (Sphere != null)
                {
                    //Sphere
                    if (Sphere.Value.Intersects(ref bounds))
                    {
                        return(true);
                    }
                }
                else if (Ray != null)
                {
                    //Ray
                    if (bounds.Intersects(Ray.Value))
                    {
                        return(true);
                    }
                }

                return(false);
            }