Developer Documentation

RendererInfo.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42 #pragma once
43
44 #include <QString>
45 #include <QObject>
46 #include <ACG/Scenegraph/DrawModes.hh>
47 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
48 #include <OpenFlipper/BasePlugin/PostProcessorInterface.hh>
49 #include <OpenFlipper/BasePlugin/RenderInterface.hh>
50 #include <OpenFlipper/common/GlobalDefines.hh>
51
52 #include <vector>
53
55 class DLLEXPORT RendererInfo{
56
57 public :
58
59 RendererInfo();
60
61 RendererInfo(RenderInterface* _plugin,QString _name);
62
64 RenderInterface* plugin;
65
67 QString name;
68
70 QString version;
71
73 QString description;
74
76 ACG::SceneGraph::DrawModes::DrawMode modes;
77
79 QAction* optionsAction;
80 };
81
82
83 class DLLEXPORT RenderManager {
84 public:
85 RenderManager();
86
92 bool rendererExists(QString _name);
93
100 RendererInfo* newRenderer(QString _name);
101
107 int getRendererId(QString _name);
108
114 RendererInfo* getRenderer(QString _name);
115
124 int countRenderers(ACG::SceneGraph::DrawModes::DrawMode _mode);
125
131 RendererInfo* operator[](unsigned int _id);
132
137 size_t available();
138
144 void setActive(unsigned int _active, int _id);
145
151 void setActive(QString _active, int _id);
152
158 RendererInfo* active(int _id);
159
165 unsigned int activeId(int _id);
166
167 private:
169 std::vector<RendererInfo> availableRenderers_;
170
172 std::vector<unsigned int> activeRenderers_;
173 };
174
176 DLLEXPORT
177 RenderManager& renderManager();
178
179 //===================================================================================
180 // Post processor Manager
181 //===================================================================================
182
184 class DLLEXPORT PostProcessorInfo{
185
186 public :
187
188 PostProcessorInfo();
189
190 PostProcessorInfo(PostProcessorInterface* _plugin, QString _name);
191
193 PostProcessorInterface* plugin;
194
196 QString name;
197
199 QString description;
200
202 QString version;
203
205 QAction* optionsAction;
206
207 };
208
209
210 class DLLEXPORT PostProcessorManager {
211 public:
212
213 PostProcessorManager();
214
220 bool postProcessorExists(QString _name);
221
228 PostProcessorInfo* newPostProcessor(QString _name);
229
235 PostProcessorInfo* getPostProcessor(QString _name);
236
242 PostProcessorInfo* operator[](unsigned int _id);
243
248 size_t available();
249
255 void setActive(unsigned int _active, int _viewerId);
256
265 void setActive(QString _active, int _id);
266
267
268 //===========================================================================
271 //===========================================================================
272
278 void append(unsigned int _active, int _viewerId);
279
285 void append(QString _active, int _id);
286
293 void insert(unsigned int _active, int _chainIdx, int _viewerId);
294
301 void insert(QString _active, int _chainIdx, int _id);
302
308 void remove(int _id, int _chainIdx);
309
315 int numActive( int _id);
316
328 unsigned int activeId( int _id, int _chainIdx = 0);
329
336 PostProcessorInfo* active( int _id, int _chainIdx = 0);
337
338
339 private:
341 std::vector<PostProcessorInfo> availablePostProcessors_;
342
344 std::vector<std::vector<unsigned int> > activePostProcessors_;
345 };
346
348 DLLEXPORT
349 PostProcessorManager& postProcessorManager();
350
RendererInfo::name
QString name
Name of the plugin ( requested from the plugin on load)
Definition: RendererInfo.hh:67
PostProcessorInfo
Definition: RendererInfo.hh:184
RendererInfo::version
QString version
Version of the plugin ( requested from the plugin on load)
Definition: RendererInfo.hh:70
PostProcessorInfo::name
QString name
Name of the plugin ( requested from the plugin on load)
Definition: RendererInfo.hh:196
GlobalDefines.hh
RenderInterface.hh
RendererInfo::modes
ACG::SceneGraph::DrawModes::DrawMode modes
Supported DrawModes.
Definition: RendererInfo.hh:76
PostProcessorManager::activePostProcessors_
std::vector< std::vector< unsigned int > > activePostProcessors_
The currently active post processor chain.
Definition: RendererInfo.hh:344
RendererInfo::optionsAction
QAction * optionsAction
Possible action to add an options action or menu to the system.
Definition: RendererInfo.hh:79
RenderManager::availableRenderers_
std::vector< RendererInfo > availableRenderers_
Vector holding all available renderers.
Definition: RendererInfo.hh:169
RendererInfo::description
QString description
Description of the plugin ( requested from the plugin on load)
Definition: RendererInfo.hh:73
PostProcessorManager::availablePostProcessors_
std::vector< PostProcessorInfo > availablePostProcessors_
Vector holding all available post processors.
Definition: RendererInfo.hh:341
PostProcessorInfo::optionsAction
QAction * optionsAction
Possible action to add an options action or menu to the system.
Definition: RendererInfo.hh:205
PostProcessorInfo::description
QString description
Description of the plugin.
Definition: RendererInfo.hh:199
BaseInterface.hh
PostProcessorInterface.hh
RenderInterface
Interface to add additional rendering functions from within plugins.
Definition: RenderInterface.hh:60
ACG::SceneGraph::DrawModes::DrawMode
Specifies a DrawMode.
Definition: DrawModes.hh:288
RenderManager
Definition: RendererInfo.hh:83
PostProcessorInterface
Interface to add global image post processor functions from within plugins.
Definition: PostProcessorInterface.hh:147
PostProcessorInfo::version
QString version
Version of the plugin.
Definition: RendererInfo.hh:202
PostProcessorInfo::plugin
PostProcessorInterface * plugin
Pointer to the loaded plugin (Already casted when loading it)
Definition: RendererInfo.hh:193
RenderManager::activeRenderers_
std::vector< unsigned int > activeRenderers_
The currently active renderer ids.
Definition: RendererInfo.hh:172
RendererInfo::plugin
RenderInterface * plugin
Pointer to the loaded plugin (Already casted when loading it)
Definition: RendererInfo.hh:64
PostProcessorManager
Definition: RendererInfo.hh:210
DLLEXPORT
#define DLLEXPORT
Definition: GlobalDefines.hh:95
RendererInfo
Definition: RendererInfo.hh:55