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/BsDecal.h"
7#include "Scene/BsComponent.h"
8
9namespace bs
10{
11 /** @addtogroup Components-Core
12 * @{
13 */
14
15 /** Wraps Decal as a Component. */
16 class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering,n:Decal) CDecal : public Component
17 {
18 public:
19 CDecal(const HSceneObject& parent);
20 virtual ~CDecal();
21
22 /** @copydoc Decal::setMaterial */
23 BS_SCRIPT_EXPORT(n:Material,pr:setter)
24 void setMaterial(const HMaterial& material) { mInternal->setMaterial(material); }
25
26 /** @copydoc setMaterial */
27 BS_SCRIPT_EXPORT(n:Material,pr:getter)
28 const HMaterial& getMaterial() const { return mInternal->getMaterial(); }
29
30 /** @copydoc Decal::setSize */
31 BS_SCRIPT_EXPORT(n:Size,pr:setter)
32 void setSize(const Vector2& size) { mInternal->setSize(size); }
33
34 /** @copydoc setSize */
35 BS_SCRIPT_EXPORT(n:Size,pr:getter)
36 Vector2 getSize() const { return mInternal->getSize(); }
37
38 /** @copydoc Decal::setMaxDistance */
39 BS_SCRIPT_EXPORT(n:MaxDistance,pr:setter)
40 void setMaxDistance(float distance) { mInternal->setMaxDistance(distance); }
41
42 /** @copydoc getSize */
43 BS_SCRIPT_EXPORT(n:MaxDistance,pr:getter)
44 float getMaxDistance() const { return mInternal->getMaxDistance(); }
45
46 /** @copydoc Decal::setLayer */
47 BS_SCRIPT_EXPORT(n:Layer,pr:setter)
48 void setLayer(UINT64 layer) { mInternal->setLayer(layer); }
49
50 /** @copydoc setLayer() */
51 BS_SCRIPT_EXPORT(n:Layer,pr:getter)
52 UINT64 getLayer() const { return mInternal->getLayer(); }
53
54 BS_SCRIPT_EXPORT(n:LayerMask,pr:setter)
55 /** @copydoc Decal::setLayerMask */
56 void setLayerMask(UINT32 mask) { mInternal->setLayerMask(mask); }
57
58 BS_SCRIPT_EXPORT(n:LayerMask,pr:getter)
59 /** @copydoc setLayerMask */
60 UINT32 getLayerMask() const { return mInternal->getLayerMask(); }
61
62 /** @name Internal
63 * @{
64 */
65
66 /** Returns the internal decal object that this component wraps. */
67 SPtr<Decal> _getInternal() const { return mInternal; }
68
69 /** @} */
70
71 protected:
72 mutable SPtr<Decal> mInternal;
73
74 /************************************************************************/
75 /* COMPONENT OVERRIDES */
76 /************************************************************************/
77 protected:
78 friend class SceneObject;
79
80 /** @copydoc Component::onInitialized */
81 void onInitialized() override;
82
83 /** @copydoc Component::onDestroyed */
84 void onDestroyed() override;
85
86 /** @copydoc Component::update */
87 void update() override { }
88
89 /************************************************************************/
90 /* RTTI */
91 /************************************************************************/
92 public:
93 friend class CDecalRTTI;
94 static RTTITypeBase* getRTTIStatic();
95 RTTITypeBase* getRTTI() const override;
96
97 protected:
98 CDecal(); // Serialization only
99 };
100
101 /** @} */
102}