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/BsReflectionProbe.h"
7#include "Scene/BsComponent.h"
8
9namespace bs
10{
11 /** @addtogroup Components-Core
12 * @{
13 */
14
15 /**
16 * @copydoc ReflectionProbe
17 *
18 * @note Wraps ReflectionProbe as a Component.
19 */
20 class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering,n:ReflectionProbe) CReflectionProbe : public Component
21 {
22 public:
23 CReflectionProbe(const HSceneObject& parent);
24 virtual ~CReflectionProbe();
25
26 /** @copydoc ReflectionProbe::getType */
27 BS_SCRIPT_EXPORT(n:Type,pr:getter)
28 ReflectionProbeType getType() const { return mInternal->getType(); }
29
30 /** @copydoc ReflectionProbe::setType */
31 BS_SCRIPT_EXPORT(n:Type,pr:setter)
32 void setType(ReflectionProbeType type) { mInternal->setType(type); }
33
34 /** @copydoc ReflectionProbe::getRadius */
35 BS_SCRIPT_EXPORT(n:Radius,pr:getter)
36 float getRadius() const { return mInternal->getRadius(); }
37
38 /** @copydoc ReflectionProbe::setRadius */
39 BS_SCRIPT_EXPORT(n:Radius,pr:setter)
40 void setRadius(float radius) { mInternal->setRadius(radius); }
41
42 /** @copydoc ReflectionProbe::getExtents */
43 BS_SCRIPT_EXPORT(n:Extents,pr:getter)
44 Vector3 getExtents() const { return mInternal->getExtents(); }
45
46 /** @copydoc ReflectionProbe::setExtents */
47 BS_SCRIPT_EXPORT(n:Extents,pr:setter)
48 void setExtents(const Vector3& extents) { mInternal->setExtents(extents); }
49
50 /** Retrieves transition distance set by setTransitionDistance(). */
51 float getTransitionDistance() const { return mInternal->getTransitionDistance(); }
52
53 /** @copydoc ReflectionProbe::setTransitionDistance */
54 void setTransitionDistance(float distance) { mInternal->setTransitionDistance(distance); }
55
56 /** @copydoc ReflectionProbe::getCustomTexture */
57 BS_SCRIPT_EXPORT(n:CustomTexture,pr:getter)
58 HTexture getCustomTexture() const { return mInternal->getCustomTexture(); }
59
60 /** @copydoc ReflectionProbe::setCustomTexture */
61 BS_SCRIPT_EXPORT(n:CustomTexture,pr:setter)
62 void setCustomTexture(const HTexture& texture) { mInternal->setCustomTexture(texture); }
63
64 /** @copydoc ReflectionProbe::getBounds */
65 Sphere getBounds() const;
66
67 /** @copydoc ReflectionProbe::capture */
68 BS_SCRIPT_EXPORT(n:Capture)
69 void capture() { mInternal->capture(); }
70
71 /** @name Internal
72 * @{
73 */
74
75 /** Returns the reflection probe that this component wraps. */
76 SPtr<ReflectionProbe> _getReflectionProbe() const { return mInternal; }
77
78 /** @} */
79
80 protected:
81 mutable SPtr<ReflectionProbe> mInternal;
82
83 /************************************************************************/
84 /* COMPONENT OVERRIDES */
85 /************************************************************************/
86 protected:
87 friend class SceneObject;
88
89 /** @copydoc Component::onInitialized */
90 void onInitialized() override;
91
92 /** @copydoc Component::onDestroyed */
93 void onDestroyed() override;
94
95 /** @copydoc Component::update */
96 void update() override { }
97
98 /************************************************************************/
99 /* RTTI */
100 /************************************************************************/
101 public:
102 friend class CReflectionProbeRTTI;
103 static RTTITypeBase* getRTTIStatic();
104 RTTITypeBase* getRTTI() const override;
105
106 protected:
107 CReflectionProbe(); // Serialization only
108 };
109
110 /** @} */
111}