summaryrefslogtreecommitdiffstats
path: root/scene/resources/visual_shader.cpp
diff options
context:
space:
mode:
authorAlexey Bondarenko <alexey.bond.94.55@gmail.com>2024-04-18 18:26:03 +0600
committerGitHub <noreply@github.com>2024-04-18 18:26:03 +0600
commit69f2e066dbec911a2dfcc9c1bb7380a946b52284 (patch)
tree4f8760854df9a73c51f7b3d60b561abfcb871ade /scene/resources/visual_shader.cpp
parent2543d192c3f74640393f245e48fdf70e241dbe37 (diff)
downloadredot-engine-69f2e066dbec911a2dfcc9c1bb7380a946b52284.tar.gz
fix: Handle Vector4 default input values in visual shaders
Diffstat (limited to 'scene/resources/visual_shader.cpp')
-rw-r--r--scene/resources/visual_shader.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 7e80d0be3c..3dd06c8bb1 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -2116,6 +2116,10 @@ Error VisualShader::_write_node(Type type, StringBuilder *p_global_code, StringB
Vector3 val = defval;
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);
+ } 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) {
Quaternion val = defval;
inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);