merged all drawing functions into a single shader processing function

This commit is contained in:
itsmattkc
2020-11-10 15:50:13 +11:00
parent 1d61f89920
commit 0429e70fe0
46 changed files with 570 additions and 398 deletions
+2 -2
View File
@@ -48,7 +48,7 @@ ShaderCode MathNodeBase::GetShaderCodeInternal(const QString &shader_id, NodeInp
// No-op frag shader (can we return QString() instead?)
operation = QStringLiteral("texture(%1, ove_texcoord)").arg(tex_in->id());
vert = ReadFileAsString(":/shaders/matrix.vert").arg(mat_in->id(), tex_in->id());
vert = FileFunctions::ReadFileAsString(":/shaders/matrix.vert").arg(mat_in->id(), tex_in->id());
} else {
switch (op) {
@@ -329,7 +329,7 @@ NodeValueTable MathNodeBase::ValueInternal(NodeValueDatabase &value, Operation o
float number = RetrieveNumber(number_val);
SampleJob job(val_a.type() == NodeParam::kSamples ? val_a : val_b);
job.InsertValue(number_param, NodeValue(NodeParam::kFloat, number, this));
job.InsertValue(number_param, ShaderValue(number, NodeParam::kFloat));
if (job.HasSamples()) {
if (number_param->is_static()) {
+6 -6
View File
@@ -66,7 +66,7 @@ ShaderCode MergeNode::GetShaderCode(const QString &shader_id) const
{
Q_UNUSED(shader_id)
return ShaderCode(ReadFileAsString(":/shaders/alphaover.frag"), QString());
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/alphaover.frag"), QString());
}
NodeValueTable MergeNode::Value(NodeValueDatabase &value) const
@@ -79,13 +79,13 @@ NodeValueTable MergeNode::Value(NodeValueDatabase &value) const
NodeValueTable table = value.Merge();
if (!job.GetValue(base_in_).data().isNull() || !job.GetValue(blend_in_).data().isNull()) {
if (job.GetValue(base_in_).data().isNull()) {
if (!job.GetValue(base_in_).data.isNull() || !job.GetValue(blend_in_).data.isNull()) {
if (job.GetValue(base_in_).data.isNull()) {
// We only have a blend texture, no need to alpha over
table.Push(job.GetValue(blend_in_));
} else if (job.GetValue(blend_in_).data().isNull()) {
table.Push(job.GetValue(blend_in_), this);
} else if (job.GetValue(blend_in_).data.isNull()) {
// We only have a base texture, no need to alpha over
table.Push(job.GetValue(base_in_));
table.Push(job.GetValue(base_in_), this);
} else {
// We have both textures, push the job
table.Push(NodeParam::kShaderJob, QVariant::fromValue(job), this);