BsRenderTarget.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include "BsRenderTarget.h"
  2. #include "BsViewport.h"
  3. #include "BsException.h"
  4. #include "BsRenderSystem.h"
  5. #include "BsCoreThread.h"
  6. #include "BsFrameAlloc.h"
  7. namespace BansheeEngine
  8. {
  9. RenderTargetCore::RenderTargetCore()
  10. {
  11. }
  12. void RenderTargetCore::setActive(bool state)
  13. {
  14. RenderTargetProperties& props = const_cast<RenderTargetProperties&>(getProperties());
  15. props.mActive = state;
  16. markCoreDirty();
  17. }
  18. void RenderTargetCore::setPriority(INT32 priority)
  19. {
  20. RenderTargetProperties& props = const_cast<RenderTargetProperties&>(getProperties());
  21. props.mPriority = priority;
  22. markCoreDirty();
  23. }
  24. const RenderTargetProperties& RenderTargetCore::getProperties() const
  25. {
  26. return getPropertiesInternal();
  27. }
  28. void RenderTargetCore::getCustomAttribute(const String& name, void* pData) const
  29. {
  30. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  31. }
  32. void RenderTarget::setPriority(CoreAccessor& accessor, UINT32 priority)
  33. {
  34. std::function<void(SPtr<RenderTargetCore>, UINT32)> windowedFunc =
  35. [](SPtr<RenderTargetCore> renderTarget, UINT32 priority)
  36. {
  37. renderTarget->setPriority(priority);
  38. };
  39. accessor.queueCommand(std::bind(windowedFunc, getCore(), priority));
  40. }
  41. SPtr<RenderTargetCore> RenderTarget::getCore() const
  42. {
  43. return std::static_pointer_cast<RenderTargetCore>(mCoreSpecific);
  44. }
  45. const RenderTargetProperties& RenderTarget::getProperties() const
  46. {
  47. THROW_IF_CORE_THREAD;
  48. return getPropertiesInternal();
  49. }
  50. void RenderTarget::getCustomAttribute(const String& name, void* pData) const
  51. {
  52. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  53. }
  54. }