| 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 "Renderer/BsSkybox.h" |
| 8 | #include "Renderer/BsRenderer.h" |
| 9 | |
| 10 | namespace bs |
| 11 | { |
| 12 | /** @cond RTTI */ |
| 13 | /** @addtogroup RTTI-Impl-Engine |
| 14 | * @{ |
| 15 | */ |
| 16 | |
| 17 | class BS_CORE_EXPORT SkyboxRTTI : public RTTIType <Skybox, IReflectable, SkyboxRTTI> |
| 18 | { |
| 19 | private: |
| 20 | BS_BEGIN_RTTI_MEMBERS |
| 21 | BS_RTTI_MEMBER_REFL(mTexture, 0) |
| 22 | BS_RTTI_MEMBER_PLAIN(mBrightness, 1) |
| 23 | BS_RTTI_MEMBER_REFLPTR(mFilteredRadiance, 2) |
| 24 | BS_RTTI_MEMBER_REFLPTR(mIrradiance, 3) |
| 25 | BS_END_RTTI_MEMBERS |
| 26 | public: |
| 27 | void onSerializationStarted(IReflectable* obj, SerializationContext* context) override |
| 28 | { |
| 29 | Skybox* skybox = static_cast<Skybox*>(obj); |
| 30 | |
| 31 | // Make sure that the renderer finishes generating filtered radiance and irradiance before saving |
| 32 | if (skybox->mRendererTask) |
| 33 | skybox->mRendererTask->wait(); |
| 34 | } |
| 35 | |
| 36 | void onDeserializationEnded(IReflectable* obj, SerializationContext* context) override |
| 37 | { |
| 38 | // Note: Since this is a CoreObject I should call initialize() right after deserialization, |
| 39 | // but since this specific type is used in Components we delay initialization until Component |
| 40 | // itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component |
| 41 | // purposes (you'll need to call initialize manually). |
| 42 | } |
| 43 | |
| 44 | const String& getRTTIName() override |
| 45 | { |
| 46 | static String name = "Skybox"; |
| 47 | return name; |
| 48 | } |
| 49 | |
| 50 | UINT32 getRTTIId() override |
| 51 | { |
| 52 | return TID_Skybox; |
| 53 | } |
| 54 | |
| 55 | SPtr<IReflectable> newRTTIObject() override |
| 56 | { |
| 57 | return Skybox::createEmpty(); |
| 58 | } |
| 59 | }; |
| 60 | |
| 61 | /** @} */ |
| 62 | /** @endcond */ |
| 63 | } |
| 64 |