BsSkyboxRTTI.h 1.9 KB

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