mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
BugFix: change Device of DeviceSource with different resolution
This commit is contained in:
82
Source.cpp
82
Source.cpp
@@ -492,45 +492,59 @@ void Source::attach(FrameBuffer *renderbuffer)
|
||||
delete renderbuffer_;
|
||||
renderbuffer_ = renderbuffer;
|
||||
|
||||
// create the surfaces to draw the frame buffer in the views
|
||||
rendersurface_ = new FrameBufferSurface(renderbuffer_, blendingshader_);
|
||||
groups_[View::RENDERING]->attach(rendersurface_);
|
||||
groups_[View::GEOMETRY]->attach(rendersurface_);
|
||||
// only first time initialization
|
||||
if ( mode_ == UNINITIALIZED ) {
|
||||
|
||||
// for mixing and layer views, add another surface to overlay
|
||||
// (stippled view on top with transparency)
|
||||
mixingsurface_ = new FrameBufferSurface(renderbuffer_, mixingshader_);
|
||||
groups_[View::MIXING]->attach(mixingsurface_);
|
||||
groups_[View::LAYER]->attach(mixingsurface_);
|
||||
// create the surfaces to draw the frame buffer in the views
|
||||
rendersurface_ = new FrameBufferSurface(renderbuffer_, blendingshader_);
|
||||
groups_[View::RENDERING]->attach(rendersurface_);
|
||||
groups_[View::GEOMETRY]->attach(rendersurface_);
|
||||
|
||||
// for views showing a scaled mixing surface, a dedicated transparent surface allows grabbing
|
||||
activesurface_ = new Surface();
|
||||
activesurface_->setTextureIndex(Resource::getTextureTransparent());
|
||||
groups_[View::TEXTURE]->attach(activesurface_);
|
||||
groups_[View::MIXING]->attach(activesurface_);
|
||||
groups_[View::LAYER]->attach(activesurface_);
|
||||
// for mixing and layer views, add another surface to overlay
|
||||
// (stippled view on top with transparency)
|
||||
mixingsurface_ = new FrameBufferSurface(renderbuffer_, mixingshader_);
|
||||
groups_[View::MIXING]->attach(mixingsurface_);
|
||||
groups_[View::LAYER]->attach(mixingsurface_);
|
||||
|
||||
// Transition group node is optionnal
|
||||
if (groups_[View::TRANSITION]->numChildren() > 0)
|
||||
groups_[View::TRANSITION]->attach(mixingsurface_);
|
||||
// for views showing a scaled mixing surface, a dedicated transparent surface allows grabbing
|
||||
activesurface_ = new Surface();
|
||||
activesurface_->setTextureIndex(Resource::getTextureTransparent());
|
||||
groups_[View::TEXTURE]->attach(activesurface_);
|
||||
groups_[View::MIXING]->attach(activesurface_);
|
||||
groups_[View::LAYER]->attach(activesurface_);
|
||||
|
||||
// if a symbol is available, add it to overlay
|
||||
if (symbol_) {
|
||||
overlays_[View::MIXING]->attach( symbol_ );
|
||||
overlays_[View::LAYER]->attach( symbol_ );
|
||||
// hack to place the symbols in the corner independently of aspect ratio
|
||||
symbol_->translation_.x += 0.1f * (renderbuffer_->aspectRatio()-1.f);
|
||||
// Transition group node is optionnal
|
||||
if (groups_[View::TRANSITION]->numChildren() > 0)
|
||||
groups_[View::TRANSITION]->attach(mixingsurface_);
|
||||
|
||||
// if a symbol is available, add it to overlay
|
||||
if (symbol_) {
|
||||
overlays_[View::MIXING]->attach( symbol_ );
|
||||
overlays_[View::LAYER]->attach( symbol_ );
|
||||
}
|
||||
|
||||
// add lock icon to views (displayed on front)
|
||||
groups_[View::LAYER]->attach( locker_ );
|
||||
groups_[View::MIXING]->attach( locker_ );
|
||||
groups_[View::GEOMETRY]->attach( locker_ );
|
||||
groups_[View::TEXTURE]->attach( locker_ );
|
||||
|
||||
// make the source visible
|
||||
setMode(VISIBLE);
|
||||
}
|
||||
else {
|
||||
rendersurface_->setFrameBuffer(renderbuffer_);
|
||||
mixingsurface_->setFrameBuffer(renderbuffer_);
|
||||
}
|
||||
|
||||
// hack to place the initials in the corner independently of aspect ratio
|
||||
initial_0_->translation_.x -= renderbuffer_->aspectRatio();
|
||||
initial_1_->translation_.x -= renderbuffer_->aspectRatio();
|
||||
// if a symbol is available
|
||||
if (symbol_)
|
||||
// hack to place the symbols in the corner independently of aspect ratio
|
||||
symbol_->translation_.x = 1.1f * (renderbuffer_->aspectRatio()-1.f);
|
||||
|
||||
// add lock icon to views (displayed on front)
|
||||
groups_[View::LAYER]->attach( locker_ );
|
||||
groups_[View::MIXING]->attach( locker_ );
|
||||
groups_[View::GEOMETRY]->attach( locker_ );
|
||||
groups_[View::TEXTURE]->attach( locker_ );
|
||||
// hack to place the initials in the corner independently of aspect ratio
|
||||
initial_0_->translation_.x = 0.2f - renderbuffer_->aspectRatio();
|
||||
initial_1_->translation_.x = 0.4f - renderbuffer_->aspectRatio();
|
||||
|
||||
// scale all icon nodes to match aspect ratio
|
||||
for (int v = View::MIXING; v < View::INVALID; v++) {
|
||||
@@ -546,10 +560,6 @@ void Source::attach(FrameBuffer *renderbuffer)
|
||||
delete maskbuffer_;
|
||||
maskbuffer_ = new FrameBuffer( glm::vec3(0.5) * renderbuffer->resolution() );
|
||||
|
||||
// make the source visible
|
||||
if ( mode_ == UNINITIALIZED )
|
||||
setMode(VISIBLE);
|
||||
|
||||
// request update
|
||||
need_update_ = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user