Ocean
rendering/SpotLight.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_RENDERING_SPOT_LIGHT_H
9 #define META_OCEAN_RENDERING_SPOT_LIGHT_H
10 
13 
14 #include "ocean/math/Quaternion.h"
15 
16 namespace Ocean
17 {
18 
19 namespace Rendering
20 {
21 
22 // Forward declaration
23 class SpotLight;
24 
25 /**
26  * Definition of a smart object reference holding a spot light.
27  * @see SmartObjectRef, SpotLight.
28  * @ingroup rendering
29  */
31 
32 /**
33  * This class is the base class for all spot lights.
34  * @ingroup rendering
35  */
36 class OCEAN_RENDERING_EXPORT SpotLight : virtual public PointLight
37 {
38  public:
39 
40  /**
41  * Returns the direction of this directional light.
42  * The default value is (0, 0, -1).
43  * @return Light direction
44  * @exception NotSupportedException Is thrown if this function is not supported
45  */
46  virtual Vector3 direction() const;
47 
48  /**
49  * Returns the angle of the light cone in radian.
50  * Objects outside this cone are unlit.
51  * @return Angle of light cone in radian with range [0.0, Pi / 2]
52  */
53  virtual Scalar coneAngle() const;
54 
55  /**
56  * Returns the sharpness of the spot as fall off exponent.
57  * @return Spot exponent
58  */
59  virtual Scalar spotExponent() const;
60 
61  /**
62  * Sets the direction of this directional light.
63  * The default value is (0, 0, -1).
64  * @param direction Direction to set
65  * @exception NotSupportedException Is thrown if this function is not supported
66  */
67  virtual void setDirection(const Vector3& direction);
68 
69  /**
70  * Sets the angle of the light cone in radian.
71  * Objects outside this conde are unlit.
72  * @return True, if the angle is valid and could be set
73  * @param angle Angle of the light cone in radian with range [0.0, Pi / 2]
74  * @exception NotSupportedException Is thrown if this function is not supported
75  */
76  virtual bool setConeAngle(const Scalar angle);
77 
78  /**
79  * Sets the sharpness of the spot as fall off exponent.
80  * @param exponent Sharpness exponent to set with range [0.0, 1.0]
81  * @return True, if the value is valid and could be set
82  * @exception NotSupportedException Is thrown if this function is not supported
83  */
84  virtual bool setSpotExponent(const Scalar exponent);
85 
86  /**
87  * Returns the type of this object.
88  * @see Object::type().
89  */
90  ObjectType type() const override;
91 
92  protected:
93 
94  /**
95  * Creates a new sport light.
96  */
98 
99  /**
100  * Destructs a spot light.
101  */
102  ~SpotLight() override;
103 };
104 
105 }
106 
107 }
108 
109 #endif // META_OCEAN_RENDERING_SPOT_LIGHT_H
ObjectType
Definition of different object type.
Definition: Object.h:63
This class is the base class for all point lights.
Definition: rendering/PointLight.h:43
This class implements a smart rendering object reference.
Definition: rendering/ObjectRef.h:34
This class is the base class for all spot lights.
Definition: rendering/SpotLight.h:37
virtual void setDirection(const Vector3 &direction)
Sets the direction of this directional light.
virtual Scalar coneAngle() const
Returns the angle of the light cone in radian.
virtual Vector3 direction() const
Returns the direction of this directional light.
~SpotLight() override
Destructs a spot light.
SpotLight()
Creates a new sport light.
virtual bool setSpotExponent(const Scalar exponent)
Sets the sharpness of the spot as fall off exponent.
ObjectType type() const override
Returns the type of this object.
virtual bool setConeAngle(const Scalar angle)
Sets the angle of the light cone in radian.
virtual Scalar spotExponent() const
Returns the sharpness of the spot as fall off exponent.
float Scalar
Definition of a scalar type.
Definition: Math.h:128
SmartObjectRef< SpotLight > SpotLightRef
Definition of a smart object reference holding a spot light.
Definition: rendering/SpotLight.h:23
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15