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