diff --git a/Tests/Framework/BoundingTest.cs b/Tests/Framework/BoundingTest.cs index 7ab99d15f9e..c1112c99fd3 100644 --- a/Tests/Framework/BoundingTest.cs +++ b/Tests/Framework/BoundingTest.cs @@ -290,12 +290,14 @@ public void BoundingFrustumIntersectsBoundingSphere() var bsphere3 = new BoundingSphere(-Vector3.One * 6, 1); var bsphere4 = new BoundingSphere(Vector3.Zero, 200); var bsphere5 = new BoundingSphere(new Vector3(1, 1, 5), 1); + var bsphere6 = new BoundingSphere(new Vector3(0, 0, -95), 1); Assert.AreEqual(testFrustum.Intersects(bsphere1), true); Assert.AreEqual(testFrustum.Intersects(bsphere2), true); Assert.AreEqual(testFrustum.Intersects(bsphere3), false); Assert.AreEqual(testFrustum.Intersects(bsphere4), true); Assert.AreEqual(testFrustum.Intersects(bsphere5), false); + Assert.AreEqual(testFrustum.Intersects(bsphere6), true); } [Test] @@ -310,6 +312,7 @@ public void BoundingFrustumContainsBoundingSphere() var bsphere3 = new BoundingSphere(-Vector3.One * 6, 1); var bsphere4 = new BoundingSphere(Vector3.Zero, 200); var bsphere5 = new BoundingSphere(new Vector3(1, 1, 5), 1); + var bsphere6 = new BoundingSphere(new Vector3(0, 0, -95), 1); Assert.AreEqual(testFrustum.Contains(bsphere1), ContainmentType.Contains); Assert.AreEqual(testFrustum.Contains(bsphere2), ContainmentType.Contains); @@ -318,6 +321,7 @@ public void BoundingFrustumContainsBoundingSphere() #if !XNA // XNA reports a false Intersects Assert.AreEqual(testFrustum.Contains(bsphere5), ContainmentType.Disjoint); #endif + Assert.AreEqual(testFrustum.Contains(bsphere6), ContainmentType.Intersects); } [Test] diff --git a/src/Xna.Framework/IntersectsHelper.cs b/src/Xna.Framework/IntersectsHelper.cs index d0b2d797b45..78ca2298906 100644 --- a/src/Xna.Framework/IntersectsHelper.cs +++ b/src/Xna.Framework/IntersectsHelper.cs @@ -281,7 +281,7 @@ internal static void BoundingFrustumIntersectsBoundingSphere(BoundingFrustum fru } } - if (back == BoundingFrustum.PlaneCount) + if (back >= (BoundingFrustum.PlaneCount - 1)) return; if (SegmentIntersectsBoundingSphere(ref frustum._corners[0], ref frustum._corners[1], ref sphere))