BsRenderTarget.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. RenderTargetCore::RenderTargetCore(RenderTarget* parent, RenderTargetProperties* properties)
  10. :mProperties(properties), mParent(parent)
  11. {
  12. }
  13. RenderTargetCore::~RenderTargetCore()
  14. {
  15. bs_delete(mProperties);
  16. }
  17. void RenderTargetCore::getCustomAttribute(const String& name, void* pData) const
  18. {
  19. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  20. }
  21. const RenderTargetProperties& RenderTargetCore::getProperties() const
  22. {
  23. THROW_IF_NOT_CORE_THREAD;
  24. return *mProperties;
  25. }
  26. RenderTarget::RenderTarget()
  27. :mCore(nullptr), mProperties(nullptr)
  28. {
  29. }
  30. RenderTarget::~RenderTarget()
  31. {
  32. bs_delete(mProperties);
  33. }
  34. const RenderTargetProperties& RenderTarget::getProperties() const
  35. {
  36. THROW_IF_CORE_THREAD;
  37. return *mProperties;
  38. }
  39. RenderTargetCore* RenderTarget::getCore() const
  40. {
  41. return mCore;
  42. }
  43. void RenderTarget::initialize_internal()
  44. {
  45. CoreObject::initialize_internal();
  46. mCore = createCore();
  47. RenderTargetManager::instance().registerRenderTarget(this);
  48. }
  49. void RenderTarget::destroy_internal()
  50. {
  51. RenderTargetManager::instance().unregisterRenderTarget(this);
  52. bs_delete(mCore);
  53. mCore = nullptr;
  54. CoreObject::destroy_internal();
  55. }
  56. void RenderTarget::getCustomAttribute(const String& name, void* pData) const
  57. {
  58. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  59. }
  60. }