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 | #pragma once |
4 | |
5 | #include "BsCorePrerequisites.h" |
6 | #include "Reflection/BsRTTIType.h" |
7 | #include "RenderAPI/BsBlendState.h" |
8 | #include "Managers/BsRenderStateManager.h" |
9 | |
10 | namespace bs |
11 | { |
12 | /** @cond RTTI */ |
13 | /** @addtogroup RTTI-Impl-Core |
14 | * @{ |
15 | */ |
16 | |
17 | class BS_CORE_EXPORT BlendStateRTTI : public RTTIType<BlendState, IReflectable, BlendStateRTTI> |
18 | { |
19 | private: |
20 | BLEND_STATE_DESC& getData(BlendState* obj) { return obj->mProperties.mData; } |
21 | void setData(BlendState* obj, BLEND_STATE_DESC& val) { obj->mProperties.mData = val; } |
22 | |
23 | public: |
24 | BlendStateRTTI() |
25 | { |
26 | addPlainField("mData", 0, &BlendStateRTTI::getData, &BlendStateRTTI::setData); |
27 | } |
28 | |
29 | void onDeserializationEnded(IReflectable* obj, SerializationContext* context) override |
30 | { |
31 | BlendState* blendState = static_cast<BlendState*>(obj); |
32 | blendState->initialize(); |
33 | } |
34 | |
35 | const String& getRTTIName() override |
36 | { |
37 | static String name = "BlendState"; |
38 | return name; |
39 | } |
40 | |
41 | UINT32 getRTTIId() override |
42 | { |
43 | return TID_BlendState; |
44 | } |
45 | |
46 | SPtr<IReflectable> newRTTIObject() override |
47 | { |
48 | return RenderStateManager::instance()._createBlendStatePtr(BLEND_STATE_DESC()); |
49 | } |
50 | }; |
51 | |
52 | /** @} */ |
53 | /** @endcond */ |
54 | } |