static public CullingResult Cull(ref WorldBoundingSphere bounds, float4 plane) { float dist = math.dot(bounds.position, plane.xyz) + plane.w; if (dist <= -bounds.radius) { return(CullingResult.Outside); } if (dist >= bounds.radius) { return(CullingResult.Inside); } return(CullingResult.Intersects); }
static public CullingResult Cull(ref WorldBoundingSphere bounds, ref Frustum f) { CullingResult rall = CullingResult.Inside; for (int i = 0; i < f.PlanesCount; i++) { float4 plane = f.GetPlane(i); CullingResult r = Cull(ref bounds, plane); if (r == CullingResult.Outside) { return(CullingResult.Outside); } if (r == CullingResult.Intersects) { rall = CullingResult.Intersects; } } return(rall); }