Ocean
GISpotLight.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_GI_SPOT_LIGHT_H
9 #define META_OCEAN_RENDERING_GI_SPOT_LIGHT_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Rendering
20 {
21 
22 namespace GlobalIllumination
23 {
24 
25 /**
26  * This class implements a spot light.
27  * @ingroup renderinggi
28  */
29 class OCEAN_RENDERING_GI_EXPORT GISpotLight :
30  virtual public GIPointLight,
31  virtual public SpotLight
32 {
33  friend class GIFactory;
34 
35  public:
36 
37  /**
38  * Returns the direction of this directional light.
39  * @see SpotLight::direction().
40  */
41  Vector3 direction() const override;
42 
43  /**
44  * Returns the angle of the light cone in radian.
45  * @see SpotLight::coneAngle().
46  */
47  Scalar coneAngle() const override;
48 
49  /**
50  * Returns the cosine of the cone angle.
51  * @return Cosine of the cone angle
52  * @see coneAngle()
53  */
54  inline Scalar coneAngleCos() const;
55 
56  /**
57  * Returns the sharpness of the spot as fall off exponent.
58  * @see SpotLight::spotExponent().
59  */
60  Scalar spotExponent() const override;
61 
62  /**
63  * Returns the direction of this directional light.
64  * @see direction().
65  */
66  inline const Vector3& directionInline() const;
67 
68  /**
69  * Returns the angle of the light cone in radian.
70  * @see coneAngle().
71  */
72  inline Scalar coneAngleInline() const;
73 
74  /**
75  * Returns the sharpness of the spot as fall off exponent.
76  * @see spotExponent().
77  */
78  inline Scalar spotExponentInline() const;
79 
80  /**
81  * Sets the direction of this directional light.
82  * @see SpotLight::setDirection().
83  */
84  void setDirection(const Vector3& direction) override;
85 
86  /**
87  * Sets the angle of the light cone in radian.
88  * @see SpotLight::setConeAngle().
89  */
90  bool setConeAngle(const Scalar angle) override;
91 
92  /**
93  * Sets the sharpness of the spot as fall off exponent.
94  * @see SpotLight::setSpotExponent().
95  */
96  bool setSpotExponent(const Scalar exponent) override;
97 
98  protected:
99 
100  /**
101  * Creates a new spot light object.
102  */
104 
105  /**
106  * Destructs a spot light object.
107  */
108  ~GISpotLight() override;
109 
110  protected:
111 
112  /// Light direction inside the local coordinate system.
114 
115  /// Light cone angle.
117 
118  /// Cosine of the light cone angle.
120 
121  /// Light spot exponent.
123 };
124 
126 {
127  return lightConeAngleCos;
128 }
129 
131 {
132  return lightDirection;
133 }
134 
136 {
137  return lightConeAngle;
138 }
139 
141 {
142  return lightSpotExponent;
143 }
144 
145 }
146 
147 }
148 
149 }
150 
151 #endif // META_OCEAN_RENDERING_GI_SPOT_LIGHT_H
This class implements a class factory for all Global Illumination objects.
Definition: GIFactory.h:30
This class implements a point light.
Definition: GIPointLight.h:32
This class implements a spot light.
Definition: GISpotLight.h:32
Scalar lightSpotExponent
Light spot exponent.
Definition: GISpotLight.h:122
const Vector3 & directionInline() const
Returns the direction of this directional light.
Definition: GISpotLight.h:130
Scalar lightConeAngleCos
Cosine of the light cone angle.
Definition: GISpotLight.h:119
void setDirection(const Vector3 &direction) override
Sets the direction of this directional light.
bool setConeAngle(const Scalar angle) override
Sets the angle of the light cone in radian.
GISpotLight()
Creates a new spot light object.
Vector3 direction() const override
Returns the direction of this directional light.
Scalar spotExponent() const override
Returns the sharpness of the spot as fall off exponent.
Scalar spotExponentInline() const
Returns the sharpness of the spot as fall off exponent.
Definition: GISpotLight.h:140
Scalar coneAngleInline() const
Returns the angle of the light cone in radian.
Definition: GISpotLight.h:135
bool setSpotExponent(const Scalar exponent) override
Sets the sharpness of the spot as fall off exponent.
Vector3 lightDirection
Light direction inside the local coordinate system.
Definition: GISpotLight.h:113
Scalar coneAngleCos() const
Returns the cosine of the cone angle.
Definition: GISpotLight.h:125
~GISpotLight() override
Destructs a spot light object.
Scalar lightConeAngle
Light cone angle.
Definition: GISpotLight.h:116
Scalar coneAngle() const override
Returns the angle of the light cone in radian.
This class is the base class for all spot lights.
Definition: rendering/SpotLight.h:37
float Scalar
Definition of a scalar type.
Definition: Math.h:128
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15