fix: Handle Vector4 default input values in visual shaders

This commit is contained in:
Alexey Bondarenko 2024-04-18 18:26:03 +06:00 committed by GitHub
parent 2543d192c3
commit 69f2e066db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -2116,6 +2116,10 @@ Error VisualShader::_write_node(Type type, StringBuilder *p_global_code, StringB
Vector3 val = defval; Vector3 val = defval;
inputs[i] = "n_in" + itos(p_node) + "p" + itos(i); inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);
node_code += " vec3 " + inputs[i] + " = " + vformat("vec3(%.5f, %.5f, %.5f);\n", val.x, val.y, val.z); node_code += " vec3 " + inputs[i] + " = " + vformat("vec3(%.5f, %.5f, %.5f);\n", val.x, val.y, val.z);
} else if (defval.get_type() == Variant::VECTOR4) {
Vector4 val = defval;
inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);
node_code += " vec4 " + inputs[i] + " = " + vformat("vec4(%.5f, %.5f, %.5f, %.5f);\n", val.x, val.y, val.z, val.w);
} else if (defval.get_type() == Variant::QUATERNION) { } else if (defval.get_type() == Variant::QUATERNION) {
Quaternion val = defval; Quaternion val = defval;
inputs[i] = "n_in" + itos(p_node) + "p" + itos(i); inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);