diff --git a/app/node/CMakeLists.txt b/app/node/CMakeLists.txt index 235d4b589..415df32e0 100644 --- a/app/node/CMakeLists.txt +++ b/app/node/CMakeLists.txt @@ -16,7 +16,6 @@ add_subdirectory(blend) add_subdirectory(block) -add_subdirectory(color) add_subdirectory(distort) add_subdirectory(generator) add_subdirectory(input) diff --git a/app/node/color/CMakeLists.txt b/app/node/color/CMakeLists.txt deleted file mode 100644 index eb35cc108..000000000 --- a/app/node/color/CMakeLists.txt +++ /dev/null @@ -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 . - -add_subdirectory(opacity) - -set(OLIVE_SOURCES - ${OLIVE_SOURCES} - PARENT_SCOPE -) diff --git a/app/node/color/opacity/CMakeLists.txt b/app/node/color/opacity/CMakeLists.txt deleted file mode 100644 index 13c645217..000000000 --- a/app/node/color/opacity/CMakeLists.txt +++ /dev/null @@ -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 . - -set(OLIVE_SOURCES - ${OLIVE_SOURCES} - node/color/opacity/opacity.h - node/color/opacity/opacity.cpp - PARENT_SCOPE -) diff --git a/app/node/color/opacity/opacity.cpp b/app/node/color/opacity/opacity.cpp deleted file mode 100644 index 55465f999..000000000 --- a/app/node/color/opacity/opacity.cpp +++ /dev/null @@ -1,81 +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 . - -***/ - -#include "opacity.h" - -OpacityNode::OpacityNode() -{ - opacity_input_ = new NodeInput("opacity_in"); - opacity_input_->set_data_type(NodeParam::kFloat); - opacity_input_->set_value_at_time(0, 100); - opacity_input_->set_minimum(0); - opacity_input_->set_maximum(100); - AddInput(opacity_input_); - - texture_input_ = new NodeInput("tex_in"); - texture_input_->set_data_type(NodeParam::kTexture); - AddInput(texture_input_); -} - -Node *OpacityNode::copy() const -{ - return new OpacityNode(); -} - -QString OpacityNode::Name() const -{ - return tr("Opacity"); -} - -QString OpacityNode::Category() const -{ - return tr("Color"); -} - -QString OpacityNode::Description() const -{ - return tr("Adjust an image's opacity."); -} - -QString OpacityNode::id() const -{ - return "org.olivevideoeditor.Olive.opacity"; -} - -void OpacityNode::Retranslate() -{ - opacity_input_->set_name(tr("Opacity")); - texture_input_->set_name(tr("Texture")); -} - -bool OpacityNode::IsAccelerated() const -{ - return true; -} - -QString OpacityNode::AcceleratedCodeFragment() const -{ - return ReadFileAsString(":/shaders/opacity.frag"); -} - -NodeInput *OpacityNode::texture_input() const -{ - return texture_input_; -} diff --git a/app/node/color/opacity/opacity.h b/app/node/color/opacity/opacity.h deleted file mode 100644 index 4c83b5da5..000000000 --- a/app/node/color/opacity/opacity.h +++ /dev/null @@ -1,54 +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 . - -***/ - -#ifndef OPACITYNODE_H -#define OPACITYNODE_H - -#include "node/node.h" - -class OpacityNode : public Node -{ - Q_OBJECT -public: - OpacityNode(); - - virtual Node* copy() const override; - - virtual QString Name() const override; - virtual QString Category() const override; - virtual QString Description() const override; - - virtual QString id() const override; - - virtual void Retranslate() override; - - virtual bool IsAccelerated() const override; - virtual QString AcceleratedCodeFragment() const override; - - NodeInput* texture_input() const; - -private: - NodeInput* opacity_input_; - - NodeInput* texture_input_; - -}; - -#endif // OPACITYNODE_H diff --git a/app/node/factory.cpp b/app/node/factory.cpp index 714d34477..221056a50 100644 --- a/app/node/factory.cpp +++ b/app/node/factory.cpp @@ -4,7 +4,6 @@ #include "block/clip/clip.h" #include "block/gap/gap.h" #include "block/transition/crossdissolve/crossdissolve.h" -#include "color/opacity/opacity.h" #include "distort/transform/transform.h" #include "generator/solid/solid.h" #include "input/media/video/video.h" @@ -27,6 +26,7 @@ void NodeFactory::Initialize() library_.append(new ExternalNode(":/shaders/gaussianblur.xml")); library_.append(new ExternalNode(":/shaders/boxblur.xml")); + library_.append(new ExternalNode(":/shaders/opacity.xml")); } void NodeFactory::Destroy() @@ -109,8 +109,6 @@ Node *NodeFactory::CreateInternal(const NodeFactory::InternalID &id) return new GapBlock(); case kTransitionBlock: return new CrossDissolveTransition(); - case kOpacity: - return new OpacityNode(); case kTransformDistort: return new TransformDistort(); case kSolidGenerator: diff --git a/app/node/factory.h b/app/node/factory.h index f592ce0a1..6ea37bd9a 100644 --- a/app/node/factory.h +++ b/app/node/factory.h @@ -18,7 +18,6 @@ public: kAudioInput, kTransformDistort, kTransitionBlock, - kOpacity, kVideoInput, kTimelineOutput, kTrackOutput, diff --git a/app/shaders/opacity.frag b/app/shaders/opacity.frag index 52464e6f0..c74e8bf98 100644 --- a/app/shaders/opacity.frag +++ b/app/shaders/opacity.frag @@ -1,10 +1,10 @@ #version 110 -varying vec2 ove_tex_coord; +varying vec2 ove_texcoord; uniform sampler2D tex_in; uniform float opacity_in; void main(void) { - gl_FragColor = texture2D(tex_in, ove_tex_coord) * (opacity_in * 0.01); + gl_FragColor = texture2D(tex_in, ove_texcoord) * (opacity_in * 0.01); } diff --git a/app/shaders/opacity.xml b/app/shaders/opacity.xml new file mode 100644 index 000000000..82a4af59b --- /dev/null +++ b/app/shaders/opacity.xml @@ -0,0 +1,30 @@ + + + + Opacity + + + Color + Colour + + + + Adjust an image's opacity (transparency). + + + + + Texture + + + + + Opacity + 0 + 100 + 100 + + + + + diff --git a/app/shaders/shaders.qrc b/app/shaders/shaders.qrc index 8ec128a5c..08e15ad53 100644 --- a/app/shaders/shaders.qrc +++ b/app/shaders/shaders.qrc @@ -8,6 +8,7 @@ gaussianblur.frag gaussianblur.xml opacity.frag + opacity.xml solid.frag videoinput.frag videoinput.vert diff --git a/app/widget/timelinewidget/tool/import.cpp b/app/widget/timelinewidget/tool/import.cpp index fa4cb3e5b..1c0d99e5b 100644 --- a/app/widget/timelinewidget/tool/import.cpp +++ b/app/widget/timelinewidget/tool/import.cpp @@ -27,7 +27,6 @@ #include "common/qtversionabstraction.h" #include "core.h" #include "node/distort/transform/transform.h" -#include "node/color/opacity/opacity.h" #include "node/input/media/audio/audio.h" #include "node/input/media/video/video.h" #include "widget/nodeview/nodeviewundo.h"