removed all dependence on NodeOutputs

If Nodes only have the one output, we don't need to do so much differentiation
between them. Previous iteration used outputs as like a distinct function
within a Node (e.g. length output would return one result, buffer output would
produce a different result - each run different code to produce their results).
Now in this iteration, it's more accurate to say a Node is just one function
(which seems more appropriate for a node system anyway).
This commit is contained in:
itsmattkc
2019-12-06 00:23:26 +11:00
parent f424d8b44e
commit d25dda5275
45 changed files with 253 additions and 407 deletions
+11 -23
View File
@@ -32,9 +32,6 @@ OpacityNode::OpacityNode()
texture_input_ = new NodeInput("tex_in");
texture_input_->set_data_type(NodeParam::kTexture);
AddParameter(texture_input_);
texture_output_ = new NodeOutput("tex_out");
AddParameter(texture_output_);
}
Node *OpacityNode::copy() const
@@ -67,30 +64,21 @@ void OpacityNode::Retranslate()
opacity_input_->set_name(tr("Opacity"));
}
QString OpacityNode::Code(NodeOutput *output) const
QString OpacityNode::Code() const
{
if (output == texture_output()) {
return "#version 110"
"\n"
"varying vec2 olive_tex_coord;\n"
"\n"
"uniform sampler2D tex_in;\n"
"uniform float opacity_in;\n"
"\n"
"void main(void) {\n"
" gl_FragColor = texture2D(tex_in, olive_tex_coord) * (opacity_in * 0.01);\n"
"}\n";
}
return Node::Code(output);
return "#version 110"
"\n"
"varying vec2 olive_tex_coord;\n"
"\n"
"uniform sampler2D tex_in;\n"
"uniform float opacity_in;\n"
"\n"
"void main(void) {\n"
" gl_FragColor = texture2D(tex_in, olive_tex_coord) * (opacity_in * 0.01);\n"
"}\n";
}
NodeInput *OpacityNode::texture_input() const
{
return texture_input_;
}
NodeOutput *OpacityNode::texture_output() const
{
return texture_output_;
}
+1 -5
View File
@@ -39,19 +39,15 @@ public:
virtual void Retranslate() override;
virtual QString Code(NodeOutput* output) const override;
virtual QString Code() const override;
NodeInput* texture_input() const;
NodeOutput* texture_output() const;
private:
NodeInput* opacity_input_;
NodeInput* texture_input_;
NodeOutput* texture_output_;
};
#endif // OPACITYNODE_H