BsPixelVolume.h 1.5 KB

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