math: fixed power function

Corrected shader code and fixed bug in widget bridge that reported an
incorrect index.
This commit is contained in:
itsmattkc
2020-07-17 12:33:28 +10:00
parent 662d66ad10
commit 6309b8fbb7
2 changed files with 21 additions and 2 deletions
+10 -1
View File
@@ -65,7 +65,16 @@ ShaderCode MathNodeBase::GetShaderCodeInternal(const QString &shader_id, NodeInp
operation = QStringLiteral("%1 / %2");
break;
case kOpPower:
operation = QStringLiteral("pow(%1, %2)");
if (pairing == kPairTextureNumber) {
// The "number" in this operation has to be declared a vec4
if (type_a & NodeParam::kNumber) {
operation = QStringLiteral("pow(%2, vec4(%1))");
} else {
operation = QStringLiteral("pow(%1, vec4(%2))");
}
} else {
operation = QStringLiteral("pow(%1, %2)");
}
break;
}