Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DeferredShading.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
5 * www.openflipper.org *
6 * *
7 *--------------------------------------------------------------------------- *
8 * This file is part of OpenFlipper. *
9 * *
10 * OpenFlipper is free software: you can redistribute it and/or modify *
11 * it under the terms of the GNU Lesser General Public License as *
12 * published by the Free Software Foundation, either version 3 of *
13 * the License, or (at your option) any later version with the *
14 * following exceptions: *
15 * *
16 * If other files instantiate templates or use macros *
17 * or inline functions from this file, or you compile this file and *
18 * link it with other files to produce an executable, this file does *
19 * not by itself cause the resulting executable to be covered by the *
20 * GNU Lesser General Public License. This exception does not however *
21 * invalidate any other reasons why the executable file might be *
22 * covered by the GNU Lesser General Public License. *
23 * *
24 * OpenFlipper is distributed in the hope that it will be useful, *
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27 * GNU Lesser General Public License for more details. *
28 * *
29 * You should have received a copy of the GNU LesserGeneral Public *
30 * License along with OpenFlipper. If not, *
31 * see <http://www.gnu.org/licenses/>. *
32 * *
33 \*===========================================================================*/
34 
35 /*===========================================================================*\
36 * *
37 * $Revision: 18127 $ *
38 * $LastChangedBy: moebius $ *
39 * $Date: 2014-02-05 10:12:54 +0100 (Wed, 05 Feb 2014) $ *
40 * *
41 \*===========================================================================*/
42 
43 #pragma once
44 
45 #include <QObject>
46 
49 
50 #include <ACG/GL/IRenderer.hh>
51 #include <ACG/GL/FBO.hh>
52 #include <ACG/GL/globjects.hh>
53 #include <ACG/GL/AntiAliasing.hh>
54 
55 #include <vector>
56 
57 
58 
60 {
61  Q_OBJECT
62  Q_INTERFACES(BaseInterface)
63  Q_INTERFACES(RenderInterface)
64 
65 #if QT_VERSION >= 0x050000
66  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-Deferred-Shading")
67 #endif
68 
69 public:
71  ~DeferredShading();
72 
73  QString name() { return (QString("Deferred Shading Renderer")); };
74  QString description( ) { return (QString(tr("Render scene with deferred shading for each light"))); };
75 
76 public slots:
77  QString version() { return QString("1.0"); };
78  QString renderObjectsInfo(bool _outputShaderInfo);
79 
80  QAction* optionsAction();
81 
82 private slots:
83 
84  //BaseInterface
85  void initializePlugin();
86  void exit(){}
87 
88  // RenderInterface
89  void render(ACG::GLState* _glState, Viewer::ViewerProperties& _properties);
90  QString rendererName() {return QString("Deferred_Shading");}
91  void supportedDrawModes(ACG::SceneGraph::DrawModes::DrawMode& _mode) {_mode = ACG::SceneGraph::DrawModes::DEFAULT;}
92 
93  void reloadShaders();
94 
95  QString checkOpenGL();
96 
97 
98  void slotMSAASelection( QAction * );
99 
100 private:
101 
102  void loadShader();
103 
106 
109 
112 
115 
118 
121 
124 
125 
128 
131 
134  {
135  ViewerResources() : scene_(0) {}
136  ~ViewerResources() {delete scene_;}
137 
138  void resize( int _newWidth, int _newHeight, int& _numSamples );
139 
140  ACG::FBO* scene_;
141  };
142 
143 
144 
145  int numSamples_;
146 
147  // requires texture buffers and will not load without them
148  #ifdef GL_ARB_texture_buffer_object
149  ACG::TextureBuffer filterWeightsBuffer_;
150  ACG::TextureBuffer materialBuffer_;
151  #endif
152 
153  std::vector<ACG::Vec3f> materialBufferData_;
154 
159  std::map<int, ViewerResources> viewerRes_;
160 };
161 
162 
163 
GLSL::Program * progSpot_
spot lighting pass
QAction * optionsAction()
Return options menu.
GLSL::Program * progBackground_
background color pass
std::map< int, ViewerResources > viewerRes_
GLSL::Program * progEmissive_
emissive color pass
GLSL::Program * progDirectionalMS_
directional lighting pass with multisampling
GLSL::Program * progEmissiveMS_
emissive color pass with multisampling
Collection of fbos for each viewport.
Definition: FBO.hh:83
Interface class from which all plugins have to be created.
QString renderObjectsInfo(bool _outputShaderInfo)
Return a qstring of the current render objects.
GLSL program class.
Definition: GLSLShader.hh:217
GLSL::Program * progPoint_
point lighting pass
QString name()
Return a name for the plugin.
GLSL::Program * progPointMS_
point lighting pass with multisampling
GLSL::Program * progSpotMS_
spot lighting pass with multisampling
DrawMode DEFAULT
use the default (global) draw mode and not the node's own.
Definition: DrawModes.cc:78
GLSL::Program * progDirectional_
directional lighting pass
Interface to add additional rendering functions from within plugins.
QString description()
Return a description of what the plugin is doing.