| 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 "Renderer/BsLightProbeVolume.h" |
| 7 | #include "Scene/BsComponent.h" |
| 8 | |
| 9 | namespace bs |
| 10 | { |
| 11 | /** @addtogroup Components-Core |
| 12 | * @{ |
| 13 | */ |
| 14 | |
| 15 | /** |
| 16 | * @copydoc LightProbeVolume |
| 17 | * |
| 18 | * @note Wraps LightProbeVolume as a Component. |
| 19 | */ |
| 20 | class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering,n:LightProbeVolume) CLightProbeVolume : public Component |
| 21 | { |
| 22 | public: |
| 23 | CLightProbeVolume(const HSceneObject& parent, const AABox& volume = AABox::UNIT_BOX, |
| 24 | const Vector3I& cellCount = Vector3I(1, 1, 1)); |
| 25 | virtual ~CLightProbeVolume(); |
| 26 | |
| 27 | /** @copydoc LightProbeVolume::addProbe() */ |
| 28 | BS_SCRIPT_EXPORT() |
| 29 | UINT32 addProbe(const Vector3& position) { return mInternal->addProbe(position); } |
| 30 | |
| 31 | /** @copydoc LightProbeVolume::setProbePosition() */ |
| 32 | BS_SCRIPT_EXPORT() |
| 33 | void setProbePosition(UINT32 handle, const Vector3& position) { mInternal->setProbePosition(handle, position); } |
| 34 | |
| 35 | /** @copydoc LightProbeVolume::getProbePosition() */ |
| 36 | BS_SCRIPT_EXPORT() |
| 37 | Vector3 getProbePosition(UINT32 handle) const { return mInternal->getProbePosition(handle); } |
| 38 | |
| 39 | /** @copydoc LightProbeVolume::removeProbe() */ |
| 40 | BS_SCRIPT_EXPORT() |
| 41 | void removeProbe(UINT32 handle) { mInternal->removeProbe(handle); } |
| 42 | |
| 43 | /** @copydoc LightProbeVolume::getProbes() */ |
| 44 | BS_SCRIPT_EXPORT() |
| 45 | Vector<LightProbeInfo> getProbes() const; |
| 46 | |
| 47 | /** @copydoc LightProbeVolume::renderProbe() */ |
| 48 | BS_SCRIPT_EXPORT() |
| 49 | void renderProbe(UINT32 handle); |
| 50 | |
| 51 | /** @copydoc LightProbeVolume::renderProbes() */ |
| 52 | BS_SCRIPT_EXPORT() |
| 53 | void renderProbes(); |
| 54 | |
| 55 | /** @copydoc LightProbeVolume::resize() */ |
| 56 | BS_SCRIPT_EXPORT() |
| 57 | void resize(const AABox& volume, const Vector3I& cellCount = Vector3I(1, 1, 1)) { mInternal->resize(volume, cellCount); } |
| 58 | |
| 59 | /** @copydoc LightProbeVolume::clip() */ |
| 60 | BS_SCRIPT_EXPORT() |
| 61 | void clip() { mInternal->clip(); } |
| 62 | |
| 63 | /** @copydoc LightProbeVolume::reset() */ |
| 64 | BS_SCRIPT_EXPORT() |
| 65 | void reset() { mInternal->reset(); } |
| 66 | |
| 67 | /** @copydoc LightProbeVolume::getGridVolume() */ |
| 68 | BS_SCRIPT_EXPORT(n:GridVolume,pr:getter) |
| 69 | const AABox& getGridVolume() const { return mVolume; } |
| 70 | |
| 71 | /** @copydoc LightProbeVolume::getCellCount() */ |
| 72 | BS_SCRIPT_EXPORT(n:CellCount,pr:getter) |
| 73 | const Vector3I& getCellCount() const { return mCellCount; } |
| 74 | |
| 75 | /** @name Internal |
| 76 | * @{ |
| 77 | */ |
| 78 | |
| 79 | /** Returns the light probe volume that this component wraps. */ |
| 80 | SPtr<LightProbeVolume> _getInternal() const { return mInternal; } |
| 81 | |
| 82 | /** @} */ |
| 83 | |
| 84 | protected: |
| 85 | mutable SPtr<LightProbeVolume> mInternal; |
| 86 | |
| 87 | // Only valid during construction |
| 88 | AABox mVolume; |
| 89 | Vector3I mCellCount; |
| 90 | |
| 91 | /************************************************************************/ |
| 92 | /* COMPONENT OVERRIDES */ |
| 93 | /************************************************************************/ |
| 94 | protected: |
| 95 | friend class SceneObject; |
| 96 | |
| 97 | /** @copydoc Component::onInitialized */ |
| 98 | void onInitialized() override; |
| 99 | |
| 100 | /** @copydoc Component::onDestroyed */ |
| 101 | void onDestroyed() override; |
| 102 | |
| 103 | /** @copydoc Component::update */ |
| 104 | void update() override { } |
| 105 | |
| 106 | /************************************************************************/ |
| 107 | /* RTTI */ |
| 108 | /************************************************************************/ |
| 109 | public: |
| 110 | friend class CLightProbeVolumeRTTI; |
| 111 | static RTTITypeBase* getRTTIStatic(); |
| 112 | RTTITypeBase* getRTTI() const override; |
| 113 | |
| 114 | protected: |
| 115 | CLightProbeVolume(); // Serialization only |
| 116 | }; |
| 117 | |
| 118 | /** @} */ |
| 119 | } |