work on texture passthrough node

This commit is contained in:
itsmattkc
2019-05-22 22:57:33 +10:00
parent f1fb0cccd0
commit a82e5ccbce
21 changed files with 277 additions and 326 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ double Node::Time()
return 0;
}
void Node::Process(rational time)
void Node::Process(const rational &time)
{
Q_UNUSED(time)
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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
-43
View File
@@ -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<NodeImageOutput>(c);
}
-20
View File
@@ -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
+43 -2
View File
@@ -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
+1 -1
View File
@@ -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();
+38
View File
@@ -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_;
}
+24
View File
@@ -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