mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Isolate implementation of RenderSource and new Non-Recursive mode
Separate files for RenderSource, make RenderSource playable, and implement two rendering mechanisms
This commit is contained in:
@@ -382,77 +382,3 @@ std::string SessionGroupSource::info() const
|
||||
else
|
||||
return std::string("undefined group.");
|
||||
}
|
||||
|
||||
RenderSource::RenderSource(uint64_t id) : Source(id), session_(nullptr)
|
||||
{
|
||||
// set symbol
|
||||
symbol_ = new Symbol(Symbol::RENDER, glm::vec3(0.75f, 0.75f, 0.01f));
|
||||
symbol_->scale_.y = 1.5f;
|
||||
}
|
||||
|
||||
bool RenderSource::failed() const
|
||||
{
|
||||
if ( renderbuffer_ != nullptr && session_ != nullptr )
|
||||
return renderbuffer_->resolution() != session_->frame()->resolution();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint RenderSource::texture() const
|
||||
{
|
||||
if (session_ && session_->frame())
|
||||
return session_->frame()->texture();
|
||||
else
|
||||
return Resource::getTextureBlack(); // getTextureTransparent ?
|
||||
}
|
||||
|
||||
void RenderSource::init()
|
||||
{
|
||||
if (session_ && session_->frame() && session_->frame()->texture() != Resource::getTextureBlack()) {
|
||||
|
||||
FrameBuffer *fb = session_->frame();
|
||||
|
||||
// get the texture index from framebuffer of view, apply it to the surface
|
||||
texturesurface_->setTextureIndex( fb->texture() );
|
||||
|
||||
// create Frame buffer matching size of output session
|
||||
FrameBuffer *renderbuffer = new FrameBuffer( fb->resolution() );
|
||||
|
||||
// set the renderbuffer of the source and attach rendering nodes
|
||||
attach(renderbuffer);
|
||||
|
||||
// deep update to reorder
|
||||
++View::need_deep_update_;
|
||||
|
||||
// done init
|
||||
Log::Info("Source Render linked to session (%d x %d).", int(fb->resolution().x), int(fb->resolution().y) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
glm::vec3 RenderSource::resolution() const
|
||||
{
|
||||
if (renderbuffer_ != nullptr)
|
||||
return renderbuffer_->resolution();
|
||||
else if (session_ && session_->frame())
|
||||
return session_->frame()->resolution();
|
||||
else
|
||||
return glm::vec3(0.f);
|
||||
}
|
||||
|
||||
void RenderSource::accept(Visitor& v)
|
||||
{
|
||||
Source::accept(v);
|
||||
// if (!failed())
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
glm::ivec2 RenderSource::icon() const
|
||||
{
|
||||
return glm::ivec2(ICON_SOURCE_RENDER);
|
||||
}
|
||||
|
||||
std::string RenderSource::info() const
|
||||
{
|
||||
return std::string("Render loopback");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user