BsBounds.cpp 758 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "BsBounds.h"
  2. #include "BsRay.h"
  3. #include "BsPlane.h"
  4. #include "BsSphere.h"
  5. namespace BansheeEngine
  6. {
  7. Bounds::Bounds()
  8. { }
  9. Bounds::Bounds(const AABox& box, const Sphere& sphere)
  10. :mBox(box), mSphere(sphere)
  11. { }
  12. void Bounds::setBounds(const AABox& box, const Sphere& sphere)
  13. {
  14. mBox = box;
  15. mSphere = sphere;
  16. }
  17. void Bounds::merge(const Bounds& rhs)
  18. {
  19. mBox.merge(rhs.mBox);
  20. mSphere.merge(rhs.mSphere);
  21. }
  22. void Bounds::merge(const Vector3& point)
  23. {
  24. mBox.merge(point);
  25. mSphere.merge(point);
  26. }
  27. void Bounds::transform(const Matrix4& matrix)
  28. {
  29. mBox.transform(matrix);
  30. mSphere.transform(matrix);
  31. }
  32. void Bounds::transformAffine(const Matrix4& matrix)
  33. {
  34. mBox.transformAffine(matrix);
  35. mSphere.transform(matrix);
  36. }
  37. }