BsConvexVolume.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsPrerequisitesUtil.h"
  5. #include "BsPlane.h"
  6. namespace bs
  7. {
  8. /** @addtogroup Math
  9. * @{
  10. */
  11. /** Represents a convex volume defined by planes representing the volume border. */
  12. class BS_UTILITY_EXPORT ConvexVolume
  13. {
  14. public:
  15. ConvexVolume() {}
  16. ConvexVolume(const Vector<Plane>& planes);
  17. /** Creates frustum planes from the provided projection matrix. */
  18. ConvexVolume(const Matrix4& projectionMatrix);
  19. /**
  20. * Checks does the volume intersects the provided axis aligned box.
  21. * This will return true if the box is fully inside the volume.
  22. */
  23. bool intersects(const AABox& box) const;
  24. /**
  25. * Checks does the volume intersects the provided sphere.
  26. * This will return true if the sphere is fully inside the volume.
  27. */
  28. bool intersects(const Sphere& sphere) const;
  29. /** Returns the internal set of planes that represent the volume. */
  30. Vector<Plane> getPlanes() const { return mPlanes; }
  31. private:
  32. Vector<Plane> mPlanes;
  33. };
  34. /** @} */
  35. }