3 Copyright (C) 2021 Liso <anlismon@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "irrlichttypes_bloated.h"
24 #include "util/basic_macros.h"
34 core::matrix4 ProjOrthMat;
35 core::matrix4 ViewMat;
39 class DirectionalLight
42 DirectionalLight(const u32 shadowMapResolution,
44 video::SColorf lightColor = video::SColor(0xffffffff),
45 f32 farValue = 100.0f);
46 ~DirectionalLight() = default;
48 //DISABLE_CLASS_COPY(DirectionalLight)
50 void update_frustum(const Camera *cam, Client *client);
52 // when set direction is updated to negative normalized(direction)
53 void setDirection(v3f dir);
54 v3f getDirection() const{
57 v3f getPosition() const;
59 /// Gets the light's matrices.
60 const core::matrix4 &getViewMatrix() const;
61 const core::matrix4 &getProjectionMatrix() const;
62 core::matrix4 getViewProjMatrix();
64 /// Gets the light's far value.
65 f32 getMaxFarValue() const
71 /// Gets the light's color.
72 const video::SColorf &getLightColor() const
77 /// Sets the light's color.
78 void setLightColor(const video::SColorf &lightColor)
80 diffuseColor = lightColor;
83 /// Gets the shadow map resolution for this light.
84 u32 getMapResolution() const
89 bool should_update_map_shadow{true};
92 void createSplitMatrices(const Camera *cam);
94 video::SColorf diffuseColor;
101 shadowFrustum shadow_frustum;