Add ability to add custom shaders to ColorProcessorJobs
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
#include "math/trigonometry/trigonometry.h"
|
||||
#include "keying/colordifferencekey/colordifferencekey.h"
|
||||
#include "keying/despill/despill.h"
|
||||
#include "keying/chromakey/chromakey.h"
|
||||
#include "output/track/track.h"
|
||||
#include "output/viewer/viewer.h"
|
||||
#include "project/folder/folder.h"
|
||||
@@ -283,6 +284,8 @@ Node *NodeFactory::CreateFromFactoryIndex(const NodeFactory::InternalID &id)
|
||||
return new DisplayTransformNode();
|
||||
case kOCIOGradingTransform:
|
||||
return new OCIOGradingTransformNode();
|
||||
case kChromaKey:
|
||||
return new ChromaKeyNode();
|
||||
|
||||
case kInternalNodeCount:
|
||||
break;
|
||||
|
||||
@@ -72,6 +72,7 @@ public:
|
||||
kCornerPinDistort,
|
||||
kDisplayTransform,
|
||||
kOCIOGradingTransform,
|
||||
kChromaKey,
|
||||
|
||||
// Count value
|
||||
kInternalNodeCount
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
# 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(chromakey)
|
||||
add_subdirectory(colordifferencekey)
|
||||
add_subdirectory(despill)
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2021 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/keying/chromakey/chromakey.h
|
||||
node/keying/chromakey/chromakey.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,89 @@
|
||||
/***
|
||||
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 "chromakey.h"
|
||||
|
||||
#include "node/color/colormanager/colormanager.h"
|
||||
#include "render/colorprocessor.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
#define super OCIOBaseNode
|
||||
|
||||
ChromaKeyNode::ChromaKeyNode()
|
||||
{
|
||||
}
|
||||
|
||||
QString ChromaKeyNode::Name() const
|
||||
{
|
||||
return tr("Chroma Key");
|
||||
}
|
||||
|
||||
QString ChromaKeyNode::id() const
|
||||
{
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.chromakey");
|
||||
}
|
||||
|
||||
QVector<Node::CategoryID> ChromaKeyNode::Category() const
|
||||
{
|
||||
return {kCategoryKeying};
|
||||
}
|
||||
|
||||
QString ChromaKeyNode::Description() const
|
||||
{
|
||||
return tr("A simple color key based on the distance from the chroma of a selected color.");
|
||||
}
|
||||
|
||||
void ChromaKeyNode::Retranslate()
|
||||
{
|
||||
super::Retranslate();
|
||||
SetInputName(kTextureInput, tr("Input"));
|
||||
//SetInputName(kGarbageMatteInput, tr("Garbage Matte"));
|
||||
//SetInputName(kCoreMatteInput, tr("Core Matte"));
|
||||
//SetInputName(kColorInput, tr("Key Color"));
|
||||
//SetComboBoxStrings(kColorInput, {tr("Green"), tr("Blue")});
|
||||
//SetInputName(kShadowsInput, tr("Shadows"));
|
||||
//SetInputName(kHighlightsInput, tr("Highlights"));
|
||||
//SetInputName(kMaskOnlyInput, tr("Show Mask Only"));
|
||||
}
|
||||
|
||||
void ChromaKeyNode::InputValueChangedEvent(const QString &input, int element)
|
||||
{
|
||||
Q_UNUSED(element);
|
||||
GenerateProcessor();
|
||||
}
|
||||
|
||||
void ChromaKeyNode::GenerateProcessor()
|
||||
{
|
||||
if (manager()){
|
||||
ColorTransform transform("cie_xyz_d65_interchange");
|
||||
set_processor(ColorProcessor::Create(manager(), manager()->GetReferenceColorSpace(), transform));
|
||||
}
|
||||
}
|
||||
|
||||
void ChromaKeyNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
{
|
||||
if (!value[kTextureInput].data().isNull() && processor()) {
|
||||
ColorTransformJob job;
|
||||
|
||||
job.SetColorProcessor(processor());
|
||||
job.SetInputTexture(value[kTextureInput].data().value<TexturePtr>());
|
||||
job.SetShaderPath(QStringLiteral(":/shaders/chromakey.frag"));
|
||||
|
||||
table->Push(NodeValue::kColorTransformJob, QVariant::fromValue(job), this);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace olive
|
||||
@@ -0,0 +1,53 @@
|
||||
/***
|
||||
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 CHROMAKEYNODE_H
|
||||
#define CHROMAKEYNODE_H
|
||||
|
||||
#include "node/color/ociobase/ociobase.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class ChromaKeyNode : public OCIOBaseNode {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChromaKeyNode();
|
||||
|
||||
NODE_DEFAULT_DESTRUCTOR(ChromaKeyNode)
|
||||
NODE_COPY_FUNCTION(ChromaKeyNode)
|
||||
|
||||
virtual QString Name() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QVector<CategoryID> Category() const override;
|
||||
virtual QString Description() const override;
|
||||
|
||||
virtual void Retranslate() override;
|
||||
|
||||
virtual void InputValueChangedEvent(const QString& input, int element) override;
|
||||
|
||||
virtual void Value(const NodeValueRow& value, const NodeGlobals& globals, NodeValueTable* table) const override;
|
||||
|
||||
virtual void ConfigChanged() override {};
|
||||
|
||||
private:
|
||||
void GenerateProcessor();
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace olive
|
||||
|
||||
#endif // CHROMAKEYNODE_H
|
||||
Reference in New Issue
Block a user