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/BsRasterizerState.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 RasterizerStateRTTI : public RTTIType<RasterizerState, IReflectable, RasterizerStateRTTI> |
18 | { |
19 | private: |
20 | RASTERIZER_STATE_DESC& getData(RasterizerState* obj) { return obj->mProperties.mData; } |
21 | void setData(RasterizerState* obj, RASTERIZER_STATE_DESC& val) { obj->mProperties.mData = val; } |
22 | |
23 | public: |
24 | RasterizerStateRTTI() |
25 | { |
26 | addPlainField("mData", 0, &RasterizerStateRTTI::getData, &RasterizerStateRTTI::setData); |
27 | } |
28 | |
29 | void onDeserializationEnded(IReflectable* obj, SerializationContext* context) override |
30 | { |
31 | RasterizerState* rasterizerState = static_cast<RasterizerState*>(obj); |
32 | rasterizerState->initialize(); |
33 | } |
34 | |
35 | const String& getRTTIName() override |
36 | { |
37 | static String name = "RasterizerState"; |
38 | return name; |
39 | } |
40 | |
41 | UINT32 getRTTIId() override |
42 | { |
43 | return TID_RasterizerState; |
44 | } |
45 | |
46 | SPtr<IReflectable> newRTTIObject() override |
47 | { |
48 | return RenderStateManager::instance()._createRasterizerStatePtr(RASTERIZER_STATE_DESC()); |
49 | } |
50 | }; |
51 | |
52 | /** @} */ |
53 | /** @endcond */ |
54 | } |