BsRenderTarget.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. #include "Allocators/BsFrameAlloc.h"
  9. namespace bs
  10. {
  11. RenderTarget::RenderTarget()
  12. {
  13. // We never sync from sim to core, so mark it clean to avoid overwriting core thread changes
  14. markCoreClean();
  15. }
  16. void RenderTarget::setPriority(INT32 priority)
  17. {
  18. std::function<void(SPtr<ct::RenderTarget>, INT32)> windowedFunc =
  19. [](SPtr<ct::RenderTarget> renderTarget, INT32 priority)
  20. {
  21. renderTarget->setPriority(priority);
  22. };
  23. gCoreThread().queueCommand(std::bind(windowedFunc, getCore(), priority));
  24. }
  25. SPtr<ct::RenderTarget> RenderTarget::getCore() const
  26. {
  27. return std::static_pointer_cast<ct::RenderTarget>(mCoreSpecific);
  28. }
  29. const RenderTargetProperties& RenderTarget::getProperties() const
  30. {
  31. THROW_IF_CORE_THREAD;
  32. return getPropertiesInternal();
  33. }
  34. void RenderTarget::getCustomAttribute(const String& name, void* pData) const
  35. {
  36. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  37. }
  38. namespace ct
  39. {
  40. RenderTarget::RenderTarget()
  41. {
  42. }
  43. void RenderTarget::setPriority(INT32 priority)
  44. {
  45. RenderTargetProperties& props = const_cast<RenderTargetProperties&>(getProperties());
  46. props.priority = priority;
  47. }
  48. const RenderTargetProperties& RenderTarget::getProperties() const
  49. {
  50. return getPropertiesInternal();
  51. }
  52. void RenderTarget::getCustomAttribute(const String& name, void* pData) const
  53. {
  54. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  55. }
  56. }
  57. }