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:
@@ -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_;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user