started pair of transition derivatives

These will serve as stock transitions and as a reference implementation for
hardware accelerated transitions.
This commit is contained in:
itsmattkc
2019-12-09 23:44:27 +11:00
parent 0448451bc2
commit cc8aeea672
6 changed files with 137 additions and 0 deletions
@@ -0,0 +1,22 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2019 Olive Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
node/block/transition/crossdissolve/crossdissolve.h
node/block/transition/crossdissolve/crossdissolve.cpp
PARENT_SCOPE
)
@@ -0,0 +1,54 @@
#include "crossdissolve.h"
CrossDissolveTransition::CrossDissolveTransition()
{
}
Node *CrossDissolveTransition::copy() const
{
return new CrossDissolveTransition();
}
QString CrossDissolveTransition::Name() const
{
return tr("Cross Dissolve");
}
QString CrossDissolveTransition::id() const
{
return "org.olivevideoeditor.Olive.crossdissolve";
}
QString CrossDissolveTransition::Description() const
{
return tr("A smooth fade transition from one video clip to another.");
}
bool CrossDissolveTransition::IsAccelerated() const
{
return true;
}
QString CrossDissolveTransition::CodeFragment() const
{
return "#version 110\n"
"\n"
"varying vec2 ove_texcoord;\n"
"\n"
"uniform sampler2D out_block_in;\n"
"uniform sampler2D in_block_in;\n"
"\n"
"uniform float transition_total_prog;\n"
"uniform float transition_out_prog;\n"
"uniform float transition_in_prog;\n"
"\n"
"void main(void) {\n"
" vec4 out_tex = texture2D(out_block_in, ove_texcoord);\n"
" vec4 in_tex = texture2D(in_block_in, ove_texcoord);\n"
" \n"
" in_tex *= transition_total_prog;\n"
" \n"
" gl_FragColor = out_tex - in_tex.a + in_tex;\n"
"}\n";
}
@@ -0,0 +1,21 @@
#ifndef CROSSDISSOLVETRANSITION_H
#define CROSSDISSOLVETRANSITION_H
#include "../transition.h"
class CrossDissolveTransition : public TransitionBlock
{
public:
CrossDissolveTransition();
virtual Node* copy() const override;
virtual QString Name() const override;
virtual QString id() const override;
virtual QString Description() const override;
virtual bool IsAccelerated() const override;
virtual QString CodeFragment() const override;
};
#endif // CROSSDISSOLVETRANSITION_H
@@ -0,0 +1,22 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2019 Olive Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
node/block/transition/diptoblack/diptoblack.h
node/block/transition/diptoblack/diptoblack.cpp
PARENT_SCOPE
)
@@ -0,0 +1,6 @@
#include "diptoblack.h"
DipToBlackTransition::DipToBlackTransition()
{
}
@@ -0,0 +1,12 @@
#ifndef DIPTOBLACKTRANSITION_H
#define DIPTOBLACKTRANSITION_H
#include "../transition.h"
class DipToBlackTransition : public TransitionBlock
{
public:
DipToBlackTransition();
};
#endif // DIPTOBLACKTRANSITION_H