BsPixelVolume.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. namespace BansheeEngine
  4. {
  5. /**
  6. * @brief Represents a 3D region of pixels used for referencing pixel data.
  7. */
  8. struct BS_CORE_EXPORT PixelVolume
  9. {
  10. UINT32 left, top, right, bottom, front, back;
  11. PixelVolume()
  12. : left(0), top(0), right(1), bottom(1), front(0), back(1)
  13. { }
  14. PixelVolume(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom):
  15. left(left), top(top), right(right), bottom(bottom), front(0), back(1)
  16. {
  17. assert(right >= left && bottom >= top && back >= front);
  18. }
  19. PixelVolume(UINT32 left, UINT32 top, UINT32 front, UINT32 right, UINT32 bottom, UINT32 back):
  20. left(left), top(top), right(right), bottom(bottom), front(front), back(back)
  21. {
  22. assert(right >= left && bottom >= top && back >= front);
  23. }
  24. /**
  25. * @brief Return true if the other box is a part of this one.
  26. */
  27. bool contains(const PixelVolume &volume) const
  28. {
  29. return (volume.left >= left && volume.top >= top && volume.front >= front &&
  30. volume.right <= right && volume.bottom <= bottom && volume.back <= back);
  31. }
  32. UINT32 getWidth() const { return right-left; }
  33. UINT32 getHeight() const { return bottom-top; }
  34. UINT32 getDepth() const { return back-front; }
  35. };
  36. }