Skylicht Engine
Loading...
Searching...
No Matches
CBoundShadowMaps.h
1/*
2!@
3MIT License
4
5Copyright (c) 2019 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include "Camera/CCamera.h"
28
29namespace Skylicht
30{
31 class SKYLICHT_API CBoundShadowMaps
32 {
33 protected:
34 int m_shadowMapSize;
35 float m_nearOffset;
36
37 core::vector3df m_lightDirection;
38
39 core::matrix4 m_bias;
40 core::matrix4 m_viewMatrices;
41 core::matrix4 m_projMatrices;
42 core::matrix4 m_textureMatrices;
43
44 core::aabbox3df m_frustumBox;
45
46 float m_shadowMatrices[16];
47
48 float m_farValue;
49
50 public:
51 CBoundShadowMaps();
52
53 virtual ~CBoundShadowMaps();
54
55 void init(int shadowMapSize, float farValue, int screenWidth, int screenHeight);
56
57 void update(CCamera* camera, const core::vector3df& lightDir, const core::aabbox3df& bound);
58
59 void update(const core::vector3df& lightPosition, float lightRadius, const core::aabbox3df& bound);
60
61 inline const core::aabbox3df& getFrustumBox()
62 {
63 return m_frustumBox;
64 }
65
66 inline const core::matrix4& getViewMatrices()
67 {
68 return m_viewMatrices;
69 }
70
71 inline const core::matrix4& getProjectionMatrices()
72 {
73 return m_projMatrices;
74 }
75
76 inline float* getShadowMatrices()
77 {
78 return m_shadowMatrices;
79 }
80
81 protected:
82
83 void updateMatrix(core::vector3df& camPos, const core::aabbox3df& bound);
84 };
85}
This is an object class used to set up the camera, including its position, viewing angle,...
Definition CCamera.h:70
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29