summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/SCsub4
-rw-r--r--editor/collada/SCsub5
-rw-r--r--editor/doc/SCsub5
-rw-r--r--editor/doc/doc_dump.cpp308
-rw-r--r--editor/doc/doc_dump.h41
-rw-r--r--editor/doc_data.cpp (renamed from editor/doc/doc_data.cpp)0
-rw-r--r--editor/doc_data.h (renamed from editor/doc/doc_data.h)0
-rw-r--r--editor/editor_help.h2
-rw-r--r--editor/file_type_cache.cpp104
-rw-r--r--editor/file_type_cache.h57
-rw-r--r--editor/import/collada.cpp (renamed from editor/collada/collada.cpp)0
-rw-r--r--editor/import/collada.h (renamed from editor/collada/collada.h)0
-rw-r--r--editor/import/editor_import_collada.cpp2
-rw-r--r--main/main.cpp4
-rw-r--r--main/tests/test_main.cpp3
-rw-r--r--main/tests/test_main.h3
-rw-r--r--main/tests/test_oa_hash_map.cpp3
-rw-r--r--main/tests/test_oa_hash_map.h1
-rw-r--r--main/tests/test_ordered_hash_map.cpp2
-rw-r--r--main/tests/test_ordered_hash_map.h4
-rw-r--r--modules/gdscript/language_server/lsp.hpp2
-rw-r--r--modules/mono/editor/bindings_generator.h2
-rw-r--r--platform/iphone/platform_refcount.h48
-rw-r--r--platform/x11/detect_prime.cpp2
-rw-r--r--platform/x11/joypad_linux.cpp5
-rw-r--r--platform/x11/os_x11.cpp6
-rw-r--r--scene/2d/path_texture.cpp90
-rw-r--r--scene/2d/path_texture.h64
-rw-r--r--scene/gui/line_edit.cpp21
-rw-r--r--scene/gui/rich_text_label.cpp2
-rw-r--r--scene/resources/canvas.cpp46
-rw-r--r--scene/resources/canvas.h48
-rw-r--r--scene/resources/sky_material.cpp2
-rw-r--r--servers/audio/reverb_sw.cpp538
-rw-r--r--servers/audio/reverb_sw.h88
-rw-r--r--servers/audio/voice_rb_sw.h141
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp59
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_rd.h23
-rw-r--r--servers/visual/rasterizer_rd/shader_rd.cpp1
-rw-r--r--servers/visual/rasterizer_rd/shaders/sky.glsl56
-rw-r--r--servers/visual/shader_types.cpp47
-rw-r--r--servers/visual/visual_server_light_baker.cpp34
-rw-r--r--servers/visual/visual_server_light_baker.h52
43 files changed, 157 insertions, 1768 deletions
diff --git a/editor/SCsub b/editor/SCsub
index e54383350e..6e8679b770 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -56,7 +56,7 @@ if env['tools']:
except OSError:
pass
- _make_doc_data_class_path(os.path.join(env.Dir('#').abspath, "editor/doc"))
+ _make_doc_data_class_path(os.path.join(env.Dir('#').abspath, "editor"))
docs = sorted(docs)
env.Depends("#editor/doc_data_compressed.gen.h", docs)
@@ -85,8 +85,6 @@ if env['tools']:
env.add_source_files(env.editor_sources, "*.cpp")
- SConscript('collada/SCsub')
- SConscript('doc/SCsub')
SConscript('debugger/SCsub')
SConscript('fileserver/SCsub')
SConscript('icons/SCsub')
diff --git a/editor/collada/SCsub b/editor/collada/SCsub
deleted file mode 100644
index 2b1e889fb0..0000000000
--- a/editor/collada/SCsub
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-
-env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/doc/SCsub b/editor/doc/SCsub
deleted file mode 100644
index 2b1e889fb0..0000000000
--- a/editor/doc/SCsub
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-
-env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp
deleted file mode 100644
index b0a89ff4b8..0000000000
--- a/editor/doc/doc_dump.cpp
+++ /dev/null
@@ -1,308 +0,0 @@
-/*************************************************************************/
-/* doc_dump.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "doc_dump.h"
-
-#include "core/os/file_access.h"
-#include "core/version.h"
-#include "scene/main/node.h"
-
-static void _write_string(FileAccess *f, int p_tablevel, const String &p_string) {
-
- String tab;
- for (int i = 0; i < p_tablevel; i++)
- tab += "\t";
- f->store_string(tab + p_string + "\n");
-}
-
-struct _ConstantSort {
-
- String name;
- int value;
- bool operator<(const _ConstantSort &p_c) const {
-
- String left_a = name.find("_") == -1 ? name : name.substr(0, name.find("_"));
- String left_b = p_c.name.find("_") == -1 ? p_c.name : p_c.name.substr(0, p_c.name.find("_"));
- if (left_a == left_b)
- return value < p_c.value;
- else
- return left_a < left_b;
- }
-};
-
-static String _escape_string(const String &p_str) {
-
- String ret = p_str;
- ret = ret.replace("&", "&amp;");
- ret = ret.replace("<", "&gt;");
- ret = ret.replace(">", "&lt;");
- ret = ret.replace("'", "&apos;");
- ret = ret.replace("\"", "&quot;");
- for (char i = 1; i < 32; i++) {
-
- char chr[2] = { i, 0 };
- ret = ret.replace(chr, "&#" + String::num(i) + ";");
- }
- ret = ret.utf8();
- return ret;
-}
-void DocDump::dump(const String &p_file) {
-
- List<StringName> class_list;
- ClassDB::get_class_list(&class_list);
-
- class_list.sort_custom<StringName::AlphCompare>();
-
- FileAccess *f = FileAccess::open(p_file, FileAccess::WRITE);
-
- _write_string(f, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
- _write_string(f, 0, String("<doc version=\"") + VERSION_BRANCH + "\" name=\"Engine Types\">");
-
- while (class_list.size()) {
-
- String name = class_list.front()->get();
-
- String header = "<class name=\"" + name + "\"";
- String inherits = ClassDB::get_parent_class(name);
- if (inherits != "")
- header += " inherits=\"" + inherits + "\"";
- _write_string(f, 0, header);
-
- _write_string(f, 1, "<brief_description>");
- _write_string(f, 1, "</brief_description>");
-
- _write_string(f, 1, "<description>");
- _write_string(f, 1, "</description>");
-
- _write_string(f, 1, "<methods>");
-
- List<MethodInfo> method_list;
- ClassDB::get_method_list(name, &method_list, true);
- method_list.sort();
-
- for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
- if (E->get().name == "" || E->get().name[0] == '_')
- continue; //hidden
-
- MethodBind *m = ClassDB::get_method(name, E->get().name);
-
- String qualifiers;
- if (E->get().flags & METHOD_FLAG_CONST)
- qualifiers += "qualifiers=\"const\"";
-
- _write_string(f, 2, "<method name=\"" + _escape_string(E->get().name) + "\" " + qualifiers + " >");
-
- for (int i = -1; i < E->get().arguments.size(); i++) {
-
- PropertyInfo arginfo;
-
- if (i == -1) {
-
- arginfo = E->get().return_val;
- String type_name = (arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE) ? arginfo.hint_string : Variant::get_type_name(arginfo.type);
-
- if (arginfo.type == Variant::NIL)
- continue;
- _write_string(f, 3, "<return type=\"" + type_name + "\">");
- } else {
-
- arginfo = E->get().arguments[i];
-
- String type_name;
-
- if (arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE)
- type_name = arginfo.hint_string;
- else if (arginfo.type == Variant::NIL)
- type_name = "Variant";
- else
- type_name = Variant::get_type_name(arginfo.type);
-
- if (m && m->has_default_argument(i)) {
- Variant default_arg = m->get_default_argument(i);
- String default_arg_text = String(_escape_string(m->get_default_argument(i)));
-
- switch (default_arg.get_type()) {
-
- case Variant::NIL:
- default_arg_text = "NULL";
- break;
- // atomic types
- case Variant::BOOL:
- if (bool(default_arg))
- default_arg_text = "true";
- else
- default_arg_text = "false";
- break;
- case Variant::INT:
- case Variant::FLOAT:
- //keep it
- break;
- case Variant::STRING:
- case Variant::STRING_NAME:
- default_arg_text = "@\"" + default_arg_text + "\"";
- break;
- case Variant::NODE_PATH:
- default_arg_text = "\"" + default_arg_text + "\"";
- break;
- case Variant::TRANSFORM:
- if (default_arg.operator Transform() == Transform()) {
- default_arg_text = "";
- }
-
- default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")";
- break;
-
- case Variant::VECTOR2:
- case Variant::RECT2:
- case Variant::VECTOR3:
- case Variant::PLANE:
- case Variant::QUAT:
- case Variant::AABB:
- case Variant::BASIS:
- case Variant::COLOR:
- case Variant::PACKED_BYTE_ARRAY:
- case Variant::PACKED_INT32_ARRAY:
- case Variant::PACKED_FLOAT32_ARRAY:
- case Variant::PACKED_INT64_ARRAY:
- case Variant::PACKED_FLOAT64_ARRAY:
- case Variant::PACKED_STRING_ARRAY:
- case Variant::PACKED_VECTOR3_ARRAY:
- case Variant::PACKED_COLOR_ARRAY:
- default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")";
- break;
- case Variant::OBJECT:
- case Variant::DICTIONARY:
- case Variant::ARRAY:
- case Variant::_RID:
-
- default: {
- }
- }
-
- _write_string(f, 3, "<argument index=\"" + itos(i) + "\" name=\"" + _escape_string(arginfo.name) + "\" type=\"" + type_name + "\" default=\"" + _escape_string(default_arg_text) + "\">");
- } else
- _write_string(f, 3, "<argument index=\"" + itos(i) + "\" name=\"" + arginfo.name + "\" type=\"" + type_name + "\">");
- }
-
- String hint;
- switch (arginfo.hint) {
- case PROPERTY_HINT_DIR: hint = "A directory."; break;
- case PROPERTY_HINT_RANGE: hint = "Range - min: " + arginfo.hint_string.get_slice(",", 0) + " max: " + arginfo.hint_string.get_slice(",", 1) + " step: " + arginfo.hint_string.get_slice(",", 2); break;
- case PROPERTY_HINT_ENUM:
- hint = "Values: ";
- for (int j = 0; j < arginfo.hint_string.get_slice_count(","); j++) {
- if (j > 0) hint += ", ";
- hint += arginfo.hint_string.get_slice(",", j) + "=" + itos(j);
- }
- break;
- case PROPERTY_HINT_LENGTH: hint = "Length: " + arginfo.hint_string; break;
- case PROPERTY_HINT_FLAGS:
- hint = "Values: ";
- for (int j = 0; j < arginfo.hint_string.get_slice_count(","); j++) {
- if (j > 0) hint += ", ";
- hint += arginfo.hint_string.get_slice(",", j) + "=" + itos((uint64_t)1 << j);
- }
- break;
- case PROPERTY_HINT_FILE: hint = "A file:"; break;
- default: {
- }
- //case PROPERTY_HINT_RESOURCE_TYPE: hint="Type: "+arginfo.hint_string; break;
- };
- if (hint != "")
- _write_string(f, 4, hint);
-
- _write_string(f, 3, (i == -1) ? "</return>" : "</argument>");
- }
-
- _write_string(f, 3, "<description>");
- _write_string(f, 3, "</description>");
-
- _write_string(f, 2, "</method>");
- }
-
- _write_string(f, 1, "</methods>");
-
- List<MethodInfo> signal_list;
- ClassDB::get_signal_list(name, &signal_list, true);
-
- if (signal_list.size()) {
-
- _write_string(f, 1, "<signals>");
- for (List<MethodInfo>::Element *EV = signal_list.front(); EV; EV = EV->next()) {
-
- _write_string(f, 2, "<signal name=\"" + EV->get().name + "\">");
- for (int i = 0; i < EV->get().arguments.size(); i++) {
- PropertyInfo arginfo = EV->get().arguments[i];
- _write_string(f, 3, "<argument index=\"" + itos(i) + "\" name=\"" + arginfo.name + "\" type=\"" + Variant::get_type_name(arginfo.type) + "\">");
- _write_string(f, 3, "</argument>");
- }
- _write_string(f, 3, "<description>");
- _write_string(f, 3, "</description>");
-
- _write_string(f, 2, "</signal>");
- }
-
- _write_string(f, 1, "</signals>");
- }
-
- _write_string(f, 1, "<constants>");
-
- List<String> constant_list;
- ClassDB::get_integer_constant_list(name, &constant_list, true);
-
- /* constants are sorted in a special way */
-
- List<_ConstantSort> constant_sort;
-
- for (List<String>::Element *E = constant_list.front(); E; E = E->next()) {
- _ConstantSort cs;
- cs.name = E->get();
- cs.value = ClassDB::get_integer_constant(name, E->get());
- constant_sort.push_back(cs);
- }
-
- constant_sort.sort();
-
- for (List<_ConstantSort>::Element *E = constant_sort.front(); E; E = E->next()) {
-
- _write_string(f, 2, "<constant name=\"" + E->get().name + "\" value=\"" + itos(E->get().value) + "\">");
- _write_string(f, 2, "</constant>");
- }
-
- _write_string(f, 1, "</constants>");
- _write_string(f, 0, "</class>");
-
- class_list.erase(name);
- }
-
- _write_string(f, 0, "</doc>");
- f->close();
- memdelete(f);
-}
diff --git a/editor/doc/doc_dump.h b/editor/doc/doc_dump.h
deleted file mode 100644
index f8f1b6f805..0000000000
--- a/editor/doc/doc_dump.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*************************************************************************/
-/* doc_dump.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef DOC_DUMP_H
-#define DOC_DUMP_H
-
-#include "core/class_db.h"
-
-class DocDump {
-public:
- static void dump(const String &p_file);
-};
-
-#endif // DOC_DUMP_H
diff --git a/editor/doc/doc_data.cpp b/editor/doc_data.cpp
index 66134b4428..66134b4428 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc_data.cpp
diff --git a/editor/doc/doc_data.h b/editor/doc_data.h
index 073705f0b1..073705f0b1 100644
--- a/editor/doc/doc_data.h
+++ b/editor/doc_data.h
diff --git a/editor/editor_help.h b/editor/editor_help.h
index a690e10e7e..0d3ecf9bd0 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -32,7 +32,7 @@
#define EDITOR_HELP_H
#include "editor/code_editor.h"
-#include "editor/doc/doc_data.h"
+#include "editor/doc_data.h"
#include "editor/editor_plugin.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/file_type_cache.cpp b/editor/file_type_cache.cpp
deleted file mode 100644
index 52ab80cc48..0000000000
--- a/editor/file_type_cache.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*************************************************************************/
-/* file_type_cache.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "file_type_cache.h"
-
-#include "core/os/file_access.h"
-#include "core/project_settings.h"
-
-FileTypeCache *FileTypeCache::singleton = NULL;
-
-bool FileTypeCache::has_file(const String &p_path) const {
-
- GLOBAL_LOCK_FUNCTION
- return file_type_map.has(p_path);
-}
-
-String FileTypeCache::get_file_type(const String &p_path) const {
-
- GLOBAL_LOCK_FUNCTION
- ERR_FAIL_COND_V(!file_type_map.has(p_path), "");
- return file_type_map[p_path];
-}
-void FileTypeCache::set_file_type(const String &p_path, const String &p_type) {
-
- GLOBAL_LOCK_FUNCTION
- file_type_map[p_path] = p_type;
-}
-
-void FileTypeCache::load() {
-
- GLOBAL_LOCK_FUNCTION
- String project = ProjectSettings::get_singleton()->get_resource_path();
- FileAccess *f = FileAccess::open(project + "/file_type_cache.cch", FileAccess::READ);
-
- if (!f) {
-
- WARN_PRINT("Can't open file_type_cache.cch.");
- return;
- }
-
- file_type_map.clear();
- while (!f->eof_reached()) {
-
- String path = f->get_line();
- if (f->eof_reached())
- break;
- String type = f->get_line();
- set_file_type(path, type);
- }
-
- memdelete(f);
-}
-
-void FileTypeCache::save() {
-
- GLOBAL_LOCK_FUNCTION
- String project = ProjectSettings::get_singleton()->get_resource_path();
- FileAccess *f = FileAccess::open(project + "/file_type_cache.cch", FileAccess::WRITE);
-
- ERR_FAIL_COND_MSG(!f, "Can't open file_type_cache.cch for writing, not saving file type cache!");
-
- const String *K = NULL;
-
- while ((K = file_type_map.next(K))) {
-
- f->store_line(*K);
- f->store_line(file_type_map[*K]);
- }
-
- memdelete(f);
-}
-
-FileTypeCache::FileTypeCache() {
-
- ERR_FAIL_COND_MSG(singleton, "FileTypeCache singleton already exist.");
- singleton = this;
-}
diff --git a/editor/file_type_cache.h b/editor/file_type_cache.h
deleted file mode 100644
index 216effea00..0000000000
--- a/editor/file_type_cache.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*************************************************************************/
-/* file_type_cache.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef FILE_TYPE_CACHE_H
-#define FILE_TYPE_CACHE_H
-
-#include "core/object.h"
-
-class FileTypeCache : Object {
-
- GDCLASS(FileTypeCache, Object);
-
- HashMap<String, String> file_type_map;
-
- static FileTypeCache *singleton;
-
-public:
- static FileTypeCache *get_singleton() { return singleton; }
-
- bool has_file(const String &p_path) const;
- String get_file_type(const String &p_path) const;
- void set_file_type(const String &p_path, const String &p_type);
-
- void load();
- void save();
-
- FileTypeCache();
-};
-
-#endif // FILE_TYPE_CACHE_H
diff --git a/editor/collada/collada.cpp b/editor/import/collada.cpp
index 8ef9d17083..8ef9d17083 100644
--- a/editor/collada/collada.cpp
+++ b/editor/import/collada.cpp
diff --git a/editor/collada/collada.h b/editor/import/collada.h
index 4707d7d779..4707d7d779 100644
--- a/editor/collada/collada.h
+++ b/editor/import/collada.h
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 3cc6e7a50c..f7da8c27f9 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -31,8 +31,8 @@
#include "editor_import_collada.h"
#include "core/os/os.h"
-#include "editor/collada/collada.h"
#include "editor/editor_node.h"
+#include "editor/import/collada.h"
#include "scene/3d/camera.h"
#include "scene/3d/light.h"
#include "scene/3d/mesh_instance.h"
diff --git a/main/main.cpp b/main/main.cpp
index 887d423d52..0047d05771 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -71,8 +71,8 @@
#include "servers/register_server_types.h"
#ifdef TOOLS_ENABLED
-#include "editor/doc/doc_data.h"
-#include "editor/doc/doc_data_class_path.gen.h"
+#include "editor/doc_data.h"
+#include "editor/doc_data_class_path.gen.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/progress_dialog.h"
diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp
index 2c2e6e8b45..beb955d045 100644
--- a/main/tests/test_main.cpp
+++ b/main/tests/test_main.cpp
@@ -28,8 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "test_main.h"
+
#include "core/list.h"
-#include "core/os/main_loop.h"
#ifdef DEBUG_ENABLED
diff --git a/main/tests/test_main.h b/main/tests/test_main.h
index 56db3ea2a5..bdb1668d21 100644
--- a/main/tests/test_main.h
+++ b/main/tests/test_main.h
@@ -32,9 +32,10 @@
#define TEST_MAIN_H
#include "core/list.h"
+#include "core/os/main_loop.h"
#include "core/ustring.h"
const char **tests_get_names();
MainLoop *test_main(String p_test, const List<String> &p_args);
-#endif
+#endif // TEST_MAIN_H
diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp
index edb57f2a9f..ac53f124d2 100644
--- a/main/tests/test_oa_hash_map.cpp
+++ b/main/tests/test_oa_hash_map.cpp
@@ -30,9 +30,8 @@
#include "test_oa_hash_map.h"
-#include "core/os/os.h"
-
#include "core/oa_hash_map.h"
+#include "core/os/os.h"
namespace TestOAHashMap {
diff --git a/main/tests/test_oa_hash_map.h b/main/tests/test_oa_hash_map.h
index 60cde961c5..eb2b3d1e99 100644
--- a/main/tests/test_oa_hash_map.h
+++ b/main/tests/test_oa_hash_map.h
@@ -37,4 +37,5 @@ namespace TestOAHashMap {
MainLoop *test();
}
+
#endif // TEST_OA_HASH_MAP_H
diff --git a/main/tests/test_ordered_hash_map.cpp b/main/tests/test_ordered_hash_map.cpp
index cc779119bc..a5553217e2 100644
--- a/main/tests/test_ordered_hash_map.cpp
+++ b/main/tests/test_ordered_hash_map.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "test_ordered_hash_map.h"
+
#include "core/ordered_hash_map.h"
#include "core/os/os.h"
#include "core/pair.h"
diff --git a/main/tests/test_ordered_hash_map.h b/main/tests/test_ordered_hash_map.h
index 03e559107e..f251da0ba2 100644
--- a/main/tests/test_ordered_hash_map.h
+++ b/main/tests/test_ordered_hash_map.h
@@ -31,9 +31,11 @@
#ifndef TEST_ORDERED_HASH_MAP_H
#define TEST_ORDERED_HASH_MAP_H
+#include "core/os/main_loop.h"
+
namespace TestOrderedHashMap {
MainLoop *test();
}
-#endif
+#endif // TEST_ORDERED_HASH_MAP_H
diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp
index a2dcc48820..914c9742e1 100644
--- a/modules/gdscript/language_server/lsp.hpp
+++ b/modules/gdscript/language_server/lsp.hpp
@@ -33,7 +33,7 @@
#include "core/class_db.h"
#include "core/list.h"
-#include "editor/doc/doc_data.h"
+#include "editor/doc_data.h"
namespace lsp {
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index b133923c25..bebe489d02 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -33,7 +33,7 @@
#include "core/class_db.h"
#include "core/string_builder.h"
-#include "editor/doc/doc_data.h"
+#include "editor/doc_data.h"
#include "editor/editor_help.h"
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
diff --git a/platform/iphone/platform_refcount.h b/platform/iphone/platform_refcount.h
deleted file mode 100644
index 9029418462..0000000000
--- a/platform/iphone/platform_refcount.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*************************************************************************/
-/* platform_refcount.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "core/safe_refcount.h"
-
-#ifdef IPHONE_ENABLED
-
-#define REFCOUNT_T int
-#define REFCOUNT_GET_T int const volatile &
-
-#include <libkern/OSAtomic.h>
-
-inline int atomic_conditional_increment(volatile int *v) {
- return (*v == 0) ? 0 : OSAtomicIncrement32(v);
-}
-
-inline int atomic_decrement(volatile int *v) {
- return OSAtomicDecrement32(v);
-}
-
-#endif
diff --git a/platform/x11/detect_prime.cpp b/platform/x11/detect_prime.cpp
index a0e5f835c0..d79fd00118 100644
--- a/platform/x11/detect_prime.cpp
+++ b/platform/x11/detect_prime.cpp
@@ -31,6 +31,8 @@
#ifdef X11_ENABLED
#if defined(OPENGL_ENABLED)
+#include "detect_prime.h"
+
#include "core/print_string.h"
#include "core/ustring.h"
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index a9fe7275c2..1aacc6a250 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -340,7 +340,10 @@ void JoypadLinux::open_joypad(const char *p_path) {
(test_bit(ABS_X, absbit) || test_bit(ABS_Y, absbit) || test_bit(ABS_HAT0X, absbit) ||
test_bit(ABS_GAS, absbit) || test_bit(ABS_RUDDER, absbit)) &&
(test_bit(BTN_A, keybit) || test_bit(BTN_THUMBL, keybit) ||
- test_bit(BTN_TRIGGER, keybit) || test_bit(BTN_1, keybit)))) {
+ test_bit(BTN_TRIGGER, keybit) || test_bit(BTN_1, keybit))) &&
+ !(test_bit(EV_ABS, evbit) &&
+ test_bit(ABS_X, absbit) && test_bit(ABS_Y, absbit) &&
+ test_bit(ABS_RX, absbit) && test_bit(ABS_RY, absbit))) {
close(fd);
return;
}
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index e1f7691cf6..772913980b 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -267,6 +267,9 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
unsigned long valuemask = CWBorderPixel | CWColormap | CWEventMask;
x11_window = XCreateWindow(x11_display, RootWindow(x11_display, visualInfo->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, visualInfo->depth, InputOutput, visualInfo->visual, valuemask, &windowAttributes);
+ wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true);
+ XSetWMProtocols(x11_display, x11_window, &wm_delete, 1);
+
//set_class_hint(x11_display, x11_window);
XMapWindow(x11_display, x11_window);
XFlush(x11_display);
@@ -476,9 +479,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
/* set the titlebar name */
XStoreName(x11_display, x11_window, "Godot");
- wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true);
- XSetWMProtocols(x11_display, x11_window, &wm_delete, 1);
-
im_active = false;
im_position = Vector2();
diff --git a/scene/2d/path_texture.cpp b/scene/2d/path_texture.cpp
deleted file mode 100644
index 590f70a1b2..0000000000
--- a/scene/2d/path_texture.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*************************************************************************/
-/* path_texture.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "path_texture.h"
-
-void PathTexture::set_begin_texture(const Ref<Texture2D> &p_texture) {
-
- begin = p_texture;
- update();
-}
-
-Ref<Texture2D> PathTexture::get_begin_texture() const {
-
- return begin;
-}
-
-void PathTexture::set_repeat_texture(const Ref<Texture2D> &p_texture) {
-
- repeat = p_texture;
- update();
-}
-Ref<Texture2D> PathTexture::get_repeat_texture() const {
-
- return repeat;
-}
-
-void PathTexture::set_end_texture(const Ref<Texture2D> &p_texture) {
-
- end = p_texture;
- update();
-}
-Ref<Texture2D> PathTexture::get_end_texture() const {
-
- return end;
-}
-
-void PathTexture::set_subdivisions(int p_amount) {
-
- ERR_FAIL_INDEX(p_amount, 32);
- subdivs = p_amount;
- update();
-}
-
-int PathTexture::get_subdivisions() const {
-
- return subdivs;
-}
-
-void PathTexture::set_overlap(int p_amount) {
-
- overlap = p_amount;
- update();
-}
-int PathTexture::get_overlap() const {
-
- return overlap;
-}
-
-PathTexture::PathTexture() {
-
- overlap = 0;
- subdivs = 1;
-}
diff --git a/scene/2d/path_texture.h b/scene/2d/path_texture.h
deleted file mode 100644
index 014d0dc959..0000000000
--- a/scene/2d/path_texture.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*************************************************************************/
-/* path_texture.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef PATH_TEXTURE_H
-#define PATH_TEXTURE_H
-
-#include "scene/2d/node_2d.h"
-
-class PathTexture : public Node2D {
- GDCLASS(PathTexture, Node2D);
-
- Ref<Texture2D> begin;
- Ref<Texture2D> repeat;
- Ref<Texture2D> end;
- int subdivs;
- bool overlap;
-
-public:
- void set_begin_texture(const Ref<Texture2D> &p_texture);
- Ref<Texture2D> get_begin_texture() const;
-
- void set_repeat_texture(const Ref<Texture2D> &p_texture);
- Ref<Texture2D> get_repeat_texture() const;
-
- void set_end_texture(const Ref<Texture2D> &p_texture);
- Ref<Texture2D> get_end_texture() const;
-
- void set_subdivisions(int p_amount);
- int get_subdivisions() const;
-
- void set_overlap(int p_amount);
- int get_overlap() const;
-
- PathTexture();
-};
-
-#endif // PATH_TEXTURE_H
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 73380c6b1b..7ee4dab3c9 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -307,7 +307,6 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->hide_virtual_keyboard();
- return;
} break;
case KEY_BACKSPACE: {
@@ -633,7 +632,7 @@ void LineEdit::drop_data(const Point2 &p_point, const Variant &p_data) {
Ref<Font> font = get_font("font");
if (font != NULL) {
for (int i = selection.begin; i < selection.end; i++)
- cached_width -= font->get_char_size(text[i]).width;
+ cached_width -= font->get_char_size(pass ? secret_character[0] : text[i]).width;
}
text.erase(selection.begin, selected);
@@ -1093,11 +1092,7 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
int char_w = 0;
if (font != NULL) {
- if (is_secret()) {
- char_w = font->get_char_size(secret_character[0]).width;
- } else {
- char_w = font->get_char_size(text[ofs]).width;
- }
+ char_w = font->get_char_size(pass ? secret_character[0] : text[ofs]).width;
}
pixel_ofs += char_w;
@@ -1149,7 +1144,7 @@ int LineEdit::get_cursor_pixel_pos() {
while (ofs < cursor_pos) {
if (font != NULL) {
- pixel_ofs += font->get_char_size(text[ofs]).width;
+ pixel_ofs += font->get_char_size(pass ? secret_character[0] : text[ofs]).width;
}
ofs++;
}
@@ -1208,7 +1203,7 @@ void LineEdit::delete_char() {
Ref<Font> font = get_font("font");
if (font != NULL) {
- cached_width -= font->get_char_size(text[cursor_pos - 1]).width;
+ cached_width -= font->get_char_size(pass ? secret_character[0] : text[cursor_pos - 1]).width;
}
text.erase(cursor_pos - 1, 1);
@@ -1228,7 +1223,7 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) {
Ref<Font> font = get_font("font");
if (font != NULL) {
for (int i = p_from_column; i < p_to_column; i++)
- cached_width -= font->get_char_size(text[i]).width;
+ cached_width -= font->get_char_size(pass ? secret_character[0] : text[i]).width;
}
} else {
cached_width = 0;
@@ -1352,7 +1347,11 @@ void LineEdit::set_cursor_position(int p_pos) {
// Do not do this, because if the cursor is at the end, its just fine that it takes no space.
// accum_width = font->get_char_size(' ').width;
} else {
- accum_width += font->get_char_size(text[i], i + 1 < text.length() ? text[i + 1] : 0).width; // Anything should do.
+ if (pass) {
+ accum_width += font->get_char_size(secret_character[0], i + 1 < text.length() ? secret_character[0] : 0).width;
+ } else {
+ accum_width += font->get_char_size(text[i], i + 1 < text.length() ? text[i + 1] : 0).width; // Anything should do.
+ }
}
if (accum_width > window_width)
break;
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index bc1510d6f6..e4651ef473 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -2507,7 +2507,7 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p
if (it->type == ITEM_TEXT) {
ItemText *t = static_cast<ItemText *>(it);
- int sp = t->text.find(p_string, charidx);
+ int sp = t->text.findn(p_string, charidx);
if (sp != -1) {
selection.from = it;
selection.from_char = sp;
diff --git a/scene/resources/canvas.cpp b/scene/resources/canvas.cpp
deleted file mode 100644
index 1dbd02ea28..0000000000
--- a/scene/resources/canvas.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*************************************************************************/
-/* canvas.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "canvas.h"
-#include "servers/visual_server.h"
-
-RID Canvas::get_rid() const {
-
- return canvas;
-}
-
-Canvas::Canvas() {
-
- canvas = VisualServer::get_singleton()->canvas_create();
-}
-
-Canvas::~Canvas() {
- VisualServer::get_singleton()->free(canvas);
-}
diff --git a/scene/resources/canvas.h b/scene/resources/canvas.h
deleted file mode 100644
index 621911fe0a..0000000000
--- a/scene/resources/canvas.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*************************************************************************/
-/* canvas.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef CANVAS_H
-#define CANVAS_H
-
-#include "core/resource.h"
-
-class Canvas : public Resource {
-
- GDCLASS(Canvas, Resource);
-
- RID canvas;
-
-public:
- virtual RID get_rid() const;
- Canvas();
- ~Canvas();
-};
-
-#endif // CANVAS_H
diff --git a/scene/resources/sky_material.cpp b/scene/resources/sky_material.cpp
index 5d8ceacbf2..c3e51460c6 100644
--- a/scene/resources/sky_material.cpp
+++ b/scene/resources/sky_material.cpp
@@ -293,6 +293,8 @@ ProceduralSkyMaterial::ProceduralSkyMaterial() {
}
ProceduralSkyMaterial::~ProceduralSkyMaterial() {
+ VS::get_singleton()->free(shader);
+ VS::get_singleton()->material_set_shader(_get_material(), RID());
}
/////////////////////////////////////////
diff --git a/servers/audio/reverb_sw.cpp b/servers/audio/reverb_sw.cpp
deleted file mode 100644
index 3bf0b0ea96..0000000000
--- a/servers/audio/reverb_sw.cpp
+++ /dev/null
@@ -1,538 +0,0 @@
-/*************************************************************************/
-/* reverb_sw.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "reverb_sw.h"
-
-#include "core/print_string.h"
-
-#include <stdlib.h>
-
-#define SETMIN(x, y) (x) = MIN((x), (y))
-
-#define rangeloop(c, min, max) \
- for ((c) = (min); (c) < (max); (c)++)
-
-#define MULSHIFT_S32(Factor1, Factor2, Bits) \
- ((int)(((int64_t)(Factor1) * (Factor2)) >> (Bits)))
-
-struct ReverbParamsSW {
- unsigned int BufferSize; // Required buffer size
- int gLPF; // Coefficient
- int gEcho0; // Coefficient
- int gEcho1; // Coefficient
- int gEcho2; // Coefficient
- int gEcho3; // Coefficient
- int gWall; // Coefficient
- int gReva; // Coefficient
- int gRevb; // Coefficient
- int gInputL; // Coefficient
- int gInputR; // Coefficient
- unsigned int nRevaOldL; // Offset
- unsigned int nRevaOldR; // Offset
- unsigned int nRevbOldL; // Offset
- unsigned int nRevbOldR; // Offset
- unsigned int nLwlNew; // Offset
- unsigned int nRwrNew; // Offset
- unsigned int nEcho0L; // Offset
- unsigned int nEcho0R; // Offset
- unsigned int nEcho1L; // Offset
- unsigned int nEcho1R; // Offset
- unsigned int nLwlOld; // Offset
- unsigned int nRwrOld; // Offset
- unsigned int nLwrNew; // Offset
- unsigned int nRwlNew; // Offset
- unsigned int nEcho2L; // Offset
- unsigned int nEcho2R; // Offset
- unsigned int nEcho3L; // Offset
- unsigned int nEcho3R; // Offset
- unsigned int nLwrOld; // Offset
- unsigned int nRwlOld; // Offset
- unsigned int nRevaNewL; // Offset
- unsigned int nRevaNewR; // Offset
- unsigned int nRevbNewL; // Offset
- unsigned int nRevbNewR; // Offset
-};
-
-static ReverbParamsSW reverb_params_Room = {
- 0x26C0 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x6D80, 0x54B8, -0x4130, 0x0000, 0x0000, -0x4580,
- //gReva gRevb gInputL gInputR
- 0x5800, 0x5300, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x01B4 - 0x007D, 0x0136 - 0x007D, 0x00B8 - 0x005B, 0x005C - 0x005B,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x04D6, 0x0333, 0x03F0, 0x0227, 0x0374, 0x01EF,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x0334, 0x01B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x0000, 0x0000, 0x01B4, 0x0136, 0x00B8, 0x005C
-};
-
-static ReverbParamsSW reverb_params_StudioSmall = {
- 0x1F40 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x70F0, 0x4FA8, -0x4320, 0x4410, -0x3F10, -0x6400,
- //gReva gRevb gInputL gInputR
- 0x5280, 0x4EC0, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x00B4 - 0x0033, 0x0080 - 0x0033, 0x004C - 0x0025, 0x0026 - 0x0025,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x03E4, 0x031B, 0x03A4, 0x02AF, 0x0372, 0x0266,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x031C, 0x025D, 0x025C, 0x018E, 0x022F, 0x0135, 0x01D2, 0x00B7,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x018F, 0x00B5, 0x00B4, 0x0080, 0x004C, 0x0026
-};
-
-static ReverbParamsSW reverb_params_StudioMedium = {
- 0x4840 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x70F0, 0x4FA8, -0x4320, 0x4510, -0x4110, -0x4B40,
- //gReva gRevb gInputL gInputR
- 0x5280, 0x4EC0, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x0264 - 0x00B1, 0x01B2 - 0x00B1, 0x0100 - 0x007F, 0x0080 - 0x007F,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x0904, 0x076B, 0x0824, 0x065F, 0x07A2, 0x0616,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x076C, 0x05ED, 0x05EC, 0x042E, 0x050F, 0x0305, 0x0462, 0x02B7,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x042F, 0x0265, 0x0264, 0x01B2, 0x0100, 0x0080
-};
-
-static ReverbParamsSW reverb_params_StudioLarge = {
- 0x6FE0 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x6F60, 0x4FA8, -0x4320, 0x4510, -0x4110, -0x5980,
- //gReva gRevb gInputL gInputR
- 0x5680, 0x52C0, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x031C - 0x00E3, 0x0238 - 0x00E3, 0x0154 - 0x00A9, 0x00AA - 0x00A9,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x0DFB, 0x0B58, 0x0D09, 0x0A3C, 0x0BD9, 0x0973,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x0B59, 0x08DA, 0x08D9, 0x05E9, 0x07EC, 0x04B0, 0x06EF, 0x03D2,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x05EA, 0x031D, 0x031C, 0x0238, 0x0154, 0x00AA
-};
-
-static ReverbParamsSW reverb_params_Hall = {
- 0xADE0 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x6000, 0x5000, 0x4C00, -0x4800, -0x4400, -0x4000,
- //gReva gRevb gInputL gInputR
- 0x6000, 0x5C00, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x05C0 - 0x01A5, 0x041A - 0x01A5, 0x0274 - 0x0139, 0x013A - 0x0139,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x15BA, 0x11BB, 0x14C2, 0x10BD, 0x11BC, 0x0DC1,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x11C0, 0x0DC3, 0x0DC0, 0x09C1, 0x0BC4, 0x07C1, 0x0A00, 0x06CD,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x09C2, 0x05C1, 0x05C0, 0x041A, 0x0274, 0x013A
-};
-
-static ReverbParamsSW reverb_params_SpaceEcho = {
- 0xF6C0 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x7E00, 0x5000, -0x4C00, -0x5000, 0x4C00, -0x5000,
- //gReva gRevb gInputL gInputR
- 0x6000, 0x5400, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x0AE0 - 0x033D, 0x07A2 - 0x033D, 0x0464 - 0x0231, 0x0232 - 0x0231,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x1ED6, 0x1A31, 0x1D14, 0x183B, 0x1BC2, 0x16B2,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x1A32, 0x15EF, 0x15EE, 0x1055, 0x1334, 0x0F2D, 0x11F6, 0x0C5D,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x1056, 0x0AE1, 0x0AE0, 0x07A2, 0x0464, 0x0232
-};
-
-static ReverbParamsSW reverb_params_Echo = {
- 0x18040 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x7FFF, 0x7FFF, 0x0000, 0x0000, 0x0000, -0x7F00,
- //gReva gRevb gInputL gInputR
- 0x0000, 0x0000, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x1004 - 0x0001, 0x1002 - 0x0001, 0x0004 - 0x0001, 0x0002 - 0x0001,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x1FFF, 0x0FFF, 0x1005, 0x0005, 0x0000, 0x0000,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x1005, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x0000, 0x0000, 0x1004, 0x1002, 0x0004, 0x0002
-};
-
-static ReverbParamsSW reverb_params_Delay = {
- 0x18040 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x7FFF, 0x7FFF, 0x0000, 0x0000, 0x0000, 0x0000,
- //gReva gRevb gInputL gInputR
- 0x0000, 0x0000, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x1004 - 0x0001, 0x1002 - 0x0001, 0x0004 - 0x0001, 0x0002 - 0x0001,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x1FFF, 0x0FFF, 0x1005, 0x0005, 0x0000, 0x0000,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x1005, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x0000, 0x0000, 0x1004, 0x1002, 0x0004, 0x0002
-};
-
-static ReverbParamsSW reverb_params_HalfEcho = {
- 0x3C00 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x70F0, 0x4FA8, -0x4320, 0x4510, -0x4110, -0x7B00,
- //gReva gRevb gInputL gInputR
- 0x5F80, 0x54C0, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x0058 - 0x0017, 0x0040 - 0x0017, 0x0028 - 0x0013, 0x0014 - 0x0013,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x0371, 0x02AF, 0x02E5, 0x01DF, 0x02B0, 0x01D7,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x0358, 0x026A, 0x01D6, 0x011E, 0x012D, 0x00B1, 0x011F, 0x0059,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x01A0, 0x00E3, 0x0058, 0x0040, 0x0028, 0x0014
-};
-
-static ReverbParamsSW *reverb_param_modes[] = {
- &reverb_params_Room,
- &reverb_params_StudioSmall,
- &reverb_params_StudioMedium,
- &reverb_params_StudioLarge,
- &reverb_params_Hall,
- &reverb_params_SpaceEcho,
- &reverb_params_Echo,
- &reverb_params_Delay,
- &reverb_params_HalfEcho,
-};
-
-bool ReverbSW::process(int *p_input, int *p_output, int p_frames, int p_stereo_stride) {
-
- // p_input must point to a non-looping buffer.
- // BOTH p_input and p_output must be touched (use ClearModuleBuffer).
-
- if (!reverb_buffer)
- return false;
-
-// LOCAL MACROS
-#undef LM_SETSRCOFFSET
-#define LM_SETSRCOFFSET(x) \
- (x) = current_params->x + Offset; \
- if ((x) >= reverb_buffer_size) { \
- (x) -= reverb_buffer_size; \
- } \
- SETMIN(aSample, reverb_buffer_size - (x));
-
-/*
-#undef LM_SETSRCOFFSET2
-#define LM_SETSRCOFFSET2(x,y) \
- (x) = ((y) << 3) >> HZShift; \
- (x) += Offset; \
- if ( (x) >= reverb_buffer_size ) { \
- (x) -= reverb_buffer_size; \
- } \
- SETMIN ( aSample, reverb_buffer_size - (x) );
-*/
-#undef LM_SRCADVANCE
-#define LM_SRCADVANCE(x) \
- (x) += aSample;
-
-#undef LM_MUL
-#define LM_MUL(x, y) \
- MULSHIFT_S32(x, current_params->y, 15)
-
-#undef LM_REVERB
-#define LM_REVERB(x) reverb_buffer[(x) + cSample]
-
- // LOCAL VARIABLES
-
- unsigned int Offset;
-
- int lwl, lwr, rwl, rwr;
- //unsigned char HZShift;
-
- // CODE
-
- lwl = state.lwl;
- lwr = state.lwr;
- rwl = state.rwl;
- rwr = state.rwr;
- Offset = state.Offset;
-
- int max = 0;
-
- while (p_frames) {
-
- // Offsets
-
- unsigned int nLwlOld;
- unsigned int nRwrOld;
- unsigned int nLwlNew;
- unsigned int nRwrNew;
-
- unsigned int nLwrOld;
- unsigned int nRwlOld;
- unsigned int nLwrNew;
- unsigned int nRwlNew;
-
- unsigned int nEcho0L;
- unsigned int nEcho1L;
- unsigned int nEcho2L;
- unsigned int nEcho3L;
-
- unsigned int nEcho0R;
- unsigned int nEcho1R;
- unsigned int nEcho2R;
- unsigned int nEcho3R;
-
- unsigned int nRevaOldL;
- unsigned int nRevaOldR;
- unsigned int nRevbOldL;
- unsigned int nRevbOldR;
-
- unsigned int nRevaNewL;
- unsigned int nRevaNewR;
- unsigned int nRevbNewL;
- unsigned int nRevbNewR;
-
- // Other variables
-
- unsigned int aSample = p_frames;
-
- // Set initial offsets
-
- LM_SETSRCOFFSET(nLwlOld);
- LM_SETSRCOFFSET(nRwrOld);
- LM_SETSRCOFFSET(nLwlNew);
- LM_SETSRCOFFSET(nRwrNew);
- LM_SETSRCOFFSET(nLwrOld);
- LM_SETSRCOFFSET(nRwlOld);
- LM_SETSRCOFFSET(nLwrNew);
- LM_SETSRCOFFSET(nRwlNew);
- LM_SETSRCOFFSET(nEcho0L);
- LM_SETSRCOFFSET(nEcho1L);
- LM_SETSRCOFFSET(nEcho2L);
- LM_SETSRCOFFSET(nEcho3L);
- LM_SETSRCOFFSET(nEcho0R);
- LM_SETSRCOFFSET(nEcho1R);
- LM_SETSRCOFFSET(nEcho2R);
- LM_SETSRCOFFSET(nEcho3R);
- LM_SETSRCOFFSET(nRevaOldL);
- LM_SETSRCOFFSET(nRevaOldR);
- LM_SETSRCOFFSET(nRevbOldL);
- LM_SETSRCOFFSET(nRevbOldR);
- LM_SETSRCOFFSET(nRevaNewL);
- LM_SETSRCOFFSET(nRevaNewR);
- LM_SETSRCOFFSET(nRevbNewL);
- LM_SETSRCOFFSET(nRevbNewR);
-
- //SETMIN ( aSample, p_output.Size - p_output.Offset );
-
- for (unsigned int cSample = 0; cSample < aSample; cSample++) {
-
- int tempL0, tempL1, tempR0, tempR1;
-
- tempL1 = p_input[(cSample << p_stereo_stride)] >> 8;
- tempR1 = p_input[(cSample << p_stereo_stride) + 1] >> 8;
-
- tempL0 = LM_MUL(tempL1, gInputL);
- tempR0 = LM_MUL(tempR1, gInputR);
-
- /*
- Left -> Wall -> Left Reflection
- */
- tempL1 = tempL0 + LM_MUL(LM_REVERB(nLwlOld), gWall);
- tempR1 = tempR0 + LM_MUL(LM_REVERB(nRwrOld), gWall);
- lwl += LM_MUL(tempL1 - lwl, gLPF);
- rwr += LM_MUL(tempR1 - rwr, gLPF);
- LM_REVERB(nLwlNew) = lwl;
- LM_REVERB(nRwrNew) = rwr;
- /*
- Left -> Wall -> Right Reflection
- */
- tempL1 = tempL0 + LM_MUL(LM_REVERB(nRwlOld), gWall);
- tempR1 = tempR0 + LM_MUL(LM_REVERB(nLwrOld), gWall);
- lwr += LM_MUL(tempL1 - lwr, gLPF);
- rwl += LM_MUL(tempR1 - rwl, gLPF);
- LM_REVERB(nLwrNew) = lwr;
- LM_REVERB(nRwlNew) = rwl;
- /*
- Early Echo(Early Reflection)
- */
- tempL0 =
- LM_MUL(LM_REVERB(nEcho0L), gEcho0) +
- LM_MUL(LM_REVERB(nEcho1L), gEcho1) +
- LM_MUL(LM_REVERB(nEcho2L), gEcho2) +
- LM_MUL(LM_REVERB(nEcho3L), gEcho3);
- tempR0 =
- LM_MUL(LM_REVERB(nEcho0R), gEcho0) +
- LM_MUL(LM_REVERB(nEcho1R), gEcho1) +
- LM_MUL(LM_REVERB(nEcho2R), gEcho2) +
- LM_MUL(LM_REVERB(nEcho3R), gEcho3);
- /*
- Late Reverb
- */
- tempL1 = LM_REVERB(nRevaOldL);
- tempR1 = LM_REVERB(nRevaOldR);
- tempL0 -= LM_MUL(tempL1, gReva);
- tempR0 -= LM_MUL(tempR1, gReva);
- LM_REVERB(nRevaNewL) = tempL0;
- LM_REVERB(nRevaNewR) = tempR0;
- tempL0 = LM_MUL(tempL0, gReva) + tempL1;
- tempR0 = LM_MUL(tempR0, gReva) + tempR1;
- tempL1 = LM_REVERB(nRevbOldL);
- tempR1 = LM_REVERB(nRevbOldR);
- tempL0 -= LM_MUL(tempL1, gRevb);
- tempR0 -= LM_MUL(tempR1, gRevb);
- LM_REVERB(nRevbNewL) = tempL0;
- LM_REVERB(nRevbNewR) = tempR0;
- tempL0 = LM_MUL(tempL0, gRevb) + tempL1;
- tempR0 = LM_MUL(tempR0, gRevb) + tempR1;
- /*
- Output
- */
-
- max |= abs(tempL0);
- max |= abs(tempR0);
-
- p_output[(cSample << p_stereo_stride)] += tempL0 << 8;
- p_output[(cSample << p_stereo_stride) + 1] += tempR0 << 8;
- }
-
- // Advance offsets
-
- Offset += aSample;
- if (Offset >= reverb_buffer_size) {
- Offset -= reverb_buffer_size;
- }
-
- p_input += aSample << p_stereo_stride;
- p_output += aSample << p_stereo_stride;
-
- p_frames -= aSample;
- }
-
- state.lwl = lwl;
- state.lwr = lwr;
- state.rwl = rwl;
- state.rwr = rwr;
- state.Offset = Offset;
-
- return (max & 0x7FFFFF00) != 0; // audio was mixed?
-}
-
-void ReverbSW::adjust_current_params() {
-
- *current_params = *reverb_param_modes[mode];
-
- uint32_t maxofs = 0;
-
-#define LM_CONFIG_PARAM(x) \
- current_params->x = (int)(((int64_t)current_params->x * (int64_t)mix_rate * 8L) / (int64_t)44100); \
- if (current_params->x > maxofs) \
- maxofs = current_params->x;
-
- LM_CONFIG_PARAM(nLwlOld);
- LM_CONFIG_PARAM(nRwrOld);
- LM_CONFIG_PARAM(nLwlNew);
- LM_CONFIG_PARAM(nRwrNew);
- LM_CONFIG_PARAM(nLwrOld);
- LM_CONFIG_PARAM(nRwlOld);
- LM_CONFIG_PARAM(nLwrNew);
- LM_CONFIG_PARAM(nRwlNew);
- LM_CONFIG_PARAM(nEcho0L);
- LM_CONFIG_PARAM(nEcho1L);
- LM_CONFIG_PARAM(nEcho2L);
- LM_CONFIG_PARAM(nEcho3L);
- LM_CONFIG_PARAM(nEcho0R);
- LM_CONFIG_PARAM(nEcho1R);
- LM_CONFIG_PARAM(nEcho2R);
- LM_CONFIG_PARAM(nEcho3R);
- LM_CONFIG_PARAM(nRevaOldL);
- LM_CONFIG_PARAM(nRevaOldR);
- LM_CONFIG_PARAM(nRevbOldL);
- LM_CONFIG_PARAM(nRevbOldR);
- LM_CONFIG_PARAM(nRevaNewL);
- LM_CONFIG_PARAM(nRevaNewR);
- LM_CONFIG_PARAM(nRevbNewL);
- LM_CONFIG_PARAM(nRevbNewR);
-
- int needed_buffer_size = maxofs + 1;
- if (reverb_buffer)
- memdelete_arr(reverb_buffer);
-
- reverb_buffer = memnew_arr(int, needed_buffer_size);
- reverb_buffer_size = needed_buffer_size;
-
- for (uint32_t i = 0; i < reverb_buffer_size; i++)
- reverb_buffer[i] = 0;
-
- state.reset();
-}
-
-void ReverbSW::set_mode(ReverbMode p_mode) {
-
- if (mode == p_mode)
- return;
-
- mode = p_mode;
-
- adjust_current_params();
-}
-
-void ReverbSW::set_mix_rate(int p_mix_rate) {
-
- if (p_mix_rate == mix_rate)
- return;
-
- mix_rate = p_mix_rate;
-
- adjust_current_params();
-}
-
-ReverbSW::ReverbSW() {
-
- reverb_buffer = 0;
- reverb_buffer_size = 0;
- mode = REVERB_MODE_ROOM;
- mix_rate = 1;
- current_params = memnew(ReverbParamsSW);
-}
-
-ReverbSW::~ReverbSW() {
-
- if (reverb_buffer)
- memdelete_arr(reverb_buffer);
-
- memdelete(current_params);
-}
diff --git a/servers/audio/reverb_sw.h b/servers/audio/reverb_sw.h
deleted file mode 100644
index 13c63e602a..0000000000
--- a/servers/audio/reverb_sw.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************************************/
-/* reverb_sw.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef REVERB_SW_H
-#define REVERB_SW_H
-
-#include "core/os/memory.h"
-#include "core/typedefs.h"
-
-struct ReverbParamsSW;
-
-class ReverbSW {
-public:
- enum ReverbMode {
- REVERB_MODE_ROOM,
- REVERB_MODE_STUDIO_SMALL,
- REVERB_MODE_STUDIO_MEDIUM,
- REVERB_MODE_STUDIO_LARGE,
- REVERB_MODE_HALL,
- REVERB_MODE_SPACE_ECHO,
- REVERB_MODE_ECHO,
- REVERB_MODE_DELAY,
- REVERB_MODE_HALF_ECHO
- };
-
-private:
- struct State {
- int lwl;
- int lwr;
- int rwl;
- int rwr;
- unsigned int Offset;
- void reset() {
- lwl = 0;
- lwr = 0;
- rwl = 0;
- rwr = 0;
- Offset = 0;
- }
- State() { reset(); }
- } state;
-
- ReverbParamsSW *current_params;
-
- int *reverb_buffer;
- unsigned int reverb_buffer_size;
- ReverbMode mode;
- int mix_rate;
-
- void adjust_current_params();
-
-public:
- void set_mode(ReverbMode p_mode);
- bool process(int *p_input, int *p_output, int p_frames, int p_stereo_stride = 1); // return tru if audio was created
- void set_mix_rate(int p_mix_rate);
-
- ReverbSW();
- ~ReverbSW();
-};
-
-#endif
diff --git a/servers/audio/voice_rb_sw.h b/servers/audio/voice_rb_sw.h
deleted file mode 100644
index c51076035c..0000000000
--- a/servers/audio/voice_rb_sw.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*************************************************************************/
-/* voice_rb_sw.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef VOICE_RB_SW_H
-#define VOICE_RB_SW_H
-
-#include "core/os/os.h"
-#include "servers/audio_server.h"
-class VoiceRBSW {
-public:
- enum {
- VOICE_RB_SIZE = 1024
- };
-
- struct Command {
-
- enum Type {
- CMD_NONE,
- CMD_PLAY,
- CMD_STOP,
- CMD_SET_VOLUME,
- CMD_SET_PAN,
- CMD_SET_FILTER,
- CMD_SET_CHORUS,
- CMD_SET_REVERB,
- CMD_SET_MIX_RATE,
- CMD_SET_POSITIONAL,
- CMD_CHANGE_ALL_FX_VOLUMES
- };
-
- Type type;
- RID voice;
-
- struct {
-
- RID sample;
-
- } play;
-
- union {
-
- struct {
-
- float volume;
- } volume;
-
- struct {
-
- float pan, depth, height;
- } pan;
-
- struct {
-
- AS::FilterType type;
- float cutoff;
- float resonance;
- float gain;
- } filter;
-
- struct {
- float send;
- } chorus;
- struct {
- float send;
- AS::ReverbRoomType room;
- } reverb;
-
- struct {
-
- int mix_rate;
- } mix_rate;
-
- struct {
-
- bool positional;
- } positional;
- };
-
- Command() { type = CMD_NONE; }
- };
-
-private:
- Command voice_cmd_rb[VOICE_RB_SIZE];
- volatile int read_pos;
- volatile int write_pos;
-
-public:
- _FORCE_INLINE_ bool commands_left() const { return read_pos != write_pos; }
- _FORCE_INLINE_ Command pop_command() {
- ERR_FAIL_COND_V(read_pos == write_pos, Command());
- Command cmd = voice_cmd_rb[read_pos];
- read_pos = (read_pos + 1) % VOICE_RB_SIZE;
- return cmd;
- }
- _FORCE_INLINE_ void push_command(const Command &p_command) {
-
- bool full = ((write_pos + 1) % VOICE_RB_SIZE) == read_pos;
- if (full) {
-#ifdef DEBUG_ENABLED
- if (OS::get_singleton()->is_stdout_verbose()) {
- ERR_FAIL_COND_MSG(((write_pos + 1) % VOICE_RB_SIZE) == read_pos, "Audio ring buffer full (too many commands).");
- }
-#endif
- return;
- }
-
- voice_cmd_rb[write_pos] = p_command;
- write_pos = (write_pos + 1) % VOICE_RB_SIZE;
- }
-
- VoiceRBSW() { read_pos = write_pos = 0; }
-};
-
-#endif // VOICE_RB_SW_H
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
index 41682d3135..395b73ca9b 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -410,16 +410,18 @@ RID RasterizerSceneRD::_get_sky_textures(Sky *p_sky, SkyTextureSetVersion p_vers
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 1; // half res
- if (p_sky->half_res_pass.is_valid() && (p_version != SKY_TEXTURE_SET_HALF_RES) && (p_version < SKY_TEXTURE_SET_CUBEMAP_HALF_RES0 || p_version > SKY_TEXTURE_SET_CUBEMAP_HALF_RES5)) {
- if (p_version >= SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES0) {
- u.ids.push_back(p_sky->reflection.layers[0].mipmaps[1].views[p_version - SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES0]);
- } else if (p_version >= SKY_TEXTURE_SET_CUBEMAP0) {
- u.ids.push_back(p_sky->reflection.layers[0].mipmaps[1].views[p_version - SKY_TEXTURE_SET_CUBEMAP0]);
+ if (p_sky->half_res_pass.is_valid() && p_version != SKY_TEXTURE_SET_HALF_RES && p_version != SKY_TEXTURE_SET_CUBEMAP_HALF_RES) {
+ if (p_version >= SKY_TEXTURE_SET_CUBEMAP) {
+ u.ids.push_back(p_sky->reflection.layers[0].views[1]);
} else {
u.ids.push_back(p_sky->half_res_pass);
}
} else {
- u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
+ if (p_version < SKY_TEXTURE_SET_CUBEMAP) {
+ u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
+ } else {
+ u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_CUBEMAP_BLACK));
+ }
}
uniforms.push_back(u);
}
@@ -427,16 +429,18 @@ RID RasterizerSceneRD::_get_sky_textures(Sky *p_sky, SkyTextureSetVersion p_vers
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 2; // quarter res
- if (p_sky->quarter_res_pass.is_valid() && (p_version != SKY_TEXTURE_SET_QUARTER_RES) && (p_version < SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES0 || p_version > SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES5)) {
- if (p_version >= SKY_TEXTURE_SET_CUBEMAP_HALF_RES0) {
- u.ids.push_back(p_sky->reflection.layers[0].mipmaps[2].views[p_version - SKY_TEXTURE_SET_CUBEMAP_HALF_RES0]);
- } else if (p_version >= SKY_TEXTURE_SET_CUBEMAP0) {
- u.ids.push_back(p_sky->reflection.layers[0].mipmaps[2].views[p_version - SKY_TEXTURE_SET_CUBEMAP0]);
+ if (p_sky->quarter_res_pass.is_valid() && p_version != SKY_TEXTURE_SET_QUARTER_RES && p_version != SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES) {
+ if (p_version >= SKY_TEXTURE_SET_CUBEMAP) {
+ u.ids.push_back(p_sky->reflection.layers[0].views[2]);
} else {
u.ids.push_back(p_sky->quarter_res_pass);
}
} else {
- u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
+ if (p_version < SKY_TEXTURE_SET_CUBEMAP) {
+ u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
+ } else {
+ u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_CUBEMAP_BLACK));
+ }
}
uniforms.push_back(u);
}
@@ -733,7 +737,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
cm = correction * cm;
if (shader_data->uses_quarter_res) {
- RenderPipelineVertexFormatCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_QUARTER_RES];
+ RenderPipelineVertexFormatCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_CUBEMAP_QUARTER_RES];
Vector<Color> clear_colors;
clear_colors.push_back(Color(0.0, 0.0, 0.0));
@@ -742,7 +746,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
for (int i = 0; i < 6; i++) {
Transform local_view;
local_view.set_look_at(Vector3(0, 0, 0), view_normals[i], view_up[i]);
- RID texture_uniform_set = _get_sky_textures(sky, SkyTextureSetVersion(SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES0 + i));
+ RID texture_uniform_set = _get_sky_textures(sky, SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES);
cubemap_draw_list = RD::get_singleton()->draw_list_begin(sky->reflection.layers[0].mipmaps[2].framebuffers[i], RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_DISCARD);
storage->get_effects()->render_sky(cubemap_draw_list, time, sky->reflection.layers[0].mipmaps[2].framebuffers[i], sky_scene_state.sampler_uniform_set, sky_scene_state.light_uniform_set, pipeline, material->uniform_set, texture_uniform_set, cm, local_view.basis, multiplier, p_transform.origin);
@@ -751,7 +755,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
}
if (shader_data->uses_half_res) {
- RenderPipelineVertexFormatCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_HALF_RES];
+ RenderPipelineVertexFormatCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_CUBEMAP_HALF_RES];
Vector<Color> clear_colors;
clear_colors.push_back(Color(0.0, 0.0, 0.0));
@@ -760,7 +764,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
for (int i = 0; i < 6; i++) {
Transform local_view;
local_view.set_look_at(Vector3(0, 0, 0), view_normals[i], view_up[i]);
- RID texture_uniform_set = _get_sky_textures(sky, SkyTextureSetVersion(SKY_TEXTURE_SET_CUBEMAP_HALF_RES0 + i));
+ RID texture_uniform_set = _get_sky_textures(sky, SKY_TEXTURE_SET_CUBEMAP_HALF_RES);
cubemap_draw_list = RD::get_singleton()->draw_list_begin(sky->reflection.layers[0].mipmaps[1].framebuffers[i], RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_DISCARD);
storage->get_effects()->render_sky(cubemap_draw_list, time, sky->reflection.layers[0].mipmaps[1].framebuffers[i], sky_scene_state.sampler_uniform_set, sky_scene_state.light_uniform_set, pipeline, material->uniform_set, texture_uniform_set, cm, local_view.basis, multiplier, p_transform.origin);
@@ -774,7 +778,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
for (int i = 0; i < 6; i++) {
Transform local_view;
local_view.set_look_at(Vector3(0, 0, 0), view_normals[i], view_up[i]);
- RID texture_uniform_set = _get_sky_textures(sky, SkyTextureSetVersion(SKY_TEXTURE_SET_CUBEMAP0 + i));
+ RID texture_uniform_set = _get_sky_textures(sky, SKY_TEXTURE_SET_CUBEMAP);
cubemap_draw_list = RD::get_singleton()->draw_list_begin(sky->reflection.layers[0].mipmaps[0].framebuffers[i], RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_DISCARD);
storage->get_effects()->render_sky(cubemap_draw_list, time, sky->reflection.layers[0].mipmaps[0].framebuffers[i], sky_scene_state.sampler_uniform_set, sky_scene_state.light_uniform_set, pipeline, material->uniform_set, texture_uniform_set, cm, local_view.basis, multiplier, p_transform.origin);
@@ -829,9 +833,6 @@ void RasterizerSceneRD::SkyShaderData::set_code(const String &p_code) {
actions.render_mode_flags["use_half_res_pass"] = &uses_half_res;
actions.render_mode_flags["use_quarter_res_pass"] = &uses_quarter_res;
- // TODO: Consider using usage flags instead
- //actions.usage_flag_pointers["HALF_RES_TEXTURE"] = &uses_half_res;
- //actions.usage_flag_pointers["QUARTER_RES_TEXTURE"] = &uses_quarter_res;
actions.usage_flag_pointers["TIME"] = &uses_time;
actions.usage_flag_pointers["POSITION"] = &uses_position;
@@ -3905,10 +3906,12 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
// Initialize sky
Vector<String> sky_modes;
- sky_modes.push_back("\n#define AT_CUBEMAP_PASS false\n#define AT_HALF_RES_PASS false\n#define AT_QUARTER_RES_PASS false\n"); // Full size
- sky_modes.push_back("\n#define AT_CUBEMAP_PASS false\n#define AT_HALF_RES_PASS true\n#define AT_QUARTER_RES_PASS false\n"); // Half Res
- sky_modes.push_back("\n#define AT_CUBEMAP_PASS false\n#define AT_HALF_RES_PASS false\n#define AT_QUARTER_RES_PASS true\n"); // Quarter res
- sky_modes.push_back("\n#define AT_CUBEMAP_PASS true\n#define AT_HALF_RES_PASS false\n#define AT_QUARTER_RES_PASS false\n"); // Cubemap
+ sky_modes.push_back(""); // Full size
+ sky_modes.push_back("\n#define USE_HALF_RES_PASS\n"); // Half Res
+ sky_modes.push_back("\n#define USE_QUARTER_RES_PASS\n"); // Quarter res
+ sky_modes.push_back("\n#define USE_CUBEMAP_PASS\n"); // Cubemap
+ sky_modes.push_back("\n#define USE_CUBEMAP_PASS\n#define USE_HALF_RES_PASS\n"); // Half Res Cubemap
+ sky_modes.push_back("\n#define USE_CUBEMAP_PASS\n#define USE_QUARTER_RES_PASS\n"); // Quarter res Cubemap
sky_shader.shader.initialize(sky_modes, defines);
}
@@ -3926,8 +3929,8 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
actions.renames["SKY_COORDS"] = "panorama_coords";
actions.renames["SCREEN_UV"] = "uv";
actions.renames["TIME"] = "params.time";
- actions.renames["HALF_RES_TEXTURE"] = "half_res";
- actions.renames["QUARTER_RES_TEXTURE"] = "quarter_res";
+ actions.renames["HALF_RES_COLOR"] = "half_res_color";
+ actions.renames["QUARTER_RES_COLOR"] = "quarter_res_color";
actions.renames["RADIANCE"] = "radiance";
actions.renames["LIGHT0_ENABLED"] = "directional_lights.data[0].enabled";
actions.renames["LIGHT0_DIRECTION"] = "directional_lights.data[0].direction";
@@ -3949,8 +3952,8 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
actions.renames["AT_HALF_RES_PASS"] = "AT_HALF_RES_PASS";
actions.renames["AT_QUARTER_RES_PASS"] = "AT_QUARTER_RES_PASS";
actions.custom_samplers["RADIANCE"] = "material_samplers[3]";
- actions.custom_samplers["SUBPASS2"] = "material_samplers[1]";
- actions.custom_samplers["SUBPASS4"] = "material_samplers[1]";
+ actions.usage_defines["HALF_RES_COLOR"] = "\n#define USES_HALF_RES_COLOR\n";
+ actions.usage_defines["QUARTER_RES_COLOR"] = "\n#define USES_QUARTER_RES_COLOR\n";
actions.sampler_array_name = "material_samplers";
actions.base_texture_binding_index = 1;
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.h b/servers/visual/rasterizer_rd/rasterizer_scene_rd.h
index e779854327..7332f93dc5 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.h
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_rd.h
@@ -149,6 +149,8 @@ private:
SKY_VERSION_HALF_RES,
SKY_VERSION_QUARTER_RES,
SKY_VERSION_CUBEMAP,
+ SKY_VERSION_CUBEMAP_HALF_RES,
+ SKY_VERSION_CUBEMAP_QUARTER_RES,
SKY_VERSION_MAX
};
@@ -222,24 +224,9 @@ private:
SKY_TEXTURE_SET_BACKGROUND,
SKY_TEXTURE_SET_HALF_RES,
SKY_TEXTURE_SET_QUARTER_RES,
- SKY_TEXTURE_SET_CUBEMAP0,
- SKY_TEXTURE_SET_CUBEMAP1,
- SKY_TEXTURE_SET_CUBEMAP2,
- SKY_TEXTURE_SET_CUBEMAP3,
- SKY_TEXTURE_SET_CUBEMAP4,
- SKY_TEXTURE_SET_CUBEMAP5,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES0,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES1,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES2,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES3,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES4,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES5,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES0,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES1,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES2,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES3,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES4,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES5,
+ SKY_TEXTURE_SET_CUBEMAP,
+ SKY_TEXTURE_SET_CUBEMAP_HALF_RES,
+ SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES,
SKY_TEXTURE_SET_MAX
};
diff --git a/servers/visual/rasterizer_rd/shader_rd.cpp b/servers/visual/rasterizer_rd/shader_rd.cpp
index 857a29f7f4..74edaee983 100644
--- a/servers/visual/rasterizer_rd/shader_rd.cpp
+++ b/servers/visual/rasterizer_rd/shader_rd.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "shader_rd.h"
+
#include "core/string_builder.h"
#include "rasterizer_rd.h"
#include "servers/visual/rendering_device.h"
diff --git a/servers/visual/rasterizer_rd/shaders/sky.glsl b/servers/visual/rasterizer_rd/shaders/sky.glsl
index b73f9345e7..3f433eb2ee 100644
--- a/servers/visual/rasterizer_rd/shaders/sky.glsl
+++ b/servers/visual/rasterizer_rd/shaders/sky.glsl
@@ -43,6 +43,19 @@ layout(push_constant, binding = 1, std430) uniform Params {
}
params;
+#define SAMPLER_NEAREST_CLAMP 0
+#define SAMPLER_LINEAR_CLAMP 1
+#define SAMPLER_NEAREST_WITH_MIPMAPS_CLAMP 2
+#define SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP 3
+#define SAMPLER_NEAREST_WITH_MIPMAPS_ANISOTROPIC_CLAMP 4
+#define SAMPLER_LINEAR_WITH_MIPMAPS_ANISOTROPIC_CLAMP 5
+#define SAMPLER_NEAREST_REPEAT 6
+#define SAMPLER_LINEAR_REPEAT 7
+#define SAMPLER_NEAREST_WITH_MIPMAPS_REPEAT 8
+#define SAMPLER_LINEAR_WITH_MIPMAPS_REPEAT 9
+#define SAMPLER_NEAREST_WITH_MIPMAPS_ANISOTROPIC_REPEAT 10
+#define SAMPLER_LINEAR_WITH_MIPMAPS_ANISOTROPIC_REPEAT 11
+
layout(set = 0, binding = 0) uniform sampler material_samplers[12];
#ifdef USE_MATERIAL_UNIFORMS
@@ -56,8 +69,31 @@ MATERIAL_UNIFORMS
#endif
layout(set = 2, binding = 0) uniform textureCube radiance;
+#ifdef USE_CUBEMAP_PASS
+layout(set = 2, binding = 1) uniform textureCube half_res;
+layout(set = 2, binding = 2) uniform textureCube quarter_res;
+#else
layout(set = 2, binding = 1) uniform texture2D half_res;
layout(set = 2, binding = 2) uniform texture2D quarter_res;
+#endif
+
+#ifdef USE_CUBEMAP_PASS
+#define AT_CUBEMAP_PASS true
+#else
+#define AT_CUBEMAP_PASS false
+#endif
+
+#ifdef USE_HALF_RES_PASS
+#define AT_HALF_RES_PASS true
+#else
+#define AT_HALF_RES_PASS false
+#endif
+
+#ifdef USE_QUARTER_RES_PASS
+#define AT_QUARTER_RES_PASS true
+#else
+#define AT_QUARTER_RES_PASS false
+#endif
struct DirectionalLightData {
vec3 direction;
@@ -101,6 +137,26 @@ void main() {
vec3 color = vec3(0.0, 0.0, 0.0);
float alpha = 1.0; // Only available to subpasses
+ vec4 half_res_color = vec4(1.0);
+ vec4 quarter_res_color = vec4(1.0);
+
+#ifdef USE_CUBEMAP_PASS
+ float using_cubemap = 1.0;
+#ifdef USES_HALF_RES_COLOR
+ half_res_color = texture(samplerCube(half_res, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), cube_normal);
+#endif
+#ifdef USES_QUARTER_RES_COLOR
+ quarter_res_color = texture(samplerCube(quarter_res, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), cube_normal);
+#endif
+#else
+ float using_cubemap = 0.0;
+#ifdef USES_HALF_RES_COLOR
+ half_res_color = textureLod(sampler2D(half_res, material_samplers[SAMPLER_LINEAR_CLAMP]), uv, 0.0);
+#endif
+#ifdef USES_QUARTER_RES_COLOR
+ quarter_res_color = textureLod(sampler2D(quarter_res, material_samplers[SAMPLER_LINEAR_CLAMP]), uv, 0.0);
+#endif
+#endif
// unused, just here to make our compiler happy, make sure we don't execute any light code the user adds in..
#ifndef REALLYINCLUDETHIS
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index 7307f7527a..041ad799d0 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -288,34 +288,35 @@ ShaderTypes::ShaderTypes() {
/************ SKY **************************/
shader_modes[VS::SHADER_SKY].functions["global"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["RADIANCE"] = constt(ShaderLanguage::TYPE_SAMPLERCUBE);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["AT_HALF_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["AT_QUARTER_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["AT_CUBEMAP_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+
shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["EYEDIR"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["SKY_COORDS"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["HALF_RES_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["QUARTER_RES_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["RADIANCE"] = constt(ShaderLanguage::TYPE_SAMPLERCUBE);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["AT_HALF_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["AT_QUARTER_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["AT_CUBEMAP_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT0_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT0_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT0_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT0_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT1_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT1_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT1_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT1_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT2_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT2_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT2_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT2_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT3_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT3_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT3_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT3_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["HALF_RES_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["QUARTER_RES_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
shader_modes[VS::SHADER_SKY].modes.push_back("use_half_res_pass");
shader_modes[VS::SHADER_SKY].modes.push_back("use_quarter_res_pass");
diff --git a/servers/visual/visual_server_light_baker.cpp b/servers/visual/visual_server_light_baker.cpp
deleted file mode 100644
index 4f9ade5017..0000000000
--- a/servers/visual/visual_server_light_baker.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*************************************************************************/
-/* visual_server_light_baker.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "visual_server_light_baker.h"
-
-VisualServerLightBaker::VisualServerLightBaker() {
-}
diff --git a/servers/visual/visual_server_light_baker.h b/servers/visual/visual_server_light_baker.h
deleted file mode 100644
index d88090c473..0000000000
--- a/servers/visual/visual_server_light_baker.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*************************************************************************/
-/* visual_server_light_baker.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef VISUALSERVERLIGHTBAKER_H
-#define VISUALSERVERLIGHTBAKER_H
-
-#include "servers/visual_server.h"
-
-class VisualServerLightBaker {
-public:
- struct BakeCell {
-
- uint32_t cells[8];
- uint32_t neighbours[7]; //one unused
- uint32_t albedo; //albedo in RGBE
- uint32_t emission; //emissive light in RGBE
- uint32_t light[4]; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast)
- float alpha; //used for upsampling
- uint32_t directional_pass; //used for baking directional
- };
-
- VisualServerLightBaker();
-};
-
-#endif // VISUALSERVERLIGHTBAKER_H