2
0

Sphere.cs 1.4 KB

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