Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Contains() [2/7]

ContainmentType Microsoft.Xna.Framework.BoundingSphere.Contains ( BoundingFrustum frustum)
inline

Definition at line 437 of file BoundingSphere.cs.

438 {
439 if (null == frustum)
440 {
441 throw new ArgumentNullException("frustum", FrameworkResources.NullNotAllowed);
442 }
443 if (!frustum.Intersects(this))
444 {
445 return ContainmentType.Disjoint;
446 }
447 float num = Radius * Radius;
448 Vector3[] cornerArray = frustum.cornerArray;
449 Vector3 vector2 = default(Vector3);
450 for (int i = 0; i < cornerArray.Length; i++)
451 {
452 Vector3 vector = cornerArray[i];
453 vector2.X = vector.X - Center.X;
454 vector2.Y = vector.Y - Center.Y;
455 vector2.Z = vector.Z - Center.Z;
456 if (vector2.LengthSquared() > num)
457 {
458 return ContainmentType.Intersects;
459 }
460 }
461 return ContainmentType.Contains;
462 }

References Microsoft.Xna.Framework.BoundingSphere.Center, Microsoft.Xna.Framework.Vector3.Length(), Microsoft.Xna.Framework.FrameworkResources.NullNotAllowed, Microsoft.Xna.Framework.BoundingSphere.Radius, Microsoft.Xna.Framework.Vector3.X, Microsoft.Xna.Framework.Vector3.Y, and Microsoft.Xna.Framework.Vector3.Z.