moved alphaover to external file format

This commit is contained in:
itsmattkc
2019-12-15 03:41:37 +11:00
parent ae7c9597e2
commit 46b3f9db48
12 changed files with 30 additions and 255 deletions
-1
View File
@@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
add_subdirectory(blend)
add_subdirectory(block)
add_subdirectory(distort)
add_subdirectory(input)
-24
View File
@@ -1,24 +0,0 @@
# 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/>.
add_subdirectory(alphaover)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
node/blend/blend.h
node/blend/blend.cpp
PARENT_SCOPE
)
-22
View File
@@ -1,22 +0,0 @@
# 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/blend/alphaover/alphaover.h
node/blend/alphaover/alphaover.cpp
PARENT_SCOPE
)
-56
View File
@@ -1,56 +0,0 @@
/***
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/>.
***/
#include "alphaover.h"
AlphaOverBlend::AlphaOverBlend()
{
}
Node *AlphaOverBlend::copy() const
{
return new AlphaOverBlend();
}
QString AlphaOverBlend::Name() const
{
return tr("Alpha Over");
}
QString AlphaOverBlend::id() const
{
return "org.olivevideoeditor.Olive.alphaoverblend";
}
QString AlphaOverBlend::Description() const
{
return tr("A blending node that composites one texture over another using its alpha channel.");
}
bool AlphaOverBlend::IsAccelerated() const
{
return true;
}
QString AlphaOverBlend::AcceleratedCodeFragment() const
{
return ReadFileAsString(":/shaders/alphaover.frag");
}
-45
View File
@@ -1,45 +0,0 @@
/***
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/>.
***/
#ifndef ALPHAOVER_H
#define ALPHAOVER_H
#include "node/blend/blend.h"
class AlphaOverBlend : public BlendNode
{
public:
AlphaOverBlend();
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 AcceleratedCodeFragment() const override;
protected:
private:
};
#endif // ALPHAOVER_H
-53
View File
@@ -1,53 +0,0 @@
/***
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/>.
***/
#include "blend.h"
BlendNode::BlendNode()
{
base_input_ = new NodeInput("base_in");
base_input_->set_data_type(NodeParam::kTexture);
AddInput(base_input_);
blend_input_ = new NodeInput("blend_in");
blend_input_->set_data_type(NodeParam::kTexture);
AddInput(blend_input_);
}
QString BlendNode::Category() const
{
return tr("Blend");
}
NodeInput *BlendNode::base_input() const
{
return base_input_;
}
NodeInput *BlendNode::blend_input() const
{
return blend_input_;
}
void BlendNode::Retranslate()
{
base_input_->set_name(tr("Base"));
blend_input_->set_name(tr("Blend"));
}
-46
View File
@@ -1,46 +0,0 @@
/***
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/>.
***/
#ifndef BLEND_H
#define BLEND_H
#include "node/node.h"
class BlendNode : public Node
{
public:
BlendNode();
virtual QString Category() const override;
NodeInput* base_input() const;
NodeInput* blend_input() const;
virtual void Retranslate() override;
private:
NodeInput* base_input_;
NodeInput* blend_input_;
};
#endif // BLEND_H
+1 -3
View File
@@ -1,6 +1,5 @@
#include "factory.h"
#include "blend/alphaover/alphaover.h"
#include "block/clip/clip.h"
#include "block/gap/gap.h"
#include "block/transition/crossdissolve/crossdissolve.h"
@@ -27,6 +26,7 @@ void NodeFactory::Initialize()
library_.append(new ExternalNode(":/shaders/boxblur.xml"));
library_.append(new ExternalNode(":/shaders/opacity.xml"));
library_.append(new ExternalNode(":/shaders/solid.xml"));
library_.append(new ExternalNode(":/shaders/alphaover.xml"));
}
void NodeFactory::Destroy()
@@ -112,8 +112,6 @@ Node *NodeFactory::CreateFromID(const QString &id)
Node *NodeFactory::CreateInternal(const NodeFactory::InternalID &id)
{
switch (id) {
case kAlphaOverBlend:
return new AlphaOverBlend();
case kClipBlock:
return new ClipBlock();
case kGapBlock:
-1
View File
@@ -13,7 +13,6 @@ public:
kViewerOutput,
kClipBlock,
kGapBlock,
kAlphaOverBlend,
kAudioInput,
kTransformDistort,
kTransitionBlock,
+4 -4
View File
@@ -20,7 +20,7 @@
#include "tracklist.h"
#include "node/blend/alphaover/alphaover.h"
#include "node/factory.h"
#include "timeline.h"
TrackList::TrackList(TimelineOutput* parent, const enum TrackType &type, NodeInputArray *track_input) :
@@ -117,11 +117,11 @@ TrackOutput* TrackList::AddTrack()
if (last_track && last_track->output()->IsConnected()) {
foreach (NodeEdgePtr edge, last_track->output()->edges()) {
if (edge->input()->parentNode() != track_input_->parentNode()) {
AlphaOverBlend* blend = new AlphaOverBlend();
Node* blend = NodeFactory::CreateFromID("org.olivevideoeditor.Olive.alphaoverblend");
GetParentGraph()->AddNode(blend);
NodeParam::ConnectEdge(track->output(), blend->blend_input());
NodeParam::ConnectEdge(last_track->output(), blend->base_input());
NodeParam::ConnectEdge(track->output(), static_cast<NodeInput*>(blend->GetParameterWithID("blend_in")));
NodeParam::ConnectEdge(last_track->output(), static_cast<NodeInput*>(blend->GetParameterWithID("base_in")));
NodeParam::ConnectEdge(blend->output(), edge->input());
}
}
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect id="org.olivevideoeditor.Olive.alphaoverblend">
<!-- Effect Name -->
<name lang="en_US">Alpha Over</name>
<!-- Effect Category -->
<category lang="en_US">Blend</category>
<!-- Effect Description -->
<description lang="en_US">
A blending node that composites one texture over another using its alpha channel.
</description>
<!-- Blending Parameters -->
<param id="base_in" type="texture">
<name lang="en_US">Base</name>
</param>
<param id="blend_in" type="texture">
<name lang="en_US">Blend</name>
</param>
<!-- Qt Resource path to fragment shader -->
<fragment url=":/shaders/alphaover.frag" />
</effect>
+1
View File
@@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/shaders">
<file>alphaover.frag</file>
<file>alphaover.xml</file>
<file>boxblur.frag</file>
<file>boxblur.xml</file>
<file>crossdissolve.frag</file>