diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp deleted file mode 100644 index 5f7fa53ee77..00000000000 --- a/editor/doc/doc_dump.cpp +++ /dev/null @@ -1,303 +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("&", "&"); - ret = ret.replace("<", ">"); - ret = ret.replace(">", "<"); - ret = ret.replace("'", "'"); - ret = ret.replace("\"", """); - 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 class_list; - ClassDB::get_class_list(&class_list); - - class_list.sort_custom(); - - FileAccess *f = FileAccess::open(p_file, FileAccess::WRITE); - - _write_string(f, 0, ""); - _write_string(f, 0, String(""); - - while (class_list.size()) { - - String name = class_list.front()->get(); - - String header = ""); - _write_string(f, 1, ""); - - _write_string(f, 1, ""); - _write_string(f, 1, ""); - - _write_string(f, 1, ""); - - List method_list; - ClassDB::get_method_list(name, &method_list, true); - method_list.sort(); - - for (List::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, "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, ""); - } 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::REAL: - //keep it - break; - case Variant::STRING: - 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::POOL_BYTE_ARRAY: - case Variant::POOL_INT_ARRAY: - case Variant::POOL_REAL_ARRAY: - case Variant::POOL_STRING_ARRAY: - case Variant::POOL_VECTOR3_ARRAY: - case Variant::POOL_COLOR_ARRAY: - default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")"; - break; - case Variant::OBJECT: - case Variant::DICTIONARY: // 20 - case Variant::ARRAY: - case Variant::_RID: - - default: { - } - } - - _write_string(f, 3, ""); - } else - _write_string(f, 3, ""); - } - - 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) ? "" : ""); - } - - _write_string(f, 3, ""); - _write_string(f, 3, ""); - - _write_string(f, 2, ""); - } - - _write_string(f, 1, ""); - - List signal_list; - ClassDB::get_signal_list(name, &signal_list, true); - - if (signal_list.size()) { - - _write_string(f, 1, ""); - for (List::Element *EV = signal_list.front(); EV; EV = EV->next()) { - - _write_string(f, 2, "get().name + "\">"); - for (int i = 0; i < EV->get().arguments.size(); i++) { - PropertyInfo arginfo = EV->get().arguments[i]; - _write_string(f, 3, ""); - _write_string(f, 3, ""); - } - _write_string(f, 3, ""); - _write_string(f, 3, ""); - - _write_string(f, 2, ""); - } - - _write_string(f, 1, ""); - } - - _write_string(f, 1, ""); - - List constant_list; - ClassDB::get_integer_constant_list(name, &constant_list, true); - - /* constants are sorted in a special way */ - - List<_ConstantSort> constant_sort; - - for (List::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, "get().name + "\" value=\"" + itos(E->get().value) + "\">"); - _write_string(f, 2, ""); - } - - _write_string(f, 1, ""); - _write_string(f, 0, ""); - - class_list.erase(name); - } - - _write_string(f, 0, ""); - f->close(); - memdelete(f); -} diff --git a/editor/doc/doc_dump.h b/editor/doc/doc_dump.h deleted file mode 100644 index f8f1b6f805d..00000000000 --- 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/file_type_cache.cpp b/editor/file_type_cache.cpp deleted file mode 100644 index 52ab80cc480..00000000000 --- 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 216effea007..00000000000 --- 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 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/main/tests/test_main.cpp b/main/tests/test_main.cpp index 2c2e6e8b452..beb955d045e 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 56db3ea2a57..bdb1668d21a 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 &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 edb57f2a9f0..ac53f124d2f 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 60cde961c5b..eb2b3d1e99a 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 4a74ad5898e..db1caa85ab8 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 03e559107e4..f251da0ba2c 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/platform/iphone/platform_refcount.h b/platform/iphone/platform_refcount.h deleted file mode 100644 index 9029418462e..00000000000 --- 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 - -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 a0e5f835c0c..d79fd001188 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/scene/2d/path_texture.cpp b/scene/2d/path_texture.cpp deleted file mode 100644 index df59c9e2bb2..00000000000 --- 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 &p_texture) { - - begin = p_texture; - update(); -} - -Ref PathTexture::get_begin_texture() const { - - return begin; -} - -void PathTexture::set_repeat_texture(const Ref &p_texture) { - - repeat = p_texture; - update(); -} -Ref PathTexture::get_repeat_texture() const { - - return repeat; -} - -void PathTexture::set_end_texture(const Ref &p_texture) { - - end = p_texture; - update(); -} -Ref 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 9cfa004cfbc..00000000000 --- 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 begin; - Ref repeat; - Ref end; - int subdivs; - bool overlap; - -public: - void set_begin_texture(const Ref &p_texture); - Ref get_begin_texture() const; - - void set_repeat_texture(const Ref &p_texture); - Ref get_repeat_texture() const; - - void set_end_texture(const Ref &p_texture); - Ref 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/resources/canvas.cpp b/scene/resources/canvas.cpp deleted file mode 100644 index 1dbd02ea287..00000000000 --- 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 621911fe0a5..00000000000 --- 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/servers/audio/reverb_sw.cpp b/servers/audio/reverb_sw.cpp deleted file mode 100644 index 3bf0b0ea96c..00000000000 --- 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 - -#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 13c63e602a4..00000000000 --- 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 c51076035c2..00000000000 --- 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/visual_server_light_baker.cpp b/servers/visual/visual_server_light_baker.cpp deleted file mode 100644 index 4f9ade50170..00000000000 --- 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 d88090c473e..00000000000 --- 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