#include <directional_light_component.h>
Directional light component class.
Definition at line 17 of file directional_light_component.h.
◆ directional_light_component() [1/3]
scl::directional_light_component::directional_light_component |
( |
| ) |
|
|
default |
Directional light methods.
◆ directional_light_component() [2/3]
◆ directional_light_component() [3/3]
scl::directional_light_component::directional_light_component |
( |
const vec3 & |
Color, |
|
|
bool |
IsShadows = false , |
|
|
float |
BoxSize = 10 , |
|
|
float |
BoxDepth = 0 , |
|
|
int |
ShadowMapWidth = 1000 , |
|
|
int |
ShadowMapHeight = 1000 |
|
) |
| |
|
inline |
Definition at line 124 of file directional_light_component.h.
126 {
127 if (IsShadows)
EnableShadows(BoxSize, BoxDepth, ShadowMapWidth, ShadowMapHeight);
128 }
void EnableShadows(float BoxSize=10, float BoxDepth=100, int ShadowMapWidth=1000, int ShadowMapHeight=1000)
◆ ~directional_light_component()
scl::directional_light_component::~directional_light_component |
( |
| ) |
|
|
default |
◆ DisableShadows()
void scl::directional_light_component::DisableShadows |
( |
| ) |
|
|
inline |
- Disable directional light shadow casting function.
- Parameters
-
- Returns
- None.
Definition at line 72 of file directional_light_component.h.
73 {
74 this->IsShadows = false;
75 if (ShadowMap) ShadowMap->Free();
76 ShadowMap.reset();
77 }
◆ EnableShadows()
void scl::directional_light_component::EnableShadows |
( |
float |
BoxSize = 10 , |
|
|
float |
BoxDepth = 100 , |
|
|
int |
ShadowMapWidth = 1000 , |
|
|
int |
ShadowMapHeight = 1000 |
|
) |
| |
|
inline |
- Enable directiona light shadow casting function.
- Parameters
-
BoxSize | - ortho projection shadow caster box width. |
BoxDepth | - ortho projecction shadow caster box depth. |
ShadowMapWidth | - shadow map frame buffer width in pixels. |
ShadowMapHeight | - shadow map frame buffer height in pixels. |
Definition at line 55 of file directional_light_component.h.
57 {
58 this->IsShadows = true;
59 this->BoxSize = BoxSize;
60 this->BoxDepth = BoxDepth;
61 this->ShadowMapWidth = ShadowMapWidth, this->ShadowMapHeight = ShadowMapHeight;
62 Projection =
matr4::Ortho(-BoxSize, BoxSize, -BoxSize, BoxSize, 1, BoxDepth);
63 ShadowMap =
frame_buffer::Create(frame_buffer_props { ShadowMapWidth, ShadowMapHeight, 1,
false, 0, 1 });
64 }
static shared< frame_buffer > Create(const frame_buffer_props &Props)
static matr4 Ortho(float Left, float Right, float Bottom, float Top, float Near, float Far)
◆ GetBoxDepth()
float scl::directional_light_component::GetBoxDepth |
( |
| ) |
const |
|
inline |
◆ GetBoxSize()
float scl::directional_light_component::GetBoxSize |
( |
| ) |
const |
|
inline |
◆ GetIsShadow()
bool scl::directional_light_component::GetIsShadow |
( |
| ) |
const |
|
inline |
Directiona light data getter/setter functions.
Flag, showing wheather directional light is shadow caster or not getter function.
Definition at line 34 of file directional_light_component.h.
◆ GetProjection()
const matr4 & scl::directional_light_component::GetProjection |
( |
| ) |
const |
|
inline |
◆ GetShadowMap()
◆ GetShadowMapHeight()
int scl::directional_light_component::GetShadowMapHeight |
( |
| ) |
const |
|
inline |
◆ GetShadowMapWidth()
int scl::directional_light_component::GetShadowMapWidth |
( |
| ) |
const |
|
inline |
◆ SetBoxDepth()
void scl::directional_light_component::SetBoxDepth |
( |
float |
BoxDepth | ) |
|
|
inline |
Ortho projecction shadow caster box depth getter function.
Definition at line 99 of file directional_light_component.h.
100 {
101 this->BoxDepth = BoxDepth;
102 Projection =
matr4::Ortho(-BoxSize, BoxSize, -BoxSize, BoxSize, 1, BoxDepth);
103 }
◆ SetBoxSize()
void scl::directional_light_component::SetBoxSize |
( |
float |
BoxSize | ) |
|
|
inline |
Ortho projection shadow caster box width getter function.
Definition at line 92 of file directional_light_component.h.
93 {
94 this->BoxSize = BoxSize;
95 Projection =
matr4::Ortho(-BoxSize, BoxSize, -BoxSize, BoxSize, 1, BoxDepth);
96 }
◆ SetIsShadows()
void scl::directional_light_component::SetIsShadows |
( |
bool |
IsShadows | ) |
|
|
inline |
- Set flag, showing wheather directiona light casing shadows or not function.
- Parameters
-
IsShadows | - flag, showing wheather directiona light casing shadows or not function. |
- Returns
- None.
Definition at line 85 of file directional_light_component.h.
◆ SetShadowMapHeight()
void scl::directional_light_component::SetShadowMapHeight |
( |
int |
ShadowMapHeight | ) |
|
|
inline |
Shadow map frame buffer height in pixels getter function.
Definition at line 114 of file directional_light_component.h.
115 {
116 this->ShadowMapHeight = ShadowMapHeight;
117 if (!ShadowMap) return;
118 ShadowMap->Resize(ShadowMapWidth, ShadowMapHeight);
119 }
◆ SetShadowMapWidth()
void scl::directional_light_component::SetShadowMapWidth |
( |
int |
ShadowMapWidth | ) |
|
|
inline |
Shadow map frame buffer width in pixels getter function.
Definition at line 106 of file directional_light_component.h.
107 {
108 this->ShadowMapWidth = ShadowMapWidth;
109 if (!ShadowMap) return;
110 ShadowMap->Resize(ShadowMapWidth, ShadowMapHeight);
111 }
◆ Color
vec3 scl::directional_light_component::Color {} |
◆ Strength
float scl::directional_light_component::Strength { 1 } |
The documentation for this struct was generated from the following file: