Easy3D 2.6.1
Loading...
Searching...
No Matches
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
31namespace easy3d {
32
33 class Camera;
34 class ShaderProgram;
36
60 {
61 public:
66 explicit EyeDomeLighting(Camera* cam);
70 virtual ~EyeDomeLighting();
74 void begin();
78 void end();
79
80 protected:
81
82 // Initialization of required framebuffer objects
83 void init_frame_buffers(int w, int h);
84
85 // Initialization of required GLSL shaders
86 void init_shader_programs();
87
88 // Render EDL in full resolution buffer
89 void shade_high(float scene_radius);
90
91 // Render EDL in middle resolution buffer
92 void shade_low();
93
94 // Render EDL in middle resolution buffer
95 void blur_low();
96
97 // Compose color and shaded images
98 void compose();
99
100 // Release graphics resources
101 void clear();
102
103 private:
104 Camera* camera_;
105
106 // Framebuffer object for initial projection
107
108 // used to record scene data
109 FramebufferObject* projection_fbo_;
110
112
113 // Framebuffer objects for EDL
114
115 // for EDL full res shading
116 FramebufferObject* high_fbo_;
117
118 // for EDL low res shading (image size/4)
119 FramebufferObject* low_fbo_;
120
122
123 // Shader programs
124 ShaderProgram* shade_program_;
125 ShaderProgram* compose_program_;
126 ShaderProgram* blur_program_;
127
128 float neighbours_[8][4];
129 float low_res_factor_; // basically 4
130
132
133 float z_near_; // near clipping plane
134 float z_far_; // far clipping plane
135
136 int width_;
137 int height_;
138
139 private:
140 //copying disabled
142 EyeDomeLighting& operator=(const EyeDomeLighting&);
143 };
144
145}
146
147#endif // EASY3D_RENDERER_EYE_DOME_LIGHTING_H
A perspective or orthographic camera.
Definition camera.h:113
EyeDomeLighting(Camera *cam)
Constructor.
Definition eye_dome_lighting.cpp:39
void end()
Ends the EDL rendering process.
Definition eye_dome_lighting.cpp:323
void begin()
Begins the EDL rendering process.
Definition eye_dome_lighting.cpp:294
virtual ~EyeDomeLighting()
Destructor.
Definition eye_dome_lighting.cpp:65
An implementation of framebuffer object (FBO).
Definition framebuffer_object.h:122
OpenGL Shader Compilation.
Definition shader_program.h:75
Definition collider.cpp:182