Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
RenderPipeline
CPostProcessorRP.h
1
/*
2
!@
3
MIT License
4
5
Copyright (c) 2020 Skylicht Technology CO., LTD
6
7
Permission 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,
9
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10
subject to the following conditions:
11
12
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20
This file is part of the "Skylicht Engine".
21
https://github.com/skylicht-lab/skylicht-engine
22
!#
23
*/
24
25
#pragma once
26
27
#include "CBaseRP.h"
28
#include "IPostProcessor.h"
29
30
#include "Material/CMaterial.h"
31
32
namespace
Skylicht
33
{
67
class
SKYLICHT_API CPostProcessorRP :
68
public
CBaseRP,
69
public
IPostProcessor
70
{
71
protected
:
72
core::dimension2du
m_size;
73
core::dimension2du
m_lumSize;
74
75
ITexture
* m_luminance[2];
76
ITexture
* m_adaptLum;
77
int
m_lumTarget;
78
79
ITexture
* m_lastFrameBuffer;
80
ITexture
* m_rtt[10];
81
82
SMaterial
m_finalPass;
83
SMaterial
m_finalManualExposurePass;
84
SMaterial
m_linearPass;
85
SMaterial
m_lumPass;
86
SMaterial
m_adaptLumPass;
87
SMaterial
m_effectPass;
88
89
float
m_bloomThreshold;
90
float
m_bloomIntensity;
91
float
m_exposure;
92
93
bool
m_autoExposure;
94
bool
m_bloomEffect;
95
bool
m_fxaa;
96
bool
m_screenSpaceReflection;
97
bool
m_enableLastFrameTexture;
98
99
CMaterial
* m_brightFilter;
100
CMaterial
* m_blurDownFilter;
101
CMaterial
* m_blurUpFilter;
102
CMaterial
* m_bloomFilter;
103
CMaterial
* m_fxaaFilter;
104
105
public
:
106
CPostProcessorRP();
107
108
virtual
~CPostProcessorRP();
109
110
virtual
void
initRender(
int
w,
int
h);
111
112
virtual
void
resize(
int
w,
int
h);
113
114
virtual
void
render(
ITexture
* target,
CCamera
* camera,
CEntityManager
* entityManager,
const
core::recti
& vp,
int
cubeFaceId = -1,
IRenderPipeline
* lastRP = NULL);
115
116
virtual
void
postProcessing(
ITexture
* finalTarget,
ITexture
* color,
ITexture
* emission,
ITexture
* normal,
ITexture
* position,
const
core::recti
& viewport,
int
cubeFaceId = -1);
117
118
void
luminanceMapGeneration(
ITexture
* color);
119
120
void
brightFilter(
ITexture
* from,
ITexture
* to,
ITexture
* emission);
121
122
void
blurDown(
int
from,
int
to);
123
124
void
blurUp(
int
from,
int
to);
125
126
inline
void
enableAutoExposure(
bool
b)
127
{
128
m_autoExposure = b;
129
}
130
131
inline
bool
isEnableAutoExposure()
132
{
133
return
m_autoExposure;
134
}
135
136
inline
void
setManualExposure(
float
f)
137
{
138
m_exposure = f;
139
}
140
141
inline
float
getManualExposure()
142
{
143
return
m_exposure;
144
}
145
146
inline
void
enableBloomEffect(
bool
b)
147
{
148
m_bloomEffect = b;
149
}
150
151
inline
bool
isEnableBloomEffect()
152
{
153
return
m_bloomEffect;
154
}
155
156
inline
void
enableFXAA(
bool
b)
157
{
158
m_fxaa = b;
159
}
160
161
inline
bool
isEnableFXAA()
162
{
163
return
m_fxaa;
164
}
165
166
inline
void
enableScreenSpaceReflection(
bool
b)
167
{
168
m_screenSpaceReflection = b;
169
}
170
171
virtual
bool
isEnableScreenSpaceReflection()
172
{
173
return
m_screenSpaceReflection;
174
}
175
176
inline
void
enableLastFrameTexture(
bool
b)
177
{
178
m_enableLastFrameTexture = b;
179
}
180
181
inline
bool
isEnableLastFrameTexture()
182
{
183
return
m_enableLastFrameTexture;
184
}
185
186
inline
void
setBloomThreshold(
float
f)
187
{
188
m_bloomThreshold = f;
189
}
190
191
inline
void
setBloomIntensity(
float
f)
192
{
193
m_bloomIntensity = f;
194
}
195
196
inline
float
getBloomThreshold()
197
{
198
return
m_bloomThreshold;
199
}
200
201
inline
float
getBloomIntensity()
202
{
203
return
m_bloomIntensity;
204
}
205
206
virtual
ITexture
* getLastFrameBuffer()
207
{
208
return
m_lastFrameBuffer;
209
}
210
211
protected
:
212
213
void
initMainRTT(
int
w,
int
h);
214
215
void
releaseMainRTT();
216
217
void
renderEffect(
int
fromTarget,
int
toTarget,
CMaterial
* material);
218
219
void
renderEffect(
ITexture
* fromTarget,
ITexture
* toTarget,
CMaterial
* material);
220
};
221
}
Skylicht::CCamera
This is an object class used to set up the camera, including its position, viewing angle,...
Definition
CCamera.h:70
Skylicht::CEntityManager
This object class manages all entities within a scene.
Definition
CEntityManager.h:89
Skylicht::CMaterial
The object class describes material information such as which shader it's associated with,...
Definition
CMaterial.h:84
Skylicht::IRenderPipeline
Definition
IRenderPipeline.h:37
irr::video::ITexture
Interface of a Video Driver dependent Texture.
Definition
ITexture.h:119
irr::video::SMaterial
Struct for holding parameters for a material renderer.
Definition
SMaterial.h:255
Skylicht
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition
AudioDebugLog.h:29
irr::core::recti
rect< s32 > recti
Rectangle with int values.
Definition
rect.h:273
irr::core::dimension2du
dimension2d< u32 > dimension2du
Typedef for an unsigned integer dimension.
Definition
dimension2d.h:212
Generated by
1.17.0