Commit 1a8ddca9 authored by Jan Möbius's avatar Jan Möbius

Prepared rendermanager for per view control

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12301 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 63c7e052
......@@ -68,12 +68,12 @@ RendererInfo::RendererInfo(QObject* _plugin,QString _name) :
}
RenderManager::RenderManager():
activeRenderer_(0)
RenderManager::RenderManager()
{
availableRenderers_.clear();
availableRenderers_.push_back(RendererInfo(0,"Default internal renderer"));
activeRenderers_.clear();
}
bool RenderManager::rendererExists(QString _name) {
......@@ -133,28 +133,43 @@ unsigned int RenderManager::available() {
}
void RenderManager::setActive(unsigned int _active) {
void RenderManager::setActive(unsigned int _active, unsigned int _id) {
// Increase vector size
if ( _id >= activeRenderers_.size() )
activeRenderers_.resize(_id +1 );
if ( _active < availableRenderers_.size() )
activeRenderer_ = _active;
activeRenderers_[_id] = _active;
else
std::cerr << "Out of range error when setting active renderer" << std::endl;
}
void RenderManager::setActive(QString _active) {
void RenderManager::setActive(QString _active, unsigned int _id) {
// Increase vector size
if ( _id >= activeRenderers_.size() )
activeRenderers_.resize(_id +1 );
for ( unsigned int i = 0 ; i < availableRenderers_.size() ; ++i)
if ( availableRenderers_[i].name == _active) {
activeRenderer_ = i;
activeRenderers_[i] = i;
}
}
RendererInfo* RenderManager::active() {
return &availableRenderers_[activeRenderer_];
RendererInfo* RenderManager::active(unsigned int _id) {
// Increase vector size
if ( _id >= activeRenderers_.size() )
activeRenderers_.resize(_id +1 );
return &availableRenderers_[activeRenderers_[_id]];
}
unsigned int RenderManager::activeId() {
return activeRenderer_;
unsigned int RenderManager::activeId(unsigned int _id) {
// Increase vector size
if ( _id >= activeRenderers_.size() )
activeRenderers_.resize(_id +1 );
return activeRenderers_[_id];
}
//===================================================================
......
......@@ -122,34 +122,38 @@ class RenderManager {
/** \brief set the active renderer
*
* @param _id viewer id
* @param _active id of the renderer
*/
void setActive(unsigned int _active);
void setActive(unsigned int _active, unsigned int _id);
/** \brief set the active renderer
*
* @param _id viewer id
* @param _active name of the renderer
*/
void setActive(QString _active);
void setActive(QString _active, unsigned int _id);
/** \brief Get the current active renderer
*
* @param _id viewer id
* @return Renderer
*/
RendererInfo* active();
RendererInfo* active(unsigned int _id);
/** \brief Get the id of the active renderer
*
* @param _id viewer id
* @return renderer id
*/
unsigned int activeId();
unsigned int activeId(unsigned int _id);
private:
/// Vector holding all available renderers
std::vector<RendererInfo> availableRenderers_;
/// The currently active renderer id
unsigned int activeRenderer_;
/// The currently active renderer ids
std::vector<unsigned int> activeRenderers_;
};
/// Get an instance of the render manager
......@@ -251,7 +255,7 @@ class PostProcessorManager {
std::vector<PostProcessorInfo> availablePostProcessors_;
/// The currently active post processor id
std::vector<int> activePostProcessors_;
std::vector<unsigned int> activePostProcessors_;
};
/// Get an instance of the Post Processor manager
......
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