43 #include <OpenFlipper/common/RendererInfo.hh> 49 return renderManager_;
53 return postProcessorManager_;
56 RendererInfo::RendererInfo():
71 RenderManager::RenderManager()
73 availableRenderers_.clear();
74 availableRenderers_.push_back(
RendererInfo(0,
"Default internal renderer"));
76 activeRenderers_.clear();
81 for (
unsigned int i = 0 ; i < availableRenderers_.size() ; ++i)
82 if ( availableRenderers_[i].name == _name)
91 for (
unsigned int i = 0 ; i < availableRenderers_.size() ; ++i)
92 if ( availableRenderers_[i].name == _name)
93 return &availableRenderers_[i];
96 availableRenderers_[availableRenderers_.size()-1].
name = _name;
98 return &availableRenderers_[availableRenderers_.size()-1];
103 for (
unsigned int i = 0 ; i < availableRenderers_.size() ; ++i)
104 if ( availableRenderers_[i].name == _name)
105 return &availableRenderers_[i];
112 for (
unsigned int i = 0 ; i < availableRenderers_.size() ; ++i)
113 if ( availableRenderers_[i].name == _name)
124 for (
unsigned int i = 1 ; i < availableRenderers_.size() ; ++i)
125 if ( (availableRenderers_[i].modes & _mode) )
133 if ( _id >= availableRenderers_.size())
136 return &availableRenderers_[_id];
141 return availableRenderers_.size();
148 std::cerr <<
"RenderManager::setActive illegal viewer id: " << _id << std::endl;
153 if ( _id >= (
int)activeRenderers_.size() )
154 activeRenderers_.resize(_id +1 );
156 if ( _active < availableRenderers_.size() )
157 activeRenderers_[_id] = _active;
159 std::cerr <<
"Out of range error when setting active renderer" << std::endl;
165 std::cerr <<
"RenderManager::setActive illegal viewer id: " << _id << std::endl;
170 if ( _id >= (
int)activeRenderers_.size() ) {
171 activeRenderers_.resize(_id +1 );
175 for (
unsigned int i = 0 ; i < availableRenderers_.size() ; ++i)
176 if ( availableRenderers_[i].name == _active) {
177 activeRenderers_[_id] = i;
189 if ( _id >= (
int)activeRenderers_.size() )
190 activeRenderers_.resize(_id +1 );
192 return &availableRenderers_[activeRenderers_[_id]];
202 if ( _id >= (
int)activeRenderers_.size() )
203 activeRenderers_.resize(_id +1 );
205 return activeRenderers_[_id];
217 PostProcessorInfo::PostProcessorInfo():
225 PostProcessorManager::PostProcessorManager()
227 availablePostProcessors_.clear();
228 availablePostProcessors_.push_back(
PostProcessorInfo(0,
"Default internal post processor"));
230 activePostProcessors_.clear();
236 for (
unsigned int i = 0 ; i < availablePostProcessors_.size() ; ++i)
237 if ( availablePostProcessors_[i].name == _name)
246 for (
unsigned int i = 0 ; i < availablePostProcessors_.size() ; ++i)
247 if ( availablePostProcessors_[i].name == _name)
248 return &availablePostProcessors_[i];
251 availablePostProcessors_[availablePostProcessors_.size()-1].
name = _name;
253 return &availablePostProcessors_[availablePostProcessors_.size()-1];
258 for (
unsigned int i = 0 ; i < availablePostProcessors_.size() ; ++i)
259 if ( availablePostProcessors_[i].name == _name)
260 return &availablePostProcessors_[i];
267 if ( _id >= availablePostProcessors_.size())
270 return &availablePostProcessors_[_id];
275 return availablePostProcessors_.size();
281 if ( _viewerId < 0 ) {
282 std::cerr <<
"PostProcessorManager::setActive illegal viewer id: " << _viewerId << std::endl;
287 if ( _viewerId >= (
int)activePostProcessors_.size() )
288 activePostProcessors_.resize(_viewerId +1 );
291 activePostProcessors_[_viewerId].clear();
292 activePostProcessors_[_viewerId].push_back(_active);
299 std::cerr <<
"PostProcessorManager::setActive illegal viewer id: " << _id << std::endl;
304 if ( _id >= (
int)activePostProcessors_.size() )
305 activePostProcessors_.resize(_id +1 );
307 for (
unsigned int i = 0 ; i < availablePostProcessors_.size() ; ++i)
308 if ( availablePostProcessors_[i].name == _active) {
311 activePostProcessors_[_id].clear();
312 activePostProcessors_[_id].push_back(i);
324 if ( _id >= (
int)activePostProcessors_.size() )
325 activePostProcessors_.resize(_id +1 );
327 if ( (
int)activePostProcessors_[_id].size() <= _chainIdx)
330 return &availablePostProcessors_[activePostProcessors_[_id][_chainIdx]];
340 if ( _id >= (
int)activePostProcessors_.size() )
341 activePostProcessors_.resize(_id +1 );
343 if ( (
int)activePostProcessors_[_id].size() <= _chainIdx)
346 return activePostProcessors_[_id][_chainIdx];
356 if ( _id >= (
int)activePostProcessors_.size() )
357 activePostProcessors_.resize(_id +1 );
359 return (
int)activePostProcessors_[_id].size();
365 if ( _viewerId < 0 ) {
366 std::cerr <<
"PostProcessorManager::append illegal viewer id: " << _viewerId << std::endl;
371 if ( _viewerId >= (
int)activePostProcessors_.size() )
372 activePostProcessors_.resize(_viewerId +1 );
374 if ( _active < availablePostProcessors_.size() )
375 activePostProcessors_[_viewerId].push_back(_active);
377 std::cerr <<
"Out of range error when setting active post processor" << std::endl;
385 std::cerr <<
"PostProcessorManager::append illegal viewer id: " << _id << std::endl;
390 if ( _id >= (
int)activePostProcessors_.size() )
391 activePostProcessors_.resize(_id +1 );
393 for (
unsigned int i = 0 ; i < availablePostProcessors_.size() ; ++i)
394 if ( availablePostProcessors_[i].name == _active) {
395 activePostProcessors_[_id].push_back(i);
404 if ( _viewerId < 0 ) {
405 std::cerr <<
"PostProcessorManager::insert illegal viewer id: " << _viewerId << std::endl;
410 if ( _viewerId >= (
int)activePostProcessors_.size() )
411 activePostProcessors_.resize(_viewerId +1 );
413 if ( _active < availablePostProcessors_.size() )
414 activePostProcessors_[_viewerId].insert(activePostProcessors_[_viewerId].begin() + _chainIdx, _active);
416 std::cerr <<
"Out of range error when setting active post processor" << std::endl;
424 std::cerr <<
"PostProcessorManager::insert illegal viewer id: " << _id << std::endl;
429 if ( _id >= (
int)activePostProcessors_.size() )
430 activePostProcessors_.resize(_id +1 );
432 for (
unsigned int i = 0 ; i < availablePostProcessors_.size() ; ++i)
433 if ( availablePostProcessors_[i].name == _active) {
434 activePostProcessors_[_id].insert(activePostProcessors_[_id].begin() + _chainIdx, i);
446 if ( _id >= (
int)activePostProcessors_.size() )
447 activePostProcessors_.resize(_id +1 );
449 if ( (
int)activePostProcessors_[_id].size() <= _chainIdx)
452 activePostProcessors_[_id].erase(activePostProcessors_[_id].begin() + _chainIdx);
PostProcessorInfo * getPostProcessor(QString _name)
get post processor with the given name
PostProcessorInfo * active(int _id, int _chainIdx=0)
Get the current active post processor for viewer at chain index.
QString name
Name of the plugin ( requested from the plugin on load)
void setActive(unsigned int _active, int _id)
set the active renderer
int getRendererId(QString _name)
get renderer id with the given name
size_t available()
number of available post processor
RendererInfo * active(int _id)
Get the current active renderer.
void remove(int _id, int _chainIdx)
Remove a post processor at the specified chain index.
bool postProcessorExists(QString _name)
Check if a post processor with the given name exists.
QString name
Name of the plugin ( requested from the plugin on load)
PostProcessorInfo * newPostProcessor(QString _name)
Get a new post processor Instance.
void append(unsigned int _active, int _viewerId)
Append the active post processor to the chain for viewer.
void insert(unsigned int _active, int _chainIdx, int _viewerId)
Insert the active post processor to the chain for viewer.
bool rendererExists(QString _name)
Check if a renderer with the given name exists.
Interface to add global image post processor functions from within plugins.
RendererInfo * newRenderer(QString _name)
Get a new renderer Instance.
unsigned int activeId(int _id, int _chainIdx=0)
Get the id of the active post processor for viewer at chain index.
void setActive(unsigned int _active, int _viewerId)
set the active post processor for viewer
RendererInfo * operator[](unsigned int _id)
Get the renderer with the given id.
PostProcessorInfo * operator[](unsigned int _id)
Get the post processor with the given id.
unsigned int activeId(int _id)
Get the id of the active renderer.
int numActive(int _id)
Get the number of active post processors for viewer.
int countRenderers(ACG::SceneGraph::DrawModes::DrawMode _mode)
count renderers for a DrawMode (excluding the default renderer)
size_t available()
number of available renderers
Interface to add additional rendering functions from within plugins.
RendererInfo * getRenderer(QString _name)
get renderer with the given name