1 //  SuperTuxKart - a fun racing game with go-kart
2 //  Copyright (C) 2015 SuperTuxKart-Team
3 //
4 //  This program is free software; you can redistribute it and/or
5 //  modify it under the terms of the GNU General Public License
6 //  as published by the Free Software Foundation; either version 3
7 //  of the License, or (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program; if not, write to the Free Software
16 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17 
18 #ifndef HEADER_LIGHTING_PASSES_HPP
19 #define HEADER_LIGHTING_PASSES_HPP
20 
21 #include "graphics/gl_headers.hpp"
22 #include <irrlicht.h>
23 
24 class FrameBuffer;
25 class PostProcessing;
26 class ShadowMatrices;
27 
28 using namespace irr;
29 
30 class LightingPasses
31 {
32 private:
33     unsigned m_point_light_count;
34 
35     void renderEnvMap(GLuint normal_depth_texture,
36                       GLuint depth_stencil_texture,
37                       GLuint specular_probe,
38                       GLuint albedo_buffer);
39 
40     /** Generate diffuse and specular map */
41     void         renderSunlight(const core::vector3df &direction,
42                                 const video::SColorf &col,
43                                 GLuint normal_depth_texture,
44                                 GLuint depth_stencil_texture);
45 
46 public:
LightingPasses()47     LightingPasses(): m_point_light_count(0){}
48 
49     void updateLightsInfo(irr::scene::ICameraSceneNode * const camnode,
50                           float dt);
51     void renderLights(  bool has_shadow,
52                         GLuint normal_depth_texture,
53                         GLuint depth_stencil_texture,
54                         GLuint albedo_texture,
55                         const FrameBuffer* shadow_framebuffer,
56                         GLuint specular_probe);
57     void renderLightsScatter(GLuint depth_stencil_texture,
58                              const FrameBuffer& half1_framebuffer,
59                              const FrameBuffer& half2_framebuffer,
60                              const PostProcessing* post_processing);
61 };
62 
63 #endif //HEADER_LIGHTING_PASSES_HPP
64