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:
@@ -45,23 +45,19 @@ QString AlphaOverBlend::Description() const
|
||||
return tr("A blending node that composites one texture over another using its alpha channel.");
|
||||
}
|
||||
|
||||
QString AlphaOverBlend::Code(NodeOutput *output) const
|
||||
QString AlphaOverBlend::Code() const
|
||||
{
|
||||
if (output == texture_output()) {
|
||||
return "#version 110"
|
||||
"\n"
|
||||
"varying vec2 v_texcoord;\n"
|
||||
"\n"
|
||||
"uniform sampler2D base_in;\n"
|
||||
"uniform sampler2D blend_in;\n"
|
||||
"\n"
|
||||
"void main(void) {\n"
|
||||
" vec4 base_col = texture2D(base_in, v_texcoord);\n"
|
||||
" vec4 blend_col = texture2D(blend_in, v_texcoord);\n"
|
||||
" \n"
|
||||
" gl_FragColor = base_col - blend_col.a + blend_col;\n"
|
||||
"}\n";
|
||||
}
|
||||
|
||||
return Node::Code(output);
|
||||
return "#version 110"
|
||||
"\n"
|
||||
"varying vec2 v_texcoord;\n"
|
||||
"\n"
|
||||
"uniform sampler2D base_in;\n"
|
||||
"uniform sampler2D blend_in;\n"
|
||||
"\n"
|
||||
"void main(void) {\n"
|
||||
" vec4 base_col = texture2D(base_in, v_texcoord);\n"
|
||||
" vec4 blend_col = texture2D(blend_in, v_texcoord);\n"
|
||||
" \n"
|
||||
" gl_FragColor = base_col - blend_col.a + blend_col;\n"
|
||||
"}\n";
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
virtual QString id() const override;
|
||||
virtual QString Description() const override;
|
||||
|
||||
virtual QString Code(NodeOutput* output) const override;
|
||||
virtual QString Code() const override;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -29,9 +29,6 @@ BlendNode::BlendNode()
|
||||
blend_input_ = new NodeInput("blend_in");
|
||||
blend_input_->set_data_type(NodeParam::kTexture);
|
||||
AddParameter(blend_input_);
|
||||
|
||||
texture_output_ = new NodeOutput("tex_out");
|
||||
AddParameter(texture_output_);
|
||||
}
|
||||
|
||||
QString BlendNode::Category() const
|
||||
@@ -49,7 +46,8 @@ NodeInput *BlendNode::blend_input() const
|
||||
return blend_input_;
|
||||
}
|
||||
|
||||
NodeOutput *BlendNode::texture_output() const
|
||||
void BlendNode::Retranslate()
|
||||
{
|
||||
return texture_output_;
|
||||
base_input_->set_name(tr("Base"));
|
||||
blend_input_->set_name(tr("Blend"));
|
||||
}
|
||||
|
||||
@@ -34,14 +34,13 @@ public:
|
||||
|
||||
NodeInput* blend_input() const;
|
||||
|
||||
NodeOutput* texture_output() const;
|
||||
virtual void Retranslate() override;
|
||||
|
||||
private:
|
||||
NodeInput* base_input_;
|
||||
|
||||
NodeInput* blend_input_;
|
||||
|
||||
NodeOutput* texture_output_;
|
||||
};
|
||||
|
||||
#endif // BLEND_H
|
||||
|
||||
Reference in New Issue
Block a user