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