From 6873ecaaf9b2c5ad35487b1ff1d4be17770d7aab Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Wed, 9 Jun 2021 12:33:41 +0300 Subject: Added support for uniform arrays in shaders --- tests/test_shader_lang.cpp | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/test_shader_lang.cpp b/tests/test_shader_lang.cpp index 6d58eb63cc..5598852f29 100644 --- a/tests/test_shader_lang.cpp +++ b/tests/test_shader_lang.cpp @@ -125,23 +125,28 @@ static String dump_node_code(SL::Node *p_node, int p_level) { ucode += _prestr(E.value.precision); ucode += _typestr(E.value.type); ucode += " " + String(E.key); + if (E.value.array_size > 0) { + ucode += "["; + ucode += itos(E.value.array_size); + ucode += "]"; + } else { + if (E.value.default_value.size()) { + ucode += " = " + get_constant_text(E.value.type, E.value.default_value); + } - if (E.value.default_value.size()) { - ucode += " = " + get_constant_text(E.value.type, E.value.default_value); - } - - static const char *hint_name[SL::ShaderNode::Uniform::HINT_MAX] = { - "", - "color", - "range", - "albedo", - "normal", - "black", - "white" - }; - - if (E.value.hint) { - ucode += " : " + String(hint_name[E.value.hint]); + static const char *hint_name[SL::ShaderNode::Uniform::HINT_MAX] = { + "", + "color", + "range", + "albedo", + "normal", + "black", + "white" + }; + + if (E.value.hint) { + ucode += " : " + String(hint_name[E.value.hint]); + } } code += ucode + "\n"; -- cgit v1.2.3