BsRenderTarget.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #include "BsRenderTarget.h"
  2. #include "BsViewport.h"
  3. #include "BsException.h"
  4. #include "BsRenderSystem.h"
  5. #include "BsCoreThread.h"
  6. #include "BsRenderTargetManager.h"
  7. namespace BansheeEngine
  8. {
  9. void RenderTargetProperties::copyFrom(const RenderTargetProperties& other)
  10. {
  11. *this = other;
  12. }
  13. RenderTargetCore::RenderTargetCore(RenderTarget* parent, RenderTargetProperties* properties)
  14. :mProperties(properties), mParent(parent)
  15. {
  16. }
  17. RenderTargetCore::~RenderTargetCore()
  18. {
  19. bs_delete(mProperties);
  20. }
  21. void RenderTargetCore::getCustomAttribute(const String& name, void* pData) const
  22. {
  23. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  24. }
  25. const RenderTargetProperties& RenderTargetCore::getProperties() const
  26. {
  27. THROW_IF_NOT_CORE_THREAD;
  28. return *mProperties;
  29. }
  30. RenderTarget::RenderTarget()
  31. :mCore(nullptr), mProperties(nullptr)
  32. {
  33. }
  34. RenderTarget::~RenderTarget()
  35. {
  36. bs_delete(mProperties);
  37. }
  38. const RenderTargetProperties& RenderTarget::getProperties() const
  39. {
  40. THROW_IF_CORE_THREAD;
  41. return *mProperties;
  42. }
  43. RenderTargetCore* RenderTarget::getCore() const
  44. {
  45. return mCore;
  46. }
  47. void RenderTarget::initialize_internal()
  48. {
  49. CoreObject::initialize_internal();
  50. mCore = createCore();
  51. RenderTargetManager::instance().registerRenderTarget(this);
  52. }
  53. void RenderTarget::destroy_internal()
  54. {
  55. RenderTargetManager::instance().unregisterRenderTarget(this);
  56. bs_delete(mCore);
  57. mCore = nullptr;
  58. CoreObject::destroy_internal();
  59. }
  60. void RenderTarget::getCustomAttribute(const String& name, void* pData) const
  61. {
  62. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  63. }
  64. }