BsReflectionProbeRTTI.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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/BsReflectionProbe.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 ReflectionProbeRTTI : public RTTIType <ReflectionProbe, IReflectable, ReflectionProbeRTTI>
  15. {
  16. private:
  17. BS_BEGIN_RTTI_MEMBERS
  18. BS_RTTI_MEMBER_REFL(mTransform, 0)
  19. BS_RTTI_MEMBER_PLAIN(mActive, 1)
  20. BS_RTTI_MEMBER_PLAIN(mMobility, 2)
  21. BS_RTTI_MEMBER_PLAIN(mType, 3)
  22. BS_RTTI_MEMBER_PLAIN(mRadius, 4)
  23. BS_RTTI_MEMBER_PLAIN(mExtents, 5)
  24. BS_RTTI_MEMBER_PLAIN(mTransitionDistance, 6)
  25. BS_RTTI_MEMBER_REFL(mCustomTexture, 7)
  26. BS_RTTI_MEMBER_REFLPTR(mFilteredTexture, 8)
  27. BS_END_RTTI_MEMBERS
  28. public:
  29. ReflectionProbeRTTI()
  30. :mInitMembers(this)
  31. { }
  32. void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
  33. {
  34. ReflectionProbe* probe = static_cast<ReflectionProbe*>(obj);
  35. // Force the renderer task to complete, so the filtered texture is up to date
  36. if (probe->mRendererTask != nullptr)
  37. probe->mRendererTask->wait();
  38. }
  39. void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
  40. {
  41. // Note: Since this is a CoreObject I should call initialize() right after deserialization,
  42. // but since this specific type is used in Components we delay initialization until Component
  43. // itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component
  44. // purposes (you'll need to call initialize manually).
  45. }
  46. const String& getRTTIName() override
  47. {
  48. static String name = "ReflectionProbe";
  49. return name;
  50. }
  51. UINT32 getRTTIId() override
  52. {
  53. return TID_ReflectionProbe;
  54. }
  55. SPtr<IReflectable> newRTTIObject() override
  56. {
  57. return ReflectionProbe::createEmpty();
  58. }
  59. };
  60. /** @} */
  61. /** @endcond */
  62. }