1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#include "RenderAPI/BsRenderTarget.h"
4#include "RenderAPI/BsViewport.h"
5#include "Private/RTTI/BsRenderTargetRTTI.h"
6#include "Error/BsException.h"
7#include "RenderAPI/BsRenderAPI.h"
8#include "CoreThread/BsCoreThread.h"
9
10namespace bs
11{
12 RenderTarget::RenderTarget()
13 {
14 // We never sync from sim to core, so mark it clean to avoid overwriting core thread changes
15 markCoreClean();
16 }
17
18 void RenderTarget::setPriority(INT32 priority)
19 {
20 std::function<void(SPtr<ct::RenderTarget>, INT32)> windowedFunc =
21 [](SPtr<ct::RenderTarget> renderTarget, INT32 priority)
22 {
23 renderTarget->setPriority(priority);
24 };
25
26 gCoreThread().queueCommand(std::bind(windowedFunc, getCore(), priority));
27 }
28
29 SPtr<ct::RenderTarget> RenderTarget::getCore() const
30 {
31 return std::static_pointer_cast<ct::RenderTarget>(mCoreSpecific);
32 }
33
34 const RenderTargetProperties& RenderTarget::getProperties() const
35 {
36 THROW_IF_CORE_THREAD;
37
38 return getPropertiesInternal();
39 }
40
41 void RenderTarget::getCustomAttribute(const String& name, void* pData) const
42 {
43 BS_EXCEPT(InvalidParametersException, "Attribute not found.");
44 }
45
46 /************************************************************************/
47 /* SERIALIZATION */
48 /************************************************************************/
49
50 RTTITypeBase* RenderTarget::getRTTIStatic()
51 {
52 return RenderTargetRTTI::instance();
53 }
54
55 RTTITypeBase* RenderTarget::getRTTI() const
56 {
57 return RenderTarget::getRTTIStatic();
58 }
59
60 namespace ct
61 {
62 RenderTarget::RenderTarget()
63 {
64
65 }
66
67 void RenderTarget::setPriority(INT32 priority)
68 {
69 RenderTargetProperties& props = const_cast<RenderTargetProperties&>(getProperties());
70
71 props.priority = priority;
72 }
73
74 const RenderTargetProperties& RenderTarget::getProperties() const
75 {
76 return getPropertiesInternal();
77 }
78
79 void RenderTarget::getCustomAttribute(const String& name, void* pData) const
80 {
81 BS_EXCEPT(InvalidParametersException, "Attribute not found.");
82 }
83 }
84}
85