❖
Monad Engine
da02fba2
>
Undercity Codex
_
Loading...
Searching...
No Matches
PostProcess.h
Go to the documentation of this file.
1
/**
2
* @file PostProcess.h
3
* @ingroup mnd_graphics
4
* @brief Three.js-style pixel-art post-pass.
5
*
6
* Reads the scene RenderTarget's three attachments (colour, view-normals,
7
* depth), computes depth-edge and normal-edge indicators a la
8
* threejs.org/examples/webgl_postprocessing_pixel.html, and writes the
9
* result into its own colour FBO for the final BlitNearest upscale.
10
*
11
* For the current full-resolution RenderTarget path, pixelation is done in
12
* this pass by snapping colour/depth/normal samples to RenderSettings::pixelSize
13
* screen-pixel cells before applying the optional edge term.
14
*/
15
16
#pragma once
17
18
#include "GL/glew.h"
19
20
namespace
mnd
21
{
22
23
class
RenderTarget;
24
struct
CameraData;
25
26
class
PostProcess
27
{
28
public
:
29
bool
Init
();
30
void
Destroy
();
31
32
/// Lazily resize the internal output FBO to match the scene target.
33
void
Resize
(
int
w,
int
h);
34
35
/// Run the outline pass, sampling `scene` and writing to OutputTex().
36
void
RunOutline
(
const
RenderTarget
&scene,
const
CameraData
&cam);
37
38
GLuint
OutputTex
()
const
{
return
m_color; }
39
bool
IsValid
()
const
{
return
m_program != 0 && m_vao != 0; }
40
41
// Editor-tunable. Both 0 = passthrough (no edges).
42
float
depthEdgeStrength
= 0.4F;
43
float
normalEdgeStrength
= 0.3F;
44
45
private
:
46
bool
CreateFBO(
int
w,
int
h);
47
void
DestroyFBO();
48
49
GLuint
m_program = 0;
50
GLuint
m_vao = 0;
51
52
GLuint
m_fbo = 0;
53
GLuint
m_color = 0;
54
int
m_w = 0;
55
int
m_h = 0;
56
57
int
m_locColor = -1;
58
int
m_locNormal = -1;
59
int
m_locDepth = -1;
60
int
m_locTexel = -1;
61
int
m_locDepthStr = -1;
62
int
m_locNormalStr = -1;
63
int
m_locPixelSize = -1;
64
};
65
66
}
// namespace mnd
GLuint
unsigned int GLuint
Definition
GLForward.h:11
mnd::PostProcess
Definition
PostProcess.h:27
mnd::PostProcess::IsValid
bool IsValid() const
Definition
PostProcess.h:39
mnd::PostProcess::normalEdgeStrength
float normalEdgeStrength
Definition
PostProcess.h:43
mnd::PostProcess::depthEdgeStrength
float depthEdgeStrength
Definition
PostProcess.h:42
mnd::PostProcess::Resize
void Resize(int w, int h)
Lazily resize the internal output FBO to match the scene target.
Definition
PostProcess.cpp:178
mnd::PostProcess::RunOutline
void RunOutline(const RenderTarget &scene, const CameraData &cam)
Run the outline pass, sampling scene and writing to OutputTex().
Definition
PostProcess.cpp:187
mnd::PostProcess::OutputTex
GLuint OutputTex() const
Definition
PostProcess.h:38
mnd::PostProcess::Destroy
void Destroy()
Definition
PostProcess.cpp:116
mnd::PostProcess::Init
bool Init()
Definition
PostProcess.cpp:82
mnd::RenderTarget
Offscreen FBO with MRT colour + sampleable depth for low-resolution rendering.
Definition
RenderTarget.h:34
mnd
Definition
IdleClip.cpp:13
mnd::CameraData
Per-frame camera matrices and world-space position.
Definition
Common.h:35
engine
source
graphics
PostProcess.h
Generated by
1.9.8