Commit 63c7e052 authored by Jan Möbius's avatar Jan Möbius

Choose postprocessor per viewer

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12300 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e30c3e92
......@@ -172,11 +172,12 @@ PostProcessorInfo::PostProcessorInfo()
}
PostProcessorManager::PostProcessorManager():
activePostProcessor_(0)
PostProcessorManager::PostProcessorManager()
{
availablePostProcessors_.clear();
availablePostProcessors_.push_back(PostProcessorInfo(0,"Default internal post processor"));
activePostProcessors_.clear();
}
......@@ -224,28 +225,45 @@ unsigned int PostProcessorManager::available() {
return availablePostProcessors_.size();
}
void PostProcessorManager::setActive(unsigned int _active) {
void PostProcessorManager::setActive(unsigned int _active, unsigned int _id) {
// Increase vector size
if ( _id >= activePostProcessors_.size() )
activePostProcessors_.resize(_id +1 );
if ( _active < availablePostProcessors_.size() )
activePostProcessor_ = _active;
activePostProcessors_[_id] = _active;
else
std::cerr << "Out of range error when setting active postprocessor" << std::endl;
std::cerr << "Out of range error when setting active post processor" << std::endl;
}
void PostProcessorManager::setActive(QString _active) {
void PostProcessorManager::setActive(QString _active,unsigned int _id) {
// Increase vector size
if ( _id >= activePostProcessors_.size() )
activePostProcessors_.resize(_id +1 );
for ( unsigned int i = 0 ; i < availablePostProcessors_.size() ; ++i)
if ( availablePostProcessors_[i].name == _active) {
activePostProcessor_ = i;
activePostProcessors_[_id] = i;
}
}
PostProcessorInfo* PostProcessorManager::active() {
return &availablePostProcessors_[activePostProcessor_];
PostProcessorInfo* PostProcessorManager::active(unsigned int _id) {
// Increase vector size
if ( _id >= activePostProcessors_.size() )
activePostProcessors_.resize(_id +1 );
return &availablePostProcessors_[activePostProcessors_[_id]];
}
unsigned int PostProcessorManager::activeId() {
return activePostProcessor_;
unsigned int PostProcessorManager::activeId(unsigned int _id) {
// Increase vector size
if ( _id >= activePostProcessors_.size() )
activePostProcessors_.resize(_id +1 );
return activePostProcessors_[_id];
}
......
......@@ -217,37 +217,41 @@ class PostProcessorManager {
*/
unsigned int available();
/** \brief set the active post processor
/** \brief set the active post processor for viewer
*
* @param _id viewer id
* @param _active id of the post processor
*/
void setActive(unsigned int _active);
void setActive(unsigned int _active, unsigned int _id);
/** \brief set the active post processor
/** \brief set the active post processor for viewer
*
* @param _id viewer id
* @param _active name of the post processor
*/
void setActive(QString _active);
void setActive(QString _active, unsigned int _id);
/** \brief Get the current active post processor
/** \brief Get the current active post processor for viewer
*
* @param _id ViewerId
* @return post processor
*/
PostProcessorInfo* active();
PostProcessorInfo* active(unsigned int _id);
/** \brief Get the id of the active post processor
/** \brief Get the id of the active post processor for viewer
*
* @param _id ViewerId
* @return post processor id
*/
unsigned int activeId();
unsigned int activeId(unsigned int _id);
private:
/// Vector holding all available post processors
std::vector<PostProcessorInfo> availablePostProcessors_;
/// The currently active post processor id
int activePostProcessor_;
std::vector<int> activePostProcessors_;
};
/// Get an instance of the Post Processor manager
......
......@@ -232,7 +232,7 @@ void CoreWidget::updatePopupMenuCoordsysNode(QMenu* _menu , const int /*_part*/
action->setCheckable( true );
// Check if this processor is currently active
if ( postProcessorManager().activeId() == i )
if ( postProcessorManager().activeId(PluginFunctions::activeExaminer() ) == i )
action->setChecked(true);
// Remember the id for the processor
......@@ -852,7 +852,7 @@ void CoreWidget::slotViewerDrawMenu(QAction * _action) {
void CoreWidget::slotPostProcessorMenu( QAction * _action) {
unsigned int mode = _action->data().toUInt();
postProcessorManager().setActive(mode);
postProcessorManager().setActive(mode,PluginFunctions::activeExaminer());
}
//=============================================================================
......@@ -588,7 +588,6 @@ void glViewer::drawScene()
// draw mono or stereo
makeCurrent();
/* std::cerr << "Draw Scene" << std::endl;
std::cerr << "Available renderers: " << renderManager().available() << std::endl;
......@@ -597,19 +596,17 @@ void glViewer::drawScene()
std::cerr << "Available postprocessors: " << postProcessorManager().available() << std::endl;
std::cerr << "Active postprocessor: " << postProcessorManager().active()->name.toStdString() << std::endl;
*/
if (stereo_) drawScene_stereo();
else drawScene_mono();
if ( postProcessorManager().activeId() != 0 ) {
std::cerr << "Non default postProcessor!" << std::endl;
postProcessorManager().active()->plugin->postProcess(glstate_);
if ( postProcessorManager().activeId( properties_.viewerId() ) != 0 ) {
postProcessorManager().active( properties_.viewerId() )->plugin->postProcess(glstate_);
}
// } else {
// std::cerr << "No post processor" << std::endl;
// }
glFinish();
frame_time_ = timer.elapsed();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment