Ocean
GLESSpotLight.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_GLES_SPOT_LIGHT_H
9 #define META_OCEAN_RENDERING_GLES_SPOT_LIGHT_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Rendering
20 {
21 
22 namespace GLESceneGraph
23 {
24 
25 /**
26  * This class implements a GLESceneGraph spot light.
27  * @ingroup renderinggles
28  */
29 class OCEAN_RENDERING_GLES_EXPORT GLESSpotLight :
30  virtual public GLESPointLight,
31  virtual public SpotLight
32 {
33  friend class GLESFactory;
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 sharpness of the spot as fall off exponent.
51  * @see SpotLight::spotExponent().
52  */
53  Scalar spotExponent() const override;
54 
55  /**
56  * Sets the direction of this directional light.
57  * @see SpotLight::setDirection().
58  */
59  void setDirection(const Vector3& direction) override;
60 
61  /**
62  * Sets the angle of the light cone in radian.
63  * @see SpotLight::setConeAngle().
64  */
65  bool setConeAngle(const Scalar angle) override;
66 
67  /**
68  * Sets the sharpness of the spot as fall off exponent.
69  * @see SpotLight::setSpotExponent().
70  */
71  bool setSpotExponent(const Scalar exponent) override;
72 
73  /**
74  * Binds this light source.
75  * @see GLESLightSource::bindLight().
76  */
77  void bindLight(GLESShaderProgram& shaderProgram, const HomogenousMatrix4& camera_T_model, const HomogenousMatrix4& camera_T_world, const SquareMatrix3& normalMatrix, const unsigned int index) override;
78 
79  protected:
80 
81  /**
82  * Creates a new GLESceneGraph spot light object.
83  */
85 
86  /**
87  * Destructs a GLESceneGraph spot light object.
88  */
89  ~GLESSpotLight() override;
90 
91  protected:
92 
93  /// Light direction inside the local coordinate system.
95 
96  /// Light cone angle.
98 
99  /// Light spot exponent.
101 };
102 
103 }
104 
105 }
106 
107 }
108 
109 #endif // META_OCEAN_RENDERING_GLES_SPOT_LIGHT_H
This class implements a class factory for all GLESceneGraph objects.
Definition: GLESFactory.h:30
This class implements a GLESceneGraph point light object.
Definition: GLESPointLight.h:32
This class implements a container for an OpenGL ES shader program.
Definition: GLESShaderProgram.h:53
This class implements a GLESceneGraph spot light.
Definition: GLESSpotLight.h:32
Scalar coneAngle_
Light cone angle.
Definition: GLESSpotLight.h:97
Scalar spotExponent() const override
Returns the sharpness of the spot as fall off exponent.
GLESSpotLight()
Creates a new GLESceneGraph spot light object.
Scalar spotExponent_
Light spot exponent.
Definition: GLESSpotLight.h:100
Vector3 direction() const override
Returns the direction of this directional light.
~GLESSpotLight() override
Destructs a GLESceneGraph spot light object.
Vector3 direction_
Light direction inside the local coordinate system.
Definition: GLESSpotLight.h:94
Scalar coneAngle() const override
Returns the angle of the light cone in radian.
bool setSpotExponent(const Scalar exponent) override
Sets the sharpness of the spot as fall off exponent.
void bindLight(GLESShaderProgram &shaderProgram, const HomogenousMatrix4 &camera_T_model, const HomogenousMatrix4 &camera_T_world, const SquareMatrix3 &normalMatrix, const unsigned int index) override
Binds this light source.
bool setConeAngle(const Scalar angle) override
Sets the angle of the light cone in radian.
void setDirection(const Vector3 &direction) override
Sets the direction of this directional light.
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