alpha over and opacity nodes are now functional

This commit is contained in:
itsmattkc
2019-09-06 15:45:12 +10:00
parent a5fb8693d0
commit c2e59b0855
16 changed files with 104 additions and 19 deletions
+11 -3
View File
@@ -64,8 +64,13 @@ QVariant AlphaOverBlend::Value(NodeOutput *param, const rational &time)
RenderTexturePtr base = base_input()->get_value(time).value<RenderTexturePtr>();
RenderTexturePtr blend = blend_input()->get_value(time).value<RenderTexturePtr>();
// Set compositing strategy to alpha over
renderer->context()->functions()->glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
if (base == nullptr && blend == nullptr) {
return 0;
} else if (base == nullptr) {
return QVariant::fromValue(blend);
} else if (blend == nullptr) {
return QVariant::fromValue(base);
}
// Attach framebuffer to the backbuffer of base
renderer->buffer()->Attach(base);
@@ -74,13 +79,16 @@ QVariant AlphaOverBlend::Value(NodeOutput *param, const rational &time)
// Bind blend
blend->Bind();
// Set compositing strategy to alpha over
renderer->context()->functions()->glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
// Draw blend on base
olive::gl::Blit(renderer->default_pipeline());
// Release all
blend->Release();
renderer->buffer()->Detach();
renderer->buffer()->Release();
renderer->buffer()->Detach();
// Return base texture which now has blend composited on top
// NOTE: Blend texture will be implicitly deleted here (if it's not used anywhere else)