Easy3D 2.5.3
eye_dome_lighting.h
1/********************************************************************
2 * Copyright (C) 2015 Liangliang Nan <liangliang.nan@gmail.com>
3 * https://3d.bk.tudelft.nl/liangliang/
4 *
5 * This file is part of Easy3D. If it is useful in your research/work,
6 * I would be grateful if you show your appreciation by citing it:
7 * ------------------------------------------------------------------
8 * Liangliang Nan.
9 * Easy3D: a lightweight, easy-to-use, and efficient C++ library
10 * for processing and rendering 3D data.
11 * Journal of Open Source Software, 6(64), 3255, 2021.
12 * ------------------------------------------------------------------
13 *
14 * Easy3D is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License Version 3
16 * as published by the Free Software Foundation.
17 *
18 * Easy3D is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ********************************************************************/
26
27#ifndef EASY3D_RENDERER_EYE_DOME_LIGHTING_H
28#define EASY3D_RENDERER_EYE_DOME_LIGHTING_H
29
30
31#include <string>
32
33namespace easy3d {
34
35
66 class Camera;
67 class ShaderProgram;
68 class FramebufferObject;
69
71 {
72 public:
75 explicit EyeDomeLighting(Camera* cam);
76 virtual ~EyeDomeLighting();
77
78 void begin();
79 void end();
80
81 protected:
82
83 // Initialization of required framebuffer objects
84 void init_frame_buffers(int w, int h);
85
86 // Initialization of required GLSL shaders
87 void init_shader_programs();
88
89 // Render EDL in full resolution buffer
90 void shade_high(float scene_radius);
91
92 // Render EDL in middle resolution buffer
93 void shade_low();
94
95 // Render EDL in middle resolution buffer
96 void blur_low();
97
98 // Compose color and shaded images
99 void compose();
100
101 // Release graphics resources
102 void clear();
103
104 private:
105 Camera* camera_;
106
107 // Framebuffer object for initial projection
108
109 // used to record scene data
110 FramebufferObject* projection_fbo_;
111
113
114 // Framebuffer objects for EDL
115
116 // for EDL full res shading
117 FramebufferObject* high_fbo_;
118
119 // for EDL low res shading (image size/4)
120 FramebufferObject* low_fbo_;
121
123
124 // Shader programs
125 ShaderProgram* shade_program_;
126 ShaderProgram* compose_program_;
127 ShaderProgram* blur_program_;
128
129 float neighbours_[8][4];
130 float low_res_factor_; // basically 4
131
133
134 float z_near_; // near clipping plane
135 float z_far_; // far clipping plane
136
137 int width_;
138 int height_;
139
140 private:
141 //copying disabled
143 EyeDomeLighting& operator=(const EyeDomeLighting&);
144 };
145
146}
147
148#endif // EASY3D_RENDERER_EYE_DOME_LIGHTING_H
A perspective or orthographic camera.
Definition: camera.h:116
An implementation of the Eye Dome Lighting (EDL) technique.
Definition: eye_dome_lighting.h:71
EyeDomeLighting(Camera *cam)
Constructor.
Definition: eye_dome_lighting.cpp:39
An implementation of framebuffer object (FBO).
Definition: framebuffer_object.h:122
OpenGL Shader Compilation.
Definition: shader_program.h:78
Definition: collider.cpp:182