25 int ShadowMapWidth {}, ShadowMapHeight {};
56 int ShadowMapWidth = 1000,
int ShadowMapHeight = 1000)
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);
74 this->IsShadows =
false;
75 if (ShadowMap) ShadowMap->Free();
94 this->BoxSize = BoxSize;
95 Projection =
matr4::Ortho(-BoxSize, BoxSize, -BoxSize, BoxSize, 1, BoxDepth);
101 this->BoxDepth = BoxDepth;
102 Projection =
matr4::Ortho(-BoxSize, BoxSize, -BoxSize, BoxSize, 1, BoxDepth);
108 this->ShadowMapWidth = ShadowMapWidth;
109 if (!ShadowMap)
return;
110 ShadowMap->Resize(ShadowMapWidth, ShadowMapHeight);
116 this->ShadowMapHeight = ShadowMapHeight;
117 if (!ShadowMap)
return;
118 ShadowMap->Resize(ShadowMapWidth, ShadowMapHeight);
125 int ShadowMapWidth = 1000,
int ShadowMapHeight = 1000) :
Color(
Color)
127 if (IsShadows)
EnableShadows(BoxSize, BoxDepth, ShadowMapWidth, ShadowMapHeight);
Topology object basis class for mesh creating implementation module.
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)
Frame buffer interface implementation module.
std::shared_ptr< T > shared
const matr4 & GetProjection() const
int GetShadowMapHeight() const
void EnableShadows(float BoxSize=10, float BoxDepth=100, int ShadowMapWidth=1000, int ShadowMapHeight=1000)
const shared< frame_buffer > & GetShadowMap() const
void SetBoxSize(float BoxSize)
void SetBoxDepth(float BoxDepth)
directional_light_component()=default
float GetBoxDepth() const
void SetIsShadows(bool IsShadows)
~directional_light_component()=default
directional_light_component(const directional_light_component &Other)=default
directional_light_component(const vec3 &Color, bool IsShadows=false, float BoxSize=10, float BoxDepth=0, int ShadowMapWidth=1000, int ShadowMapHeight=1000)
void SetShadowMapWidth(int ShadowMapWidth)
void SetShadowMapHeight(int ShadowMapHeight)
int GetShadowMapWidth() const