BsRenderTarget.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "RenderAPI/BsRenderTarget.h"
  4. #include "RenderAPI/BsViewport.h"
  5. #include "Error/BsException.h"
  6. #include "RenderAPI/BsRenderAPI.h"
  7. #include "CoreThread/BsCoreThread.h"
  8. namespace bs
  9. {
  10. RenderTarget::RenderTarget()
  11. {
  12. // We never sync from sim to core, so mark it clean to avoid overwriting core thread changes
  13. markCoreClean();
  14. }
  15. void RenderTarget::setPriority(INT32 priority)
  16. {
  17. std::function<void(SPtr<ct::RenderTarget>, INT32)> windowedFunc =
  18. [](SPtr<ct::RenderTarget> renderTarget, INT32 priority)
  19. {
  20. renderTarget->setPriority(priority);
  21. };
  22. gCoreThread().queueCommand(std::bind(windowedFunc, getCore(), priority));
  23. }
  24. SPtr<ct::RenderTarget> RenderTarget::getCore() const
  25. {
  26. return std::static_pointer_cast<ct::RenderTarget>(mCoreSpecific);
  27. }
  28. const RenderTargetProperties& RenderTarget::getProperties() const
  29. {
  30. THROW_IF_CORE_THREAD;
  31. return getPropertiesInternal();
  32. }
  33. void RenderTarget::getCustomAttribute(const String& name, void* pData) const
  34. {
  35. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  36. }
  37. namespace ct
  38. {
  39. RenderTarget::RenderTarget()
  40. {
  41. }
  42. void RenderTarget::setPriority(INT32 priority)
  43. {
  44. RenderTargetProperties& props = const_cast<RenderTargetProperties&>(getProperties());
  45. props.priority = priority;
  46. }
  47. const RenderTargetProperties& RenderTarget::getProperties() const
  48. {
  49. return getPropertiesInternal();
  50. }
  51. void RenderTarget::getCustomAttribute(const String& name, void* pData) const
  52. {
  53. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  54. }
  55. }
  56. }