Skylicht Engine
Loading...
Searching...
No Matches
CSH9.h
1/*
2!@
3MIT License
4
5Copyright (c) 2020 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
27namespace Skylicht
28{
29 namespace Lightmapper
30 {
31 class CSH9
32 {
33 protected:
34 core::vector3df m_sh[9];
35
36 public:
37 CSH9();
38 CSH9(const core::vector3df* sh);
39 CSH9(const CSH9& sh);
40 ~CSH9();
41
42 void zero();
43
44 inline core::vector3df* getValue()
45 {
46 return m_sh;
47 }
48
49 const core::vector3df* getValueConst() const
50 {
51 return m_sh;
52 }
53
54 void copyTo(core::vector3df* to);
55
56 CSH9 operator-() const;
57
58 CSH9& operator=(const CSH9& other);
59
60 CSH9 operator+(const CSH9& other) const;
61 CSH9& operator+=(const CSH9& other);
62
63 CSH9 operator-(const CSH9& other) const;
64 CSH9& operator-=(const CSH9& other);
65
66 CSH9 operator*(const CSH9& other) const;
67 CSH9& operator*=(const CSH9& other);
68 CSH9 operator*(const float v) const;
69 CSH9& operator*=(const float v);
70
71 CSH9 operator/(const CSH9& other) const;
72 CSH9& operator/=(const CSH9& other);
73 CSH9 operator/(const float v) const;
74 CSH9& operator/=(const float v);
75
76 core::vector3df dotProduct(const CSH9& other);
77
78 void projectOntoSH(const core::vector3df& n, const core::vector3df& color, float A0 = 1.0f, float A1 = 1.0f, float A2 = 1.0f);
79
80 void projectAddOntoSH(const core::vector3df& n, const core::vector3df& color, float A0 = 1.0f, float A1 = 1.0f, float A2 = 1.0f);
81
82 void getSH(const core::vector3df& n, core::vector3df& color);
83
84 void getSHIrradiance(const core::vector3df& n, core::vector3df& color);
85
86 void getSH4Irradiance(const core::vector3df& n, core::vector3df& color);
87
88 void convolveWithCosineKernel();
89 };
90 }
91}
Supports classes for baking lighting into Spherical Harmonics (SH) or Lightmap data.
Definition CBakeLightComponent.h:32
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29