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 "Material/BsMaterial.h" |
8 | |
9 | namespace bs |
10 | { |
11 | /** @cond RTTI */ |
12 | /** @addtogroup RTTI-Impl-Core |
13 | * @{ |
14 | */ |
15 | |
16 | class BS_CORE_EXPORT MaterialRTTI : public RTTIType<Material, Resource, MaterialRTTI> |
17 | { |
18 | private: |
19 | HShader& getShader(Material* obj) { return obj->mShader; } |
20 | void setShader(Material* obj, HShader& val) { obj->mShader = val; } |
21 | |
22 | SPtr<MaterialParams> getMaterialParams(Material* obj) { return obj->mParams; } |
23 | void setMaterialParams(Material* obj, SPtr<MaterialParams> value) { mMatParams = value; } |
24 | |
25 | public: |
26 | MaterialRTTI() |
27 | { |
28 | addReflectableField("mShader" , 0, &MaterialRTTI::getShader, &MaterialRTTI::setShader); |
29 | addReflectablePtrField("mMaterialParams" , 2, &MaterialRTTI::getMaterialParams, &MaterialRTTI::setMaterialParams); |
30 | } |
31 | |
32 | void onDeserializationEnded(IReflectable* obj, SerializationContext* context) override; |
33 | |
34 | const String& getRTTIName() override |
35 | { |
36 | static String name = "Material" ; |
37 | return name; |
38 | } |
39 | |
40 | UINT32 getRTTIId() override |
41 | { |
42 | return TID_Material; |
43 | } |
44 | |
45 | SPtr<IReflectable> newRTTIObject() override; |
46 | |
47 | private: |
48 | SPtr<MaterialParams> mMatParams; |
49 | }; |
50 | |
51 | /** @} */ |
52 | /** @endcond */ |
53 | } |