2
0

Sphere.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Runtime.InteropServices;
  2. namespace BansheeEngine
  3. {
  4. /// <summary>
  5. /// A sphere represented by a center point and a radius.
  6. /// </summary>
  7. [StructLayout(LayoutKind.Sequential), SerializeObject]
  8. public struct Sphere // Note: Must match C++ enum Sphere
  9. {
  10. [SerializeField]
  11. private float _radius;
  12. [SerializeField]
  13. private Vector3 _center;
  14. /// <summary>
  15. /// Center point of the sphere.
  16. /// </summary>
  17. public Vector3 Center
  18. {
  19. get { return _center; }
  20. set { _center = value; }
  21. }
  22. /// <summary>
  23. /// Radius of the sphere.
  24. /// </summary>
  25. public float Radius
  26. {
  27. get { return _radius; }
  28. set { _radius = value; }
  29. }
  30. /// <summary>
  31. /// Creates a new sphere object.
  32. /// </summary>
  33. /// <param name="center">Center point of the sphere.</param>
  34. /// <param name="radius">Radius of the sphere.</param>
  35. public Sphere(Vector3 center, float radius)
  36. {
  37. _center = center;
  38. _radius = radius;
  39. }
  40. };
  41. }