SleakEngine
0.1.0
C++23 multi-backend game engine
Toggle main menu visibility
Loading...
Searching...
No Matches
AreaLight.hpp
Go to the documentation of this file.
1
#ifndef _AREA_LIGHT_HPP_
2
#define _AREA_LIGHT_HPP_
3
4
#include <
Lighting/Light.hpp
>
5
6
namespace
Sleak
{
7
8
/// Emitting surface shape for an AreaLight.
9
/// @ingroup lighting
10
enum class
AreaLightShape
: uint8_t {
11
Rectangle
= 0,
12
Disc
= 1
13
};
14
15
/// Light emitted from a rectangular or disc surface rather than a point.
16
/// @ingroup lighting
17
class
ENGINE_API
AreaLight
:
public
Light
{
18
public
:
19
explicit
AreaLight
(
const
std::string& name =
"AreaLight"
);
20
~AreaLight
()
override
=
default
;
21
22
RenderEngine::LightGPUEntry
BuildGPUData
()
const override
;
23
24
void
SetPosition
(
const
Math::Vector3D
& pos) {
25
m_position = pos;
26
}
27
Math::Vector3D
GetPosition
()
const
{
return
m_position; }
28
29
void
SetDirection
(
const
Math::Vector3D
& dir) {
30
m_direction = dir;
31
m_direction.
Normalize
();
32
}
33
Math::Vector3D
GetDirection
()
const
{
return
m_direction; }
34
35
void
SetRange
(
float
range) { m_range = range; }
36
float
GetRange
()
const
{
return
m_range; }
37
38
void
SetWidth
(
float
width
) { m_width =
width
; }
39
float
GetWidth
()
const
{
return
m_width; }
40
41
void
SetHeight
(
float
height
) { m_height =
height
; }
42
float
GetHeight
()
const
{
return
m_height; }
43
44
void
SetShape
(
AreaLightShape
shape) { m_shape = shape; }
45
AreaLightShape
GetShape
()
const
{
return
m_shape; }
46
47
void
SetTwoSided
(
bool
twoSided) { m_twoSided = twoSided; }
48
bool
IsTwoSided
()
const
{
return
m_twoSided; }
49
50
private
:
51
Math::Vector3D
m_position{0.0f, 0.0f, 0.0f};
52
Math::Vector3D m_direction{0.0f, -1.0f, 0.0f};
53
float
m_range = 10.0f;
54
float
m_width = 1.0f;
55
float
m_height = 1.0f;
56
AreaLightShape
m_shape = AreaLightShape::Rectangle;
57
bool
m_twoSided =
false
;
58
};
59
60
}
// namespace Sleak
61
62
#endif
// _AREA_LIGHT_HPP_
width
int width
Definition
Application.cpp:40
height
int height
Definition
Application.cpp:41
Light.hpp
Sleak::AreaLight::SetShape
void SetShape(AreaLightShape shape)
Definition
AreaLight.hpp:44
Sleak::AreaLight::GetRange
float GetRange() const
Definition
AreaLight.hpp:36
Sleak::AreaLight::AreaLight
AreaLight(const std::string &name="AreaLight")
Definition
AreaLight.cpp:6
Sleak::AreaLight::IsTwoSided
bool IsTwoSided() const
Definition
AreaLight.hpp:48
Sleak::AreaLight::SetDirection
void SetDirection(const Math::Vector3D &dir)
Definition
AreaLight.hpp:29
Sleak::AreaLight::SetRange
void SetRange(float range)
Definition
AreaLight.hpp:35
Sleak::AreaLight::BuildGPUData
RenderEngine::LightGPUEntry BuildGPUData() const override
Packs this light's parameters into the GPU-side entry used by the lighting constant buffer.
Definition
AreaLight.cpp:8
Sleak::AreaLight::SetWidth
void SetWidth(float width)
Definition
AreaLight.hpp:38
Sleak::AreaLight::~AreaLight
~AreaLight() override=default
Sleak::AreaLight::SetPosition
void SetPosition(const Math::Vector3D &pos)
Definition
AreaLight.hpp:24
Sleak::AreaLight::GetShape
AreaLightShape GetShape() const
Definition
AreaLight.hpp:45
Sleak::AreaLight::GetHeight
float GetHeight() const
Definition
AreaLight.hpp:42
Sleak::AreaLight::SetTwoSided
void SetTwoSided(bool twoSided)
Definition
AreaLight.hpp:47
Sleak::AreaLight::SetHeight
void SetHeight(float height)
Definition
AreaLight.hpp:41
Sleak::AreaLight::GetPosition
Math::Vector3D GetPosition() const
Definition
AreaLight.hpp:27
Sleak::AreaLight::GetDirection
Math::Vector3D GetDirection() const
Definition
AreaLight.hpp:33
Sleak::AreaLight::GetWidth
float GetWidth() const
Definition
AreaLight.hpp:39
Sleak::Light::Light
Light(const std::string &name="Light")
Definition
Light.cpp:5
Sleak::Math::Vector3D
Definition
Vector.hpp:354
Sleak::Math::Vector3D::Normalize
Vector3D & Normalize()
Definition
Vector.hpp:436
Sleak::AreaLightShape
AreaLightShape
Definition
AreaLight.hpp:10
Sleak::AreaLightShape::Disc
@ Disc
Definition
AreaLight.hpp:12
Sleak::AreaLightShape::Rectangle
@ Rectangle
Definition
AreaLight.hpp:11
Sleak
Root namespace for everything the engine exposes.
Definition
Camera.hpp:10
Sleak::RenderEngine::LightGPUEntry
One light's packed GPU representation, laid out for std140/cbuffer alignment.
Definition
ConstantBuffer.hpp:20
include
public
Lighting
AreaLight.hpp
Generated on
for SleakEngine by
1.18.0