diff options
author | Yuri Roubinsky <chaosus89@gmail.com> | 2021-06-04 12:24:08 +0300 |
---|---|---|
committer | Yuri Roubinsky <chaosus89@gmail.com> | 2021-08-07 21:02:13 +0300 |
commit | 5e5cd2495d8ec8bc0685dbf3b98dc251c3c7bddb (patch) | |
tree | 1f039810d2dc0308bde14d75afc6d6dcd971c14a /servers/rendering | |
parent | 3177da1d053a6132668e12a8d8af82366f5c4ac9 (diff) |
Added editor dialog for easily creating shaders.
Diffstat (limited to 'servers/rendering')
-rw-r--r-- | servers/rendering/shader_types.cpp | 22 | ||||
-rw-r--r-- | servers/rendering/shader_types.h | 8 |
2 files changed, 20 insertions, 10 deletions
diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp index 376d23ccb3..4488069698 100644 --- a/servers/rendering/shader_types.cpp +++ b/servers/rendering/shader_types.cpp @@ -31,18 +31,22 @@ #include "shader_types.h" #include "core/math/math_defs.h" -const Map<StringName, ShaderLanguage::FunctionInfo> &ShaderTypes::get_functions(RS::ShaderMode p_mode) { +const Map<StringName, ShaderLanguage::FunctionInfo> &ShaderTypes::get_functions(RS::ShaderMode p_mode) const { return shader_modes[p_mode].functions; } -const Vector<StringName> &ShaderTypes::get_modes(RS::ShaderMode p_mode) { +const Vector<StringName> &ShaderTypes::get_modes(RS::ShaderMode p_mode) const { return shader_modes[p_mode].modes; } -const Set<String> &ShaderTypes::get_types() { +const Set<String> &ShaderTypes::get_types() const { return shader_types; } +const List<String> &ShaderTypes::get_types_list() const { + return shader_types_list; +} + ShaderTypes *ShaderTypes::singleton = nullptr; static ShaderLanguage::BuiltInInfo constt(ShaderLanguage::DataType p_type) { @@ -440,8 +444,12 @@ ShaderTypes::ShaderTypes() { shader_modes[RS::SHADER_SKY].modes.push_back("use_quarter_res_pass"); shader_modes[RS::SHADER_SKY].modes.push_back("disable_fog"); - shader_types.insert("spatial"); - shader_types.insert("canvas_item"); - shader_types.insert("particles"); - shader_types.insert("sky"); + shader_types_list.push_back("spatial"); + shader_types_list.push_back("canvas_item"); + shader_types_list.push_back("particles"); + shader_types_list.push_back("sky"); + + for (int i = 0; i < shader_types_list.size(); i++) { + shader_types.insert(shader_types_list[i]); + } } diff --git a/servers/rendering/shader_types.h b/servers/rendering/shader_types.h index e59cef6b79..75a310a1b1 100644 --- a/servers/rendering/shader_types.h +++ b/servers/rendering/shader_types.h @@ -46,13 +46,15 @@ class ShaderTypes { static ShaderTypes *singleton; Set<String> shader_types; + List<String> shader_types_list; public: static ShaderTypes *get_singleton() { return singleton; } - const Map<StringName, ShaderLanguage::FunctionInfo> &get_functions(RS::ShaderMode p_mode); - const Vector<StringName> &get_modes(RS::ShaderMode p_mode); - const Set<String> &get_types(); + const Map<StringName, ShaderLanguage::FunctionInfo> &get_functions(RS::ShaderMode p_mode) const; + const Vector<StringName> &get_modes(RS::ShaderMode p_mode) const; + const Set<String> &get_types() const; + const List<String> &get_types_list() const; ShaderTypes(); }; |