From a82e5ccbce899de32ff18dccca8e013ebe262c33 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 22 May 2019 22:57:33 +1000 Subject: [PATCH] work on texture passthrough node --- CMakeLists.txt | 4 +-- effects/effectloaders.cpp | 4 +-- nodes/node.cpp | 2 +- nodes/node.h | 2 +- nodes/nodes.h | 2 +- nodes/nodes/nodeimageoutput.cpp | 43 --------------------------- nodes/nodes/nodeimageoutput.h | 20 ------------- nodes/nodes/nodemedia.cpp | 45 +++++++++++++++++++++++++++-- nodes/nodes/nodemedia.h | 2 +- nodes/nodes/nodetexturepassthru.cpp | 38 ++++++++++++++++++++++++ nodes/nodes/nodetexturepassthru.h | 24 +++++++++++++++ ts/olive_ar.ts | 43 +++++++++++---------------- ts/olive_bs.ts | 43 +++++++++++---------------- ts/olive_cs.ts | 30 +++++++------------ ts/olive_de.ts | 43 +++++++++++---------------- ts/olive_es.ts | 43 +++++++++++---------------- ts/olive_fr.ts | 43 +++++++++++---------------- ts/olive_id.ts | 43 +++++++++++---------------- ts/olive_it.ts | 43 +++++++++++---------------- ts/olive_ru.ts | 43 +++++++++++---------------- ts/olive_sr.ts | 43 +++++++++++---------------- 21 files changed, 277 insertions(+), 326 deletions(-) delete mode 100644 nodes/nodes/nodeimageoutput.cpp delete mode 100644 nodes/nodes/nodeimageoutput.h create mode 100644 nodes/nodes/nodetexturepassthru.cpp create mode 100644 nodes/nodes/nodetexturepassthru.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cd5bade8..9d2b0ffec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,8 +227,8 @@ set(OLIVE_SOURCES nodes/oldeffectnode.cpp nodes/nodes/nodeblock.h nodes/nodes/nodeblock.cpp - nodes/nodes/nodeimageoutput.cpp - nodes/nodes/nodeimageoutput.h + nodes/nodes/nodetexturepassthru.cpp + nodes/nodes/nodetexturepassthru.h nodes/nodes/nodemedia.cpp nodes/nodes/nodemedia.h nodes/nodes/nodeshader.cpp diff --git a/effects/effectloaders.cpp b/effects/effectloaders.cpp index b4de9a5b5..54922b276 100644 --- a/effects/effectloaders.cpp +++ b/effects/effectloaders.cpp @@ -51,7 +51,7 @@ #include "effects/internal/exponentialfadetransition.h" #include "nodes/nodes/nodemedia.h" -#include "nodes/nodes/nodeimageoutput.h" +#include "nodes/nodes/nodetexturepassthru.h" #include "nodes/nodes/nodeshader.h" QMutex olive::effects_loaded; @@ -78,7 +78,7 @@ void load_internal_effects() { olive::node_library[kCornerPinEffect] = std::make_shared(nullptr); olive::node_library[kRichTextInput] = std::make_shared(nullptr); //olive::node_library[kMediaInput] = std::make_shared(nullptr); - olive::node_library[kImageOutput] = std::make_shared(nullptr); + //olive::node_library[kImageOutput] = std::make_shared(nullptr); olive::node_library[kCrossDissolveTransition] = std::make_shared(nullptr); olive::node_library[kLinearFadeTransition] = std::make_shared(nullptr); olive::node_library[kExponentialFadeTransition] = std::make_shared(nullptr); diff --git a/nodes/node.cpp b/nodes/node.cpp index 00b23e1a9..2a28b1e37 100644 --- a/nodes/node.cpp +++ b/nodes/node.cpp @@ -43,7 +43,7 @@ double Node::Time() return 0; } -void Node::Process(rational time) +void Node::Process(const rational &time) { Q_UNUSED(time) } diff --git a/nodes/node.h b/nodes/node.h index 434fc37db..7fdbfc79d 100644 --- a/nodes/node.h +++ b/nodes/node.h @@ -15,7 +15,7 @@ public: virtual QString name(); virtual QString id(); - virtual void Process(rational time); + virtual void Process(const rational& time); void AddParameter(NodeIO* row); int IndexOfParameter(NodeIO* row); diff --git a/nodes/nodes.h b/nodes/nodes.h index e3135d7e1..998fd900d 100644 --- a/nodes/nodes.h +++ b/nodes/nodes.h @@ -2,7 +2,7 @@ #define NODES_H #include "nodes/nodemedia.h" -#include "nodes/nodeimageoutput.h" +#include "nodes/nodetexturepassthru.h" #include "nodes/nodeshader.h" #endif // NODES_H diff --git a/nodes/nodes/nodeimageoutput.cpp b/nodes/nodes/nodeimageoutput.cpp deleted file mode 100644 index 8824a28ac..000000000 --- a/nodes/nodes/nodeimageoutput.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "nodeimageoutput.h" - -NodeImageOutput::NodeImageOutput(Clip *c) : - OldEffectNode(c) -{ - NodeIO* input_texture = new NodeIO(this, "texture", tr("Texture"), true, false); - input_texture->AddAcceptedNodeInput(olive::nodes::kTexture); -} - -QString NodeImageOutput::name() -{ - return tr("Image Output"); -} - -QString NodeImageOutput::id() -{ - return "org.olivevideoeditor.Olive.imageoutput"; -} - -QString NodeImageOutput::category() -{ - return tr("Outputs"); -} - -QString NodeImageOutput::description() -{ - return tr("Used for outputting images outside of the node graph."); -} - -EffectType NodeImageOutput::type() -{ - return EFFECT_TYPE_EFFECT; -} - -olive::TrackType NodeImageOutput::subtype() -{ - return olive::kTypeVideo; -} - -OldEffectNodePtr NodeImageOutput::Create(Clip *c) -{ - return std::make_shared(c); -} diff --git a/nodes/nodes/nodeimageoutput.h b/nodes/nodes/nodeimageoutput.h deleted file mode 100644 index 5620ae280..000000000 --- a/nodes/nodes/nodeimageoutput.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef NODEIMAGEOUTPUT_H -#define NODEIMAGEOUTPUT_H - -#include "nodes/oldeffectnode.h" - -class NodeImageOutput : public OldEffectNode -{ -public: - NodeImageOutput(Clip* c); - - virtual QString name() override; - virtual QString id() override; - virtual QString category() override; - virtual QString description() override; - virtual EffectType type() override; - virtual olive::TrackType subtype() override; - virtual OldEffectNodePtr Create(Clip *c) override; -}; - -#endif // NODEIMAGEOUTPUT_H diff --git a/nodes/nodes/nodemedia.cpp b/nodes/nodes/nodemedia.cpp index e7603db16..d7df4da39 100644 --- a/nodes/nodes/nodemedia.cpp +++ b/nodes/nodes/nodemedia.cpp @@ -25,13 +25,54 @@ QString NodeMedia::id() return "org.olivevideoeditor.Olive.media"; } -void NodeMedia::Process(rational time) +double H = 0.0; + +void NodeMedia::Process(const rational &time) { Q_UNUSED(time) buffer_.buffer()->BindBuffer(); - // DEBUG CODE - we should see a solid red color return from this function + // DEBUG CODE - we should see a solid rainbow color return from this function + H += 1; + double S = 1.0; + double V = 1.0; + double C = S * V; + double X = C * (1 - abs(fmod(H / 60.0, 2) - 1)); + double m = V - C; + double Rs, Gs, Bs; + + if(H >= 0 && H < 60) { + Rs = C; + Gs = X; + Bs = 0; + } + else if(H >= 60 && H < 120) { + Rs = X; + Gs = C; + Bs = 0; + } + else if(H >= 120 && H < 180) { + Rs = 0; + Gs = C; + Bs = X; + } + else if(H >= 180 && H < 240) { + Rs = 0; + Gs = X; + Bs = C; + } + else if(H >= 240 && H < 300) { + Rs = X; + Gs = 0; + Bs = C; + } + else { + Rs = C; + Gs = 0; + Bs = X; + } + glClearColor(1.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); // END DEBUG CODE diff --git a/nodes/nodes/nodemedia.h b/nodes/nodes/nodemedia.h index 3d168d31b..708a36934 100644 --- a/nodes/nodes/nodemedia.h +++ b/nodes/nodes/nodemedia.h @@ -13,7 +13,7 @@ public: virtual QString name() override; virtual QString id() override; - virtual void Process(rational time) override; + virtual void Process(const rational& time) override; NodeIO* matrix_input(); NodeIO* texture_output(); diff --git a/nodes/nodes/nodetexturepassthru.cpp b/nodes/nodes/nodetexturepassthru.cpp new file mode 100644 index 000000000..6b644d20a --- /dev/null +++ b/nodes/nodes/nodetexturepassthru.cpp @@ -0,0 +1,38 @@ +#include "nodetexturepassthru.h" + +NodeTexturePassthru::NodeTexturePassthru(NodeGraph *c) : + Node(c) +{ + texture_input_ = new NodeIO(this, "tex_in", tr("Texture"), true, false); + texture_input_->AddAcceptedNodeInput(olive::nodes::kTexture); + + texture_output_ = new NodeIO(this, "tex_out", tr("Texture"), true, false); + texture_output_->SetOutputDataType(olive::nodes::kTexture); +} + +QString NodeTexturePassthru::name() +{ + return tr("Image Output"); +} + +QString NodeTexturePassthru::id() +{ + return "org.olivevideoeditor.Olive.imageoutput"; +} + +void NodeTexturePassthru::Process(const rational &time) +{ + Q_UNUSED(time) + + texture_output_->SetValue(texture_input_->GetValue()); +} + +NodeIO *NodeTexturePassthru::texture_input() +{ + return texture_input_; +} + +NodeIO *NodeTexturePassthru::texture_output() +{ + return texture_output_; +} diff --git a/nodes/nodes/nodetexturepassthru.h b/nodes/nodes/nodetexturepassthru.h new file mode 100644 index 000000000..41d1797bc --- /dev/null +++ b/nodes/nodes/nodetexturepassthru.h @@ -0,0 +1,24 @@ +#ifndef NODEIMAGEOUTPUT_H +#define NODEIMAGEOUTPUT_H + +#include "nodes/node.h" + +class NodeTexturePassthru : public Node +{ +public: + NodeTexturePassthru(NodeGraph* c); + + virtual QString name() override; + virtual QString id() override; + + virtual void Process(const rational& time) override; + + NodeIO* texture_input(); + NodeIO* texture_output(); + +private: + NodeIO* texture_input_; + NodeIO* texture_output_; +}; + +#endif // NODEIMAGEOUTPUT_H diff --git a/ts/olive_ar.ts b/ts/olive_ar.ts index 82c92647d..2ed7f0291 100644 --- a/ts/olive_ar.ts +++ b/ts/olive_ar.ts @@ -2168,47 +2168,38 @@ Audio Layout: %6 تعطيل اﻹطارات المفتاحية سوف يحذف جميع اﻹطارات المفتاحية الحالية هل أنت متأكد من ما ستقدم عليه؟ - - NodeImageOutput - - - Texture - - - - - Image Output - - - - - Outputs - - - - - Used for outputting images outside of the node graph. - - - NodeMedia - + Matrix - + Texture - + Media الوسائط + + NodeTexturePassthru + + + + Texture + + + + + Image Output + + + NodeVideoClip diff --git a/ts/olive_bs.ts b/ts/olive_bs.ts index 86639fd46..7240e3c7c 100644 --- a/ts/olive_bs.ts +++ b/ts/olive_bs.ts @@ -1972,47 +1972,38 @@ Audio Layout: %6 Onemogućavanje ključnih kadrova će obrisati sve trenutne ključne kadrove. Da li ste sigurni da želite ovo uraditi? - - NodeImageOutput - - - Texture - - - - - Image Output - - - - - Outputs - - - - - Used for outputting images outside of the node graph. - - - NodeMedia - + Matrix - + Texture - + Media + + NodeTexturePassthru + + + + Texture + + + + + Image Output + + + NodeVideoClip diff --git a/ts/olive_cs.ts b/ts/olive_cs.ts index b0fc28478..8e941a595 100644 --- a/ts/olive_cs.ts +++ b/ts/olive_cs.ts @@ -1661,25 +1661,6 @@ Rozložení zvuku: %6 Zákázání klíčových snímků smaže všechny nynější klíčové snímky. Opravdu to chcete udělat? - - NodeImageOutput - - Texture - - - - Image Output - - - - Outputs - - - - Used for outputting images outside of the node graph. - - - NodeMedia @@ -1695,6 +1676,17 @@ Rozložení zvuku: %6 Záznamy + + NodeTexturePassthru + + Texture + + + + Image Output + + + NodeVideoClip diff --git a/ts/olive_de.ts b/ts/olive_de.ts index 1d503149a..43920e1da 100644 --- a/ts/olive_de.ts +++ b/ts/olive_de.ts @@ -2188,47 +2188,38 @@ Audio Layout: %6 Ein Deaktivieren von Keyframes löscht alle aktuellen Keyframes. Sind Sie sicher? - - NodeImageOutput - - - Texture - - - - - Image Output - - - - - Outputs - - - - - Used for outputting images outside of the node graph. - - - NodeMedia - + Matrix - + Texture - + Media Medien + + NodeTexturePassthru + + + + Texture + + + + + Image Output + + + NodeVideoClip diff --git a/ts/olive_es.ts b/ts/olive_es.ts index ed34ff4e0..63011d122 100644 --- a/ts/olive_es.ts +++ b/ts/olive_es.ts @@ -1823,47 +1823,38 @@ Audio Layout: %6 - - NodeImageOutput - - - Texture - - - - - Image Output - - - - - Outputs - - - - - Used for outputting images outside of the node graph. - - - NodeMedia - + Matrix - + Texture - + Media + + NodeTexturePassthru + + + + Texture + + + + + Image Output + + + NodeVideoClip diff --git a/ts/olive_fr.ts b/ts/olive_fr.ts index 3918de017..8799477a8 100644 --- a/ts/olive_fr.ts +++ b/ts/olive_fr.ts @@ -2152,47 +2152,38 @@ Canaux audio : %6 Désactiver les images-clés supprimera toutes les images-clés courantes. Êtes-vous sûr⋅e de vouloir cela ? - - NodeImageOutput - - - Texture - - - - - Image Output - - - - - Outputs - - - - - Used for outputting images outside of the node graph. - - - NodeMedia - + Matrix - + Texture - + Media Média + + NodeTexturePassthru + + + + Texture + + + + + Image Output + + + NodeVideoClip diff --git a/ts/olive_id.ts b/ts/olive_id.ts index b6c57ab79..23f620c74 100644 --- a/ts/olive_id.ts +++ b/ts/olive_id.ts @@ -2013,47 +2013,38 @@ Tata Audio: %6 Mematikan keyframe akan menghapus semua keyframe di efek ini. Benarkah Anda ingin melakukan hal tersebut? - - NodeImageOutput - - - Texture - - - - - Image Output - - - - - Outputs - - - - - Used for outputting images outside of the node graph. - - - NodeMedia - + Matrix - + Texture - + Media + + NodeTexturePassthru + + + + Texture + + + + + Image Output + + + NodeVideoClip diff --git a/ts/olive_it.ts b/ts/olive_it.ts index 82fea3c83..9595a392c 100644 --- a/ts/olive_it.ts +++ b/ts/olive_it.ts @@ -2006,47 +2006,38 @@ Disposizione audio: %6 Disabilitare i fotogrammi chiave eliminerà tutti quelli attualmente esistenti. Sei sicuro di volerlo fare? - - NodeImageOutput - - - Texture - - - - - Image Output - - - - - Outputs - - - - - Used for outputting images outside of the node graph. - - - NodeMedia - + Matrix - + Texture - + Media Media + + NodeTexturePassthru + + + + Texture + + + + + Image Output + + + NodeVideoClip diff --git a/ts/olive_ru.ts b/ts/olive_ru.ts index 4afdf5115..f460db0f5 100644 --- a/ts/olive_ru.ts +++ b/ts/olive_ru.ts @@ -1903,47 +1903,38 @@ Audio Layout: %6 Отключение приведёт к удалению всех текущих ключевых кадров. Вы уверены? - - NodeImageOutput - - - Texture - - - - - Image Output - - - - - Outputs - - - - - Used for outputting images outside of the node graph. - - - NodeMedia - + Matrix - + Texture - + Media Файл + + NodeTexturePassthru + + + + Texture + + + + + Image Output + + + NodeVideoClip diff --git a/ts/olive_sr.ts b/ts/olive_sr.ts index 74cdcc276..ff7a54c50 100644 --- a/ts/olive_sr.ts +++ b/ts/olive_sr.ts @@ -1959,47 +1959,38 @@ Audio Layout: %6 Онемогућавање кључних кадрова ће обрисати све тренутне кључне кадрове. Да ли сте сигурни да желите ово урадити? - - NodeImageOutput - - - Texture - - - - - Image Output - - - - - Outputs - - - - - Used for outputting images outside of the node graph. - - - NodeMedia - + Matrix - + Texture - + Media + + NodeTexturePassthru + + + + Texture + + + + + Image Output + + + NodeVideoClip