diff options
180 files changed, 2642 insertions, 1153 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 0b4abac1af..1050f259a0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -5,9 +5,10 @@ body: - type: markdown attributes: value: | - - Read our [CONTRIBUTING.md guide](https://github.com/godotengine/godot/blob/master/CONTRIBUTING.md#reporting-bugs) on reporting bugs. + - When reporting bugs, you'll make our life simpler (and the fix will come sooner) if you follow the guidelines in this template. - Write a descriptive issue title above. - - Search [open](https://github.com/godotengine/godot/issues) and [closed](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported. + - The golden rule is to **always open *one* issue for *one* bug**. If you notice several bugs and want to report them, make sure to create one new issue for each of them. + - Search [open](https://github.com/godotengine/godot/issues) and [closed](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported. If you don't find a relevant match or if you're unsure, don't hesitate to **open a new issue**. The bugsquad will handle it from there if it's a duplicate. - Verify that you are using a [supported Godot version](https://docs.godotengine.org/en/stable/about/release_policy.html). - type: input @@ -24,9 +25,11 @@ body: attributes: label: System information description: | - Specify the OS version, and when relevant hardware information. - For graphics-related issues, specify the GPU model, driver version, and the rendering backend (GLES2, GLES3, Vulkan). - placeholder: Windows 10, GLES3, Intel HD Graphics 620 (27.20.100.9616) + - Specify the OS version, and when relevant hardware information. + - For issues that are likely OS-specific and/or graphics-related, please specify the CPU model and architecture. + - For graphics-related issues, specify the GPU model, driver version, and the rendering backend (GLES2, GLES3, Vulkan). + - **Bug reports not including the required information may be closed at the maintainers' discretion.** If in doubt, always include all the requested information; it's better to include too much information than not enough information. + placeholder: Windows 10, Intel Core i5-7200U, GLES3, Intel HD Graphics 620 (27.20.100.9616) validations: required: true @@ -52,8 +55,10 @@ body: attributes: label: Minimal reproduction project description: | - A small Godot project which reproduces the issue, with no unnecessary files included. Be sure to not include the `.godot` folder in the archive (but keep `project.godot`). - Required, unless the reproduction steps are trivial and don't require any project files to be followed. In this case, write "N/A" in the field. - Drag and drop a ZIP archive to upload it. **Do not select another field until the project is done uploading.** + - A small Godot project which reproduces the issue, with no unnecessary files included. Be sure to not include the `.godot` folder in the archive (but keep `project.godot`). + - Required, unless the reproduction steps are trivial and don't require any project files to be followed. In this case, write "N/A" in the field. + - Drag and drop a ZIP archive to upload it. **Do not select another field until the project is done uploading.** + - **Note for C# users:** If your issue is *not* Mono-specific, please upload a minimal reproduction project written in GDScript or VisualScript. This will make it easier for contributors to reproduce the issue locally as not everyone has a Mono setup available. + - **If you've been asked by a maintainer to upload a minimal reproduction project, you *must* do so within 7 days.** Otherwise, your bug report will be closed as it'll be considered too difficult to diagnose. validations: required: true diff --git a/.gitignore b/.gitignore index 17c9a6c95a..060f5696b8 100644 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,10 @@ tests/data/*.translation # Binutils tmp linker output of the form "stXXXXXX" where "X" is alphanumeric st[A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9] +# Python development +.venv +venv + # Python generated __pycache__/ *.pyc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aea1c8c5ff..30934dcf9b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,87 +8,10 @@ - [Contributing to Godot's translation](#contributing-to-godots-translation) - [Communicating with developers](#communicating-with-developers) -**Please read the first section before reporting a bug!** - ## Reporting bugs -The golden rule is to **always open *one* issue for *one* bug**. If you notice -several bugs and want to report them, make sure to create one new issue for -each of them. - -If you're reporting a new bug, you'll make our life simpler (and the -fix will come sooner) by following these guidelines: - -### Search first in the existing database - -Issues are often reported several times by various users. It's good practice to -**search first in the [issue tracker](https://github.com/godotengine/godot/issues) -before reporting your issue**. If you don't find a relevant match or if you're -unsure, don't hesitate to **open a new issue**. The bugsquad will handle it -from there if it's a duplicate. - -### Specify the platform - -Godot runs on a large variety of platforms and operating systems and devices. -**In your bug reports, please always specify:** - -- Operating system and version (e.g. Windows 10, macOS 10.15, Ubuntu 19.10) -- Godot version (e.g. 3.2, 3.1.2, or the Git commit hash if you're using a development branch) - -For bugs that are likely OS-specific and/or graphics-related, please also specify: - -- Device (CPU model including architecture, e.g. x86_64, arm64, etc.) -- GPU model (and the driver version in use if you know it) - -**Bug reports not including the required information may be closed at the -maintainers' discretion.** If in doubt, always include all the requested -information; it's better to include too much information than not enough -information. - -### Specify steps to reproduce - -Many bugs can't be reproduced unless specific steps are taken. Please **specify -the exact steps** that must be taken to reproduce the condition, and try to -keep them as minimal as possible. If you're describing a procedure to follow -in the editor, don't hesitate to include screenshots. - -Making your bug report easy to reproduce will make it easier for contributors -to fix the bug. - -### Provide a simple example project - -Sometimes, unexpected behavior can happen in your project. In such case, -understand that: - -- What happens to you may not happen to other users. -- We can't take the time to look at your project, understand how it is set up - and then figure out why it's failing. -- On the contributors' end, recreating a test project from scratch takes valuable - time that can be saved by uploading a *minimal* project. - -To speed up our work, **please upload a minimal project** that isolates -and reproduces the issue. This is always the **best way for us to fix it**. -We recommend attaching a ZIP file with the minimal project directly to the bug report, -by drag and dropping the file in the GitHub edition field. This ensures the file -can remain available for a long period of time. Only use third-party file hosts -if your ZIP file isn't accepted by GitHub because it's too large. - -We recommend always attaching a minimal reproduction project, even if the issue -may seem simple to reproduce manually. - -**Note for C# users:** If your issue is *not* .NET-specific, please upload a -minimal reproduction project written in GDScript. -This will make it easier for contributors to reproduce the issue -locally as not everyone has a .NET setup available. - -**If you've been asked by a maintainer to upload a minimal reproduction project, -you *must* do so within 7 days.** Otherwise, your bug report will be closed as -it'll be considered too difficult to diagnose. - -Now that you've read the guidelines, click the link below to create a -bug report: - -- **[Report a bug](https://github.com/godotengine/godot/issues/new?assignees=&labels=&template=bug_report.yml)** +Report bugs [here](https://github.com/godotengine/godot/issues/new?assignees=&labels=&template=bug_report.yml). +Please follow the instructions in the template when you do. ## Proposing features or improvements diff --git a/core/input/input.cpp b/core/input/input.cpp index e74523e059..5aef9a9039 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -35,6 +35,10 @@ #include "core/input/input_map.h" #include "core/os/os.h" +#ifdef DEV_ENABLED +#include "core/os/thread.h" +#endif + static const char *_joy_buttons[(size_t)JoyButton::SDL_MAX] = { "a", "b", @@ -486,6 +490,10 @@ Vector3 Input::get_gyroscope() const { } void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated) { + // This function does the final delivery of the input event to user land. + // Regardless where the event came from originally, this has to happen on the main thread. + DEV_ASSERT(Thread::get_caller_id() == Thread::get_main_id()); + // Notes on mouse-touch emulation: // - Emulated mouse events are parsed, that is, re-routed to this method, so they make the same effects // as true mouse events. The only difference is the situation is flagged as emulated so they are not @@ -537,7 +545,9 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em touch_event->set_position(mb->get_position()); touch_event->set_double_tap(mb->is_double_click()); touch_event->set_device(InputEvent::DEVICE_ID_EMULATION); + _THREAD_SAFE_UNLOCK_ event_dispatch_function(touch_event); + _THREAD_SAFE_LOCK_ } } @@ -563,7 +573,9 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em drag_event->set_velocity(get_last_mouse_velocity()); drag_event->set_device(InputEvent::DEVICE_ID_EMULATION); + _THREAD_SAFE_UNLOCK_ event_dispatch_function(drag_event); + _THREAD_SAFE_LOCK_ } } @@ -664,7 +676,9 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em if (ge.is_valid()) { if (event_dispatch_function) { + _THREAD_SAFE_UNLOCK_ event_dispatch_function(ge); + _THREAD_SAFE_LOCK_ } } @@ -687,7 +701,9 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em } if (event_dispatch_function) { + _THREAD_SAFE_UNLOCK_ event_dispatch_function(p_event); + _THREAD_SAFE_LOCK_ } } @@ -937,8 +953,15 @@ void Input::flush_buffered_events() { _THREAD_SAFE_METHOD_ while (buffered_events.front()) { - _parse_input_event_impl(buffered_events.front()->get(), false); + // The final delivery of the input event involves releasing the lock. + // While the lock is released, another thread may lock it and add new events to the back. + // Therefore, we get each event and pop it while we still have the lock, + // to ensure the list is in a consistent state. + List<Ref<InputEvent>>::Element *E = buffered_events.front(); + Ref<InputEvent> e = E->get(); buffered_events.pop_front(); + + _parse_input_event_impl(e, false); } } diff --git a/core/io/dir_access.h b/core/io/dir_access.h index 51eb68eaea..52ed688deb 100644 --- a/core/io/dir_access.h +++ b/core/io/dir_access.h @@ -68,7 +68,7 @@ protected: virtual String _get_root_string() const; AccessType get_access_type() const; - String fix_path(String p_path) const; + virtual String fix_path(String p_path) const; template <class T> static Ref<DirAccess> _create_builtin() { diff --git a/core/io/file_access.h b/core/io/file_access.h index 34c80b3dd9..ad1ac665f3 100644 --- a/core/io/file_access.h +++ b/core/io/file_access.h @@ -81,7 +81,7 @@ protected: static void _bind_methods(); AccessType get_access_type() const; - String fix_path(const String &p_path) const; + virtual String fix_path(const String &p_path) const; virtual Error open_internal(const String &p_path, int p_mode_flags) = 0; ///< open a file virtual uint64_t _get_modified_time(const String &p_file) = 0; virtual void _set_access_type(AccessType p_access); diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index da59ae8c59..3e5a1217dd 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -34,13 +34,7 @@ void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_mode, uint32_t p_block_size) { magic = p_magic.ascii().get_data(); - if (magic.length() > 4) { - magic = magic.substr(0, 4); - } else { - while (magic.length() < 4) { - magic += " "; - } - } + magic = (magic + " ").substr(0, 4); cmode = p_mode; block_size = p_block_size; diff --git a/core/io/json.cpp b/core/io/json.cpp index 8d0fe53ed4..a6e054a9fe 100644 --- a/core/io/json.cpp +++ b/core/io/json.cpp @@ -47,13 +47,7 @@ const char *JSON::tk_name[TK_MAX] = { }; String JSON::_make_indent(const String &p_indent, int p_size) { - String indent_text = ""; - if (!p_indent.is_empty()) { - for (int i = 0; i < p_size; i++) { - indent_text += p_indent; - } - } - return indent_text; + return p_indent.repeat(p_size); } String JSON::_stringify(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, HashSet<const void *> &p_markers, bool p_full_precision) { diff --git a/core/math/bvh_debug.inc b/core/math/bvh_debug.inc index 2e519ceb3d..1964f2fa83 100644 --- a/core/math/bvh_debug.inc +++ b/core/math/bvh_debug.inc @@ -30,11 +30,7 @@ String _debug_aabb_to_string(const BVHABB_CLASS &aabb) const { void _debug_recursive_print_tree_node(uint32_t p_node_id, int depth = 0) const { const TNode &tnode = _nodes[p_node_id]; - String sz = ""; - for (int n = 0; n < depth; n++) { - sz += "\t"; - } - sz += itos(p_node_id); + String sz = String("\t").repeat(depth) + itos(p_node_id); if (tnode.is_leaf()) { sz += " L"; diff --git a/core/string/translation.cpp b/core/string/translation.cpp index 160bad14ab..3ca2e5ccdf 100644 --- a/core/string/translation.cpp +++ b/core/string/translation.cpp @@ -941,18 +941,11 @@ String TranslationServer::wrap_with_fakebidi_characters(String &p_message) const } String TranslationServer::add_padding(const String &p_message, int p_length) const { - String res; - String prefix = pseudolocalization_prefix; - String suffix; - for (int i = 0; i < p_length * expansion_ratio / 2; i++) { - prefix += "_"; - suffix += "_"; - } - suffix += pseudolocalization_suffix; - res += prefix; - res += p_message; - res += suffix; - return res; + String underscores = String("_").repeat(p_length * expansion_ratio / 2); + String prefix = pseudolocalization_prefix + underscores; + String suffix = underscores + pseudolocalization_suffix; + + return prefix + p_message + suffix; } const char32_t *TranslationServer::get_accented_version(char32_t p_character) const { diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 49c72a9dcf..92c9e4b70c 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -2857,6 +2857,12 @@ String String::insert(int p_at_pos, const String &p_string) const { return pre + p_string + post; } +String String::erase(int p_pos, int p_chars) const { + ERR_FAIL_COND_V_MSG(p_pos < 0, "", vformat("Invalid starting position for `String.erase()`: %d. Starting position must be positive or zero.", p_pos)); + ERR_FAIL_COND_V_MSG(p_chars < 0, "", vformat("Invalid character count for `String.erase()`: %d. Character count must be positive or zero.", p_chars)); + return left(p_pos) + substr(p_pos + p_chars); +} + String String::substr(int p_from, int p_chars) const { if (p_chars == -1) { p_chars = length() - p_from; @@ -3524,6 +3530,14 @@ String String::replacen(const String &p_key, const String &p_with) const { String String::repeat(int p_count) const { ERR_FAIL_COND_V_MSG(p_count < 0, "", "Parameter count should be a positive number."); + if (p_count == 0) { + return ""; + } + + if (p_count == 1) { + return *this; + } + int len = length(); String new_string = *this; new_string.resize(p_count * len + 1); @@ -4161,13 +4175,11 @@ String String::pad_decimals(int p_digits) const { } if (s.length() - (c + 1) > p_digits) { - s = s.substr(0, c + p_digits + 1); + return s.substr(0, c + p_digits + 1); } else { - while (s.length() - (c + 1) < p_digits) { - s += "0"; - } + int zeros_to_add = p_digits - s.length() + (c + 1); + return s + String("0").repeat(zeros_to_add); } - return s; } String String::pad_zeros(int p_digits) const { @@ -4192,12 +4204,8 @@ String String::pad_zeros(int p_digits) const { return s; } - while (end - begin < p_digits) { - s = s.insert(begin, "0"); - end++; - } - - return s; + int zeros_to_add = p_digits - (end - begin); + return s.insert(begin, String("0").repeat(zeros_to_add)); } String String::trim_prefix(const String &p_prefix) const { @@ -4376,11 +4384,8 @@ String String::path_to(const String &p_path) const { common_parent--; - String dir; - - for (int i = src_dirs.size() - 1; i > common_parent; i--) { - dir += "../"; - } + int dirs_to_backtrack = (src_dirs.size() - 1) - common_parent; + String dir = String("../").repeat(dirs_to_backtrack); for (int i = common_parent + 1; i < dst_dirs.size(); i++) { dir += dst_dirs[i] + "/"; @@ -4669,11 +4674,8 @@ String String::rpad(int min_length, const String &character) const { String s = *this; int padding = min_length - s.length(); if (padding > 0) { - for (int i = 0; i < padding; i++) { - s = s + character; - } + s += character.repeat(padding); } - return s; } @@ -4682,11 +4684,8 @@ String String::lpad(int min_length, const String &character) const { String s = *this; int padding = min_length - s.length(); if (padding > 0) { - for (int i = 0; i < padding; i++) { - s = character + s; - } + s = character.repeat(padding) + s; } - return s; } diff --git a/core/string/ustring.h b/core/string/ustring.h index e1512cfb26..c771dff515 100644 --- a/core/string/ustring.h +++ b/core/string/ustring.h @@ -304,6 +304,7 @@ public: String replacen(const String &p_key, const String &p_with) const; String repeat(int p_count) const; String insert(int p_at_pos, const String &p_string) const; + String erase(int p_pos, int p_chars = 1) const; String pad_decimals(int p_digits) const; String pad_zeros(int p_digits) const; String trim_prefix(const String &p_prefix) const; diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index e83b6dc183..d77222b166 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -1659,6 +1659,7 @@ static void _register_variant_builtin_methods() { bind_string_method(replacen, sarray("what", "forwhat"), varray()); bind_string_method(repeat, sarray("count"), varray()); bind_string_method(insert, sarray("position", "what"), varray()); + bind_string_method(erase, sarray("position", "chars"), varray(1)); bind_string_method(capitalize, sarray(), varray()); bind_string_method(to_camel_case, sarray(), varray()); bind_string_method(to_pascal_case, sarray(), varray()); diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml index c15289bde0..3e94f3d0bd 100644 --- a/doc/classes/Animation.xml +++ b/doc/classes/Animation.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Animation" inherits="Resource" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Contains data used to animate everything in the engine. + Holds data that can be used to animate anything in the engine. </brief_description> <description> - An Animation resource contains data used to animate everything in the engine. Animations are divided into tracks, and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track. + This resource holds data that can be used to animate anything in the engine. Animations are divided into tracks and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track. [codeblocks] [gdscript] # This creates an animation that makes the node "Enemy" move to the right by diff --git a/doc/classes/AnimationNode.xml b/doc/classes/AnimationNode.xml index 80f9fd0803..cb6a4f30f9 100644 --- a/doc/classes/AnimationNode.xml +++ b/doc/classes/AnimationNode.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNode" inherits="Resource" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Base resource for [AnimationTree] nodes. + Base class for [AnimationTree] nodes. Not related to scene nodes. </brief_description> <description> Base resource for [AnimationTree] nodes. In general, it's not used directly, but you can create custom ones with custom blending formulas. Inherit this when creating nodes mainly for use in [AnimationNodeBlendTree], otherwise [AnimationRootNode] should be used instead. </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> <methods> <method name="_get_caption" qualifiers="virtual const"> diff --git a/doc/classes/AnimationNodeAdd2.xml b/doc/classes/AnimationNodeAdd2.xml index 1320e5de2d..68bbe8090b 100644 --- a/doc/classes/AnimationNodeAdd2.xml +++ b/doc/classes/AnimationNodeAdd2.xml @@ -7,6 +7,6 @@ A resource to add to an [AnimationNodeBlendTree]. Blends two animations additively based on an amount value in the [code][0.0, 1.0][/code] range. </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> </class> diff --git a/doc/classes/AnimationNodeAdd3.xml b/doc/classes/AnimationNodeAdd3.xml index b93f1eadd1..1e51a8a4c5 100644 --- a/doc/classes/AnimationNodeAdd3.xml +++ b/doc/classes/AnimationNodeAdd3.xml @@ -11,7 +11,7 @@ - A +add animation to blend with when the blend amount is in the [code][0.0, 1.0][/code] range </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> </class> diff --git a/doc/classes/AnimationNodeAnimation.xml b/doc/classes/AnimationNodeAnimation.xml index 504160516d..ffefa89e35 100644 --- a/doc/classes/AnimationNodeAnimation.xml +++ b/doc/classes/AnimationNodeAnimation.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeAnimation" inherits="AnimationRootNode" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Input animation to use in an [AnimationNodeBlendTree]. + An input animation for an [AnimationNodeBlendTree]. </brief_description> <description> - A resource to add to an [AnimationNodeBlendTree]. Only features one output set using the [member animation] property. Use it as an input for [AnimationNode] that blend animations together. + A resource to add to an [AnimationNodeBlendTree]. Only has one output port using the [member animation] property. Used as an input for [AnimationNode]s that blend animations together. </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> <link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link> <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> diff --git a/doc/classes/AnimationNodeBlend2.xml b/doc/classes/AnimationNodeBlend2.xml index 694beb2780..1460f5f055 100644 --- a/doc/classes/AnimationNodeBlend2.xml +++ b/doc/classes/AnimationNodeBlend2.xml @@ -7,7 +7,7 @@ A resource to add to an [AnimationNodeBlendTree]. Blends two animations linearly based on an amount value in the [code][0.0, 1.0][/code] range. </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> <link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link> <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> diff --git a/doc/classes/AnimationNodeBlend3.xml b/doc/classes/AnimationNodeBlend3.xml index 90363a9718..34c4b8566a 100644 --- a/doc/classes/AnimationNodeBlend3.xml +++ b/doc/classes/AnimationNodeBlend3.xml @@ -11,6 +11,6 @@ - A +blend animation to blend with when the blend amount is in the [code][0.0, 1.0][/code] range </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> </class> diff --git a/doc/classes/AnimationNodeBlendSpace1D.xml b/doc/classes/AnimationNodeBlendSpace1D.xml index 3d5b70a69e..aa15ac03d9 100644 --- a/doc/classes/AnimationNodeBlendSpace1D.xml +++ b/doc/classes/AnimationNodeBlendSpace1D.xml @@ -1,16 +1,15 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeBlendSpace1D" inherits="AnimationRootNode" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Blends linearly between two of any number of [AnimationNode] of any type placed on a virtual axis. + A set of [AnimationRootNode]s placed on a virtual axis, crossfading between the two adjacent ones. Used by [AnimationTree]. </brief_description> <description> - A resource to add to an [AnimationNodeBlendTree]. - This is a virtual axis on which you can add any type of [AnimationNode] using [method add_blend_point]. - Outputs the linear blend of the two [AnimationNode]s closest to the node's current value. - You can set the extents of the axis using the [member min_space] and [member max_space]. + A resource used by [AnimationNodeBlendTree]. + [AnimationNodeBlendSpace1D] represents a virtual axis on which any type of [AnimationRootNode]s can be added using [method add_blend_point]. Outputs the linear blend of the two [AnimationRootNode]s adjacent to the current value. + You can set the extents of the axis with [member min_space] and [member max_space]. </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> <methods> <method name="add_blend_point"> diff --git a/doc/classes/AnimationNodeBlendSpace2D.xml b/doc/classes/AnimationNodeBlendSpace2D.xml index 7e9c2eed47..27dff11e88 100644 --- a/doc/classes/AnimationNodeBlendSpace2D.xml +++ b/doc/classes/AnimationNodeBlendSpace2D.xml @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeBlendSpace2D" inherits="AnimationRootNode" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Blends linearly between three [AnimationNode] of any type placed in a 2D space. + A set of [AnimationRootNode]s placed on 2D coordinates, crossfading between the three adjacent ones. Used by [AnimationTree]. </brief_description> <description> - A resource to add to an [AnimationNodeBlendTree]. - This node allows you to blend linearly between three animations using a [Vector2] weight. - You can add vertices to the blend space with [method add_blend_point] and automatically triangulate it by setting [member auto_triangles] to [code]true[/code]. Otherwise, use [method add_triangle] and [method remove_triangle] to create up the blend space by hand. + A resource used by [AnimationNodeBlendTree]. + [AnimationNodeBlendSpace1D] represents a virtual 2D space on which [AnimationRootNode]s are placed. Outputs the linear blend of the three adjacent animations using a [Vector2] weight. Adjacent in this context means the three [AnimationRootNode]s making up the triangle that contains the current value. + You can add vertices to the blend space with [method add_blend_point] and automatically triangulate it by setting [member auto_triangles] to [code]true[/code]. Otherwise, use [method add_triangle] and [method remove_triangle] to triangulate the blend space by hand. </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> <methods> diff --git a/doc/classes/AnimationNodeBlendTree.xml b/doc/classes/AnimationNodeBlendTree.xml index 4be7f5e7f8..9ae34e8038 100644 --- a/doc/classes/AnimationNodeBlendTree.xml +++ b/doc/classes/AnimationNodeBlendTree.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeBlendTree" inherits="AnimationRootNode" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - [AnimationTree] node resource that contains many blend type nodes. + A sub-tree of blend type [AnimationNode]s used for complex animations. Used by [AnimationTree]. </brief_description> <description> - This node may contain a sub-tree of any other blend type nodes, such as [AnimationNodeTransition], [AnimationNodeBlend2], [AnimationNodeBlend3], [AnimationNodeOneShot], etc. This is one of the most commonly used roots. + This node may contain a sub-tree of any other blend type nodes, such as [AnimationNodeTransition], [AnimationNodeBlend2], [AnimationNodeBlend3], [AnimationNodeOneShot], etc. This is one of the most commonly used animation node roots. An [AnimationNodeOutput] node named [code]output[/code] is created by default. </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> <methods> <method name="add_node"> diff --git a/doc/classes/AnimationNodeOneShot.xml b/doc/classes/AnimationNodeOneShot.xml index e95eab993c..11ef27178b 100644 --- a/doc/classes/AnimationNodeOneShot.xml +++ b/doc/classes/AnimationNodeOneShot.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeOneShot" inherits="AnimationNodeSync" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Plays an animation once in [AnimationNodeBlendTree]. + Plays an animation once in an [AnimationNodeBlendTree]. </brief_description> <description> A resource to add to an [AnimationNodeBlendTree]. This node will execute a sub-animation and return once it finishes. Blend times for fading in and out can be customized, as well as filters. @@ -36,7 +36,7 @@ [/codeblocks] </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> <members> diff --git a/doc/classes/AnimationNodeOutput.xml b/doc/classes/AnimationNodeOutput.xml index 46b7169bba..0a9210ce37 100644 --- a/doc/classes/AnimationNodeOutput.xml +++ b/doc/classes/AnimationNodeOutput.xml @@ -1,12 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeOutput" inherits="AnimationNode" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Generic output node to be added to [AnimationNodeBlendTree]. + The animation output node of an [AnimationNodeBlendTree]. </brief_description> <description> + A node created automatically in an [AnimationNodeBlendTree] that outputs the final animation. </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> <link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link> <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> diff --git a/doc/classes/AnimationNodeStateMachine.xml b/doc/classes/AnimationNodeStateMachine.xml index 13f88f79ef..9459c31b3b 100644 --- a/doc/classes/AnimationNodeStateMachine.xml +++ b/doc/classes/AnimationNodeStateMachine.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeStateMachine" inherits="AnimationRootNode" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - State machine for control of animations. + A state machine with multiple [AnimationRootNode]s, used by [AnimationTree]. </brief_description> <description> - Contains multiple nodes representing animation states, connected in a graph. Node transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the [AnimationNodeStateMachinePlayback] object from the [AnimationTree] node to control it programmatically. + Contains multiple [AnimationRootNode]s representing animation states, connected in a graph. Node transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the [AnimationNodeStateMachinePlayback] object from the [AnimationTree] node to control it programmatically. [b]Example:[/b] [codeblocks] [gdscript] @@ -18,7 +18,7 @@ [/codeblocks] </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> <methods> <method name="add_node"> diff --git a/doc/classes/AnimationNodeStateMachinePlayback.xml b/doc/classes/AnimationNodeStateMachinePlayback.xml index 08634f650e..1c9fe4b9f8 100644 --- a/doc/classes/AnimationNodeStateMachinePlayback.xml +++ b/doc/classes/AnimationNodeStateMachinePlayback.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeStateMachinePlayback" inherits="Resource" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Playback control for [AnimationNodeStateMachine]. + Provides playback control for an [AnimationNodeStateMachine]. </brief_description> <description> Allows control of [AnimationTree] state machines created with [AnimationNodeStateMachine]. Retrieve with [code]$AnimationTree.get("parameters/playback")[/code]. @@ -18,7 +18,7 @@ [/codeblocks] </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> <methods> <method name="get_current_length" qualifiers="const"> diff --git a/doc/classes/AnimationNodeStateMachineTransition.xml b/doc/classes/AnimationNodeStateMachineTransition.xml index e23c120cc4..7bb615c148 100644 --- a/doc/classes/AnimationNodeStateMachineTransition.xml +++ b/doc/classes/AnimationNodeStateMachineTransition.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeStateMachineTransition" inherits="Resource" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - A resource to connect each node to make a path for [AnimationNodeStateMachine]. + A transition within an [AnimationNodeStateMachine] connecting two [AnimationRootNode]s. </brief_description> <description> The path generated when using [method AnimationNodeStateMachinePlayback.travel] is limited to the nodes connected by [AnimationNodeStateMachineTransition]. You can set the timing and conditions of the transition in detail. </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> <members> <member name="advance_condition" type="StringName" setter="set_advance_condition" getter="get_advance_condition" default="&"""> diff --git a/doc/classes/AnimationNodeSync.xml b/doc/classes/AnimationNodeSync.xml index e72a0619f4..38f4069c7b 100644 --- a/doc/classes/AnimationNodeSync.xml +++ b/doc/classes/AnimationNodeSync.xml @@ -1,11 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeSync" inherits="AnimationNode" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - The base class for [AnimationNode] which has more than two input ports and needs to synchronize them. + Base class for [AnimationNode]s with more than two input ports that must be synchronized. </brief_description> <description> + An animation node used to combine, mix, or blend two or more animations together while keeping them synchronized within an [AnimationTree]. </description> <tutorials> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> <members> <member name="sync" type="bool" setter="set_use_sync" getter="is_using_sync" default="false"> diff --git a/doc/classes/AnimationNodeTimeScale.xml b/doc/classes/AnimationNodeTimeScale.xml index 5d1b8b109c..65795823b3 100644 --- a/doc/classes/AnimationNodeTimeScale.xml +++ b/doc/classes/AnimationNodeTimeScale.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeTimeScale" inherits="AnimationNode" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - A time-scaling animation node to be used with [AnimationTree]. + A time-scaling animation node used in [AnimationTree]. </brief_description> <description> - Allows scaling the speed of the animation (or reversing it) in any children nodes. Setting it to 0 will pause the animation. + Allows to scale the speed of the animation (or reverse it) in any children [AnimationNode]s. Setting it to [code]0.0[/code] will pause the animation. </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> <link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link> </tutorials> </class> diff --git a/doc/classes/AnimationNodeTimeSeek.xml b/doc/classes/AnimationNodeTimeSeek.xml index 978cd079c8..3098fa7662 100644 --- a/doc/classes/AnimationNodeTimeSeek.xml +++ b/doc/classes/AnimationNodeTimeSeek.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeTimeSeek" inherits="AnimationNode" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - A time-seeking animation node to be used with [AnimationTree]. + A time-seeking animation node used in [AnimationTree]. </brief_description> <description> This node can be used to cause a seek command to happen to any sub-children of the animation graph. Use this node type to play an [Animation] from the start or a certain playback position inside the [AnimationNodeBlendTree]. @@ -28,6 +28,6 @@ [/codeblocks] </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> </class> diff --git a/doc/classes/AnimationNodeTransition.xml b/doc/classes/AnimationNodeTransition.xml index ccf14fcb50..481ea9ff59 100644 --- a/doc/classes/AnimationNodeTransition.xml +++ b/doc/classes/AnimationNodeTransition.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeTransition" inherits="AnimationNodeSync" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - A generic animation transition node for [AnimationTree]. + A transition within an [AnimationTree] connecting two [AnimationNode]s. </brief_description> <description> Simple state machine for cases which don't require a more advanced [AnimationNodeStateMachine]. Animations can be connected to the inputs and transition times can be specified. @@ -37,7 +37,7 @@ [/codeblocks] </description> <tutorials> - <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> <link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link> <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml index 77770a0f7e..94451e7c30 100644 --- a/doc/classes/AnimationPlayer.xml +++ b/doc/classes/AnimationPlayer.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationPlayer" inherits="Node" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Player of [Animation] resources. + A node used for animation playback. </brief_description> <description> - An animation player is used for general-purpose playback of [Animation] resources. It contains a dictionary of [AnimationLibrary] resources and custom blend times between animation transitions. + An animation player is used for general-purpose playback of animations. It contains a dictionary of [AnimationLibrary] resources and custom blend times between animation transitions. Some methods and properties use a single key to reference an animation directly. These keys are formatted as the key for the library, followed by a forward slash, then the key for the animation within the library, for example [code]"movement/run"[/code]. If the library's key is an empty string (known as the default library), the forward slash is omitted, being the same key used by the library. - [AnimationPlayer] is more suited than [Tween] for animations where you know the final values in advance. For example, fading a screen in and out is more easily done with an [AnimationPlayer] node thanks to the animation tools provided by the editor. That particular example can also be implemented with a [Tween], but it requires doing everything by code. - Updating the target properties of animations occurs at process time. + [AnimationPlayer] is better-suited than [Tween] for more complex animations, for example ones with non-trivial timings. It can also be used over [Tween] if the animation track editor is more convenient than doing it in code. + Updating the target properties of animations occurs at the process frame. </description> <tutorials> <link title="2D Sprite animation">$DOCS_URL/tutorials/2d/2d_sprite_animation.html</link> diff --git a/doc/classes/AnimationRootNode.xml b/doc/classes/AnimationRootNode.xml index 47c8c8f287..bf5122fe4f 100644 --- a/doc/classes/AnimationRootNode.xml +++ b/doc/classes/AnimationRootNode.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationRootNode" inherits="AnimationNode" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - The [AnimationNode] which can be set as the root of an [AnimationTree]. + Base class for [AnimationNode]s that hold one or multiple composite animations. Usually used for [member AnimationTree.tree_root]. </brief_description> <description> + [AnimationRootNode] is a base class for [AnimationNode]s that hold a complete animation. A complete animation refers to the output of an [AnimationNodeOutput] in an [AnimationNodeBlendTree] or the output of another [AnimationRootNode]. Used for [member AnimationTree.tree_root] or in other [AnimationRootNode]s. </description> <tutorials> + <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> </tutorials> </class> diff --git a/doc/classes/AnimationTree.xml b/doc/classes/AnimationTree.xml index 4de079c5a3..ef3c1a3f9e 100644 --- a/doc/classes/AnimationTree.xml +++ b/doc/classes/AnimationTree.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationTree" inherits="Node" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - A node to be used for advanced animation transitions in an [AnimationPlayer]. + A node used for advanced animation transitions in an [AnimationPlayer]. </brief_description> <description> - A node to be used for advanced animation transitions in an [AnimationPlayer]. + A node used for advanced animation transitions in an [AnimationPlayer]. [b]Note:[/b] When linked with an [AnimationPlayer], several properties and methods of the corresponding [AnimationPlayer] will not function as expected. Playback and transitions should be handled using only the [AnimationTree] and its constituent [AnimationNode](s). The [AnimationPlayer] node should be used solely for adding, deleting, and editing animations. </description> <tutorials> diff --git a/doc/classes/AudioStreamGenerator.xml b/doc/classes/AudioStreamGenerator.xml index fa4b2ae49f..7718cb78ea 100644 --- a/doc/classes/AudioStreamGenerator.xml +++ b/doc/classes/AudioStreamGenerator.xml @@ -1,16 +1,36 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioStreamGenerator" inherits="AudioStream" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Audio stream that generates sounds procedurally. + An audio stream with utilities for procedural sound generation. </brief_description> <description> - This audio stream does not play back sounds, but expects a script to generate audio data for it instead. See also [AudioStreamGeneratorPlayback]. + [AudioStreamGenerator] is a type of audio stream that does not play back sounds on its own; instead, it expects a script to generate audio data for it. See also [AudioStreamGeneratorPlayback]. + Here's a sample on how to use it to generate a sine wave: + [codeblock] + var playback # Will hold the AudioStreamGeneratorPlayback. + @onready var sample_hz = $AudioStreamPlayer.stream.mix_rate + var pulse_hz = 440.0 # The frequency of the sound wave. + + func _ready(): + $AudioStreamPlayer.play() + playback = $AudioStreamPlayer.get_stream_playback() + fill_buffer() + + func fill_buffer(): + var phase = 0.0 + var increment = pulse_hz / sample_hz + var frames_available = playback.get_frames_available() + + for i in range(frames_available): + playback.push_frame(Vector2.ONE * sin(phase * TAU)) + phase = fmod(phase + increment, 1.0) + [/codeblock] + In the example above, the "AudioStreamPlayer" node must use an [AudioStreamGenerator] as its stream. The [code]fill_buffer[/code] function provides audio data for approximating a sine wave. See also [AudioEffectSpectrumAnalyzer] for performing real-time audio spectrum analysis. [b]Note:[/b] Due to performance constraints, this class is best used from C# or from a compiled language via GDExtension. If you still want to use this class from GDScript, consider using a lower [member mix_rate] such as 11,025 Hz or 22,050 Hz. </description> <tutorials> <link title="Audio Generator Demo">https://godotengine.org/asset-library/asset/526</link> - <link title="Godot 3.2 will get new audio features">https://godotengine.org/article/godot-32-will-get-new-audio-features</link> </tutorials> <members> <member name="buffer_length" type="float" setter="set_buffer_length" getter="get_buffer_length" default="0.5"> diff --git a/doc/classes/BaseMaterial3D.xml b/doc/classes/BaseMaterial3D.xml index 989c76d5da..f5e14e29bf 100644 --- a/doc/classes/BaseMaterial3D.xml +++ b/doc/classes/BaseMaterial3D.xml @@ -356,13 +356,13 @@ [b]Note:[/b] [member specular_mode] only applies to the specular blob. It does not affect specular reflections from the sky, screen-space reflections, [VoxelGI], SDFGI or [ReflectionProbe]s. To disable reflections from these sources as well, set [member metallic_specular] to [code]0.0[/code] instead. </member> <member name="subsurf_scatter_enabled" type="bool" setter="set_feature" getter="get_feature" default="false"> - If [code]true[/code], subsurface scattering is enabled. Emulates light that penetrates an object's surface, is scattered, and then emerges. + If [code]true[/code], subsurface scattering is enabled. Emulates light that penetrates an object's surface, is scattered, and then emerges. Subsurface scattering quality is controlled by [member ProjectSettings.rendering/environment/subsurface_scattering/subsurface_scattering_quality]. </member> <member name="subsurf_scatter_skin_mode" type="bool" setter="set_flag" getter="get_flag" default="false"> If [code]true[/code], subsurface scattering will use a special mode optimized for the color and density of human skin, such as boosting the intensity of the red channel in subsurface scattering. </member> <member name="subsurf_scatter_strength" type="float" setter="set_subsurface_scattering_strength" getter="get_subsurface_scattering_strength" default="0.0"> - The strength of the subsurface scattering effect. + The strength of the subsurface scattering effect. The depth of the effect is also controlled by [member ProjectSettings.rendering/environment/subsurface_scattering/subsurface_scattering_scale], which is set globally. </member> <member name="subsurf_scatter_texture" type="Texture2D" setter="set_texture" getter="get_texture"> Texture used to control the subsurface scattering strength. Stored in the red texture channel. Multiplied by [member subsurf_scatter_strength]. diff --git a/doc/classes/Bone2D.xml b/doc/classes/Bone2D.xml index 446c9d3702..93bdd9d527 100644 --- a/doc/classes/Bone2D.xml +++ b/doc/classes/Bone2D.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Bone2D" inherits="Node2D" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Joint used with [Skeleton2D] to control and animate other nodes. + A joint used with [Skeleton2D] to control and animate other nodes. </brief_description> <description> - Use a hierarchy of [code]Bone2D[/code] bound to a [Skeleton2D] to control, and animate other [Node2D] nodes. - You can use [code]Bone2D[/code] and [code]Skeleton2D[/code] nodes to animate 2D meshes created with the Polygon 2D UV editor. + A hierarchy of [Bone2D]s can be bound to a [Skeleton2D] to control and animate other [Node2D] nodes. + You can use [Bone2D] and [Skeleton2D] nodes to animate 2D meshes created with the [Polygon2D] UV editor. Each bone has a [member rest] transform that you can reset to with [method apply_rest]. These rest poses are relative to the bone's parent. If in the editor, you can set the rest pose of an entire skeleton using a menu option, from the code, you need to iterate over the bones to set their individual rest poses. </description> @@ -21,14 +21,14 @@ <method name="get_autocalculate_length_and_angle" qualifiers="const"> <return type="bool" /> <description> - Returns whether this [code]Bone2D[/code] node is going to autocalculate its length and bone angle using its first [code]Bone2D[/code] child node, if one exists. If there are no [code]Bone2D[/code] children, then it cannot autocalculate these values and will print a warning. + Returns whether this [Bone2D] is going to autocalculate its length and bone angle using its first [Bone2D] child node, if one exists. If there are no [Bone2D] children, then it cannot autocalculate these values and will print a warning. </description> </method> <method name="get_bone_angle" qualifiers="const"> <return type="float" /> <description> - Returns the angle of the bone in the [code]Bone2D[/code] node. - [b]Note:[/b] This is different from the [code]Bone2D[/code]'s rotation. The bone angle is the rotation of the bone shown by the [code]Bone2D[/code] gizmo, and because [code]Bone2D[/code] bones are based on positions, this can vary from the actual rotation of the [code]Bone2D[/code] node. + Returns the angle of the bone in the [Bone2D]. + [b]Note:[/b] This is different from the [Bone2D]'s rotation. The bone's angle is the rotation of the bone shown by the gizmo, which is unaffected by the [Bone2D]'s [member Node2D.transform]. </description> </method> <method name="get_index_in_skeleton" qualifiers="const"> @@ -40,7 +40,7 @@ <method name="get_length" qualifiers="const"> <return type="float" /> <description> - Returns the length of the bone in the [code]Bone2D[/code] node. + Returns the length of the bone in the [Bone2D] node. </description> </method> <method name="get_skeleton_rest" qualifiers="const"> @@ -53,22 +53,22 @@ <return type="void" /> <param index="0" name="auto_calculate" type="bool" /> <description> - When set to [code]true[/code], the [code]Bone2D[/code] node will attempt to automatically calculate the bone angle and length using the first child [code]Bone2D[/code] node, if one exists. If none exist, the [code]Bone2D[/code] cannot automatically calculate these values and will print a warning. + When set to [code]true[/code], the [Bone2D] node will attempt to automatically calculate the bone angle and length using the first child [Bone2D] node, if one exists. If none exist, the [Bone2D] cannot automatically calculate these values and will print a warning. </description> </method> <method name="set_bone_angle"> <return type="void" /> <param index="0" name="angle" type="float" /> <description> - Sets the bone angle for the [code]Bone2D[/code] node. This is typically set to the rotation from the [code]Bone2D[/code] node to a child [code]Bone2D[/code] node. - [b]Note:[/b] This is different from the [code]Bone2D[/code]'s rotation. The bone angle is the rotation of the bone shown by the [code]Bone2D[/code] gizmo, and because [code]Bone2D[/code] bones are based on positions, this can vary from the actual rotation of the [code]Bone2D[/code] node. + Sets the bone angle for the [Bone2D]. This is typically set to the rotation from the [Bone2D] to a child [Bone2D] node. + [b]Note:[/b] [b]Note:[/b] This is different from the [Bone2D]'s rotation. The bone's angle is the rotation of the bone shown by the gizmo, which is unaffected by the [Bone2D]'s [member Node2D.transform]. </description> </method> <method name="set_length"> <return type="void" /> <param index="0" name="length" type="float" /> <description> - Sets the length of the bone in the [code]Bone2D[/code] node. + Sets the length of the bone in the [Bone2D]. </description> </method> </methods> diff --git a/doc/classes/BoneAttachment3D.xml b/doc/classes/BoneAttachment3D.xml index bcf7ed42e9..83f70fc331 100644 --- a/doc/classes/BoneAttachment3D.xml +++ b/doc/classes/BoneAttachment3D.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="BoneAttachment3D" inherits="Node3D" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - A node that will attach to a bone. + А node that dynamically copies or overrides the 3D transform of a bone in its parent [Skeleton3D]. </brief_description> <description> - This node will allow you to select a bone for this node to attach to. The BoneAttachment3D node can copy the transform of the select bone, or can override the transform of the selected bone. - The BoneAttachment3D node must either be a child of a [Skeleton3D] node or be given an external [Skeleton3D] to use in order to function properly. + This node selects a bone in a [Skeleton3D] and attaches to it. This means that the [BoneAttachment3D] node will either dynamically copy or override the 3D transform of the selected bone. </description> <tutorials> </tutorials> diff --git a/doc/classes/BoneMap.xml b/doc/classes/BoneMap.xml index 1fd54a5019..032e2420ca 100644 --- a/doc/classes/BoneMap.xml +++ b/doc/classes/BoneMap.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="BoneMap" inherits="Resource" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Bone map for retargeting. + Describes a mapping of bone names for retargeting [Skeleton3D] into common names defined by a [SkeletonProfile]. </brief_description> <description> - This class contains a hashmap that uses a list of bone names in [SkeletonProfile] as key names. + This class contains a dictionary that uses a list of bone names in [SkeletonProfile] as key names. By assigning the actual [Skeleton3D] bone name as the key value, it maps the [Skeleton3D] to the [SkeletonProfile]. </description> <tutorials> diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml index ec2447dbbc..1bf5c31818 100644 --- a/doc/classes/Button.xml +++ b/doc/classes/Button.xml @@ -58,7 +58,7 @@ To edit margin and spacing of the icon, use [theme_item h_separation] theme property and [code]content_margin_*[/code] properties of the used [StyleBox]es. </member> <member name="icon_alignment" type="int" setter="set_icon_alignment" getter="get_icon_alignment" enum="HorizontalAlignment" default="0"> - Specifies if the icon should be aligned to the left, right, or center of a button. Uses the same [enum HorizontalAlignment] constants as the text alignment. If centered, text will draw on top of the icon. + Specifies if the icon should be aligned horizontally to the left, right, or center of a button. Uses the same [enum HorizontalAlignment] constants as the text alignment. If centered horizontally and vertically, text will draw on top of the icon. </member> <member name="language" type="String" setter="set_language" getter="get_language" default=""""> Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. @@ -72,6 +72,9 @@ <member name="text_overrun_behavior" type="int" setter="set_text_overrun_behavior" getter="get_text_overrun_behavior" enum="TextServer.OverrunBehavior" default="0"> Sets the clipping behavior when the text exceeds the node's bounding rectangle. See [enum TextServer.OverrunBehavior] for a description of all modes. </member> + <member name="vertical_icon_alignment" type="int" setter="set_vertical_icon_alignment" getter="get_vertical_icon_alignment" enum="VerticalAlignment" default="1"> + Specifies if the icon should be aligned vertically to the top, bottom, or center of a button. Uses the same [enum VerticalAlignment] constants as the text alignment. If centered horizontally and vertically, text will draw on top of the icon. + </member> </members> <theme_items> <theme_item name="font_color" data_type="color" type="Color" default="Color(0.875, 0.875, 0.875, 1)"> diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index af1f2be76d..bf854e6a5e 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -237,7 +237,7 @@ <param index="2" name="uvs" type="PackedVector2Array" default="PackedVector2Array()" /> <param index="3" name="texture" type="Texture2D" default="null" /> <description> - Draws a solid polygon of any number of points, convex or concave. Unlike [method draw_colored_polygon], each point's color can be changed individually. See also [method draw_polyline] and [method draw_polyline_colors]. + Draws a solid polygon of any number of points, convex or concave. Unlike [method draw_colored_polygon], each point's color can be changed individually. See also [method draw_polyline] and [method draw_polyline_colors]. If you need more flexibility (such as being able to use bones), use [method RenderingServer.canvas_item_add_triangle_array] instead. </description> </method> <method name="draw_polyline"> @@ -279,7 +279,7 @@ <param index="2" name="filled" type="bool" default="true" /> <param index="3" name="width" type="float" default="-1.0" /> <description> - Draws a rectangle. If [param filled] is [code]true[/code], the rectangle will be filled with the [param color] specified. If [param filled] is [code]false[/code], the rectangle will be drawn as a stroke with the [param color] and [param width] specified. + Draws a rectangle. If [param filled] is [code]true[/code], the rectangle will be filled with the [param color] specified. If [param filled] is [code]false[/code], the rectangle will be drawn as a stroke with the [param color] and [param width] specified. See also [method draw_texture_rect]. If [param width] is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive [param width] like [code]1.0[/code]. [b]Note:[/b] [param width] is only effective if [param filled] is [code]false[/code]. [b]Note:[/b] Unfilled rectangles drawn with a negative [param width] may not display perfectly. For example, corners may be missing or brighter due to overlapping lines (for a translucent [param color]). @@ -380,7 +380,7 @@ <param index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" /> <param index="4" name="transpose" type="bool" default="false" /> <description> - Draws a textured rectangle at a given position, optionally modulated by a color. If [param transpose] is [code]true[/code], the texture will have its X and Y coordinates swapped. + Draws a textured rectangle at a given position, optionally modulated by a color. If [param transpose] is [code]true[/code], the texture will have its X and Y coordinates swapped. See also [method draw_rect] and [method draw_texture_rect_region]. </description> </method> <method name="draw_texture_rect_region"> @@ -392,7 +392,7 @@ <param index="4" name="transpose" type="bool" default="false" /> <param index="5" name="clip_uv" type="bool" default="true" /> <description> - Draws a textured rectangle region at a given position, optionally modulated by a color. If [param transpose] is [code]true[/code], the texture will have its X and Y coordinates swapped. + Draws a textured rectangle from a texture's region (specified by [param src_rect]) at a given position, optionally modulated by a color. If [param transpose] is [code]true[/code], the texture will have its X and Y coordinates swapped. See also [method draw_texture_rect]. </description> </method> <method name="force_update_transform"> @@ -423,6 +423,7 @@ <return type="Vector2" /> <description> Returns the mouse's position in the [CanvasLayer] that this [CanvasItem] is in using the coordinate system of the [CanvasLayer]. + [b]Note:[/b] For screen-space coordinates (e.g. when using a non-embedded [Popup]), you can use [method DisplayServer.mouse_get_position]. </description> </method> <method name="get_global_transform" qualifiers="const"> @@ -502,7 +503,7 @@ <method name="is_visible_in_tree" qualifiers="const"> <return type="bool" /> <description> - Returns [code]true[/code] if the node is present in the [SceneTree], its [member visible] property is [code]true[/code] and all its antecedents are also visible. If any antecedent is hidden, this node will not be visible in the scene tree, and is consequently not drawn (see [method _draw]). + Returns [code]true[/code] if the node is present in the [SceneTree], its [member visible] property is [code]true[/code] and all its ancestors are also visible. If any ancestor is hidden, this node will not be visible in the scene tree, and is consequently not drawn (see [method _draw]). </description> </method> <method name="make_canvas_position_local" qualifiers="const"> @@ -597,7 +598,7 @@ The rendering layer in which this [CanvasItem] is rendered by [Viewport] nodes. A [Viewport] will render a [CanvasItem] if it and all its parents share a layer with the [Viewport]'s canvas cull mask. </member> <member name="visible" type="bool" setter="set_visible" getter="is_visible" default="true"> - If [code]true[/code], this [CanvasItem] is drawn. The node is only visible if all of its antecedents are visible as well (in other words, [method is_visible_in_tree] must return [code]true[/code]). + If [code]true[/code], this [CanvasItem] is drawn. The node is only visible if all of its ancestors are visible as well (in other words, [method is_visible_in_tree] must return [code]true[/code]). [b]Note:[/b] For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead. </member> <member name="y_sort_enabled" type="bool" setter="set_y_sort_enabled" getter="is_y_sort_enabled" default="false"> diff --git a/doc/classes/CodeEdit.xml b/doc/classes/CodeEdit.xml index 8642fcc0d0..b8b9b5fe5e 100644 --- a/doc/classes/CodeEdit.xml +++ b/doc/classes/CodeEdit.xml @@ -537,7 +537,7 @@ Marks the option as a member. </constant> <constant name="KIND_ENUM" value="5" enum="CodeCompletionKind"> - Marks the option as a enum entry. + Marks the option as an enum entry. </constant> <constant name="KIND_CONSTANT" value="6" enum="CodeCompletionKind"> Marks the option as a constant. diff --git a/doc/classes/CurveTexture.xml b/doc/classes/CurveTexture.xml index 4dcdd9560a..7d530e45cf 100644 --- a/doc/classes/CurveTexture.xml +++ b/doc/classes/CurveTexture.xml @@ -15,7 +15,7 @@ </member> <member name="resource_local_to_scene" type="bool" setter="set_local_to_scene" getter="is_local_to_scene" overrides="Resource" default="false" /> <member name="texture_mode" type="int" setter="set_texture_mode" getter="get_texture_mode" enum="CurveTexture.TextureMode" default="0"> - The format the texture should be generated with. When passing a CurveTexture as a input to a [Shader], this may need to be adjusted. + The format the texture should be generated with. When passing a CurveTexture as an input to a [Shader], this may need to be adjusted. </member> <member name="width" type="int" setter="set_width" getter="get_width" default="256"> The width of the texture (in pixels). Higher values make it possible to represent high-frequency data better (such as sudden direction changes), at the cost of increased generation time and memory usage. diff --git a/doc/classes/Decal.xml b/doc/classes/Decal.xml index b1ce4cef1a..ace1d026d4 100644 --- a/doc/classes/Decal.xml +++ b/doc/classes/Decal.xml @@ -107,7 +107,7 @@ <member name="texture_orm" type="Texture2D" setter="set_texture" getter="get_texture"> [Texture2D] storing ambient occlusion, roughness, and metallic for the decal. Use this to add extra detail to decals. [b]Note:[/b] Unlike [BaseMaterial3D] whose filter mode can be adjusted on a per-material basis, the filter mode for [Decal] textures is set globally with [member ProjectSettings.rendering/textures/decals/filter]. - [b]Note:[/b] Setting this texture alone will not result in a visible decal, as [member texture_albedo] must also be set. To create a ORM-only decal, load an albedo texture into [member texture_albedo] and set [member albedo_mix] to [code]0.0[/code]. The albedo texture's alpha channel will be used to determine where the underlying surface's ORM map should be overridden (and its intensity). + [b]Note:[/b] Setting this texture alone will not result in a visible decal, as [member texture_albedo] must also be set. To create an ORM-only decal, load an albedo texture into [member texture_albedo] and set [member albedo_mix] to [code]0.0[/code]. The albedo texture's alpha channel will be used to determine where the underlying surface's ORM map should be overridden (and its intensity). </member> <member name="upper_fade" type="float" setter="set_upper_fade" getter="get_upper_fade" default="0.3"> Sets the curve over which the decal will fade as the surface gets further from the center of the [AABB]. Only positive values are valid (negative values will be clamped to [code]0.0[/code]). See also [member lower_fade]. diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index 924e1d5d2f..513414e695 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -468,7 +468,7 @@ <param index="0" name="menu_root" type="String" /> <param index="1" name="idx" type="int" /> <description> - Returns number of states of an multistate item. See [method global_menu_add_multistate_item] for details. + Returns number of states of a multistate item. See [method global_menu_add_multistate_item] for details. [b]Note:[/b] This method is implemented on macOS. </description> </method> @@ -477,7 +477,7 @@ <param index="0" name="menu_root" type="String" /> <param index="1" name="idx" type="int" /> <description> - Returns the state of an multistate item. See [method global_menu_add_multistate_item] for details. + Returns the state of a multistate item. See [method global_menu_add_multistate_item] for details. [b]Note:[/b] This method is implemented on macOS. </description> </method> @@ -654,7 +654,7 @@ <param index="1" name="idx" type="int" /> <param index="2" name="max_states" type="int" /> <description> - Sets number of state of an multistate item. See [method global_menu_add_multistate_item] for details. + Sets number of state of a multistate item. See [method global_menu_add_multistate_item] for details. [b]Note:[/b] This method is implemented on macOS. </description> </method> @@ -675,7 +675,7 @@ <param index="1" name="idx" type="int" /> <param index="2" name="state" type="int" /> <description> - Sets the state of an multistate item. See [method global_menu_add_multistate_item] for details. + Sets the state of a multistate item. See [method global_menu_add_multistate_item] for details. [b]Note:[/b] This method is implemented on macOS. </description> </method> @@ -821,7 +821,7 @@ <method name="mouse_get_position" qualifiers="const"> <return type="Vector2i" /> <description> - Returns the mouse cursor's current position. + Returns the mouse cursor's current position in screen coordinates. </description> </method> <method name="mouse_set_mode"> @@ -1718,7 +1718,7 @@ [b]Note:[/b] Regardless of the platform, enabling full screen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling full screen mode. </constant> <constant name="WINDOW_FLAG_RESIZE_DISABLED" value="0" enum="WindowFlags"> - The window can't be resizing by dragging its resize grip. It's still possible to resize the window using [method window_set_size]. This flag is ignored for full screen windows. + The window can't be resized by dragging its resize grip. It's still possible to resize the window using [method window_set_size]. This flag is ignored for full screen windows. </constant> <constant name="WINDOW_FLAG_BORDERLESS" value="1" enum="WindowFlags"> The window do not have native title bar and other decorations. This flag is ignored for full-screen windows. diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index ddaed23d55..8c27c1bc06 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -295,7 +295,7 @@ If [code]true[/code], render the grid on an XZ plane. </member> <member name="editors/3d/grid_yz_plane" type="bool" setter="" getter=""> - If [code]true[/code], render the grid on an YZ plane. This can be useful for 3D side-scrolling games. + If [code]true[/code], render the grid on a YZ plane. This can be useful for 3D side-scrolling games. </member> <member name="editors/3d/navigation/emulate_3_button_mouse" type="bool" setter="" getter=""> If [code]true[/code], enables 3-button mouse emulation mode. This is useful on laptops when using a trackpad. @@ -644,6 +644,10 @@ If [code]true[/code], increases the scrollbar touch area to improve usability on touchscreen devices. [b]Note:[/b] Defaults to [code]true[/code] on touchscreen devices. </member> + <member name="interface/touchscreen/scale_gizmo_handles" type="float" setter="" getter=""> + Specify the multiplier to apply to the scale for the editor gizmo handles to improve usability on touchscreen devices. + [b]Note:[/b] Defaults to [code]1[/code] on non-touchscreen devices. + </member> <member name="network/debug/remote_host" type="String" setter="" getter=""> The address to listen to when starting the remote debugger. This can be set to [code]0.0.0.0[/code] to allow external clients to connect to the remote debugger (instead of restricting the remote debugger to connections from [code]localhost[/code]). </member> @@ -704,7 +708,7 @@ If [code]true[/code], colors the background of the line the caret is currently on with [member text_editor/theme/highlighting/current_line_color]. </member> <member name="text_editor/appearance/caret/type" type="int" setter="" getter=""> - The shape of the caret to use in the script editor. [b]Line[/b] displays a vertical line to the left of the current character, whereas [b]Block[/b] displays a outline over the current character. + The shape of the caret to use in the script editor. [b]Line[/b] displays a vertical line to the left of the current character, whereas [b]Block[/b] displays an outline over the current character. </member> <member name="text_editor/appearance/guidelines/line_length_guideline_hard_column" type="int" setter="" getter=""> The column at which to display a subtle line as a line length guideline for scripts. This should generally be greater than [member text_editor/appearance/guidelines/line_length_guideline_soft_column]. diff --git a/doc/classes/FontFile.xml b/doc/classes/FontFile.xml index ed9906186c..4993d0dc42 100644 --- a/doc/classes/FontFile.xml +++ b/doc/classes/FontFile.xml @@ -12,7 +12,7 @@ - Bitmap font importer: AngelCode BMFont (.fnt, .font), text and binary (version 3) format variants. - Monospace image font importer: All supported image formats. [b]Note:[/b] A character is a symbol that represents an item (letter, digit etc.) in an abstract way. - [b]Note:[/b] A glyph is a bitmap or shape used to draw a one or more characters in a context-dependent manner. Glyph indices are bound to the specific font data source. + [b]Note:[/b] A glyph is a bitmap or shape used to draw one or more characters in a context-dependent manner. Glyph indices are bound to the specific font data source. [b]Note:[/b] If a none of the font data sources contain glyphs for a character used in a string, the character in question will be replaced with a box displaying its hexadecimal code. [codeblocks] [gdscript] diff --git a/doc/classes/GPUParticlesCollisionHeightField3D.xml b/doc/classes/GPUParticlesCollisionHeightField3D.xml index 99ed5e7062..4c55aa225c 100644 --- a/doc/classes/GPUParticlesCollisionHeightField3D.xml +++ b/doc/classes/GPUParticlesCollisionHeightField3D.xml @@ -50,7 +50,7 @@ Represents the size of the [enum Resolution] enum. </constant> <constant name="UPDATE_MODE_WHEN_MOVED" value="0" enum="UpdateMode"> - Only update the heightmap when the [GPUParticlesCollisionHeightField3D] node is moved, or when the camera moves if [member follow_camera_enabled] is [code]true[/code]. An update can be forced by slightly moving the [GPUParticlesCollisionHeightField3D] in any direction. + Only update the heightmap when the [GPUParticlesCollisionHeightField3D] node is moved, or when the camera moves if [member follow_camera_enabled] is [code]true[/code]. An update can be forced by slightly moving the [GPUParticlesCollisionHeightField3D] in any direction, or by calling [method RenderingServer.particles_collision_height_field_update]. </constant> <constant name="UPDATE_MODE_ALWAYS" value="1" enum="UpdateMode"> Update the heightmap every frame. This has a significant performance cost. This update should only be used when geometry that particles can collide with changes significantly during gameplay. diff --git a/doc/classes/GeometryInstance3D.xml b/doc/classes/GeometryInstance3D.xml index 14945922c6..edf2f9e18a 100644 --- a/doc/classes/GeometryInstance3D.xml +++ b/doc/classes/GeometryInstance3D.xml @@ -33,7 +33,7 @@ The selected shadow casting flag. See [enum ShadowCastingSetting] for possible values. </member> <member name="custom_aabb" type="AABB" setter="set_custom_aabb" getter="get_custom_aabb" default="AABB(0, 0, 0, 0, 0, 0)"> - Overrides the bounding box of this node with a custom one. This can be used to avoid the expensive [AABB] recalculation that happens when a skeleton is used with a [MeshInstance3D] or to have fine control over the [MeshInstance3D]'s bounding box. To remove this, set value to an [AABB] with all fields set to zero. + Overrides the bounding box of this node with a custom one. This can be used to avoid the expensive [AABB] recalculation that happens when a skeleton is used with a [MeshInstance3D] or to have fine control over the [MeshInstance3D]'s bounding box. To use the default AABB, set value to an [AABB] with all fields set to [code]0.0[/code]. To avoid frustum culling, set [member custom_aabb] to a very large AABB that covers your entire game world such as [code]AABB(-10000, -10000, -10000, 20000, 20000, 20000)[/code]. To disable all forms of culling (including occlusion culling), call [method RenderingServer.instance_set_ignore_culling] on the [GeometryInstance3D]'s [RID]. </member> <member name="extra_cull_margin" type="float" setter="set_extra_cull_margin" getter="get_extra_cull_margin" default="0.0"> The extra distance added to the GeometryInstance3D's bounding box ([AABB]) to increase its cull box. @@ -47,6 +47,7 @@ </member> <member name="ignore_occlusion_culling" type="bool" setter="set_ignore_occlusion_culling" getter="is_ignoring_occlusion_culling" default="false"> If [code]true[/code], disables occlusion culling for this instance. Useful for gizmos that must be rendered even when occlusion culling is in use. + [b]Note:[/b] [member ignore_occlusion_culling] does not affect frustum culling (which is what happens when an object is not visible given the camera's angle). To avoid frustum culling, set [member custom_aabb] to a very large AABB that covers your entire game world such as [code]AABB(-10000, -10000, -10000, 20000, 20000, 20000)[/code]. </member> <member name="lod_bias" type="float" setter="set_lod_bias" getter="get_lod_bias" default="1.0"> Changes how quickly the mesh transitions to a lower level of detail. A value of 0 will force the mesh to its lowest level of detail, a value of 1 will use the default settings, and larger values will keep the mesh in a higher level of detail at farther distances. @@ -70,14 +71,14 @@ </member> <member name="visibility_range_begin_margin" type="float" setter="set_visibility_range_begin_margin" getter="get_visibility_range_begin_margin" default="0.0"> Margin for the [member visibility_range_begin] threshold. The GeometryInstance3D will only change its visibility state when it goes over or under the [member visibility_range_begin] threshold by this amount. - If [member visibility_range_fade_mode] is [constant VISIBILITY_RANGE_FADE_DISABLED], this acts as an hysteresis distance. If [member visibility_range_fade_mode] is [constant VISIBILITY_RANGE_FADE_SELF] or [constant VISIBILITY_RANGE_FADE_DEPENDENCIES], this acts as a fade transition distance and must be set to a value greater than [code]0.0[/code] for the effect to be noticeable. + If [member visibility_range_fade_mode] is [constant VISIBILITY_RANGE_FADE_DISABLED], this acts as a hysteresis distance. If [member visibility_range_fade_mode] is [constant VISIBILITY_RANGE_FADE_SELF] or [constant VISIBILITY_RANGE_FADE_DEPENDENCIES], this acts as a fade transition distance and must be set to a value greater than [code]0.0[/code] for the effect to be noticeable. </member> <member name="visibility_range_end" type="float" setter="set_visibility_range_end" getter="get_visibility_range_end" default="0.0"> Distance from which the GeometryInstance3D will be hidden, taking [member visibility_range_end_margin] into account as well. The default value of 0 is used to disable the range check. </member> <member name="visibility_range_end_margin" type="float" setter="set_visibility_range_end_margin" getter="get_visibility_range_end_margin" default="0.0"> Margin for the [member visibility_range_end] threshold. The GeometryInstance3D will only change its visibility state when it goes over or under the [member visibility_range_end] threshold by this amount. - If [member visibility_range_fade_mode] is [constant VISIBILITY_RANGE_FADE_DISABLED], this acts as an hysteresis distance. If [member visibility_range_fade_mode] is [constant VISIBILITY_RANGE_FADE_SELF] or [constant VISIBILITY_RANGE_FADE_DEPENDENCIES], this acts as a fade transition distance and must be set to a value greater than [code]0.0[/code] for the effect to be noticeable. + If [member visibility_range_fade_mode] is [constant VISIBILITY_RANGE_FADE_DISABLED], this acts as a hysteresis distance. If [member visibility_range_fade_mode] is [constant VISIBILITY_RANGE_FADE_SELF] or [constant VISIBILITY_RANGE_FADE_DEPENDENCIES], this acts as a fade transition distance and must be set to a value greater than [code]0.0[/code] for the effect to be noticeable. </member> <member name="visibility_range_fade_mode" type="int" setter="set_visibility_range_fade_mode" getter="get_visibility_range_fade_mode" enum="GeometryInstance3D.VisibilityRangeFadeMode" default="0"> Controls which instances will be faded when approaching the limits of the visibility range. See [enum VisibilityRangeFadeMode] for possible values. diff --git a/doc/classes/Light3D.xml b/doc/classes/Light3D.xml index 59549cecb8..26b97edc25 100644 --- a/doc/classes/Light3D.xml +++ b/doc/classes/Light3D.xml @@ -204,7 +204,7 @@ Light is taken into account in static baking ([VoxelGI], [LightmapGI], SDFGI ([member Environment.sdfgi_enabled])). The light can be moved around or modified, but its global illumination will not update in real-time. This is suitable for subtle changes (such as flickering torches), but generally not large changes such as toggling a light on and off. </constant> <constant name="BAKE_DYNAMIC" value="2" enum="BakeMode"> - Light is taken into account in dynamic baking ([VoxelGI] and SDFGI ([member Environment.sdfgi_enabled]) only). The light can be moved around or modified with global illumination updating in real-time. The light's global illumination appearance will be slightly different compared to [constant BAKE_STATIC]. This has a greater performance cost compared to [constant BAKE_STATIC]. + Light is taken into account in dynamic baking ([VoxelGI] and SDFGI ([member Environment.sdfgi_enabled]) only). The light can be moved around or modified with global illumination updating in real-time. The light's global illumination appearance will be slightly different compared to [constant BAKE_STATIC]. This has a greater performance cost compared to [constant BAKE_STATIC]. When using SDFGI, the update speed of dynamic lights is affected by [member ProjectSettings.rendering/global_illumination/sdfgi/frames_to_update_lights]. </constant> </constants> </class> diff --git a/doc/classes/Node3D.xml b/doc/classes/Node3D.xml index da898a5567..27cb3915ee 100644 --- a/doc/classes/Node3D.xml +++ b/doc/classes/Node3D.xml @@ -105,7 +105,7 @@ <method name="is_visible_in_tree" qualifiers="const"> <return type="bool" /> <description> - Returns [code]true[/code] if the node is present in the [SceneTree], its [member visible] property is [code]true[/code] and all its antecedents are also visible. If any antecedent is hidden, this node will not be visible in the scene tree. + Returns [code]true[/code] if the node is present in the [SceneTree], its [member visible] property is [code]true[/code] and all its ancestors are also visible. If any ancestor is hidden, this node will not be visible in the scene tree. </description> </method> <method name="look_at"> @@ -315,7 +315,7 @@ Defines the visibility range parent for this node and its subtree. The visibility parent must be a GeometryInstance3D. Any visual instance will only be visible if the visibility parent (and all of its visibility ancestors) is hidden by being closer to the camera than its own [member GeometryInstance3D.visibility_range_begin]. Nodes hidden via the [member Node3D.visible] property are essentially removed from the visibility dependency tree, so dependent instances will not take the hidden node or its ancestors into account. </member> <member name="visible" type="bool" setter="set_visible" getter="is_visible" default="true"> - If [code]true[/code], this node is drawn. The node is only visible if all of its antecedents are visible as well (in other words, [method is_visible_in_tree] must return [code]true[/code]). + If [code]true[/code], this node is drawn. The node is only visible if all of its ancestors are visible as well (in other words, [method is_visible_in_tree] must return [code]true[/code]). </member> </members> <signals> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index a30c541b71..47f39aedf4 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -426,7 +426,7 @@ <description> Returns an array of the system substitute font file paths, which are similar to the font with [param font_name] and style for the specified text, locale and script. Returns empty array if no matching fonts found. The following aliases can be used to request default fonts: "sans-serif", "serif", "monospace", "cursive", and "fantasy". - [b]Note:[/b] Depending on OS, it's not guaranteed that any of the returned fonts is suitable for rendering specified text. Fonts should be loaded and checked in the order they are returned, and the first suitable one used. + [b]Note:[/b] Depending on OS, it's not guaranteed that any of the returned fonts will be suitable for rendering specified text. Fonts should be loaded and checked in the order they are returned, and the first suitable one used. [b]Note:[/b] Returned fonts might have different style if the requested style is not available or belong to a different font family. [b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS and Windows. </description> @@ -481,7 +481,7 @@ <method name="get_video_adapter_driver_info" qualifiers="const"> <return type="PackedStringArray" /> <description> - Returns the video adapter driver name and version for the user's currently active graphics card. + Returns the video adapter driver name and version for the user's currently active graphics card. See also [method RenderingServer.get_video_adapter_api_version]. The first element holds the driver name, such as [code]nvidia[/code], [code]amdgpu[/code], etc. The second element holds the driver version. For e.g. the [code]nvidia[/code] driver on a Linux/BSD platform, the version is in the format [code]510.85.02[/code]. For Windows, the driver's format is [code]31.0.15.1659[/code]. [b]Note:[/b] This method is only supported on the platforms Linux/BSD and Windows when not running in headless mode. It returns an empty array on other platforms. diff --git a/doc/classes/ParticleProcessMaterial.xml b/doc/classes/ParticleProcessMaterial.xml index 6d549e1b67..5497effc75 100644 --- a/doc/classes/ParticleProcessMaterial.xml +++ b/doc/classes/ParticleProcessMaterial.xml @@ -282,7 +282,8 @@ Minimum equivalent of [member tangential_accel_max]. </member> <member name="turbulence_enabled" type="bool" setter="set_turbulence_enabled" getter="get_turbulence_enabled" default="false"> - Enables and disables Turbulence for the particle system. + If [code]true[/code], enables turbulence for the particle system. Turbulence can be used to vary particle movement according to its position (based on a 3D noise pattern). In 3D, [GPUParticlesAttractorVectorField3D] with [NoiseTexture3D] can be used as an alternative to turbulence that works in world space and with multiple particle systems reacting in the same way. + [b]Note:[/b] Enabling turbulence has a high performance cost on the GPU. Only enable turbulence on a few particle systems at once at most, and consider disabling it when targeting mobile/web platforms. </member> <member name="turbulence_influence_max" type="float" setter="set_param_max" getter="get_param_max" default="0.1"> Maximum turbulence influence on each particle. @@ -296,11 +297,11 @@ Each particle's amount of turbulence will be influenced along this [CurveTexture] over its life time. </member> <member name="turbulence_initial_displacement_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0"> - Maximum displacement of each particles spawn position by the turbulence. + Maximum displacement of each particle's spawn position by the turbulence. The actual amount of displacement will be a factor of the underlying turbulence multiplied by a random value between [member turbulence_initial_displacement_min] and [member turbulence_initial_displacement_max]. </member> <member name="turbulence_initial_displacement_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0"> - Minimum displacement of each particles spawn position by the turbulence. + Minimum displacement of each particle's spawn position by the turbulence. The actual amount of displacement will be a factor of the underlying turbulence multiplied by a random value between [member turbulence_initial_displacement_min] and [member turbulence_initial_displacement_max]. </member> <member name="turbulence_noise_scale" type="float" setter="set_turbulence_noise_scale" getter="get_turbulence_noise_scale" default="9.0"> @@ -312,10 +313,10 @@ A value of [code]Vector3(0.0, 0.0, 0.0)[/code] will freeze the turbulence pattern in place. </member> <member name="turbulence_noise_speed_random" type="float" setter="set_turbulence_noise_speed_random" getter="get_turbulence_noise_speed_random" default="0.0"> - Use to influence the noise speed in a random pattern. This helps to break up visible movement patterns. + Use to influence the noise speed in a random pattern. This helps break up visible movement patterns. </member> <member name="turbulence_noise_strength" type="float" setter="set_turbulence_noise_strength" getter="get_turbulence_noise_strength" default="1.0"> - The turbulence noise strength. Increasing this will result in a stronger, more contrasting, noise pattern. + The turbulence noise strength. Increasing this will result in a stronger, more contrasting noise pattern. </member> </members> <constants> diff --git a/doc/classes/PhysicalBone2D.xml b/doc/classes/PhysicalBone2D.xml index d0bfbbd998..f201016f9c 100644 --- a/doc/classes/PhysicalBone2D.xml +++ b/doc/classes/PhysicalBone2D.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="PhysicalBone2D" inherits="RigidBody2D" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - A 2D node that can be used for physically aware bones in 2D. + A [RigidBody2D]-derived node used to make [Bone2D]s in a [Skeleton2D] react to physics. </brief_description> <description> - The [code]PhysicalBone2D[/code] node is a [RigidBody2D]-based node that can be used to make [Bone2D] nodes in a [Skeleton2D] react to physics. This node is very similar to the [PhysicalBone3D] node, just for 2D instead of 3D. - [b]Note:[/b] To have the Bone2D nodes visually follow the [code]PhysicalBone2D[/code] node, use a [SkeletonModification2DPhysicalBones] modification on the [Skeleton2D] node with the [Bone2D] nodes. - [b]Note:[/b] The PhysicalBone2D node does not automatically create a [Joint2D] node to keep [code]PhysicalBone2D[/code] nodes together. You will need to create these manually. For most cases, you want to use a [PinJoint2D] node. The [code]PhysicalBone2D[/code] node can automatically configure the [Joint2D] node once it's been created as a child node. + The [PhysicalBone2D] node is a [RigidBody2D]-based node that can be used to make [Bone2D]s in a [Skeleton2D] react to physics. + [b]Note:[/b] To make the [Bone2D]s visually follow the [PhysicalBone2D] node, use a [SkeletonModification2DPhysicalBones] modification on the [Skeleton2D] parent. + [b]Note:[/b] The [PhysicalBone2D] node does not automatically create a [Joint2D] node to keep [PhysicalBone2D] nodes together. They must be created manually. For most cases, you want to use a [PinJoint2D] node. The [PhysicalBone2D] node will automatically configure the [Joint2D] node once it's been added as a child node. </description> <tutorials> </tutorials> @@ -14,32 +14,32 @@ <method name="get_joint" qualifiers="const"> <return type="Joint2D" /> <description> - Returns the first [Joint2D] child node, if one exists. This is mainly a helper function to make it easier to get the [Joint2D] that the [code]PhysicalBone2D[/code] is autoconfiguring. + Returns the first [Joint2D] child node, if one exists. This is mainly a helper function to make it easier to get the [Joint2D] that the [PhysicalBone2D] is autoconfiguring. </description> </method> <method name="is_simulating_physics" qualifiers="const"> <return type="bool" /> <description> - Returns a boolean that indicates whether the [code]PhysicalBone2D[/code] node is running and simulating using the Godot 2D physics engine. When [code]true[/code], the PhysicalBone2D node is using physics. + Returns a boolean that indicates whether the [PhysicalBone2D] is running and simulating using the Godot 2D physics engine. When [code]true[/code], the PhysicalBone2D node is using physics. </description> </method> </methods> <members> <member name="auto_configure_joint" type="bool" setter="set_auto_configure_joint" getter="get_auto_configure_joint" default="true"> - If [code]true[/code], the [code]PhysicalBone2D[/code] node will automatically configure the first [Joint2D] child node. The automatic configuration is limited to setting up the node properties and positioning the [Joint2D]. + If [code]true[/code], the [PhysicalBone2D] will automatically configure the first [Joint2D] child node. The automatic configuration is limited to setting up the node properties and positioning the [Joint2D]. </member> <member name="bone2d_index" type="int" setter="set_bone2d_index" getter="get_bone2d_index" default="-1"> - The index of the [Bone2D] node that this [code]PhysicalBone2D[/code] node is supposed to be simulating. + The index of the [Bone2D] that this [PhysicalBone2D] should simulate. </member> <member name="bone2d_nodepath" type="NodePath" setter="set_bone2d_nodepath" getter="get_bone2d_nodepath" default="NodePath("")"> - The [NodePath] to the [Bone2D] node that this [code]PhysicalBone2D[/code] node is supposed to be simulating. + The [NodePath] to the [Bone2D] that this [PhysicalBone2D] isshould simulate. </member> <member name="follow_bone_when_simulating" type="bool" setter="set_follow_bone_when_simulating" getter="get_follow_bone_when_simulating" default="false"> - If [code]true[/code], the [code]PhysicalBone2D[/code] will keep the transform of the bone it is bound to when simulating physics. + If [code]true[/code], the [PhysicalBone2D] will keep the transform of the bone it is bound to when simulating physics. </member> <member name="simulate_physics" type="bool" setter="set_simulate_physics" getter="get_simulate_physics" default="false"> - If [code]true[/code], the [code]PhysicalBone2D[/code] will start simulating using physics. If [code]false[/code], the [code]PhysicalBone2D[/code] will follow the transform of the [Bone2D] node. - [b]Note:[/b] To have the Bone2D nodes visually follow the [code]PhysicalBone2D[/code] node, use a [SkeletonModification2DPhysicalBones] modification on the [Skeleton2D] node with the [Bone2D] nodes. + If [code]true[/code], the [PhysicalBone2D] will start simulating using physics. If [code]false[/code], the [PhysicalBone2D] will follow the transform of the [Bone2D] node. + [b]Note:[/b] To have the [Bone2D]s visually follow the [PhysicalBone2D], use a [SkeletonModification2DPhysicalBones] modification on the [Skeleton2D] node with the [Bone2D] nodes. </member> </members> </class> diff --git a/doc/classes/PhysicalBone3D.xml b/doc/classes/PhysicalBone3D.xml index 7d5d0f1691..06941c0a50 100644 --- a/doc/classes/PhysicalBone3D.xml +++ b/doc/classes/PhysicalBone3D.xml @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="PhysicalBone3D" inherits="PhysicsBody3D" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + A physics body used to make bones in a [Skeleton3D] react to physics. </brief_description> <description> - [b]Warning:[/b] With a non-uniform scale this node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size(s) of its collision shape(s) instead. + The [PhysicalBone3D] node is a physics body that can be used to make bones in a [Skeleton3D] react to physics. </description> <tutorials> </tutorials> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 949253c998..f06e6e5da1 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -824,6 +824,7 @@ Default value for [member ScrollContainer.scroll_deadzone], which will be used for all [ScrollContainer]s unless overridden. </member> <member name="gui/common/snap_controls_to_pixels" type="bool" setter="" getter="" default="true"> + If [code]true[/code], snaps [Control] node vertices to the nearest pixel to ensure they remain crisp even when the camera moves or zooms. </member> <member name="gui/common/swap_cancel_ok" type="bool" setter="" getter=""> If [code]true[/code], swaps [b]Cancel[/b] and [b]OK[/b] buttons in dialogs on Windows and UWP to follow interface conventions. [method DisplayServer.get_swap_cancel_ok] can be used to query whether buttons are swapped at run-time. @@ -1955,23 +1956,34 @@ [b]Note:[/b] Only [member physics/common/max_physics_steps_per_frame] physics ticks may be simulated per rendered frame at most. If more physics ticks have to be simulated per rendered frame to keep up with rendering, the project will appear to slow down (even if [code]delta[/code] is used consistently in physics calculations). Therefore, it is recommended to also increase [member physics/common/max_physics_steps_per_frame] if increasing [member physics/common/physics_ticks_per_second] significantly above its default value. </member> <member name="rendering/2d/sdf/oversize" type="int" setter="" getter="" default="1"> + Controls how much of the original viewport size should be covered by the 2D signed distance field. This SDF can be sampled in [CanvasItem] shaders and is used for [GPUParticles2D] collision. Higher values allow portions of occluders located outside the viewport to still be taken into account in the generated signed distance field, at the cost of performance. If you notice particles falling through [LightOccluder2D]s as the occluders leave the viewport, increase this setting. + The percentage specified is added on each axis and on both sides. For example, with the default setting of 120%, the signed distance field will cover 20% of the viewport's size outside the viewport on each side (top, right, bottom, left). + [b]Note:[/b] This property is only read when the project starts. To change the 2D SDF oversizing percentage at runtime, use [method RenderingServer.viewport_set_sdf_oversize_and_scale] instead. </member> <member name="rendering/2d/sdf/scale" type="int" setter="" getter="" default="1"> + The resolution scale to use for the 2D signed distance field. Higher values lead to a more precise and more stable signed distance field as the camera moves, at the cost of performance. The default value (50%) renders at half the resolution of the viewport size on each axis, which means the SDF is generated with 25% of the viewport's pixel count. + [b]Note:[/b] This property is only read when the project starts. To change the 2D SDF resolution scale at runtime, use [method RenderingServer.viewport_set_sdf_oversize_and_scale] instead. </member> <member name="rendering/2d/shadow_atlas/size" type="int" setter="" getter="" default="2048"> + The size of the 2D shadow atlas in pixels. Higher values result in more precise [Light2D] shadows, at the cost of performance and video memory usage. The specified value is rounded up to the nearest power of 2. + [b]Note:[/b] This property is only read when the project starts. To change the 2D shadow atlas size at runtime, use [method RenderingServer.canvas_set_shadow_texture_size] instead. </member> <member name="rendering/2d/snap/snap_2d_transforms_to_pixel" type="bool" setter="" getter="" default="false"> - If [code]true[/code], [CanvasItem] nodes will internally snap to full pixels. Their position can still be sub-pixel, but the decimals will not have effect. + If [code]true[/code], [CanvasItem] nodes will internally snap to full pixels. Their position can still be sub-pixel, but the decimals will not have effect. This can lead to a crisper appearance at the cost of less smooth movement, especially when [Camera2D] smoothing is enabled. + [b]Note:[/b] This property is only read when the project starts. To toggle 2D transform snapping at runtime, use [method RenderingServer.viewport_set_snap_2d_transforms_to_pixel] on the root [Viewport] instead. + [b]Note:[/b] [Control] nodes are snapped to the nearest pixel by default. This is controlled by [member gui/common/snap_controls_to_pixels]. </member> <member name="rendering/2d/snap/snap_2d_vertices_to_pixel" type="bool" setter="" getter="" default="false"> - If [code]true[/code], vertices of [CanvasItem] nodes will snap to full pixels. Only affects the final vertex positions, not the transforms. + If [code]true[/code], vertices of [CanvasItem] nodes will snap to full pixels. Only affects the final vertex positions, not the transforms. This can lead to a crisper appearance at the cost of less smooth movement, especially when [Camera2D] smoothing is enabled. + [b]Note:[/b] This property is only read when the project starts. To toggle 2D vertex snapping at runtime, use [method RenderingServer.viewport_set_snap_2d_vertices_to_pixel] on the root [Viewport] instead. + [b]Note:[/b] [Control] nodes are snapped to the nearest pixel by default. This is controlled by [member gui/common/snap_controls_to_pixels]. </member> <member name="rendering/anti_aliasing/quality/msaa_2d" type="int" setter="" getter="" default="0"> - Sets the number of MSAA samples to use for 2D/Canvas rendering (as a power of two). MSAA is used to reduce aliasing around the edges of polygons. A higher MSAA value results in smoother edges but can be significantly slower on some hardware. This has no effect on shader-induced aliasing or texture aliasing. + Sets the number of MSAA samples to use for 2D/Canvas rendering (as a power of two). MSAA is used to reduce aliasing around the edges of polygons. A higher MSAA value results in smoother edges but can be significantly slower on some hardware, especially integrated graphics due to their limited memory bandwidth. This has no effect on shader-induced aliasing or texture aliasing. [b]Note:[/b] MSAA is only supported in the Forward+ and Mobile rendering methods, not Compatibility. </member> <member name="rendering/anti_aliasing/quality/msaa_3d" type="int" setter="" getter="" default="0"> - Sets the number of MSAA samples to use for 3D rendering (as a power of two). MSAA is used to reduce aliasing around the edges of polygons. A higher MSAA value results in smoother edges but can be significantly slower on some hardware. See also bilinear scaling 3d [member rendering/scaling_3d/mode] for supersampling, which provides higher quality but is much more expensive. This has no effect on shader-induced aliasing or texture aliasing. + Sets the number of MSAA samples to use for 3D rendering (as a power of two). MSAA is used to reduce aliasing around the edges of polygons. A higher MSAA value results in smoother edges but can be significantly slower on some hardware, especially integrated graphics due to their limited memory bandwidth. See also [member rendering/scaling_3d/mode] for supersampling, which provides higher quality but is much more expensive. This has no effect on shader-induced aliasing or texture aliasing. [b]Note:[/b] MSAA is only supported in the Forward+ and Mobile rendering methods, not Compatibility. </member> <member name="rendering/anti_aliasing/quality/screen_space_aa" type="int" setter="" getter="" default="0"> @@ -1990,12 +2002,15 @@ [b]Note:[/b] TAA is only supported in the Forward+ rendering method, not Mobile or Compatibility. </member> <member name="rendering/anti_aliasing/screen_space_roughness_limiter/amount" type="float" setter="" getter="" default="0.25"> + [b]Note:[/b] This property is only read when the project starts. To control the screen-space roughness limiter at runtime, call [method RenderingServer.screen_space_roughness_limiter_set_active] instead. </member> <member name="rendering/anti_aliasing/screen_space_roughness_limiter/enabled" type="bool" setter="" getter="" default="true"> If [code]true[/code], enables a spatial filter to limit roughness in areas with high-frequency detail. This can help reduce specular aliasing to an extent, though not as much as enabling [member rendering/anti_aliasing/quality/use_taa]. This filter has a small performance cost, so consider disabling it if it doesn't benefit your scene noticeably. - [b]Note:[/b] TAA is only supported in the Forward+ and Mobile rendering methods, not Compatibility. + [b]Note:[/b] The screen-space roughness limiter is only supported in the Forward+ and Mobile rendering methods, not Compatibility. + [b]Note:[/b] This property is only read when the project starts. To control the screen-space roughness limiter at runtime, call [method RenderingServer.screen_space_roughness_limiter_set_active] instead. </member> <member name="rendering/anti_aliasing/screen_space_roughness_limiter/limit" type="float" setter="" getter="" default="0.18"> + [b]Note:[/b] This property is only read when the project starts. To control the screen-space roughness limiter at runtime, call [method RenderingServer.screen_space_roughness_limiter_set_active] instead. </member> <member name="rendering/camera/depth_of_field/depth_of_field_bokeh_quality" type="int" setter="" getter="" default="1"> Sets the quality of the depth of field effect. Higher quality takes more samples, which is slower but looks smoother. @@ -2068,13 +2083,16 @@ Sets the quality of the screen-space indirect lighting effect. Higher values take more samples and so will result in better quality, at the cost of performance. Setting to [code]Ultra[/code] will use the [member rendering/environment/ssil/adaptive_target] setting. </member> <member name="rendering/environment/subsurface_scattering/subsurface_scattering_depth_scale" type="float" setter="" getter="" default="0.01"> - Scales the depth over which the subsurface scattering effect is applied. A high value may allow light to scatter into a part of the mesh or another mesh that is close in screen space but far in depth. + Scales the depth over which the subsurface scattering effect is applied. A high value may allow light to scatter into a part of the mesh or another mesh that is close in screen space but far in depth. See also [member rendering/environment/subsurface_scattering/subsurface_scattering_scale]. + [b]Note:[/b] This property is only read when the project starts. To set the subsurface scattering depth scale at runtime, call [method RenderingServer.sub_surface_scattering_set_scale] instead. </member> <member name="rendering/environment/subsurface_scattering/subsurface_scattering_quality" type="int" setter="" getter="" default="1"> - Sets the quality of the subsurface scattering effect. Higher values are slower but look nicer. + Sets the quality of the subsurface scattering effect. Higher values are slower but look nicer. This affects the rendering of materials that have [member BaseMaterial3D.subsurf_scatter_enabled] set to [code]true[/code], along with [ShaderMaterial]s that set [code]SSS_STRENGTH[/code]. + [b]Note:[/b] This property is only read when the project starts. To set the subsurface scattering quality at runtime, call [method RenderingServer.sub_surface_scattering_set_quality] instead. </member> <member name="rendering/environment/subsurface_scattering/subsurface_scattering_scale" type="float" setter="" getter="" default="0.05"> - Scales the distance over which samples are taken for subsurface scattering effect. Changing this does not impact performance, but higher values will result in significant artifacts as the samples will become obviously spread out. A lower value results in a smaller spread of scattered light. + Scales the distance over which samples are taken for subsurface scattering effect. Changing this does not impact performance, but higher values will result in significant artifacts as the samples will become obviously spread out. A lower value results in a smaller spread of scattered light. See also [member rendering/environment/subsurface_scattering/subsurface_scattering_depth_scale]. + [b]Note:[/b] This property is only read when the project starts. To set the subsurface scattering scale at runtime, call [method RenderingServer.sub_surface_scattering_set_scale] instead. </member> <member name="rendering/environment/volumetric_fog/use_filter" type="int" setter="" getter="" default="1"> Enables filtering of the volumetric fog effect prior to integration. This substantially blurs the fog which reduces fine details but also smooths out harsh edges and aliasing artifacts. Disable when more detail is required. @@ -2114,12 +2132,21 @@ [b]Note:[/b] This property is only read when the project starts. To set half-resolution GI at run-time, call [method RenderingServer.gi_set_use_half_resolution] instead. </member> <member name="rendering/global_illumination/sdfgi/frames_to_converge" type="int" setter="" getter="" default="5"> + The number of frames to use for converging signed distance field global illumination. Higher values lead to a less noisy result, at the cost of taking a longer time to fully converge. This means the scene's global illumination will be too dark for a longer period of time, especially when the camera moves fast. The actual convergence speed depends on rendered framerate. For example, with the default setting of 30 frames, rendering at 60 FPS will make SDFGI fully converge after 0.5 seconds. See also [member rendering/global_illumination/sdfgi/frames_to_update_lights] and [member rendering/global_illumination/sdfgi/probe_ray_count]. + [b]Note:[/b] This property is only read when the project starts. To control SDFGI convergence speed at runtime, call [method RenderingServer.environment_set_sdfgi_frames_to_converge] instead. </member> <member name="rendering/global_illumination/sdfgi/frames_to_update_lights" type="int" setter="" getter="" default="2"> + The number of frames over which dynamic lights should be updated in signed distance field global illumination. Higher values take more time to update indirect lighting coming from dynamic lights, but result in better performance when many dynamic lights are present. See also [member rendering/global_illumination/sdfgi/frames_to_converge] and [member rendering/global_illumination/sdfgi/probe_ray_count]. + [b]Note:[/b] This only affects [Light3D] nodes whose [member Light3D.light_bake_mode] is [constant Light3D.BAKE_DYNAMIC] (which is the default). Consider making non-moving lights use the [constant Light3D.BAKE_STATIC] bake mode to improve performance. + [b]Note:[/b] This property is only read when the project starts. To control SDFGI light update speed at runtime, call [method RenderingServer.environment_set_sdfgi_frames_to_update_light] instead. </member> <member name="rendering/global_illumination/sdfgi/probe_ray_count" type="int" setter="" getter="" default="1"> + The number of rays to throw per frame when computing signed distance field global illumination. Higher values lead to a less noisy result, at the cost of performance. See also [member rendering/global_illumination/sdfgi/frames_to_converge] and [member rendering/global_illumination/sdfgi/frames_to_update_lights]. + [b]Note:[/b] This property is only read when the project starts. To control SDFGI quality at runtime, call [method RenderingServer.environment_set_sdfgi_ray_count] instead. </member> <member name="rendering/global_illumination/voxel_gi/quality" type="int" setter="" getter="" default="0"> + The VoxelGI quality to use. High quality leads to more precise lighting and better reflections, but is slower to render. This setting does not affect the baked data and doesn't require baking the [VoxelGI] again to apply. + [b]Note:[/b] This property is only read when the project starts. To control VoxelGI quality at runtime, call [method RenderingServer.voxel_gi_set_quality] instead. </member> <member name="rendering/lightmapping/bake_performance/max_rays_per_pass" type="int" setter="" getter="" default="32"> The maximum number of rays that can be thrown per pass when baking lightmaps with [LightmapGI]. Depending on the scene, adjusting this value may result in higher GPU utilization when baking lightmaps, leading to faster bake times. @@ -2161,10 +2188,10 @@ The framerate-independent update speed when representing dynamic object lighting from [LightmapProbe]s. Higher values make dynamic object lighting update faster. Higher values can prevent fast-moving objects from having "outdated" indirect lighting displayed on them, at the cost of possible flickering when an object moves from a bright area to a shaded area. </member> <member name="rendering/lights_and_shadows/directional_shadow/16_bits" type="bool" setter="" getter="" default="true"> - Use 16 bits for shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices. + Use 16 bits for the directional shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices. </member> <member name="rendering/lights_and_shadows/directional_shadow/size" type="int" setter="" getter="" default="4096"> - The directional shadow's size in pixels. Higher values will result in sharper shadows, at the cost of performance. The value will be rounded up to the nearest power of 2. + The directional shadow's size in pixels. Higher values will result in sharper shadows, at the cost of performance. The value is rounded up to the nearest power of 2. </member> <member name="rendering/lights_and_shadows/directional_shadow/size.mobile" type="int" setter="" getter="" default="2048"> Lower-end override for [member rendering/lights_and_shadows/directional_shadow/size] on mobile devices, due to performance concerns or driver support. @@ -2178,7 +2205,7 @@ Lower-end override for [member rendering/lights_and_shadows/directional_shadow/soft_shadow_filter_quality] on mobile devices, due to performance concerns or driver support. </member> <member name="rendering/lights_and_shadows/positional_shadow/atlas_16_bits" type="bool" setter="" getter="" default="true"> - Use 16 bits for shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices. + Use 16 bits for the omni/spot shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices. </member> <member name="rendering/lights_and_shadows/positional_shadow/atlas_quadrant_0_subdiv" type="int" setter="" getter="" default="2"> Subdivision quadrant size for shadow mapping. See shadow mapping documentation. @@ -2242,10 +2269,12 @@ [b]Note:[/b] This property is only read when the project starts. To adjust the automatic LOD threshold at runtime, set [member Viewport.mesh_lod_threshold] on the root [Viewport]. </member> <member name="rendering/occlusion_culling/bvh_build_quality" type="int" setter="" getter="" default="2"> - The [url=https://en.wikipedia.org/wiki/Bounding_volume_hierarchy]BVH[/url] quality to use when rendering the occlusion culling buffer. Higher values will result in more accurate occlusion culling, at the cost of higher CPU usage. + The [url=https://en.wikipedia.org/wiki/Bounding_volume_hierarchy]Bounding Volume Hierarchy[/url] quality to use when rendering the occlusion culling buffer. Higher values will result in more accurate occlusion culling, at the cost of higher CPU usage. See also [member rendering/occlusion_culling/occlusion_rays_per_thread]. + [b]Note:[/b] This property is only read when the project starts. To adjust the BVH build quality at runtime, use [method RenderingServer.viewport_set_occlusion_culling_build_quality]. </member> <member name="rendering/occlusion_culling/occlusion_rays_per_thread" type="int" setter="" getter="" default="512"> - Higher values will result in more accurate occlusion culling, at the cost of higher CPU usage. The occlusion culling buffer's pixel count is roughly equal to [code]occlusion_rays_per_thread * number_of_logical_cpu_cores[/code], so it will depend on the system's CPU. Therefore, CPUs with fewer cores will use a lower resolution to attempt keeping performance costs even across devices. + The number of occlusion rays traced per CPU thread. Higher values will result in more accurate occlusion culling, at the cost of higher CPU usage. The occlusion culling buffer's pixel count is roughly equal to [code]occlusion_rays_per_thread * number_of_logical_cpu_cores[/code], so it will depend on the system's CPU. Therefore, CPUs with fewer cores will use a lower resolution to attempt keeping performance costs even across devices. See also [member rendering/occlusion_culling/bvh_build_quality]. + [b]Note:[/b] This property is only read when the project starts. To adjust the number of occlusion rays traced per thread at runtime, use [method RenderingServer.viewport_set_occlusion_rays_per_thread]. </member> <member name="rendering/occlusion_culling/use_occlusion_culling" type="bool" setter="" getter="" default="false"> If [code]true[/code], [OccluderInstance3D] nodes will be usable for occlusion culling in 3D in the root viewport. In custom viewports, [member Viewport.use_occlusion_culling] must be set to [code]true[/code] instead. diff --git a/doc/classes/RDAttachmentFormat.xml b/doc/classes/RDAttachmentFormat.xml index 4d912da1ef..1c32041f4b 100644 --- a/doc/classes/RDAttachmentFormat.xml +++ b/doc/classes/RDAttachmentFormat.xml @@ -1,17 +1,22 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDAttachmentFormat" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Attachment format (used by [RenderingDevice]). </brief_description> <description> + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> <members> <member name="format" type="int" setter="set_format" getter="get_format" enum="RenderingDevice.DataFormat" default="36"> + The attachment's data format. </member> <member name="samples" type="int" setter="set_samples" getter="get_samples" enum="RenderingDevice.TextureSamples" default="0"> + The number of samples used when sampling the attachment. </member> <member name="usage_flags" type="int" setter="set_usage_flags" getter="get_usage_flags" default="0"> + The attachment's usage flags, which determine what can be done with it. </member> </members> </class> diff --git a/doc/classes/RDFramebufferPass.xml b/doc/classes/RDFramebufferPass.xml index b78658d559..5a296da19c 100644 --- a/doc/classes/RDFramebufferPass.xml +++ b/doc/classes/RDFramebufferPass.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDFramebufferPass" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Framebuffer pass attachment description. + Framebuffer pass attachment description (used by [RenderingDevice]). </brief_description> <description> This class contains the list of attachment descriptions for a framebuffer pass. Each points with an index to a previously supplied list of texture attachments. - Multipass framebuffers can optimize some configurations in mobile, on desktop they provide little to no advantage. + Multipass framebuffers can optimize some configurations in mobile. On desktop, they provide little to no advantage. + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> @@ -28,6 +29,7 @@ </members> <constants> <constant name="ATTACHMENT_UNUSED" value="-1"> + Attachment is unused. </constant> </constants> </class> diff --git a/doc/classes/RDPipelineColorBlendState.xml b/doc/classes/RDPipelineColorBlendState.xml index 7ce5157cc5..363349927e 100644 --- a/doc/classes/RDPipelineColorBlendState.xml +++ b/doc/classes/RDPipelineColorBlendState.xml @@ -1,19 +1,25 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDPipelineColorBlendState" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Pipeline color blend state (used by [RenderingDevice]). </brief_description> <description> + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> <members> <member name="attachments" type="RDPipelineColorBlendStateAttachment[]" setter="set_attachments" getter="get_attachments" default="[]"> + The attachments that are blended together. </member> <member name="blend_constant" type="Color" setter="set_blend_constant" getter="get_blend_constant" default="Color(0, 0, 0, 1)"> + The constant color to blend with. See also [method RenderingDevice.draw_list_set_blend_constants]. </member> <member name="enable_logic_op" type="bool" setter="set_enable_logic_op" getter="get_enable_logic_op" default="false"> + If [code]true[/code], performs the logic operation defined in [member logic_op]. </member> <member name="logic_op" type="int" setter="set_logic_op" getter="get_logic_op" enum="RenderingDevice.LogicOperation" default="0"> + The logic operation to perform for blending. Only effective if [member enable_logic_op] is [code]true[/code]. </member> </members> </class> diff --git a/doc/classes/RDPipelineColorBlendStateAttachment.xml b/doc/classes/RDPipelineColorBlendStateAttachment.xml index ff52be9b23..4892536814 100644 --- a/doc/classes/RDPipelineColorBlendStateAttachment.xml +++ b/doc/classes/RDPipelineColorBlendStateAttachment.xml @@ -1,8 +1,66 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDPipelineColorBlendStateAttachment" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Pipeline color blend state attachment (used by [RenderingDevice]). </brief_description> <description> + Controls how blending between source and destination fragments is performed when using [RenderingDevice]. + For reference, this is how common user-facing blend modes are implemented in Godot's 2D renderer: + [b]Mix:[/b] + [codeblock] + var attachment = RDPipelineColorBlendStateAttachment.new() + attachment.enable_blend = true + attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD + attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA + attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA + attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD + attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE + attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA + [/codeblock] + [b]Add:[/b] + [codeblock] + var attachment = RDPipelineColorBlendStateAttachment.new() + attachment.enable_blend = true + attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD + attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD + attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA + attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE + attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA + attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE + [/codeblock] + [b]Subtract:[/b] + [codeblock] + var attachment = RDPipelineColorBlendStateAttachment.new() + attachment.enable_blend = true + attachment.alpha_blend_op = RenderingDevice.BLEND_OP_SUBTRACT + attachment.color_blend_op = RenderingDevice.BLEND_OP_SUBTRACT + attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA + attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE + attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA + attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE + [/codeblock] + [b]Multiply:[/b] + [codeblock] + var attachment = RDPipelineColorBlendStateAttachment.new() + attachment.enable_blend = true + attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD + attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD + attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_DST_COLOR + attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ZERO + attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_DST_ALPHA + attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ZERO + [/codeblock] + [b]Pre-multiplied alpha:[/b] + [codeblock] + var attachment = RDPipelineColorBlendStateAttachment.new() + attachment.enable_blend = true + attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD + attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD + attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE + attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA + attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE + attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA + [/codeblock] </description> <tutorials> </tutorials> @@ -10,31 +68,43 @@ <method name="set_as_mix"> <return type="void" /> <description> + Convenience method to perform standard mix blending with straight (non-premultiplied) alpha. This sets [member enable_blend] to [code]true[/code], [member src_color_blend_factor] to [constant RenderingDevice.BLEND_FACTOR_SRC_ALPHA], [member dst_color_blend_factor] to [constant RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA], [member src_alpha_blend_factor] to [constant RenderingDevice.BLEND_FACTOR_SRC_ALPHA] and [member dst_alpha_blend_factor] to [constant RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA]. </description> </method> </methods> <members> <member name="alpha_blend_op" type="int" setter="set_alpha_blend_op" getter="get_alpha_blend_op" enum="RenderingDevice.BlendOperation" default="0"> + The blend mode to use for the alpha channel. </member> <member name="color_blend_op" type="int" setter="set_color_blend_op" getter="get_color_blend_op" enum="RenderingDevice.BlendOperation" default="0"> + The blend mode to use for the red/green/blue color channels. </member> <member name="dst_alpha_blend_factor" type="int" setter="set_dst_alpha_blend_factor" getter="get_dst_alpha_blend_factor" enum="RenderingDevice.BlendFactor" default="0"> + Controls how the blend factor for the alpha channel is determined based on the destination's fragments. </member> <member name="dst_color_blend_factor" type="int" setter="set_dst_color_blend_factor" getter="get_dst_color_blend_factor" enum="RenderingDevice.BlendFactor" default="0"> + Controls how the blend factor for the color channels is determined based on the destination's fragments. </member> <member name="enable_blend" type="bool" setter="set_enable_blend" getter="get_enable_blend" default="false"> + If [code]true[/code], performs blending between the source and destination according to the factors defined in [member src_color_blend_factor], [member dst_color_blend_factor], [member src_alpha_blend_factor] and [member dst_alpha_blend_factor]. The blend modes [member color_blend_op] and [member alpha_blend_op] are also taken into account, with [member write_r], [member write_g], [member write_b] and [member write_a] controlling the output. </member> <member name="src_alpha_blend_factor" type="int" setter="set_src_alpha_blend_factor" getter="get_src_alpha_blend_factor" enum="RenderingDevice.BlendFactor" default="0"> + Controls how the blend factor for the alpha channel is determined based on the source's fragments. </member> <member name="src_color_blend_factor" type="int" setter="set_src_color_blend_factor" getter="get_src_color_blend_factor" enum="RenderingDevice.BlendFactor" default="0"> + Controls how the blend factor for the color channels is determined based on the source's fragments. </member> <member name="write_a" type="bool" setter="set_write_a" getter="get_write_a" default="true"> + If [code]true[/code], writes the new alpha channel to the final result. </member> <member name="write_b" type="bool" setter="set_write_b" getter="get_write_b" default="true"> + If [code]true[/code], writes the new blue color channel to the final result. </member> <member name="write_g" type="bool" setter="set_write_g" getter="get_write_g" default="true"> + If [code]true[/code], writes the new green color channel to the final result. </member> <member name="write_r" type="bool" setter="set_write_r" getter="get_write_r" default="true"> + If [code]true[/code], writes the new red color channel to the final result. </member> </members> </class> diff --git a/doc/classes/RDPipelineDepthStencilState.xml b/doc/classes/RDPipelineDepthStencilState.xml index 65a83a962a..3893e0188d 100644 --- a/doc/classes/RDPipelineDepthStencilState.xml +++ b/doc/classes/RDPipelineDepthStencilState.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDPipelineDepthStencilState" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Pipeline depth/stencil state (used by [RenderingDevice]). </brief_description> <description> + [RDPipelineDepthStencilState] controls the way depth and stencil comparisons are performed when sampling those values using [RenderingDevice]. </description> <tutorials> </tutorials> @@ -30,6 +32,7 @@ <member name="enable_depth_range" type="bool" setter="set_enable_depth_range" getter="get_enable_depth_range" default="false"> </member> <member name="enable_depth_test" type="bool" setter="set_enable_depth_test" getter="get_enable_depth_test" default="false"> + If [code]true[/code], enables depth testing which allows objects to be automatically occluded by other objects based on their depth. This also allows objects to be partially occluded by other objects. If [code]false[/code], objects will appear in the order they were drawn (like in Godot's 2D renderer). </member> <member name="enable_depth_write" type="bool" setter="set_enable_depth_write" getter="get_enable_depth_write" default="false"> </member> diff --git a/doc/classes/RDPipelineMultisampleState.xml b/doc/classes/RDPipelineMultisampleState.xml index 2e72ca2bae..635a2480de 100644 --- a/doc/classes/RDPipelineMultisampleState.xml +++ b/doc/classes/RDPipelineMultisampleState.xml @@ -1,23 +1,31 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDPipelineMultisampleState" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Pipeline multisample state (used by [RenderingDevice]). </brief_description> <description> + [RDPipelineMultisampleState] is used to control how multisample or supersample antialiasing is being performed when rendering using [RenderingDevice]. </description> <tutorials> </tutorials> <members> <member name="enable_alpha_to_coverage" type="bool" setter="set_enable_alpha_to_coverage" getter="get_enable_alpha_to_coverage" default="false"> + If [code]true[/code], alpha to coverage is enabled. This generates a temporary coverage value based on the alpha component of the fragment's first color output. This allows alpha transparency to make use of multisample antialiasing. </member> <member name="enable_alpha_to_one" type="bool" setter="set_enable_alpha_to_one" getter="get_enable_alpha_to_one" default="false"> + If [code]true[/code], alpha is forced to either [code]0.0[/code] or [code]1.0[/code]. This allows hardening the edges of antialiased alpha transparencies. Only relevant if [member enable_alpha_to_coverage] is [code]true[/code]. </member> <member name="enable_sample_shading" type="bool" setter="set_enable_sample_shading" getter="get_enable_sample_shading" default="false"> + If [code]true[/code], enables per-sample shading which replaces MSAA by SSAA. This provides higher quality antialiasing that works with transparent (alpha scissor) edges. This has a very high performance cost. See also [member min_sample_shading]. See the [url=https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#primsrast-sampleshading]per-sample shading Vulkan documentation[/url] for more details. </member> <member name="min_sample_shading" type="float" setter="set_min_sample_shading" getter="get_min_sample_shading" default="0.0"> + The multiplier of [member sample_count] that determines how many samples are performed for each fragment. Must be between [code]0.0[/code] and [code]1.0[/code] (inclusive). Only effective if [member enable_sample_shading] is [code]true[/code]. If [member min_sample_shading] is [code]1.0[/code], fragment invocation must only read from the coverage index sample. Tile image access must not be used if [member enable_sample_shading] is [i]not[/i] [code]1.0[/code]. </member> <member name="sample_count" type="int" setter="set_sample_count" getter="get_sample_count" enum="RenderingDevice.TextureSamples" default="0"> + The number of MSAA samples (or SSAA samples if [member enable_sample_shading] is [code]true[/code]) to perform. Higher values result in better antialiasing, at the cost of performance. </member> <member name="sample_masks" type="int[]" setter="set_sample_masks" getter="get_sample_masks" default="[]"> + The sampleSee the [url=https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-samplemask]sample mask Vulkan documentation[/url] for more details. </member> </members> </class> diff --git a/doc/classes/RDPipelineRasterizationState.xml b/doc/classes/RDPipelineRasterizationState.xml index 80aef26d2b..79d0eeef48 100644 --- a/doc/classes/RDPipelineRasterizationState.xml +++ b/doc/classes/RDPipelineRasterizationState.xml @@ -1,13 +1,16 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDPipelineRasterizationState" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Pipeline rasterization state (used by [RenderingDevice]). </brief_description> <description> + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> <members> <member name="cull_mode" type="int" setter="set_cull_mode" getter="get_cull_mode" enum="RenderingDevice.PolygonCullMode" default="0"> + The cull mode to use when drawing polygons, which determines whether front faces or backfaces are hidden. </member> <member name="depth_bias_clamp" type="float" setter="set_depth_bias_clamp" getter="get_depth_bias_clamp" default="0.0"> </member> @@ -18,16 +21,21 @@ <member name="depth_bias_slope_factor" type="float" setter="set_depth_bias_slope_factor" getter="get_depth_bias_slope_factor" default="0.0"> </member> <member name="discard_primitives" type="bool" setter="set_discard_primitives" getter="get_discard_primitives" default="false"> + If [code]true[/code], primitives are discarded immediately before the rasterization stage. </member> <member name="enable_depth_clamp" type="bool" setter="set_enable_depth_clamp" getter="get_enable_depth_clamp" default="false"> </member> <member name="front_face" type="int" setter="set_front_face" getter="get_front_face" enum="RenderingDevice.PolygonFrontFace" default="0"> + The winding order to use to determine which face of a triangle is considered its front face. </member> <member name="line_width" type="float" setter="set_line_width" getter="get_line_width" default="1.0"> + THe line width to use when drawing lines (in pixels). Thick lines may not be supported on all hardware. </member> <member name="patch_control_points" type="int" setter="set_patch_control_points" getter="get_patch_control_points" default="1"> + The number of control points to use when drawing a patch with tessellation enabled. Higher values result in higher quality at the cost of performance. </member> <member name="wireframe" type="bool" setter="set_wireframe" getter="get_wireframe" default="false"> + If [code]true[/code], performs wireframe rendering for triangles instead of flat or textured rendering. </member> </members> </class> diff --git a/doc/classes/RDPipelineSpecializationConstant.xml b/doc/classes/RDPipelineSpecializationConstant.xml index 3c1c8b3a76..9b1ca98708 100644 --- a/doc/classes/RDPipelineSpecializationConstant.xml +++ b/doc/classes/RDPipelineSpecializationConstant.xml @@ -1,15 +1,20 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDPipelineSpecializationConstant" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Pipeline specialization constant (used by [RenderingDevice]). </brief_description> <description> + A [i]specialization constant[/i] is a way to create additional variants of shaders without actually increasing the number of shader versions that are compiled. This allows improving performance by reducing the number of shader versions and reducing [code]if[/code] branching, while still allowing shaders to be flexible for different use cases. + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> <members> <member name="constant_id" type="int" setter="set_constant_id" getter="get_constant_id" default="0"> + The identifier of the specialization constant. This is a value starting from [code]0[/code] and that increments for every different specialization constant for a given shader. </member> <member name="value" type="Variant" setter="set_value" getter="get_value"> + The specialization constant's value. Only [bool], [int] and [float] types are valid for specialization constants. </member> </members> </class> diff --git a/doc/classes/RDSamplerState.xml b/doc/classes/RDSamplerState.xml index 3ddc73a05e..464fe61543 100644 --- a/doc/classes/RDSamplerState.xml +++ b/doc/classes/RDSamplerState.xml @@ -1,41 +1,57 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDSamplerState" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Sampler state (used by [RenderingDevice]). </brief_description> <description> + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> <members> <member name="anisotropy_max" type="float" setter="set_anisotropy_max" getter="get_anisotropy_max" default="1.0"> + Maximum anisotropy that can be used when sampling. Only effective if [member use_anisotropy] is [code]true[/code]. Higher values result in a sharper sampler at oblique angles, at the cost of performance (due to memory bandwidth). This value may be limited by the graphics hardware in use. Most graphics hardware only supports values up to [code]16.0[/code]. + If [member anisotropy_max] is [code]1.0[/code], forcibly disables anisotropy even if [member use_anisotropy] is [code]true[/code]. </member> <member name="border_color" type="int" setter="set_border_color" getter="get_border_color" enum="RenderingDevice.SamplerBorderColor" default="2"> + The border color that will be returned when sampling outside the sampler's bounds and the [member repeat_u], [member repeat_v] or [member repeat_w] modes have repeating disabled. </member> <member name="compare_op" type="int" setter="set_compare_op" getter="get_compare_op" enum="RenderingDevice.CompareOperator" default="7"> + The compare operation to use. Only effective if [member enable_compare] is [code]true[/code]. </member> <member name="enable_compare" type="bool" setter="set_enable_compare" getter="get_enable_compare" default="false"> + If [code]true[/code], returned values will be based on the comparison operation defined in [member compare_op]. This is a hardware-based approach and is therefore faster than performing this manually in a shader. For example, compare operations are used for shadow map rendering by comparing depth values from a shadow sampler. </member> <member name="lod_bias" type="float" setter="set_lod_bias" getter="get_lod_bias" default="0.0"> + The mipmap LOD bias to use. Positive values will make the sampler blurrier at a given distance, while negative values will make the sampler sharper at a given distance (at the risk of looking grainy). Recommended values are between [code]-0.5[/code] and [code]0.0[/code]. Only effective if the sampler has mipmaps available. </member> <member name="mag_filter" type="int" setter="set_mag_filter" getter="get_mag_filter" enum="RenderingDevice.SamplerFilter" default="0"> + The sampler's magnification filter. </member> <member name="max_lod" type="float" setter="set_max_lod" getter="get_max_lod" default="1e+20"> + The maximum mipmap LOD bias to display (lowest resolution). Only effective if the sampler has mipmaps available. </member> <member name="min_filter" type="int" setter="set_min_filter" getter="get_min_filter" enum="RenderingDevice.SamplerFilter" default="0"> </member> <member name="min_lod" type="float" setter="set_min_lod" getter="get_min_lod" default="0.0"> + The minimum mipmap LOD bias to display (highest resolution). Only effective if the sampler has mipmaps available. </member> <member name="mip_filter" type="int" setter="set_mip_filter" getter="get_mip_filter" enum="RenderingDevice.SamplerFilter" default="0"> + The filtering method to use for mipmaps. </member> <member name="repeat_u" type="int" setter="set_repeat_u" getter="get_repeat_u" enum="RenderingDevice.SamplerRepeatMode" default="2"> + The repeat mode to use along the U axis of UV coordinates. This affects the returned values if sampling outside the UV bounds. </member> <member name="repeat_v" type="int" setter="set_repeat_v" getter="get_repeat_v" enum="RenderingDevice.SamplerRepeatMode" default="2"> + The repeat mode to use along the V axis of UV coordinates. This affects the returned values if sampling outside the UV bounds. </member> <member name="repeat_w" type="int" setter="set_repeat_w" getter="get_repeat_w" enum="RenderingDevice.SamplerRepeatMode" default="2"> + The repeat mode to use along the W axis of UV coordinates. This affects the returned values if sampling outside the UV bounds. Only effective for 3D samplers. </member> <member name="unnormalized_uvw" type="bool" setter="set_unnormalized_uvw" getter="get_unnormalized_uvw" default="false"> </member> <member name="use_anisotropy" type="bool" setter="set_use_anisotropy" getter="get_use_anisotropy" default="false"> + If [code]true[/code], perform anisotropic sampling. See [member anisotropy_max]. </member> </members> </class> diff --git a/doc/classes/RDShaderFile.xml b/doc/classes/RDShaderFile.xml index 0d2217b507..3097573858 100644 --- a/doc/classes/RDShaderFile.xml +++ b/doc/classes/RDShaderFile.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDShaderFile" inherits="Resource" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Compiled shader file in SPIR-V form (used by [RenderingDevice]). Not to be confused with Godot's own [Shader]. </brief_description> <description> + Compiled shader file in SPIR-V form. + See also [RDShaderSource]. [RDShaderFile] is only meant to be used with the [RenderingDevice] API. It should not be confused with Godot's own [Shader] resource, which is what Godot's various nodes use for high-level shader programming. </description> <tutorials> </tutorials> @@ -11,11 +14,13 @@ <return type="RDShaderSPIRV" /> <param index="0" name="version" type="StringName" default="&""" /> <description> + Returns the SPIR-V intermediate representation for the specified shader [param version]. </description> </method> <method name="get_version_list" qualifiers="const"> <return type="PackedStringArray" /> <description> + Returns the list of compiled versions for this shader. </description> </method> <method name="set_bytecode"> @@ -23,11 +28,13 @@ <param index="0" name="bytecode" type="RDShaderSPIRV" /> <param index="1" name="version" type="StringName" default="&""" /> <description> + Sets the SPIR-V [param bytecode] that will be compiled for the specified [param version]. </description> </method> </methods> <members> <member name="base_error" type="String" setter="set_base_error" getter="get_base_error" default=""""> + The base compilation error message, which indicates errors not related to a specific shader stage if non-empty. If empty, shader compilation is not necessarily successful (check [RDShaderSPIRV]'s error message members). </member> </members> </class> diff --git a/doc/classes/RDShaderSPIRV.xml b/doc/classes/RDShaderSPIRV.xml index c17699882b..3fc69431d2 100644 --- a/doc/classes/RDShaderSPIRV.xml +++ b/doc/classes/RDShaderSPIRV.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDShaderSPIRV" inherits="Resource" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + SPIR-V intermediate representation as part of a [RDShaderFile] (used by [RenderingDevice]). </brief_description> <description> + [RDShaderSPIRV] represents a [RDShaderFile]'s [url=https://www.khronos.org/spir/]SPIR-V[/url] code for various shader stages, as well as possible compilation error messages. SPIR-V a low-level intermediate shader representation. This intermediate representation is not used directly by GPUs for rendering, but it can be compiled into binary shaders that GPUs can understand. Unlike compiled shaders, SPIR-V is portable across GPU models and driver versions. + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> @@ -11,12 +14,14 @@ <return type="PackedByteArray" /> <param index="0" name="stage" type="int" enum="RenderingDevice.ShaderStage" /> <description> + Equivalent to getting one of [member bytecode_compute], [member bytecode_fragment], [member bytecode_tesselation_control], [member bytecode_tesselation_evaluation], [member bytecode_vertex]. </description> </method> <method name="get_stage_compile_error" qualifiers="const"> <return type="String" /> <param index="0" name="stage" type="int" enum="RenderingDevice.ShaderStage" /> <description> + Returns the compilation error message for the given shader [param stage]. Equivalent to getting one of [member compile_error_compute], [member compile_error_fragment], [member compile_error_tesselation_control], [member compile_error_tesselation_evaluation], [member compile_error_vertex]. </description> </method> <method name="set_stage_bytecode"> @@ -24,6 +29,7 @@ <param index="0" name="stage" type="int" enum="RenderingDevice.ShaderStage" /> <param index="1" name="bytecode" type="PackedByteArray" /> <description> + Sets the SPIR-V [param bytecode] for the given shader [param stage]. Equivalent to setting one of [member bytecode_compute], [member bytecode_fragment], [member bytecode_tesselation_control], [member bytecode_tesselation_evaluation], [member bytecode_vertex]. </description> </method> <method name="set_stage_compile_error"> @@ -31,29 +37,40 @@ <param index="0" name="stage" type="int" enum="RenderingDevice.ShaderStage" /> <param index="1" name="compile_error" type="String" /> <description> + Sets the compilation error message for the given shader [param stage] to [param compile_error]. Equivalent to setting one of [member compile_error_compute], [member compile_error_fragment], [member compile_error_tesselation_control], [member compile_error_tesselation_evaluation], [member compile_error_vertex]. </description> </method> </methods> <members> <member name="bytecode_compute" type="PackedByteArray" setter="set_stage_bytecode" getter="get_stage_bytecode" default="PackedByteArray()"> + The SPIR-V bytecode for the compute shader stage. </member> <member name="bytecode_fragment" type="PackedByteArray" setter="set_stage_bytecode" getter="get_stage_bytecode" default="PackedByteArray()"> + The SPIR-V bytecode for the fragment shader stage. </member> <member name="bytecode_tesselation_control" type="PackedByteArray" setter="set_stage_bytecode" getter="get_stage_bytecode" default="PackedByteArray()"> + The SPIR-V bytecode for the tessellation control shader stage. </member> <member name="bytecode_tesselation_evaluation" type="PackedByteArray" setter="set_stage_bytecode" getter="get_stage_bytecode" default="PackedByteArray()"> + The SPIR-V bytecode for the tessellation evaluation shader stage. </member> <member name="bytecode_vertex" type="PackedByteArray" setter="set_stage_bytecode" getter="get_stage_bytecode" default="PackedByteArray()"> + The SPIR-V bytecode for the vertex shader stage. </member> <member name="compile_error_compute" type="String" setter="set_stage_compile_error" getter="get_stage_compile_error" default=""""> + The compilation error message for the compute shader stage (set by the SPIR-V compiler and Godot). If empty, shader compilation was successful. </member> <member name="compile_error_fragment" type="String" setter="set_stage_compile_error" getter="get_stage_compile_error" default=""""> + The compilation error message for the fragment shader stage (set by the SPIR-V compiler and Godot). If empty, shader compilation was successful. </member> <member name="compile_error_tesselation_control" type="String" setter="set_stage_compile_error" getter="get_stage_compile_error" default=""""> + The compilation error message for the tessellation control shader stage (set by the SPIR-V compiler and Godot). If empty, shader compilation was successful. </member> <member name="compile_error_tesselation_evaluation" type="String" setter="set_stage_compile_error" getter="get_stage_compile_error" default=""""> + The compilation error message for the tessellation evaluation shader stage (set by the SPIR-V compiler and Godot). If empty, shader compilation was successful. </member> <member name="compile_error_vertex" type="String" setter="set_stage_compile_error" getter="get_stage_compile_error" default=""""> + The compilation error message for the vertex shader stage (set by the SPIR-V compiler and Godot). If empty, shader compilation was successful. </member> </members> </class> diff --git a/doc/classes/RDShaderSource.xml b/doc/classes/RDShaderSource.xml index d7fbb6a1ee..054e882b91 100644 --- a/doc/classes/RDShaderSource.xml +++ b/doc/classes/RDShaderSource.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDShaderSource" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Shader source code (used by [RenderingDevice]). </brief_description> <description> + Shader source code in text form. + See also [RDShaderFile]. [RDShaderSource] is only meant to be used with the [RenderingDevice] API. It should not be confused with Godot's own [Shader] resource, which is what Godot's various nodes use for high-level shader programming. </description> <tutorials> </tutorials> @@ -11,6 +14,7 @@ <return type="String" /> <param index="0" name="stage" type="int" enum="RenderingDevice.ShaderStage" /> <description> + Returns source code for the specified shader [param stage]. Equivalent to getting one of [member source_compute], [member source_fragment], [member source_tesselation_control], [member source_tesselation_evaluation] or [member source_vertex]. </description> </method> <method name="set_stage_source"> @@ -18,21 +22,28 @@ <param index="0" name="stage" type="int" enum="RenderingDevice.ShaderStage" /> <param index="1" name="source" type="String" /> <description> + Sets [param source] code for the specified shader [param stage]. Equivalent to setting one of [member source_compute], [member source_fragment], [member source_tesselation_control], [member source_tesselation_evaluation] or [member source_vertex]. </description> </method> </methods> <members> <member name="language" type="int" setter="set_language" getter="get_language" enum="RenderingDevice.ShaderLanguage" default="0"> + The language the shader is written in. </member> <member name="source_compute" type="String" setter="set_stage_source" getter="get_stage_source" default=""""> + Source code for the shader's compute stage. </member> <member name="source_fragment" type="String" setter="set_stage_source" getter="get_stage_source" default=""""> + Source code for the shader's fragment stage. </member> <member name="source_tesselation_control" type="String" setter="set_stage_source" getter="get_stage_source" default=""""> + Source code for the shader's tessellation control stage. </member> <member name="source_tesselation_evaluation" type="String" setter="set_stage_source" getter="get_stage_source" default=""""> + Source code for the shader's tessellation evaluation stage. </member> <member name="source_vertex" type="String" setter="set_stage_source" getter="get_stage_source" default=""""> + Source code for the shader's vertex stage. </member> </members> </class> diff --git a/doc/classes/RDTextureFormat.xml b/doc/classes/RDTextureFormat.xml index 6ba5a62113..ff674a8d7e 100644 --- a/doc/classes/RDTextureFormat.xml +++ b/doc/classes/RDTextureFormat.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDTextureFormat" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Texture format (used by [RenderingDevice]). </brief_description> <description> + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> @@ -22,22 +24,31 @@ </methods> <members> <member name="array_layers" type="int" setter="set_array_layers" getter="get_array_layers" default="1"> + The number of layers in the texture. Only relevant for 2D texture arrays. </member> <member name="depth" type="int" setter="set_depth" getter="get_depth" default="1"> + The texture's depth (in pixels). This is always [code]1[/code] for 2D textures. </member> <member name="format" type="int" setter="set_format" getter="get_format" enum="RenderingDevice.DataFormat" default="8"> + The texture's pixel data format. </member> <member name="height" type="int" setter="set_height" getter="get_height" default="1"> + The texture's height (in pixels). </member> <member name="mipmaps" type="int" setter="set_mipmaps" getter="get_mipmaps" default="1"> + The number of mipmaps available in the texture. </member> <member name="samples" type="int" setter="set_samples" getter="get_samples" enum="RenderingDevice.TextureSamples" default="0"> + The number of samples used when sampling the texture. </member> <member name="texture_type" type="int" setter="set_texture_type" getter="get_texture_type" enum="RenderingDevice.TextureType" default="1"> + The texture type. </member> <member name="usage_bits" type="int" setter="set_usage_bits" getter="get_usage_bits" enum="RenderingDevice.TextureUsageBits" default="0"> + The texture's usage bits, which determine what can be done using the texture. </member> <member name="width" type="int" setter="set_width" getter="get_width" default="1"> + The texture's width (in pixels). </member> </members> </class> diff --git a/doc/classes/RDTextureView.xml b/doc/classes/RDTextureView.xml index 064bd11319..4e4e93f88a 100644 --- a/doc/classes/RDTextureView.xml +++ b/doc/classes/RDTextureView.xml @@ -1,21 +1,28 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDTextureView" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Texture view (used by [RenderingDevice]). </brief_description> <description> + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> <members> <member name="format_override" type="int" setter="set_format_override" getter="get_format_override" enum="RenderingDevice.DataFormat" default="218"> + Optional override for the data format to return sampled values in. The default value of [constant RenderingDevice.DATA_FORMAT_MAX] does not override the format. </member> <member name="swizzle_a" type="int" setter="set_swizzle_a" getter="get_swizzle_a" enum="RenderingDevice.TextureSwizzle" default="6"> + The channel to sample when sampling the alpha channel. </member> <member name="swizzle_b" type="int" setter="set_swizzle_b" getter="get_swizzle_b" enum="RenderingDevice.TextureSwizzle" default="5"> + The channel to sample when sampling the blue color channel. </member> <member name="swizzle_g" type="int" setter="set_swizzle_g" getter="get_swizzle_g" enum="RenderingDevice.TextureSwizzle" default="4"> + The channel to sample when sampling the green color channel. </member> <member name="swizzle_r" type="int" setter="set_swizzle_r" getter="get_swizzle_r" enum="RenderingDevice.TextureSwizzle" default="3"> + The channel to sample when sampling the red color channel. </member> </members> </class> diff --git a/doc/classes/RDUniform.xml b/doc/classes/RDUniform.xml index 9fb2979676..a2d05502e7 100644 --- a/doc/classes/RDUniform.xml +++ b/doc/classes/RDUniform.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDUniform" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Shader uniform (used by [RenderingDevice]). </brief_description> <description> + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> @@ -26,8 +28,10 @@ </methods> <members> <member name="binding" type="int" setter="set_binding" getter="get_binding" default="0"> + The uniform's binding. </member> <member name="uniform_type" type="int" setter="set_uniform_type" getter="get_uniform_type" enum="RenderingDevice.UniformType" default="3"> + The uniform's data type. </member> </members> </class> diff --git a/doc/classes/RDVertexAttribute.xml b/doc/classes/RDVertexAttribute.xml index f5c7d08ac9..9347edf9db 100644 --- a/doc/classes/RDVertexAttribute.xml +++ b/doc/classes/RDVertexAttribute.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RDVertexAttribute" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Vertex attribute (used by [RenderingDevice]). </brief_description> <description> + This object is used by [RenderingDevice]. </description> <tutorials> </tutorials> diff --git a/doc/classes/ReflectionProbe.xml b/doc/classes/ReflectionProbe.xml index f890831fa4..42922d51e2 100644 --- a/doc/classes/ReflectionProbe.xml +++ b/doc/classes/ReflectionProbe.xml @@ -15,13 +15,13 @@ </tutorials> <members> <member name="ambient_color" type="Color" setter="set_ambient_color" getter="get_ambient_color" default="Color(0, 0, 0, 1)"> - The custom ambient color to use within the [ReflectionProbe]'s [member size]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR]. + The custom ambient color to use within the [ReflectionProbe]'s box defined by its [member size]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR]. </member> <member name="ambient_color_energy" type="float" setter="set_ambient_color_energy" getter="get_ambient_color_energy" default="1.0"> - The custom ambient color energy to use within the [ReflectionProbe]'s [member size]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR]. + The custom ambient color energy to use within the [ReflectionProbe]'s box defined by its [member size]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR]. </member> <member name="ambient_mode" type="int" setter="set_ambient_mode" getter="get_ambient_mode" enum="ReflectionProbe.AmbientMode" default="1"> - The ambient color to use within the [ReflectionProbe]'s [member size]. The ambient color will smoothly blend with other [ReflectionProbe]s and the rest of the scene (outside the [ReflectionProbe]'s [member size]). + The ambient color to use within the [ReflectionProbe]'s box defined by its [member size]. The ambient color will smoothly blend with other [ReflectionProbe]s and the rest of the scene (outside the [ReflectionProbe]'s box defined by its [member size]). </member> <member name="box_projection" type="bool" setter="set_enable_box_projection" getter="is_box_projection_enabled" default="false"> If [code]true[/code], enables box projection. This makes reflections look more correct in rectangle-shaped rooms by offsetting the reflection center depending on the camera's location. @@ -41,7 +41,7 @@ </member> <member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance" default="0.0"> The maximum distance away from the [ReflectionProbe] an object can be before it is culled. Decrease this to improve performance, especially when using the [constant UPDATE_ALWAYS] [member update_mode]. - [b]Note:[/b] The maximum reflection distance is always at least equal to the probe's extents. This means that decreasing [member max_distance] will not always cull objects from reflections, especially if the reflection probe's [member size] is already large. + [b]Note:[/b] The maximum reflection distance is always at least equal to the probe's extents. This means that decreasing [member max_distance] will not always cull objects from reflections, especially if the reflection probe's box defined by its [member size] is already large. </member> <member name="mesh_lod_threshold" type="float" setter="set_mesh_lod_threshold" getter="get_mesh_lod_threshold" default="1.0"> The automatic LOD bias to use for meshes rendered within the [ReflectionProbe] (this is analog to [member Viewport.mesh_lod_threshold]). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to [code]0.0[/code], automatic LOD is disabled. Increase [member mesh_lod_threshold] to improve performance at the cost of geometry detail, especially when using the [constant UPDATE_ALWAYS] [member update_mode]. @@ -66,13 +66,13 @@ Update the probe every frame. This provides better results for fast-moving dynamic objects (such as cars). However, it has a significant performance cost. Due to the cost, it's recommended to only use one ReflectionProbe with [constant UPDATE_ALWAYS] at most per scene. For all other use cases, use [constant UPDATE_ONCE]. </constant> <constant name="AMBIENT_DISABLED" value="0" enum="AmbientMode"> - Do not apply any ambient lighting inside the [ReflectionProbe]'s [member size]. + Do not apply any ambient lighting inside the [ReflectionProbe]'s box defined by its [member size]. </constant> <constant name="AMBIENT_ENVIRONMENT" value="1" enum="AmbientMode"> - Apply automatically-sourced environment lighting inside the [ReflectionProbe]'s [member size]. + Apply automatically-sourced environment lighting inside the [ReflectionProbe]'s box defined by its [member size]. </constant> <constant name="AMBIENT_COLOR" value="2" enum="AmbientMode"> - Apply custom ambient lighting inside the [ReflectionProbe]'s [member size]. See [member ambient_color] and [member ambient_color_energy]. + Apply custom ambient lighting inside the [ReflectionProbe]'s box defined by its [member size]. See [member ambient_color] and [member ambient_color_energy]. </constant> </constants> </class> diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml index b9f6a009fb..651c085dd4 100644 --- a/doc/classes/RenderingDevice.xml +++ b/doc/classes/RenderingDevice.xml @@ -4,13 +4,14 @@ Abstraction for working with modern low-level graphics APIs. </brief_description> <description> - [RenderingDevice] is an abstraction for working with modern low-level graphics APIs such as Vulkan. - On startup, Godot creates a global [RenderingDevice] which can be retrieved using [method RenderingServer.get_rendering_device]. This global RenderingDevice performs drawing to the screen. - Internally, [RenderingDevice] is used in Godot to provide support for several modern low-level graphics APIs while reducing the amount of code duplication required. + [RenderingDevice] is an abstraction for working with modern low-level graphics APIs such as Vulkan. Compared to [RenderingServer] (which works with Godot's own rendering subsystems), [RenderingDevice] is much lower-level and allows working more directly with the underlying graphics APIs. [RenderingDevice] is used in Godot to provide support for several modern low-level graphics APIs while reducing the amount of code duplication required. [RenderingDevice] can also be used in your own projects to perform things that are not exposed by [RenderingServer] or high-level nodes, such as using compute shaders. + On startup, Godot creates a global [RenderingDevice] which can be retrieved using [method RenderingServer.get_rendering_device]. This global [RenderingDevice] performs drawing to the screen. [b]Local RenderingDevices:[/b] Using [method RenderingServer.create_local_rendering_device], you can create "secondary" rendering devices to perform drawing and GPU compute operations on separate threads. + [b]Note:[/b] [RenderingDevice] assumes intermediate knowledge of modern graphics APIs such as Vulkan, Direct3D 12, Metal or WebGPU. These graphics APIs are lower-level than OpenGL or Direct3D 11, requiring you to perform what was previously done by the graphics driver itself. If you have difficulty understanding the concepts used in this class, follow the [url=https://vulkan-tutorial.com/]Vulkan Tutorial[/url] or [url=https://vkguide.dev/]Vulkan Guide[/url]. It's recommended to have existing modern OpenGL or Direct3D 11 knowledge before attempting to learn a low-level graphics API. [b]Note:[/b] [RenderingDevice] is not available when running in headless mode or when using the Compatibility rendering method. </description> <tutorials> + <link title="Using compute shaders">https://docs.godotengine.org/en/latest/tutorials/shaders/compute_shaders.html</link> </tutorials> <methods> <method name="barrier"> @@ -18,6 +19,7 @@ <param index="0" name="from" type="int" enum="RenderingDevice.BarrierMask" default="7" /> <param index="1" name="to" type="int" enum="RenderingDevice.BarrierMask" default="7" /> <description> + Puts a memory barrier in place. This is used for synchronization to avoid data races. See also [method full_barrier], which may be useful for debugging. </description> </method> <method name="buffer_clear"> @@ -52,6 +54,7 @@ <return type="void" /> <param index="0" name="name" type="String" /> <description> + Creates a timestamp marker with the specified [param name]. This is used for performance reporting with the [method get_captured_timestamp_cpu_time], [method get_captured_timestamp_gpu_time] and [method get_captured_timestamp_name] methods. </description> </method> <method name="compute_list_add_barrier"> @@ -64,6 +67,24 @@ <return type="int" /> <param index="0" name="allow_draw_overlap" type="bool" default="false" /> <description> + Starts a list of compute commands created with the [code]compute_*[/code] methods. The returned value should be passed to other [code]compute_list_*[/code] functions. + If [code]allow_draw_overlap[/code] is true, you may have one draw list running at the same time as one compute list. Multiple compute lists cannot be created at the same time; you must finish the previous compute list first using [method compute_list_end]. + A simple compute operation might look like this (code is not a complete example): + [codeblock] + var rd = RenderingDevice.new() + var compute_list = rd.compute_list_begin() + + rd.compute_list_bind_compute_pipeline(compute_list, compute_shader_dilate_pipeline) + rd.compute_list_bind_uniform_set(compute_list, compute_base_uniform_set, 0) + rd.compute_list_bind_uniform_set(compute_list, dilate_uniform_set, 1) + + for i in atlas_slices: + rd.compute_list_set_push_constant(compute_list, push_constant, push_constant.size()) + rd.compute_list_dispatch(compute_list, group_size.x, group_size.y, group_size.z) + # No barrier, let them run all together. + + rd.compute_list_end() + [/codeblock] </description> </method> <method name="compute_list_bind_compute_pipeline"> @@ -88,12 +109,14 @@ <param index="2" name="y_groups" type="int" /> <param index="3" name="z_groups" type="int" /> <description> + Submits the compute list for processing on the GPU. This is the compute equivalent to [method draw_list_draw]. </description> </method> <method name="compute_list_end"> <return type="void" /> <param index="0" name="post_barrier" type="int" enum="RenderingDevice.BarrierMask" default="7" /> <description> + Finishes a list of compute commands created with the [code]compute_*[/code] methods. </description> </method> <method name="compute_list_set_push_constant"> @@ -102,6 +125,7 @@ <param index="1" name="buffer" type="PackedByteArray" /> <param index="2" name="size_bytes" type="int" /> <description> + Sets the push constant data to [param buffer] for the specified [param compute_list]. The shader determines how this binary data is used. The buffer's size in bytes must also be specified in [param size_bytes] (this can be obtained by calling the [method PackedByteArray.size] method on the passed [param buffer]). </description> </method> <method name="compute_pipeline_create"> @@ -109,17 +133,21 @@ <param index="0" name="shader" type="RID" /> <param index="1" name="specialization_constants" type="RDPipelineSpecializationConstant[]" default="[]" /> <description> + Creates a new compute pipeline. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="compute_pipeline_is_valid"> <return type="bool" /> <param index="0" name="compute_pipeline" type="RID" /> <description> + Returns [code]true[/code] if the compute pipeline specified by the [param compute_pipeline] RID is valid, [code]false[/code] otherwise. </description> </method> <method name="create_local_device"> <return type="RenderingDevice" /> <description> + Create a new local [RenderingDevice]. This is most useful for performing compute operations on the GPU independently from the rest of the engine. </description> </method> <method name="draw_command_begin_label"> @@ -127,11 +155,14 @@ <param index="0" name="name" type="String" /> <param index="1" name="color" type="Color" /> <description> + Create a command buffer debug label region that can be displayed in third-party tools such as [url=https://renderdoc.org/]RenderDoc[/url]. All regions must be ended with a [method draw_command_end_label] call. When viewed from the linear series of submissions to a single queue, calls to [method draw_command_begin_label] and [method draw_command_end_label] must be matched and balanced. + The [code]VK_EXT_DEBUG_UTILS_EXTENSION_NAME[/code] Vulkan extension must be available and enabled for command buffer debug label region to work. See also [method draw_command_insert_label] and [method draw_command_end_label]. </description> </method> <method name="draw_command_end_label"> <return type="void" /> <description> + Ends the command buffer debug label region started by a [method draw_command_begin_label] call. </description> </method> <method name="draw_command_insert_label"> @@ -139,6 +170,7 @@ <param index="0" name="name" type="String" /> <param index="1" name="color" type="Color" /> <description> + Inserts a command buffer debug label region in the current command buffer. Unlike [method draw_command_begin_label], this region should not be ended with a [method draw_command_end_label] call. </description> </method> <method name="draw_list_begin"> @@ -154,6 +186,27 @@ <param index="8" name="region" type="Rect2" default="Rect2(0, 0, 0, 0)" /> <param index="9" name="storage_textures" type="Array" default="[]" /> <description> + Starts a list of raster drawing commands created with the [code]draw_*[/code] methods. The returned value should be passed to other [code]draw_list_*[/code] functions. + Multiple draw lists cannot be created at the same time; you must finish the previous draw list first using [method draw_list_end]. + A simple drawing operation might look like this (code is not a complete example): + [codeblock] + var rd = RenderingDevice.new() + var clear_colors = PackedColorArray([Color(0, 0, 0, 0), Color(0, 0, 0, 0), Color(0, 0, 0, 0)] + var draw_list = rd.draw_list_begin(framebuffers[i], RenderingDevice.INITIAL_ACTION_CLEAR, RenderingDevice.FINAL_ACTION_READ, RenderingDevice.INITIAL_ACTION_CLEAR, RenderingDevice.FINAL_ACTION_DISCARD, clear_colors) + + # Draw opaque. + rd.draw_list_bind_render_pipeline(draw_list, raster_pipeline) + rd.draw_list_bind_uniform_set(draw_list, raster_base_uniform, 0) + rd.draw_list_set_push_constant(draw_list, raster_push_constant, raster_push_constant.size()) + rd.draw_list_draw(draw_list, false, 1, slice_triangle_count[i] * 3) + # Draw wire. + rd.draw_list_bind_render_pipeline(draw_list, raster_pipeline_wire) + rd.draw_list_bind_uniform_set(draw_list, raster_base_uniform, 0) + rd.draw_list_set_push_constant(draw_list, raster_push_constant, raster_push_constant.size()) + rd.draw_list_draw(draw_list, false, 1, slice_triangle_count[i] * 3) + + rd.draw_list_end() + [/codeblock] </description> </method> <method name="draw_list_begin_for_screen"> @@ -161,6 +214,8 @@ <param index="0" name="screen" type="int" default="0" /> <param index="1" name="clear_color" type="Color" default="Color(0, 0, 0, 1)" /> <description> + High-level variant of [method draw_list_begin], with the parameters automtaically being adjusted for drawing onto the window specified by the [param screen] ID. + [b]Note:[/b] Cannot be used with local RenderingDevices, as these don't have a screen. If called on a local RenderingDevice, [method draw_list_begin_for_screen] returns [constant INVALID_ID]. </description> </method> <method name="draw_list_begin_split"> @@ -177,6 +232,7 @@ <param index="9" name="region" type="Rect2" default="Rect2(0, 0, 0, 0)" /> <param index="10" name="storage_textures" type="RID[]" default="[]" /> <description> + Variant of [method draw_list_begin] with support for multiple splits. The [param splits] parameter determines how many splits are created. </description> </method> <method name="draw_list_bind_index_array"> @@ -184,6 +240,7 @@ <param index="0" name="draw_list" type="int" /> <param index="1" name="index_array" type="RID" /> <description> + Binds [param index_array] to the specified [param draw_list]. </description> </method> <method name="draw_list_bind_render_pipeline"> @@ -191,6 +248,7 @@ <param index="0" name="draw_list" type="int" /> <param index="1" name="render_pipeline" type="RID" /> <description> + Binds [param render_pipeline] to the specified [param draw_list]. </description> </method> <method name="draw_list_bind_uniform_set"> @@ -199,6 +257,7 @@ <param index="1" name="uniform_set" type="RID" /> <param index="2" name="set_index" type="int" /> <description> + Binds [param uniform_set] to the specified [param draw_list]. A [param set_index] must also be specified, which is an identifier starting from [code]0[/code] that must match the one expected by the draw list. </description> </method> <method name="draw_list_bind_vertex_array"> @@ -206,12 +265,14 @@ <param index="0" name="draw_list" type="int" /> <param index="1" name="vertex_array" type="RID" /> <description> + Binds [param vertex_array] to the specified [param draw_list]. </description> </method> <method name="draw_list_disable_scissor"> <return type="void" /> <param index="0" name="draw_list" type="int" /> <description> + Removes and disables the scissor rectangle for the specified [param draw_list]. See also [method draw_list_enable_scissor]. </description> </method> <method name="draw_list_draw"> @@ -221,6 +282,7 @@ <param index="2" name="instances" type="int" /> <param index="3" name="procedural_vertex_count" type="int" default="0" /> <description> + Submits [param draw_list] for rendering on the GPU. This is the raster equivalent to [method compute_list_dispatch]. </description> </method> <method name="draw_list_enable_scissor"> @@ -228,12 +290,15 @@ <param index="0" name="draw_list" type="int" /> <param index="1" name="rect" type="Rect2" default="Rect2(0, 0, 0, 0)" /> <description> + Creates a scissor rectangle and enables it for the specified [param draw_list]. Scissor rectangles are used for clipping by discarding fragments that fall outside a specified rectangular portion of the screen. See also [method draw_list_disable_scissor]. + [b]Note:[/b] The specified [param rect] is automatically intersected with the screen's dimensions, which means it cannot exceed the screen's dimensions. </description> </method> <method name="draw_list_end"> <return type="void" /> <param index="0" name="post_barrier" type="int" enum="RenderingDevice.BarrierMask" default="7" /> <description> + Finishes a list of raster drawing commands created with the [code]draw_*[/code] methods. </description> </method> <method name="draw_list_set_blend_constants"> @@ -241,7 +306,7 @@ <param index="0" name="draw_list" type="int" /> <param index="1" name="color" type="Color" /> <description> - Sets blend constants for draw list, blend constants are used only if the graphics pipeline is created with [constant DYNAMIC_STATE_BLEND_CONSTANTS] flag set. + Sets blend constants for the specified [param draw_list] to [param color]. Blend constants are used only if the graphics pipeline is created with [constant DYNAMIC_STATE_BLEND_CONSTANTS] flag set. </description> </method> <method name="draw_list_set_push_constant"> @@ -250,17 +315,20 @@ <param index="1" name="buffer" type="PackedByteArray" /> <param index="2" name="size_bytes" type="int" /> <description> + Sets the push constant data to [param buffer] for the specified [param draw_list]. The shader determines how this binary data is used. The buffer's size in bytes must also be specified in [param size_bytes] (this can be obtained by calling the [method PackedByteArray.size] method on the passed [param buffer]). </description> </method> <method name="draw_list_switch_to_next_pass"> <return type="int" /> <description> + Switches to the next draw pass and returns the split's ID. Equivalent to [method draw_list_switch_to_next_pass_split] with [code]splits[/code] set to [code]1[/code]. </description> </method> <method name="draw_list_switch_to_next_pass_split"> <return type="PackedInt64Array" /> <param index="0" name="splits" type="int" /> <description> + Switches to the next draw pass, with the number of splits allocated specified in [param splits]. The return value is an array containing the ID of each split. For single-split usage, see [method draw_list_switch_to_next_pass]. </description> </method> <method name="framebuffer_create"> @@ -269,6 +337,8 @@ <param index="1" name="validate_with_format" type="int" default="-1" /> <param index="2" name="view_count" type="int" default="1" /> <description> + Creates a new framebuffer. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="framebuffer_create_empty"> @@ -277,6 +347,8 @@ <param index="1" name="samples" type="int" enum="RenderingDevice.TextureSamples" default="0" /> <param index="2" name="validate_with_format" type="int" default="-1" /> <description> + Creates a new empty framebuffer. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="framebuffer_create_multipass"> @@ -286,6 +358,8 @@ <param index="2" name="validate_with_format" type="int" default="-1" /> <param index="3" name="view_count" type="int" default="1" /> <description> + Creates a new multipass framebuffer. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="framebuffer_format_create"> @@ -293,12 +367,15 @@ <param index="0" name="attachments" type="RDAttachmentFormat[]" /> <param index="1" name="view_count" type="int" default="1" /> <description> + Creates a new framebuffer format with the specified [param attachments] and [param view_count]. Returns the new framebuffer's unique framebuffer format ID. + If [code]view_count[/code] is greater than or equal to [code]2[/code], enables multiview which is used for VR rendering. This requires support for the Vulkan multiview extension. </description> </method> <method name="framebuffer_format_create_empty"> <return type="int" /> <param index="0" name="samples" type="int" enum="RenderingDevice.TextureSamples" default="0" /> <description> + Creates a new empty framebuffer format with the specified number of [param samples] and returns its ID. </description> </method> <method name="framebuffer_format_create_multipass"> @@ -307,6 +384,7 @@ <param index="1" name="passes" type="RDFramebufferPass[]" /> <param index="2" name="view_count" type="int" default="1" /> <description> + Creates a multipass framebuffer format with the specified [param attachments], [param passes] and [param view_count] and returns its ID. If [code]view_count[/code] is greater than or equal to [code]2[/code], enables multiview which is used for VR rendering. This requires support for the Vulkan multiview extension. </description> </method> <method name="framebuffer_format_get_texture_samples"> @@ -314,72 +392,85 @@ <param index="0" name="format" type="int" /> <param index="1" name="render_pass" type="int" default="0" /> <description> + Returns the number of texture samples used for the given framebuffer [param format] ID (returned by [method framebuffer_get_format]). </description> </method> <method name="framebuffer_get_format"> <return type="int" /> <param index="0" name="framebuffer" type="RID" /> <description> + Returns the format ID of the framebuffer specified by the [param framebuffer] RID. This ID is guaranteed to be unique for the same formats and does not need to be freed. </description> </method> <method name="framebuffer_is_valid" qualifiers="const"> <return type="bool" /> <param index="0" name="framebuffer" type="RID" /> <description> + Returns [code]true[/code] if the framebuffer specified by the [param framebuffer] RID is valid, [code]false[/code] otherwise. </description> </method> <method name="free_rid"> <return type="void" /> <param index="0" name="rid" type="RID" /> <description> + Tries to free an object in the RenderingDevice. To avoid memory leaks, this should be called after using an object as memory management does not occur automatically when using RenderingDevice directly. </description> </method> <method name="full_barrier"> <return type="void" /> <description> + Puts a [i]full[/i] memory barrier in place. This is a memory [method barrier] with all flags enabled. [method full_barrier] it should only be used for debugging as it can severely impact performance. </description> </method> <method name="get_captured_timestamp_cpu_time" qualifiers="const"> <return type="int" /> <param index="0" name="index" type="int" /> <description> + Returns the timestamp in CPU time for the rendering step specified by [param index] (in microseconds since the engine started). See also [method get_captured_timestamp_gpu_time] and [method capture_timestamp]. </description> </method> <method name="get_captured_timestamp_gpu_time" qualifiers="const"> <return type="int" /> <param index="0" name="index" type="int" /> <description> + Returns the timestamp in GPU time for the rendering step specified by [param index] (in microseconds since the engine started). See also [method get_captured_timestamp_cpu_time] and [method capture_timestamp]. </description> </method> <method name="get_captured_timestamp_name" qualifiers="const"> <return type="String" /> <param index="0" name="index" type="int" /> <description> + Returns the timestamp's name for the rendering step specified by [param index]. See also [method capture_timestamp]. </description> </method> <method name="get_captured_timestamps_count" qualifiers="const"> <return type="int" /> <description> + Returns the total number of timestamps (rendering steps) available for profiling. </description> </method> <method name="get_captured_timestamps_frame" qualifiers="const"> <return type="int" /> <description> + Returns the index of the last frame rendered that has rendering timestamps available for querying. </description> </method> <method name="get_device_name" qualifiers="const"> <return type="String" /> <description> + Returns the name of the video adapter (e.g. "GeForce GTX 1080/PCIe/SSE2"). Equivalent to [method RenderingServer.get_video_adapter_name]. See also [method get_device_vendor_name]. </description> </method> <method name="get_device_pipeline_cache_uuid" qualifiers="const"> <return type="String" /> <description> + Returns the universally unique identifier for the pipeline cache. This is used to cache shader files on disk, which avoids shader recompilations on subsequent engine runs. This UUID varies depending on the graphics card model, but also the driver version. Therefore, updating graphics drivers will invalidate the shader cache. </description> </method> <method name="get_device_vendor_name" qualifiers="const"> <return type="String" /> <description> + Returns the vendor of the video adapter (e.g. "NVIDIA Corporation"). Equivalent to [method RenderingServer.get_video_adapter_vendor]. See also [method get_device_name]. </description> </method> <method name="get_driver_resource"> @@ -388,17 +479,20 @@ <param index="1" name="rid" type="RID" /> <param index="2" name="index" type="int" /> <description> + Returns the unique identifier of the driver [param resource] for the specified [param rid]. Some driver resource types ignore the specified [param rid] (see [enum DriverResource] descriptions). [param index] is always ignored but must be specified anyway. </description> </method> <method name="get_frame_delay" qualifiers="const"> <return type="int" /> <description> + Returns the frame count kept by the graphics API. Higher values result in higher input lag, but with more consistent throughput. For the main [RenderingDevice], frames are cycled (usually 3 with triple-buffered V-Sync enabled). However, local [RenderingDevice]s only have 1 frame. </description> </method> <method name="get_memory_usage" qualifiers="const"> <return type="int" /> <param index="0" name="type" type="int" enum="RenderingDevice.MemoryType" /> <description> + Returns the memory usage in bytes corresponding to the given [param type]. When using Vulkan, these statistics are calculated by [url=https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator]Vulkan Memory Allocator[/url]. </description> </method> <method name="index_array_create"> @@ -407,6 +501,8 @@ <param index="1" name="index_offset" type="int" /> <param index="2" name="index_count" type="int" /> <description> + Creates a new index array. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="index_buffer_create"> @@ -416,12 +512,16 @@ <param index="2" name="data" type="PackedByteArray" default="PackedByteArray()" /> <param index="3" name="use_restart_indices" type="bool" default="false" /> <description> + Creates a new index buffer. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="limit_get" qualifiers="const"> <return type="int" /> <param index="0" name="limit" type="int" enum="RenderingDevice.Limit" /> <description> + Returns the value of the specified [param limit]. This limit varies depending on the current graphics hardware (and sometimes the driver version). If the given limit is exceeded, rendering errors will occur. + Limits for various graphics hardware can be found in the [url=https://vulkan.gpuinfo.org/]Vulkan Hardware Database[/url]. </description> </method> <method name="render_pipeline_create"> @@ -438,18 +538,23 @@ <param index="9" name="for_render_pass" type="int" default="0" /> <param index="10" name="specialization_constants" type="RDPipelineSpecializationConstant[]" default="[]" /> <description> + Creates a new render pipeline. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="render_pipeline_is_valid"> <return type="bool" /> <param index="0" name="render_pipeline" type="RID" /> <description> + Returns [code]true[/code] if the render pipeline specified by the [param render_pipeline] RID is valid, [code]false[/code] otherwise. </description> </method> <method name="sampler_create"> <return type="RID" /> <param index="0" name="state" type="RDSamplerState" /> <description> + Creates a new sampler. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="sampler_is_format_supported_for_filter" qualifiers="const"> @@ -463,18 +568,24 @@ <method name="screen_get_framebuffer_format" qualifiers="const"> <return type="int" /> <description> + Returns the screen's framebuffer format. + [b]Note:[/b] Only the main [RenderingDevice] returned by [method RenderingServer.get_rendering_device] has a format. If called on a local [RenderingDevice], this method prints an error and returns [constant INVALID_ID]. </description> </method> <method name="screen_get_height" qualifiers="const"> <return type="int" /> <param index="0" name="screen" type="int" default="0" /> <description> + Returns the window height matching the graphics API context for the given window ID (in pixels). Despite the parameter being named [param screen], this returns the [i]window[/i] size. See also [method screen_get_width]. + [b]Note:[/b] Only the main [RenderingDevice] returned by [method RenderingServer.get_rendering_device] has a height. If called on a local [RenderingDevice], this method prints an error and returns [constant INVALID_ID]. </description> </method> <method name="screen_get_width" qualifiers="const"> <return type="int" /> <param index="0" name="screen" type="int" default="0" /> <description> + Returns the window width matching the graphics API context for the given window ID (in pixels). Despite the parameter being named [param screen], this returns the [i]window[/i] size. See also [method screen_get_height]. + [b]Note:[/b] Only the main [RenderingDevice] returned by [method RenderingServer.get_rendering_device] has a width. If called on a local [RenderingDevice], this method prints an error and returns [constant INVALID_ID]. </description> </method> <method name="set_resource_name"> @@ -482,6 +593,9 @@ <param index="0" name="id" type="RID" /> <param index="1" name="name" type="String" /> <description> + Sets the resource name for [param id] to [param name]. This is used for debugging with third-party tools such as [url=https://renderdoc.org/]RenderDoc[/url]. + The following types of resources can be named: texture, sampler, vertex buffer, index buffer, uniform buffer, texture buffer, storage buffer, uniform set buffer, shader, render pipeline and compute pipeline. Framebuffers cannot be named. Attempting to name an incompatible resource type will print an error. + [b]Note:[/b] Resource names are only set when the engine runs in verbose mode ([method OS.is_stdout_verbose] = [code]true[/code]), or when using an engine build compiled with the [code]dev_mode=yes[/code] SCons option. The graphics driver must also support the [code]VK_EXT_DEBUG_UTILS_EXTENSION_NAME[/code] Vulkan extension for named resources to work. </description> </method> <method name="shader_compile_binary_from_spirv"> @@ -489,6 +603,8 @@ <param index="0" name="spirv_data" type="RDShaderSPIRV" /> <param index="1" name="name" type="String" default="""" /> <description> + Compiles a binary shader from [param spirv_data] and returns the compiled binary data as a [PackedByteArray]. This compiled shader is specific to the GPU model and driver version used; it will not work on different GPU models or even different driver versions. See also [method shader_compile_spirv_from_source]. + [param name] is an optional human-readable name that can be given to the compiled shader for organizational purposes. </description> </method> <method name="shader_compile_spirv_from_source"> @@ -496,12 +612,16 @@ <param index="0" name="shader_source" type="RDShaderSource" /> <param index="1" name="allow_cache" type="bool" default="true" /> <description> + Compiles a SPIR-V from the shader source code in [param shader_source] and returns the SPIR-V as a [RDShaderSPIRV]. This intermediate language shader is portable across different GPU models and driver versions, but cannot be run directly by GPUs until compiled into a binary shader using [method shader_compile_binary_from_spirv]. + If [param allow_cache] is [code]true[/code], make use of the shader cache generated by Godot. This avoids a potentially lengthy shader compilation step if the shader is already in cache. If [param allow_cache] is [code]false[/code], Godot's shader cache is ignored and the shader will always be recompiled. </description> </method> <method name="shader_create_from_bytecode"> <return type="RID" /> <param index="0" name="binary_data" type="PackedByteArray" /> <description> + Creates a new shader instance from a binary compiled shader. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. See also [method shader_compile_binary_from_spirv] and [method shader_create_from_spirv]. </description> </method> <method name="shader_create_from_spirv"> @@ -509,6 +629,8 @@ <param index="0" name="spirv_data" type="RDShaderSPIRV" /> <param index="1" name="name" type="String" default="""" /> <description> + Creates a new shader instance from SPIR-V intermediate code. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. See also [method shader_compile_spirv_from_source] and [method shader_create_from_bytecode]. </description> </method> <method name="shader_get_vertex_input_attribute_mask"> @@ -523,16 +645,23 @@ <param index="1" name="data" type="PackedByteArray" default="PackedByteArray()" /> <param index="2" name="usage" type="int" enum="RenderingDevice.StorageBufferUsage" default="0" /> <description> + Creates a [url=https://vkguide.dev/docs/chapter-4/storage_buffers/]storage buffer[/url] with the specified [param data] and [param usage]. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="submit"> <return type="void" /> <description> + Pushes the frame setup and draw command buffers then marks the local device as currently processing (which allows calling [method sync]). + [b]Note:[/b] Only available in local RenderingDevices. </description> </method> <method name="sync"> <return type="void" /> <description> + Forces a synchronization between the CPU and GPU, which may be required in certain cases. Only call this when needed, as CPU-GPU synchronization has a performance cost. + [b]Note:[/b] Only available in local RenderingDevices. + [b]Note:[/b] [method sync] can only be called after a [method submit]. </description> </method> <method name="texture_buffer_create"> @@ -541,6 +670,8 @@ <param index="1" name="format" type="int" enum="RenderingDevice.DataFormat" /> <param index="2" name="data" type="PackedByteArray" default="PackedByteArray()" /> <description> + Creates a new texture buffer. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="texture_clear"> @@ -553,6 +684,8 @@ <param index="5" name="layer_count" type="int" /> <param index="6" name="post_barrier" type="int" enum="RenderingDevice.BarrierMask" default="7" /> <description> + Clears the specified [param texture] by replacing all of its pixels with the specified [param color]. [param base_mipmap] and [param mipmap_count] determine which mipmaps of the texture are affected by this clear operation, while [param base_layer] and [param layer_count] determine which layers of a 3D texture (or texture array) are affected by this clear operation. For 2D textures (which only have one layer by design), [param base_layer] and [param layer_count] must both be [code]0[/code]. + [b]Note:[/b] [param texture] can't be cleared while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to [constant FINAL_ACTION_CONTINUE]) to clear this texture. </description> </method> <method name="texture_copy"> @@ -568,6 +701,12 @@ <param index="8" name="dst_layer" type="int" /> <param index="9" name="post_barrier" type="int" enum="RenderingDevice.BarrierMask" default="7" /> <description> + Copies the [param from_texture] to [param to_texture] with the specified [param from_pos], [param to_pos] and [param size] coordinates. The Z axis of the [param from_pos], [param to_pos] and [param size] must be [code]0[/code] for 2-dimensional textures. Source and destination mipmaps/layers must also be specified, with these parameters being [code]0[/code] for textures without mipmaps or single-layer textures. Returns [constant @GlobalScope.OK] if the texture copy was successful or [constant @GlobalScope.ERR_INVALID_PARAMETER] otherwise. + [b]Note:[/b] [param from_texture] texture can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to [constant FINAL_ACTION_CONTINUE]) to copy this texture. + [b]Note:[/b] [param from_texture] texture requires the [constant TEXTURE_USAGE_CAN_COPY_FROM_BIT] to be retrieved. + [b]Note:[/b] [param to_texture] can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to [constant FINAL_ACTION_CONTINUE]) to copy this texture. + [b]Note:[/b] [param to_texture] requires the [constant TEXTURE_USAGE_CAN_COPY_TO_BIT] to be retrieved. + [b]Note:[/b] [param from_texture] and [param to_texture] must be of the same type (color or depth). </description> </method> <method name="texture_create"> @@ -576,6 +715,9 @@ <param index="1" name="view" type="RDTextureView" /> <param index="2" name="data" type="PackedByteArray[]" default="[]" /> <description> + Creates a new texture. It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. + [b]Note:[/b] Not to be confused with [method RenderingServer.texture_2d_create], which creates the Godot-specific [Texture2D] resource as opposed to the graphics API's own texture type. </description> </method> <method name="texture_create_shared"> @@ -583,6 +725,7 @@ <param index="0" name="view" type="RDTextureView" /> <param index="1" name="with_texture" type="RID" /> <description> + Creates a shared texture using the specified [param view] and the texture information from [param with_texture]. </description> </method> <method name="texture_create_shared_from_slice"> @@ -594,6 +737,9 @@ <param index="4" name="mipmaps" type="int" default="1" /> <param index="5" name="slice_type" type="int" enum="RenderingDevice.TextureSliceType" default="0" /> <description> + Creates a shared texture using the specified [param view] and the texture information from [param with_texture]'s [param layer] and [param mipmap]. The number of included mipmaps from the original texture can be controlled using the [param mipmaps] parameter. Only relevant for textures with multiple layers, such as 3D textures, texture arrays and cubemaps. For single-layer textures, use [method texture_create_shared] + For 2D textures (which only have one layer), [param layer] must be [code]0[/code]. + [b]Note:[/b] Layer slicing is only supported for 2D texture arrays, not 3D textures or cubemaps. </description> </method> <method name="texture_get_data"> @@ -601,6 +747,9 @@ <param index="0" name="texture" type="RID" /> <param index="1" name="layer" type="int" /> <description> + Retruns the [param texture] data for the specified [param layer] as raw binary data. For 2D textures (which only have one layer), [param layer] must be [code]0[/code]. + [b]Note:[/b] [param texture] can't be retrieved while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to [constant FINAL_ACTION_CONTINUE]) to retrieve this texture. Otherwise, an error is printed and a empty [PackedByteArray] is returned. + [b]Note:[/b] [param texture] requires the [constant TEXTURE_USAGE_CAN_COPY_FROM_BIT] to be retrieved. Otherwise, an error is printed and a empty [PackedByteArray] is returned. </description> </method> <method name="texture_is_format_supported_for_usage" qualifiers="const"> @@ -608,18 +757,21 @@ <param index="0" name="format" type="int" enum="RenderingDevice.DataFormat" /> <param index="1" name="usage_flags" type="int" enum="RenderingDevice.TextureUsageBits" /> <description> + Returns [code]true[/code] if the specified [param format] is supported for the given [param usage_flags], [code]false[/code] otherwise. </description> </method> <method name="texture_is_shared"> <return type="bool" /> <param index="0" name="texture" type="RID" /> <description> + Returns [code]true[/code] if the [param texture] is shared, [code]false[/code] otherwise. See [RDTextureView]. </description> </method> <method name="texture_is_valid"> <return type="bool" /> <param index="0" name="texture" type="RID" /> <description> + Returns [code]true[/code] if the [param texture] is valid, [code]false[/code] otherwise. </description> </method> <method name="texture_resolve_multisample"> @@ -628,6 +780,14 @@ <param index="1" name="to_texture" type="RID" /> <param index="2" name="post_barrier" type="int" enum="RenderingDevice.BarrierMask" default="7" /> <description> + Resolves the [param from_texture] texture onto [param to_texture] with multisample antialiasing enabled. This must be used when rendering a framebuffer for MSAA to work. Returns [constant @GlobalScope.OK] if successful, [constant @GlobalScope.ERR_INVALID_PARAMETER] otherwise. + [b]Note:[/b] [param from_texture] and [param to_texture] textures must have the same dimension, format and type (color or depth). + [b]Note:[/b] [param from_texture] can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to [constant FINAL_ACTION_CONTINUE]) to resolve this texture. + [b]Note:[/b] [param from_texture] requires the [constant TEXTURE_USAGE_CAN_COPY_FROM_BIT] to be retrieved. + [b]Note:[/b] [param from_texture] must be multisampled and must also be 2D (or a slice of a 3D/cubemap texture). + [b]Note:[/b] [param to_texture] can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to [constant FINAL_ACTION_CONTINUE]) to resolve this texture. + [b]Note:[/b] [param to_texture] texture requires the [constant TEXTURE_USAGE_CAN_COPY_TO_BIT] to be retrieved. + [b]Note:[/b] [param to_texture] texture must [b]not[/b] be multisampled and must also be 2D (or a slice of a 3D/cubemap texture). </description> </method> <method name="texture_update"> @@ -637,6 +797,10 @@ <param index="2" name="data" type="PackedByteArray" /> <param index="3" name="post_barrier" type="int" enum="RenderingDevice.BarrierMask" default="7" /> <description> + Updates texture data with new data, replacing the previous data in place. The updated texture data must have the same dimensions and format. For 2D textures (which only have one layer), [param layer] must be [code]0[/code]. Returns [constant @GlobalScope.OK] if the update was successful, [constant @GlobalScope.ERR_INVALID_PARAMETER] otherwise. + [b]Note:[/b] Updating textures is forbidden during creation of a draw or compute list. + [b]Note:[/b] The existing [param texture] can't be updated while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to [constant FINAL_ACTION_CONTINUE]) to update this texture. + [b]Note:[/b] The existing [param texture] requires the [constant TEXTURE_USAGE_CAN_UPDATE_BIT] to be updatable. </description> </method> <method name="uniform_buffer_create"> @@ -644,6 +808,8 @@ <param index="0" name="size_bytes" type="int" /> <param index="1" name="data" type="PackedByteArray" default="PackedByteArray()" /> <description> + It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="uniform_set_create"> @@ -652,6 +818,8 @@ <param index="1" name="shader" type="RID" /> <param index="2" name="shader_set" type="int" /> <description> + It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="uniform_set_is_valid"> @@ -676,12 +844,15 @@ <param index="1" name="data" type="PackedByteArray" default="PackedByteArray()" /> <param index="2" name="use_as_storage" type="bool" default="false" /> <description> + It can be accessed with the RID that is returned. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. </description> </method> <method name="vertex_format_create"> <return type="int" /> <param index="0" name="vertex_descriptions" type="RDVertexAttribute[]" /> <description> + Creates a new vertex format with the specified [param vertex_descriptions]. Returns a unique vertex format ID corresponding to the newly created vertex format. </description> </method> </methods> @@ -705,478 +876,716 @@ Represents the size of the [enum DeviceType] enum. </constant> <constant name="DRIVER_RESOURCE_VULKAN_DEVICE" value="0" enum="DriverResource"> + Vulkan device driver resource. This is a "global" resource and ignores the RID passed in </constant> <constant name="DRIVER_RESOURCE_VULKAN_PHYSICAL_DEVICE" value="1" enum="DriverResource"> + Physical device (graphics card) driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_INSTANCE" value="2" enum="DriverResource"> + Vulkan instance driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_QUEUE" value="3" enum="DriverResource"> + Vulkan queue driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_QUEUE_FAMILY_INDEX" value="4" enum="DriverResource"> + Vulkan queue family index driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_IMAGE" value="5" enum="DriverResource"> + Vulkan image driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_IMAGE_VIEW" value="6" enum="DriverResource"> + Vulkan image view driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_IMAGE_NATIVE_TEXTURE_FORMAT" value="7" enum="DriverResource"> + Vulkan image native texture format driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_SAMPLER" value="8" enum="DriverResource"> + Vulkan sampler driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_DESCRIPTOR_SET" value="9" enum="DriverResource"> + Vulkan [url=https://vkguide.dev/docs/chapter-4/descriptors/]descriptor set[/url] driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_BUFFER" value="10" enum="DriverResource"> + Vulkan buffer driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_COMPUTE_PIPELINE" value="11" enum="DriverResource"> + Vulkan compute pipeline driver resource. </constant> <constant name="DRIVER_RESOURCE_VULKAN_RENDER_PIPELINE" value="12" enum="DriverResource"> + Vulkan render pipeline driver resource. </constant> <constant name="DATA_FORMAT_R4G4_UNORM_PACK8" value="0" enum="DataFormat"> + 4-bit-per-channel red/green channel data format, packed into 8 bits. Values are in the [code][0.0, 1.0][/code] range. + [b]Note:[/b] More information on all data formats can be found on the [url=https://registry.khronos.org/vulkan/specs/1.1/html/vkspec.html#_identification_of_formats]Identification of formats[/url] section of the Vulkan specification, as well as the [url=https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkFormat.html]VkFormat[/url] enum. </constant> <constant name="DATA_FORMAT_R4G4B4A4_UNORM_PACK16" value="1" enum="DataFormat"> + 4-bit-per-channel red/green/blue/alpha channel data format, packed into 16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_B4G4R4A4_UNORM_PACK16" value="2" enum="DataFormat"> + 4-bit-per-channel blue/green/red/alpha channel data format, packed into 16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R5G6B5_UNORM_PACK16" value="3" enum="DataFormat"> + Red/green/blue channel data format with 5 bits of red, 6 bits of green and 5 bits of blue, packed into 16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_B5G6R5_UNORM_PACK16" value="4" enum="DataFormat"> + Blue/green/red channel data format with 5 bits of blue, 6 bits of green and 5 bits of red, packed into 16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R5G5B5A1_UNORM_PACK16" value="5" enum="DataFormat"> + Red/green/blue/alpha channel data format with 5 bits of red, 6 bits of green, 5 bits of blue and 1 bit of alpha, packed into 16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_B5G5R5A1_UNORM_PACK16" value="6" enum="DataFormat"> + Blue/green/red/alpha channel data format with 5 bits of blue, 6 bits of green, 5 bits of red and 1 bit of alpha, packed into 16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_A1R5G5B5_UNORM_PACK16" value="7" enum="DataFormat"> + Alpha/red/green/blue channel data format with 1 bit of alpha, 5 bits of red, 6 bits of green and 5 bits of blue, packed into 16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8_UNORM" value="8" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8_SNORM" value="9" enum="DataFormat"> + 8-bit-per-channel signed floating-point red channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8_USCALED" value="10" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red channel data format with scaled value (value is converted from integer to float). Values are in the [code][0.0, 255.0][/code] range. </constant> <constant name="DATA_FORMAT_R8_SSCALED" value="11" enum="DataFormat"> + 8-bit-per-channel signed floating-point red channel data format with scaled value (value is converted from integer to float). Values are in the [code][-127.0, 127.0][/code] range. </constant> <constant name="DATA_FORMAT_R8_UINT" value="12" enum="DataFormat"> + 8-bit-per-channel unsigned integer red channel data format. Values are in the [code][0, 255][/code] range. </constant> <constant name="DATA_FORMAT_R8_SINT" value="13" enum="DataFormat"> + 8-bit-per-channel signed integer red channel data format. Values are in the [code][-127, 127][/code] range. </constant> <constant name="DATA_FORMAT_R8_SRGB" value="14" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8_UNORM" value="15" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red/green channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8_SNORM" value="16" enum="DataFormat"> + 8-bit-per-channel signed floating-point red/green channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8_USCALED" value="17" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red/green channel data format with scaled value (value is converted from integer to float). Values are in the [code][0.0, 255.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8_SSCALED" value="18" enum="DataFormat"> + 8-bit-per-channel signed floating-point red/green channel data format with scaled value (value is converted from integer to float). Values are in the [code][-127.0, 127.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8_UINT" value="19" enum="DataFormat"> + 8-bit-per-channel unsigned integer red/green channel data format. Values are in the [code][0, 255][/code] range. </constant> <constant name="DATA_FORMAT_R8G8_SINT" value="20" enum="DataFormat"> + 8-bit-per-channel signed integer red/green channel data format. Values are in the [code][-127, 127][/code] range. </constant> <constant name="DATA_FORMAT_R8G8_SRGB" value="21" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red/green channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8_UNORM" value="22" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red/green/blue channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8_SNORM" value="23" enum="DataFormat"> + 8-bit-per-channel signed floating-point red/green/blue channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8_USCALED" value="24" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red/green/blue channel data format with scaled value (value is converted from integer to float). Values are in the [code][0.0, 255.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8_SSCALED" value="25" enum="DataFormat"> + 8-bit-per-channel signed floating-point red/green/blue channel data format with scaled value (value is converted from integer to float). Values are in the [code][-127.0, 127.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8_UINT" value="26" enum="DataFormat"> + 8-bit-per-channel unsigned integer red/green/blue channel data format. Values are in the [code][0, 255][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8_SINT" value="27" enum="DataFormat"> + 8-bit-per-channel signed integer red/green/blue channel data format. Values are in the [code][-127, 127][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8_SRGB" value="28" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red/green/blue/blue channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8_UNORM" value="29" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point blue/green/red channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8_SNORM" value="30" enum="DataFormat"> + 8-bit-per-channel signed floating-point blue/green/red channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8_USCALED" value="31" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point blue/green/red channel data format with scaled value (value is converted from integer to float). Values are in the [code][0.0, 255.0][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8_SSCALED" value="32" enum="DataFormat"> + 8-bit-per-channel signed floating-point blue/green/red channel data format with scaled value (value is converted from integer to float). Values are in the [code][-127.0, 127.0][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8_UINT" value="33" enum="DataFormat"> + 8-bit-per-channel unsigned integer blue/green/red channel data format. Values are in the [code][0, 255][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8_SINT" value="34" enum="DataFormat"> + 8-bit-per-channel signed integer blue/green/red channel data format. Values are in the [code][-127, 127][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8_SRGB" value="35" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point blue/green/red data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8A8_UNORM" value="36" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red/green/blue/alpha channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8A8_SNORM" value="37" enum="DataFormat"> + 8-bit-per-channel signed floating-point red/green/blue/alpha channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8A8_USCALED" value="38" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red/green/blue/alpha channel data format with scaled value (value is converted from integer to float). Values are in the [code][0.0, 255.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8A8_SSCALED" value="39" enum="DataFormat"> + 8-bit-per-channel signed floating-point red/green/blue/alpha channel data format with scaled value (value is converted from integer to float). Values are in the [code][-127.0, 127.0][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8A8_UINT" value="40" enum="DataFormat"> + 8-bit-per-channel unsigned integer red/green/blue/alpha channel data format. Values are in the [code][0, 255][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8A8_SINT" value="41" enum="DataFormat"> + 8-bit-per-channel signed integer red/green/blue/alpha channel data format. Values are in the [code][-127, 127][/code] range. </constant> <constant name="DATA_FORMAT_R8G8B8A8_SRGB" value="42" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point red/green/blue/alpha channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8A8_UNORM" value="43" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point blue/green/red/alpha channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8A8_SNORM" value="44" enum="DataFormat"> + 8-bit-per-channel signed floating-point blue/green/red/alpha channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8A8_USCALED" value="45" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point blue/green/red/alpha channel data format with scaled value (value is converted from integer to float). Values are in the [code][0.0, 255.0][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8A8_SSCALED" value="46" enum="DataFormat"> + 8-bit-per-channel signed floating-point blue/green/red/alpha channel data format with scaled value (value is converted from integer to float). Values are in the [code][-127.0, 127.0][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8A8_UINT" value="47" enum="DataFormat"> + 8-bit-per-channel unsigned integer blue/green/red/alpha channel data format. Values are in the [code][0, 255][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8A8_SINT" value="48" enum="DataFormat"> + 8-bit-per-channel signed integer blue/green/red/alpha channel data format. Values are in the [code][-127, 127][/code] range. </constant> <constant name="DATA_FORMAT_B8G8R8A8_SRGB" value="49" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point blue/green/red/alpha channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_A8B8G8R8_UNORM_PACK32" value="50" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point alpha/red/green/blue channel data format with normalized value, packed in 32 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_A8B8G8R8_SNORM_PACK32" value="51" enum="DataFormat"> + 8-bit-per-channel signed floating-point alpha/red/green/blue channel data format with normalized value, packed in 32 bits. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_A8B8G8R8_USCALED_PACK32" value="52" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point alpha/red/green/blue channel data format with scaled value (value is converted from integer to float), packed in 32 bits. Values are in the [code][0.0, 255.0][/code] range. </constant> <constant name="DATA_FORMAT_A8B8G8R8_SSCALED_PACK32" value="53" enum="DataFormat"> + 8-bit-per-channel signed floating-point alpha/red/green/blue channel data format with scaled value (value is converted from integer to float), packed in 32 bits. Values are in the [code][-127.0, 127.0][/code] range. </constant> <constant name="DATA_FORMAT_A8B8G8R8_UINT_PACK32" value="54" enum="DataFormat"> + 8-bit-per-channel unsigned integer alpha/red/green/blue channel data format, packed in 32 bits. Values are in the [code][0, 255][/code] range. </constant> <constant name="DATA_FORMAT_A8B8G8R8_SINT_PACK32" value="55" enum="DataFormat"> + 8-bit-per-channel signed integer alpha/red/green/blue channel data format, packed in 32 bits. Values are in the [code][-127, 127][/code] range. </constant> <constant name="DATA_FORMAT_A8B8G8R8_SRGB_PACK32" value="56" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point alpha/red/green/blue channel data format with normalized value and non-linear sRGB encoding, packed in 32 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_A2R10G10B10_UNORM_PACK32" value="57" enum="DataFormat"> + Unsigned floating-point alpha/red/green/blue channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of red, 10 bits of green and 10 bits of blue. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_A2R10G10B10_SNORM_PACK32" value="58" enum="DataFormat"> + Signed floating-point alpha/red/green/blue channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of red, 10 bits of green and 10 bits of blue. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_A2R10G10B10_USCALED_PACK32" value="59" enum="DataFormat"> + Unsigned floating-point alpha/red/green/blue channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of red, 10 bits of green and 10 bits of blue. Values are in the [code][0.0, 1023.0][/code] range for red/green/blue and [code][0.0, 3.0][/code] for alpha. </constant> <constant name="DATA_FORMAT_A2R10G10B10_SSCALED_PACK32" value="60" enum="DataFormat"> + Signed floating-point alpha/red/green/blue channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of red, 10 bits of green and 10 bits of blue. Values are in the [code][-511.0, 511.0][/code] range for red/green/blue and [code][-1.0, 1.0][/code] for alpha. </constant> <constant name="DATA_FORMAT_A2R10G10B10_UINT_PACK32" value="61" enum="DataFormat"> + Unsigned integer alpha/red/green/blue channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of red, 10 bits of green and 10 bits of blue. Values are in the [code][0, 1023][/code] range for red/green/blue and [code][0, 3][/code] for alpha. </constant> <constant name="DATA_FORMAT_A2R10G10B10_SINT_PACK32" value="62" enum="DataFormat"> + Signed integer alpha/red/green/blue channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of red, 10 bits of green and 10 bits of blue. Values are in the [code][-511, 511][/code] range for red/green/blue and [code][-1, 1][/code] for alpha. </constant> <constant name="DATA_FORMAT_A2B10G10R10_UNORM_PACK32" value="63" enum="DataFormat"> + Unsigned floating-point alpha/blue/green/red channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of blue, 10 bits of green and 10 bits of red. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_A2B10G10R10_SNORM_PACK32" value="64" enum="DataFormat"> + Signed floating-point alpha/blue/green/red channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of blue, 10 bits of green and 10 bits of red. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_A2B10G10R10_USCALED_PACK32" value="65" enum="DataFormat"> + Unsigned floating-point alpha/blue/green/red channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of blue, 10 bits of green and 10 bits of red. Values are in the [code][0.0, 1023.0][/code] range for blue/green/red and [code][0.0, 3.0][/code] for alpha. </constant> <constant name="DATA_FORMAT_A2B10G10R10_SSCALED_PACK32" value="66" enum="DataFormat"> + Signed floating-point alpha/blue/green/red channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of blue, 10 bits of green and 10 bits of red. Values are in the [code][-511.0, 511.0][/code] range for blue/green/red and [code][-1.0, 1.0][/code] for alpha. </constant> <constant name="DATA_FORMAT_A2B10G10R10_UINT_PACK32" value="67" enum="DataFormat"> + Unsigned integer alpha/blue/green/red channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of blue, 10 bits of green and 10 bits of red. Values are in the [code][0, 1023][/code] range for blue/green/red and [code][0, 3][/code] for alpha. </constant> <constant name="DATA_FORMAT_A2B10G10R10_SINT_PACK32" value="68" enum="DataFormat"> + Signed integer alpha/blue/green/red channel data format with normalized value, packed in 32 bits. Format contains 2 bits of alpha, 10 bits of blue, 10 bits of green and 10 bits of red. Values are in the [code][-511, 511][/code] range for blue/green/red and [code][-1, 1][/code] for alpha. </constant> <constant name="DATA_FORMAT_R16_UNORM" value="69" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point red channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R16_SNORM" value="70" enum="DataFormat"> + 16-bit-per-channel signed floating-point red channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R16_USCALED" value="71" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point red channel data format with scaled value (value is converted from integer to float). Values are in the [code][0.0, 65535.0][/code] range. </constant> <constant name="DATA_FORMAT_R16_SSCALED" value="72" enum="DataFormat"> + 16-bit-per-channel signed floating-point red channel data format with scaled value (value is converted from integer to float). Values are in the [code][-32767.0, 32767.0][/code] range. </constant> <constant name="DATA_FORMAT_R16_UINT" value="73" enum="DataFormat"> + 16-bit-per-channel unsigned integer red channel data format. Values are in the [code][0.0, 65535][/code] range. </constant> <constant name="DATA_FORMAT_R16_SINT" value="74" enum="DataFormat"> + 16-bit-per-channel signed integer red channel data format. Values are in the [code][-32767, 32767][/code] range. </constant> <constant name="DATA_FORMAT_R16_SFLOAT" value="75" enum="DataFormat"> + 16-bit-per-channel signed floating-point red channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R16G16_UNORM" value="76" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point red/green channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16_SNORM" value="77" enum="DataFormat"> + 16-bit-per-channel signed floating-point red/green channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16_USCALED" value="78" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point red/green channel data format with scaled value (value is converted from integer to float). Values are in the [code][0.0, 65535.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16_SSCALED" value="79" enum="DataFormat"> + 16-bit-per-channel signed floating-point red/green channel data format with scaled value (value is converted from integer to float). Values are in the [code][-32767.0, 32767.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16_UINT" value="80" enum="DataFormat"> + 16-bit-per-channel unsigned integer red/green channel data format. Values are in the [code][0.0, 65535][/code] range. </constant> <constant name="DATA_FORMAT_R16G16_SINT" value="81" enum="DataFormat"> + 16-bit-per-channel signed integer red/green channel data format. Values are in the [code][-32767, 32767][/code] range. </constant> <constant name="DATA_FORMAT_R16G16_SFLOAT" value="82" enum="DataFormat"> + 16-bit-per-channel signed floating-point red/green channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R16G16B16_UNORM" value="83" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point red/green/blue channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16_SNORM" value="84" enum="DataFormat"> + 16-bit-per-channel signed floating-point red/green/blue channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16_USCALED" value="85" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point red/green/blue channel data format with scaled value (value is converted from integer to float). Values are in the [code][0.0, 65535.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16_SSCALED" value="86" enum="DataFormat"> + 16-bit-per-channel signed floating-point red/green/blue channel data format with scaled value (value is converted from integer to float). Values are in the [code][-32767.0, 32767.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16_UINT" value="87" enum="DataFormat"> + 16-bit-per-channel unsigned integer red/green/blue channel data format. Values are in the [code][0.0, 65535][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16_SINT" value="88" enum="DataFormat"> + 16-bit-per-channel signed integer red/green/blue channel data format. Values are in the [code][-32767, 32767][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16_SFLOAT" value="89" enum="DataFormat"> + 16-bit-per-channel signed floating-point red/green/blue channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R16G16B16A16_UNORM" value="90" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point red/green/blue/alpha channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16A16_SNORM" value="91" enum="DataFormat"> + 16-bit-per-channel signed floating-point red/green/blue/alpha channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16A16_USCALED" value="92" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point red/green/blue/alpha channel data format with scaled value (value is converted from integer to float). Values are in the [code][0.0, 65535.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16A16_SSCALED" value="93" enum="DataFormat"> + 16-bit-per-channel signed floating-point red/green/blue/alpha channel data format with scaled value (value is converted from integer to float). Values are in the [code][-32767.0, 32767.0][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16A16_UINT" value="94" enum="DataFormat"> + 16-bit-per-channel unsigned integer red/green/blue/alpha channel data format. Values are in the [code][0.0, 65535][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16A16_SINT" value="95" enum="DataFormat"> + 16-bit-per-channel signed integer red/green/blue/alpha channel data format. Values are in the [code][-32767, 32767][/code] range. </constant> <constant name="DATA_FORMAT_R16G16B16A16_SFLOAT" value="96" enum="DataFormat"> + 16-bit-per-channel signed floating-point red/green/blue/alpha channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R32_UINT" value="97" enum="DataFormat"> + 32-bit-per-channel unsigned integer red channel data format. Values are in the [code][0, 2^32 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R32_SINT" value="98" enum="DataFormat"> + 32-bit-per-channel signed integer red channel data format. Values are in the [code][2^31 + 1, 2^31 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R32_SFLOAT" value="99" enum="DataFormat"> + 32-bit-per-channel signed floating-point red channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R32G32_UINT" value="100" enum="DataFormat"> + 32-bit-per-channel unsigned integer red/green channel data format. Values are in the [code][0, 2^32 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R32G32_SINT" value="101" enum="DataFormat"> + 32-bit-per-channel signed integer red/green channel data format. Values are in the [code][2^31 + 1, 2^31 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R32G32_SFLOAT" value="102" enum="DataFormat"> + 32-bit-per-channel signed floating-point red/green channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R32G32B32_UINT" value="103" enum="DataFormat"> + 32-bit-per-channel unsigned integer red/green/blue channel data format. Values are in the [code][0, 2^32 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R32G32B32_SINT" value="104" enum="DataFormat"> + 32-bit-per-channel signed integer red/green/blue channel data format. Values are in the [code][2^31 + 1, 2^31 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R32G32B32_SFLOAT" value="105" enum="DataFormat"> + 32-bit-per-channel signed floating-point red/green/blue channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R32G32B32A32_UINT" value="106" enum="DataFormat"> + 32-bit-per-channel unsigned integer red/green/blue/alpha channel data format. Values are in the [code][0, 2^32 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R32G32B32A32_SINT" value="107" enum="DataFormat"> + 32-bit-per-channel signed integer red/green/blue/alpha channel data format. Values are in the [code][2^31 + 1, 2^31 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R32G32B32A32_SFLOAT" value="108" enum="DataFormat"> + 32-bit-per-channel signed floating-point red/green/blue/alpha channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R64_UINT" value="109" enum="DataFormat"> + 64-bit-per-channel unsigned integer red channel data format. Values are in the [code][0, 2^64 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R64_SINT" value="110" enum="DataFormat"> + 64-bit-per-channel signed integer red channel data format. Values are in the [code][2^63 + 1, 2^63 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R64_SFLOAT" value="111" enum="DataFormat"> + 64-bit-per-channel signed floating-point red channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R64G64_UINT" value="112" enum="DataFormat"> + 64-bit-per-channel unsigned integer red/green channel data format. Values are in the [code][0, 2^64 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R64G64_SINT" value="113" enum="DataFormat"> + 64-bit-per-channel signed integer red/green channel data format. Values are in the [code][2^63 + 1, 2^63 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R64G64_SFLOAT" value="114" enum="DataFormat"> + 64-bit-per-channel signed floating-point red/green channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R64G64B64_UINT" value="115" enum="DataFormat"> + 64-bit-per-channel unsigned integer red/green/blue channel data format. Values are in the [code][0, 2^64 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R64G64B64_SINT" value="116" enum="DataFormat"> + 64-bit-per-channel signed integer red/green/blue channel data format. Values are in the [code][2^63 + 1, 2^63 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R64G64B64_SFLOAT" value="117" enum="DataFormat"> + 64-bit-per-channel signed floating-point red/green/blue channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_R64G64B64A64_UINT" value="118" enum="DataFormat"> + 64-bit-per-channel unsigned integer red/green/blue/alpha channel data format. Values are in the [code][0, 2^64 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R64G64B64A64_SINT" value="119" enum="DataFormat"> + 64-bit-per-channel signed integer red/green/blue/alpha channel data format. Values are in the [code][2^63 + 1, 2^63 - 1][/code] range. </constant> <constant name="DATA_FORMAT_R64G64B64A64_SFLOAT" value="120" enum="DataFormat"> + 64-bit-per-channel signed floating-point red/green/blue/alpha channel data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_B10G11R11_UFLOAT_PACK32" value="121" enum="DataFormat"> + Unsigned floating-point blue/green/red data format with the value stored as-is, packed in 32 bits. The format's precision is 10 bits of blue channel, 11 bits of green channel and 11 bits of red channel. </constant> <constant name="DATA_FORMAT_E5B9G9R9_UFLOAT_PACK32" value="122" enum="DataFormat"> + Unsigned floating-point exposure/blue/green/red data format with the value stored as-is, packed in 32 bits. The format's precision is 5 bits of exposure, 9 bits of blue channel, 9 bits of green channel and 9 bits of red channel. </constant> <constant name="DATA_FORMAT_D16_UNORM" value="123" enum="DataFormat"> + 16-bit unsigned floating-point depth data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_X8_D24_UNORM_PACK32" value="124" enum="DataFormat"> + 24-bit unsigned floating-point depth data format with normalized value, plus 8 unused bits, packed in 32 bits. Values for depth are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_D32_SFLOAT" value="125" enum="DataFormat"> + 32-bit signed floating-point depth data format with the value stored as-is. </constant> <constant name="DATA_FORMAT_S8_UINT" value="126" enum="DataFormat"> + 8-bit unsigned integer stencil data format. </constant> <constant name="DATA_FORMAT_D16_UNORM_S8_UINT" value="127" enum="DataFormat"> + 16-bit unsigned floating-point depth data format with normalized value, plus 8 bits of stencil in unsigned integer format. Values for depth are in the [code][0.0, 1.0][/code] range. Values for stencil are in the [code][0, 255][/code] range. </constant> <constant name="DATA_FORMAT_D24_UNORM_S8_UINT" value="128" enum="DataFormat"> + 24-bit unsigned floating-point depth data format with normalized value, plus 8 bits of stencil in unsigned integer format. Values for depth are in the [code][0.0, 1.0][/code] range. Values for stencil are in the [code][0, 255][/code] range. </constant> <constant name="DATA_FORMAT_D32_SFLOAT_S8_UINT" value="129" enum="DataFormat"> + 32-bit signed floating-point depth data format with the value stored as-is, plus 8 bits of stencil in unsigned integer format. Values for stencil are in the [code][0, 255][/code] range. </constant> <constant name="DATA_FORMAT_BC1_RGB_UNORM_BLOCK" value="130" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. The format's precision is 5 bits of red channel, 6 bits of green channel and 5 bits of blue channel. Using BC1 texture compression (also known as S3TC DXT1). </constant> <constant name="DATA_FORMAT_BC1_RGB_SRGB_BLOCK" value="131" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. The format's precision is 5 bits of red channel, 6 bits of green channel and 5 bits of blue channel. Using BC1 texture compression (also known as S3TC DXT1). </constant> <constant name="DATA_FORMAT_BC1_RGBA_UNORM_BLOCK" value="132" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. The format's precision is 5 bits of red channel, 6 bits of green channel, 5 bits of blue channel and 1 bit of alpha channel. Using BC1 texture compression (also known as S3TC DXT1). </constant> <constant name="DATA_FORMAT_BC1_RGBA_SRGB_BLOCK" value="133" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. The format's precision is 5 bits of red channel, 6 bits of green channel, 5 bits of blue channel and 1 bit of alpha channel. Using BC1 texture compression (also known as S3TC DXT1). </constant> <constant name="DATA_FORMAT_BC2_UNORM_BLOCK" value="134" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. The format's precision is 5 bits of red channel, 6 bits of green channel, 5 bits of blue channel and 4 bits of alpha channel. Using BC2 texture compression (also known as S3TC DXT3). </constant> <constant name="DATA_FORMAT_BC2_SRGB_BLOCK" value="135" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. The format's precision is 5 bits of red channel, 6 bits of green channel, 5 bits of blue channel and 4 bits of alpha channel. Using BC2 texture compression (also known as S3TC DXT3). </constant> <constant name="DATA_FORMAT_BC3_UNORM_BLOCK" value="136" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. The format's precision is 5 bits of red channel, 6 bits of green channel, 5 bits of blue channel and 8 bits of alpha channel. Using BC3 texture compression (also known as S3TC DXT5). </constant> <constant name="DATA_FORMAT_BC3_SRGB_BLOCK" value="137" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. The format's precision is 5 bits of red channel, 6 bits of green channel, 5 bits of blue channel and 8 bits of alpha channel. Using BC3 texture compression (also known as S3TC DXT5). </constant> <constant name="DATA_FORMAT_BC4_UNORM_BLOCK" value="138" enum="DataFormat"> + VRAM-compressed unsigned red channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. The format's precision is 8 bits of red channel. Using BC4 texture compression. </constant> <constant name="DATA_FORMAT_BC4_SNORM_BLOCK" value="139" enum="DataFormat"> + VRAM-compressed signed red channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. The format's precision is 8 bits of red channel. Using BC4 texture compression. </constant> <constant name="DATA_FORMAT_BC5_UNORM_BLOCK" value="140" enum="DataFormat"> + VRAM-compressed unsigned red/green channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. The format's precision is 8 bits of red channel and 8 bits of green channel. Using BC5 texture compression (also known as S3TC RGTC). </constant> <constant name="DATA_FORMAT_BC5_SNORM_BLOCK" value="141" enum="DataFormat"> + VRAM-compressed signed red/green channel data format with normalized value. Values are in the [code][-1.0, 1.0][/code] range. The format's precision is 8 bits of red channel and 8 bits of green channel. Using BC5 texture compression (also known as S3TC RGTC). </constant> <constant name="DATA_FORMAT_BC6H_UFLOAT_BLOCK" value="142" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue channel data format with the floating-point value stored as-is. The format's precision is 8 bits of red channel and 8 bits of green channel. Using BC6H texture compression (also known as BPTC HDR). </constant> <constant name="DATA_FORMAT_BC6H_SFLOAT_BLOCK" value="143" enum="DataFormat"> + VRAM-compressed signed red/green/blue channel data format with the floating-point value stored as-is. The format's precision is between 4 and 7 bits for the red/green/blue channels and between 0 and 8 bits for the alpha channel. Using BC7 texture compression (also known as BPTC HDR). </constant> <constant name="DATA_FORMAT_BC7_UNORM_BLOCK" value="144" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. The format's precision is between 4 and 7 bits for the red/green/blue channels and between 0 and 8 bits for the alpha channel. Also known as BPTC LDR. </constant> <constant name="DATA_FORMAT_BC7_SRGB_BLOCK" value="145" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. The format's precision is between 4 and 7 bits for the red/green/blue channels and between 0 and 8 bits for the alpha channel. Also known as BPTC LDR. </constant> <constant name="DATA_FORMAT_ETC2_R8G8B8_UNORM_BLOCK" value="146" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Using ETC2 texture compression. </constant> <constant name="DATA_FORMAT_ETC2_R8G8B8_SRGB_BLOCK" value="147" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. Using ETC2 texture compression. </constant> <constant name="DATA_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK" value="148" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Red/green/blue use 8 bit of precision each, with alpha using 1 bit of precision. Using ETC2 texture compression. </constant> <constant name="DATA_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK" value="149" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. Red/green/blue use 8 bit of precision each, with alpha using 1 bit of precision. Using ETC2 texture compression. </constant> <constant name="DATA_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK" value="150" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Red/green/blue use 8 bits of precision each, with alpha using 8 bits of precision. Using ETC2 texture compression. </constant> <constant name="DATA_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK" value="151" enum="DataFormat"> + VRAM-compressed unsigned red/green/blue/alpha channel data format with normalized value and non-linear sRGB encoding. Values are in the [code][0.0, 1.0][/code] range. Red/green/blue use 8 bits of precision each, with alpha using 8 bits of precision. Using ETC2 texture compression. </constant> <constant name="DATA_FORMAT_EAC_R11_UNORM_BLOCK" value="152" enum="DataFormat"> + 11-bit VRAM-compressed unsigned red channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Using ETC2 texture compression. </constant> <constant name="DATA_FORMAT_EAC_R11_SNORM_BLOCK" value="153" enum="DataFormat"> + 11-bit VRAM-compressed signed red channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Using ETC2 texture compression. </constant> <constant name="DATA_FORMAT_EAC_R11G11_UNORM_BLOCK" value="154" enum="DataFormat"> + 11-bit VRAM-compressed unsigned red/green channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Using ETC2 texture compression. </constant> <constant name="DATA_FORMAT_EAC_R11G11_SNORM_BLOCK" value="155" enum="DataFormat"> + 11-bit VRAM-compressed signed red/green channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Using ETC2 texture compression. </constant> <constant name="DATA_FORMAT_ASTC_4x4_UNORM_BLOCK" value="156" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 4×4 blocks (highest quality). Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_4x4_SRGB_BLOCK" value="157" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 4×4 blocks (highest quality). Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_5x4_UNORM_BLOCK" value="158" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 5×4 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_5x4_SRGB_BLOCK" value="159" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 5×4 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_5x5_UNORM_BLOCK" value="160" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 5×5 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_5x5_SRGB_BLOCK" value="161" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 5×5 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_6x5_UNORM_BLOCK" value="162" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 6×5 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_6x5_SRGB_BLOCK" value="163" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 6×5 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_6x6_UNORM_BLOCK" value="164" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 6×6 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_6x6_SRGB_BLOCK" value="165" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 6×6 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_8x5_UNORM_BLOCK" value="166" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 8×5 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_8x5_SRGB_BLOCK" value="167" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 8×5 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_8x6_UNORM_BLOCK" value="168" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 8×6 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_8x6_SRGB_BLOCK" value="169" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 8×6 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_8x8_UNORM_BLOCK" value="170" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 8×8 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_8x8_SRGB_BLOCK" value="171" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 8×8 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_10x5_UNORM_BLOCK" value="172" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 10×5 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_10x5_SRGB_BLOCK" value="173" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 10×5 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_10x6_UNORM_BLOCK" value="174" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 10×6 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_10x6_SRGB_BLOCK" value="175" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 10×6 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_10x8_UNORM_BLOCK" value="176" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 10×8 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_10x8_SRGB_BLOCK" value="177" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 10×8 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_10x10_UNORM_BLOCK" value="178" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 10×10 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_10x10_SRGB_BLOCK" value="179" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 10×10 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_12x10_UNORM_BLOCK" value="180" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 12×10 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_12x10_SRGB_BLOCK" value="181" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 12×10 blocks. Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_12x12_UNORM_BLOCK" value="182" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value, packed in 12 blocks (lowest quality). Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_ASTC_12x12_SRGB_BLOCK" value="183" enum="DataFormat"> + VRAM-compressed unsigned floating-point data format with normalized value and non-linear sRGB encoding, packed in 12 blocks (lowest quality). Values are in the [code][0.0, 1.0][/code] range. Using ASTC compression. </constant> <constant name="DATA_FORMAT_G8B8G8R8_422_UNORM" value="184" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point green/blue/red channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_B8G8R8G8_422_UNORM" value="185" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point blue/green/red channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G8_B8_R8_3PLANE_420_UNORM" value="186" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, stored across 3 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal and vertical resolution (i.e. 2×2 adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G8_B8R8_2PLANE_420_UNORM" value="187" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, stored across 2 separate planes (green + blue/red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal and vertical resolution (i.e. 2×2 adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G8_B8_R8_3PLANE_422_UNORM" value="188" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, stored across 2 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G8_B8R8_2PLANE_422_UNORM" value="189" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, stored across 2 separate planes (green + blue/red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G8_B8_R8_3PLANE_444_UNORM" value="190" enum="DataFormat"> + 8-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, stored across 3 separate planes. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R10X6_UNORM_PACK16" value="191" enum="DataFormat"> + 10-bit-per-channel unsigned floating-point red channel data with normalized value, plus 6 unused bits, packed in 16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R10X6G10X6_UNORM_2PACK16" value="192" enum="DataFormat"> + 10-bit-per-channel unsigned floating-point red/green channel data with normalized value, plus 6 unused bits after each channel, packed in 2×16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16" value="193" enum="DataFormat"> + 10-bit-per-channel unsigned floating-point red/green/blue/alpha channel data with normalized value, plus 6 unused bits after each channel, packed in 4×16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16" value="194" enum="DataFormat"> + 10-bit-per-channel unsigned floating-point green/blue/green/red channel data with normalized value, plus 6 unused bits after each channel, packed in 4×16 bits. Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). The green channel is listed twice, but contains different values to allow it to be represented at full resolution. </constant> <constant name="DATA_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16" value="195" enum="DataFormat"> + 10-bit-per-channel unsigned floating-point blue/green/red/green channel data with normalized value, plus 6 unused bits after each channel, packed in 4×16 bits. Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). The green channel is listed twice, but contains different values to allow it to be represented at full resolution. </constant> <constant name="DATA_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16" value="196" enum="DataFormat"> + 10-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Packed in 3×16 bits and stored across 2 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal and vertical resolution (i.e. 2×2 adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16" value="197" enum="DataFormat"> + 10-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Packed in 3×16 bits and stored across 2 separate planes (green + blue/red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal and vertical resolution (i.e. 2×2 adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16" value="198" enum="DataFormat"> + 10-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Packed in 3×16 bits and stored across 3 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16" value="199" enum="DataFormat"> + 10-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Packed in 3×16 bits and stored across 3 separate planes (green + blue/red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16" value="200" enum="DataFormat"> + 10-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Packed in 3×16 bits and stored across 3 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R12X4_UNORM_PACK16" value="201" enum="DataFormat"> + 12-bit-per-channel unsigned floating-point red channel data with normalized value, plus 6 unused bits, packed in 16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R12X4G12X4_UNORM_2PACK16" value="202" enum="DataFormat"> + 12-bit-per-channel unsigned floating-point red/green channel data with normalized value, plus 6 unused bits after each channel, packed in 2×16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16" value="203" enum="DataFormat"> + 12-bit-per-channel unsigned floating-point red/green/blue/alpha channel data with normalized value, plus 6 unused bits after each channel, packed in 4×16 bits. Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16" value="204" enum="DataFormat"> + 12-bit-per-channel unsigned floating-point green/blue/green/red channel data with normalized value, plus 6 unused bits after each channel, packed in 4×16 bits. Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). The green channel is listed twice, but contains different values to allow it to be represented at full resolution. </constant> <constant name="DATA_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16" value="205" enum="DataFormat"> + 12-bit-per-channel unsigned floating-point blue/green/red/green channel data with normalized value, plus 6 unused bits after each channel, packed in 4×16 bits. Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). The green channel is listed twice, but contains different values to allow it to be represented at full resolution. </constant> <constant name="DATA_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16" value="206" enum="DataFormat"> + 12-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Packed in 3×16 bits and stored across 2 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal and vertical resolution (i.e. 2×2 adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16" value="207" enum="DataFormat"> + 12-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Packed in 3×16 bits and stored across 2 separate planes (green + blue/red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal and vertical resolution (i.e. 2×2 adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16" value="208" enum="DataFormat"> + 12-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Packed in 3×16 bits and stored across 3 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16" value="209" enum="DataFormat"> + 12-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Packed in 3×16 bits and stored across 3 separate planes (green + blue/red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16" value="210" enum="DataFormat"> + 12-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Packed in 3×16 bits and stored across 3 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_G16B16G16R16_422_UNORM" value="211" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point green/blue/red channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_B16G16R16G16_422_UNORM" value="212" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point blue/green/red channel data format with normalized value. Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G16_B16_R16_3PLANE_420_UNORM" value="213" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Stored across 2 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal and vertical resolution (i.e. 2×2 adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G16_B16R16_2PLANE_420_UNORM" value="214" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Stored across 2 separate planes (green + blue/red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal and vertical resolution (i.e. 2×2 adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G16_B16_R16_3PLANE_422_UNORM" value="215" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Stored across 3 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G16_B16R16_2PLANE_422_UNORM" value="216" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Stored across 3 separate planes (green + blue/red). Values are in the [code][0.0, 1.0][/code] range. Blue and red channel data is stored at halved horizontal resolution (i.e. 2 horizontally adjacent pixels will share the same value for the blue/red channel). </constant> <constant name="DATA_FORMAT_G16_B16_R16_3PLANE_444_UNORM" value="217" enum="DataFormat"> + 16-bit-per-channel unsigned floating-point green/blue/red channel data with normalized value, plus 6 unused bits after each channel. Stored across 3 separate planes (green + blue + red). Values are in the [code][0.0, 1.0][/code] range. </constant> <constant name="DATA_FORMAT_MAX" value="218" enum="DataFormat"> + Represents the size of the [enum DataFormat] enum. </constant> <constant name="BARRIER_MASK_RASTER" value="1" enum="BarrierMask" is_bitfield="true"> + Raster barrier mask. </constant> <constant name="BARRIER_MASK_COMPUTE" value="2" enum="BarrierMask" is_bitfield="true"> + Compute barrier mask. </constant> <constant name="BARRIER_MASK_TRANSFER" value="4" enum="BarrierMask" is_bitfield="true"> + Transfer barrier mask. </constant> <constant name="BARRIER_MASK_ALL_BARRIERS" value="7" enum="BarrierMask" is_bitfield="true"> + Barrier mask for all types (raster, compute, transfer). Equivalent to [code]BARRIER_MASK_RASTER | BARRIER_MASK_COMPUTE | BARRIER_MASK_TRANSFER[/code]. </constant> <constant name="BARRIER_MASK_NO_BARRIER" value="8" enum="BarrierMask" is_bitfield="true"> + No barrier for any type. </constant> <constant name="TEXTURE_TYPE_1D" value="0" enum="TextureType"> 1-dimensional texture. @@ -1203,63 +1612,91 @@ Represents the size of the [enum TextureType] enum. </constant> <constant name="TEXTURE_SAMPLES_1" value="0" enum="TextureSamples"> + Perform 1 texture sample (this is the fastest but lowest-quality for antialiasing). </constant> <constant name="TEXTURE_SAMPLES_2" value="1" enum="TextureSamples"> + Perform 2 texture samples. </constant> <constant name="TEXTURE_SAMPLES_4" value="2" enum="TextureSamples"> + Perform 4 texture samples. </constant> <constant name="TEXTURE_SAMPLES_8" value="3" enum="TextureSamples"> + Perform 8 texture samples. Not supported on mobile GPUs (including Apple Silicon). </constant> <constant name="TEXTURE_SAMPLES_16" value="4" enum="TextureSamples"> + Perform 16 texture samples. Not supported on mobile GPUs and many desktop GPUs. </constant> <constant name="TEXTURE_SAMPLES_32" value="5" enum="TextureSamples"> + Perform 32 texture samples. Not supported on most GPUs. </constant> <constant name="TEXTURE_SAMPLES_64" value="6" enum="TextureSamples"> + Perform 64 texture samples (this is the slowest but highest-quality for antialiasing). Not supported on most GPUs. </constant> <constant name="TEXTURE_SAMPLES_MAX" value="7" enum="TextureSamples"> Represents the size of the [enum TextureSamples] enum. </constant> <constant name="TEXTURE_USAGE_SAMPLING_BIT" value="1" enum="TextureUsageBits" is_bitfield="true"> + Texture can be sampled. </constant> <constant name="TEXTURE_USAGE_COLOR_ATTACHMENT_BIT" value="2" enum="TextureUsageBits" is_bitfield="true"> + Texture can be used as a color attachment in a framebuffer. </constant> <constant name="TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT" value="4" enum="TextureUsageBits" is_bitfield="true"> + Texture can be used as a depth/stencil attachment in a framebuffer. </constant> <constant name="TEXTURE_USAGE_STORAGE_BIT" value="8" enum="TextureUsageBits" is_bitfield="true"> + Texture can be used as a [url=https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#descriptorsets-storageimage]storage image[/url]. </constant> <constant name="TEXTURE_USAGE_STORAGE_ATOMIC_BIT" value="16" enum="TextureUsageBits" is_bitfield="true"> + Texture can be used as a [url=https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#descriptorsets-storageimage]storage image[/url] with support for atomic operations. </constant> <constant name="TEXTURE_USAGE_CPU_READ_BIT" value="32" enum="TextureUsageBits" is_bitfield="true"> + Texture can be read back on the CPU using [method texture_get_data] faster than without this bit, since it is always kept in the system memory. </constant> <constant name="TEXTURE_USAGE_CAN_UPDATE_BIT" value="64" enum="TextureUsageBits" is_bitfield="true"> + Texture can be updated using [method texture_update]. </constant> <constant name="TEXTURE_USAGE_CAN_COPY_FROM_BIT" value="128" enum="TextureUsageBits" is_bitfield="true"> + Texture can be a source for [method texture_copy]. </constant> <constant name="TEXTURE_USAGE_CAN_COPY_TO_BIT" value="256" enum="TextureUsageBits" is_bitfield="true"> + Texture can be a destination for [method texture_copy]. </constant> <constant name="TEXTURE_USAGE_INPUT_ATTACHMENT_BIT" value="512" enum="TextureUsageBits" is_bitfield="true"> + Texture can be used as a [url=https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#descriptorsets-inputattachment]input attachment[/url] in a framebuffer. </constant> <constant name="TEXTURE_SWIZZLE_IDENTITY" value="0" enum="TextureSwizzle"> + Return the sampled value as-is. </constant> <constant name="TEXTURE_SWIZZLE_ZERO" value="1" enum="TextureSwizzle"> + Always return [code]0.0[/code] when sampling. </constant> <constant name="TEXTURE_SWIZZLE_ONE" value="2" enum="TextureSwizzle"> + Always return [code]1.0[/code] when sampling. </constant> <constant name="TEXTURE_SWIZZLE_R" value="3" enum="TextureSwizzle"> + Sample the red color channel. </constant> <constant name="TEXTURE_SWIZZLE_G" value="4" enum="TextureSwizzle"> + Sample the green color channel. </constant> <constant name="TEXTURE_SWIZZLE_B" value="5" enum="TextureSwizzle"> + Sample the blue color channel. </constant> <constant name="TEXTURE_SWIZZLE_A" value="6" enum="TextureSwizzle"> + Sample the alpha channel. </constant> <constant name="TEXTURE_SWIZZLE_MAX" value="7" enum="TextureSwizzle"> + Represents the size of the [enum TextureSwizzle] enum. </constant> <constant name="TEXTURE_SLICE_2D" value="0" enum="TextureSliceType"> + 2-dimensional texture slice. </constant> <constant name="TEXTURE_SLICE_CUBEMAP" value="1" enum="TextureSliceType"> + Cubemap texture slice. </constant> <constant name="TEXTURE_SLICE_3D" value="2" enum="TextureSliceType"> + 3-dimensional texture slice. </constant> <constant name="SAMPLER_FILTER_NEAREST" value="0" enum="SamplerFilter"> Nearest-neighbor sampler filtering. Sampling at higher resolutions than the source will result in a pixelated look. @@ -1268,209 +1705,311 @@ Bilinear sampler filtering. Sampling at higher resolutions than the source will result in a blurry look. </constant> <constant name="SAMPLER_REPEAT_MODE_REPEAT" value="0" enum="SamplerRepeatMode"> + Sample with repeating enabled. </constant> <constant name="SAMPLER_REPEAT_MODE_MIRRORED_REPEAT" value="1" enum="SamplerRepeatMode"> + Sample with mirrored repeating enabled. When sampling outside the [code][0.0, 1.0][/code] range, return a mirrorred version of the sampler. This mirrored version is mirrored again if sampling further away, with the pattern repeating indefinitely. </constant> <constant name="SAMPLER_REPEAT_MODE_CLAMP_TO_EDGE" value="2" enum="SamplerRepeatMode"> + Sample with repeating disabled. When sampling outside the [code][0.0, 1.0][/code] range, return the color of the last pixel on the edge. </constant> <constant name="SAMPLER_REPEAT_MODE_CLAMP_TO_BORDER" value="3" enum="SamplerRepeatMode"> + Sample with repeating disabled. When sampling outside the [code][0.0, 1.0][/code] range, return the specified [member RDSamplerState.border_color]. </constant> <constant name="SAMPLER_REPEAT_MODE_MIRROR_CLAMP_TO_EDGE" value="4" enum="SamplerRepeatMode"> + Sample with mirorred repeating enabled, but only once. When sampling in the [code][-1.0, 0.0][/code] range, return a mirrored version of the sampler. When sampling outside the [code][-1.0, 1.0][/code] range, return the color of the last pixel on the edge. </constant> <constant name="SAMPLER_REPEAT_MODE_MAX" value="5" enum="SamplerRepeatMode"> + Represents the size of the [enum SamplerRepeatMode] enum. </constant> <constant name="SAMPLER_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK" value="0" enum="SamplerBorderColor"> + Return a floating-point transparent black color when sampling outside the [code][0.0, 1.0][/code] range. Only effective if the sampler repeat mode is [constant SAMPLER_REPEAT_MODE_CLAMP_TO_BORDER]. </constant> <constant name="SAMPLER_BORDER_COLOR_INT_TRANSPARENT_BLACK" value="1" enum="SamplerBorderColor"> + Return a integer transparent black color when sampling outside the [code][0.0, 1.0][/code] range. Only effective if the sampler repeat mode is [constant SAMPLER_REPEAT_MODE_CLAMP_TO_BORDER]. </constant> <constant name="SAMPLER_BORDER_COLOR_FLOAT_OPAQUE_BLACK" value="2" enum="SamplerBorderColor"> + Return a floating-point opaque black color when sampling outside the [code][0.0, 1.0][/code] range. Only effective if the sampler repeat mode is [constant SAMPLER_REPEAT_MODE_CLAMP_TO_BORDER]. </constant> <constant name="SAMPLER_BORDER_COLOR_INT_OPAQUE_BLACK" value="3" enum="SamplerBorderColor"> + Return a integer opaque black color when sampling outside the [code][0.0, 1.0][/code] range. Only effective if the sampler repeat mode is [constant SAMPLER_REPEAT_MODE_CLAMP_TO_BORDER]. </constant> <constant name="SAMPLER_BORDER_COLOR_FLOAT_OPAQUE_WHITE" value="4" enum="SamplerBorderColor"> + Return a floating-point opaque white color when sampling outside the [code][0.0, 1.0][/code] range. Only effective if the sampler repeat mode is [constant SAMPLER_REPEAT_MODE_CLAMP_TO_BORDER]. </constant> <constant name="SAMPLER_BORDER_COLOR_INT_OPAQUE_WHITE" value="5" enum="SamplerBorderColor"> + Return a integer opaque white color when sampling outside the [code][0.0, 1.0][/code] range. Only effective if the sampler repeat mode is [constant SAMPLER_REPEAT_MODE_CLAMP_TO_BORDER]. </constant> <constant name="SAMPLER_BORDER_COLOR_MAX" value="6" enum="SamplerBorderColor"> + Represents the size of the [enum SamplerBorderColor] enum. </constant> <constant name="VERTEX_FREQUENCY_VERTEX" value="0" enum="VertexFrequency"> + Vertex attribute addressing is a function of the vertex. This is used to specify the rate at which vertex attributes are pulled from buffers. </constant> <constant name="VERTEX_FREQUENCY_INSTANCE" value="1" enum="VertexFrequency"> + Vertex attribute addressing is a function of the instance index. This is used to specify the rate at which vertex attributes are pulled from buffers. </constant> <constant name="INDEX_BUFFER_FORMAT_UINT16" value="0" enum="IndexBufferFormat"> + Index buffer in 16-bit unsigned integer format. This limits the maximum index that can be specified to [code]65535[/code]. </constant> <constant name="INDEX_BUFFER_FORMAT_UINT32" value="1" enum="IndexBufferFormat"> + Index buffer in 32-bit unsigned integer format. This limits the maximum index that can be specified to [code]4294967295[/code]. </constant> <constant name="STORAGE_BUFFER_USAGE_DISPATCH_INDIRECT" value="1" enum="StorageBufferUsage" is_bitfield="true"> </constant> <constant name="UNIFORM_TYPE_SAMPLER" value="0" enum="UniformType"> + Sampler uniform. TODO: Difference between sampler and texture uniform </constant> <constant name="UNIFORM_TYPE_SAMPLER_WITH_TEXTURE" value="1" enum="UniformType"> + Sampler uniform with a texture. </constant> <constant name="UNIFORM_TYPE_TEXTURE" value="2" enum="UniformType"> + Texture uniform. </constant> <constant name="UNIFORM_TYPE_IMAGE" value="3" enum="UniformType"> + Image uniform. TODO: Difference between texture and image uniform </constant> <constant name="UNIFORM_TYPE_TEXTURE_BUFFER" value="4" enum="UniformType"> + Texture buffer uniform. TODO: Difference between texture and texture buffe uniformr </constant> <constant name="UNIFORM_TYPE_SAMPLER_WITH_TEXTURE_BUFFER" value="5" enum="UniformType"> + Sampler uniform with a texture buffer. TODO: Difference between texture and texture buffer uniform </constant> <constant name="UNIFORM_TYPE_IMAGE_BUFFER" value="6" enum="UniformType"> + Image buffer uniform. TODO: Difference between texture and image uniforms </constant> <constant name="UNIFORM_TYPE_UNIFORM_BUFFER" value="7" enum="UniformType"> + Uniform buffer uniform. </constant> <constant name="UNIFORM_TYPE_STORAGE_BUFFER" value="8" enum="UniformType"> + [url=https://vkguide.dev/docs/chapter-4/storage_buffers/]Storage buffer[/url] uniform. </constant> <constant name="UNIFORM_TYPE_INPUT_ATTACHMENT" value="9" enum="UniformType"> + Input attachment uniform. </constant> <constant name="UNIFORM_TYPE_MAX" value="10" enum="UniformType"> + Represents the size of the [enum UniformType] enum. </constant> <constant name="RENDER_PRIMITIVE_POINTS" value="0" enum="RenderPrimitive"> Point rendering primitive (with constant size, regardless of distance from camera). </constant> <constant name="RENDER_PRIMITIVE_LINES" value="1" enum="RenderPrimitive"> - Line rendering primitive. + Line list rendering primitive. Lines are drawn separated from each other. </constant> <constant name="RENDER_PRIMITIVE_LINES_WITH_ADJACENCY" value="2" enum="RenderPrimitive"> + [url=https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#drawing-line-lists-with-adjacency]Line list rendering primitive with adjacency.[/url] + [b]Note:[/b] Adjacency is only useful with geometry shaders, which Godot does not expose. </constant> <constant name="RENDER_PRIMITIVE_LINESTRIPS" value="3" enum="RenderPrimitive"> + Line strip rendering primitive. Lines drawn are connected to the previous vertex. </constant> <constant name="RENDER_PRIMITIVE_LINESTRIPS_WITH_ADJACENCY" value="4" enum="RenderPrimitive"> + [url=https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#drawing-line-strips-with-adjacency]Line strip rendering primitive with adjacency.[/url] + [b]Note:[/b] Adjacency is only useful with geometry shaders, which Godot does not expose. </constant> <constant name="RENDER_PRIMITIVE_TRIANGLES" value="5" enum="RenderPrimitive"> + Triangle list rendering primitive. Triangles are drawn separated from each other. </constant> <constant name="RENDER_PRIMITIVE_TRIANGLES_WITH_ADJACENCY" value="6" enum="RenderPrimitive"> + [url=https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#drawing-triangle-lists-with-adjacency]Triangle list rendering primitive with adjacency.[/url] + [b]Note:[/b] Adjacency is only useful with geometry shaders, which Godot does not expose. </constant> <constant name="RENDER_PRIMITIVE_TRIANGLE_STRIPS" value="7" enum="RenderPrimitive"> + Triangle strip rendering primitive. Triangles drawn are connected to the previous triangle. </constant> <constant name="RENDER_PRIMITIVE_TRIANGLE_STRIPS_WITH_AJACENCY" value="8" enum="RenderPrimitive"> + [url=https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#drawing-triangle-strips-with-adjacency]Triangle strip rendering primitive with adjacency.[/url] + [b]Note:[/b] Adjacency is only useful with geometry shaders, which Godot does not expose. </constant> <constant name="RENDER_PRIMITIVE_TRIANGLE_STRIPS_WITH_RESTART_INDEX" value="9" enum="RenderPrimitive"> + Triangle strip rendering primitive with [i]primitive restart[/i] enabled. Triangles drawn are connected to the previous triangle, but a primitive restart index can be specified before drawing to create a second triangle strip after the specified index. + [b]Note:[/b] Only compatible with indexed draws. </constant> <constant name="RENDER_PRIMITIVE_TESSELATION_PATCH" value="10" enum="RenderPrimitive"> + Tessellation patch rendering primitive. Only useful with tessellation shaders, which can be used to deform these patches. </constant> <constant name="RENDER_PRIMITIVE_MAX" value="11" enum="RenderPrimitive"> + Represents the size of the [enum RenderPrimitive] enum. </constant> <constant name="POLYGON_CULL_DISABLED" value="0" enum="PolygonCullMode"> + Do not use polygon front face or backface culling. </constant> <constant name="POLYGON_CULL_FRONT" value="1" enum="PolygonCullMode"> + Use polygon frontface culling (faces pointing towards the camera are hidden). </constant> <constant name="POLYGON_CULL_BACK" value="2" enum="PolygonCullMode"> + Use polygon backface culling (faces pointing away from the camera are hidden). </constant> <constant name="POLYGON_FRONT_FACE_CLOCKWISE" value="0" enum="PolygonFrontFace"> + Clockwise winding order to determine which face of a polygon is its front face. </constant> <constant name="POLYGON_FRONT_FACE_COUNTER_CLOCKWISE" value="1" enum="PolygonFrontFace"> + Counter-clockwise winding order to determine which face of a polygon is its front face. </constant> <constant name="STENCIL_OP_KEEP" value="0" enum="StencilOperation"> + Keep the current stencil value. </constant> <constant name="STENCIL_OP_ZERO" value="1" enum="StencilOperation"> + Set the stencil value to [code]0[/code]. </constant> <constant name="STENCIL_OP_REPLACE" value="2" enum="StencilOperation"> + Replace the existing stencil value with the new one. </constant> <constant name="STENCIL_OP_INCREMENT_AND_CLAMP" value="3" enum="StencilOperation"> + Increment the existing stencil value and clamp to the maximum representable unsigned value if reached. Stencil bits are considered as an unsigned integer. </constant> <constant name="STENCIL_OP_DECREMENT_AND_CLAMP" value="4" enum="StencilOperation"> + Decrement the existing stencil value and clamp to the minimum value if reached. Stencil bits are considered as an unsigned integer. </constant> <constant name="STENCIL_OP_INVERT" value="5" enum="StencilOperation"> + Bitwise-invert the existing stencil value. </constant> <constant name="STENCIL_OP_INCREMENT_AND_WRAP" value="6" enum="StencilOperation"> + Increment the stencil value and wrap around to [code]0[/code] if reaching the maximum representable unsigned. Stencil bits are considered as an unsigned integer. </constant> <constant name="STENCIL_OP_DECREMENT_AND_WRAP" value="7" enum="StencilOperation"> + Decrement the stencil value and wrap around to the maximum representable unsigned if reaching the minimum. Stencil bits are considered as an unsigned integer. </constant> <constant name="STENCIL_OP_MAX" value="8" enum="StencilOperation"> + Represents the size of the [enum StencilOperation] enum. </constant> <constant name="COMPARE_OP_NEVER" value="0" enum="CompareOperator"> + "Never" comparison (opposite of [constant COMPARE_OP_ALWAYS]). </constant> <constant name="COMPARE_OP_LESS" value="1" enum="CompareOperator"> + "Less than" comparison. </constant> <constant name="COMPARE_OP_EQUAL" value="2" enum="CompareOperator"> + "Equal" comparison. </constant> <constant name="COMPARE_OP_LESS_OR_EQUAL" value="3" enum="CompareOperator"> + "Less than or equal" comparison. </constant> <constant name="COMPARE_OP_GREATER" value="4" enum="CompareOperator"> + "Greater than" comparison. </constant> <constant name="COMPARE_OP_NOT_EQUAL" value="5" enum="CompareOperator"> + "Not equal" comparison. </constant> <constant name="COMPARE_OP_GREATER_OR_EQUAL" value="6" enum="CompareOperator"> + "Greater than or equal" comparison. </constant> <constant name="COMPARE_OP_ALWAYS" value="7" enum="CompareOperator"> + "Always" comparison (opposite of [constant COMPARE_OP_NEVER]). </constant> <constant name="COMPARE_OP_MAX" value="8" enum="CompareOperator"> + Represents the size of the [enum CompareOperator] enum. </constant> <constant name="LOGIC_OP_CLEAR" value="0" enum="LogicOperation"> + Clear logic operation (result is always [code]0[/code]). See also [constant LOGIC_OP_SET]. </constant> <constant name="LOGIC_OP_AND" value="1" enum="LogicOperation"> + AND logic operation. </constant> <constant name="LOGIC_OP_AND_REVERSE" value="2" enum="LogicOperation"> + AND logic operation with the [i]destination[/i] operand being inverted. See also [constant LOGIC_OP_AND_INVERTED]. </constant> <constant name="LOGIC_OP_COPY" value="3" enum="LogicOperation"> + Copy logic operation (keeps the [i]source[/i] value as-is). See also [constant LOGIC_OP_COPY_INVERTED] and [constant LOGIC_OP_NO_OP]. </constant> <constant name="LOGIC_OP_AND_INVERTED" value="4" enum="LogicOperation"> + AND logic operation with the [i]source[/i] operand being inverted. See also [constant LOGIC_OP_AND_REVERSE]. </constant> <constant name="LOGIC_OP_NO_OP" value="5" enum="LogicOperation"> + No-op logic operation (keeps the [i]destination[/i] value as-is). See also [constant LOGIC_OP_COPY]. </constant> <constant name="LOGIC_OP_XOR" value="6" enum="LogicOperation"> Exclusive or (XOR) logic operation. </constant> <constant name="LOGIC_OP_OR" value="7" enum="LogicOperation"> + OR logic operation. </constant> <constant name="LOGIC_OP_NOR" value="8" enum="LogicOperation"> + Not-OR (NOR) logic operation. </constant> <constant name="LOGIC_OP_EQUIVALENT" value="9" enum="LogicOperation"> + Not-XOR (XNOR) logic operation. </constant> <constant name="LOGIC_OP_INVERT" value="10" enum="LogicOperation"> + Invert logic operation. </constant> <constant name="LOGIC_OP_OR_REVERSE" value="11" enum="LogicOperation"> + OR logic operation with the [i]destination[/i] operand being inverted. See also [constant LOGIC_OP_OR_REVERSE]. </constant> <constant name="LOGIC_OP_COPY_INVERTED" value="12" enum="LogicOperation"> + NOT logic operation (inverts the value). See also [constant LOGIC_OP_COPY]. </constant> <constant name="LOGIC_OP_OR_INVERTED" value="13" enum="LogicOperation"> + OR logic operation with the [i]source[/i] operand being inverted. See also [constant LOGIC_OP_OR_REVERSE]. </constant> <constant name="LOGIC_OP_NAND" value="14" enum="LogicOperation"> + Not-AND (NAND) logic operation. </constant> <constant name="LOGIC_OP_SET" value="15" enum="LogicOperation"> + SET logic operation (result is always [code]1[/code]). See also [constant LOGIC_OP_CLEAR]. </constant> <constant name="LOGIC_OP_MAX" value="16" enum="LogicOperation"> + Represents the size of the [enum LogicOperation] enum. </constant> <constant name="BLEND_FACTOR_ZERO" value="0" enum="BlendFactor"> + Constant [code]0.0[/code] blend factor. </constant> <constant name="BLEND_FACTOR_ONE" value="1" enum="BlendFactor"> + Constant [code]1.0[/code] blend factor. </constant> <constant name="BLEND_FACTOR_SRC_COLOR" value="2" enum="BlendFactor"> + Color blend factor is [code]source color[/code]. Alpha blend factor is [code]source alpha[/code]. </constant> <constant name="BLEND_FACTOR_ONE_MINUS_SRC_COLOR" value="3" enum="BlendFactor"> + Color blend factor is [code]1.0 - source color[/code]. Alpha blend factor is [code]1.0 - source alpha[/code]. </constant> <constant name="BLEND_FACTOR_DST_COLOR" value="4" enum="BlendFactor"> + Color blend factor is [code]destination color[/code]. Alpha blend factor is [code]destination alpha[/code]. </constant> <constant name="BLEND_FACTOR_ONE_MINUS_DST_COLOR" value="5" enum="BlendFactor"> + Color blend factor is [code]1.0 - destination color[/code]. Alpha blend factor is [code]1.0 - destination alpha[/code]. </constant> <constant name="BLEND_FACTOR_SRC_ALPHA" value="6" enum="BlendFactor"> + Color and alpha blend factor is [code]source alpha[/code]. </constant> <constant name="BLEND_FACTOR_ONE_MINUS_SRC_ALPHA" value="7" enum="BlendFactor"> + Color and alpha blend factor is [code]1.0 - source alpha[/code]. </constant> <constant name="BLEND_FACTOR_DST_ALPHA" value="8" enum="BlendFactor"> + Color and alpha blend factor is [code]destination alpha[/code]. </constant> <constant name="BLEND_FACTOR_ONE_MINUS_DST_ALPHA" value="9" enum="BlendFactor"> + Color and alpha blend factor is [code]1.0 - destination alpha[/code]. </constant> <constant name="BLEND_FACTOR_CONSTANT_COLOR" value="10" enum="BlendFactor"> + Color blend factor is [code]blend constant color[/code]. Alpha blend factor is [code]blend constant alpha[/code] (see [method draw_list_set_blend_constants]). </constant> <constant name="BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR" value="11" enum="BlendFactor"> + Color blend factor is [code]1.0 - blend constant color[/code]. Alpha blend factor is [code]1.0 - blend constant alpha[/code] (see [method draw_list_set_blend_constants]). </constant> <constant name="BLEND_FACTOR_CONSTANT_ALPHA" value="12" enum="BlendFactor"> + Color and alpha blend factor is [code]blend constant alpha[/code] (see [method draw_list_set_blend_constants]). </constant> <constant name="BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA" value="13" enum="BlendFactor"> + Color and alpha blend factor is [code]1.0 - blend constant alpha[/code] (see [method draw_list_set_blend_constants]). </constant> <constant name="BLEND_FACTOR_SRC_ALPHA_SATURATE" value="14" enum="BlendFactor"> + Color blend factor is [code]min(source alpha, 1.0 - destination alpha)[/code]. Alpha blend factor is [code]1.0[/code]. </constant> <constant name="BLEND_FACTOR_SRC1_COLOR" value="15" enum="BlendFactor"> + Color blend factor is [code]second source color[/code]. Alpha blend factor is [code]second source alpha[/code]. Only relevant for dual-source blending. </constant> <constant name="BLEND_FACTOR_ONE_MINUS_SRC1_COLOR" value="16" enum="BlendFactor"> + Color blend factor is [code]1.0 - second source color[/code]. Alpha blend factor is [code]1.0 - second source alpha[/code]. Only relevant for dual-source blending. </constant> <constant name="BLEND_FACTOR_SRC1_ALPHA" value="17" enum="BlendFactor"> + Color and alpha blend factor is [code]second source alpha[/code]. Only relevant for dual-source blending. </constant> <constant name="BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA" value="18" enum="BlendFactor"> + Color and alpha blend factor is [code]1.0 - second source alpha[/code]. Only relevant for dual-source blending. </constant> <constant name="BLEND_FACTOR_MAX" value="19" enum="BlendFactor"> + Represents the size of the [enum BlendFactor] enum. </constant> <constant name="BLEND_OP_ADD" value="0" enum="BlendOperation"> Additive blending operation ([code]source + destination[/code]). @@ -1517,68 +2056,100 @@ <constant name="INITIAL_ACTION_CONTINUE" value="5" enum="InitialAction"> </constant> <constant name="INITIAL_ACTION_MAX" value="6" enum="InitialAction"> + Represents the size of the [enum InitialAction] enum. </constant> <constant name="FINAL_ACTION_READ" value="0" enum="FinalAction"> + Store the texture for reading and make it read-only if it has the [constant TEXTURE_USAGE_SAMPLING_BIT] bit (only applies to color, depth and stencil attachments). </constant> <constant name="FINAL_ACTION_DISCARD" value="1" enum="FinalAction"> + Discard the texture data and make it read-only if it has the [constant TEXTURE_USAGE_SAMPLING_BIT] bit (only applies to color, depth and stencil attachments). </constant> <constant name="FINAL_ACTION_CONTINUE" value="2" enum="FinalAction"> + Store the texture and continue for further processing. Similar to [constant FINAL_ACTION_READ], but does not make the texture read-only if it has the [constant TEXTURE_USAGE_SAMPLING_BIT] bit. </constant> <constant name="FINAL_ACTION_MAX" value="3" enum="FinalAction"> + Represents the size of the [enum FinalAction] enum. </constant> <constant name="SHADER_STAGE_VERTEX" value="0" enum="ShaderStage"> + Vertex shader stage. This can be used to manipulate vertices from a shader (but not create new vertices). </constant> <constant name="SHADER_STAGE_FRAGMENT" value="1" enum="ShaderStage"> + Fragment shader stage (called "pixel shader" in Direct3D). This can be used to manipulate pixels from a shader. </constant> <constant name="SHADER_STAGE_TESSELATION_CONTROL" value="2" enum="ShaderStage"> + Tessellation control shader stage. This can be used to create additional geometry from a shader. </constant> <constant name="SHADER_STAGE_TESSELATION_EVALUATION" value="3" enum="ShaderStage"> + Tessellation evaluation shader stage. This can be used to create additional geometry from a shader. </constant> <constant name="SHADER_STAGE_COMPUTE" value="4" enum="ShaderStage"> + Compute shader stage. This can be used to run arbitrary computing tasks in a shader, performing them on the GPU instead of the CPU. </constant> <constant name="SHADER_STAGE_MAX" value="5" enum="ShaderStage"> + Represents the size of the [enum ShaderStage] enum. </constant> <constant name="SHADER_STAGE_VERTEX_BIT" value="1" enum="ShaderStage"> + Vertex shader stage bit (see also [constant SHADER_STAGE_VERTEX]). </constant> <constant name="SHADER_STAGE_FRAGMENT_BIT" value="2" enum="ShaderStage"> + Fragment shader stage bit (see also [constant SHADER_STAGE_FRAGMENT]). </constant> <constant name="SHADER_STAGE_TESSELATION_CONTROL_BIT" value="4" enum="ShaderStage"> + Tessellation control shader stage bit (see also [constant SHADER_STAGE_TESSELATION_CONTROL]). </constant> <constant name="SHADER_STAGE_TESSELATION_EVALUATION_BIT" value="8" enum="ShaderStage"> + Tessellation evaluation shader stage bit (see also [constant SHADER_STAGE_TESSELATION_EVALUATION]). </constant> <constant name="SHADER_STAGE_COMPUTE_BIT" value="16" enum="ShaderStage"> + Compute shader stage bit (see also [constant SHADER_STAGE_COMPUTE]). </constant> <constant name="SHADER_LANGUAGE_GLSL" value="0" enum="ShaderLanguage"> + Khronos' GLSL shading language (used natively by OpenGL and Vulkan). This is the language used for core Godot shaders. </constant> <constant name="SHADER_LANGUAGE_HLSL" value="1" enum="ShaderLanguage"> + Microsoft's High-Level Shading Language (used natively by Direct3D, but can also be used in Vulkan). </constant> <constant name="PIPELINE_SPECIALIZATION_CONSTANT_TYPE_BOOL" value="0" enum="PipelineSpecializationConstantType"> + Boolean specialization constant. </constant> <constant name="PIPELINE_SPECIALIZATION_CONSTANT_TYPE_INT" value="1" enum="PipelineSpecializationConstantType"> + Integer specialization constant. </constant> <constant name="PIPELINE_SPECIALIZATION_CONSTANT_TYPE_FLOAT" value="2" enum="PipelineSpecializationConstantType"> + Floating-point specialization constant. </constant> <constant name="LIMIT_MAX_BOUND_UNIFORM_SETS" value="0" enum="Limit"> + Maximum number of uniform sets that can be bound at a given time. </constant> <constant name="LIMIT_MAX_FRAMEBUFFER_COLOR_ATTACHMENTS" value="1" enum="Limit"> + Maximum number of color framebuffer attachments that can be used at a given time. </constant> <constant name="LIMIT_MAX_TEXTURES_PER_UNIFORM_SET" value="2" enum="Limit"> + Maximum number of textures that can be used per uniform set. </constant> <constant name="LIMIT_MAX_SAMPLERS_PER_UNIFORM_SET" value="3" enum="Limit"> + Maximum number of samplers that can be used per uniform set. </constant> <constant name="LIMIT_MAX_STORAGE_BUFFERS_PER_UNIFORM_SET" value="4" enum="Limit"> + Maximum number of [url=https://vkguide.dev/docs/chapter-4/storage_buffers/]storage buffers[/url] per uniform set. </constant> <constant name="LIMIT_MAX_STORAGE_IMAGES_PER_UNIFORM_SET" value="5" enum="Limit"> + Maximum number of storage images per uniform set. </constant> <constant name="LIMIT_MAX_UNIFORM_BUFFERS_PER_UNIFORM_SET" value="6" enum="Limit"> + Maximum number of uniform buffers per uniform set. </constant> <constant name="LIMIT_MAX_DRAW_INDEXED_INDEX" value="7" enum="Limit"> + Maximum index for an indexed draw command. </constant> <constant name="LIMIT_MAX_FRAMEBUFFER_HEIGHT" value="8" enum="Limit"> + Maximum height of a framebuffer (in pixels). </constant> <constant name="LIMIT_MAX_FRAMEBUFFER_WIDTH" value="9" enum="Limit"> + Maximum width of a framebuffer (in pixels). </constant> <constant name="LIMIT_MAX_TEXTURE_ARRAY_LAYERS" value="10" enum="Limit"> + Maximum number of texture array layers. </constant> <constant name="LIMIT_MAX_TEXTURE_SIZE_1D" value="11" enum="Limit"> Maximum supported 1-dimensional texture size (in pixels on a single axis). @@ -1593,48 +2164,70 @@ Maximum supported cubemap texture size (in pixels on a single axis of a single face). </constant> <constant name="LIMIT_MAX_TEXTURES_PER_SHADER_STAGE" value="15" enum="Limit"> + Maximum number of textures per shader stage. </constant> <constant name="LIMIT_MAX_SAMPLERS_PER_SHADER_STAGE" value="16" enum="Limit"> + Maximum number of samplers per shader stage. </constant> <constant name="LIMIT_MAX_STORAGE_BUFFERS_PER_SHADER_STAGE" value="17" enum="Limit"> + Maximum number of [url=https://vkguide.dev/docs/chapter-4/storage_buffers/]storage buffers[/url] per shader stage. </constant> <constant name="LIMIT_MAX_STORAGE_IMAGES_PER_SHADER_STAGE" value="18" enum="Limit"> + Maximum number of storage images per shader stage. </constant> <constant name="LIMIT_MAX_UNIFORM_BUFFERS_PER_SHADER_STAGE" value="19" enum="Limit"> + Maximum number of uniform buffers per uniform set. </constant> <constant name="LIMIT_MAX_PUSH_CONSTANT_SIZE" value="20" enum="Limit"> + Maximum size of a push constant. A lot of devices are limited to 128 bytes, so try to avoid exceeding 128 bytes in push constants to ensure compatibility even if your GPU is reporting a higher value. </constant> <constant name="LIMIT_MAX_UNIFORM_BUFFER_SIZE" value="21" enum="Limit"> + Maximum size of a uniform buffer. </constant> <constant name="LIMIT_MAX_VERTEX_INPUT_ATTRIBUTE_OFFSET" value="22" enum="Limit"> + Maximum vertex input attribute offset. </constant> <constant name="LIMIT_MAX_VERTEX_INPUT_ATTRIBUTES" value="23" enum="Limit"> + Maximum number of vertex input attributes. </constant> <constant name="LIMIT_MAX_VERTEX_INPUT_BINDINGS" value="24" enum="Limit"> + Maximum number of vertex input bindings. </constant> <constant name="LIMIT_MAX_VERTEX_INPUT_BINDING_STRIDE" value="25" enum="Limit"> + Maximum vertex input binding stride. </constant> <constant name="LIMIT_MIN_UNIFORM_BUFFER_OFFSET_ALIGNMENT" value="26" enum="Limit"> + Minimum uniform buffer offset alignment. </constant> <constant name="LIMIT_MAX_COMPUTE_SHARED_MEMORY_SIZE" value="27" enum="Limit"> + Maximum shared memory size for compute shaders. </constant> <constant name="LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_X" value="28" enum="Limit"> + Maximum number of workgroups for compute shaders on the X axis. </constant> <constant name="LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_Y" value="29" enum="Limit"> + Maximum number of workgroups for compute shaders on the Y axis. </constant> <constant name="LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_Z" value="30" enum="Limit"> + Maximum number of workgroups for compute shaders on the Z axis. </constant> <constant name="LIMIT_MAX_COMPUTE_WORKGROUP_INVOCATIONS" value="31" enum="Limit"> + Maximum number of workgroup invocations for compute shaders. </constant> <constant name="LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_X" value="32" enum="Limit"> + Maximum workgroup size for compute shaders on the X axis. </constant> <constant name="LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Y" value="33" enum="Limit"> + Maximum workgroup size for compute shaders on the Y axis. </constant> <constant name="LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Z" value="34" enum="Limit"> + Maximum workgroup size for compute shaders on the Z axis. </constant> <constant name="LIMIT_MAX_VIEWPORT_DIMENSIONS_X" value="35" enum="Limit"> + Maximum viewport width (in pixels). </constant> <constant name="LIMIT_MAX_VIEWPORT_DIMENSIONS_Y" value="36" enum="Limit"> + Maximum viewport height (in pixels). </constant> <constant name="MEMORY_TEXTURES" value="0" enum="MemoryType"> Memory taken by textures. diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 5f9abe2cda..549caccfe7 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -4,15 +4,14 @@ Server for anything visible. </brief_description> <description> - The rendering server is the API backend for everything visible. The whole scene system mounts on it to display. - The rendering server is completely opaque, the internals are entirely implementation specific and cannot be accessed. - The rendering server can be used to bypass the scene/[Node] system entirely. + The rendering server is the API backend for everything visible. The whole scene system mounts on it to display. The rendering server is completely opaque: the internals are entirely implementation-specific and cannot be accessed. + The rendering server can be used to bypass the scene/[Node] system entirely. This can improve performance in cases where the scene system is the bottleneck, but won't improve performance otherwise (for instance, if the GPU is already fully utilized). Resources are created using the [code]*_create[/code] functions. These functions return [RID]s which are not references to the objects themselves, but opaque [i]pointers[/i] towards these objects. All objects are drawn to a viewport. You can use the [Viewport] attached to the [SceneTree] or you can create one yourself with [method viewport_create]. When using a custom scenario or canvas, the scenario or canvas needs to be attached to the viewport using [method viewport_set_scenario] or [method viewport_attach_canvas]. - In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the rendering server from a running game, the scenario can be accessed from the scene tree from any [Node3D] node with [method Node3D.get_world_3d]. Otherwise, a scenario can be created with [method scenario_create]. + [b]Scenarios:[/b] In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the rendering server from a running game, the scenario can be accessed from the scene tree from any [Node3D] node with [method Node3D.get_world_3d]. Otherwise, a scenario can be created with [method scenario_create]. Similarly, in 2D, a canvas is needed to draw all canvas items. - In 3D, all visible objects are comprised of a resource and an instance. A resource can be a mesh, a particle system, a light, or any other 3D object. In order to be visible resources must be attached to an instance using [method instance_set_base]. The instance must also be attached to the scenario using [method instance_set_scenario] in order to be visible. - In 2D, all visible objects are some form of canvas item. In order to be visible, a canvas item needs to be the child of a canvas attached to a viewport, or it needs to be the child of another canvas item that is eventually attached to the canvas. + [b]3D:[/b] In 3D, all visible objects are comprised of a resource and an instance. A resource can be a mesh, a particle system, a light, or any other 3D object. In order to be visible resources must be attached to an instance using [method instance_set_base]. The instance must also be attached to the scenario using [method instance_set_scenario] in order to be visible. RenderingServer methods that don't have a prefix are usually 3D-specific (but not always). + [b]2D:[/b] In 2D, all visible objects are some form of canvas item. In order to be visible, a canvas item needs to be the child of a canvas attached to a viewport, or it needs to be the child of another canvas item that is eventually attached to the canvas. 2D-specific RenderingServer methods generally start with [code]canvas_*[/code]. [b]Headless mode:[/b] Starting the engine with the [code]--headless[/code] [url=$DOCS_URL/tutorials/editor/command_line_tutorial.html]command line argument[/url] disables all rendering and window management functions. Most functions from [RenderingServer] will return dummy values in this case. </description> <tutorials> @@ -32,8 +31,8 @@ <return type="RID" /> <description> Creates a camera attributes object and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]camera_attributes_[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. - This is the internal equivalent of the [CameraAttributes] resource. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent resource is [CameraAttributes]. </description> </method> <method name="camera_attributes_set_auto_exposure"> @@ -99,9 +98,9 @@ <method name="camera_create"> <return type="RID" /> <description> - Creates a camera and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]camera_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. - This is the internal equivalent of the [Camera3D] node. + Creates a 3D camera and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]camera_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent node is [Camera3D]. </description> </method> <method name="camera_set_camera_attributes"> @@ -179,7 +178,7 @@ <return type="RID" /> <description> Creates a canvas and returns the assigned [RID]. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. Canvas has no [Resource] or [Node] equivalent. </description> </method> @@ -260,6 +259,16 @@ See also [method CanvasItem.draw_msdf_texture_rect_region]. </description> </method> + <method name="canvas_item_add_multiline"> + <return type="void" /> + <param index="0" name="item" type="RID" /> + <param index="1" name="points" type="PackedVector2Array" /> + <param index="2" name="colors" type="PackedColorArray" /> + <param index="3" name="width" type="float" default="-1.0" /> + <description> + Draws a 2D multiline on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_multiline] and [method CanvasItem.draw_multiline_colors]. + </description> + </method> <method name="canvas_item_add_multimesh"> <return type="void" /> <param index="0" name="item" type="RID" /> @@ -302,7 +311,7 @@ <param index="3" name="uvs" type="PackedVector2Array" default="PackedVector2Array()" /> <param index="4" name="texture" type="RID" /> <description> - Draws a 2D polygon on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_polygon]. + Draws a 2D polygon on the [CanvasItem] pointed to by the [param item] [RID]. If you need more flexibility (such as being able to use bones), use [method canvas_item_add_triangle_array] instead. See also [method CanvasItem.draw_polygon]. </description> </method> <method name="canvas_item_add_polyline"> @@ -313,7 +322,7 @@ <param index="3" name="width" type="float" default="-1.0" /> <param index="4" name="antialiased" type="bool" default="false" /> <description> - Draws a 2D polyline on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_polyline]. + Draws a 2D polyline on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_polyline] and [method CanvasItem.draw_polyline_colors]. </description> </method> <method name="canvas_item_add_primitive"> @@ -381,6 +390,8 @@ <param index="7" name="texture" type="RID" /> <param index="8" name="count" type="int" default="-1" /> <description> + Draws a triangle array on the [CanvasItem] pointed to by the [param item] [RID]. This is internally used by [Line2D] and [StyleBoxFlat] for rendering. [method canvas_item_add_triangle_array] is highly flexible, but more complex to use than [method canvas_item_add_polygon]. + [b]Note:[/b] [param count] is unused and can be left unspecified. </description> </method> <method name="canvas_item_clear"> @@ -393,9 +404,9 @@ <method name="canvas_item_create"> <return type="RID" /> <description> - Creates a canvas item and returns the assigned [RID]. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_item_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. - This is the internal equivalent of the [CanvasItem] node. + Creates a new CanvasItem instance and returns its [RID]. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_item_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent node is [CanvasItem]. </description> </method> <method name="canvas_item_set_canvas_group_mode"> @@ -407,6 +418,8 @@ <param index="4" name="fit_margin" type="float" default="0.0" /> <param index="5" name="blur_mipmaps" type="bool" default="false" /> <description> + Sets the canvas group mode used during 2D rendering for the canvas item specified by the [param item] RID. For faster but more limited clipping, use [method canvas_item_set_clip] instead. + [b]Note:[/b] The equivalent node functionality is found in [CanvasGroup] and [member CanvasItem.clip_children]. </description> </method> <method name="canvas_item_set_clip"> @@ -414,6 +427,8 @@ <param index="0" name="item" type="RID" /> <param index="1" name="clip" type="bool" /> <description> + If [param clip] is [code]true[/code], makes the canvas item specified by the [param item] RID not draw anything outside of its rect's coordinates. This clipping is fast, but works only with axis-aligned rectangles. This means that rotation is ignored by the clipping rectangle. For more advanced clipping shapes, use [method canvas_item_set_canvas_group_mode] instead. + [b]Note:[/b] The equivalent node functionality is found in [member Label.clip_text], [RichTextLabel] (always enabled) and more. </description> </method> <method name="canvas_item_set_copy_to_backbuffer"> @@ -431,6 +446,7 @@ <param index="1" name="use_custom_rect" type="bool" /> <param index="2" name="rect" type="Rect2" default="Rect2(0, 0, 0, 0)" /> <description> + If [param use_custom_rect] is [code]true[/code], sets the custom visibility rectangle (used for culling) to [param rect] for the canvas item specified by [param item]. Setting a custom visibility rect can reduce CPU load when drawing lots of 2D instances. If [param use_custom_rect] is [code]false[/code], automatically computes a visibility rectangle based on the canvas item's draw commands. </description> </method> <method name="canvas_item_set_default_texture_filter"> @@ -438,6 +454,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" /> <description> + Sets the default texture filter mode for the canvas item specified by the [param item] RID. Equivalent to [member CanvasItem.texture_filter]. </description> </method> <method name="canvas_item_set_default_texture_repeat"> @@ -445,6 +462,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" /> <description> + Sets the default texture repeat mode for the canvas item specified by the [param item] RID. Equivalent to [member CanvasItem.texture_repeat]. </description> </method> <method name="canvas_item_set_distance_field_mode"> @@ -452,6 +470,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="enabled" type="bool" /> <description> + If [param enabled] is [code]true[/code], enables multichannel signed distance field rendering mode for the canvas item specified by the [param item] RID. This is meant to be used for font rendering, or with specially generated images using [url=https://github.com/Chlumsky/msdfgen]msdfgen[/url]. </description> </method> <method name="canvas_item_set_draw_behind_parent"> @@ -459,6 +478,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="enabled" type="bool" /> <description> + If [param enabled] is [code]true[/code], draws the canvas item specified by the [param item] RID behind its parent. Equivalent to [member CanvasItem.show_behind_parent]. </description> </method> <method name="canvas_item_set_draw_index"> @@ -474,6 +494,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="mask" type="int" /> <description> + Sets the light [param mask] for the canvas item specified by the [param item] RID. Equivalent to [member CanvasItem.light_mask]. </description> </method> <method name="canvas_item_set_material"> @@ -481,7 +502,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="material" type="RID" /> <description> - Sets a new material to the [CanvasItem]. + Sets a new [param material] to the canvas item specified by the [param item] RID. Equivalent to [member CanvasItem.material]. </description> </method> <method name="canvas_item_set_modulate"> @@ -489,7 +510,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="color" type="Color" /> <description> - Sets a color modulation to the [CanvasItem]. This also affects child canvas items. + Multiplies the color of the canvas item specified by the [param item] RID, while affecting its children. See also [method canvas_item_set_self_modulate]. Equivalent to [member CanvasItem.modulate]. </description> </method> <method name="canvas_item_set_parent"> @@ -505,7 +526,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="color" type="Color" /> <description> - Sets a color self-modulation to the [CanvasItem]. It does not affect the child canvas items. + Multiplies the color of the canvas item specified by the [param item] RID, without affecting its children. See also [method canvas_item_set_modulate]. Equivalent to [member CanvasItem.self_modulate]. </description> </method> <method name="canvas_item_set_sort_children_by_y"> @@ -513,7 +534,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="enabled" type="bool" /> <description> - Enables or disables Y-sorting of a [CanvasItem]. + If [param enabled] is [code]true[/code], child nodes with the lowest Y position are drawn before those with a higher Y position. Y-sorting only affects children that inherit from the canvas item specified by the [param item] RID, not the canvas item itself. Equivalent to [member CanvasItem.y_sort_enabled]. </description> </method> <method name="canvas_item_set_transform"> @@ -521,7 +542,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="transform" type="Transform2D" /> <description> - Sets the transform of the [CanvasItem]. It affects where and how the item will be drawn. Child canvas items' transforms are multiplied by their parent's transform. + Sets the [param transform] of the canvas item specified by the [param item] RID. This affects where and how the item will be drawn. Child canvas items' transforms are multiplied by their parent's transform. Equivalent to [member Node2D.transform]. </description> </method> <method name="canvas_item_set_use_parent_material"> @@ -588,7 +609,8 @@ <return type="RID" /> <description> Creates a canvas light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent node is [Light2D]. </description> </method> <method name="canvas_light_occluder_attach_to_canvas"> @@ -603,7 +625,8 @@ <return type="RID" /> <description> Creates a light occluder and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_occluder_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent node is [LightOccluder2D]. </description> </method> <method name="canvas_light_occluder_set_as_sdf_collision"> @@ -795,7 +818,8 @@ <return type="RID" /> <description> Creates a new light occluder polygon and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_occluder_polygon_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent resource is [OccluderPolygon2D]. </description> </method> <method name="canvas_occluder_polygon_set_cull_mode"> @@ -842,14 +866,15 @@ <return type="void" /> <param index="0" name="size" type="int" /> <description> + Sets the [member ProjectSettings.rendering/2d/shadow_atlas/size] to use for [Light2D] shadow rendering (in pixels). The value is rounded up to the nearest power of 2. </description> </method> <method name="canvas_texture_create"> <return type="RID" /> <description> Creates a canvas texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_texture_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. - This is the internal equivalent of the [CanvasTexture] resource. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. See also [method texture_2d_create]. + [b]Note:[/b] The equivalent resource is [CanvasTexture] and is only meant to be used in 2D rendering, not 3D. </description> </method> <method name="canvas_texture_set_channel"> @@ -858,6 +883,7 @@ <param index="1" name="channel" type="int" enum="RenderingServer.CanvasTextureChannel" /> <param index="2" name="texture" type="RID" /> <description> + Sets the [param channel]'s [param texture] for the canvas texture specified by the [param canvas_texture] RID. Equivalent to [member CanvasTexture.diffuse_texture], [member CanvasTexture.normal_texture] and [member CanvasTexture.specular_texture]. </description> </method> <method name="canvas_texture_set_shading_parameters"> @@ -866,6 +892,7 @@ <param index="1" name="base_color" type="Color" /> <param index="2" name="shininess" type="float" /> <description> + Sets the [param base_color] and [param shininess] to use for the canvas texture specified by the [param canvas_texture] RID. Equivalent to [member CanvasTexture.specular_color] and [member CanvasTexture.specular_shininess]. </description> </method> <method name="canvas_texture_set_texture_filter"> @@ -873,7 +900,7 @@ <param index="0" name="canvas_texture" type="RID" /> <param index="1" name="filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" /> <description> - Sets the texture filter used by the [CanvasTexture]. + Sets the texture [param filter] mode to use for the canvas texture specified by the [param canvas_texture] RID. </description> </method> <method name="canvas_texture_set_texture_repeat"> @@ -881,7 +908,7 @@ <param index="0" name="canvas_texture" type="RID" /> <param index="1" name="repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" /> <description> - Sets the texture repeat used by the [CanvasTexture]. + Sets the texture [param repeat] mode to use for the canvas texture specified by the [param canvas_texture] RID. </description> </method> <method name="create_local_rendering_device" qualifiers="const"> @@ -895,8 +922,9 @@ <return type="RID" /> <description> Creates a decal and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]decal_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. - This is the internal equivalent of the [Decal] node. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + To place in a scene, attach this decal to an instance using [method instance_set_base] using the returned RID. + [b]Note:[/b] The equivalent node is [Decal]. </description> </method> <method name="decal_set_albedo_mix"> @@ -904,6 +932,7 @@ <param index="0" name="decal" type="RID" /> <param index="1" name="albedo_mix" type="float" /> <description> + Sets the [param albedo_mix] in the decal specified by the [param decal] RID. Equivalent to [member Decal.albedo_mix]. </description> </method> <method name="decal_set_cull_mask"> @@ -911,6 +940,7 @@ <param index="0" name="decal" type="RID" /> <param index="1" name="mask" type="int" /> <description> + Sets the cull [param mask] in the decal specified by the [param decal] RID. Equivalent to [member Decal.cull_mask]. </description> </method> <method name="decal_set_distance_fade"> @@ -920,6 +950,7 @@ <param index="2" name="begin" type="float" /> <param index="3" name="length" type="float" /> <description> + Sets the distance fade parameters in the decal specified by the [param decal] RID. Equivalent to [member Decal.distance_fade_enabled], [member Decal.distance_fade_begin] and [member Decal.distance_fade_length]. </description> </method> <method name="decal_set_emission_energy"> @@ -927,6 +958,7 @@ <param index="0" name="decal" type="RID" /> <param index="1" name="energy" type="float" /> <description> + Sets the emission [param energy] in the decal specified by the [param decal] RID. Equivalent to [member Decal.emission_energy]. </description> </method> <method name="decal_set_fade"> @@ -935,6 +967,7 @@ <param index="1" name="above" type="float" /> <param index="2" name="below" type="float" /> <description> + Sets the upper fade ([param above]) and lower fade ([param below]) in the decal specified by the [param decal] RID. Equivalent to [member Decal.upper_fade] and [member Decal.lower_fade]. </description> </method> <method name="decal_set_modulate"> @@ -942,7 +975,7 @@ <param index="0" name="decal" type="RID" /> <param index="1" name="color" type="Color" /> <description> - Sets the color modulation of the [Decal]. + Sets the color multiplier in the decal specified by the [param decal] RID to [param color]. Equivalent to [member Decal.modulate]. </description> </method> <method name="decal_set_normal_fade"> @@ -950,6 +983,7 @@ <param index="0" name="decal" type="RID" /> <param index="1" name="fade" type="float" /> <description> + Sets the normal [param fade] in the decal specified by the [param decal] RID. Equivalent to [member Decal.normal_fade]. </description> </method> <method name="decal_set_size"> @@ -957,7 +991,7 @@ <param index="0" name="decal" type="RID" /> <param index="1" name="size" type="Vector3" /> <description> - Sets the size of the [Decal]. + Sets the [param size] of the decal specified by the [param decal] RID. Equivalent to [member Decal.size]. </description> </method> <method name="decal_set_texture"> @@ -966,22 +1000,23 @@ <param index="1" name="type" type="int" enum="RenderingServer.DecalTexture" /> <param index="2" name="texture" type="RID" /> <description> - Sets the texture of the [Decal]. + Sets the [param texture] in the given texture [param type] slot for the specified decal. Equivalent to [method Decal.set_texture]. </description> </method> <method name="decals_set_filter"> <return type="void" /> <param index="0" name="filter" type="int" enum="RenderingServer.DecalFilter" /> <description> + Sets the texture [param filter] mode to use when rendering decals. This parameter is global and cannot be set on a per-decal basis. </description> </method> <method name="directional_light_create"> <return type="RID" /> <description> Creates a directional light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. To place in a scene, attach this directional light to an instance using [method instance_set_base] using the returned RID. - This is the internal equivalent of the [DirectionalLight3D] node. + [b]Note:[/b] The equivalent node is [DirectionalLight3D]. </description> </method> <method name="directional_shadow_atlas_set_size"> @@ -989,12 +1024,14 @@ <param index="0" name="size" type="int" /> <param index="1" name="is_16bits" type="bool" /> <description> + Sets the [param size] of the directional light shadows in 3D. See also [member ProjectSettings.rendering/lights_and_shadows/directional_shadow/size]. This parameter is global and cannot be set on a per-viewport basis. </description> </method> <method name="directional_soft_shadow_filter_set_quality"> <return type="void" /> <param index="0" name="quality" type="int" enum="RenderingServer.ShadowQuality" /> <description> + Sets the filter [param quality] for directional light shadows in 3D. See also [member ProjectSettings.rendering/lights_and_shadows/directional_shadow/soft_shadow_filter_quality]. This parameter is global and cannot be set on a per-viewport basis. </description> </method> <method name="environment_bake_panorama"> @@ -1003,20 +1040,24 @@ <param index="1" name="bake_irradiance" type="bool" /> <param index="2" name="size" type="Vector2i" /> <description> + Generates and returns an [Image] containing the radiance map for the specified [param environment] RID's sky. This supports built-in sky material and custom sky shaders. If [param bake_irradiance] is [code]true[/code], the irradiance map is saved instead of the radiance map. The radiance map is used to render reflected light, while the irradiance map is used to render ambient light. See also [method sky_bake_panorama]. + [b]Note:[/b] The image is saved in linear color space without any tonemapping performed, which means it will look too dark if viewed directly in an image editor. + [b]Note:[/b] [param size] should be a 2:1 aspect ratio for the generated panorama to have square pixels. For radiance maps, there is no point in using a height greater than [member Sky.radiance_size], as it won't increase detail. Irradiance maps only contain low-frequency data, so there is usually no point in going past a size of 128×64 pixels when saving an irradiance map. </description> </method> <method name="environment_create"> <return type="RID" /> <description> Creates an environment and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]environment_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. - This is the internal equivalent of the [Environment] resource. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent resource is [Environment]. </description> </method> <method name="environment_glow_set_use_bicubic_upscale"> <return type="void" /> <param index="0" name="enable" type="bool" /> <description> + If [param enable] is [code]true[/code], enables bicubic upscaling for glow which improves quality at the cost of performance. Equivalent to [member ProjectSettings.rendering/environment/glow/upscale_mode]. </description> </method> <method name="environment_set_adjustment"> @@ -1029,7 +1070,7 @@ <param index="5" name="use_1d_color_correction" type="bool" /> <param index="6" name="color_correction" type="RID" /> <description> - Sets the values to be used with the "Adjustment" post-process effect. See [Environment] for more details. + Sets the values to be used with the "adjustments" post-process effect. See [Environment] for more details. </description> </method> <method name="environment_set_ambient_light"> @@ -1041,6 +1082,7 @@ <param index="4" name="sky_contibution" type="float" default="0.0" /> <param index="5" name="reflection_source" type="int" enum="RenderingServer.EnvironmentReflectionSource" default="0" /> <description> + Sets the values to be used for ambient light rendering. See [Environment] for more details. </description> </method> <method name="environment_set_background"> @@ -1048,7 +1090,7 @@ <param index="0" name="env" type="RID" /> <param index="1" name="bg" type="int" enum="RenderingServer.EnvironmentBG" /> <description> - Sets the [i]BGMode[/i] of the environment. Equivalent to [member Environment.background_mode]. + Sets the environment's background mode. Equivalent to [member Environment.background_mode]. </description> </method> <method name="environment_set_bg_color"> @@ -1056,7 +1098,7 @@ <param index="0" name="env" type="RID" /> <param index="1" name="color" type="Color" /> <description> - Color displayed for clear areas of the scene (if using Custom color or Color+Sky background modes). + Color displayed for clear areas of the scene. Only effective if using the [constant ENV_BG_COLOR] background mode. </description> </method> <method name="environment_set_bg_energy"> @@ -1089,6 +1131,7 @@ <param index="8" name="aerial_perspective" type="float" /> <param index="9" name="sky_affect" type="float" /> <description> + Configures fog for the specified environment RID. See [code]fog_*[/code] properties in [Environment] for more information. </description> </method> <method name="environment_set_glow"> @@ -1107,6 +1150,7 @@ <param index="11" name="glow_map_strength" type="float" /> <param index="12" name="glow_map" type="RID" /> <description> + Configures glow for the specified environment RID. See [code]glow_*[/code] properties in [Environment] for more information. </description> </method> <method name="environment_set_sdfgi"> @@ -1123,24 +1167,28 @@ <param index="9" name="normal_bias" type="float" /> <param index="10" name="probe_bias" type="float" /> <description> + Configures signed distance field global illumination for the specified environment RID. See [code]sdfgi_*[/code] properties in [Environment] for more information. </description> </method> <method name="environment_set_sdfgi_frames_to_converge"> <return type="void" /> <param index="0" name="frames" type="int" enum="RenderingServer.EnvironmentSDFGIFramesToConverge" /> <description> + Sets the number of frames to use for converging signed distance field global illumination. Equivalent to [member ProjectSettings.rendering/global_illumination/sdfgi/frames_to_converge]. </description> </method> <method name="environment_set_sdfgi_frames_to_update_light"> <return type="void" /> <param index="0" name="frames" type="int" enum="RenderingServer.EnvironmentSDFGIFramesToUpdateLight" /> <description> + Sets the update speed for dynamic lights' indirect lighting when computing signed distance field global illumination. Equivalent to [member ProjectSettings.rendering/global_illumination/sdfgi/frames_to_update_lights]. </description> </method> <method name="environment_set_sdfgi_ray_count"> <return type="void" /> <param index="0" name="ray_count" type="int" enum="RenderingServer.EnvironmentSDFGIRayCount" /> <description> + Sets the number of rays to throw per frame when computing signed distance field global illumination. Equivalent to [member ProjectSettings.rendering/global_illumination/sdfgi/probe_ray_count]. </description> </method> <method name="environment_set_sky"> @@ -1216,7 +1264,7 @@ <param index="4" name="fade_out" type="float" /> <param index="5" name="depth_tolerance" type="float" /> <description> - Sets the variables to be used with the "screen space reflections" post-process effect. See [Environment] for more details. + Sets the variables to be used with the screen-space reflections (SSR) post-process effect. See [Environment] for more details. </description> </method> <method name="environment_set_ssr_roughness_quality"> @@ -1252,6 +1300,7 @@ <param index="12" name="ambient_inject" type="float" /> <param index="13" name="sky_affect" type="float" /> <description> + Sets the variables to be used with the volumetric fog post-process effect. See [Environment] for more details. </description> </method> <method name="environment_set_volumetric_fog_filter_active"> @@ -1272,9 +1321,9 @@ <method name="fog_volume_create"> <return type="RID" /> <description> - Creates a fog volume and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]fog_volume_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. - This is the internal equivalent of the [FogVolume] node. + Creates a new fog volume and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]fog_volume_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent node is [FogVolume]. </description> </method> <method name="fog_volume_set_material"> @@ -1306,29 +1355,32 @@ <param index="0" name="swap_buffers" type="bool" default="true" /> <param index="1" name="frame_step" type="float" default="0.0" /> <description> + Forces redrawing of all viewports at once. </description> </method> <method name="force_sync"> <return type="void" /> <description> + Forces a synchronization between the CPU and GPU, which may be required in certain cases. Only call this when needed, as CPU-GPU synchronization has a performance cost. </description> </method> <method name="free_rid"> <return type="void" /> <param index="0" name="rid" type="RID" /> <description> - Tries to free an object in the RenderingServer. + Tries to free an object in the RenderingServer. To avoid memory leaks, this should be called after using an object as memory management does not occur automatically when using RendeeringServer directly. </description> </method> <method name="get_default_clear_color"> <return type="Color" /> <description> - Returns the default clear color which is used when a specific clear color has not been selected. + Returns the default clear color which is used when a specific clear color has not been selected. See also [method set_default_clear_color]. </description> </method> <method name="get_frame_setup_time_cpu" qualifiers="const"> <return type="float" /> <description> + Returns the time taken to setup rendering on the CPU in milliseconds. This value is shared across all viewports and does [i]not[/i] require [method viewport_set_measure_render_time] to be enabled on a viewport to be queried. See also [method viewport_get_measured_render_time_cpu]. </description> </method> <method name="get_rendering_device" qualifiers="const"> @@ -1342,6 +1394,16 @@ <return type="int" /> <param index="0" name="info" type="int" enum="RenderingServer.RenderingInfo" /> <description> + Returns a statistic about the rendering engine which can be used for performance profiling. See [enum RenderingServer.RenderingInfo] for a list of values that can be queried. See also [method viewport_get_render_info], which retruns information specific to a viewport. + [b]Note:[/b] Only 3D rendering is currently taken into account by some of these values, such as the number of draw calls. + [b]Note:[/b] Rendering information is not available until at least 2 frames have been rendered by the engine. If rendering information is not available, [method get_rendering_info] returns [code]0[/code]. To print rendering information in [code]_ready()[/code] successfully, use the following: + [codeblock] + func _ready(): + for _i in 2: + await get_tree().process_frame + + print(RenderingServer.get_rendering_info(RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME)) + [/codeblock] </description> </method> <method name="get_shader_parameter_list" qualifiers="const"> @@ -1354,19 +1416,25 @@ <method name="get_test_cube"> <return type="RID" /> <description> - Returns the ID of the test cube. Creates one if none exists. + Returns the RID of the test cube. This mesh will be created and returned on the first call to [method get_test_cube], then it will be cached for subsequent calls. See also [method make_sphere_mesh]. </description> </method> <method name="get_test_texture"> <return type="RID" /> <description> - Returns the ID of the test texture. Creates one if none exists. + Returns the RID of a 256×256 texture with a testing pattern on it (in [constant Image.FORMAT_RGB8] format). This texture will be created and returned on the first call to [method get_test_texture], then it will be cached for subsequent calls. See also [method get_white_texture]. + Example of getting the test texture and applying it to a [Sprite2D] node: + [codeblock] + var texture_rid = RenderingServer.get_test_texture() + var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid)) + $Sprite2D.texture = texture + [/codeblock] </description> </method> <method name="get_video_adapter_api_version" qualifiers="const"> <return type="String" /> <description> - Returns the version of the graphics video adapter [i]currently in use[/i] (e.g. "1.2.189" for Vulkan, "3.3.0 NVIDIA 510.60.02" for OpenGL). This version may be different from the actual latest version supported by the hardware, as Godot may not always request the latest version. + Returns the version of the graphics video adapter [i]currently in use[/i] (e.g. "1.2.189" for Vulkan, "3.3.0 NVIDIA 510.60.02" for OpenGL). This version may be different from the actual latest version supported by the hardware, as Godot may not always request the latest version. See also [method OS.get_video_adapter_driver_info]. [b]Note:[/b] When running a headless or server binary, this function returns an empty string. </description> </method> @@ -1394,14 +1462,20 @@ <method name="get_white_texture"> <return type="RID" /> <description> - Returns the ID of a white texture. Creates one if none exists. + Returns the ID of a 4×4 white texture (in [constant Image.FORMAT_RGB8] format). This texture will be created and returned on the first call to [method get_white_texture], then it will be cached for subsequent calls. See also [method get_test_texture]. + Example of getting the white texture and applying it to a [Sprite2D] node: + [codeblock] + var texture_rid = RenderingServer.get_white_texture() + var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid)) + $Sprite2D.texture = texture + [/codeblock] </description> </method> <method name="gi_set_use_half_resolution"> <return type="void" /> <param index="0" name="half_resolution" type="bool" /> <description> - If [param half_resolution] is [code]true[/code], renders [VoxelGI] and SDFGI ([member Environment.sdfgi_enabled]) buffers at halved resolution (e.g. 960×540 when the viewport size is 1920×1080). This improves performance significantly when VoxelGI or SDFGI is enabled, at the cost of artifacts that may be visible on polygon edges. The loss in quality becomes less noticeable as the viewport resolution increases. [LightmapGI] rendering is not affected by this setting. See also [member ProjectSettings.rendering/global_illumination/gi/use_half_resolution]. + If [param half_resolution] is [code]true[/code], renders [VoxelGI] and SDFGI ([member Environment.sdfgi_enabled]) buffers at halved resolution on each axis (e.g. 960×540 when the viewport size is 1920×1080). This improves performance significantly when VoxelGI or SDFGI is enabled, at the cost of artifacts that may be visible on polygon edges. The loss in quality becomes less noticeable as the viewport resolution increases. [LightmapGI] rendering is not affected by this setting. Equivalent to [member ProjectSettings.rendering/global_illumination/gi/use_half_resolution]. </description> </method> <method name="global_shader_parameter_add"> @@ -1410,29 +1484,38 @@ <param index="1" name="type" type="int" enum="RenderingServer.GlobalShaderParameterType" /> <param index="2" name="default_value" type="Variant" /> <description> + Creates a new global shader uniform. + [b]Note:[/b] Global shader parameter names are case-sensitive. </description> </method> <method name="global_shader_parameter_get" qualifiers="const"> <return type="Variant" /> <param index="0" name="name" type="StringName" /> <description> + Returns the value of the global shader uniform specified by [param name]. + [b]Note:[/b] [method global_shader_parameter_get] has a large performance penalty as the rendering thread needs to synchronize with the calling thread, which is slow. Do not use this method during gameplay to avoid stuttering. If you need to read values in a script after setting them, consider creating an autoload where you store the values you need to query at the same time you're setting them as global parameters. </description> </method> <method name="global_shader_parameter_get_list" qualifiers="const"> <return type="PackedStringArray" /> <description> + Returns the list of global shader uniform names. + [b]Note:[/b] [method global_shader_parameter_get] has a large performance penalty as the rendering thread needs to synchronize with the calling thread, which is slow. Do not use this method during gameplay to avoid stuttering. If you need to read values in a script after setting them, consider creating an autoload where you store the values you need to query at the same time you're setting them as global parameters. </description> </method> <method name="global_shader_parameter_get_type" qualifiers="const"> <return type="int" enum="RenderingServer.GlobalShaderParameterType" /> <param index="0" name="name" type="StringName" /> <description> + Returns the type associated to the global shader uniform specified by [param name]. + [b]Note:[/b] [method global_shader_parameter_get] has a large performance penalty as the rendering thread needs to synchronize with the calling thread, which is slow. Do not use this method during gameplay to avoid stuttering. If you need to read values in a script after setting them, consider creating an autoload where you store the values you need to query at the same time you're setting them as global parameters. </description> </method> <method name="global_shader_parameter_remove"> <return type="void" /> <param index="0" name="name" type="StringName" /> <description> + Removes the global shader uniform specified by [param name]. </description> </method> <method name="global_shader_parameter_set"> @@ -1440,6 +1523,7 @@ <param index="0" name="name" type="StringName" /> <param index="1" name="value" type="Variant" /> <description> + Sets the global shader uniform [param name] to [param value]. </description> </method> <method name="global_shader_parameter_set_override"> @@ -1447,6 +1531,7 @@ <param index="0" name="name" type="StringName" /> <param index="1" name="value" type="Variant" /> <description> + Overrides the global shader uniform [param name] with [param value]. Equivalent to the [ShaderGlobalsOverride] node. </description> </method> <method name="has_changed" qualifiers="const"> @@ -1489,9 +1574,9 @@ <return type="RID" /> <description> Creates a visual instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. - An instance is a way of placing a 3D object in the scenario. Objects like particles, meshes, and reflection probes need to be associated with an instance to be visible in the scenario using [method instance_set_base]. - This is the internal equivalent of the [VisualInstance3D] node. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + An instance is a way of placing a 3D object in the scenario. Objects like particles, meshes, reflection probes and decals need to be associated with an instance to be visible in the scenario using [method instance_set_base]. + [b]Note:[/b] The equivalent node is [VisualInstance3D]. </description> </method> <method name="instance_create2"> @@ -1500,7 +1585,7 @@ <param index="1" name="scenario" type="RID" /> <description> Creates a visual instance, adds it to the RenderingServer, and sets both base and scenario. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. This is a shorthand for using [method instance_create] and setting the base and scenario manually. </description> </method> <method name="instance_geometry_get_shader_parameter" qualifiers="const"> @@ -1508,6 +1593,8 @@ <param index="0" name="instance" type="RID" /> <param index="1" name="parameter" type="StringName" /> <description> + Returns the value of the per-instance shader uniform from the specified 3D geometry instance. Equivalent to [method GeometryInstance3D.get_instance_shader_parameter]. + [b]Note:[/b] Per-instance shader parameter names are case-sensitive. </description> </method> <method name="instance_geometry_get_shader_parameter_default_value" qualifiers="const"> @@ -1515,12 +1602,14 @@ <param index="0" name="instance" type="RID" /> <param index="1" name="parameter" type="StringName" /> <description> + Returns the default value of the per-instance shader uniform from the specified 3D geometry instance. Equivalent to [method GeometryInstance3D.get_instance_shader_parameter]. </description> </method> <method name="instance_geometry_get_shader_parameter_list" qualifiers="const"> <return type="Dictionary[]" /> <param index="0" name="instance" type="RID" /> <description> + Returns a dictionary of per-instance shader uniform names of the per-instance shader uniform from the specified 3D geometry instance. The returned dictionary is in PropertyInfo format, with the keys [code]name[/code], [code]class_name[/code], [code]type[/code], [code]hint[/code], [code]hint_string[/code] and [code]usage[/code]. Equivalent to [method GeometryInstance3D.get_instance_shader_parameter]. </description> </method> <method name="instance_geometry_set_cast_shadows_setting"> @@ -1547,6 +1636,7 @@ <param index="2" name="lightmap_uv_scale" type="Rect2" /> <param index="3" name="lightmap_slice" type="int" /> <description> + Sets the lightmap GI instance to use for the specified 3D geometry instance. The lightmap UV scale for the specified instance (equivalent to [member GeometryInstance3D.gi_lightmap_scale]) and lightmap atlas slice must also be specified. </description> </method> <method name="instance_geometry_set_lod_bias"> @@ -1554,6 +1644,7 @@ <param index="0" name="instance" type="RID" /> <param index="1" name="lod_bias" type="float" /> <description> + Sets the level of detail bias to use when rendering the specified 3D geometry instance. Higher values result in higher detail from further away. Equivalent to [member GeometryInstance3D.lod_bias]. </description> </method> <method name="instance_geometry_set_material_overlay"> @@ -1578,6 +1669,7 @@ <param index="1" name="parameter" type="StringName" /> <param index="2" name="value" type="Variant" /> <description> + Sets the per-instance shader uniform on the specified 3D geometry instance. Equivalent to [method GeometryInstance3D.set_instance_shader_parameter]. </description> </method> <method name="instance_geometry_set_transparency"> @@ -1608,7 +1700,7 @@ <param index="0" name="instance" type="RID" /> <param index="1" name="base" type="RID" /> <description> - Sets the base of the instance. A base can be any of the 3D objects that are created in the RenderingServer that can be displayed. For example, any of the light types, mesh, multimesh, immediate geometry, particle system, reflection probe, lightmap, and the GI probe are all types that can be set as the base of an instance in order to be displayed in the scenario. + Sets the base of the instance. A base can be any of the 3D objects that are created in the RenderingServer that can be displayed. For example, any of the light types, mesh, multimesh, particle system, reflection probe, decal, lightmap, voxel GI and visibility notifiers are all types that can be set as the base of an instance in order to be displayed in the scenario. </description> </method> <method name="instance_set_blend_shape_weight"> @@ -1641,6 +1733,7 @@ <param index="0" name="instance" type="RID" /> <param index="1" name="enabled" type="bool" /> <description> + If [code]true[/code], ignores both frustum and occlusion culling on the specified 3D geometry instance. This is not the same as [member GeometryInstance3D.ignore_occlusion_culling], which only ignores occlusion culling and leaves frustum culling intact. </description> </method> <method name="instance_set_layer_mask"> @@ -1706,7 +1799,7 @@ <param index="0" name="aabb" type="AABB" /> <param index="1" name="scenario" type="RID" /> <description> - Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GlobalScope.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. + Returns an array of object IDs intersecting with the provided AABB. Only 3D nodes that inherit from [VisualInstance3D] are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GlobalScope.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. [b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision. </description> </method> @@ -1715,7 +1808,7 @@ <param index="0" name="convex" type="Plane[]" /> <param index="1" name="scenario" type="RID" /> <description> - Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GlobalScope.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. + Returns an array of object IDs intersecting with the provided convex shape. Only 3D nodes that inherit from [VisualInstance3D] are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GlobalScope.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. [b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision. </description> </method> @@ -1725,7 +1818,7 @@ <param index="1" name="to" type="Vector3" /> <param index="2" name="scenario" type="RID" /> <description> - Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GlobalScope.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. + Returns an array of object IDs intersecting with the provided 3D ray. Only 3D nodes that inherit from [VisualInstance3D] are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GlobalScope.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. [b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision. </description> </method> @@ -1765,6 +1858,7 @@ <return type="void" /> <param index="0" name="filter" type="int" enum="RenderingServer.LightProjectorFilter" /> <description> + Sets the texture filter mode to use when rendering light projectors. This parameter is global and cannot be set on a per-light basis. </description> </method> <method name="light_set_bake_mode"> @@ -1772,6 +1866,7 @@ <param index="0" name="light" type="RID" /> <param index="1" name="bake_mode" type="int" enum="RenderingServer.LightBakeMode" /> <description> + Sets the bake mode to use for the specified 3D light. Equivalent to [member Light3D.light_bake_mode]. </description> </method> <method name="light_set_color"> @@ -1787,7 +1882,7 @@ <param index="0" name="light" type="RID" /> <param index="1" name="mask" type="int" /> <description> - Sets the cull mask for this Light3D. Lights only affect objects in the selected layers. Equivalent to [member Light3D.light_cull_mask]. + Sets the cull mask for this 3D light. Lights only affect objects in the selected layers. Equivalent to [member Light3D.light_cull_mask]. </description> </method> <method name="light_set_distance_fade"> @@ -1798,7 +1893,7 @@ <param index="3" name="shadow" type="float" /> <param index="4" name="length" type="float" /> <description> - Sets the distance fade for this Light3D. This acts as a form of level of detail (LOD) and can be used to improve performance. Equivalent to [member Light3D.distance_fade_enabled], [member Light3D.distance_fade_begin], [member Light3D.distance_fade_shadow], and [member Light3D.distance_fade_length]. + Sets the distance fade for this 3D light. This acts as a form of level of detail (LOD) and can be used to improve performance. Equivalent to [member Light3D.distance_fade_enabled], [member Light3D.distance_fade_begin], [member Light3D.distance_fade_shadow], and [member Light3D.distance_fade_length]. </description> </method> <method name="light_set_max_sdfgi_cascade"> @@ -1806,6 +1901,7 @@ <param index="0" name="light" type="RID" /> <param index="1" name="cascade" type="int" /> <description> + Sets the maximum SDFGI cascade in which the 3D light's indirect lighting is rendered. Higher values allow the light to be rendered in SDFGI further away from the camera. </description> </method> <method name="light_set_negative"> @@ -1813,7 +1909,7 @@ <param index="0" name="light" type="RID" /> <param index="1" name="enable" type="bool" /> <description> - If [code]true[/code], light will subtract light instead of adding light. Equivalent to [member Light3D.light_negative]. + If [code]true[/code], the 3D light will subtract light instead of adding light. Equivalent to [member Light3D.light_negative]. </description> </method> <method name="light_set_param"> @@ -1822,7 +1918,7 @@ <param index="1" name="param" type="int" enum="RenderingServer.LightParam" /> <param index="2" name="value" type="float" /> <description> - Sets the specified light parameter. See [enum LightParam] for options. Equivalent to [method Light3D.set_param]. + Sets the specified 3D light parameter. See [enum LightParam] for options. Equivalent to [method Light3D.set_param]. </description> </method> <method name="light_set_projector"> @@ -1830,7 +1926,7 @@ <param index="0" name="light" type="RID" /> <param index="1" name="texture" type="RID" /> <description> - Not implemented in Godot 3.x. + Sets the projector texture to use for the specified 3D light. Equivalent to [member Light3D.light_projector]. </description> </method> <method name="light_set_reverse_cull_face_mode"> @@ -1852,9 +1948,9 @@ <method name="lightmap_create"> <return type="RID" /> <description> - Creates a lightmap GI and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]lightmap_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. - This is the internal equivalent of the [LightmapGI] node. + Creates a new lightmap global illumination instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]lightmap_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent node is [LightmapGI]. </description> </method> <method name="lightmap_get_probe_capture_bsp_tree" qualifiers="const"> @@ -1925,6 +2021,7 @@ <param index="1" name="light" type="RID" /> <param index="2" name="uses_sh" type="bool" /> <description> + Set the textures on the given [param lightmap] GI instance to the texture array pointed to by the [param light] RID. If the lightmap texture was baked with [member LightmapGI.directional] set to [code]true[/code], then [param uses_sh] must also be [code]true[/code]. </description> </method> <method name="make_sphere_mesh"> @@ -1933,15 +2030,15 @@ <param index="1" name="longitudes" type="int" /> <param index="2" name="radius" type="float" /> <description> - Returns a mesh of a sphere with the given number of horizontal and vertical subdivisions. + Returns a mesh of a sphere with the given number of horizontal subdivisions, vertical subdivisions and radius. See also [method get_test_cube]. </description> </method> <method name="material_create"> <return type="RID" /> <description> Creates an empty material and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]material_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. - This is the internal equivalent of the [Material] resource. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent resource is [Material]. </description> </method> <method name="material_get_param" qualifiers="const"> @@ -2014,9 +2111,9 @@ <return type="RID" /> <description> Creates a new mesh and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]mesh_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. To place in a scene, attach this mesh to an instance using [method instance_set_base] using the returned RID. - This is the internal equivalent of the [Mesh] resource. + [b]Note:[/b] The equivalent resource is [Mesh]. </description> </method> <method name="mesh_create_from_surfaces"> @@ -2187,9 +2284,9 @@ <return type="RID" /> <description> Creates a new multimesh on the RenderingServer and returns an [RID] handle. This RID will be used in all [code]multimesh_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. To place in a scene, attach this multimesh to an instance using [method instance_set_base] using the returned RID. - This is the internal equivalent of the [MultiMesh] resource. + [b]Note:[/b] The equivalent resource is [MultiMesh]. </description> </method> <method name="multimesh_get_aabb" qualifiers="const"> @@ -2203,6 +2300,8 @@ <return type="PackedFloat32Array" /> <param index="0" name="multimesh" type="RID" /> <description> + Returns the MultiMesh data (such as instance transforms, colors, etc). See [method multimesh_set_buffer] for a description of the returned data. + [b]Note:[/b] If the buffer is in the engine's internal cache, it will have to be fetched from GPU memory and possibly decompressed. This means [method multimesh_get_buffer] is potentially a slow operation and should be avoided whenever possible. </description> </method> <method name="multimesh_get_instance_count" qualifiers="const"> @@ -2299,6 +2398,20 @@ <param index="0" name="multimesh" type="RID" /> <param index="1" name="buffer" type="PackedFloat32Array" /> <description> + Set the entire data to use for drawing the [param multimesh] at once to [param buffer] (such as instance transforms and colors). [param buffer]'s size must match the number of instances multiplied by the per-instance data size (which depends on the enabled MultiMesh fields). Otherwise, an error message is printed and nothing is rendered. See also [method multimesh_get_buffer]. + The per-instance data size and expected data order is: + [codeblock] + 2D: + - Position: 8 floats (8 floats for Transform2D) + - Position + Vertex color: 12 floats (8 floats for Transform2D, 4 floats for Color) + - Position + Custom data: 12 floats (8 floats for Transform2D, 4 floats of custom data) + - Position + Vertex color + Custom data: 16 floats (8 floats for Transform2D, 4 floats for Color, 4 floats of custom data) + 3D: + - Position: 12 floats (12 floats for Transform3D) + - Position + Vertex color: 16 floats (12 floats for Transform3D, 4 floats for Color) + - Position + Custom data: 16 floats (12 floats for Transform3D, 4 floats of custom data) + - Position + Vertex color + Custom data: 20 floats (12 floats for Transform3D, 4 floats for Color, 4 floats of custom data) + [/codeblock] </description> </method> <method name="multimesh_set_mesh"> @@ -2320,6 +2433,9 @@ <method name="occluder_create"> <return type="RID" /> <description> + Creates an occluder instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]occluder_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent resource is [Occluder3D] (not to be confused with the [OccluderInstance3D] node). </description> </method> <method name="occluder_set_mesh"> @@ -2328,25 +2444,30 @@ <param index="1" name="vertices" type="PackedVector3Array" /> <param index="2" name="indices" type="PackedInt32Array" /> <description> + Sets the mesh data for the given occluder RID, which controls the shape of the occlusion culling that will be performed. </description> </method> <method name="omni_light_create"> <return type="RID" /> <description> Creates a new omni light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. To place in a scene, attach this omni light to an instance using [method instance_set_base] using the returned RID. + [b]Note:[/b] The equivalent node is [OmniLight3D]. </description> </method> <method name="particles_collision_create"> <return type="RID" /> <description> + Creates a new 3D GPU particle collision or attractor and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]particles_collision_*[/code] RenderingServer functions. + [b]Note:[/b] The equivalent nodes are [GPUParticlesCollision3D] and [GPUParticlesAttractor3D]. </description> </method> <method name="particles_collision_height_field_update"> <return type="void" /> <param index="0" name="particles_collision" type="RID" /> <description> + Requests an update for the 3D GPU particle collision heightfield. This may be automatically called by the 3D GPU particle collision heightfield depending on its [member GPUParticlesCollisionHeightField3D.update_mode]. </description> </method> <method name="particles_collision_set_attractor_attenuation"> @@ -2354,6 +2475,7 @@ <param index="0" name="particles_collision" type="RID" /> <param index="1" name="curve" type="float" /> <description> + Sets the attenuation [param curve] for the 3D GPU particles attractor specified by the [param particles_collision] RID. Only used for attractors, not colliders. Equivalent to [member GPUParticlesAttractor3D.attenuation]. </description> </method> <method name="particles_collision_set_attractor_directionality"> @@ -2361,6 +2483,7 @@ <param index="0" name="particles_collision" type="RID" /> <param index="1" name="amount" type="float" /> <description> + Sets the directionality [param amount] for the 3D GPU particles attractor specified by the [param particles_collision] RID. Only used for attractors, not colliders. Equivalent to [member GPUParticlesAttractor3D.directionality]. </description> </method> <method name="particles_collision_set_attractor_strength"> @@ -2368,6 +2491,7 @@ <param index="0" name="particles_collision" type="RID" /> <param index="1" name="strength" type="float" /> <description> + Sets the [param strength] for the 3D GPU particles attractor specified by the [param particles_collision] RID. Only used for attractors, not colliders. Equivalent to [member GPUParticlesAttractor3D.strength]. </description> </method> <method name="particles_collision_set_box_extents"> @@ -2375,6 +2499,7 @@ <param index="0" name="particles_collision" type="RID" /> <param index="1" name="extents" type="Vector3" /> <description> + Sets the [param extents] for the 3D GPU particles collision by the [param particles_collision] RID. Equivalent to [member GPUParticlesCollisionBox3D.size], [member GPUParticlesCollisionSDF3D.size], [member GPUParticlesCollisionHeightField3D.size], [member GPUParticlesAttractorBox3D.size] or [member GPUParticlesAttractorVectorField3D.size] depending on the [param particles_collision] type. </description> </method> <method name="particles_collision_set_collision_type"> @@ -2382,6 +2507,7 @@ <param index="0" name="particles_collision" type="RID" /> <param index="1" name="type" type="int" enum="RenderingServer.ParticlesCollisionType" /> <description> + Sets the collision or attractor shape [param type] for the 3D GPU particles collision or attractor specified by the [param particles_collision] RID. </description> </method> <method name="particles_collision_set_cull_mask"> @@ -2389,6 +2515,7 @@ <param index="0" name="particles_collision" type="RID" /> <param index="1" name="mask" type="int" /> <description> + Sets the cull [param mask] for the 3D GPU particles collision or attractor specified by the [param particles_collision] RID. Equivalent to [member GPUParticlesCollision3D.cull_mask] or [member GPUParticlesAttractor3D.cull_mask] depending on the [param particles_collision] type. </description> </method> <method name="particles_collision_set_field_texture"> @@ -2396,6 +2523,7 @@ <param index="0" name="particles_collision" type="RID" /> <param index="1" name="texture" type="RID" /> <description> + Sets the signed distance field [param texture] for the 3D GPU particles collision specified by the [param particles_collision] RID. Equivalent to [member GPUParticlesCollisionSDF3D.texture] or [member GPUParticlesAttractorVectorField3D.texture] depending on the [param particles_collision] type. </description> </method> <method name="particles_collision_set_height_field_resolution"> @@ -2403,6 +2531,7 @@ <param index="0" name="particles_collision" type="RID" /> <param index="1" name="resolution" type="int" enum="RenderingServer.ParticlesCollisionHeightfieldResolution" /> <description> + Sets the heightmap [param resolution] for the 3D GPU particles heightfield collision specified by the [param particles_collision] RID. Equivalent to [member GPUParticlesCollisionHeightField3D.resolution]. </description> </method> <method name="particles_collision_set_sphere_radius"> @@ -2410,14 +2539,17 @@ <param index="0" name="particles_collision" type="RID" /> <param index="1" name="radius" type="float" /> <description> + Sets the [param radius] for the 3D GPU particles sphere collision or attractor specified by the [param particles_collision] RID. Equivalent to [member GPUParticlesCollisionSphere3D.radius] or [member GPUParticlesAttractorSphere3D.radius] depending on the [param particles_collision] type. </description> </method> <method name="particles_create"> <return type="RID" /> <description> - Creates a particle system and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]particles_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Creates a GPU-based particle system and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]particles_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. To place in a scene, attach these particles to an instance using [method instance_set_base] using the returned RID. + [b]Note:[/b] The equivalent nodes are [GPUParticles2D] and [GPUParticles3D]. + [b]Note:[/b] All [code]particles_*[/code] methods only apply to GPU-based particles, not CPU-based particles. [CPUParticles2D] and [CPUParticles3D] do not have equivalent RenderingServer functions available, as these use [MultiMeshInstance2D] and [MultiMeshInstance3D] under the hood (see [code]multimesh_*[/code] methods). </description> </method> <method name="particles_emit"> @@ -2429,6 +2561,7 @@ <param index="4" name="custom" type="Color" /> <param index="5" name="emit_flags" type="int" /> <description> + Manually emits particles from the [param particles] instance. </description> </method> <method name="particles_get_current_aabb"> @@ -2574,6 +2707,7 @@ <param index="0" name="particles" type="RID" /> <param index="1" name="mode" type="int" enum="RenderingServer.ParticlesMode" /> <description> + Sets whether the GPU particles specified by the [param particles] RID should be rendered in 2D or 3D according to [param mode]. </description> </method> <method name="particles_set_one_shot"> @@ -2637,6 +2771,7 @@ <param index="1" name="enable" type="bool" /> <param index="2" name="length_sec" type="float" /> <description> + If [param enable] is [code]true[/code], enables trails for the [param particles] with the specified [param length_sec] in seconds. Equivalent to [member GPUParticles3D.trail_enabled] and [member GPUParticles3D.trail_lifetime]. </description> </method> <method name="particles_set_transform_align"> @@ -2658,14 +2793,16 @@ <return type="void" /> <param index="0" name="quality" type="int" enum="RenderingServer.ShadowQuality" /> <description> + Sets the filter quality for omni and spot light shadows in 3D. See also [member ProjectSettings.rendering/lights_and_shadows/positional_shadow/soft_shadow_filter_quality]. This parameter is global and cannot be set on a per-viewport basis. </description> </method> <method name="reflection_probe_create"> <return type="RID" /> <description> Creates a reflection probe and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]reflection_probe_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. To place in a scene, attach this reflection probe to an instance using [method instance_set_base] using the returned RID. + [b]Note:[/b] The equivalent node is [ReflectionProbe]. </description> </method> <method name="reflection_probe_set_ambient_color"> @@ -2673,6 +2810,7 @@ <param index="0" name="probe" type="RID" /> <param index="1" name="color" type="Color" /> <description> + Sets the reflection probe's custom ambient light color. Equivalent to [member ReflectionProbe.ambient_color]. </description> </method> <method name="reflection_probe_set_ambient_energy"> @@ -2680,6 +2818,7 @@ <param index="0" name="probe" type="RID" /> <param index="1" name="energy" type="float" /> <description> + Sets the reflection probe's custom ambient light energy. Equivalent to [member ReflectionProbe.ambient_color_energy]. </description> </method> <method name="reflection_probe_set_ambient_mode"> @@ -2687,6 +2826,7 @@ <param index="0" name="probe" type="RID" /> <param index="1" name="mode" type="int" enum="RenderingServer.ReflectionProbeAmbientMode" /> <description> + Sets the reflection probe's ambient light mode. Equivalent to [member ReflectionProbe.ambient_mode]. </description> </method> <method name="reflection_probe_set_as_interior"> @@ -2742,6 +2882,7 @@ <param index="0" name="probe" type="RID" /> <param index="1" name="pixels" type="float" /> <description> + Sets the mesh level of detail to use in the reflection probe rendering. Higher values will use less detailed versions of meshes that have LOD variations generated, which can improve performance. Equivalent to [member ReflectionProbe.mesh_lod_threshold]. </description> </method> <method name="reflection_probe_set_origin_offset"> @@ -2757,6 +2898,7 @@ <param index="0" name="probe" type="RID" /> <param index="1" name="resolution" type="int" /> <description> + Sets the resolution to use when rendering the specified reflection probe. The [param resolution] is specified for each cubemap face: for instance, specifying [code]512[/code] will allocate 6 faces of 512×512 each (plus mipmaps for roughness levels). </description> </method> <method name="reflection_probe_set_size"> @@ -2786,7 +2928,7 @@ <return type="RID" /> <description> Creates a scenario and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]scenario_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. The scenario is the 3D world that all the visual instances exist in. </description> </method> @@ -2795,6 +2937,7 @@ <param index="0" name="scenario" type="RID" /> <param index="1" name="effects" type="RID" /> <description> + Sets the camera attributes ([param effects]) that will be used with this scenario. See also [CameraAttributes]. </description> </method> <method name="scenario_set_environment"> @@ -2802,7 +2945,7 @@ <param index="0" name="scenario" type="RID" /> <param index="1" name="environment" type="RID" /> <description> - Sets the environment that will be used with this scenario. + Sets the environment that will be used with this scenario. See also [Environment]. </description> </method> <method name="scenario_set_fallback_environment"> @@ -2819,6 +2962,7 @@ <param index="1" name="amount" type="float" /> <param index="2" name="limit" type="float" /> <description> + Sets the screen-space roughness limiter parameters, such as whether it should be enabled and its thresholds. Equivalent to [member ProjectSettings.rendering/anti_aliasing/screen_space_roughness_limiter/enabled], [member ProjectSettings.rendering/anti_aliasing/screen_space_roughness_limiter/amount] and [member ProjectSettings.rendering/anti_aliasing/screen_space_roughness_limiter/limit]. </description> </method> <method name="set_boot_image"> @@ -2835,28 +2979,29 @@ <return type="void" /> <param index="0" name="generate" type="bool" /> <description> - If [code]true[/code], the engine will generate wireframes for use with the wireframe debug mode. + This method is currently unimplemented and does nothing if called with [param generate] set to [code]true[/code]. </description> </method> <method name="set_default_clear_color"> <return type="void" /> <param index="0" name="color" type="Color" /> <description> - Sets the default clear color which is used when a specific clear color has not been selected. + Sets the default clear color which is used when a specific clear color has not been selected. See also [method get_default_clear_color]. </description> </method> <method name="shader_create"> <return type="RID" /> <description> Creates an empty shader and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]shader_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent resource is [Shader]. </description> </method> <method name="shader_get_code" qualifiers="const"> <return type="String" /> <param index="0" name="shader" type="RID" /> <description> - Returns a shader's code. + Returns a shader's source code as a string. </description> </method> <method name="shader_get_default_texture_parameter" qualifiers="const"> @@ -2874,6 +3019,7 @@ <param index="0" name="shader" type="RID" /> <param index="1" name="name" type="StringName" /> <description> + Returns the default value for the specified shader uniform. This is usually the value written in the shader source code. </description> </method> <method name="shader_set_code"> @@ -2881,6 +3027,7 @@ <param index="0" name="shader" type="RID" /> <param index="1" name="code" type="String" /> <description> + Sets the shader's source code (which triggers recompilation after being changed). </description> </method> <method name="shader_set_default_texture_parameter"> @@ -2899,6 +3046,7 @@ <param index="0" name="shader" type="RID" /> <param index="1" name="path" type="String" /> <description> + Sets the path hint for the specified shader. This should generally match the [Shader] resource's [member Resource.resource_path]. </description> </method> <method name="skeleton_allocate_data"> @@ -2947,7 +3095,7 @@ <return type="RID" /> <description> Creates a skeleton and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]skeleton_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. </description> </method> <method name="skeleton_get_bone_count" qualifiers="const"> @@ -2971,13 +3119,16 @@ <param index="2" name="bake_irradiance" type="bool" /> <param index="3" name="size" type="Vector2i" /> <description> + Generates and returns an [Image] containing the radiance map for the specified [param sky] RID. This supports built-in sky material and custom sky shaders. If [param bake_irradiance] is [code]true[/code], the irradiance map is saved instead of the radiance map. The radiance map is used to render reflected light, while the irradiance map is used to render ambient light. See also [method environment_bake_panorama]. + [b]Note:[/b] The image is saved in linear color space without any tonemapping performed, which means it will look too dark if viewed directly in an image editor. [param energy] values above [code]1.0[/code] can be used to brighten the resulting image. + [b]Note:[/b] [param size] should be a 2:1 aspect ratio for the generated panorama to have square pixels. For radiance maps, there is no point in using a height greater than [member Sky.radiance_size], as it won't increase detail. Irradiance maps only contain low-frequency data, so there is usually no point in going past a size of 128×64 pixels when saving an irradiance map. </description> </method> <method name="sky_create"> <return type="RID" /> <description> Creates an empty sky and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]sky_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. </description> </method> <method name="sky_set_material"> @@ -2985,7 +3136,7 @@ <param index="0" name="sky" type="RID" /> <param index="1" name="material" type="RID" /> <description> - Sets the material that the sky uses to render the background and reflection maps. + Sets the material that the sky uses to render the background, ambient and reflection maps. </description> </method> <method name="sky_set_mode"> @@ -2993,6 +3144,7 @@ <param index="0" name="sky" type="RID" /> <param index="1" name="mode" type="int" enum="RenderingServer.SkyMode" /> <description> + Sets the process [param mode] of the sky specified by the [param sky] RID. Equivalent to [member Sky.process_mode]. </description> </method> <method name="sky_set_radiance_size"> @@ -3000,13 +3152,14 @@ <param index="0" name="sky" type="RID" /> <param index="1" name="radiance_size" type="int" /> <description> + Sets the [param radiance_size] of the sky specified by the [param sky] RID (in pixels). Equivalent to [member Sky.radiance_size]. </description> </method> <method name="spot_light_create"> <return type="RID" /> <description> Creates a spot light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. To place in a scene, attach this spot light to an instance using [method instance_set_base] using the returned RID. </description> </method> @@ -3014,6 +3167,7 @@ <return type="void" /> <param index="0" name="quality" type="int" enum="RenderingServer.SubSurfaceScatteringQuality" /> <description> + Sets [member ProjectSettings.rendering/environment/subsurface_scattering/subsurface_scattering_quality] to use when rendering materials that have subsurface scattering enabled. </description> </method> <method name="sub_surface_scattering_set_scale"> @@ -3021,18 +3175,30 @@ <param index="0" name="scale" type="float" /> <param index="1" name="depth_scale" type="float" /> <description> + Sets the [member ProjectSettings.rendering/environment/subsurface_scattering/subsurface_scattering_scale] and [member ProjectSettings.rendering/environment/subsurface_scattering/subsurface_scattering_depth_scale] to use when rendering materials that have subsurface scattering enabled. </description> </method> <method name="texture_2d_create"> <return type="RID" /> <param index="0" name="image" type="Image" /> <description> + Creates a 2-dimensional texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]texture_2d_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent resource is [Texture2D]. + [b]Note:[/b] Not to be confused with [method RenderingDevice.texture_create], which creates the graphics API's own texture type as opposed to the Godot-specific [Texture2D] resource. </description> </method> <method name="texture_2d_get" qualifiers="const"> <return type="Image" /> <param index="0" name="texture" type="RID" /> <description> + Returns an [Image] instance from the given [param texture] [RID]. + Example of getting the test texture from [method get_test_texture] and applying it to a [Sprite2D] node: + [codeblock] + var texture_rid = RenderingServer.get_test_texture() + var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid)) + $Sprite2D.texture = texture + [/codeblock] </description> </method> <method name="texture_2d_layer_get" qualifiers="const"> @@ -3040,6 +3206,7 @@ <param index="0" name="texture" type="RID" /> <param index="1" name="layer" type="int" /> <description> + Returns an [Image] instance from the given [param texture] [RID] and [param layer]. </description> </method> <method name="texture_2d_layered_create"> @@ -3047,17 +3214,25 @@ <param index="0" name="layers" type="Image[]" /> <param index="1" name="layered_type" type="int" enum="RenderingServer.TextureLayeredType" /> <description> + Creates a 2-dimensional layered texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]texture_2d_layered_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent resource is [TextureLayered]. </description> </method> <method name="texture_2d_layered_placeholder_create"> <return type="RID" /> <param index="0" name="layered_type" type="int" enum="RenderingServer.TextureLayeredType" /> <description> + Creates a placeholder for a 2-dimensional layered texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]texture_2d_layered_*[/code] RenderingServer functions, although it does nothing when used. See also [method texture_2d_placeholder_create]. + [b]Note:[/b] The equivalent resource is [PlaceholderTextureLayered]. </description> </method> <method name="texture_2d_placeholder_create"> <return type="RID" /> <description> + Creates a placeholder for a 2-dimensional layered texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]texture_2d_layered_*[/code] RenderingServer functions, although it does nothing when used. See also [method texture_2d_layered_placeholder_create] + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent resource is [PlaceholderTexture2D]. </description> </method> <method name="texture_2d_update"> @@ -3066,6 +3241,8 @@ <param index="1" name="image" type="Image" /> <param index="2" name="layer" type="int" /> <description> + Updates the texture specified by the [param texture] [RID] with the data in [param image]. A [param layer] must also be specified, which should be [code]0[/code] when updating a single-layer texture ([Texture2D]). + [b]Note:[/b] The [param image] must have the same width, height and format as the current [param texture] data. Otherwise, an error will be printed and the original texture won't be modified. If you need to use different width, height or format, use [method texture_replace] instead. </description> </method> <method name="texture_3d_create"> @@ -3077,17 +3254,22 @@ <param index="4" name="mipmaps" type="bool" /> <param index="5" name="data" type="Image[]" /> <description> + [b]Note:[/b] The equivalent resource is [Texture3D]. </description> </method> <method name="texture_3d_get" qualifiers="const"> <return type="Image[]" /> <param index="0" name="texture" type="RID" /> <description> + Returns 3D texture data as an array of [Image]s for the specified texture [RID]. </description> </method> <method name="texture_3d_placeholder_create"> <return type="RID" /> <description> + Creates a placeholder for a 3-dimensional texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]texture_3d_*[/code] RenderingServer functions, although it does nothing when used. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent resource is [PlaceholderTexture3D]. </description> </method> <method name="texture_3d_update"> @@ -3095,6 +3277,8 @@ <param index="0" name="texture" type="RID" /> <param index="1" name="data" type="Image[]" /> <description> + Updates the texture specified by the [param texture] [RID]'s data with the data in [param data]. All the texture's layers must be replaced at once. + [b]Note:[/b] The [param texture] must have the same width, height, depth and format as the current texture data. Otherwise, an error will be printed and the original texture won't be modified. If you need to use different width, height, depth or format, use [method texture_replace] instead. </description> </method> <method name="texture_get_path" qualifiers="const"> @@ -3115,6 +3299,7 @@ <return type="RID" /> <param index="0" name="base" type="RID" /> <description> + [i]Deprecated.[/i] As ProxyTexture was removed in Godot 4, this method does nothing when called and always returns a null [RID]. </description> </method> <method name="texture_proxy_update"> @@ -3122,6 +3307,7 @@ <param index="0" name="texture" type="RID" /> <param index="1" name="proxy_to" type="RID" /> <description> + [i]Deprecated.[/i] ProxyTexture was removed in Godot 4, so this method cannot be used anymore. </description> </method> <method name="texture_replace"> @@ -3129,6 +3315,7 @@ <param index="0" name="texture" type="RID" /> <param index="1" name="by_texture" type="RID" /> <description> + Replaces [param texture]'s texture data by the texture specified by the [param by_texture] RID, without changing [param texture]'s RID. </description> </method> <method name="texture_set_force_redraw_if_visible"> @@ -3192,19 +3379,25 @@ <return type="RID" /> <description> Creates an empty viewport and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]viewport_*[/code] RenderingServer functions. - Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent node is [Viewport]. </description> </method> <method name="viewport_get_measured_render_time_cpu" qualifiers="const"> <return type="float" /> <param index="0" name="viewport" type="RID" /> <description> + Returns the CPU time taken to render the last frame in milliseconds. This [i]only[/i] includes time spent in rendering-related operations; scripts' [code]_process[/code] functions and other engine subsystems are not included in this readout. To get a complete readout of CPU time spent to render the scene, sum the render times of all viewports that are drawn every frame plus [method get_frame_setup_time_cpu]. Unlike [method Engine.get_frames_per_second], this method will accurately reflect CPU utilization even if framerate is capped via V-Sync or [member Engine.max_fps]. See also [method viewport_get_measured_render_time_gpu]. + [b]Note:[/b] Requires measurements to be enabled on the specified [param viewport] using [method viewport_set_measure_render_time]. Otherwise, this method returns [code]0.0[/code]. </description> </method> <method name="viewport_get_measured_render_time_gpu" qualifiers="const"> <return type="float" /> <param index="0" name="viewport" type="RID" /> <description> + Returns the GPU time taken to render the last frame in milliseconds. To get a complete readout of GPU time spent to render the scene, sum the render times of all viewports that are drawn every frame. Unlike [method Engine.get_frames_per_second], this method accurately reflects GPU utilization even if framerate is capped via V-Sync or [member Engine.max_fps]. See also [method viewport_get_measured_render_time_gpu]. + [b]Note:[/b] Requires measurements to be enabled on the specified [param viewport] using [method viewport_set_measure_render_time]. Otherwise, this method returns [code]0.0[/code]. + [b]Note:[/b] When GPU utilization is low enough during a certain period of time, GPUs will decrease their power state (which in turn decreases core and memory clock speeds). This can cause the reported GPU time to increase if GPU utilization is kept low enough by a framerate cap (compared to what it would be at the GPU's highest power state). Keep this in mind when benchmarking using [method viewport_get_measured_render_time_gpu]. This behavior can be overridden in the graphics driver settings at the cost of higher power usage. </description> </method> <method name="viewport_get_render_info"> @@ -3213,6 +3406,27 @@ <param index="1" name="type" type="int" enum="RenderingServer.ViewportRenderInfoType" /> <param index="2" name="info" type="int" enum="RenderingServer.ViewportRenderInfo" /> <description> + Returns a statistic about the rendering engine which can be used for performance profiling. This is separated into render pass [param type]s, each of them having the same [param info]s you can query (different passes will return different values). See [enum RenderingServer.ViewportRenderInfoType] for a list of render pass types and [enum RenderingServer.ViewportRenderInfo] for a list of informations that can be queried. + See also [method get_rendering_info], which returns global information across all viewports. + [b]Note:[/b] Viewport rendering information is not available until at least 2 frames have been rendered by the engine. If rendering information is not available, [method viewport_get_render_info] returns [code]0[/code]. To print rendering information in [code]_ready()[/code] successfully, use the following: + [codeblock] + func _ready(): + for _i in 2: + await get_tree().process_frame + + print( + RenderingServer.viewport_get_render_info(get_viewport().get_viewport_rid(), + RenderingServer.VIEWPORT_RENDER_INFO_TYPE_VISIBLE, + RenderingServer.VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME) + ) + [/codeblock] + </description> + </method> + <method name="viewport_get_render_target" qualifiers="const"> + <return type="RID" /> + <param index="0" name="viewport" type="RID" /> + <description> + Returns the render target for the viewport. </description> </method> <method name="viewport_get_texture" qualifiers="const"> @@ -3287,6 +3501,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" /> <description> + Sets the default texture filtering mode for the specified [param viewport] RID. See [enum CanvasItemTextureFilter] for options. </description> </method> <method name="viewport_set_default_canvas_item_texture_repeat"> @@ -3294,6 +3509,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" /> <description> + Sets the default texture repeat mode for the specified [param viewport] RID. See [enum CanvasItemTextureRepeat] for options. </description> </method> <method name="viewport_set_disable_2d"> @@ -3301,7 +3517,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="disable" type="bool" /> <description> - If [code]true[/code], the viewport's canvas is not rendered. + If [code]true[/code], the viewport's canvas (i.e. 2D and GUI elements) is not rendered. </description> </method> <method name="viewport_set_disable_3d"> @@ -3309,6 +3525,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="disable" type="bool" /> <description> + If [code]true[/code], the viewport's 3D elements are not rendered. </description> </method> <method name="viewport_set_environment_mode"> @@ -3340,6 +3557,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="enable" type="bool" /> <description> + Sets the measurement for the given [param viewport] RID (obtained using [method Viewport.get_viewport_rid]). Once enabled, [method viewport_get_measured_render_time_cpu] and [method viewport_get_measured_render_time_gpu] will return values greater than [code]0.0[/code] when queried with the given [param viewport]. </description> </method> <method name="viewport_set_msaa_2d"> @@ -3347,7 +3565,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="msaa" type="int" enum="RenderingServer.ViewportMSAA" /> <description> - Sets the multisample anti-aliasing mode for 2D/Canvas. See [enum ViewportMSAA] for options. + Sets the multisample anti-aliasing mode for 2D/Canvas on the specified [param viewport] RID. See [enum ViewportMSAA] for options. </description> </method> <method name="viewport_set_msaa_3d"> @@ -3355,19 +3573,21 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="msaa" type="int" enum="RenderingServer.ViewportMSAA" /> <description> - Sets the multisample anti-aliasing mode for 3D. See [enum ViewportMSAA] for options. + Sets the multisample anti-aliasing mode for 3D on the specified [param viewport] RID. See [enum ViewportMSAA] for options. </description> </method> <method name="viewport_set_occlusion_culling_build_quality"> <return type="void" /> <param index="0" name="quality" type="int" enum="RenderingServer.ViewportOcclusionCullingBuildQuality" /> <description> + Sets the [member ProjectSettings.rendering/occlusion_culling/bvh_build_quality] to use for occlusion culling. This parameter is global and cannot be set on a per-viewport basis. </description> </method> <method name="viewport_set_occlusion_rays_per_thread"> <return type="void" /> <param index="0" name="rays_per_thread" type="int" /> <description> + Sets the [member ProjectSettings.rendering/occlusion_culling/occlusion_rays_per_thread] to use for occlusion culling. This parameter is global and cannot be set on a per-viewport basis. </description> </method> <method name="viewport_set_parent_viewport"> @@ -3375,7 +3595,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="parent_viewport" type="RID" /> <description> - Sets the viewport's parent to another viewport. + Sets the viewport's parent to the viewport specified by the [param parent_viewport] RID. </description> </method> <method name="viewport_set_positional_shadow_atlas_quadrant_subdivision"> @@ -3384,7 +3604,7 @@ <param index="1" name="quadrant" type="int" /> <param index="2" name="subdivision" type="int" /> <description> - Sets the shadow atlas quadrant's subdivision. + Sets the number of subdivisions to use in the specified shadow atlas [param quadrant] for omni and spot shadows. See also [method Viewport.set_positional_shadow_atlas_quadrant_subdiv]. </description> </method> <method name="viewport_set_positional_shadow_atlas_size"> @@ -3393,8 +3613,8 @@ <param index="1" name="size" type="int" /> <param index="2" name="use_16_bits" type="bool" default="false" /> <description> - Sets the size of the shadow atlas's images (used for omni and spot lights). The value will be rounded up to the nearest power of 2. - [b]Note:[/b] If this is set to [code]0[/code], no shadows will be visible at all (including directional shadows). + Sets the [param size] of the shadow atlas's images (used for omni and spot lights) on the viewport specified by the [param viewport] RID. The value is rounded up to the nearest power of 2. If [code]use_16_bits[/code] is [code]true[/code], use 16 bits for the omni/spot shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices. + [b]Note:[/b] If this is set to [code]0[/code], no positional shadows will be visible at all. This can improve performance significantly on low-end systems by reducing both the CPU and GPU load (as fewer draw calls are needed to draw the scene without shadows). </description> </method> <method name="viewport_set_render_direct_to_screen"> @@ -3410,7 +3630,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="scaling_3d_mode" type="int" enum="RenderingServer.ViewportScaling3DMode" /> <description> - Sets scaling 3d mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible. + Sets the 3D resolution scaling mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible. </description> </method> <method name="viewport_set_scaling_3d_scale"> @@ -3427,8 +3647,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="scenario" type="RID" /> <description> - Sets a viewport's scenario. - The scenario contains information about environment information, reflection atlas etc. + Sets a viewport's scenario. The scenario contains information about environment information, reflection atlas, etc. </description> </method> <method name="viewport_set_screen_space_aa"> @@ -3436,6 +3655,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="mode" type="int" enum="RenderingServer.ViewportScreenSpaceAA" /> <description> + Sets the viewport's screen-space antialiasing mode. </description> </method> <method name="viewport_set_sdf_oversize_and_scale"> @@ -3444,6 +3664,7 @@ <param index="1" name="oversize" type="int" enum="RenderingServer.ViewportSDFOversize" /> <param index="2" name="scale" type="int" enum="RenderingServer.ViewportSDFScale" /> <description> + Sets the viewport's 2D signed distance field [member ProjectSettings.rendering/2d/sdf/oversize] and [member ProjectSettings.rendering/2d/sdf/scale]. This is used when sampling the signed distance field in [CanvasItem] shaders as well as [GPUParticles2D] collision. This is [i]not[/i] used by SDFGI in 3D rendering. </description> </method> <method name="viewport_set_size"> @@ -3452,7 +3673,7 @@ <param index="1" name="width" type="int" /> <param index="2" name="height" type="int" /> <description> - Sets the viewport's width and height. + Sets the viewport's width and height in pixels. </description> </method> <method name="viewport_set_snap_2d_transforms_to_pixel"> @@ -3460,6 +3681,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="enabled" type="bool" /> <description> + If [code]true[/code], canvas item transforms (i.e. origin position) are snapped to the nearest pixel when rendering. This can lead to a crisper appearance at the cost of less smooth movement, especially when [Camera2D] smoothing is enabled. Equivalent to [member ProjectSettings.rendering/2d/snap/snap_2d_transforms_to_pixel]. </description> </method> <method name="viewport_set_snap_2d_vertices_to_pixel"> @@ -3467,6 +3689,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="enabled" type="bool" /> <description> + If [code]true[/code], canvas item vertices (i.e. polygon points) are snapped to the nearest pixel when rendering. This can lead to a crisper appearance at the cost of less smooth movement, especially when [Camera2D] smoothing is enabled. Equivalent to [member ProjectSettings.rendering/2d/snap/snap_2d_vertices_to_pixel]. </description> </method> <method name="viewport_set_texture_mipmap_bias"> @@ -3499,6 +3722,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="enable" type="bool" /> <description> + If [code]true[/code], enables debanding on the specified viewport. Equivalent to [member ProjectSettings.rendering/anti_aliasing/quality/use_debanding]. </description> </method> <method name="viewport_set_use_occlusion_culling"> @@ -3506,6 +3730,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="enable" type="bool" /> <description> + If [code]true[/code], enables occlusion culling on the specified viewport. Equivalent to [member ProjectSettings.rendering/occlusion_culling/use_occlusion_culling]. </description> </method> <method name="viewport_set_use_taa"> @@ -3513,7 +3738,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="enable" type="bool" /> <description> - If [code]true[/code], use Temporal Anti-Aliasing. + If [code]true[/code], use Temporal Anti-Aliasing. Equivalent to [member ProjectSettings.rendering/anti_aliasing/quality/use_taa]. </description> </method> <method name="viewport_set_use_xr"> @@ -3529,7 +3754,7 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="mode" type="int" enum="RenderingServer.ViewportVRSMode" /> <description> - Sets the Variable Rate Shading (VRS) mode for the viewport. Note, if hardware does not support VRS this property is ignored. + Sets the Variable Rate Shading (VRS) mode for the viewport. If the GPU does not support VRS, this property is ignored. Equivalent to [member ProjectSettings.rendering/vrs/mode]. </description> </method> <method name="viewport_set_vrs_texture"> @@ -3537,12 +3762,16 @@ <param index="0" name="viewport" type="RID" /> <param index="1" name="texture" type="RID" /> <description> - Texture to use when the VRS mode is set to [constant RenderingServer.VIEWPORT_VRS_TEXTURE]. + The texture to use when the VRS mode is set to [constant RenderingServer.VIEWPORT_VRS_TEXTURE]. Equivalent to [member ProjectSettings.rendering/vrs/texture]. </description> </method> <method name="visibility_notifier_create"> <return type="RID" /> <description> + Creates a new 3D visibility notifier object and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]visibility_notifier_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + To place in a scene, attach this mesh to an instance using [method instance_set_base] using the returned RID. + [b]Note:[/b] The equivalent node is [VisibleOnScreenNotifier3D]. </description> </method> <method name="visibility_notifier_set_aabb"> @@ -3576,6 +3805,9 @@ <method name="voxel_gi_create"> <return type="RID" /> <description> + Creates a new voxel-based global illumination object and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]voxel_gi_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The equivalent node is [VoxelGI]. </description> </method> <method name="voxel_gi_get_data_cells" qualifiers="const"> @@ -3627,6 +3859,7 @@ <param index="0" name="voxel_gi" type="RID" /> <param index="1" name="bias" type="float" /> <description> + Sets the [member VoxelGIData.bias] value to use on the specified [param voxel_gi]'s [RID]. </description> </method> <method name="voxel_gi_set_dynamic_range"> @@ -3634,6 +3867,7 @@ <param index="0" name="voxel_gi" type="RID" /> <param index="1" name="range" type="float" /> <description> + Sets the [member VoxelGIData.dynamic_range] value to use on the specified [param voxel_gi]'s [RID]. </description> </method> <method name="voxel_gi_set_energy"> @@ -3641,6 +3875,7 @@ <param index="0" name="voxel_gi" type="RID" /> <param index="1" name="energy" type="float" /> <description> + Sets the [member VoxelGIData.energy] value to use on the specified [param voxel_gi]'s [RID]. </description> </method> <method name="voxel_gi_set_interior"> @@ -3648,6 +3883,7 @@ <param index="0" name="voxel_gi" type="RID" /> <param index="1" name="enable" type="bool" /> <description> + Sets the [member VoxelGIData.interior] value to use on the specified [param voxel_gi]'s [RID]. </description> </method> <method name="voxel_gi_set_normal_bias"> @@ -3655,6 +3891,7 @@ <param index="0" name="voxel_gi" type="RID" /> <param index="1" name="bias" type="float" /> <description> + Sets the [member VoxelGIData.normal_bias] value to use on the specified [param voxel_gi]'s [RID]. </description> </method> <method name="voxel_gi_set_propagation"> @@ -3662,12 +3899,14 @@ <param index="0" name="voxel_gi" type="RID" /> <param index="1" name="amount" type="float" /> <description> + Sets the [member VoxelGIData.propagation] value to use on the specified [param voxel_gi]'s [RID]. </description> </method> <method name="voxel_gi_set_quality"> <return type="void" /> <param index="0" name="quality" type="int" enum="RenderingServer.VoxelGIQuality" /> <description> + Sets the [member ProjectSettings.rendering/global_illumination/voxel_gi/quality] value to use when rendering. This parameter is global and cannot be set on a per-VoxelGI basis. </description> </method> <method name="voxel_gi_set_use_two_bounces"> @@ -3675,6 +3914,7 @@ <param index="0" name="voxel_gi" type="RID" /> <param index="1" name="enable" type="bool" /> <description> + Sets the [member VoxelGIData.use_two_bounces] value to use on the specified [param voxel_gi]'s [RID]. </description> </method> </methods> @@ -3709,30 +3949,40 @@ The maximum Z-layer for canvas items. </constant> <constant name="MAX_GLOW_LEVELS" value="7"> - Max number of glow levels that can be used with glow post-process effect. + The maximum number of glow levels that can be used with the glow post-processing effect. </constant> <constant name="MAX_CURSORS" value="8"> - Unused enum in Godot 3.x. + [i]Deprecated.[/i] This constant is unused. </constant> <constant name="MAX_2D_DIRECTIONAL_LIGHTS" value="8"> + The maximum number of directional lights that can be rendered at a given time in 2D. </constant> <constant name="TEXTURE_LAYERED_2D_ARRAY" value="0" enum="TextureLayeredType"> + Array of 2-dimensional textures (see [Texture2DArray]). </constant> <constant name="TEXTURE_LAYERED_CUBEMAP" value="1" enum="TextureLayeredType"> + Cubemap texture (see [Cubemap]). </constant> <constant name="TEXTURE_LAYERED_CUBEMAP_ARRAY" value="2" enum="TextureLayeredType"> + Array of cubemap textures (see [CubemapArray]). </constant> <constant name="CUBEMAP_LAYER_LEFT" value="0" enum="CubeMapLayer"> + Left face of a [Cubemap]. </constant> <constant name="CUBEMAP_LAYER_RIGHT" value="1" enum="CubeMapLayer"> + Right face of a [Cubemap]. </constant> <constant name="CUBEMAP_LAYER_BOTTOM" value="2" enum="CubeMapLayer"> + Bottom face of a [Cubemap]. </constant> <constant name="CUBEMAP_LAYER_TOP" value="3" enum="CubeMapLayer"> + Top face of a [Cubemap]. </constant> <constant name="CUBEMAP_LAYER_FRONT" value="4" enum="CubeMapLayer"> + Front face of a [Cubemap]. </constant> <constant name="CUBEMAP_LAYER_BACK" value="5" enum="CubeMapLayer"> + Back face of a [Cubemap]. </constant> <constant name="SHADER_SPATIAL" value="0" enum="ShaderMode"> Shader is a 3D shader. @@ -3741,13 +3991,13 @@ Shader is a 2D shader. </constant> <constant name="SHADER_PARTICLES" value="2" enum="ShaderMode"> - Shader is a particle shader. + Shader is a particle shader (can be used in both 2D and 3D). </constant> <constant name="SHADER_SKY" value="3" enum="ShaderMode"> - Shader is a sky shader. + Shader is a 3D sky shader. </constant> <constant name="SHADER_FOG" value="4" enum="ShaderMode"> - Shader is a fog shader. + Shader is a 3D fog shader. </constant> <constant name="SHADER_MAX" value="5" enum="ShaderMode"> Represents the size of the [enum ShaderMode] enum. @@ -3759,7 +4009,7 @@ The maximum renderpriority of all materials. </constant> <constant name="ARRAY_VERTEX" value="0" enum="ArrayType"> - Array is a vertex array. + Array is a vertex position array. </constant> <constant name="ARRAY_NORMAL" value="1" enum="ArrayType"> Array is a normal array. @@ -3768,21 +4018,25 @@ Array is a tangent array. </constant> <constant name="ARRAY_COLOR" value="3" enum="ArrayType"> - Array is a color array. + Array is a vertex color array. </constant> <constant name="ARRAY_TEX_UV" value="4" enum="ArrayType"> Array is an UV coordinates array. </constant> <constant name="ARRAY_TEX_UV2" value="5" enum="ArrayType"> - Array is an UV coordinates array for the second UV coordinates. + Array is an UV coordinates array for the second set of UV coordinates. </constant> <constant name="ARRAY_CUSTOM0" value="6" enum="ArrayType"> + Array is a custom data array for the first set of custom data. </constant> <constant name="ARRAY_CUSTOM1" value="7" enum="ArrayType"> + Array is a custom data array for the second set of custom data. </constant> <constant name="ARRAY_CUSTOM2" value="8" enum="ArrayType"> + Array is a custom data array for the third set of custom data. </constant> <constant name="ARRAY_CUSTOM3" value="9" enum="ArrayType"> + Array is a custom data array for the fourth set of custom data. </constant> <constant name="ARRAY_BONES" value="10" enum="ArrayType"> Array contains bone information. @@ -3791,33 +4045,43 @@ Array is weight information. </constant> <constant name="ARRAY_INDEX" value="12" enum="ArrayType"> - Array is index array. + Array is an index array. </constant> <constant name="ARRAY_MAX" value="13" enum="ArrayType"> Represents the size of the [enum ArrayType] enum. </constant> <constant name="ARRAY_CUSTOM_COUNT" value="4"> + The number of custom data arrays available ([constant ARRAY_CUSTOM0], [constant ARRAY_CUSTOM1], [constant ARRAY_CUSTOM2], [constant ARRAY_CUSTOM3]). </constant> <constant name="ARRAY_CUSTOM_RGBA8_UNORM" value="0" enum="ArrayCustomFormat"> + Custom data array contains 8-bit-per-channel red/green/blue/alpha color data. Values are normalized, unsigned floating-point in the [code][0.0, 1.0][/code] range. </constant> <constant name="ARRAY_CUSTOM_RGBA8_SNORM" value="1" enum="ArrayCustomFormat"> + Custom data array contains 8-bit-per-channel red/green/blue/alpha color data. Values are normalized, signed floating-point in the [code][-1.0, 1.0][/code] range. </constant> <constant name="ARRAY_CUSTOM_RG_HALF" value="2" enum="ArrayCustomFormat"> + Custom data array contains 16-bit-per-channel red/green color data. Values are floating-point in half precision. </constant> <constant name="ARRAY_CUSTOM_RGBA_HALF" value="3" enum="ArrayCustomFormat"> + Custom data array contains 16-bit-per-channel red/green/blue/alpha color data. Values are floating-point in half precision. </constant> <constant name="ARRAY_CUSTOM_R_FLOAT" value="4" enum="ArrayCustomFormat"> + Custom data array contains 32-bit-per-channel red color data. Values are floating-point in single precision. </constant> <constant name="ARRAY_CUSTOM_RG_FLOAT" value="5" enum="ArrayCustomFormat"> + Custom data array contains 32-bit-per-channel red/green color data. Values are floating-point in single precision. </constant> <constant name="ARRAY_CUSTOM_RGB_FLOAT" value="6" enum="ArrayCustomFormat"> + Custom data array contains 32-bit-per-channel red/green/blue color data. Values are floating-point in single precision. </constant> <constant name="ARRAY_CUSTOM_RGBA_FLOAT" value="7" enum="ArrayCustomFormat"> + Custom data array contains 32-bit-per-channel red/green/blue/alpha color data. Values are floating-point in single precision. </constant> <constant name="ARRAY_CUSTOM_MAX" value="8" enum="ArrayCustomFormat"> + Represents the size of the [enum ArrayCustomFormat] enum. </constant> <constant name="ARRAY_FORMAT_VERTEX" value="1" enum="ArrayFormat" is_bitfield="true"> - Flag used to mark a vertex array. + Flag used to mark a vertex position array. </constant> <constant name="ARRAY_FORMAT_NORMAL" value="2" enum="ArrayFormat" is_bitfield="true"> Flag used to mark a normal array. @@ -3826,7 +4090,7 @@ Flag used to mark a tangent array. </constant> <constant name="ARRAY_FORMAT_COLOR" value="8" enum="ArrayFormat" is_bitfield="true"> - Flag used to mark a color array. + Flag used to mark a vertex color array. </constant> <constant name="ARRAY_FORMAT_TEX_UV" value="16" enum="ArrayFormat" is_bitfield="true"> Flag used to mark an UV coordinates array. @@ -3835,12 +4099,16 @@ Flag used to mark an UV coordinates array for the second UV coordinates. </constant> <constant name="ARRAY_FORMAT_CUSTOM0" value="64" enum="ArrayFormat" is_bitfield="true"> + Flag used to mark an array of custom per-vertex data for the first set of custom data. </constant> <constant name="ARRAY_FORMAT_CUSTOM1" value="128" enum="ArrayFormat" is_bitfield="true"> + Flag used to mark an array of custom per-vertex data for the second set of custom data. </constant> <constant name="ARRAY_FORMAT_CUSTOM2" value="256" enum="ArrayFormat" is_bitfield="true"> + Flag used to mark an array of custom per-vertex data for the third set of custom data. </constant> <constant name="ARRAY_FORMAT_CUSTOM3" value="512" enum="ArrayFormat" is_bitfield="true"> + Flag used to mark an array of custom per-vertex data for the fourth set of custom data. </constant> <constant name="ARRAY_FORMAT_BONES" value="1024" enum="ArrayFormat" is_bitfield="true"> Flag used to mark a bone information array. @@ -3875,6 +4143,7 @@ <constant name="ARRAY_FLAG_USE_DYNAMIC_UPDATE" value="67108864" enum="ArrayFormat" is_bitfield="true"> </constant> <constant name="ARRAY_FLAG_USE_8_BONE_WEIGHTS" value="134217728" enum="ArrayFormat" is_bitfield="true"> + Flag used to mark that the array uses 8 bone weighs instead of 4. </constant> <constant name="ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY" value="268435456" enum="ArrayFormat" is_bitfield="true"> </constant> @@ -3927,13 +4196,13 @@ Linear filter for light projectors (use for non-pixel art light projectors). Anisotropic mipmaps are used for rendering, which means light projectors at a distance will look smooth and sharp when viewed from oblique angles. This looks better compared to isotropic mipmaps, but is slower. The level of anisotropic filtering is defined by [member ProjectSettings.rendering/textures/default_filters/anisotropic_filtering_level]. </constant> <constant name="LIGHT_DIRECTIONAL" value="0" enum="LightType"> - Is a directional (sun) light. + Directional (sun/moon) light (see [DirectionalLight3D]). </constant> <constant name="LIGHT_OMNI" value="1" enum="LightType"> - Is an omni light. + Omni light (see [OmniLight3D]). </constant> <constant name="LIGHT_SPOT" value="2" enum="LightType"> - Is a spot light. + Spot light (see [SpotLight3D]). </constant> <constant name="LIGHT_PARAM_ENERGY" value="0" enum="LightParam"> The light's energy multiplier. @@ -3963,7 +4232,7 @@ The spotlight's attenuation. </constant> <constant name="LIGHT_PARAM_SHADOW_MAX_DISTANCE" value="9" enum="LightParam"> - Max distance that shadows will be rendered. + The maximum distance for shadow splits. Increasing this value will make directional shadows visible from further away, at the cost of lower overall shadow detail and performance (since more objects need to be included in the directional shadow rendering). </constant> <constant name="LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET" value="10" enum="LightParam"> Proportion of shadow atlas occupied by the first split. @@ -3998,10 +4267,13 @@ Represents the size of the [enum LightParam] enum. </constant> <constant name="LIGHT_BAKE_DISABLED" value="0" enum="LightBakeMode"> + Light is ignored when baking. This is the fastest mode, but the light will be taken into account when baking global illumination. This mode should generally be used for dynamic lights that change quickly, as the effect of global illumination is less noticeable on those lights. </constant> <constant name="LIGHT_BAKE_STATIC" value="1" enum="LightBakeMode"> + Light is taken into account in static baking ([VoxelGI], [LightmapGI], SDFGI ([member Environment.sdfgi_enabled])). The light can be moved around or modified, but its global illumination will not update in real-time. This is suitable for subtle changes (such as flickering torches), but generally not large changes such as toggling a light on and off. </constant> <constant name="LIGHT_BAKE_DYNAMIC" value="2" enum="LightBakeMode"> + Light is taken into account in dynamic baking ([VoxelGI] and SDFGI ([member Environment.sdfgi_enabled]) only). The light can be moved around or modified with global illumination updating in real-time. The light's global illumination appearance will be slightly different compared to [constant LIGHT_BAKE_STATIC]. This has a greater performance cost compared to [constant LIGHT_BAKE_STATIC]. When using SDFGI, the update speed of dynamic lights is affected by [member ProjectSettings.rendering/global_illumination/sdfgi/frames_to_update_lights]. </constant> <constant name="LIGHT_OMNI_SHADOW_DUAL_PARABOLOID" value="0" enum="LightOmniShadowMode"> Use a dual paraboloid shadow map for omni lights. @@ -4047,6 +4319,7 @@ Highest low shadow filtering quality (slowest). When using this quality setting, [member Light3D.shadow_blur] is automatically multiplied by 2× to better make use of the high sample count. This increased blur also improves the stability of dynamic object shadows. This multiplier only applies to lights whose [member Light3D.light_size] or [member Light3D.light_angular_distance] is [code]0.0[/code]). </constant> <constant name="SHADOW_QUALITY_MAX" value="6" enum="ShadowQuality"> + Represents the size of the [enum ShadowQuality] enum. </constant> <constant name="REFLECTION_PROBE_UPDATE_ONCE" value="0" enum="ReflectionProbeUpdateMode"> Reflection probe will update reflections once and then stop. @@ -4055,20 +4328,28 @@ Reflection probe will update each frame. This mode is necessary to capture moving objects. </constant> <constant name="REFLECTION_PROBE_AMBIENT_DISABLED" value="0" enum="ReflectionProbeAmbientMode"> + Do not apply any ambient lighting inside the reflection probe's box defined by its size. </constant> <constant name="REFLECTION_PROBE_AMBIENT_ENVIRONMENT" value="1" enum="ReflectionProbeAmbientMode"> + Apply automatically-sourced environment lighting inside the reflection probe's box defined by its size. </constant> <constant name="REFLECTION_PROBE_AMBIENT_COLOR" value="2" enum="ReflectionProbeAmbientMode"> + Apply custom ambient lighting inside the reflection probe's box defined by its size. See [method reflection_probe_set_ambient_color] and [method reflection_probe_set_ambient_energy]. </constant> <constant name="DECAL_TEXTURE_ALBEDO" value="0" enum="DecalTexture"> + Albedo texture slot in a decal ([member Decal.texture_albedo]). </constant> <constant name="DECAL_TEXTURE_NORMAL" value="1" enum="DecalTexture"> + Normal map texture slot in a decal ([member Decal.texture_normal]). </constant> <constant name="DECAL_TEXTURE_ORM" value="2" enum="DecalTexture"> + Occlusion/Roughness/Metallic texture slot in a decal ([member Decal.texture_orm]). </constant> <constant name="DECAL_TEXTURE_EMISSION" value="3" enum="DecalTexture"> + Emission texture slot in a decal ([member Decal.texture_emission]). </constant> <constant name="DECAL_TEXTURE_MAX" value="4" enum="DecalTexture"> + Represents the size of the [enum DecalTexture] enum. </constant> <constant name="DECAL_FILTER_NEAREST" value="0" enum="DecalFilter"> Nearest-neighbor filter for decals (use for pixel art decals). No mipmaps are used for rendering, which means decals at a distance will look sharp but grainy. This has roughly the same performance cost as using mipmaps. @@ -4089,12 +4370,16 @@ Linear filter for decals (use for non-pixel art decals). Anisotropic mipmaps are used for rendering, which means decals at a distance will look smooth and sharp when viewed from oblique angles. This looks better compared to isotropic mipmaps, but is slower. The level of anisotropic filtering is defined by [member ProjectSettings.rendering/textures/default_filters/anisotropic_filtering_level]. </constant> <constant name="VOXEL_GI_QUALITY_LOW" value="0" enum="VoxelGIQuality"> + Low [VoxelGI] rendering quality using 4 cones. </constant> <constant name="VOXEL_GI_QUALITY_HIGH" value="1" enum="VoxelGIQuality"> + High [VoxelGI] rendering quality using 6 cones. </constant> <constant name="PARTICLES_MODE_2D" value="0" enum="ParticlesMode"> + 2D particles. </constant> <constant name="PARTICLES_MODE_3D" value="1" enum="ParticlesMode"> + 3D particles. </constant> <constant name="PARTICLES_TRANSFORM_ALIGN_DISABLED" value="0" enum="ParticlesTransformAlign"> </constant> @@ -4152,6 +4437,7 @@ <constant name="PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_8192" value="5" enum="ParticlesCollisionHeightfieldResolution"> </constant> <constant name="PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_MAX" value="6" enum="ParticlesCollisionHeightfieldResolution"> + Represents the size of the [enum ParticlesCollisionHeightfieldResolution] enum. </constant> <constant name="FOG_VOLUME_SHAPE_ELLIPSOID" value="0" enum="FogVolumeShape"> [FogVolume] will be shaped like an ellipsoid (stretched sphere). @@ -4169,6 +4455,7 @@ [FogVolume] will have no shape, will cover the whole world and will not be culled. </constant> <constant name="FOG_VOLUME_SHAPE_MAX" value="5" enum="FogVolumeShape"> + Represents the size of the [enum FogVolumeShape] enum. </constant> <constant name="VIEWPORT_SCALING_3D_MODE_BILINEAR" value="0" enum="ViewportScaling3DMode"> Use bilinear scaling for the viewport's 3D buffer. The amount of scaling can be set using [member Viewport.scaling_3d_scale]. Values less than [code]1.0[/code] will result in undersampling while values greater than [code]1.0[/code] will result in supersampling. A value of [code]1.0[/code] disables scaling. @@ -4177,29 +4464,31 @@ Use AMD FidelityFX Super Resolution 1.0 upscaling for the viewport's 3D buffer. The amount of scaling can be set using [member Viewport.scaling_3d_scale]. Values less than [code]1.0[/code] will be result in the viewport being upscaled using FSR. Values greater than [code]1.0[/code] are not supported and bilinear downsampling will be used instead. A value of [code]1.0[/code] disables scaling. </constant> <constant name="VIEWPORT_SCALING_3D_MODE_MAX" value="2" enum="ViewportScaling3DMode"> + Represents the size of the [enum ViewportScaling3DMode] enum. </constant> <constant name="VIEWPORT_UPDATE_DISABLED" value="0" enum="ViewportUpdateMode"> - Do not update the viewport. + Do not update the viewport's render target. </constant> <constant name="VIEWPORT_UPDATE_ONCE" value="1" enum="ViewportUpdateMode"> - Update the viewport once then set to disabled. + Update the viewport's render target once, then switch to [constant VIEWPORT_UPDATE_DISABLED]. </constant> <constant name="VIEWPORT_UPDATE_WHEN_VISIBLE" value="2" enum="ViewportUpdateMode"> - Update the viewport whenever it is visible. + Update the viewport's render target only when it is visible. This is the default value. </constant> <constant name="VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE" value="3" enum="ViewportUpdateMode"> + Update the viewport's render target only when its parent is visible. </constant> <constant name="VIEWPORT_UPDATE_ALWAYS" value="4" enum="ViewportUpdateMode"> - Always update the viewport. + Always update the viewport's render target. </constant> <constant name="VIEWPORT_CLEAR_ALWAYS" value="0" enum="ViewportClearMode"> - The viewport is always cleared before drawing. + Always clear the viewport's render target before drawing. </constant> <constant name="VIEWPORT_CLEAR_NEVER" value="1" enum="ViewportClearMode"> - The viewport is never cleared before drawing. + Never clear the viewport's render target. </constant> <constant name="VIEWPORT_CLEAR_ONLY_NEXT_FRAME" value="2" enum="ViewportClearMode"> - The viewport is cleared once, then the clear mode is set to [constant VIEWPORT_CLEAR_NEVER]. + Clear the viewport's render target on the next frame, then switch to [constant VIEWPORT_CLEAR_NEVER]. </constant> <constant name="VIEWPORT_ENVIRONMENT_DISABLED" value="0" enum="ViewportEnvironmentMode"> Disable rendering of 3D environment over 2D canvas. @@ -4208,28 +4497,37 @@ Enable rendering of 3D environment over 2D canvas. </constant> <constant name="VIEWPORT_ENVIRONMENT_INHERIT" value="2" enum="ViewportEnvironmentMode"> - Inherit enable/disable value from parent. If topmost parent is also set to inherit, then this has the same behavior as [constant VIEWPORT_ENVIRONMENT_ENABLED]. + Inherit enable/disable value from parent. If the topmost parent is also set to [constant VIEWPORT_ENVIRONMENT_INHERIT], then this has the same behavior as [constant VIEWPORT_ENVIRONMENT_ENABLED]. </constant> <constant name="VIEWPORT_ENVIRONMENT_MAX" value="3" enum="ViewportEnvironmentMode"> - Max value of [enum ViewportEnvironmentMode] enum. + Represents the size of the [enum ViewportEnvironmentMode] enum. </constant> <constant name="VIEWPORT_SDF_OVERSIZE_100_PERCENT" value="0" enum="ViewportSDFOversize"> + Do not oversize the 2D signed distance field. Occluders may disappear when touching the viewport's edges, and [GPUParticles3D] collision may stop working earlier than intended. This has the lowest GPU requirements. </constant> <constant name="VIEWPORT_SDF_OVERSIZE_120_PERCENT" value="1" enum="ViewportSDFOversize"> + 2D signed distance field covers 20% of the viewport's size outside the viewport on each side (top, right, bottom, left). </constant> <constant name="VIEWPORT_SDF_OVERSIZE_150_PERCENT" value="2" enum="ViewportSDFOversize"> + 2D signed distance field covers 50% of the viewport's size outside the viewport on each side (top, right, bottom, left). </constant> <constant name="VIEWPORT_SDF_OVERSIZE_200_PERCENT" value="3" enum="ViewportSDFOversize"> + 2D signed distance field covers 100% of the viewport's size outside the viewport on each side (top, right, bottom, left). This has the highest GPU requirements. </constant> <constant name="VIEWPORT_SDF_OVERSIZE_MAX" value="4" enum="ViewportSDFOversize"> + Represents the size of the [enum ViewportSDFOversize] enum. </constant> <constant name="VIEWPORT_SDF_SCALE_100_PERCENT" value="0" enum="ViewportSDFScale"> + Full resolution 2D signed distance field scale. This has the highest GPU requirements. </constant> <constant name="VIEWPORT_SDF_SCALE_50_PERCENT" value="1" enum="ViewportSDFScale"> + Half resolution 2D signed distance field scale on each axis (25% of the viewport pixel count). </constant> <constant name="VIEWPORT_SDF_SCALE_25_PERCENT" value="2" enum="ViewportSDFScale"> + Quarter resolution 2D signed distance field scale on each axis (6.25% of the viewport pixel count). This has the lowest GPU requirements. </constant> <constant name="VIEWPORT_SDF_SCALE_MAX" value="3" enum="ViewportSDFScale"> + Represents the size of the [enum ViewportSDFScale] enum. </constant> <constant name="VIEWPORT_MSAA_DISABLED" value="0" enum="ViewportMSAA"> Multisample antialiasing for 3D is disabled. This is the default value, and also the fastest setting. @@ -4244,18 +4542,25 @@ Multisample antialiasing uses 8 samples per pixel for 3D. This has a very high impact on performance. Likely unsupported on low-end and older hardware. </constant> <constant name="VIEWPORT_MSAA_MAX" value="4" enum="ViewportMSAA"> + Represents the size of the [enum ViewportMSAA] enum. </constant> <constant name="VIEWPORT_SCREEN_SPACE_AA_DISABLED" value="0" enum="ViewportScreenSpaceAA"> + Do not perform any antialiasing in the full screen post-process. </constant> <constant name="VIEWPORT_SCREEN_SPACE_AA_FXAA" value="1" enum="ViewportScreenSpaceAA"> + Use fast approximate antialiasing. FXAA is a popular screen-space antialiasing method, which is fast but will make the image look blurry, especially at lower resolutions. It can still work relatively well at large resolutions such as 1440p and 4K. </constant> <constant name="VIEWPORT_SCREEN_SPACE_AA_MAX" value="2" enum="ViewportScreenSpaceAA"> + Represents the size of the [enum ViewportScreenSpaceAA] enum. </constant> <constant name="VIEWPORT_OCCLUSION_BUILD_QUALITY_LOW" value="0" enum="ViewportOcclusionCullingBuildQuality"> + Low occlusion culling BVH build quality (as defined by Embree). Results in the lowest CPU usage, but least effective culling. </constant> <constant name="VIEWPORT_OCCLUSION_BUILD_QUALITY_MEDIUM" value="1" enum="ViewportOcclusionCullingBuildQuality"> + Medium occlusion culling BVH build quality (as defined by Embree). </constant> <constant name="VIEWPORT_OCCLUSION_BUILD_QUALITY_HIGH" value="2" enum="ViewportOcclusionCullingBuildQuality"> + High occlusion culling BVH build quality (as defined by Embree). Results in the highest CPU usage, but most effective culling. </constant> <constant name="VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME" value="0" enum="ViewportRenderInfo"> Number of objects drawn in a single frame. @@ -4270,10 +4575,13 @@ Represents the size of the [enum ViewportRenderInfo] enum. </constant> <constant name="VIEWPORT_RENDER_INFO_TYPE_VISIBLE" value="0" enum="ViewportRenderInfoType"> + Visible render pass (excluding shadows). </constant> <constant name="VIEWPORT_RENDER_INFO_TYPE_SHADOW" value="1" enum="ViewportRenderInfoType"> + Shadow render pass. Objects will be rendered several times depending on the number of amounts of lights with shadows and the number of directional shadow splits. </constant> <constant name="VIEWPORT_RENDER_INFO_TYPE_MAX" value="2" enum="ViewportRenderInfoType"> + Represents the size of the [enum ViewportRenderInfoType] enum. </constant> <constant name="VIEWPORT_DEBUG_DRAW_DISABLED" value="0" enum="ViewportDebugDraw"> Debug draw is disabled. Default setting. @@ -4310,6 +4618,7 @@ Draws the shadow atlas that stores shadows from [DirectionalLight3D]s in the upper left quadrant of the [Viewport]. </constant> <constant name="VIEWPORT_DEBUG_DRAW_SCENE_LUMINANCE" value="11" enum="ViewportDebugDraw"> + Draws the estimated scene luminance. This is a 1×1 texture that is generated when autoexposure is enabled to control the scene's exposure. </constant> <constant name="VIEWPORT_DEBUG_DRAW_SSAO" value="12" enum="ViewportDebugDraw"> Draws the screen space ambient occlusion texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have [member Environment.ssao_enabled] set in your [WorldEnvironment]. @@ -4321,49 +4630,62 @@ Colors each PSSM split for the [DirectionalLight3D]s in the scene a different color so you can see where the splits are. In order they will be colored red, green, blue, yellow. </constant> <constant name="VIEWPORT_DEBUG_DRAW_DECAL_ATLAS" value="15" enum="ViewportDebugDraw"> + Draws the decal atlas that stores decal textures from [Decal]s. </constant> <constant name="VIEWPORT_DEBUG_DRAW_SDFGI" value="16" enum="ViewportDebugDraw"> + Draws SDFGI cascade data. This is the data structure that is used to bounce lighting against and create reflections. </constant> <constant name="VIEWPORT_DEBUG_DRAW_SDFGI_PROBES" value="17" enum="ViewportDebugDraw"> + Draws SDFGI probe data. This is the data structure that is used to give indirect lighting dynamic objects moving within the scene. </constant> <constant name="VIEWPORT_DEBUG_DRAW_GI_BUFFER" value="18" enum="ViewportDebugDraw"> + Draws the global illumination buffer ([VoxelGI] or SDFGI). </constant> <constant name="VIEWPORT_DEBUG_DRAW_DISABLE_LOD" value="19" enum="ViewportDebugDraw"> + Disable mesh LOD. All meshes are drawn with full detail, which can be used to compare performance. </constant> <constant name="VIEWPORT_DEBUG_DRAW_CLUSTER_OMNI_LIGHTS" value="20" enum="ViewportDebugDraw"> + Draws the [OmniLight3D] cluster. Clustering determines where lights are positioned in screen-space, which allows the engine to only process these portions of the screen for lighting. </constant> <constant name="VIEWPORT_DEBUG_DRAW_CLUSTER_SPOT_LIGHTS" value="21" enum="ViewportDebugDraw"> + Draws the [SpotLight3D] cluster. Clustering determines where lights are positioned in screen-space, which allows the engine to only process these portions of the screen for lighting. </constant> <constant name="VIEWPORT_DEBUG_DRAW_CLUSTER_DECALS" value="22" enum="ViewportDebugDraw"> + Draws the [Decal] cluster. Clustering determines where decals are positioned in screen-space, which allows the engine to only process these portions of the screen for decals. </constant> <constant name="VIEWPORT_DEBUG_DRAW_CLUSTER_REFLECTION_PROBES" value="23" enum="ViewportDebugDraw"> + Draws the [ReflectionProbe] cluster. Clustering determines where reflection probes are positioned in screen-space, which allows the engine to only process these portions of the screen for reflection probes. </constant> <constant name="VIEWPORT_DEBUG_DRAW_OCCLUDERS" value="24" enum="ViewportDebugDraw"> + Draws the occlusion culling buffer. This low-resolution occlusion culling buffer is rasterized on the CPU and is used to check whether instances are occluded by other objects. </constant> <constant name="VIEWPORT_DEBUG_DRAW_MOTION_VECTORS" value="25" enum="ViewportDebugDraw"> + Draws the motion vectors buffer. This is used by temporal antialiasing to correct for motion that occurs during gameplay. </constant> <constant name="VIEWPORT_VRS_DISABLED" value="0" enum="ViewportVRSMode"> - VRS is disabled. + Variable rate shading is disabled. </constant> <constant name="VIEWPORT_VRS_TEXTURE" value="1" enum="ViewportVRSMode"> - VRS uses a texture. Note, for stereoscopic use a texture atlas with a texture for each view. + Variable rate shading uses a texture. Note, for stereoscopic use a texture atlas with a texture for each view. </constant> <constant name="VIEWPORT_VRS_XR" value="2" enum="ViewportVRSMode"> - VRS texture is supplied by the primary [XRInterface]. + Variable rate shading texture is supplied by the primary [XRInterface]. </constant> <constant name="VIEWPORT_VRS_MAX" value="3" enum="ViewportVRSMode"> Represents the size of the [enum ViewportVRSMode] enum. </constant> <constant name="SKY_MODE_AUTOMATIC" value="0" enum="SkyMode"> + Automatically selects the appropriate process mode based on your sky shader. If your shader uses [code]TIME[/code] or [code]POSITION[/code], this will use [constant SKY_MODE_REALTIME]. If your shader uses any of the [code]LIGHT_*[/code] variables or any custom uniforms, this uses [constant SKY_MODE_INCREMENTAL]. Otherwise, this defaults to [constant SKY_MODE_QUALITY]. </constant> <constant name="SKY_MODE_QUALITY" value="1" enum="SkyMode"> - Uses high quality importance sampling to process the radiance map. In general, this results in much higher quality than [constant Sky.PROCESS_MODE_REALTIME] but takes much longer to generate. This should not be used if you plan on changing the sky at runtime. If you are finding that the reflection is not blurry enough and is showing sparkles or fireflies, try increasing [member ProjectSettings.rendering/reflections/sky_reflections/ggx_samples]. + Uses high quality importance sampling to process the radiance map. In general, this results in much higher quality than [constant SKY_MODE_REALTIME] but takes much longer to generate. This should not be used if you plan on changing the sky at runtime. If you are finding that the reflection is not blurry enough and is showing sparkles or fireflies, try increasing [member ProjectSettings.rendering/reflections/sky_reflections/ggx_samples]. </constant> <constant name="SKY_MODE_INCREMENTAL" value="2" enum="SkyMode"> + Uses the same high quality importance sampling to process the radiance map as [constant SKY_MODE_QUALITY], but updates over several frames. The number of frames is determined by [member ProjectSettings.rendering/reflections/sky_reflections/roughness_layers]. Use this when you need highest quality radiance maps, but have a sky that updates slowly. </constant> <constant name="SKY_MODE_REALTIME" value="3" enum="SkyMode"> - Uses the fast filtering algorithm to process the radiance map. In general this results in lower quality, but substantially faster run times. - [b]Note:[/b] The fast filtering algorithm is limited to 256x256 cubemaps, so [member Sky.radiance_size] must be set to [constant Sky.RADIANCE_SIZE_256]. + Uses the fast filtering algorithm to process the radiance map. In general this results in lower quality, but substantially faster run times. If you need better quality, but still need to update the sky every frame, consider turning on [member ProjectSettings.rendering/reflections/sky_reflections/fast_filter_high_quality]. + [b]Note:[/b] The fast filtering algorithm is limited to 256×256 cubemaps, so [method sky_set_radiance_size] must be set to [code]256[/code]. Otherwise, a warning is printed and the overridden radiance size is ignored. </constant> <constant name="ENV_BG_CLEAR_COLOR" value="0" enum="EnvironmentBG"> Use the clear color as background. @@ -4478,60 +4800,88 @@ Highest quality screen-space indirect lighting. Uses the adaptive target setting which can be dynamically adjusted to smoothly balance performance and visual quality. </constant> <constant name="ENV_SDFGI_Y_SCALE_50_PERCENT" value="0" enum="EnvironmentSDFGIYScale"> + Use 50% scale for SDFGI on the Y (vertical) axis. SDFGI cells will be twice as short as they are wide. This allows providing increased GI detail and reduced light leaking with thin floors and ceilings. This is usually the best choice for scenes that don't feature much verticality. </constant> <constant name="ENV_SDFGI_Y_SCALE_75_PERCENT" value="1" enum="EnvironmentSDFGIYScale"> + Use 75% scale for SDFGI on the Y (vertical) axis. This is a balance between the 50% and 100% SDFGI Y scales. </constant> <constant name="ENV_SDFGI_Y_SCALE_100_PERCENT" value="2" enum="EnvironmentSDFGIYScale"> + Use 100% scale for SDFGI on the Y (vertical) axis. SDFGI cells will be as tall as they are wide. This is usually the best choice for highly vertical scenes. The downside is that light leaking may become more noticeable with thin floors and ceilings. </constant> <constant name="ENV_SDFGI_RAY_COUNT_4" value="0" enum="EnvironmentSDFGIRayCount"> + Throw 4 rays per frame when converging SDFGI. This has the lowest GPU requirements, but creates the most noisy result. </constant> <constant name="ENV_SDFGI_RAY_COUNT_8" value="1" enum="EnvironmentSDFGIRayCount"> + Throw 8 rays per frame when converging SDFGI. </constant> <constant name="ENV_SDFGI_RAY_COUNT_16" value="2" enum="EnvironmentSDFGIRayCount"> + Throw 16 rays per frame when converging SDFGI. </constant> <constant name="ENV_SDFGI_RAY_COUNT_32" value="3" enum="EnvironmentSDFGIRayCount"> + Throw 32 rays per frame when converging SDFGI. </constant> <constant name="ENV_SDFGI_RAY_COUNT_64" value="4" enum="EnvironmentSDFGIRayCount"> + Throw 64 rays per frame when converging SDFGI. </constant> <constant name="ENV_SDFGI_RAY_COUNT_96" value="5" enum="EnvironmentSDFGIRayCount"> + Throw 96 rays per frame when converging SDFGI. This has high GPU requirements. </constant> <constant name="ENV_SDFGI_RAY_COUNT_128" value="6" enum="EnvironmentSDFGIRayCount"> + Throw 128 rays per frame when converging SDFGI. This has very high GPU requirements, but creates the least noisy result. </constant> <constant name="ENV_SDFGI_RAY_COUNT_MAX" value="7" enum="EnvironmentSDFGIRayCount"> + Represents the size of the [enum EnvironmentSDFGIRayCount] enum. </constant> <constant name="ENV_SDFGI_CONVERGE_IN_5_FRAMES" value="0" enum="EnvironmentSDFGIFramesToConverge"> + Converge SDFGI over 5 frames. This is the most responsive, but creates the most noisy result with a given ray count. </constant> <constant name="ENV_SDFGI_CONVERGE_IN_10_FRAMES" value="1" enum="EnvironmentSDFGIFramesToConverge"> + Configure SDFGI to fully converge over 10 frames. </constant> <constant name="ENV_SDFGI_CONVERGE_IN_15_FRAMES" value="2" enum="EnvironmentSDFGIFramesToConverge"> + Configure SDFGI to fully converge over 15 frames. </constant> <constant name="ENV_SDFGI_CONVERGE_IN_20_FRAMES" value="3" enum="EnvironmentSDFGIFramesToConverge"> + Configure SDFGI to fully converge over 20 frames. </constant> <constant name="ENV_SDFGI_CONVERGE_IN_25_FRAMES" value="4" enum="EnvironmentSDFGIFramesToConverge"> + Configure SDFGI to fully converge over 25 frames. </constant> <constant name="ENV_SDFGI_CONVERGE_IN_30_FRAMES" value="5" enum="EnvironmentSDFGIFramesToConverge"> + Configure SDFGI to fully converge over 30 frames. This is the least responsive, but creates the least noisy result with a given ray count. </constant> <constant name="ENV_SDFGI_CONVERGE_MAX" value="6" enum="EnvironmentSDFGIFramesToConverge"> + Represents the size of the [enum EnvironmentSDFGIFramesToConverge] enum. </constant> <constant name="ENV_SDFGI_UPDATE_LIGHT_IN_1_FRAME" value="0" enum="EnvironmentSDFGIFramesToUpdateLight"> + Update indirect light from dynamic lights in SDFGI over 1 frame. This is the most responsive, but has the highest GPU requirements. </constant> <constant name="ENV_SDFGI_UPDATE_LIGHT_IN_2_FRAMES" value="1" enum="EnvironmentSDFGIFramesToUpdateLight"> + Update indirect light from dynamic lights in SDFGI over 2 frames. </constant> <constant name="ENV_SDFGI_UPDATE_LIGHT_IN_4_FRAMES" value="2" enum="EnvironmentSDFGIFramesToUpdateLight"> + Update indirect light from dynamic lights in SDFGI over 4 frames. </constant> <constant name="ENV_SDFGI_UPDATE_LIGHT_IN_8_FRAMES" value="3" enum="EnvironmentSDFGIFramesToUpdateLight"> + Update indirect light from dynamic lights in SDFGI over 8 frames. </constant> <constant name="ENV_SDFGI_UPDATE_LIGHT_IN_16_FRAMES" value="4" enum="EnvironmentSDFGIFramesToUpdateLight"> + Update indirect light from dynamic lights in SDFGI over 16 frames. This is the least responsive, but has the lowest GPU requirements. </constant> <constant name="ENV_SDFGI_UPDATE_LIGHT_MAX" value="5" enum="EnvironmentSDFGIFramesToUpdateLight"> + Represents the size of the [enum EnvironmentSDFGIFramesToUpdateLight] enum. </constant> <constant name="SUB_SURFACE_SCATTERING_QUALITY_DISABLED" value="0" enum="SubSurfaceScatteringQuality"> + Disables subsurface scattering entirely, even on materials that have [member BaseMaterial3D.subsurf_scatter_enabled] set to [code]true[/code]. This has the lowest GPU requirements. </constant> <constant name="SUB_SURFACE_SCATTERING_QUALITY_LOW" value="1" enum="SubSurfaceScatteringQuality"> + Low subsurface scattering quality. </constant> <constant name="SUB_SURFACE_SCATTERING_QUALITY_MEDIUM" value="2" enum="SubSurfaceScatteringQuality"> + Medium subsurface scattering quality. </constant> <constant name="SUB_SURFACE_SCATTERING_QUALITY_HIGH" value="3" enum="SubSurfaceScatteringQuality"> + High subsurface scattering quality. This has the highest GPU requirements. </constant> <constant name="DOF_BOKEH_BOX" value="0" enum="DOFBokehShape"> Calculate the DOF blur using a box filter. The fastest option, but results in obvious lines in blur pattern. @@ -4567,6 +4917,7 @@ The instance is a particle emitter. </constant> <constant name="INSTANCE_PARTICLES_COLLISION" value="4" enum="InstanceType"> + The instance is a GPUParticles collision shape. </constant> <constant name="INSTANCE_LIGHT" value="5" enum="InstanceType"> The instance is a light. @@ -4584,10 +4935,13 @@ The instance is a lightmap. </constant> <constant name="INSTANCE_OCCLUDER" value="10" enum="InstanceType"> + The instance is an occlusion culling occluder. </constant> <constant name="INSTANCE_VISIBLITY_NOTIFIER" value="11" enum="InstanceType"> + The instance is a visible on-screen notifier. </constant> <constant name="INSTANCE_FOG_VOLUME" value="12" enum="InstanceType"> + The instance is a fog volume. </constant> <constant name="INSTANCE_MAX" value="13" enum="InstanceType"> Represents the size of the [enum InstanceType] enum. @@ -4605,6 +4959,7 @@ When set, manually requests to draw geometry on next frame. </constant> <constant name="INSTANCE_FLAG_IGNORE_OCCLUSION_CULLING" value="3" enum="InstanceFlags"> + Always draw, even if the instance would be culled by occlusion culling. Does not affect view frustum culling. </constant> <constant name="INSTANCE_FLAG_MAX" value="4" enum="InstanceFlags"> Represents the size of the [enum InstanceFlags] enum. @@ -4643,10 +4998,13 @@ Index of [Image] in array of [Image]s returned by [method bake_render_uv2]. Image uses [constant Image.FORMAT_RGBAH] and contains emission color in the [code].rgb[/code] channels and nothing in the [code].a[/code] channel. </constant> <constant name="CANVAS_TEXTURE_CHANNEL_DIFFUSE" value="0" enum="CanvasTextureChannel"> + Diffuse canvas texture ([member CanvasTexture.diffuse_texture]). </constant> <constant name="CANVAS_TEXTURE_CHANNEL_NORMAL" value="1" enum="CanvasTextureChannel"> + Normal map canvas texture ([member CanvasTexture.normal_texture]). </constant> <constant name="CANVAS_TEXTURE_CHANNEL_SPECULAR" value="2" enum="CanvasTextureChannel"> + Specular map canvas texture ([member CanvasTexture.specular_texture]). </constant> <constant name="NINE_PATCH_STRETCH" value="0" enum="NinePatchAxisMode"> The nine patch gets stretched where needed. @@ -4697,16 +5055,21 @@ Max value for [enum CanvasItemTextureRepeat] enum. </constant> <constant name="CANVAS_GROUP_MODE_DISABLED" value="0" enum="CanvasGroupMode"> + Child draws over parent and is not clipped. </constant> <constant name="CANVAS_GROUP_MODE_CLIP_ONLY" value="1" enum="CanvasGroupMode"> + Parent is used for the purposes of clipping only. Child is clipped to the parent's visible area, parent is not drawn. </constant> <constant name="CANVAS_GROUP_MODE_CLIP_AND_DRAW" value="2" enum="CanvasGroupMode"> + Parent is used for clipping child, but parent is also drawn underneath child as normal before clipping child to its visible area. </constant> <constant name="CANVAS_GROUP_MODE_TRANSPARENT" value="3" enum="CanvasGroupMode"> </constant> <constant name="CANVAS_LIGHT_MODE_POINT" value="0" enum="CanvasLightMode"> + 2D point light (see [PointLight2D]). </constant> <constant name="CANVAS_LIGHT_MODE_DIRECTIONAL" value="1" enum="CanvasLightMode"> + 2D directional (sun/moon) light (see [DirectionalLight2D]). </constant> <constant name="CANVAS_LIGHT_BLEND_MODE_ADD" value="0" enum="CanvasLightBlendMode"> Adds light color additive to the canvas. @@ -4739,74 +5102,109 @@ Culling of the canvas occluder is counterclockwise. </constant> <constant name="GLOBAL_VAR_TYPE_BOOL" value="0" enum="GlobalShaderParameterType"> + Boolean global shader parameter ([code]global uniform bool ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_BVEC2" value="1" enum="GlobalShaderParameterType"> + 2-dimensional boolean vector global shader parameter ([code]global uniform bvec2 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_BVEC3" value="2" enum="GlobalShaderParameterType"> + 3-dimensional boolean vector global shader parameter ([code]global uniform bvec3 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_BVEC4" value="3" enum="GlobalShaderParameterType"> + 4-dimensional boolean vector global shader parameter ([code]global uniform bvec4 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_INT" value="4" enum="GlobalShaderParameterType"> + Integer global shader parameter ([code]global uniform int ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_IVEC2" value="5" enum="GlobalShaderParameterType"> + 2-dimensional integer vector global shader parameter ([code]global uniform ivec2 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_IVEC3" value="6" enum="GlobalShaderParameterType"> + 3-dimensional integer vector global shader parameter ([code]global uniform ivec3 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_IVEC4" value="7" enum="GlobalShaderParameterType"> + 4-dimensional integer vector global shader parameter ([code]global uniform ivec4 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_RECT2I" value="8" enum="GlobalShaderParameterType"> + 2-dimensional integer rectangle global shader parameter ([code]global uniform ivec4 ...[/code]). Equivalent to [constant GLOBAL_VAR_TYPE_IVEC4] in shader code, but exposed as a [Rect2i] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_UINT" value="9" enum="GlobalShaderParameterType"> + Unsigned integer global shader parameter ([code]global uniform uint ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_UVEC2" value="10" enum="GlobalShaderParameterType"> + 2-dimensional unsigned integer vector global shader parameter ([code]global uniform uvec2 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_UVEC3" value="11" enum="GlobalShaderParameterType"> + 3-dimensional unsigned integer vector global shader parameter ([code]global uniform uvec3 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_UVEC4" value="12" enum="GlobalShaderParameterType"> + 4-dimensional unsigned integer vector global shader parameter ([code]global uniform uvec4 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_FLOAT" value="13" enum="GlobalShaderParameterType"> + Single-precision floating-point global shader parameter ([code]global uniform float ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_VEC2" value="14" enum="GlobalShaderParameterType"> + 2-dimensional floating-point vector global shader parameter ([code]global uniform vec2 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_VEC3" value="15" enum="GlobalShaderParameterType"> + 3-dimensional floating-point vector global shader parameter ([code]global uniform vec3 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_VEC4" value="16" enum="GlobalShaderParameterType"> + 4-dimensional floating-point vector global shader parameter ([code]global uniform vec4 ...[/code]). </constant> <constant name="GLOBAL_VAR_TYPE_COLOR" value="17" enum="GlobalShaderParameterType"> + Color global shader parameter ([code]global uniform vec4 ...[/code]). Equivalent to [constant GLOBAL_VAR_TYPE_VEC4] in shader code, but exposed as a [Color] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_RECT2" value="18" enum="GlobalShaderParameterType"> + 2-dimensional floating-point rectangle global shader parameter ([code]global uniform vec4 ...[/code]). Equivalent to [constant GLOBAL_VAR_TYPE_VEC4] in shader code, but exposed as a [Rect2] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_MAT2" value="19" enum="GlobalShaderParameterType"> + 2×2 matrix global shader parameter ([code]global uniform mat2 ...[/code]). Exposed as a [PackedInt32Array] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_MAT3" value="20" enum="GlobalShaderParameterType"> + 3×3 matrix global shader parameter ([code]global uniform mat3 ...[/code]). Exposed as a [Basis] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_MAT4" value="21" enum="GlobalShaderParameterType"> + 4×4 matrix global shader parameter ([code]global uniform mat4 ...[/code]). Exposed as a [Projection] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_TRANSFORM_2D" value="22" enum="GlobalShaderParameterType"> + 2-dimensional transform global shader parameter ([code]global uniform mat2x3 ...[/code]). Exposed as a [Transform2D] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_TRANSFORM" value="23" enum="GlobalShaderParameterType"> + 3-dimensional transform global shader parameter ([code]global uniform mat3x4 ...[/code]). Exposed as a [Transform3D] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_SAMPLER2D" value="24" enum="GlobalShaderParameterType"> + 2D sampler global shader parameter ([code]global uniform sampler2D ...[/code]). Exposed as a [Texture2D] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_SAMPLER2DARRAY" value="25" enum="GlobalShaderParameterType"> + 2D sampler array global shader parameter ([code]global uniform sampler2DArray ...[/code]). Exposed as a [Texture2DArray] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_SAMPLER3D" value="26" enum="GlobalShaderParameterType"> + 3D sampler global shader parameter ([code]global uniform sampler3D ...[/code]). Exposed as a [Texture3D] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_SAMPLERCUBE" value="27" enum="GlobalShaderParameterType"> + Cubemap sampler global shader parameter ([code]global uniform samplerCube ...[/code]). Exposed as a [Cubemap] in the editor UI. </constant> <constant name="GLOBAL_VAR_TYPE_MAX" value="28" enum="GlobalShaderParameterType"> + Represents the size of the [enum GlobalShaderParameterType] enum. </constant> <constant name="RENDERING_INFO_TOTAL_OBJECTS_IN_FRAME" value="0" enum="RenderingInfo"> + Number of objects rendered in the current 3D scene. This varies depending on camera position and rotation. </constant> <constant name="RENDERING_INFO_TOTAL_PRIMITIVES_IN_FRAME" value="1" enum="RenderingInfo"> + Number of vertices/indices rendered in the current 3D scene. This varies depending on camera position and rotation. </constant> <constant name="RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME" value="2" enum="RenderingInfo"> + Number of draw calls performed to render in the current 3D scene. This varies depending on camera position and rotation. </constant> <constant name="RENDERING_INFO_TEXTURE_MEM_USED" value="3" enum="RenderingInfo"> + Texture memory used (in bytes). </constant> <constant name="RENDERING_INFO_BUFFER_MEM_USED" value="4" enum="RenderingInfo"> + Buffer memory used (in bytes). </constant> <constant name="RENDERING_INFO_VIDEO_MEM_USED" value="5" enum="RenderingInfo"> + Video memory used (in bytes). This is always greater than the sum of [constant RENDERING_INFO_TEXTURE_MEM_USED] and [constant RENDERING_INFO_BUFFER_MEM_USED], since there is miscellaneous data not accounted for by those two metrics. </constant> <constant name="FEATURE_SHADERS" value="0" enum="Features"> Hardware supports shaders. This enum is currently unused in Godot 3.x. diff --git a/doc/classes/RibbonTrailMesh.xml b/doc/classes/RibbonTrailMesh.xml index db5c8d097c..c049570310 100644 --- a/doc/classes/RibbonTrailMesh.xml +++ b/doc/classes/RibbonTrailMesh.xml @@ -1,29 +1,42 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RibbonTrailMesh" inherits="PrimitiveMesh" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Represents a straight ribbon-shaped [PrimitiveMesh] with variable width. </brief_description> <description> + [RibbonTrailMesh] represents a straight ribbon-shaped mesh with variable width. The ribbon is composed of a number of flat or cross-shaped sections, each with the same [member section_length] and number of [member section_segments]. A [member curve] is sampled along the total length of the ribbon, meaning that the curve determines the size of the ribbon along its length. + This primitive mesh is usually used for particle trails. </description> <tutorials> + <link title="3D Particle trails">$DOCS_URL/tutorials/3d/particles/trails.html</link> + <link title="Particle systems (3D)">$DOCS_URL/tutorials/3d/particles/index.html</link> </tutorials> <members> <member name="curve" type="Curve" setter="set_curve" getter="get_curve"> + Determines the size of the ribbon along its length. The size of a particular section segment is obtained by multiplying the baseline [member size] by the value of this curve at the given distance. For values smaller than [code]0[/code], the faces will be inverted. </member> <member name="section_length" type="float" setter="set_section_length" getter="get_section_length" default="0.2"> + The length of a section of the ribbon. </member> <member name="section_segments" type="int" setter="set_section_segments" getter="get_section_segments" default="3"> + The number of segments in a section. The [member curve] is sampled on each segment to determine its size. Higher values result in a more detailed ribbon at the cost of performance. </member> <member name="sections" type="int" setter="set_sections" getter="get_sections" default="5"> + The total number of sections on the ribbon. </member> <member name="shape" type="int" setter="set_shape" getter="get_shape" enum="RibbonTrailMesh.Shape" default="1"> + Determines the shape of the ribbon. </member> <member name="size" type="float" setter="set_size" getter="get_size" default="1.0"> + The baseline size of the ribbon. The size of a particular section segment is obtained by multiplying this size by the value of the [member curve] at the given distance. </member> </members> <constants> <constant name="SHAPE_FLAT" value="0" enum="Shape"> + Gives the mesh a single flat face. </constant> <constant name="SHAPE_CROSS" value="1" enum="Shape"> + Gives the mesh two perpendicular flat faces, making a cross shape. </constant> </constants> </class> diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index 7f840ee49e..a93fdfd296 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -357,7 +357,7 @@ <method name="push_italics"> <return type="void" /> <description> - Adds a [code][font][/code] tag with a italics font to the tag stack. This is the same as adding a [code][i][/code] tag if not currently in a [code][b][/code] tag. + Adds a [code][font][/code] tag with an italics font to the tag stack. This is the same as adding an [code][i][/code] tag if not currently in a [code][b][/code] tag. </description> </method> <method name="push_list"> diff --git a/doc/classes/ShaderGlobalsOverride.xml b/doc/classes/ShaderGlobalsOverride.xml index 0a13e9485a..bfa3b9fbcd 100644 --- a/doc/classes/ShaderGlobalsOverride.xml +++ b/doc/classes/ShaderGlobalsOverride.xml @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ShaderGlobalsOverride" inherits="Node" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Overrides global shader parameters' values in a specific scene. </brief_description> <description> + Similar to how a [WorldEnvironment] node can be used to override the environment while a specific scene is loaded, [ShaderGlobalsOverride] can be used to override global shader parameters temporarily. Once the node is removed, the project-wide values for the global shader parameters are restored. See the [RenderingServer] [code]global_shader_parameter_*[/code] methods for more information. + [b]Note:[/b] Only one [ShaderGlobalsOverride] can be used per scene. If there is more than one [ShaderGlobalsOverride] node in the scene tree, only the first node (in tree order) will be taken into account. + [b]Note:[/b] All [ShaderGlobalsOverride] nodes are made part of a [code]"shader_overrides_group"[/code] group when they are added to the scene tree. The currently active [ShaderGlobalsOverride] node also has a [code]"shader_overrides_group_active"[/code] group added to it. You can use this to check which [ShaderGlobalsOverride] node is currently active. </description> <tutorials> </tutorials> diff --git a/doc/classes/Skeleton2D.xml b/doc/classes/Skeleton2D.xml index e986eb7a9c..e4b157c7ca 100644 --- a/doc/classes/Skeleton2D.xml +++ b/doc/classes/Skeleton2D.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Skeleton2D" inherits="Node2D" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Skeleton for 2D characters and animated objects. + The parent of a hierarchy of [Bone2D]s, used to create a 2D skeletal animation. </brief_description> <description> - Skeleton2D parents a hierarchy of [Bone2D] objects. It is a requirement of [Bone2D]. Skeleton2D holds a reference to the rest pose of its children and acts as a single point of access to its bones. - To setup different types of inverse kinematics for the given Skeleton2D, a [SkeletonModificationStack2D] should be created. They can be applied by creating the desired number of modifications, which can be done by increasing [member SkeletonModificationStack2D.modification_count]. + [Skeleton2D] parents a hierarchy of [Bone2D] nodes. It holds a reference to each [Bone2D]'s rest pose and acts as a single point of access to its bones. + To set up different types of inverse kinematics for the given Skeleton2D, a [SkeletonModificationStack2D] should be created. The inverse kinematics be applied by increasing [member SkeletonModificationStack2D.modification_count] and creating the desired number of modifications. </description> <tutorials> <link title="2D skeletons">$DOCS_URL/tutorials/animation/2d_skeletons.html</link> diff --git a/doc/classes/Skeleton3D.xml b/doc/classes/Skeleton3D.xml index d8875dfa0e..8f40c63104 100644 --- a/doc/classes/Skeleton3D.xml +++ b/doc/classes/Skeleton3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Skeleton3D" inherits="Node3D" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Skeleton for characters and animated objects. + A node containing a bone hierarchy, used to create a 3D skeletal animation. </brief_description> <description> - Skeleton3D provides a hierarchical interface for managing bones, including pose, rest and animation (see [Animation]). It can also use ragdoll physics. + [Skeleton3D] provides an interface for managing a hierarchy of bones, including pose, rest and animation (see [Animation]). It can also use ragdoll physics. The overall transform of a bone with respect to the skeleton is determined by the following hierarchical order: rest pose, custom pose and pose. Note that "global pose" below refers to the overall transform of the bone with respect to skeleton, so it not the actual global/world transform of the bone. To setup different types of inverse kinematics, consider using [SkeletonIK3D], or add a custom IK implementation in [method Node._process] as a child node. diff --git a/doc/classes/SkeletonIK3D.xml b/doc/classes/SkeletonIK3D.xml index 0fb8a0d44a..6de86c3b10 100644 --- a/doc/classes/SkeletonIK3D.xml +++ b/doc/classes/SkeletonIK3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SkeletonIK3D" inherits="Node" is_deprecated="true" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - SkeletonIK3D is used to place the end bone of a [Skeleton3D] bone chain at a certain point in 3D by rotating all bones in the chain accordingly. + A node used to rotate all bones of a [Skeleton3D] bone chain a way that places the end bone at a desired 3D position. </brief_description> <description> - SkeletonIK3D is used to place the end bone of a [Skeleton3D] bone chain at a certain point in 3D by rotating all bones in the chain accordingly. A typical scenario for IK in games is to place a characters feet on the ground or a characters hands on a currently hold object. SkeletonIK uses FabrikInverseKinematic internally to solve the bone chain and applies the results to the [Skeleton3D] [code]bones_global_pose_override[/code] property for all affected bones in the chain. If fully applied this overwrites any bone transform from [Animation]s or bone custom poses set by users. The applied amount can be controlled with the [member interpolation] property. + SkeletonIK3D is used to rotate all bones of a [Skeleton3D] bone chain a way that places the end bone at a desired 3D position. A typical scenario for IK in games is to place a character's feet on the ground or a character's hands on a currently held object. SkeletonIK uses FabrikInverseKinematic internally to solve the bone chain and applies the results to the [Skeleton3D] [code]bones_global_pose_override[/code] property for all affected bones in the chain. If fully applied, this overwrites any bone transform from [Animation]s or bone custom poses set by users. The applied amount can be controlled with the [member interpolation] property. [codeblock] # Apply IK effect automatically on every new frame (not the current) skeleton_ik_node.start() diff --git a/doc/classes/SkeletonModification2D.xml b/doc/classes/SkeletonModification2D.xml index 88062eb4da..f5fa3f8bb9 100644 --- a/doc/classes/SkeletonModification2D.xml +++ b/doc/classes/SkeletonModification2D.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SkeletonModification2D" inherits="Resource" is_experimental="true" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - A resource that operates on [Bone2D] nodes in a [Skeleton2D]. + Base class for resources that operate on [Bone2D]s in a [Skeleton2D]. </brief_description> <description> This resource provides an interface that can be expanded so code that operates on [Bone2D] nodes in a [Skeleton2D] can be mixed and matched together to create complex interactions. @@ -38,7 +38,7 @@ <param index="2" name="max" type="float" /> <param index="3" name="invert" type="bool" /> <description> - Takes a angle and clamps it so it is within the passed-in [param min] and [param max] range. [param invert] will inversely clamp the angle, clamping it to the range outside of the given bounds. + Takes an angle and clamps it so it is within the passed-in [param min] and [param max] range. [param invert] will inversely clamp the angle, clamping it to the range outside of the given bounds. </description> </method> <method name="get_editor_draw_gizmo" qualifiers="const"> diff --git a/doc/classes/SkeletonModification2DTwoBoneIK.xml b/doc/classes/SkeletonModification2DTwoBoneIK.xml index 9a8b9bd8f5..254a8df046 100644 --- a/doc/classes/SkeletonModification2DTwoBoneIK.xml +++ b/doc/classes/SkeletonModification2DTwoBoneIK.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SkeletonModification2DTwoBoneIK" inherits="SkeletonModification2D" is_experimental="true" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - A modification that rotates two bones using the law of cosigns to reach the target. + A modification that rotates two bones using the law of cosines to reach the target. </brief_description> <description> - This [SkeletonModification2D] uses an algorithm typically called TwoBoneIK. This algorithm works by leveraging the law of cosigns and the lengths of the bones to figure out what rotation the bones currently have, and what rotation they need to make a complete triangle, where the first bone, the second bone, and the target form the three vertices of the triangle. Because the algorithm works by making a triangle, it can only operate on two bones. + This [SkeletonModification2D] uses an algorithm typically called TwoBoneIK. This algorithm works by leveraging the law of cosines and the lengths of the bones to figure out what rotation the bones currently have, and what rotation they need to make a complete triangle, where the first bone, the second bone, and the target form the three vertices of the triangle. Because the algorithm works by making a triangle, it can only operate on two bones. TwoBoneIK is great for arms, legs, and really any joints that can be represented by just two bones that bend to reach a target. This solver is more lightweight than [SkeletonModification2DFABRIK], but gives similar, natural looking results. </description> <tutorials> diff --git a/doc/classes/SkeletonProfile.xml b/doc/classes/SkeletonProfile.xml index d6a38e9ee6..1796dabcfd 100644 --- a/doc/classes/SkeletonProfile.xml +++ b/doc/classes/SkeletonProfile.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SkeletonProfile" inherits="Resource" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Profile of a virtual skeleton used as a target for retargeting. + Base class for a profile of a virtual skeleton used as a target for retargeting. </brief_description> <description> This resource is used in [EditorScenePostImport]. Some parameters are referring to bones in [Skeleton3D], [Skin], [Animation], and some other nodes are rewritten based on the parameters of [SkeletonProfile]. diff --git a/doc/classes/Sky.xml b/doc/classes/Sky.xml index e9f4acd168..4adf4737a1 100644 --- a/doc/classes/Sky.xml +++ b/doc/classes/Sky.xml @@ -57,7 +57,7 @@ </constant> <constant name="PROCESS_MODE_REALTIME" value="3" enum="ProcessMode"> Uses the fast filtering algorithm to process the radiance map. In general this results in lower quality, but substantially faster run times. If you need better quality, but still need to update the sky every frame, consider turning on [member ProjectSettings.rendering/reflections/sky_reflections/fast_filter_high_quality]. - [b]Note:[/b] The fast filtering algorithm is limited to 256x256 cubemaps, so [member radiance_size] must be set to [constant RADIANCE_SIZE_256]. + [b]Note:[/b] The fast filtering algorithm is limited to 256×256 cubemaps, so [member radiance_size] must be set to [constant RADIANCE_SIZE_256]. Otherwise, a warning is printed and the overridden radiance size is ignored. </constant> </constants> </class> diff --git a/doc/classes/StreamPeerTLS.xml b/doc/classes/StreamPeerTLS.xml index aa132f5e86..8cf0b646a5 100644 --- a/doc/classes/StreamPeerTLS.xml +++ b/doc/classes/StreamPeerTLS.xml @@ -4,7 +4,7 @@ TLS stream peer. </brief_description> <description> - TLS stream peer. This object can be used to connect to an TLS server or accept a single TLS client connection. + TLS stream peer. This object can be used to connect to a TLS server or accept a single TLS client connection. [b]Note:[/b] When exporting to Android, make sure to enable the [code]INTERNET[/code] permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android. </description> <tutorials> diff --git a/doc/classes/String.xml b/doc/classes/String.xml index fd50b308c3..d771566688 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -175,6 +175,14 @@ Returns [code]true[/code] if the string ends with the given [param text]. See also [method begins_with]. </description> </method> + <method name="erase" qualifiers="const"> + <return type="String" /> + <param index="0" name="position" type="int" /> + <param index="1" name="chars" type="int" default="1" /> + <description> + Returns a string with [param chars] characters erased starting from [param position]. If [param chars] goes beyond the string's length given the specified [param position], fewer characters will be erased from the returned string. Returns an empty string if either [code]position[/code] or [code]chars[/code] is negative. Returns the original string unmodified if [param chars] is [code]0[/code]. + </description> + </method> <method name="find" qualifiers="const"> <return type="int" /> <param index="0" name="what" type="String" /> diff --git a/doc/classes/StringName.xml b/doc/classes/StringName.xml index 5b630a092e..a74b78f7e3 100644 --- a/doc/classes/StringName.xml +++ b/doc/classes/StringName.xml @@ -158,6 +158,14 @@ Returns [code]true[/code] if the string ends with the given [param text]. See also [method begins_with]. </description> </method> + <method name="erase" qualifiers="const"> + <return type="String" /> + <param index="0" name="position" type="int" /> + <param index="1" name="chars" type="int" default="1" /> + <description> + Returns a string with [param chars] characters erased starting from [param position]. If [param chars] goes beyond the string's length given the specified [param position], fewer characters will be erased from the returned string. Returns an empty string if either [code]position[/code] or [code]chars[/code] is negative. Returns the original string unmodified if [param chars] is [code]0[/code]. + </description> + </method> <method name="find" qualifiers="const"> <return type="int" /> <param index="0" name="what" type="String" /> diff --git a/doc/classes/SyntaxHighlighter.xml b/doc/classes/SyntaxHighlighter.xml index 79f4944bae..34063adbb0 100644 --- a/doc/classes/SyntaxHighlighter.xml +++ b/doc/classes/SyntaxHighlighter.xml @@ -5,7 +5,7 @@ </brief_description> <description> Base syntax highlighter resource all syntax highlighters extend from, provides syntax highlighting data to [TextEdit]. - The associated [TextEdit] node will call into the [SyntaxHighlighter] on a as needed basis. + The associated [TextEdit] node will call into the [SyntaxHighlighter] on an as-needed basis. [b]Note:[/b] Each Syntax highlighter instance should not be shared across multiple [TextEdit] nodes. </description> <tutorials> diff --git a/doc/classes/TextServerDummy.xml b/doc/classes/TextServerDummy.xml index 4770a641dc..4e72b3c5f8 100644 --- a/doc/classes/TextServerDummy.xml +++ b/doc/classes/TextServerDummy.xml @@ -1,8 +1,22 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="TextServerDummy" inherits="TextServerExtension" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + A dummy text server that can't render text or manage fonts. </brief_description> <description> + A dummy [TextServer] interface that doesn't do anything. Useful for freeing up memory when rendering text is not needed, as text servers are resource-intensive. It can also be used for performance comparisons in complex GUIs to check the impact of text rendering. + A dummy text server is always available at the start of a project. Here's how to access it: + [codeblock] + var dummy_text_server = TextServerManager.find_interface("Dummy") + if dummy_text_server != null: + TextServerManager.set_primary_interface(dummy_text_server) + # If the other text servers are unneeded, they can be removed: + for i in TextServerManager.get_interface_count(): + var text_server = TextServerManager.get_interface(i) + if text_server != dummy_text_server: + TextServerManager.remove_interface(text_server) + [/codeblock] + The command line argument [code]--text-driver Dummy[/code] (case-sensitive) can be used to force the "Dummy" [TextServer] on any project. </description> <tutorials> </tutorials> diff --git a/doc/classes/TileSet.xml b/doc/classes/TileSet.xml index be6b15fb0d..f80151b722 100644 --- a/doc/classes/TileSet.xml +++ b/doc/classes/TileSet.xml @@ -8,7 +8,7 @@ Tiles can either be from a [TileSetAtlasSource], that render tiles out of a texture with support for physics, navigation, etc... or from a [TileSetScenesCollectionSource] which exposes scene-based tiles. Tiles are referenced by using three IDs: their source ID, their atlas coordinates ID and their alternative tile ID. A TileSet can be configured so that its tiles expose more or less properties. To do so, the TileSet resources uses property layers, that you can add or remove depending on your needs. - For example, adding a physics layer allows giving collision shapes to your tiles. Each layer having dedicated properties (physics layer an mask), you may add several TileSet physics layers for each type of collision you need. + For example, adding a physics layer allows giving collision shapes to your tiles. Each layer having dedicated properties (physics layer and mask), you may add several TileSet physics layers for each type of collision you need. See the functions to add new layers for more information. </description> <tutorials> diff --git a/doc/classes/TileSetScenesCollectionSource.xml b/doc/classes/TileSetScenesCollectionSource.xml index 2bb4146798..e1a3b3e788 100644 --- a/doc/classes/TileSetScenesCollectionSource.xml +++ b/doc/classes/TileSetScenesCollectionSource.xml @@ -79,7 +79,7 @@ <param index="0" name="id" type="int" /> <param index="1" name="new_id" type="int" /> <description> - Changes a scene tile's ID from [param id] to [param new_id]. This will fail if there is already a tile with a ID equal to [param new_id]. + Changes a scene tile's ID from [param id] to [param new_id]. This will fail if there is already a tile with an ID equal to [param new_id]. </description> </method> <method name="set_scene_tile_scene"> diff --git a/doc/classes/TubeTrailMesh.xml b/doc/classes/TubeTrailMesh.xml index aa238af782..e6d446bd60 100644 --- a/doc/classes/TubeTrailMesh.xml +++ b/doc/classes/TubeTrailMesh.xml @@ -1,10 +1,15 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="TubeTrailMesh" inherits="PrimitiveMesh" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Represents a straight tube-shaped [PrimitiveMesh] with variable width. </brief_description> <description> + [TubeTrailMesh] represents a straight tube-shaped mesh with variable width. The tube is composed of a number of cylindrical sections, each with the same [member section_length] and number of [member section_rings]. A [member curve] is sampled along the total length of the tube, meaning that the curve determines the radius of the tube along its length. + This primitive mesh is usually used for particle trails. </description> <tutorials> + <link title="3D Particle trails">$DOCS_URL/tutorials/3d/particles/trails.html</link> + <link title="Particle systems (3D)">$DOCS_URL/tutorials/3d/particles/index.html</link> </tutorials> <members> <member name="cap_bottom" type="bool" setter="set_cap_bottom" getter="is_cap_bottom" default="true"> @@ -14,16 +19,22 @@ If [code]true[/code], generates a cap at the top of the tube. This can be set to [code]false[/code] to speed up generation and rendering when the cap is never seen by the camera. </member> <member name="curve" type="Curve" setter="set_curve" getter="get_curve"> + Determines the radius of the tube along its length. The radius of a particular section ring is obtained by multiplying the baseline [member radius] by the value of this curve at the given distance. For values smaller than [code]0[/code], the faces will be inverted. </member> <member name="radial_steps" type="int" setter="set_radial_steps" getter="get_radial_steps" default="8"> + The number of sides on the tube. For example, a value of [code]5[/code] means the tube will be pentagonal. Higher values result in a more detailed tube at the cost of performance. </member> <member name="radius" type="float" setter="set_radius" getter="get_radius" default="0.5"> + The baseline radius of the tube. The radius of a particular section ring is obtained by multiplying this radius by the value of the [member curve] at the given distance. </member> <member name="section_length" type="float" setter="set_section_length" getter="get_section_length" default="0.2"> + The length of a section of the tube. </member> <member name="section_rings" type="int" setter="set_section_rings" getter="get_section_rings" default="3"> + The number of rings in a section. The [member curve] is sampled on each ring to determine its radius. Higher values result in a more detailed tube at the cost of performance. </member> <member name="sections" type="int" setter="set_sections" getter="get_sections" default="5"> + The total number of sections on the tube. </member> </members> </class> diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 7c131202c8..81838f397f 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -284,6 +284,7 @@ [b]Note:[/b] This setting is disabled by default because of its potential expensive computational cost. </member> <member name="positional_shadow_atlas_16_bits" type="bool" setter="set_positional_shadow_atlas_16_bits" getter="get_positional_shadow_atlas_16_bits" default="true"> + Use 16 bits for the omni/spot shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices. </member> <member name="positional_shadow_atlas_quad_0" type="int" setter="set_positional_shadow_atlas_quadrant_subdiv" getter="get_positional_shadow_atlas_quadrant_subdiv" enum="Viewport.PositionalShadowAtlasQuadrantSubdiv" default="2"> The subdivision amount of the first quadrant on the shadow atlas. @@ -298,8 +299,8 @@ The subdivision amount of the fourth quadrant on the shadow atlas. </member> <member name="positional_shadow_atlas_size" type="int" setter="set_positional_shadow_atlas_size" getter="get_positional_shadow_atlas_size" default="2048"> - The shadow atlas' resolution (used for omni and spot lights). The value will be rounded up to the nearest power of 2. - [b]Note:[/b] If this is set to [code]0[/code], no shadows will be visible at all (including directional shadows). + The shadow atlas' resolution (used for omni and spot lights). The value is rounded up to the nearest power of 2. + [b]Note:[/b] If this is set to [code]0[/code], no positional shadows will be visible at all. This can improve performance significantly on low-end systems by reducing both the CPU and GPU load (as fewer draw calls are needed to draw the scene without shadows). </member> <member name="scaling_3d_mode" type="int" setter="set_scaling_3d_mode" getter="get_scaling_3d_mode" enum="Viewport.Scaling3DMode" default="0"> Sets scaling 3d mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible. diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index 4cc48bd70b..336d73290f 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -563,6 +563,7 @@ </member> <member name="position" type="Vector2i" setter="set_position" getter="get_position" default="Vector2i(0, 0)"> The window's position in pixels. + If [member ProjectSettings.display/window/subwindows/embed_subwindows] is [code]false[/code], the position is in absolute screen coordinates. This typically applies to editor plugins. If the setting is [code]false[/code], the window's position is in the coordinates of its parent [Viewport]. </member> <member name="size" type="Vector2i" setter="set_size" getter="get_size" default="Vector2i(100, 100)"> The window's size in pixels. @@ -710,7 +711,7 @@ Regardless of the platform, enabling full screen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling full screen mode. </constant> <constant name="FLAG_RESIZE_DISABLED" value="0" enum="Flags"> - The window can't be resizing by dragging its resize grip. It's still possible to resize the window using [member size]. This flag is ignored for full screen windows. Set with [member unresizable]. + The window can't be resized by dragging its resize grip. It's still possible to resize the window using [member size]. This flag is ignored for full screen windows. Set with [member unresizable]. </constant> <constant name="FLAG_BORDERLESS" value="1" enum="Flags"> The window do not have native title bar and other decorations. This flag is ignored for full-screen windows. Set with [member borderless]. diff --git a/doc/classes/X509Certificate.xml b/doc/classes/X509Certificate.xml index 6123d35d1f..a55e7d09b9 100644 --- a/doc/classes/X509Certificate.xml +++ b/doc/classes/X509Certificate.xml @@ -5,7 +5,7 @@ </brief_description> <description> The X509Certificate class represents an X509 certificate. Certificates can be loaded and saved like any other [Resource]. - They can be used as the server certificate in [method StreamPeerTLS.accept_stream] (along with the proper [CryptoKey]), and to specify the only certificate that should be accepted when connecting to an TLS server via [method StreamPeerTLS.connect_to_stream]. + They can be used as the server certificate in [method StreamPeerTLS.accept_stream] (along with the proper [CryptoKey]), and to specify the only certificate that should be accepted when connecting to a TLS server via [method StreamPeerTLS.connect_to_stream]. </description> <tutorials> </tutorials> diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index ac5d0faccf..37976bb9a0 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -771,7 +771,7 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, bool is_di alpha = min(alpha, clamp(1.0 - attenuation, 0.0, 1.0)); #endif -#endif // LIGHT_CODE_USED +#endif // USE_LIGHT_SHADER_CODE } float get_omni_spot_attenuation(float distance, float inv_range, float decay) { diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index 60a8a41abe..c7b2a715be 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -1651,7 +1651,7 @@ MaterialStorage::MaterialStorage() { actions.renames["CAMERA_POSITION_WORLD"] = "scene_data.inv_view_matrix[3].xyz"; actions.renames["CAMERA_DIRECTION_WORLD"] = "scene_data.view_matrix[3].xyz"; actions.renames["CAMERA_VISIBLE_LAYERS"] = "scene_data.camera_visible_layers"; - actions.renames["NODE_POSITION_VIEW"] = "(model_matrix * scene_data.view_matrix)[3].xyz"; + actions.renames["NODE_POSITION_VIEW"] = "(scene_data.view_matrix * model_matrix)[3].xyz"; actions.renames["VIEW_INDEX"] = "ViewIndex"; actions.renames["VIEW_MONO_LEFT"] = "uint(0)"; @@ -1660,6 +1660,7 @@ MaterialStorage::MaterialStorage() { //for light actions.renames["VIEW"] = "view"; + actions.renames["SPECULAR_AMOUNT"] = "specular_amount"; actions.renames["LIGHT_COLOR"] = "light_color"; actions.renames["LIGHT_IS_DIRECTIONAL"] = "is_directional"; actions.renames["LIGHT"] = "light"; diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 2fd46d65ff..ac2bfdcb99 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -2462,10 +2462,10 @@ Error RenderingDeviceVulkan::_texture_update(RID p_texture, uint32_t p_layer, co } ERR_FAIL_COND_V_MSG(texture->bound, ERR_CANT_ACQUIRE_RESOURCE, - "Texture can't be updated while a render pass that uses it is being created. Ensure render pass is finalized (and that it was created with RENDER_PASS_CONTENTS_FINISH) to unbind this texture."); + "Texture can't be updated while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to update this texture."); ERR_FAIL_COND_V_MSG(!(texture->usage_flags & TEXTURE_USAGE_CAN_UPDATE_BIT), ERR_INVALID_PARAMETER, - "Texture requires the TEXTURE_USAGE_CAN_UPDATE_BIT in order to be updatable."); + "Texture requires the `RenderingDevice.TEXTURE_USAGE_CAN_UPDATE_BIT` to be set to be updatable."); uint32_t layer_count = texture->layers; if (texture->type == TEXTURE_TYPE_CUBE || texture->type == TEXTURE_TYPE_CUBE_ARRAY) { @@ -2738,9 +2738,9 @@ Vector<uint8_t> RenderingDeviceVulkan::texture_get_data(RID p_texture, uint32_t ERR_FAIL_COND_V(!tex, Vector<uint8_t>()); ERR_FAIL_COND_V_MSG(tex->bound, Vector<uint8_t>(), - "Texture can't be retrieved while a render pass that uses it is being created. Ensure render pass is finalized (and that it was created with RENDER_PASS_CONTENTS_FINISH) to unbind this texture."); + "Texture can't be retrieved while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to retrieve this texture."); ERR_FAIL_COND_V_MSG(!(tex->usage_flags & TEXTURE_USAGE_CAN_COPY_FROM_BIT), Vector<uint8_t>(), - "Texture requires the TEXTURE_USAGE_CAN_COPY_FROM_BIT in order to be retrieved."); + "Texture requires the `RenderingDevice.TEXTURE_USAGE_CAN_COPY_FROM_BIT` to be set to be retrieved."); uint32_t layer_count = tex->layers; if (tex->type == TEXTURE_TYPE_CUBE || tex->type == TEXTURE_TYPE_CUBE_ARRAY) { @@ -2888,9 +2888,9 @@ Error RenderingDeviceVulkan::texture_copy(RID p_from_texture, RID p_to_texture, ERR_FAIL_COND_V(!src_tex, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V_MSG(src_tex->bound, ERR_INVALID_PARAMETER, - "Source texture can't be copied while a render pass that uses it is being created. Ensure render pass is finalized (and that it was created with RENDER_PASS_CONTENTS_FINISH) to unbind this texture."); + "Source texture can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to copy this texture."); ERR_FAIL_COND_V_MSG(!(src_tex->usage_flags & TEXTURE_USAGE_CAN_COPY_FROM_BIT), ERR_INVALID_PARAMETER, - "Source texture requires the TEXTURE_USAGE_CAN_COPY_FROM_BIT in order to be retrieved."); + "Source texture requires the `RenderingDevice.TEXTURE_USAGE_CAN_COPY_FROM_BIT` to be set to be retrieved."); uint32_t src_layer_count = src_tex->layers; uint32_t src_width, src_height, src_depth; @@ -2909,9 +2909,9 @@ Error RenderingDeviceVulkan::texture_copy(RID p_from_texture, RID p_to_texture, ERR_FAIL_COND_V(!dst_tex, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V_MSG(dst_tex->bound, ERR_INVALID_PARAMETER, - "Destination texture can't be copied while a render pass that uses it is being created. Ensure render pass is finalized (and that it was created with RENDER_PASS_CONTENTS_FINISH) to unbind this texture."); + "Destination texture can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to copy this texture."); ERR_FAIL_COND_V_MSG(!(dst_tex->usage_flags & TEXTURE_USAGE_CAN_COPY_TO_BIT), ERR_INVALID_PARAMETER, - "Destination texture requires the TEXTURE_USAGE_CAN_COPY_TO_BIT in order to be retrieved."); + "Destination texture requires the `RenderingDevice.TEXTURE_USAGE_CAN_COPY_TO_BIT` to be set to be retrieved."); uint32_t dst_layer_count = dst_tex->layers; uint32_t dst_width, dst_height, dst_depth; @@ -3083,9 +3083,9 @@ Error RenderingDeviceVulkan::texture_resolve_multisample(RID p_from_texture, RID ERR_FAIL_COND_V(!src_tex, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V_MSG(src_tex->bound, ERR_INVALID_PARAMETER, - "Source texture can't be copied while a render pass that uses it is being created. Ensure render pass is finalized (and that it was created with RENDER_PASS_CONTENTS_FINISH) to unbind this texture."); + "Source texture can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to copy this texture."); ERR_FAIL_COND_V_MSG(!(src_tex->usage_flags & TEXTURE_USAGE_CAN_COPY_FROM_BIT), ERR_INVALID_PARAMETER, - "Source texture requires the TEXTURE_USAGE_CAN_COPY_FROM_BIT in order to be retrieved."); + "Source texture requires the `RenderingDevice.TEXTURE_USAGE_CAN_COPY_FROM_BIT` to be set to be retrieved."); ERR_FAIL_COND_V_MSG(src_tex->type != TEXTURE_TYPE_2D, ERR_INVALID_PARAMETER, "Source texture must be 2D (or a slice of a 3D/Cube texture)"); ERR_FAIL_COND_V_MSG(src_tex->samples == TEXTURE_SAMPLES_1, ERR_INVALID_PARAMETER, "Source texture must be multisampled."); @@ -3094,9 +3094,9 @@ Error RenderingDeviceVulkan::texture_resolve_multisample(RID p_from_texture, RID ERR_FAIL_COND_V(!dst_tex, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V_MSG(dst_tex->bound, ERR_INVALID_PARAMETER, - "Destination texture can't be copied while a render pass that uses it is being created. Ensure render pass is finalized (and that it was created with RENDER_PASS_CONTENTS_FINISH) to unbind this texture."); + "Destination texture can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to copy this texture."); ERR_FAIL_COND_V_MSG(!(dst_tex->usage_flags & TEXTURE_USAGE_CAN_COPY_TO_BIT), ERR_INVALID_PARAMETER, - "Destination texture requires the TEXTURE_USAGE_CAN_COPY_TO_BIT in order to be retrieved."); + "Destination texture requires the `RenderingDevice.TEXTURE_USAGE_CAN_COPY_TO_BIT` to be set to be retrieved."); ERR_FAIL_COND_V_MSG(dst_tex->type != TEXTURE_TYPE_2D, ERR_INVALID_PARAMETER, "Destination texture must be 2D (or a slice of a 3D/Cube texture)."); ERR_FAIL_COND_V_MSG(dst_tex->samples != TEXTURE_SAMPLES_1, ERR_INVALID_PARAMETER, "Destination texture must not be multisampled."); @@ -3254,13 +3254,13 @@ Error RenderingDeviceVulkan::texture_clear(RID p_texture, const Color &p_color, ERR_FAIL_COND_V(!src_tex, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V_MSG(src_tex->bound, ERR_INVALID_PARAMETER, - "Source texture can't be cleared while a render pass that uses it is being created. Ensure render pass is finalized (and that it was created with RENDER_PASS_CONTENTS_FINISH) to unbind this texture."); + "Source texture can't be cleared while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to clear this texture."); ERR_FAIL_COND_V(p_layers == 0, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(p_mipmaps == 0, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V_MSG(!(src_tex->usage_flags & TEXTURE_USAGE_CAN_COPY_TO_BIT), ERR_INVALID_PARAMETER, - "Source texture requires the TEXTURE_USAGE_CAN_COPY_TO_BIT in order to be cleared."); + "Source texture requires the `RenderingDevice.TEXTURE_USAGE_CAN_COPY_TO_BIT` to be set to be cleared."); uint32_t src_layer_count = src_tex->layers; if (src_tex->type == TEXTURE_TYPE_CUBE || src_tex->type == TEXTURE_TYPE_CUBE_ARRAY) { diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index 7b88bd8a95..88eb89656a 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -59,6 +59,14 @@ struct DirAccessWindowsPrivate { WIN32_FIND_DATAW fu; //unicode version }; +String DirAccessWindows::fix_path(String p_path) const { + String r_path = DirAccess::fix_path(p_path); + if (r_path.is_absolute_path() && !r_path.is_network_share_path() && r_path.length() > MAX_PATH) { + r_path = "\\\\?\\" + r_path.replace("/", "\\"); + } + return r_path; +} + // CreateFolderAsync Error DirAccessWindows::list_dir_begin() { @@ -158,6 +166,7 @@ Error DirAccessWindows::make_dir(String p_dir) { p_dir = fix_path(p_dir); if (p_dir.is_relative_path()) { p_dir = current_dir.path_join(p_dir); + p_dir = fix_path(p_dir); } p_dir = p_dir.simplify_path().replace("/", "\\"); @@ -165,12 +174,6 @@ Error DirAccessWindows::make_dir(String p_dir) { bool success; int err; - if (!p_dir.is_network_share_path()) { - p_dir = "\\\\?\\" + p_dir; - // Add "\\?\" to the path to extend max. path length past 248, if it's not a network share UNC path. - // See https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx - } - success = CreateDirectoryW((LPCWSTR)(p_dir.utf16().get_data()), nullptr); err = GetLastError(); diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h index 9d91c22f7e..1e55917756 100644 --- a/drivers/windows/dir_access_windows.h +++ b/drivers/windows/dir_access_windows.h @@ -53,6 +53,9 @@ class DirAccessWindows : public DirAccess { bool _cisdir = false; bool _cishidden = false; +protected: + virtual String fix_path(String p_path) const override; + public: virtual Error list_dir_begin() override; ///< This starts dir listing virtual String get_next() override; diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index f36bbcc350..6e69743d4e 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -68,6 +68,14 @@ bool FileAccessWindows::is_path_invalid(const String &p_path) { return invalid_files.has(fname); } +String FileAccessWindows::fix_path(const String &p_path) const { + String r_path = FileAccess::fix_path(p_path); + if (r_path.is_absolute_path() && !r_path.is_network_share_path() && r_path.length() > MAX_PATH) { + r_path = "\\\\?\\" + r_path.replace("/", "\\"); + } + return r_path; +} + Error FileAccessWindows::open_internal(const String &p_path, int p_mode_flags) { if (is_path_invalid(p_path)) { #ifdef DEBUG_ENABLED diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h index 453f8d3b5f..13c881e562 100644 --- a/drivers/windows/file_access_windows.h +++ b/drivers/windows/file_access_windows.h @@ -54,6 +54,7 @@ class FileAccessWindows : public FileAccess { static HashSet<String> invalid_files; public: + virtual String fix_path(const String &p_path) const override; virtual Error open_internal(const String &p_path, int p_mode_flags) override; ///< open a file virtual bool is_open() const override; ///< true when file is open diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 61df3a977a..91ccede26d 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1144,11 +1144,7 @@ void CodeTextEditor::insert_final_newline() { void CodeTextEditor::convert_indent_to_spaces() { int indent_size = EDITOR_GET("text_editor/behavior/indent/size"); - String indent = ""; - - for (int i = 0; i < indent_size; i++) { - indent += " "; - } + String indent = String(" ").repeat(indent_size); Vector<int> cursor_columns; cursor_columns.resize(text_editor->get_caret_count()); diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index 996e16be33..7c9736413d 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -1372,10 +1372,7 @@ static void _write_string(Ref<FileAccess> f, int p_tablevel, const String &p_str if (p_string.is_empty()) { return; } - String tab; - for (int i = 0; i < p_tablevel; i++) { - tab += "\t"; - } + String tab = String("\t").repeat(p_tablevel); f->store_string(tab + p_string + "\n"); } diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 1f9d754185..753f54b807 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -622,7 +622,7 @@ void EditorData::remove_scene(int p_idx) { } if (!edited_scene[p_idx].path.is_empty()) { - ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(edited_scene[p_idx].path); + EditorNode::get_singleton()->emit_signal("scene_closed", edited_scene[p_idx].path); } undo_redo_manager->discard_history(edited_scene[p_idx].history_id); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 3681f61cd8..864d45230a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -762,7 +762,9 @@ void EditorNode::_notification(int p_what) { EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") || EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/help/help") || EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog/thumbnail_size") || - EditorSettings::get_singleton()->check_changed_settings_in_group("run/output/font_size"); + EditorSettings::get_singleton()->check_changed_settings_in_group("run/output/font_size") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/increase_scrollbar_touch_area") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/scale_gizmo_handles"); if (theme_changed) { theme = create_custom_theme(theme_base->get_theme()); @@ -6332,6 +6334,7 @@ void EditorNode::_bind_methods() { ADD_SIGNAL(MethodInfo("scene_saved", PropertyInfo(Variant::STRING, "path"))); ADD_SIGNAL(MethodInfo("project_settings_changed")); ADD_SIGNAL(MethodInfo("scene_changed")); + ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "path"))); } static Node *_resource_get_edited_scene() { diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 9a6302b695..9577cd0e63 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -477,6 +477,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set_restart_if_changed("interface/touchscreen/enable_long_press_as_right_click", true); EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_pan_and_scale_gestures", has_touchscreen_ui, "") set_restart_if_changed("interface/touchscreen/enable_pan_and_scale_gestures", true); + EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/touchscreen/scale_gizmo_handles", has_touchscreen_ui ? 3 : 1, "1,5,1") // Scene tabs EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/scene_tabs/display_close_button", 1, "Never,If Tab Active,Always"); // TabBar::CloseButtonDisplayPolicy @@ -696,7 +697,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("editors/tiles_editor/grid_color", Color(1.0, 0.5, 0.2, 0.5)); // Polygon editor - _initial_set("editors/polygon_editor/point_grab_radius", 8); + _initial_set("editors/polygon_editor/point_grab_radius", has_touchscreen_ui ? 32 : 8); _initial_set("editors/polygon_editor/show_previous_outline", true); // Animation diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 1a8a216605..1b5144af67 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -255,6 +255,28 @@ static Ref<ImageTexture> editor_generate_icon(int p_index, float p_scale, float return ImageTexture::create_from_image(img); } +float get_gizmo_handle_scale(const String &gizmo_handle_name = "") { + const float scale_gizmo_handles_for_touch = EDITOR_GET("interface/touchscreen/scale_gizmo_handles"); + if (scale_gizmo_handles_for_touch > 1.0f) { + // The names of the icons that require additional scaling. + static HashSet<StringName> gizmo_to_scale; + if (gizmo_to_scale.is_empty()) { + gizmo_to_scale.insert("EditorHandle"); + gizmo_to_scale.insert("EditorHandleAdd"); + gizmo_to_scale.insert("EditorHandleDisabled"); + gizmo_to_scale.insert("EditorCurveHandle"); + gizmo_to_scale.insert("EditorPathSharpHandle"); + gizmo_to_scale.insert("EditorPathSmoothHandle"); + } + + if (gizmo_to_scale.has(gizmo_handle_name)) { + return EDSCALE * scale_gizmo_handles_for_touch; + } + } + + return EDSCALE; +} + void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme, float p_icon_saturation, int p_thumb_size, bool p_only_thumbs = false) { // Before we register the icons, we adjust their colors and saturation. // Most icons follow the standard rules for color conversion to follow the editor @@ -314,22 +336,23 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme, f for (int i = 0; i < editor_icons_count; i++) { Ref<ImageTexture> icon; - if (accent_color_icons.has(editor_icons_names[i])) { - icon = editor_generate_icon(i, EDSCALE, 1.0, accent_color_map); + const String &editor_icon_name = editor_icons_names[i]; + if (accent_color_icons.has(editor_icon_name)) { + icon = editor_generate_icon(i, get_gizmo_handle_scale(editor_icon_name), 1.0, accent_color_map); } else { float saturation = p_icon_saturation; - if (saturation_exceptions.has(editor_icons_names[i])) { + if (saturation_exceptions.has(editor_icon_name)) { saturation = 1.0; } - if (conversion_exceptions.has(editor_icons_names[i])) { - icon = editor_generate_icon(i, EDSCALE, saturation); + if (conversion_exceptions.has(editor_icon_name)) { + icon = editor_generate_icon(i, get_gizmo_handle_scale(editor_icon_name), saturation); } else { - icon = editor_generate_icon(i, EDSCALE, saturation, color_conversion_map); + icon = editor_generate_icon(i, get_gizmo_handle_scale(editor_icon_name), saturation, color_conversion_map); } } - p_theme->set_icon(editor_icons_names[i], SNAME("EditorIcons"), icon); + p_theme->set_icon(editor_icon_name, SNAME("EditorIcons"), icon); } } @@ -395,6 +418,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Color base_color = EDITOR_GET("interface/theme/base_color"); float contrast = EDITOR_GET("interface/theme/contrast"); bool increase_scrollbar_touch_area = EDITOR_GET("interface/touchscreen/increase_scrollbar_touch_area"); + const float gizmo_handle_scale = EDITOR_GET("interface/touchscreen/scale_gizmo_handles"); bool draw_extra_borders = EDITOR_GET("interface/theme/draw_extra_borders"); float icon_saturation = EDITOR_GET("interface/theme/icon_saturation"); float relationship_line_opacity = EDITOR_GET("interface/theme/relationship_line_opacity"); @@ -594,6 +618,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_constant("class_icon_size", "Editor", 16 * EDSCALE); theme->set_constant("dark_theme", "Editor", dark_theme); theme->set_constant("color_picker_button_height", "Editor", 28 * EDSCALE); + theme->set_constant("gizmo_handle_scale", "Editor", gizmo_handle_scale); // Register editor icons. // If the settings are comparable to the old theme, then just copy them over. @@ -609,8 +634,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const bool prev_dark_theme = (bool)p_theme->get_constant(SNAME("dark_theme"), SNAME("Editor")); const Color prev_accent_color = p_theme->get_color(SNAME("accent_color"), SNAME("Editor")); const float prev_icon_saturation = p_theme->get_color(SNAME("icon_saturation"), SNAME("Editor")).r; + const float prev_gizmo_handle_scale = (float)p_theme->get_constant(SNAME("gizmo_handle_scale"), SNAME("Editor")); keep_old_icons = (Math::is_equal_approx(prev_scale, EDSCALE) && + Math::is_equal_approx(prev_gizmo_handle_scale, gizmo_handle_scale) && prev_dark_theme == dark_theme && prev_accent_color == accent_color && prev_icon_saturation == icon_saturation); diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index 114d927c4d..d9e0f9831b 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -833,14 +833,20 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem void ProjectExportDialog::_propagate_file_export_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_inherited_export_mode) { EditorExportPreset::FileExportMode file_export_mode = (EditorExportPreset::FileExportMode)(int)p_item->get_metadata(1); + bool is_inherited = false; if (file_export_mode == EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) { file_export_mode = p_inherited_export_mode; + is_inherited = true; } if (file_export_mode == EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) { p_item->set_text(1, ""); } else { - p_item->set_text(1, file_mode_popup->get_item_text(file_mode_popup->get_item_index(file_export_mode))); + String text = file_mode_popup->get_item_text(file_mode_popup->get_item_index(file_export_mode)); + if (is_inherited) { + text += " " + TTR("(Inherited)"); + } + p_item->set_text(1, text); } for (int i = 0; i < p_item->get_child_count(); i++) { diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 0aef364c2d..15c40a5cb3 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -33,6 +33,7 @@ #include "canvas_item_editor_plugin.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "scene/resources/capsule_shape_2d.h" #include "scene/resources/circle_shape_2d.h" @@ -44,6 +45,10 @@ #include "scene/resources/world_boundary_shape_2d.h" #include "scene/scene_string_names.h" +CollisionShape2DEditor::CollisionShape2DEditor() { + grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius"); +} + void CollisionShape2DEditor::_node_removed(Node *p_node) { if (p_node == node) { node = nullptr; @@ -307,7 +312,7 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e if (mb->get_button_index() == MouseButton::LEFT) { if (mb->is_pressed()) { for (int i = 0; i < handles.size(); i++) { - if (xform.xform(handles[i]).distance_to(gpoint) < 8) { + if (xform.xform(handles[i]).distance_to(gpoint) < grab_threshold) { edit_handle = i; break; @@ -529,6 +534,12 @@ void CollisionShape2DEditor::_notification(int p_what) { _shape_changed(); } } break; + + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/polygon_editor/point_grab_radius")) { + grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius"); + } + } break; } } diff --git a/editor/plugins/collision_shape_2d_editor_plugin.h b/editor/plugins/collision_shape_2d_editor_plugin.h index 13a99ec6f3..d58f5d511f 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.h +++ b/editor/plugins/collision_shape_2d_editor_plugin.h @@ -69,6 +69,7 @@ class CollisionShape2DEditor : public Control { int shape_type = -1; int edit_handle = -1; bool pressed = false; + real_t grab_threshold = 8; Variant original; Transform2D original_transform; Vector2 original_point; @@ -90,6 +91,8 @@ public: bool forward_canvas_gui_input(const Ref<InputEvent> &p_event); void forward_canvas_draw_over_viewport(Control *p_overlay); void edit(Node *p_node); + + CollisionShape2DEditor(); }; class CollisionShape2DEditorPlugin : public EditorPlugin { diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index ba2d7e67bf..72cd1da9dd 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -49,6 +49,7 @@ CurveEditor::CurveEditor() { _tangents_length = 40; _dragging = false; _has_undo_data = false; + _gizmo_handle_scale = EDITOR_GET("interface/touchscreen/scale_gizmo_handles"); set_focus_mode(FOCUS_ALL); set_clip_contents(true); @@ -105,6 +106,11 @@ void CurveEditor::_notification(int p_what) { case NOTIFICATION_DRAW: { _draw(); } break; + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/scale_gizmo_handles")) { + _gizmo_handle_scale = EDITOR_GET("interface/touchscreen/scale_gizmo_handles"); + } + } break; } } @@ -397,7 +403,7 @@ int CurveEditor::get_point_at(Vector2 pos) const { } const Curve &curve = **_curve_ref; - const float true_hover_radius = Math::round(_hover_radius * EDSCALE); + const float true_hover_radius = Math::round(_hover_radius * _gizmo_handle_scale * EDSCALE); const float r = true_hover_radius * true_hover_radius; for (int i = 0; i < curve.get_point_count(); ++i) { @@ -417,14 +423,14 @@ CurveEditor::TangentIndex CurveEditor::get_tangent_at(Vector2 pos) const { if (_selected_point != 0) { Vector2 control_pos = get_tangent_view_pos(_selected_point, TANGENT_LEFT); - if (control_pos.distance_to(pos) < _hover_radius) { + if (control_pos.distance_to(pos) < _hover_radius * _gizmo_handle_scale) { return TANGENT_LEFT; } } if (_selected_point != _curve_ref->get_point_count() - 1) { Vector2 control_pos = get_tangent_view_pos(_selected_point, TANGENT_RIGHT); - if (control_pos.distance_to(pos) < _hover_radius) { + if (control_pos.distance_to(pos) < _hover_radius * _gizmo_handle_scale) { return TANGENT_RIGHT; } } @@ -562,7 +568,7 @@ Vector2 CurveEditor::get_tangent_view_pos(int i, TangentIndex tangent) const { Vector2 point_pos = get_view_pos(_curve_ref->get_point_position(i)); Vector2 control_pos = get_view_pos(_curve_ref->get_point_position(i) + dir); - return point_pos + Math::round(_tangents_length * EDSCALE) * (control_pos - point_pos).normalized(); + return point_pos + Math::round(_tangents_length * _gizmo_handle_scale * EDSCALE) * (control_pos - point_pos).normalized(); } Vector2 CurveEditor::get_view_pos(Vector2 world_pos) const { @@ -707,13 +713,13 @@ void CurveEditor::_draw() { if (i != 0) { Vector2 control_pos = get_tangent_view_pos(i, TANGENT_LEFT); draw_line(get_view_pos(pos), control_pos, tangent_color, Math::round(EDSCALE)); - draw_rect(Rect2(control_pos, Vector2(1, 1)).grow(Math::round(2 * EDSCALE)), tangent_color); + draw_rect(Rect2(control_pos, Vector2(1, 1)).grow(Math::round(2 * _gizmo_handle_scale * EDSCALE)), tangent_color); } if (i != curve.get_point_count() - 1) { Vector2 control_pos = get_tangent_view_pos(i, TANGENT_RIGHT); draw_line(get_view_pos(pos), control_pos, tangent_color, Math::round(EDSCALE)); - draw_rect(Rect2(control_pos, Vector2(1, 1)).grow(Math::round(2 * EDSCALE)), tangent_color); + draw_rect(Rect2(control_pos, Vector2(1, 1)).grow(Math::round(2 * _gizmo_handle_scale * EDSCALE)), tangent_color); } } @@ -736,7 +742,7 @@ void CurveEditor::_draw() { for (int i = 0; i < curve.get_point_count(); ++i) { Vector2 pos = curve.get_point_position(i); - draw_rect(Rect2(get_view_pos(pos), Vector2(1, 1)).grow(Math::round(3 * EDSCALE)), i == _selected_point ? selected_point_color : point_color); + draw_rect(Rect2(get_view_pos(pos), Vector2(1, 1)).grow(Math::round(3 * _gizmo_handle_scale * EDSCALE)), i == _selected_point ? selected_point_color : point_color); // TODO Circles are prettier. Needs a fix! Or a texture //draw_circle(pos, 2, point_color); } @@ -746,7 +752,7 @@ void CurveEditor::_draw() { if (_hover_point != -1) { const Color hover_color = line_color; Vector2 pos = curve.get_point_position(_hover_point); - draw_rect(Rect2(get_view_pos(pos), Vector2(1, 1)).grow(Math::round(_hover_radius * EDSCALE)), hover_color, false, Math::round(EDSCALE)); + draw_rect(Rect2(get_view_pos(pos), Vector2(1, 1)).grow(Math::round(_hover_radius * _gizmo_handle_scale * EDSCALE)), hover_color, false, Math::round(EDSCALE)); } // Help text diff --git a/editor/plugins/curve_editor_plugin.h b/editor/plugins/curve_editor_plugin.h index ca1a824f0c..b0d666b847 100644 --- a/editor/plugins/curve_editor_plugin.h +++ b/editor/plugins/curve_editor_plugin.h @@ -117,6 +117,7 @@ private: // Constant float _hover_radius; float _tangents_length; + float _gizmo_handle_scale = 1.0; }; class EditorInspectorPluginCurve : public EditorInspectorPlugin { diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 2fdebc7c7f..404711e074 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -164,9 +164,19 @@ void MaterialEditor::_button_pressed(Node *p_button) { MaterialEditor::MaterialEditor() { // canvas item + vc_2d = memnew(SubViewportContainer); + vc_2d->set_stretch(true); + add_child(vc_2d); + vc_2d->set_anchors_and_offsets_preset(PRESET_FULL_RECT); + + viewport_2d = memnew(SubViewport); + vc_2d->add_child(viewport_2d); + viewport_2d->set_disable_input(true); + viewport_2d->set_transparent_background(true); + layout_2d = memnew(HBoxContainer); layout_2d->set_alignment(BoxContainer::ALIGNMENT_CENTER); - add_child(layout_2d); + viewport_2d->add_child(layout_2d); layout_2d->set_anchors_and_offsets_preset(PRESET_FULL_RECT); rect_instance = memnew(ColorRect); diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h index deb1211c54..ac81bdc7c7 100644 --- a/editor/plugins/material_editor_plugin.h +++ b/editor/plugins/material_editor_plugin.h @@ -51,6 +51,8 @@ class MaterialEditor : public Control { Vector2 rot; + SubViewportContainer *vc_2d = nullptr; + SubViewport *viewport_2d = nullptr; HBoxContainer *layout_2d = nullptr; ColorRect *rect_instance = nullptr; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index b819145e67..a726ab09d5 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -8578,9 +8578,11 @@ void fragment() { sun_color->get_popup()->connect("about_to_popup", callable_mp(EditorNode::get_singleton(), &EditorNode::setup_color_picker).bind(sun_color->get_picker())); sun_energy = memnew(EditorSpinSlider); + sun_energy->set_max(64.0); + sun_energy->set_min(0); + sun_energy->set_step(0.05); sun_vb->add_margin_child(TTR("Sun Energy"), sun_energy); sun_energy->connect("value_changed", callable_mp(this, &Node3DEditor::_preview_settings_changed).unbind(1)); - sun_energy->set_max(64.0); sun_max_distance = memnew(EditorSpinSlider); sun_vb->add_margin_child(TTR("Shadow Max Distance"), sun_max_distance); @@ -8629,8 +8631,10 @@ void fragment() { environ_ground_color->get_popup()->connect("about_to_popup", callable_mp(EditorNode::get_singleton(), &EditorNode::setup_color_picker).bind(environ_ground_color->get_picker())); environ_vb->add_margin_child(TTR("Ground Color"), environ_ground_color); environ_energy = memnew(EditorSpinSlider); - environ_energy->connect("value_changed", callable_mp(this, &Node3DEditor::_preview_settings_changed).unbind(1)); environ_energy->set_max(8.0); + environ_energy->set_min(0); + environ_energy->set_step(0.05); + environ_energy->connect("value_changed", callable_mp(this, &Node3DEditor::_preview_settings_changed).unbind(1)); environ_vb->add_margin_child(TTR("Sky Energy"), environ_energy); HBoxContainer *fx_vb = memnew(HBoxContainer); fx_vb->set_h_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index e928abe00e..0e01b11028 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1642,6 +1642,7 @@ void ScriptEditor::_notification(int p_what) { get_tree()->connect("tree_changed", callable_mp(this, &ScriptEditor::_tree_changed)); InspectorDock::get_singleton()->connect("request_help", callable_mp(this, &ScriptEditor::_help_class_open)); EditorNode::get_singleton()->connect("request_help_search", callable_mp(this, &ScriptEditor::_help_search)); + EditorNode::get_singleton()->connect("scene_closed", callable_mp(this, &ScriptEditor::_close_builtin_scripts_from_scene)); } break; case NOTIFICATION_EXIT_TREE: { @@ -1676,7 +1677,7 @@ bool ScriptEditor::can_take_away_focus() const { } } -void ScriptEditor::close_builtin_scripts_from_scene(const String &p_scene) { +void ScriptEditor::_close_builtin_scripts_from_scene(const String &p_scene) { for (int i = 0; i < tab_container->get_tab_count(); i++) { ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i)); @@ -1686,7 +1687,7 @@ void ScriptEditor::close_builtin_scripts_from_scene(const String &p_scene) { continue; } - if (scr->is_built_in() && scr->get_path().begins_with(p_scene)) { //is an internal script and belongs to scene being closed + if (scr->is_built_in() && scr->get_path().begins_with(p_scene)) { // Is an internal script and belongs to scene being closed. _close_tab(i, false); i--; } diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 7d2f5ad22a..10dfe0f199 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -482,6 +482,7 @@ class ScriptEditor : public PanelContainer { void _on_find_in_files_modified_files(PackedStringArray paths); static void _open_script_request(const String &p_path); + void _close_builtin_scripts_from_scene(const String &p_scene); static ScriptEditor *script_editor; @@ -523,8 +524,6 @@ public: void notify_script_close(const Ref<Script> &p_script); void notify_script_changed(const Ref<Script> &p_script); - void close_builtin_scripts_from_scene(const String &p_scene); - void goto_help(const String &p_desc) { _help_class_goto(p_desc); } void update_doc(const String &p_name); void clear_docs_from_script(const Ref<Script> &p_script); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 65b7526722..9e10eddd5b 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1805,20 +1805,26 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { int col = pos.x; tx->set_move_caret_on_right_click_enabled(EDITOR_GET("text_editor/behavior/navigation/move_caret_on_right_click")); + int caret_clicked = -1; if (tx->is_move_caret_on_right_click_enabled()) { - tx->remove_secondary_carets(); if (tx->has_selection()) { - int from_line = tx->get_selection_from_line(); - int to_line = tx->get_selection_to_line(); - int from_column = tx->get_selection_from_column(); - int to_column = tx->get_selection_to_column(); - - if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) { - // Right click is outside the selected text - tx->deselect(); + for (int i = 0; i < tx->get_caret_count(); i++) { + int from_line = tx->get_selection_from_line(i); + int to_line = tx->get_selection_to_line(i); + int from_column = tx->get_selection_from_column(i); + int to_column = tx->get_selection_to_column(i); + + if (row >= from_line && row <= to_line && (row != from_line || col >= from_column) && (row != to_line || col <= to_column)) { + // Right click in one of the selected text + caret_clicked = i; + break; + } } } - if (!tx->has_selection()) { + if (!caret_clicked) { + tx->deselect(); + tx->remove_secondary_carets(); + caret_clicked = 0; tx->set_caret_line(row, false, false); tx->set_caret_column(col); } @@ -1826,10 +1832,10 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { String word_at_pos = tx->get_word_at_pos(local_pos); if (word_at_pos.is_empty()) { - word_at_pos = tx->get_word_under_caret(0); + word_at_pos = tx->get_word_under_caret(caret_clicked); } if (word_at_pos.is_empty()) { - word_at_pos = tx->get_selected_text(0); + word_at_pos = tx->get_selected_text(caret_clicked); } bool has_color = (word_at_pos == "Color"); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 49459a0ba0..5cb014e5c7 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -236,6 +236,26 @@ void ShaderEditorPlugin::_close_shader(int p_index) { EditorUndoRedoManager::get_singleton()->clear_history(); // To prevent undo on deleted graphs. } +void ShaderEditorPlugin::_close_builtin_shaders_from_scene(const String &p_scene) { + for (uint32_t i = 0; i < edited_shaders.size();) { + Ref<Shader> &shader = edited_shaders[i].shader; + if (shader.is_valid()) { + if (shader->is_built_in() && shader->get_path().begins_with(p_scene)) { + _close_shader(i); + continue; + } + } + Ref<ShaderInclude> &include = edited_shaders[i].shader_inc; + if (include.is_valid()) { + if (include->is_built_in() && include->get_path().begins_with(p_scene)) { + _close_shader(i); + continue; + } + } + i++; + } +} + void ShaderEditorPlugin::_resource_saved(Object *obj) { // May have been renamed on save. for (EditedShader &edited_shader : edited_shaders) { @@ -430,6 +450,14 @@ void ShaderEditorPlugin::drop_data_fw(const Point2 &p_point, const Variant &p_da } } +void ShaderEditorPlugin::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_READY: { + EditorNode::get_singleton()->connect("scene_closed", callable_mp(this, &ShaderEditorPlugin::_close_builtin_shaders_from_scene)); + } break; + } +} + ShaderEditorPlugin::ShaderEditorPlugin() { main_split = memnew(HSplitContainer); diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h index 408d08ade0..299d5975d2 100644 --- a/editor/plugins/shader_editor_plugin.h +++ b/editor/plugins/shader_editor_plugin.h @@ -82,6 +82,7 @@ class ShaderEditorPlugin : public EditorPlugin { void _menu_item_pressed(int p_index); void _resource_saved(Object *obj); void _close_shader(int p_index); + void _close_builtin_shaders_from_scene(const String &p_scene); void _shader_created(Ref<Shader> p_shader); void _shader_include_created(Ref<ShaderInclude> p_shader_inc); @@ -92,6 +93,9 @@ class ShaderEditorPlugin : public EditorPlugin { bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); +protected: + void _notification(int p_what); + public: virtual String get_name() const override { return "Shader"; } virtual void edit(Object *p_object) override; diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index 55b5abf983..0a8ccdba1a 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -938,6 +938,20 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over } } } + + Ref<Font> font = p_overlay->get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = p_overlay->get_theme_font_size(SNAME("font_size"), SNAME("Label")); + Point2 msgpos = Point2(20 * EDSCALE, p_overlay->get_size().y - 20 * EDSCALE); + + String text = tile_map->local_to_map(tile_map->get_local_mouse_position()); + if (drag_type == DRAG_TYPE_RECT) { + Vector2i size = tile_map->local_to_map(tile_map->get_local_mouse_position()) - tile_map->local_to_map(drag_start_mouse_pos); + text += vformat(" %s (%dx%d)", TTR("Drawing Rect:"), ABS(size.x) + 1, ABS(size.y) + 1); + } + + p_overlay->draw_string(font, msgpos + Point2(1, 1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); + p_overlay->draw_string(font, msgpos + Point2(-1, -1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); + p_overlay->draw_string(font, msgpos, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 1)); } } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index b74324ff29..754533ab31 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1209,13 +1209,19 @@ void VisualShaderEditor::clear_custom_types() { } } -void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, bool p_highend) { +void VisualShaderEditor::add_custom_type(const String &p_name, const String &p_type, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, bool p_highend) { ERR_FAIL_COND(!p_name.is_valid_identifier()); - ERR_FAIL_COND(!p_script.is_valid()); + ERR_FAIL_COND(p_type.is_empty() && !p_script.is_valid()); for (int i = 0; i < add_options.size(); i++) { - if (add_options[i].is_custom) { - if (add_options[i].script == p_script) { + const AddOption &op = add_options[i]; + + if (op.is_custom) { + if (!p_type.is_empty()) { + if (op.type == p_type) { + return; + } + } else if (op.script == p_script) { return; } } @@ -1223,12 +1229,14 @@ void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> AddOption ao; ao.name = p_name; + ao.type = p_type; ao.script = p_script; ao.return_type = p_return_icon_type; ao.description = p_description; ao.category = p_category; ao.highend = p_highend; ao.is_custom = true; + ao.is_native = !p_type.is_empty(); bool begin = false; String root = p_category.split("/")[0]; @@ -1253,50 +1261,23 @@ void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> Dictionary VisualShaderEditor::get_custom_node_data(Ref<VisualShaderNodeCustom> &p_custom_node) { Dictionary dict; dict["script"] = p_custom_node->get_script(); + dict["name"] = p_custom_node->_get_name(); + dict["description"] = p_custom_node->_get_description(); + dict["return_icon_type"] = p_custom_node->_get_return_icon_type(); + dict["highend"] = p_custom_node->_is_highend(); - String name; - if (p_custom_node->has_method("_get_name")) { - name = (String)p_custom_node->call("_get_name"); - } else { - name = "Unnamed"; - } - dict["name"] = name; - - String description = ""; - if (p_custom_node->has_method("_get_description")) { - description = (String)p_custom_node->call("_get_description"); - } - dict["description"] = description; - - int return_icon_type = -1; - if (p_custom_node->has_method("_get_return_icon_type")) { - return_icon_type = (int)p_custom_node->call("_get_return_icon_type"); - } - dict["return_icon_type"] = return_icon_type; - - String category = ""; - if (p_custom_node->has_method("_get_category")) { - category = (String)p_custom_node->call("_get_category"); - } + String category = p_custom_node->_get_category(); category = category.rstrip("/"); category = category.lstrip("/"); category = "Addons/" + category; - - String subcategory = ""; if (p_custom_node->has_method("_get_subcategory")) { - subcategory = (String)p_custom_node->call("_get_subcategory"); - } - if (!subcategory.is_empty()) { - category += "/" + subcategory; + String subcategory = (String)p_custom_node->call("_get_subcategory"); + if (!subcategory.is_empty()) { + category += "/" + subcategory; + } } dict["category"] = category; - bool highend = false; - if (p_custom_node->has_method("_is_highend")) { - highend = (bool)p_custom_node->call("_is_highend"); - } - dict["highend"] = highend; - return dict; } @@ -1333,7 +1314,7 @@ void VisualShaderEditor::_script_created(const Ref<Script> &p_script) { ref->set_script(p_script); Dictionary dict = get_custom_node_data(ref); - add_custom_type(dict["name"], dict["script"], dict["description"], dict["return_icon_type"], dict["category"], dict["highend"]); + add_custom_type(dict["name"], String(), dict["script"], dict["description"], dict["return_icon_type"], dict["category"], dict["highend"]); _update_options_menu(); } @@ -1456,7 +1437,7 @@ void VisualShaderEditor::_update_custom_script(const Ref<Script> &p_script) { } if (!found_type) { - add_custom_type(dict["name"], dict["script"], dict["description"], dict["return_icon_type"], dict["category"], dict["highend"]); + add_custom_type(dict["name"], String(), dict["script"], dict["description"], dict["return_icon_type"], dict["category"], dict["highend"]); } // To prevent updating options multiple times when multiple scripts are saved. @@ -1595,29 +1576,60 @@ bool VisualShaderEditor::_is_available(int p_mode) { void VisualShaderEditor::_update_nodes() { clear_custom_types(); - List<StringName> class_list; - ScriptServer::get_global_class_list(&class_list); Dictionary added; - for (int i = 0; i < class_list.size(); i++) { - if (ScriptServer::get_global_class_native_base(class_list[i]) == "VisualShaderNodeCustom") { - String script_path = ScriptServer::get_global_class_path(class_list[i]); - Ref<Resource> res = ResourceLoader::load(script_path); - ERR_FAIL_COND(res.is_null()); - ERR_FAIL_COND(!res->is_class("Script")); - Ref<Script> scr = Ref<Script>(res); - - Ref<VisualShaderNodeCustom> ref; - ref.instantiate(); - ref->set_script(scr); - if (!ref->is_available(visual_shader->get_mode(), visual_shader->get_shader_type())) { - continue; + + // Add GDScript classes. + { + List<StringName> class_list; + ScriptServer::get_global_class_list(&class_list); + + for (int i = 0; i < class_list.size(); i++) { + if (ScriptServer::get_global_class_native_base(class_list[i]) == "VisualShaderNodeCustom") { + String script_path = ScriptServer::get_global_class_path(class_list[i]); + Ref<Resource> res = ResourceLoader::load(script_path); + ERR_CONTINUE(res.is_null()); + ERR_CONTINUE(!res->is_class("Script")); + Ref<Script> scr = Ref<Script>(res); + + Ref<VisualShaderNodeCustom> ref; + ref.instantiate(); + ref->set_script(scr); + if (!ref->is_available(visual_shader->get_mode(), visual_shader->get_shader_type())) { + continue; + } + Dictionary dict = get_custom_node_data(ref); + dict["type"] = String(); + + String key; + key = String(dict["category"]) + "/" + String(dict["name"]); + + added[key] = dict; } - Dictionary dict = get_custom_node_data(ref); + } + } - String key; - key = String(dict["category"]) + "/" + String(dict["name"]); + // Add GDExtension classes. + { + List<StringName> class_list; + ClassDB::get_class_list(&class_list); + + for (int i = 0; i < class_list.size(); i++) { + if (ClassDB::get_parent_class(class_list[i]) == "VisualShaderNodeCustom") { + Object *instance = ClassDB::instantiate(class_list[i]); + Ref<VisualShaderNodeCustom> ref = Object::cast_to<VisualShaderNodeCustom>(instance); + ERR_CONTINUE(ref.is_null()); + if (!ref->is_available(visual_shader->get_mode(), visual_shader->get_shader_type())) { + continue; + } + Dictionary dict = get_custom_node_data(ref); + dict["type"] = class_list[i]; + dict["script"] = Ref<Script>(); - added[key] = dict; + String key; + key = String(dict["category"]) + "/" + String(dict["name"]); + + added[key] = dict; + } } } @@ -1655,7 +1667,7 @@ void VisualShaderEditor::_update_nodes() { const Dictionary &value = (Dictionary)added[key]; - add_custom_type(value["name"], value["script"], value["description"], value["return_icon_type"], value["category"], value["highend"]); + add_custom_type(value["name"], value["type"], value["script"], value["description"], value["return_icon_type"], value["category"], value["highend"]); } _update_options_menu(); @@ -3062,12 +3074,21 @@ void VisualShaderEditor::_add_node(int p_idx, const Vector<Variant> &p_ops, Stri vsnode = Ref<VisualShaderNode>(vsn); } else { - ERR_FAIL_COND(add_options[p_idx].script.is_null()); - StringName base_type = add_options[p_idx].script->get_instance_base_type(); + StringName base_type; + bool is_native = add_options[p_idx].is_native; + + if (is_native) { + base_type = add_options[p_idx].type; + } else { + ERR_FAIL_COND(add_options[p_idx].script.is_null()); + base_type = add_options[p_idx].script->get_instance_base_type(); + } VisualShaderNode *vsn = Object::cast_to<VisualShaderNode>(ClassDB::instantiate(base_type)); ERR_FAIL_COND(!vsn); vsnode = Ref<VisualShaderNode>(vsn); - vsnode->set_script(add_options[p_idx].script); + if (!is_native) { + vsnode->set_script(add_options[p_idx].script); + } } bool is_texture2d = (Object::cast_to<VisualShaderNodeTexture>(vsnode.ptr()) != nullptr); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index 21139fbddd..bdb23afa0f 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -310,6 +310,7 @@ class VisualShaderEditor : public VBoxContainer { int func = 0; bool highend = false; bool is_custom = false; + bool is_native = false; int temp_idx = 0; AddOption(const String &p_name = String(), const String &p_category = String(), const String &p_type = String(), const String &p_description = String(), const Vector<Variant> &p_ops = Vector<Variant>(), int p_return_type = -1, int p_mode = -1, int p_func = -1, bool p_highend = false) { @@ -527,9 +528,10 @@ public: VisualShaderGraphPlugin *get_graph_plugin() { return graph_plugin.ptr(); } void clear_custom_types(); - void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, bool p_highend); + void add_custom_type(const String &p_name, const String &p_type, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, bool p_highend); Dictionary get_custom_node_data(Ref<VisualShaderNodeCustom> &p_custom_node); + void update_custom_type(const Ref<Resource> &p_resource); virtual Size2 get_minimum_size() const override; void edit(VisualShader *p_visual_shader); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 96166dab3f..9e231a41c3 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -276,6 +276,8 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base) return; } + instantiated_scene->set_unique_name_in_owner(base->is_unique_name_in_owner()); + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(TTR("Replace with Branch Scene")); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index f3f0e7308c..23272ab284 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -894,9 +894,9 @@ ScriptLanguage::ScriptTemplate ScriptCreateDialog::_parse_template(const ScriptL if (line.begins_with("space-indent")) { String indent_value = line.substr(17, -1).strip_edges(); if (indent_value.is_valid_int()) { - space_indent = ""; - for (int i = 0; i < indent_value.to_int(); i++) { - space_indent += " "; + int indent_size = indent_value.to_int(); + if (indent_size >= 0) { + space_indent = String(" ").repeat(indent_size); } } else { WARN_PRINT(vformat("Template meta-use_space_indent need to be a valid integer value. Found %s.", indent_value)); diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index d8f12f7232..0e51230cd0 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -139,7 +139,7 @@ print(is_instance_of(a, MyClass)) print(is_instance_of(a, MyClass.InnerClass)) [/codeblock] - [b]Note:[/b] If [param value] and/or [param type] are freed objects (see [method @GlobalScope.is_instance_valid]), or [param type] is not one of the above options, this method will raise an runtime error. + [b]Note:[/b] If [param value] and/or [param type] are freed objects (see [method @GlobalScope.is_instance_valid]), or [param type] is not one of the above options, this method will raise a runtime error. See also [method @GlobalScope.typeof], [method type_exists], [method Array.is_same_typed] (and other [Array] methods). </description> </method> @@ -227,8 +227,8 @@ To iterate over an [Array] backwards, use: [codeblock] var array = [3, 6, 9] - for i in range(array.size(), 0, -1): - print(array[i - 1]) + for i in range(array.size() - 1, -1, -1): + print(array[i]) [/codeblock] Output: [codeblock] diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index f1ac234d28..829567d734 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -3098,12 +3098,7 @@ String GDScriptLanguage::_get_indentation() const { if (use_space_indentation) { int indent_size = EDITOR_GET("text_editor/behavior/indent/size"); - - String space_indent = ""; - for (int i = 0; i < indent_size; i++) { - space_indent += " "; - } - return space_indent; + return String(" ").repeat(indent_size); } } #endif @@ -3150,12 +3145,7 @@ void GDScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_t } if (i >= p_from_line) { - l = ""; - for (int j = 0; j < indent_stack.size(); j++) { - l += indent; - } - l += st; - + l = indent.repeat(indent_stack.size()) + st; } else if (i > p_to_line) { break; } diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 4a07183b0d..251aa6375f 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -7190,9 +7190,9 @@ PackedByteArray GLTFDocument::_serialize_glb_buffer(Ref<GLTFState> p_state, Erro const int32_t header_size = 12; const int32_t chunk_header_size = 8; - for (int32_t pad_i = 0; pad_i < (chunk_header_size + json.utf8().length()) % 4; pad_i++) { - json += " "; - } + int32_t padding = (chunk_header_size + json.utf8().length()) % 4; + json += String(" ").repeat(padding); + CharString cs = json.utf8(); const uint32_t text_chunk_length = cs.length(); diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index a77b1d83ad..0d6436594e 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -522,12 +522,7 @@ String CSharpLanguage::_get_indentation() const { if (use_space_indentation) { int indent_size = EDITOR_GET("text_editor/behavior/indent/size"); - - String space_indent = ""; - for (int i = 0; i < indent_size; i++) { - space_indent += " "; - } - return space_indent; + return String(" ").repeat(indent_size); } } #endif diff --git a/modules/noise/doc_classes/Noise.xml b/modules/noise/doc_classes/Noise.xml index a5cdb5bcbc..c075b5b629 100644 --- a/modules/noise/doc_classes/Noise.xml +++ b/modules/noise/doc_classes/Noise.xml @@ -15,13 +15,24 @@ <return type="Image" /> <param index="0" name="width" type="int" /> <param index="1" name="height" type="int" /> + <param index="2" name="invert" type="bool" default="false" /> + <param index="3" name="in_3d_space" type="bool" default="false" /> + <param index="4" name="normalize" type="bool" default="true" /> + <description> + Returns an [Image] containing 2D noise values. + [b]Note:[/b] With [param normalize] set to [code]false[/code], the default implementation expects the noise generator to return values in the range [code]-1.0[/code] to [code]1.0[/code]. + </description> + </method> + <method name="get_image_3d" qualifiers="const"> + <return type="Image[]" /> + <param index="0" name="width" type="int" /> + <param index="1" name="height" type="int" /> <param index="2" name="depth" type="int" /> <param index="3" name="invert" type="bool" default="false" /> - <param index="4" name="in_3d_space" type="bool" default="false" /> - <param index="5" name="normalize" type="bool" default="true" /> + <param index="4" name="normalize" type="bool" default="true" /> <description> - Returns a 2D [Image] noise image. - Note: With [param normalize] set to [code]false[/code] the default implementation expects the noise generator to return values in the range [code]-1.0[/code] to [code]1.0[/code]. + Returns an [Array] of [Image]s containing 3D noise values for use with [method ImageTexture3D.create]. + [b]Note:[/b] With [param normalize] set to [code]false[/code], the default implementation expects the noise generator to return values in the range [code]-1.0[/code] to [code]1.0[/code]. </description> </method> <method name="get_noise_1d" qualifiers="const"> @@ -66,14 +77,26 @@ <return type="Image" /> <param index="0" name="width" type="int" /> <param index="1" name="height" type="int" /> + <param index="2" name="invert" type="bool" default="false" /> + <param index="3" name="in_3d_space" type="bool" default="false" /> + <param index="4" name="skirt" type="float" default="0.1" /> + <param index="5" name="normalize" type="bool" default="true" /> + <description> + Returns an [Image] containing seamless 2D noise values. + [b]Note:[/b] With [param normalize] set to [code]false[/code], the default implementation expects the noise generator to return values in the range [code]-1.0[/code] to [code]1.0[/code]. + </description> + </method> + <method name="get_seamless_image_3d" qualifiers="const"> + <return type="Image[]" /> + <param index="0" name="width" type="int" /> + <param index="1" name="height" type="int" /> <param index="2" name="depth" type="int" /> <param index="3" name="invert" type="bool" default="false" /> - <param index="4" name="in_3d_space" type="bool" default="false" /> - <param index="5" name="skirt" type="float" default="0.1" /> - <param index="6" name="normalize" type="bool" default="true" /> + <param index="4" name="skirt" type="float" default="0.1" /> + <param index="5" name="normalize" type="bool" default="true" /> <description> - Returns a seamless 2D [Image] noise image. - Note: With [param normalize] set to [code]false[/code] the default implementation expects the noise generator to return values in the range [code]-1.0[/code] to [code]1.0[/code]. + Returns an [Array] of [Image]s containing seamless 3D noise values for use with [method ImageTexture3D.create]. + [b]Note:[/b] With [param normalize] set to [code]false[/code], the default implementation expects the noise generator to return values in the range [code]-1.0[/code] to [code]1.0[/code]. </description> </method> </methods> diff --git a/modules/noise/doc_classes/NoiseTexture3D.xml b/modules/noise/doc_classes/NoiseTexture3D.xml index 0b385d9b9c..7394e7ff08 100644 --- a/modules/noise/doc_classes/NoiseTexture3D.xml +++ b/modules/noise/doc_classes/NoiseTexture3D.xml @@ -5,13 +5,12 @@ </brief_description> <description> Uses [FastNoiseLite] or other libraries to fill the texture data of your desired size. - The class uses [Thread]s to generate the texture data internally, so [method Texture3D.get_data] may return [code]null[/code] if the generation process has not completed yet. In that case, you need to wait for the texture to be generated before accessing the image and the generated byte data: + The class uses [Thread]s to generate the texture data internally, so [method Texture3D.get_data] may return [code]null[/code] if the generation process has not completed yet. In that case, you need to wait for the texture to be generated before accessing the image: [codeblock] var texture = NoiseTexture3D.new() texture.noise = FastNoiseLite.new() await texture.changed var data = texture.get_data() - var image = data[0] [/codeblock] </description> <tutorials> diff --git a/modules/noise/fastnoise_lite.cpp b/modules/noise/fastnoise_lite.cpp index 224c082c0f..4aea98c4de 100644 --- a/modules/noise/fastnoise_lite.cpp +++ b/modules/noise/fastnoise_lite.cpp @@ -416,7 +416,7 @@ void FastNoiseLite::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "noise_type", PROPERTY_HINT_ENUM, "Simplex,Simplex Smooth,Cellular,Perlin,Value Cubic,Value"), "set_noise_type", "get_noise_type"); ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "frequency", PROPERTY_HINT_RANGE, ".001,1"), "set_frequency", "get_frequency"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "frequency", PROPERTY_HINT_RANGE, ".0001,1,.0001"), "set_frequency", "get_frequency"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "offset", PROPERTY_HINT_RANGE, "-999999999,999999999,0.01"), "set_offset", "get_offset"); ADD_GROUP("Fractal", "fractal_"); diff --git a/modules/noise/noise.cpp b/modules/noise/noise.cpp index b8c1587ec3..1115d92f58 100644 --- a/modules/noise/noise.cpp +++ b/modules/noise/noise.cpp @@ -32,21 +32,40 @@ #include <float.h> -Ref<Image> Noise::get_seamless_image(int p_width, int p_height, int p_depth, bool p_invert, bool p_in_3d_space, real_t p_blend_skirt, bool p_normalize) const { - ERR_FAIL_COND_V(p_width <= 0 || p_height <= 0, Ref<Image>()); +Vector<Ref<Image>> Noise::_get_seamless_image(int p_width, int p_height, int p_depth, bool p_invert, bool p_in_3d_space, real_t p_blend_skirt, bool p_normalize) const { + ERR_FAIL_COND_V(p_width <= 0 || p_height <= 0 || p_depth <= 0, Vector<Ref<Image>>()); int skirt_width = MAX(1, p_width * p_blend_skirt); int skirt_height = MAX(1, p_height * p_blend_skirt); + int skirt_depth = MAX(1, p_depth * p_blend_skirt); int src_width = p_width + skirt_width; int src_height = p_height + skirt_height; + int src_depth = p_depth + skirt_depth; + + Vector<Ref<Image>> src = _get_image(src_width, src_height, src_depth, p_invert, p_in_3d_space, p_normalize); + bool grayscale = (src[0]->get_format() == Image::FORMAT_L8); - Ref<Image> src = get_image(src_width, src_height, p_depth, p_invert, p_in_3d_space, p_normalize); - bool grayscale = (src->get_format() == Image::FORMAT_L8); if (grayscale) { - return _generate_seamless_image<uint8_t>(src, p_width, p_height, p_invert, p_blend_skirt); + return _generate_seamless_image<uint8_t>(src, p_width, p_height, p_depth, p_invert, p_blend_skirt); } else { - return _generate_seamless_image<uint32_t>(src, p_width, p_height, p_invert, p_blend_skirt); + return _generate_seamless_image<uint32_t>(src, p_width, p_height, p_depth, p_invert, p_blend_skirt); + } +} + +Ref<Image> Noise::get_seamless_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space, real_t p_blend_skirt, bool p_normalize) const { + Vector<Ref<Image>> images = _get_seamless_image(p_width, p_height, 1, p_invert, p_in_3d_space, p_blend_skirt, p_normalize); + return images[0]; +} + +TypedArray<Image> Noise::get_seamless_image_3d(int p_width, int p_height, int p_depth, bool p_invert, real_t p_blend_skirt, bool p_normalize) const { + Vector<Ref<Image>> images = _get_seamless_image(p_width, p_height, p_depth, p_invert, true, p_blend_skirt, p_normalize); + + TypedArray<Image> ret; + ret.resize(images.size()); + for (int i = 0; i < images.size(); i++) { + ret[i] = images[i]; } + return ret; } // Template specialization for faster grayscale blending. @@ -58,61 +77,104 @@ uint8_t Noise::_alpha_blend<uint8_t>(uint8_t p_bg, uint8_t p_fg, int p_alpha) co return (uint8_t)((alpha * p_fg + inv_alpha * p_bg) >> 8); } -Ref<Image> Noise::get_image(int p_width, int p_height, int p_depth, bool p_invert, bool p_in_3d_space, bool p_normalize) const { - ERR_FAIL_COND_V(p_width <= 0 || p_height <= 0, Ref<Image>()); - - Vector<uint8_t> data; - data.resize(p_width * p_height); +Vector<Ref<Image>> Noise::_get_image(int p_width, int p_height, int p_depth, bool p_invert, bool p_in_3d_space, bool p_normalize) const { + ERR_FAIL_COND_V(p_width <= 0 || p_height <= 0 || p_depth <= 0, Vector<Ref<Image>>()); - uint8_t *wd8 = data.ptrw(); + Vector<Ref<Image>> images; + images.resize(p_depth); if (p_normalize) { // Get all values and identify min/max values. - Vector<real_t> values; - values.resize(p_width * p_height); + LocalVector<real_t> values; + values.resize(p_width * p_height * p_depth); + real_t min_val = FLT_MAX; real_t max_val = -FLT_MAX; - for (int y = 0, i = 0; y < p_height; y++) { - for (int x = 0; x < p_width; x++, i++) { - values.set(i, p_in_3d_space ? get_noise_3d(x, y, p_depth) : get_noise_2d(x, y)); - if (values[i] > max_val) { - max_val = values[i]; - } - if (values[i] < min_val) { - min_val = values[i]; + int idx = 0; + for (int d = 0; d < p_depth; d++) { + for (int y = 0; y < p_height; y++) { + for (int x = 0; x < p_width; x++) { + values[idx] = p_in_3d_space ? get_noise_3d(x, y, d) : get_noise_2d(x, y); + if (values[idx] > max_val) { + max_val = values[idx]; + } + if (values[idx] < min_val) { + min_val = values[idx]; + } + idx++; } } } + idx = 0; // Normalize values and write to texture. - uint8_t ivalue; - for (int i = 0, x = 0; i < p_height; i++) { - for (int j = 0; j < p_width; j++, x++) { - if (max_val == min_val) { - ivalue = 0; - } else { - ivalue = static_cast<uint8_t>(CLAMP((values[x] - min_val) / (max_val - min_val) * 255.f, 0, 255)); - } - - if (p_invert) { - ivalue = 255 - ivalue; + for (int d = 0; d < p_depth; d++) { + Vector<uint8_t> data; + data.resize(p_width * p_height); + + uint8_t *wd8 = data.ptrw(); + uint8_t ivalue; + + for (int y = 0; y < p_height; y++) { + for (int x = 0; x < p_width; x++) { + if (max_val == min_val) { + ivalue = 0; + } else { + ivalue = static_cast<uint8_t>(CLAMP((values[idx] - min_val) / (max_val - min_val) * 255.f, 0, 255)); + } + + if (p_invert) { + ivalue = 255 - ivalue; + } + + wd8[x + y * p_width] = ivalue; + idx++; } - - wd8[x] = ivalue; } + Ref<Image> img = memnew(Image(p_width, p_height, false, Image::FORMAT_L8, data)); + images.write[d] = img; } } else { // Without normalization, the expected range of the noise function is [-1, 1]. - uint8_t ivalue; - for (int y = 0, i = 0; y < p_height; y++) { - for (int x = 0; x < p_width; x++, i++) { - float value = (p_in_3d_space ? get_noise_3d(x, y, p_depth) : get_noise_2d(x, y)); - ivalue = static_cast<uint8_t>(CLAMP(value * 127.5f + 127.5f, 0.0f, 255.0f)); - wd8[i] = p_invert ? (255 - ivalue) : ivalue; + + for (int d = 0; d < p_depth; d++) { + Vector<uint8_t> data; + data.resize(p_width * p_height); + + uint8_t *wd8 = data.ptrw(); + + uint8_t ivalue; + int idx = 0; + for (int y = 0; y < p_height; y++) { + for (int x = 0; x < p_width; x++) { + float value = (p_in_3d_space ? get_noise_3d(x, y, d) : get_noise_2d(x, y)); + ivalue = static_cast<uint8_t>(CLAMP(value * 127.5f + 127.5f, 0.0f, 255.0f)); + wd8[idx] = p_invert ? (255 - ivalue) : ivalue; + idx++; + } } + + Ref<Image> img = memnew(Image(p_width, p_height, false, Image::FORMAT_L8, data)); + images.write[d] = img; } } - return memnew(Image(p_width, p_height, false, Image::FORMAT_L8, data)); + return images; +} + +Ref<Image> Noise::get_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space, bool p_normalize) const { + Vector<Ref<Image>> images = _get_image(p_width, p_height, 1, p_invert, p_in_3d_space, p_normalize); + return images[0]; +} + +TypedArray<Image> Noise::get_image_3d(int p_width, int p_height, int p_depth, bool p_invert, bool p_normalize) const { + Vector<Ref<Image>> images = _get_image(p_width, p_height, p_depth, p_invert, true, p_normalize); + + TypedArray<Image> ret; + ret.resize(images.size()); + for (int i = 0; i < images.size(); i++) { + ret[i] = images[i]; + } + return ret; } void Noise::_bind_methods() { @@ -124,6 +186,8 @@ void Noise::_bind_methods() { ClassDB::bind_method(D_METHOD("get_noise_3dv", "v"), &Noise::get_noise_3dv); // Textures. - ClassDB::bind_method(D_METHOD("get_image", "width", "height", "depth", "invert", "in_3d_space", "normalize"), &Noise::get_image, DEFVAL(false), DEFVAL(false), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("get_seamless_image", "width", "height", "depth", "invert", "in_3d_space", "skirt", "normalize"), &Noise::get_seamless_image, DEFVAL(false), DEFVAL(false), DEFVAL(0.1), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("get_image", "width", "height", "invert", "in_3d_space", "normalize"), &Noise::get_image, DEFVAL(false), DEFVAL(false), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("get_seamless_image", "width", "height", "invert", "in_3d_space", "skirt", "normalize"), &Noise::get_seamless_image, DEFVAL(false), DEFVAL(false), DEFVAL(0.1), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("get_image_3d", "width", "height", "depth", "invert", "normalize"), &Noise::get_image_3d, DEFVAL(false), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("get_seamless_image_3d", "width", "height", "depth", "invert", "skirt", "normalize"), &Noise::get_seamless_image_3d, DEFVAL(false), DEFVAL(0.1), DEFVAL(true)); } diff --git a/modules/noise/noise.h b/modules/noise/noise.h index 856bef8c31..6c49c12bc2 100644 --- a/modules/noise/noise.h +++ b/modules/noise/noise.h @@ -32,6 +32,7 @@ #define NOISE_H #include "core/io/image.h" +#include "core/variant/typed_array.h" class Noise : public Resource { GDCLASS(Noise, Resource); @@ -81,7 +82,7 @@ class Noise : public Resource { }; template <typename T> - Ref<Image> _generate_seamless_image(Ref<Image> p_src, int p_width, int p_height, bool p_invert, real_t p_blend_skirt) const { + Vector<Ref<Image>> _generate_seamless_image(Vector<Ref<Image>> p_src, int p_width, int p_height, int p_depth, bool p_invert, real_t p_blend_skirt) const { /* To make a seamless image, we swap the quadrants so the edges are perfect matches. We initially get a 10% larger image so we have an overlap we can use to blend over the seams. @@ -101,7 +102,7 @@ class Noise : public Resource { on Source it's translated to corner of Q1/s3 unless the ALT_XY modulo moves it to Q4 */ - ERR_FAIL_COND_V(p_blend_skirt < 0, Ref<Image>()); + ERR_FAIL_COND_V(p_blend_skirt < 0, Vector<Ref<Image>>()); int skirt_width = MAX(1, p_width * p_blend_skirt); int skirt_height = MAX(1, p_height * p_blend_skirt); @@ -112,83 +113,139 @@ class Noise : public Resource { int skirt_edge_x = half_width + skirt_width; int skirt_edge_y = half_height + skirt_height; - Vector<uint8_t> dest; - dest.resize(p_width * p_height * Image::get_format_pixel_size(p_src->get_format())); - - img_buff<T> rd_src = { - (T *)p_src->get_data().ptr(), - src_width, src_height, - half_width, half_height, - p_width, p_height - }; - - // `wr` is setup for straight x/y coordinate array access. - img_buff<T> wr = { - (T *)dest.ptrw(), - p_width, p_height, - 0, 0, 0, 0 - }; - // `rd_dest` is a readable pointer to `wr`, i.e. what has already been written to the output buffer. - img_buff<T> rd_dest = { - (T *)dest.ptr(), - p_width, p_height, - 0, 0, 0, 0 - }; + Image::Format format = p_src[0]->get_format(); + int pixel_size = Image::get_format_pixel_size(format); + + Vector<Ref<Image>> images; + images.resize(p_src.size()); + + // First blend across x and y for all slices. + for (int d = 0; d < images.size(); d++) { + Vector<uint8_t> dest; + dest.resize(p_width * p_height * pixel_size); + + img_buff<T> rd_src = { + (T *)p_src[d]->get_data().ptr(), + src_width, src_height, + half_width, half_height, + p_width, p_height + }; + + // `wr` is setup for straight x/y coordinate array access. + img_buff<T> wr = { + (T *)dest.ptrw(), + p_width, p_height, + 0, 0, 0, 0 + }; + // `rd_dest` is a readable pointer to `wr`, i.e. what has already been written to the output buffer. + img_buff<T> rd_dest = { + (T *)dest.ptr(), + p_width, p_height, + 0, 0, 0, 0 + }; + + // Swap the quadrants to make edges seamless. + for (int y = 0; y < p_height; y++) { + for (int x = 0; x < p_width; x++) { + // rd_src has a half offset and the shorter modulo ignores the skirt. + // It reads and writes in Q1-4 order (see map above), skipping the skirt. + wr(x, y) = rd_src(x, y, img_buff<T>::ALT_XY); + } + } - // Swap the quadrants to make edges seamless. - for (int y = 0; y < p_height; y++) { - for (int x = 0; x < p_width; x++) { - // rd_src has a half offset and the shorter modulo ignores the skirt. - // It reads and writes in Q1-4 order (see map above), skipping the skirt. - wr(x, y) = rd_src(x, y, img_buff<T>::ALT_XY); + // Blend the vertical skirt over the middle seam. + for (int x = half_width; x < skirt_edge_x; x++) { + int alpha = 255 * (1 - Math::smoothstep(0.1f, 0.9f, float(x - half_width) / float(skirt_width))); + for (int y = 0; y < p_height; y++) { + // Skip the center square + if (y == half_height) { + y = skirt_edge_y - 1; + } else { + // Starts reading at s2, ALT_Y skips s3, and continues with s1. + wr(x, y) = _alpha_blend<T>(rd_dest(x, y), rd_src(x, y, img_buff<T>::ALT_Y), alpha); + } + } } - } - // Blend the vertical skirt over the middle seam. - for (int x = half_width; x < skirt_edge_x; x++) { - int alpha = 255 * (1 - Math::smoothstep(0.1f, 0.9f, float(x - half_width) / float(skirt_width))); - for (int y = 0; y < p_height; y++) { - // Skip the center square - if (y == half_height) { - y = skirt_edge_y - 1; - } else { - // Starts reading at s2, ALT_Y skips s3, and continues with s1. - wr(x, y) = _alpha_blend<T>(rd_dest(x, y), rd_src(x, y, img_buff<T>::ALT_Y), alpha); + // Blend the horizontal skirt over the middle seam. + for (int y = half_height; y < skirt_edge_y; y++) { + int alpha = 255 * (1 - Math::smoothstep(0.1f, 0.9f, float(y - half_height) / float(skirt_height))); + for (int x = 0; x < p_width; x++) { + // Skip the center square + if (x == half_width) { + x = skirt_edge_x - 1; + } else { + // Starts reading at s4, skips s3, continues with s5. + wr(x, y) = _alpha_blend<T>(rd_dest(x, y), rd_src(x, y, img_buff<T>::ALT_X), alpha); + } } } - } - // Blend the horizontal skirt over the middle seam. - for (int y = half_height; y < skirt_edge_y; y++) { - int alpha = 255 * (1 - Math::smoothstep(0.1f, 0.9f, float(y - half_height) / float(skirt_height))); - for (int x = 0; x < p_width; x++) { - // Skip the center square - if (x == half_width) { - x = skirt_edge_x - 1; - } else { - // Starts reading at s4, skips s3, continues with s5. - wr(x, y) = _alpha_blend<T>(rd_dest(x, y), rd_src(x, y, img_buff<T>::ALT_X), alpha); + // Fill in the center square. Wr starts at the top left of Q4, which is the equivalent of the top left of s3, unless a modulo is used. + for (int y = half_height; y < skirt_edge_y; y++) { + for (int x = half_width; x < skirt_edge_x; x++) { + int xpos = 255 * (1 - Math::smoothstep(0.1f, 0.9f, float(x - half_width) / float(skirt_width))); + int ypos = 255 * (1 - Math::smoothstep(0.1f, 0.9f, float(y - half_height) / float(skirt_height))); + + // Blend s3(Q1) onto s5(Q2) for the top half. + T top_blend = _alpha_blend<T>(rd_src(x, y, img_buff<T>::ALT_X), rd_src(x, y, img_buff<T>::DEFAULT), xpos); + // Blend s1(Q3) onto Q4 for the bottom half. + T bottom_blend = _alpha_blend<T>(rd_src(x, y, img_buff<T>::ALT_XY), rd_src(x, y, img_buff<T>::ALT_Y), xpos); + // Blend the top half onto the bottom half. + wr(x, y) = _alpha_blend<T>(bottom_blend, top_blend, ypos); } } + Ref<Image> image = memnew(Image(p_width, p_height, false, format, dest)); + p_src.write[d].unref(); + images.write[d] = image; } - // Fill in the center square. Wr starts at the top left of Q4, which is the equivalent of the top left of s3, unless a modulo is used. - for (int y = half_height; y < skirt_edge_y; y++) { - for (int x = half_width; x < skirt_edge_x; x++) { - int xpos = 255 * (1 - Math::smoothstep(0.1f, 0.9f, float(x - half_width) / float(skirt_width))); - int ypos = 255 * (1 - Math::smoothstep(0.1f, 0.9f, float(y - half_height) / float(skirt_height))); - - // Blend s3(Q1) onto s5(Q2) for the top half. - T top_blend = _alpha_blend<T>(rd_src(x, y, img_buff<T>::ALT_X), rd_src(x, y, img_buff<T>::DEFAULT), xpos); - // Blend s1(Q3) onto Q4 for the bottom half. - T bottom_blend = _alpha_blend<T>(rd_src(x, y, img_buff<T>::ALT_XY), rd_src(x, y, img_buff<T>::ALT_Y), xpos); - // Blend the top half onto the bottom half. - wr(x, y) = _alpha_blend<T>(bottom_blend, top_blend, ypos); + // Now blend across z. + if (p_depth > 1) { + int skirt_depth = MAX(1, p_depth * p_blend_skirt); + int half_depth = p_depth * 0.5; + int skirt_edge_z = half_depth + skirt_depth; + + // Swap halves on depth. + for (int i = 0; i < half_depth; i++) { + Ref<Image> img = images[i]; + images.write[i] = images[i + half_depth]; + images.write[i + half_depth] = img; } + + Vector<Ref<Image>> new_images = images; + new_images.resize(p_depth); + + // Scale seamless generation to third dimension. + for (int z = half_depth; z < skirt_edge_z; z++) { + int alpha = 255 * (1 - Math::smoothstep(0.1f, 0.9f, float(z - half_depth) / float(skirt_depth))); + + Vector<uint8_t> img = images[z % p_depth]->get_data(); + Vector<uint8_t> skirt = images[(z - half_depth) + p_depth]->get_data(); + + Vector<uint8_t> dest; + dest.resize(images[0]->get_width() * images[0]->get_height() * Image::get_format_pixel_size(images[0]->get_format())); + + for (int i = 0; i < img.size(); i++) { + uint8_t fg, bg, out; + + fg = skirt[i]; + bg = img[i]; + + uint16_t a = alpha + 1; + uint16_t inv_a = 256 - alpha; + + out = (uint8_t)((a * fg + inv_a * bg) >> 8); + + dest.write[i] = out; + } + + Ref<Image> new_image = memnew(Image(images[0]->get_width(), images[0]->get_height(), false, images[0]->get_format(), dest)); + new_images.write[z % p_depth] = new_image; + } + return new_images; } - Ref<Image> image = memnew(Image(p_width, p_height, false, p_src->get_format(), dest)); - p_src.unref(); - return image; + return images; } template <typename T> @@ -233,8 +290,13 @@ public: virtual real_t get_noise_3dv(Vector3 p_v) const = 0; virtual real_t get_noise_3d(real_t p_x, real_t p_y, real_t p_z) const = 0; - virtual Ref<Image> get_image(int p_width, int p_height, int p_depth, bool p_invert = false, bool p_in_3d_space = false, bool p_normalize = true) const; - virtual Ref<Image> get_seamless_image(int p_width, int p_height, int p_depth, bool p_invert = false, bool p_in_3d_space = false, real_t p_blend_skirt = 0.1, bool p_normalize = true) const; + Vector<Ref<Image>> _get_image(int p_width, int p_height, int p_depth, bool p_invert = false, bool p_in_3d_space = false, bool p_normalize = true) const; + virtual Ref<Image> get_image(int p_width, int p_height, bool p_invert = false, bool p_in_3d_space = false, bool p_normalize = true) const; + virtual TypedArray<Image> get_image_3d(int p_width, int p_height, int p_depth, bool p_invert = false, bool p_normalize = true) const; + + Vector<Ref<Image>> _get_seamless_image(int p_width, int p_height, int p_depth, bool p_invert = false, bool p_in_3d_space = false, real_t p_blend_skirt = 0.1, bool p_normalize = true) const; + virtual Ref<Image> get_seamless_image(int p_width, int p_height, bool p_invert = false, bool p_in_3d_space = false, real_t p_blend_skirt = 0.1, bool p_normalize = true) const; + virtual TypedArray<Image> get_seamless_image_3d(int p_width, int p_height, int p_depth, bool p_invert = false, real_t p_blend_skirt = 0.1, bool p_normalize = true) const; }; #endif // NOISE_H diff --git a/modules/noise/noise_texture_2d.cpp b/modules/noise/noise_texture_2d.cpp index a31f77a38d..e4b2e0b4ac 100644 --- a/modules/noise/noise_texture_2d.cpp +++ b/modules/noise/noise_texture_2d.cpp @@ -162,9 +162,9 @@ Ref<Image> NoiseTexture2D::_generate_texture() { Ref<Image> new_image; if (seamless) { - new_image = ref_noise->get_seamless_image(size.x, size.y, 0, invert, in_3d_space, seamless_blend_skirt, normalize); + new_image = ref_noise->get_seamless_image(size.x, size.y, invert, in_3d_space, seamless_blend_skirt, normalize); } else { - new_image = ref_noise->get_image(size.x, size.y, 0, invert, in_3d_space, normalize); + new_image = ref_noise->get_image(size.x, size.y, invert, in_3d_space, normalize); } if (color_ramp.is_valid()) { new_image = _modulate_with_gradient(new_image, color_ramp); diff --git a/modules/noise/noise_texture_3d.cpp b/modules/noise/noise_texture_3d.cpp index 58403397de..25d75b8ffb 100644 --- a/modules/noise/noise_texture_3d.cpp +++ b/modules/noise/noise_texture_3d.cpp @@ -44,7 +44,9 @@ NoiseTexture3D::~NoiseTexture3D() { if (texture.is_valid()) { RS::get_singleton()->free(texture); } - noise_thread.wait_to_finish(); + if (noise_thread.is_started()) { + noise_thread.wait_to_finish(); + } } void NoiseTexture3D::_bind_methods() { @@ -147,18 +149,9 @@ TypedArray<Image> NoiseTexture3D::_generate_texture() { Vector<Ref<Image>> images; if (seamless) { - images = _get_seamless(width, height, depth, invert, seamless_blend_skirt); + images = ref_noise->_get_seamless_image(width, height, depth, invert, true, seamless_blend_skirt, normalize); } else { - images.resize(depth); - - for (int i = 0; i < images.size(); i++) { - images.write[i] = ref_noise->get_image(width, height, i, invert, true, false); - } - } - - // Normalize on whole texture at once rather than on each image individually as it would result in visible artifacts on z (depth) axis. - if (normalize) { - images = _normalize(images); + images = ref_noise->_get_image(width, height, depth, invert, true, normalize); } if (color_ramp.is_valid()) { @@ -177,116 +170,6 @@ TypedArray<Image> NoiseTexture3D::_generate_texture() { return new_data; } -Vector<Ref<Image>> NoiseTexture3D::_get_seamless(int p_width, int p_height, int p_depth, bool p_invert, real_t p_blend_skirt) { - // Prevent memdelete due to unref() on other thread. - Ref<Noise> ref_noise = noise; - - if (ref_noise.is_null()) { - return Vector<Ref<Image>>(); - } - - int skirt_depth = MAX(1, p_depth * p_blend_skirt); - int src_depth = p_depth + skirt_depth; - - Vector<Ref<Image>> images; - images.resize(src_depth); - - for (int i = 0; i < src_depth; i++) { - images.write[i] = ref_noise->get_seamless_image(p_width, p_height, i, p_invert, true, p_blend_skirt, false); - } - - int half_depth = p_depth * 0.5; - int skirt_edge_z = half_depth + skirt_depth; - - // swap halves on depth. - for (int i = 0; i < half_depth; i++) { - Ref<Image> img = images[i]; - images.write[i] = images[i + half_depth]; - images.write[i + half_depth] = img; - } - - Vector<Ref<Image>> new_images = images; - new_images.resize(p_depth); - - // scale seamless generation to third dimension. - for (int z = half_depth; z < skirt_edge_z; z++) { - int alpha = 255 * (1 - Math::smoothstep(0.1f, 0.9f, float(z - half_depth) / float(skirt_depth))); - - Vector<uint8_t> img = images[z % p_depth]->get_data(); - Vector<uint8_t> skirt = images[(z - half_depth) + p_depth]->get_data(); - - Vector<uint8_t> dest; - dest.resize(images[0]->get_width() * images[0]->get_height() * Image::get_format_pixel_size(images[0]->get_format())); - - for (int i = 0; i < img.size(); i++) { - uint8_t fg, bg, out; - - fg = skirt[i]; - bg = img[i]; - - uint16_t a; - uint16_t inv_a; - - a = alpha + 1; - inv_a = 256 - alpha; - - out = (uint8_t)((a * fg + inv_a * bg) >> 8); - - dest.write[i] = out; - } - - Ref<Image> new_image = memnew(Image(images[0]->get_width(), images[0]->get_height(), false, images[0]->get_format(), dest)); - new_images.write[z % p_depth] = new_image; - } - - return new_images; -} - -Vector<Ref<Image>> NoiseTexture3D::_normalize(Vector<Ref<Image>> p_images) { - real_t min_val = FLT_MAX; - real_t max_val = -FLT_MAX; - - int w = p_images[0]->get_width(); - int h = p_images[0]->get_height(); - - for (int i = 0; i < p_images.size(); i++) { - Vector<uint8_t> data = p_images[i]->get_data(); - - for (int j = 0; j < data.size(); j++) { - if (data[j] > max_val) { - max_val = data[j]; - } - if (data[j] < min_val) { - min_val = data[j]; - } - } - } - - Vector<Ref<Image>> new_images; - new_images.resize(p_images.size()); - - for (int i = 0; i < p_images.size(); i++) { - Vector<uint8_t> data = p_images[i]->get_data(); - - for (int j = 0; j < data.size(); j++) { - uint8_t value; - - if (max_val == min_val) { - value = 0; - } else { - value = static_cast<uint8_t>(CLAMP((data[j] - min_val) / (max_val - min_val) * 255.f, 0, 255)); - } - - data.write[j] = value; - } - - Ref<Image> new_image = memnew(Image(w, h, false, Image::FORMAT_L8, data)); - new_images.write[i] = new_image; - } - - return new_images; -} - Ref<Image> NoiseTexture3D::_modulate_with_gradient(Ref<Image> p_image, Ref<Gradient> p_gradient) { int w = p_image->get_width(); int h = p_image->get_height(); diff --git a/modules/noise/noise_texture_3d.h b/modules/noise/noise_texture_3d.h index b5dab10321..397711ca98 100644 --- a/modules/noise/noise_texture_3d.h +++ b/modules/noise/noise_texture_3d.h @@ -68,8 +68,6 @@ private: void _update_texture(); void _set_texture_data(const TypedArray<Image> &p_data); - Vector<Ref<Image>> _get_seamless(int p_width, int p_height, int p_depth, bool p_invert, real_t p_blend_skirt); - Vector<Ref<Image>> _normalize(Vector<Ref<Image>> p_images); Ref<Image> _modulate_with_gradient(Ref<Image> p_image, Ref<Gradient> p_gradient); protected: diff --git a/modules/noise/tests/test_fastnoise_lite.h b/modules/noise/tests/test_fastnoise_lite.h index db489c6672..0a435c6a5c 100644 --- a/modules/noise/tests/test_fastnoise_lite.h +++ b/modules/noise/tests/test_fastnoise_lite.h @@ -605,7 +605,7 @@ TEST_CASE("[FastNoiseLite] Generating seamless 2D images (11x11px) and compare t noise.set_cellular_jitter(0.0); SUBCASE("Blend skirt 0.0") { - Ref<Image> img = noise.get_seamless_image(11, 11, 0, false, false, 0.0); + Ref<Image> img = noise.get_seamless_image(11, 11, false, false, 0.0); Ref<Image> ref_img_1 = memnew(Image); ref_img_1->set_data(11, 11, false, Image::FORMAT_L8, ref_img_1_data); @@ -614,7 +614,7 @@ TEST_CASE("[FastNoiseLite] Generating seamless 2D images (11x11px) and compare t } SUBCASE("Blend skirt 0.1") { - Ref<Image> img = noise.get_seamless_image(11, 11, 0, false, false, 0.1); + Ref<Image> img = noise.get_seamless_image(11, 11, false, false, 0.1); Ref<Image> ref_img_2 = memnew(Image); ref_img_2->set_data(11, 11, false, Image::FORMAT_L8, ref_img_2_data); @@ -623,7 +623,7 @@ TEST_CASE("[FastNoiseLite] Generating seamless 2D images (11x11px) and compare t } SUBCASE("Blend skirt 1.0") { - Ref<Image> img = noise.get_seamless_image(11, 11, 0, false, false, 0.1); + Ref<Image> img = noise.get_seamless_image(11, 11, false, false, 0.1); Ref<Image> ref_img_3 = memnew(Image); ref_img_3->set_data(11, 11, false, Image::FORMAT_L8, ref_img_3_data); diff --git a/modules/openxr/action_map/openxr_action_map.cpp b/modules/openxr/action_map/openxr_action_map.cpp index d2f6be2233..63abbf0d71 100644 --- a/modules/openxr/action_map/openxr_action_map.cpp +++ b/modules/openxr/action_map/openxr_action_map.cpp @@ -415,7 +415,7 @@ void OpenXRActionMap::create_default_action_sets() { profile->add_new_binding(grip_pose, "/user/hand/left/input/grip/pose,/user/hand/right/input/grip/pose"); profile->add_new_binding(palm_pose, "/user/hand/left/input/palm_ext/pose,/user/hand/right/input/palm_ext/pose"); profile->add_new_binding(menu_button, "/user/hand/left/input/menu/click"); - profile->add_new_binding(select_button, "/user/hand/left/input/system/click"); // we'll map system to select + profile->add_new_binding(select_button, "/user/hand/right/input/system/click"); // we'll map system to select profile->add_new_binding(ax_button, "/user/hand/left/input/x/click,/user/hand/right/input/a/click"); // x on left hand, a on right hand profile->add_new_binding(by_button, "/user/hand/left/input/y/click,/user/hand/right/input/b/click"); // y on left hand, b on right hand profile->add_new_binding(trigger, "/user/hand/left/input/trigger/value,/user/hand/right/input/trigger/value"); @@ -439,7 +439,7 @@ void OpenXRActionMap::create_default_action_sets() { profile->add_new_binding(grip_pose, "/user/hand/left/input/grip/pose,/user/hand/right/input/grip/pose"); profile->add_new_binding(palm_pose, "/user/hand/left/input/palm_ext/pose,/user/hand/right/input/palm_ext/pose"); profile->add_new_binding(menu_button, "/user/hand/left/input/menu/click"); - profile->add_new_binding(select_button, "/user/hand/left/input/system/click"); // we'll map system to select + profile->add_new_binding(select_button, "/user/hand/right/input/system/click"); // we'll map system to select profile->add_new_binding(ax_button, "/user/hand/left/input/x/click,/user/hand/right/input/a/click"); // x on left hand, a on right hand profile->add_new_binding(by_button, "/user/hand/left/input/y/click,/user/hand/right/input/b/click"); // y on left hand, b on right hand profile->add_new_binding(trigger, "/user/hand/left/input/trigger/value,/user/hand/right/input/trigger/value"); diff --git a/modules/openxr/extensions/openxr_htc_controller_extension.cpp b/modules/openxr/extensions/openxr_htc_controller_extension.cpp index 4d141b0695..116762ee8d 100644 --- a/modules/openxr/extensions/openxr_htc_controller_extension.cpp +++ b/modules/openxr/extensions/openxr_htc_controller_extension.cpp @@ -108,7 +108,7 @@ void OpenXRHTCControllerExtension::on_register_metadata() { metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Trigger touch", "/user/hand/left", "/user/hand/left/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL); metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Trigger", "/user/hand/right", "/user/hand/right/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT); metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Trigger click", "/user/hand/right", "/user/hand/right/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL); - metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Trigger touch", "/user/hand/right", "/user/hand/right/input/trigger/touch ", "", OpenXRAction::OPENXR_ACTION_BOOL); + metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Trigger touch", "/user/hand/right", "/user/hand/right/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL); metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Squeeze click", "/user/hand/left", "/user/hand/left/input/squeeze/click", "", OpenXRAction::OPENXR_ACTION_BOOL); metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Squeeze touch", "/user/hand/left", "/user/hand/left/input/squeeze/touch", "", OpenXRAction::OPENXR_ACTION_BOOL); @@ -122,6 +122,7 @@ void OpenXRHTCControllerExtension::on_register_metadata() { metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Thumbstick click", "/user/hand/right", "/user/hand/right/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL); metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Thumbstick touch", "/user/hand/right", "/user/hand/right/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL); + metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Thumbrest touch", "/user/hand/left", "/user/hand/left/input/thumbrest/touch", "", OpenXRAction::OPENXR_ACTION_BOOL); metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Thumbrest touch", "/user/hand/right", "/user/hand/right/input/thumbrest/touch", "", OpenXRAction::OPENXR_ACTION_BOOL); metadata->register_io_path("/interaction_profiles/htc/vive_focus3_controller", "Haptic output", "/user/hand/left", "/user/hand/left/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC); diff --git a/platform/android/doc_classes/EditorExportPlatformAndroid.xml b/platform/android/doc_classes/EditorExportPlatformAndroid.xml index 570e8f01f1..1a07774287 100644 --- a/platform/android/doc_classes/EditorExportPlatformAndroid.xml +++ b/platform/android/doc_classes/EditorExportPlatformAndroid.xml @@ -153,7 +153,7 @@ Must be required by a HostApduService or OffHostApduService to ensure that only the system can bind to it. See [url=https://developer.android.com/reference/android/Manifest.permission#BIND_NFC_SERVICE]BIND_NFC_SERVICE[/url]. </member> <member name="permissions/bind_notification_listener_service" type="bool" setter="" getter=""> - Must be required by an NotificationListenerService, to ensure that only the system can bind to it. See [url=https://developer.android.com/reference/android/Manifest.permission#BIND_NOTIFICATION_LISTENER_SERVICE]BIND_NOTIFICATION_LISTENER_SERVICE[/url]. + Must be required by a NotificationListenerService, to ensure that only the system can bind to it. See [url=https://developer.android.com/reference/android/Manifest.permission#BIND_NOTIFICATION_LISTENER_SERVICE]BIND_NOTIFICATION_LISTENER_SERVICE[/url]. </member> <member name="permissions/bind_print_service" type="bool" setter="" getter=""> Must be required by a PrintService, to ensure that only the system can bind to it. See [url=https://developer.android.com/reference/android/Manifest.permission#BIND_PRINT_SERVICE]BIND_PRINT_SERVICE[/url]. diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index 71339c9443..18091649e3 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -446,39 +446,29 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *en Object *obj = ObjectDB::get_instance(ObjectID(ID)); ERR_FAIL_NULL(obj); - int res = env->PushLocalFrame(16); - ERR_FAIL_COND(res != 0); - String str_method = jstring_to_string(method, env); int count = env->GetArrayLength(params); + Variant *vlist = (Variant *)alloca(sizeof(Variant) * count); - Variant **vptr = (Variant **)alloca(sizeof(Variant *) * count); + const Variant **vptr = (const Variant **)alloca(sizeof(Variant *) * count); + for (int i = 0; i < count; i++) { jobject jobj = env->GetObjectArrayElement(params, i); - Variant v; - if (jobj) { - v = _jobject_to_variant(env, jobj); - } - memnew_placement(&vlist[i], Variant); - vlist[i] = v; + ERR_FAIL_NULL(jobj); + memnew_placement(&vlist[i], Variant(_jobject_to_variant(env, jobj))); vptr[i] = &vlist[i]; env->DeleteLocalRef(jobj); } Callable::CallError err; - obj->callp(str_method, (const Variant **)vptr, count, err); - - env->PopLocalFrame(nullptr); + obj->callp(str_method, vptr, count, err); } JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jclass clazz, jlong ID, jstring method, jobjectArray params) { Object *obj = ObjectDB::get_instance(ObjectID(ID)); ERR_FAIL_NULL(obj); - int res = env->PushLocalFrame(16); - ERR_FAIL_COND(res != 0); - String str_method = jstring_to_string(method, env); int count = env->GetArrayLength(params); @@ -488,16 +478,13 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv * for (int i = 0; i < count; i++) { jobject jobj = env->GetObjectArrayElement(params, i); - if (jobj) { - args[i] = _jobject_to_variant(env, jobj); - } - env->DeleteLocalRef(jobj); + ERR_FAIL_NULL(jobj); + memnew_placement(&args[i], Variant(_jobject_to_variant(env, jobj))); argptrs[i] = &args[i]; + env->DeleteLocalRef(jobj); } - MessageQueue::get_singleton()->push_callp(obj, str_method, (const Variant **)argptrs, count); - - env->PopLocalFrame(nullptr); + MessageQueue::get_singleton()->push_callp(obj, str_method, argptrs, count); } JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_requestPermissionResult(JNIEnv *env, jclass clazz, jstring p_permission, jboolean p_result) { diff --git a/platform/android/plugin/godot_plugin_jni.cpp b/platform/android/plugin/godot_plugin_jni.cpp index 4bb90cb971..843c015d49 100644 --- a/platform/android/plugin/godot_plugin_jni.cpp +++ b/platform/android/plugin/godot_plugin_jni.cpp @@ -120,7 +120,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeEmitS for (int i = 0; i < count; i++) { jobject j_param = env->GetObjectArrayElement(j_signal_params, i); - variant_params[i] = _jobject_to_variant(env, j_param); + ERR_FAIL_NULL(j_param); + memnew_placement(&variant_params[i], Variant(_jobject_to_variant(env, j_param))); args[i] = &variant_params[i]; env->DeleteLocalRef(j_param); } diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index c678b4bf02..1b59351b30 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -907,9 +907,7 @@ void RigidBody2D::_notification(int p_what) { } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { - if (Engine::get_singleton()->is_editor_hint()) { - update_configuration_warnings(); - } + update_configuration_warnings(); } break; } #endif diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp index 19d1b83cab..6d8d60dcaa 100644 --- a/scene/3d/collision_object_3d.cpp +++ b/scene/3d/collision_object_3d.cpp @@ -83,13 +83,9 @@ void CollisionObject3D::_notification(int p_what) { _update_pickable(); } break; -#ifdef TOOLS_ENABLED case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { - if (Engine::get_singleton()->is_editor_hint()) { - update_configuration_warnings(); - } + update_configuration_warnings(); } break; -#endif case NOTIFICATION_TRANSFORM_CHANGED: { if (only_update_transform_changes) { diff --git a/scene/3d/collision_polygon_3d.cpp b/scene/3d/collision_polygon_3d.cpp index 53a61c1368..9a2ed00274 100644 --- a/scene/3d/collision_polygon_3d.cpp +++ b/scene/3d/collision_polygon_3d.cpp @@ -104,11 +104,7 @@ void CollisionPolygon3D::_notification(int p_what) { if (parent) { _update_in_shape_owner(true); } -#ifdef TOOLS_ENABLED - if (Engine::get_singleton()->is_editor_hint()) { - update_configuration_warnings(); - } -#endif + update_configuration_warnings(); } break; case NOTIFICATION_UNPARENTED: { diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp index f1d918ad9b..b7f3b12c25 100644 --- a/scene/3d/collision_shape_3d.cpp +++ b/scene/3d/collision_shape_3d.cpp @@ -99,11 +99,7 @@ void CollisionShape3D::_notification(int p_what) { if (parent) { _update_in_shape_owner(true); } -#ifdef TOOLS_ENABLED - if (Engine::get_singleton()->is_editor_hint()) { - update_configuration_warnings(); - } -#endif + update_configuration_warnings(); } break; case NOTIFICATION_UNPARENTED: { diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp index 16c82bf6d2..18198b566e 100644 --- a/scene/3d/light_3d.cpp +++ b/scene/3d/light_3d.cpp @@ -284,6 +284,9 @@ void Light3D::_update_visibility() { void Light3D::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_TRANSFORM_CHANGED: { + update_configuration_warnings(); + } break; case NOTIFICATION_VISIBILITY_CHANGED: case NOTIFICATION_ENTER_TREE: { _update_visibility(); diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index aafc23193e..85633c1dc7 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -374,6 +374,10 @@ NavigationRegion3D::NavigationRegion3D() { } NavigationRegion3D::~NavigationRegion3D() { + if (bake_thread.is_started()) { + bake_thread.wait_to_finish(); + } + if (navigation_mesh.is_valid()) { navigation_mesh->disconnect("changed", callable_mp(this, &NavigationRegion3D::_navigation_changed)); } diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index b7d63258db..4be695d189 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -599,9 +599,7 @@ void RigidBody3D::_notification(int p_what) { } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { - if (Engine::get_singleton()->is_editor_hint()) { - update_configuration_warnings(); - } + update_configuration_warnings(); } break; } #endif diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 70d87e221c..46ac8187c4 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -233,13 +233,13 @@ void Button::_notification(int p_what) { } Rect2 icon_region; - HorizontalAlignment icon_align_rtl_checked = icon_alignment; + HorizontalAlignment icon_align_rtl_checked = horizontal_icon_alignment; HorizontalAlignment align_rtl_checked = alignment; // Swap icon and text alignment sides if right-to-left layout is set. if (rtl) { - if (icon_alignment == HORIZONTAL_ALIGNMENT_RIGHT) { + if (horizontal_icon_alignment == HORIZONTAL_ALIGNMENT_RIGHT) { icon_align_rtl_checked = HORIZONTAL_ALIGNMENT_LEFT; - } else if (icon_alignment == HORIZONTAL_ALIGNMENT_LEFT) { + } else if (horizontal_icon_alignment == HORIZONTAL_ALIGNMENT_LEFT) { icon_align_rtl_checked = HORIZONTAL_ALIGNMENT_RIGHT; } if (alignment == HORIZONTAL_ALIGNMENT_RIGHT) { @@ -251,6 +251,14 @@ void Button::_notification(int p_what) { if (!_icon.is_null()) { int valign = size.height - style->get_minimum_size().y; + int voffset = 0; + Size2 icon_size = _icon->get_size(); + + // Fix vertical size. + if (vertical_icon_alignment != VERTICAL_ALIGNMENT_CENTER) { + valign -= text_buf->get_size().height; + } + float icon_ofs_region = 0.0; Point2 style_offset; if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_LEFT) { @@ -268,7 +276,6 @@ void Button::_notification(int p_what) { } style_offset.y = style->get_margin(SIDE_TOP); - Size2 icon_size = _icon->get_size(); if (expand_icon) { Size2 _size = get_size() - style->get_offset() * 2; int icon_text_separation = text.is_empty() ? 0 : theme_cache.h_separation; @@ -276,6 +283,9 @@ void Button::_notification(int p_what) { if (!clip_text && icon_align_rtl_checked != HORIZONTAL_ALIGNMENT_CENTER) { _size.width -= text_buf->get_size().width; } + if (vertical_icon_alignment != VERTICAL_ALIGNMENT_CENTER) { + _size.height -= text_buf->get_size().height; + } float icon_width = _icon->get_width() * _size.height / _icon->get_height(); float icon_height = _size.height; @@ -288,12 +298,19 @@ void Button::_notification(int p_what) { } icon_size = _fit_icon_size(icon_size); + if (vertical_icon_alignment == VERTICAL_ALIGNMENT_TOP) { + voffset = -(valign - icon_size.y) / 2; + } + if (vertical_icon_alignment == VERTICAL_ALIGNMENT_BOTTOM) { + voffset = (valign - icon_size.y) / 2 + text_buf->get_size().y; + } + if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_LEFT) { - icon_region = Rect2(style_offset + Point2(icon_ofs_region, Math::floor((valign - icon_size.y) * 0.5)), icon_size); + icon_region = Rect2(style_offset + Point2(icon_ofs_region, voffset + Math::floor((valign - icon_size.y) * 0.5)), icon_size); } else if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_CENTER) { - icon_region = Rect2(style_offset + Point2(icon_ofs_region + Math::floor((size.x - icon_size.x) * 0.5), Math::floor((valign - icon_size.y) * 0.5)), icon_size); + icon_region = Rect2(style_offset + Point2(icon_ofs_region + Math::floor((size.x - icon_size.x) * 0.5), voffset + Math::floor((valign - icon_size.y) * 0.5)), icon_size); } else { - icon_region = Rect2(style_offset + Point2(icon_ofs_region + size.x - icon_size.x, Math::floor((valign - icon_size.y) * 0.5)), icon_size); + icon_region = Rect2(style_offset + Point2(icon_ofs_region + size.x - icon_size.x, voffset + Math::floor((valign - icon_size.y) * 0.5)), icon_size); } if (icon_region.size.width > 0) { @@ -320,6 +337,13 @@ void Button::_notification(int p_what) { Point2 text_ofs = (size - style->get_minimum_size() - icon_ofs - text_buf->get_size() - Point2(_internal_margin[SIDE_RIGHT] - _internal_margin[SIDE_LEFT], 0)) / 2.0; + if (vertical_icon_alignment == VERTICAL_ALIGNMENT_TOP) { + text_ofs.y += icon_region.size.height / 2; + } + if (vertical_icon_alignment == VERTICAL_ALIGNMENT_BOTTOM) { + text_ofs.y -= icon_region.size.height / 2; + } + text_buf->set_alignment(align_rtl_checked); text_buf->set_width(text_width); switch (align_rtl_checked) { @@ -395,9 +419,13 @@ Size2 Button::get_minimum_size_for_text_and_icon(const String &p_text, Ref<Textu if (!expand_icon && p_icon.is_valid()) { Size2 icon_size = _fit_icon_size(p_icon->get_size()); - minsize.height = MAX(minsize.height, icon_size.height); + if (vertical_icon_alignment == VERTICAL_ALIGNMENT_CENTER) { + minsize.height = MAX(minsize.height, icon_size.height); + } else { + minsize.height += icon_size.height; + } - if (icon_alignment != HORIZONTAL_ALIGNMENT_CENTER) { + if (horizontal_icon_alignment != HORIZONTAL_ALIGNMENT_CENTER) { minsize.width += icon_size.width; if (!xl_text.is_empty() || !p_text.is_empty()) { minsize.width += MAX(0, theme_cache.h_separation); @@ -410,7 +438,11 @@ Size2 Button::get_minimum_size_for_text_and_icon(const String &p_text, Ref<Textu if (!xl_text.is_empty() || !p_text.is_empty()) { Ref<Font> font = theme_cache.font; float font_height = font->get_height(theme_cache.font_size); - minsize.height = MAX(font_height, minsize.height); + if (vertical_icon_alignment == VERTICAL_ALIGNMENT_CENTER) { + minsize.height = MAX(font_height, minsize.height); + } else { + minsize.height += font_height; + } } return theme_cache.normal->get_minimum_size() + minsize; @@ -556,13 +588,23 @@ HorizontalAlignment Button::get_text_alignment() const { } void Button::set_icon_alignment(HorizontalAlignment p_alignment) { - icon_alignment = p_alignment; + horizontal_icon_alignment = p_alignment; + update_minimum_size(); + queue_redraw(); +} + +void Button::set_vertical_icon_alignment(VerticalAlignment p_alignment) { + vertical_icon_alignment = p_alignment; update_minimum_size(); queue_redraw(); } HorizontalAlignment Button::get_icon_alignment() const { - return icon_alignment; + return horizontal_icon_alignment; +} + +VerticalAlignment Button::get_vertical_icon_alignment() const { + return vertical_icon_alignment; } void Button::_bind_methods() { @@ -584,6 +626,8 @@ void Button::_bind_methods() { ClassDB::bind_method(D_METHOD("get_text_alignment"), &Button::get_text_alignment); ClassDB::bind_method(D_METHOD("set_icon_alignment", "icon_alignment"), &Button::set_icon_alignment); ClassDB::bind_method(D_METHOD("get_icon_alignment"), &Button::get_icon_alignment); + ClassDB::bind_method(D_METHOD("set_vertical_icon_alignment", "vertical_icon_alignment"), &Button::set_vertical_icon_alignment); + ClassDB::bind_method(D_METHOD("get_vertical_icon_alignment"), &Button::get_vertical_icon_alignment); ClassDB::bind_method(D_METHOD("set_expand_icon", "enabled"), &Button::set_expand_icon); ClassDB::bind_method(D_METHOD("is_expand_icon"), &Button::is_expand_icon); @@ -598,6 +642,7 @@ void Button::_bind_methods() { ADD_GROUP("Icon Behavior", ""); ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_icon_alignment", "get_icon_alignment"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "vertical_icon_alignment", PROPERTY_HINT_ENUM, "Top,Center,Bottom"), "set_vertical_icon_alignment", "get_vertical_icon_alignment"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "expand_icon"), "set_expand_icon", "is_expand_icon"); ADD_GROUP("BiDi", ""); diff --git a/scene/gui/button.h b/scene/gui/button.h index 3634b5344c..733f40c84e 100644 --- a/scene/gui/button.h +++ b/scene/gui/button.h @@ -51,7 +51,8 @@ private: bool expand_icon = false; bool clip_text = false; HorizontalAlignment alignment = HORIZONTAL_ALIGNMENT_CENTER; - HorizontalAlignment icon_alignment = HORIZONTAL_ALIGNMENT_LEFT; + HorizontalAlignment horizontal_icon_alignment = HORIZONTAL_ALIGNMENT_LEFT; + VerticalAlignment vertical_icon_alignment = VERTICAL_ALIGNMENT_CENTER; float _internal_margin[4] = {}; struct ThemeCache { @@ -135,7 +136,9 @@ public: HorizontalAlignment get_text_alignment() const; void set_icon_alignment(HorizontalAlignment p_alignment); + void set_vertical_icon_alignment(VerticalAlignment p_alignment); HorizontalAlignment get_icon_alignment() const; + VerticalAlignment get_vertical_icon_alignment() const; Button(const String &p_text = String()); ~Button(); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index b7dc1c4fbe..5e861ba45d 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -1913,34 +1913,23 @@ void ColorPickerButton::_modal_closed() { void ColorPickerButton::pressed() { _update_picker(); - Size2 size = get_size() * get_viewport()->get_canvas_transform().get_scale(); + Size2 minsize = popup->get_contents_minimum_size(); + float viewport_height = get_viewport_rect().size.y; popup->reset_size(); picker->_update_presets(); picker->_update_recent_presets(); - Rect2i usable_rect = popup->get_usable_parent_rect(); - //let's try different positions to see which one we can use - - Rect2i cp_rect(Point2i(), popup->get_size()); - for (int i = 0; i < 4; i++) { - if (i > 1) { - cp_rect.position.y = get_screen_position().y - cp_rect.size.y; - } else { - cp_rect.position.y = get_screen_position().y + size.height; - } - - if (i & 1) { - cp_rect.position.x = get_screen_position().x; - } else { - cp_rect.position.x = get_screen_position().x - MAX(0, (cp_rect.size.x - size.x)); - } - - if (usable_rect.encloses(cp_rect)) { - break; - } + // Determine in which direction to show the popup. By default popup horizontally centered below the button. + // But if the popup doesn't fit below and the button is in the bottom half of the viewport, show above. + bool show_above = false; + if (get_global_position().y + get_size().y + minsize.y > viewport_height && get_global_position().y * 2 + get_size().y > viewport_height) { + show_above = true; } - popup->set_position(cp_rect.position); + + float h_offset = (get_size().x - minsize.x) / 2; + float v_offset = show_above ? -minsize.y : get_size().y; + popup->set_position(get_screen_position() + Vector2(h_offset, v_offset)); popup->popup(); picker->set_focus_on_line_edit(); } diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 818e19ab29..1b148defc1 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -564,12 +564,12 @@ void TabContainer::add_child_notify(Node *p_child) { } void TabContainer::move_child_notify(Node *p_child) { + Container::move_child_notify(p_child); + if (p_child == tab_bar) { return; } - Container::move_child_notify(p_child); - Control *c = Object::cast_to<Control>(p_child); if (c && !c->is_set_as_top_level()) { int old_idx = -1; @@ -588,12 +588,12 @@ void TabContainer::move_child_notify(Node *p_child) { } void TabContainer::remove_child_notify(Node *p_child) { + Container::remove_child_notify(p_child); + if (p_child == tab_bar) { return; } - Container::remove_child_notify(p_child); - Control *c = Object::cast_to<Control>(p_child); if (!c || c->is_set_as_top_level()) { return; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 1564f9bc62..e29f044537 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1851,23 +1851,28 @@ void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input) { Point2i pos = get_line_column_at_pos(mpos); int row = pos.y; int col = pos.x; - int caret = carets.size() - 1; + bool selection_clicked = false; if (is_move_caret_on_right_click_enabled()) { - if (has_selection(caret)) { - int from_line = get_selection_from_line(caret); - int to_line = get_selection_to_line(caret); - int from_column = get_selection_from_column(caret); - int to_column = get_selection_to_column(caret); - - if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) { - // Right click is outside the selected text. - deselect(caret); + if (has_selection()) { + for (int i = 0; i < get_caret_count(); i++) { + int from_line = get_selection_from_line(i); + int to_line = get_selection_to_line(i); + int from_column = get_selection_from_column(i); + int to_column = get_selection_to_column(i); + + if (row >= from_line && row <= to_line && (row != from_line || col >= from_column) && (row != to_line || col <= to_column)) { + // Right click in one of the selected text + selection_clicked = true; + break; + } } } - if (!has_selection(caret)) { - set_caret_line(row, true, false, 0, caret); - set_caret_column(col, true, caret); + if (!selection_clicked) { + deselect(); + remove_secondary_carets(); + set_caret_line(row, false, false); + set_caret_column(col); } merge_overlapping_carets(); } diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index 71602d6243..279ac7953d 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -569,8 +569,7 @@ void CanvasItem::draw_line(const Point2 &p_from, const Point2 &p_to, const Color void CanvasItem::draw_polyline(const Vector<Point2> &p_points, const Color &p_color, real_t p_width, bool p_antialiased) { ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); - Vector<Color> colors; - colors.push_back(p_color); + Vector<Color> colors = { p_color }; RenderingServer::get_singleton()->canvas_item_add_polyline(canvas_item, p_points, colors, p_width, p_antialiased); } @@ -598,8 +597,7 @@ void CanvasItem::draw_arc(const Vector2 &p_center, real_t p_radius, real_t p_sta void CanvasItem::draw_multiline(const Vector<Point2> &p_points, const Color &p_color, real_t p_width) { ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); - Vector<Color> colors; - colors.push_back(p_color); + Vector<Color> colors = { p_color }; RenderingServer::get_singleton()->canvas_item_add_multiline(canvas_item, p_points, colors, p_width); } @@ -727,8 +725,7 @@ void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture) { ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); - Vector<Color> colors; - colors.push_back(p_color); + Vector<Color> colors = { p_color }; RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID(); RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, colors, p_uvs, rid); } diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 3deb1ccaab..d0aa224773 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -211,6 +211,7 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const { shader->get_shader_uniform_list(&list, true); HashMap<String, HashMap<String, List<PropertyInfo>>> groups; + LocalVector<Pair<String, LocalVector<String>>> vgroups; { HashMap<String, List<PropertyInfo>> none_subgroup; none_subgroup.insert("<None>", List<PropertyInfo>()); @@ -248,6 +249,7 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const { subgroup_map.insert("<None>", none_subgroup); groups.insert(last_group, subgroup_map); + vgroups.push_back(Pair<String, LocalVector<String>>(last_group, { "<None>" })); } if (!groups[last_group].has(last_subgroup)) { @@ -260,6 +262,12 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const { subgroup.push_back(info); groups[last_group].insert(last_subgroup, subgroup); + for (Pair<String, LocalVector<String>> &group : vgroups) { + if (group.first == last_group) { + group.second.push_back(last_subgroup); + break; + } + } } } else { last_group = "<None>"; @@ -277,6 +285,8 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const { info.name = "Shader Parameters"; info.hint_string = "shader_parameter/"; groups["<None>"]["<None>"].push_back(info); + + vgroups.push_back(Pair<String, LocalVector<String>>("<None>", { "<None>" })); } PropertyInfo info = E->get(); @@ -290,21 +300,10 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const { groups[last_group][last_subgroup].push_back(info); } - List<String> group_names; - for (HashMap<String, HashMap<String, List<PropertyInfo>>>::Iterator group = groups.begin(); group; ++group) { - group_names.push_back(group->key); - } - group_names.sort(); - - for (const String &group_name : group_names) { - List<String> subgroup_names; - HashMap<String, List<PropertyInfo>> &subgroups = groups[group_name]; - for (HashMap<String, List<PropertyInfo>>::Iterator subgroup = subgroups.begin(); subgroup; ++subgroup) { - subgroup_names.push_back(subgroup->key); - } - subgroup_names.sort(); - for (const String &subgroup_name : subgroup_names) { - List<PropertyInfo> &prop_infos = subgroups[subgroup_name]; + for (const Pair<String, LocalVector<String>> &group_pair : vgroups) { + String group = group_pair.first; + for (const String &subgroup : group_pair.second) { + List<PropertyInfo> &prop_infos = groups[group][subgroup]; for (List<PropertyInfo>::Element *item = prop_infos.front(); item; item = item->next()) { p_list->push_back(item->get()); } diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index ccb3ddee45..5ef3e09e3d 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -985,9 +985,21 @@ void SurfaceTool::create_from_blend_shape(const Ref<Mesh> &p_existing, int p_sur } ERR_FAIL_COND(shape_idx == -1); ERR_FAIL_COND(shape_idx >= arr.size()); - Array mesh = arr[shape_idx]; - ERR_FAIL_COND(mesh.size() != RS::ARRAY_MAX); - _create_list_from_arrays(arr[shape_idx], &vertex_array, &index_array, format); + Array blendshape_mesh_arrays = arr[shape_idx]; + ERR_FAIL_COND(blendshape_mesh_arrays.size() != RS::ARRAY_MAX); + + Array source_mesh_arrays = p_existing->surface_get_arrays(p_surface); + ERR_FAIL_COND(source_mesh_arrays.size() != RS::ARRAY_MAX); + + // Copy BlendShape vertex data over while keeping e.g. bones, weights, index from existing mesh intact. + source_mesh_arrays[RS::ARRAY_VERTEX] = blendshape_mesh_arrays[RS::ARRAY_VERTEX]; + source_mesh_arrays[RS::ARRAY_NORMAL] = blendshape_mesh_arrays[RS::ARRAY_NORMAL]; + source_mesh_arrays[RS::ARRAY_TANGENT] = blendshape_mesh_arrays[RS::ARRAY_TANGENT]; + + _create_list_from_arrays(source_mesh_arrays, &vertex_array, &index_array, format); + + material = p_existing->surface_get_material(p_surface); + format = p_existing->surface_get_format(p_surface); for (int j = 0; j < RS::ARRAY_CUSTOM_COUNT; j++) { if (format & custom_mask[j]) { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 282c531555..7de10149db 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -168,7 +168,8 @@ void ImageTexture::_get_property_list(List<PropertyInfo> *p_list) const { } Ref<ImageTexture> ImageTexture::create_from_image(const Ref<Image> &p_image) { - ERR_FAIL_COND_V_MSG(p_image.is_null() || p_image->is_empty(), Ref<ImageTexture>(), "Invalid image"); + ERR_FAIL_COND_V_MSG(p_image.is_null(), Ref<ImageTexture>(), "Invalid image: null"); + ERR_FAIL_COND_V_MSG(p_image->is_empty(), Ref<ImageTexture>(), "Invalid image: image is empty"); Ref<ImageTexture> image_texture; image_texture.instantiate(); diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 42e4a0fa3d..a361b7584a 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -611,6 +611,36 @@ void VisualShaderNodeCustom::_set_initialized(bool p_enabled) { is_initialized = p_enabled; } +String VisualShaderNodeCustom::_get_name() const { + String ret; + GDVIRTUAL_CALL(_get_name, ret); + return ret; +} + +String VisualShaderNodeCustom::_get_description() const { + String ret; + GDVIRTUAL_CALL(_get_description, ret); + return ret; +} + +String VisualShaderNodeCustom::_get_category() const { + String ret; + GDVIRTUAL_CALL(_get_category, ret); + return ret; +} + +VisualShaderNodeCustom::PortType VisualShaderNodeCustom::_get_return_icon_type() const { + PortType ret = PORT_TYPE_SCALAR; + GDVIRTUAL_CALL(_get_return_icon_type, ret); + return ret; +} + +bool VisualShaderNodeCustom::_is_highend() const { + bool ret = false; + GDVIRTUAL_CALL(_is_highend, ret); + return ret; +} + void VisualShaderNodeCustom::_bind_methods() { GDVIRTUAL_BIND(_get_name); GDVIRTUAL_BIND(_get_description); diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index 2838a49209..38d51dba9c 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -411,6 +411,12 @@ public: bool _is_initialized(); void _set_initialized(bool p_enabled); + + String _get_name() const; + String _get_description() const; + String _get_category() const; + PortType _get_return_icon_type() const; + bool _is_highend() const; }; ///// diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp index b9e3c4f303..706477cedb 100644 --- a/servers/rendering/renderer_canvas_cull.cpp +++ b/servers/rendering/renderer_canvas_cull.cpp @@ -1177,17 +1177,31 @@ void RendererCanvasCull::canvas_item_add_polyline(RID p_item, const Vector<Point } void RendererCanvasCull::canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width) { - ERR_FAIL_COND(p_points.size() < 2); + ERR_FAIL_COND(p_points.is_empty() || p_points.size() % 2 != 0); + ERR_FAIL_COND(p_colors.size() != 1 && p_colors.size() * 2 != p_points.size()); // TODO: `canvas_item_add_line`(`multiline`, `polyline`) share logic, should factor out. if (p_width < 0) { Item *canvas_item = canvas_item_owner.get_or_null(p_item); ERR_FAIL_COND(!canvas_item); + Vector<Color> colors; + if (p_colors.size() == 1) { + colors = p_colors; + } else { //} else if (p_colors.size() << 1 == p_points.size()) { + colors.resize(p_points.size()); + Color *colors_ptr = colors.ptrw(); + for (int i = 0; i < p_colors.size(); i++) { + Color color = p_colors[i]; + colors_ptr[i * 2 + 0] = color; + colors_ptr[i * 2 + 1] = color; + } + } + Item::CommandPolygon *pline = canvas_item->alloc_command<Item::CommandPolygon>(); ERR_FAIL_COND(!pline); pline->primitive = RS::PRIMITIVE_LINES; - pline->polygon.create(Vector<int>(), p_points, p_colors); + pline->polygon.create(Vector<int>(), p_points, colors); } else { if (p_colors.size() == 1) { Color color = p_colors[0]; @@ -1197,16 +1211,14 @@ void RendererCanvasCull::canvas_item_add_multiline(RID p_item, const Vector<Poin canvas_item_add_line(p_item, from, to, color, p_width); } - } else if (p_colors.size() == p_points.size() >> 1) { - for (int i = 0; i < p_points.size() >> 1; i++) { + } else { //} else if (p_colors.size() << 1 == p_points.size()) { + for (int i = 0; i < p_colors.size(); i++) { Color color = p_colors[i]; Vector2 from = p_points[i * 2 + 0]; Vector2 to = p_points[i * 2 + 1]; canvas_item_add_line(p_item, from, to, color, p_width); } - } else { - ERR_FAIL_MSG("Length of p_colors is invalid."); } } } diff --git a/servers/rendering/renderer_rd/environment/fog.cpp b/servers/rendering/renderer_rd/environment/fog.cpp index 57da55db4d..78b785153f 100644 --- a/servers/rendering/renderer_rd/environment/fog.cpp +++ b/servers/rendering/renderer_rd/environment/fog.cpp @@ -388,6 +388,37 @@ Fog::FogShaderData::~FogShaderData() { //////////////////////////////////////////////////////////////////////////////// // Volumetric Fog +bool Fog::VolumetricFog::sync_gi_dependent_sets_validity(bool p_ensure_freed) { + bool null = gi_dependent_sets.copy_uniform_set.is_null(); + bool valid = !null && RD::get_singleton()->uniform_set_is_valid(gi_dependent_sets.copy_uniform_set); + +#ifdef DEV_ENABLED + // It's all-or-nothing, or something else has changed that requires dev attention. + DEV_ASSERT(null == gi_dependent_sets.process_uniform_set_density.is_null()); + DEV_ASSERT(null == gi_dependent_sets.process_uniform_set.is_null()); + DEV_ASSERT(null == gi_dependent_sets.process_uniform_set2.is_null()); + DEV_ASSERT(valid == RD::get_singleton()->uniform_set_is_valid(gi_dependent_sets.process_uniform_set_density)); + DEV_ASSERT(valid == RD::get_singleton()->uniform_set_is_valid(gi_dependent_sets.process_uniform_set)); + DEV_ASSERT(valid == RD::get_singleton()->uniform_set_is_valid(gi_dependent_sets.process_uniform_set2)); +#endif + + if (valid) { + if (p_ensure_freed) { + RD::get_singleton()->free(gi_dependent_sets.copy_uniform_set); + RD::get_singleton()->free(gi_dependent_sets.process_uniform_set_density); + RD::get_singleton()->free(gi_dependent_sets.process_uniform_set); + RD::get_singleton()->free(gi_dependent_sets.process_uniform_set2); + valid = false; + } + } + + if (!valid && !null) { + gi_dependent_sets = {}; + } + + return valid; +} + void Fog::VolumetricFog::init(const Vector3i &fog_size, RID p_sky_shader) { width = fog_size.x; height = fog_size.y; @@ -464,17 +495,7 @@ Fog::VolumetricFog::~VolumetricFog() { RD::get_singleton()->free(fog_uniform_set); } - // At this point, due to cascade deletions, the sets may no longer be valid, but still they must work as a group. - gi_dependent_sets.valid = RD::get_singleton()->uniform_set_is_valid(gi_dependent_sets.process_uniform_set_density); -#ifdef DEV_ENABLED - gi_dependent_sets.assert_actual_validity(); -#endif - if (gi_dependent_sets.valid) { - RD::get_singleton()->free(gi_dependent_sets.copy_uniform_set); - RD::get_singleton()->free(gi_dependent_sets.process_uniform_set_density); - RD::get_singleton()->free(gi_dependent_sets.process_uniform_set); - RD::get_singleton()->free(gi_dependent_sets.process_uniform_set2); - } + sync_gi_dependent_sets_validity(true); if (sdfgi_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(sdfgi_uniform_set)) { RD::get_singleton()->free(sdfgi_uniform_set); @@ -717,10 +738,7 @@ void Fog::volumetric_fog_update(const VolumetricFogSettings &p_settings, const P RD::get_singleton()->compute_list_end(); } -#ifdef DEV_ENABLED - fog->gi_dependent_sets.assert_actual_validity(); -#endif - if (!fog->gi_dependent_sets.valid) { + if (!fog->sync_gi_dependent_sets_validity()) { //re create uniform set if needed Vector<RD::Uniform> uniforms; Vector<RD::Uniform> copy_uniforms; @@ -932,8 +950,6 @@ void Fog::volumetric_fog_update(const VolumetricFogSettings &p_settings, const P uniforms.remove_at(8); uniforms.write[7].set_id(0, aux7); fog->gi_dependent_sets.process_uniform_set_density = RD::get_singleton()->uniform_set_create(uniforms, volumetric_fog.process_shader.version_get_shader(volumetric_fog.process_shader_version, VolumetricFogShader::VOLUMETRIC_FOG_PROCESS_SHADER_DENSITY), 0); - - fog->gi_dependent_sets.valid = true; } bool using_sdfgi = RendererSceneRenderRD::get_singleton()->environment_get_volumetric_fog_gi_inject(p_settings.env) > 0.0001 && RendererSceneRenderRD::get_singleton()->environment_get_sdfgi_enabled(p_settings.env) && (p_settings.sdfgi.is_valid()); diff --git a/servers/rendering/renderer_rd/environment/fog.h b/servers/rendering/renderer_rd/environment/fog.h index 926da4026c..277389c596 100644 --- a/servers/rendering/renderer_rd/environment/fog.h +++ b/servers/rendering/renderer_rd/environment/fog.h @@ -303,21 +303,10 @@ public: RID fog_uniform_set; struct { - bool valid = false; RID copy_uniform_set; RID process_uniform_set_density; RID process_uniform_set; RID process_uniform_set2; - -#ifdef DEV_ENABLED - void assert_actual_validity() { - // It's all-or-nothing, or something else has changed that requires dev attention. - DEV_ASSERT(valid == RD::get_singleton()->uniform_set_is_valid(copy_uniform_set)); - DEV_ASSERT(valid == RD::get_singleton()->uniform_set_is_valid(process_uniform_set_density)); - DEV_ASSERT(valid == RD::get_singleton()->uniform_set_is_valid(process_uniform_set)); - DEV_ASSERT(valid == RD::get_singleton()->uniform_set_is_valid(process_uniform_set2)); - } -#endif } gi_dependent_sets; RID sdfgi_uniform_set; @@ -328,6 +317,8 @@ public: virtual void configure(RenderSceneBuffersRD *p_render_buffers) override{}; virtual void free_data() override{}; + bool sync_gi_dependent_sets_validity(bool p_ensure_freed = false); + void init(const Vector3i &fog_size, RID p_sky_shader); ~VolumetricFog(); }; diff --git a/servers/rendering/renderer_rd/environment/gi.cpp b/servers/rendering/renderer_rd/environment/gi.cpp index 52f09e1ccb..c2a018c7c6 100644 --- a/servers/rendering/renderer_rd/environment/gi.cpp +++ b/servers/rendering/renderer_rd/environment/gi.cpp @@ -3695,20 +3695,6 @@ void GI::setup_voxel_gi_instances(RenderDataRD *p_render_data, Ref<RenderSceneBu } rbgi->uniform_set[v] = RID(); } - if (p_render_buffers->has_custom_data(RB_SCOPE_FOG)) { - Ref<Fog::VolumetricFog> fog = p_render_buffers->get_custom_data(RB_SCOPE_FOG); - -#ifdef DEV_ENABLED - fog->gi_dependent_sets.assert_actual_validity(); -#endif - if (fog->gi_dependent_sets.valid) { - RD::get_singleton()->free(fog->gi_dependent_sets.copy_uniform_set); - RD::get_singleton()->free(fog->gi_dependent_sets.process_uniform_set_density); - RD::get_singleton()->free(fog->gi_dependent_sets.process_uniform_set); - RD::get_singleton()->free(fog->gi_dependent_sets.process_uniform_set2); - fog->gi_dependent_sets.valid = false; - } - } } if (p_voxel_gi_instances.size() > 0) { diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp index 6c948d3474..03f31f839e 100644 --- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp @@ -632,7 +632,7 @@ void SceneShaderForwardClustered::init(const String p_defines) { actions.renames["CAMERA_POSITION_WORLD"] = "scene_data.inv_view_matrix[3].xyz"; actions.renames["CAMERA_DIRECTION_WORLD"] = "scene_data.view_matrix[3].xyz"; actions.renames["CAMERA_VISIBLE_LAYERS"] = "scene_data.camera_visible_layers"; - actions.renames["NODE_POSITION_VIEW"] = "(read_model_matrix * scene_data.view_matrix)[3].xyz"; + actions.renames["NODE_POSITION_VIEW"] = "(scene_data.view_matrix * read_model_matrix)[3].xyz"; actions.renames["VIEW_INDEX"] = "ViewIndex"; actions.renames["VIEW_MONO_LEFT"] = "0"; @@ -641,6 +641,7 @@ void SceneShaderForwardClustered::init(const String p_defines) { //for light actions.renames["VIEW"] = "view"; + actions.renames["SPECULAR_AMOUNT"] = "specular_amount"; actions.renames["LIGHT_COLOR"] = "light_color"; actions.renames["LIGHT_IS_DIRECTIONAL"] = "is_directional"; actions.renames["LIGHT"] = "light"; diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp index a93b994467..f3bc8a6e55 100644 --- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp @@ -522,7 +522,7 @@ void SceneShaderForwardMobile::init(const String p_defines) { actions.renames["CAMERA_POSITION_WORLD"] = "scene_data.inv_view_matrix[3].xyz"; actions.renames["CAMERA_DIRECTION_WORLD"] = "scene_data.view_matrix[3].xyz"; actions.renames["CAMERA_VISIBLE_LAYERS"] = "scene_data.camera_visible_layers"; - actions.renames["NODE_POSITION_VIEW"] = "(read_model_matrix * scene_data.view_matrix)[3].xyz"; + actions.renames["NODE_POSITION_VIEW"] = "(scene_data.view_matrix * read_model_matrix)[3].xyz"; actions.renames["VIEW_INDEX"] = "ViewIndex"; actions.renames["VIEW_MONO_LEFT"] = "0"; @@ -531,6 +531,7 @@ void SceneShaderForwardMobile::init(const String p_defines) { //for light actions.renames["VIEW"] = "view"; + actions.renames["SPECULAR_AMOUNT"] = "specular_amount"; actions.renames["LIGHT_COLOR"] = "light_color"; actions.renames["LIGHT_IS_DIRECTIONAL"] = "is_directional"; actions.renames["LIGHT"] = "light"; diff --git a/servers/rendering/renderer_rd/shaders/effects/cubemap_downsampler_raster.glsl b/servers/rendering/renderer_rd/shaders/effects/cubemap_downsampler_raster.glsl index 0828ffd921..b8c64d09f4 100644 --- a/servers/rendering/renderer_rd/shaders/effects/cubemap_downsampler_raster.glsl +++ b/servers/rendering/renderer_rd/shaders/effects/cubemap_downsampler_raster.glsl @@ -55,109 +55,107 @@ void main() { // Converted from compute shader which uses absolute coordinates. // Could possibly simplify this float face_size = float(params.face_size); + float inv_face_size = 1.0 / face_size; + vec2 id = floor(uv_interp); - if (uv_interp.x < face_size && uv_interp.y < face_size) { - float inv_face_size = 1.0 / face_size; - - float u0 = (uv_interp.x * 2.0 + 1.0 - 0.75) * inv_face_size - 1.0; - float u1 = (uv_interp.x * 2.0 + 1.0 + 0.75) * inv_face_size - 1.0; - - float v0 = (uv_interp.y * 2.0 + 1.0 - 0.75) * -inv_face_size + 1.0; - float v1 = (uv_interp.y * 2.0 + 1.0 + 0.75) * -inv_face_size + 1.0; - - float weights[4]; - weights[0] = calcWeight(u0, v0); - weights[1] = calcWeight(u1, v0); - weights[2] = calcWeight(u0, v1); - weights[3] = calcWeight(u1, v1); - - const float wsum = 0.5 / (weights[0] + weights[1] + weights[2] + weights[3]); - for (int i = 0; i < 4; i++) { - weights[i] = weights[i] * wsum + .125; - } - - vec3 dir; - vec4 color; - switch (params.face_id) { - case 0: - get_dir_0(dir, u0, v0); - color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; - - get_dir_0(dir, u1, v0); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; - - get_dir_0(dir, u0, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; - - get_dir_0(dir, u1, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; - break; - case 1: - get_dir_1(dir, u0, v0); - color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; - - get_dir_1(dir, u1, v0); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; - - get_dir_1(dir, u0, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; - - get_dir_1(dir, u1, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; - break; - case 2: - get_dir_2(dir, u0, v0); - color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; - - get_dir_2(dir, u1, v0); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; - - get_dir_2(dir, u0, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; - - get_dir_2(dir, u1, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; - break; - case 3: - get_dir_3(dir, u0, v0); - color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; - - get_dir_3(dir, u1, v0); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; - - get_dir_3(dir, u0, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; - - get_dir_3(dir, u1, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; - break; - case 4: - get_dir_4(dir, u0, v0); - color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; - - get_dir_4(dir, u1, v0); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; - - get_dir_4(dir, u0, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; - - get_dir_4(dir, u1, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; - break; - default: - get_dir_5(dir, u0, v0); - color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; - - get_dir_5(dir, u1, v0); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; - - get_dir_5(dir, u0, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; - - get_dir_5(dir, u1, v1); - color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; - break; - } - frag_color = color; + float u1 = (id.x * 2.0 + 1.0 + 0.75) * inv_face_size - 1.0; + float u0 = (id.x * 2.0 + 1.0 - 0.75) * inv_face_size - 1.0; + + float v0 = (id.y * 2.0 + 1.0 - 0.75) * -inv_face_size + 1.0; + float v1 = (id.y * 2.0 + 1.0 + 0.75) * -inv_face_size + 1.0; + + float weights[4]; + weights[0] = calcWeight(u0, v0); + weights[1] = calcWeight(u1, v0); + weights[2] = calcWeight(u0, v1); + weights[3] = calcWeight(u1, v1); + + const float wsum = 0.5 / (weights[0] + weights[1] + weights[2] + weights[3]); + for (int i = 0; i < 4; i++) { + weights[i] = weights[i] * wsum + .125; + } + + vec3 dir; + vec4 color; + switch (params.face_id) { + case 0: + get_dir_0(dir, u0, v0); + color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; + + get_dir_0(dir, u1, v0); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; + + get_dir_0(dir, u0, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; + + get_dir_0(dir, u1, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; + break; + case 1: + get_dir_1(dir, u0, v0); + color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; + + get_dir_1(dir, u1, v0); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; + + get_dir_1(dir, u0, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; + + get_dir_1(dir, u1, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; + break; + case 2: + get_dir_2(dir, u0, v0); + color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; + + get_dir_2(dir, u1, v0); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; + + get_dir_2(dir, u0, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; + + get_dir_2(dir, u1, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; + break; + case 3: + get_dir_3(dir, u0, v0); + color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; + + get_dir_3(dir, u1, v0); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; + + get_dir_3(dir, u0, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; + + get_dir_3(dir, u1, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; + break; + case 4: + get_dir_4(dir, u0, v0); + color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; + + get_dir_4(dir, u1, v0); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; + + get_dir_4(dir, u0, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; + + get_dir_4(dir, u1, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; + break; + default: + get_dir_5(dir, u0, v0); + color = textureLod(source_cubemap, normalize(dir), 0.0) * weights[0]; + + get_dir_5(dir, u1, v0); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[1]; + + get_dir_5(dir, u0, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[2]; + + get_dir_5(dir, u1, v1); + color += textureLod(source_cubemap, normalize(dir), 0.0) * weights[3]; + break; } + frag_color = color; } diff --git a/servers/rendering/renderer_rd/storage_rd/light_storage.h b/servers/rendering/renderer_rd/storage_rd/light_storage.h index c36d1ef503..3360358169 100644 --- a/servers/rendering/renderer_rd/storage_rd/light_storage.h +++ b/servers/rendering/renderer_rd/storage_rd/light_storage.h @@ -93,11 +93,11 @@ private: struct ShadowTransform { Projection camera; Transform3D transform; - float farplane; - float split; - float bias_scale; - float shadow_texel_size; - float range_begin; + float farplane = 0.0; + float split = 0.0; + float bias_scale = 0.0; + float shadow_texel_size = 0.0; + float range_begin = 0.0; Rect2 atlas_rect; Vector2 uv_scale; }; diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp index f609fa6023..8813c2e651 100644 --- a/servers/rendering/renderer_viewport.cpp +++ b/servers/rendering/renderer_viewport.cpp @@ -962,6 +962,13 @@ void RendererViewport::viewport_set_update_mode(RID p_viewport, RS::ViewportUpda viewport->update_mode = p_mode; } +RID RendererViewport::viewport_get_render_target(RID p_viewport) const { + const Viewport *viewport = viewport_owner.get_or_null(p_viewport); + ERR_FAIL_COND_V(!viewport, RID()); + + return viewport->render_target; +} + RID RendererViewport::viewport_get_texture(RID p_viewport) const { const Viewport *viewport = viewport_owner.get_or_null(p_viewport); ERR_FAIL_COND_V(!viewport, RID()); diff --git a/servers/rendering/renderer_viewport.h b/servers/rendering/renderer_viewport.h index c24275de6e..2f9537a47c 100644 --- a/servers/rendering/renderer_viewport.h +++ b/servers/rendering/renderer_viewport.h @@ -231,6 +231,7 @@ public: void viewport_set_clear_mode(RID p_viewport, RS::ViewportClearMode p_clear_mode); + RID viewport_get_render_target(RID p_viewport) const; RID viewport_get_texture(RID p_viewport) const; RID viewport_get_occluder_debug_texture(RID p_viewport) const; diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h index 249e5c2d9d..d39bec8399 100644 --- a/servers/rendering/rendering_server_default.h +++ b/servers/rendering/rendering_server_default.h @@ -606,6 +606,7 @@ public: FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode) + FUNC1RC(RID, viewport_get_render_target, RID) FUNC1RC(RID, viewport_get_texture, RID) FUNC2(viewport_set_disable_2d, RID, bool) diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp index 8d16a29659..af4ccdf6e3 100644 --- a/servers/rendering/shader_compiler.cpp +++ b/servers/rendering/shader_compiler.cpp @@ -38,12 +38,7 @@ #define SL ShaderLanguage static String _mktab(int p_level) { - String tb; - for (int i = 0; i < p_level; i++) { - tb += "\t"; - } - - return tb; + return String("\t").repeat(p_level); } static String _typestr(SL::DataType p_type) { diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp index d95caeddc5..4e8057ef8f 100644 --- a/servers/rendering/shader_types.cpp +++ b/servers/rendering/shader_types.cpp @@ -187,6 +187,7 @@ ShaderTypes::ShaderTypes() { shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2); shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["UV2"] = constt(ShaderLanguage::TYPE_VEC2); shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["VIEW"] = constt(ShaderLanguage::TYPE_VEC3); + shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["SPECULAR_AMOUNT"] = constt(ShaderLanguage::TYPE_FLOAT); shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT"] = constt(ShaderLanguage::TYPE_VEC3); shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT_COLOR"] = constt(ShaderLanguage::TYPE_VEC3); shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT_IS_DIRECTIONAL"] = constt(ShaderLanguage::TYPE_BOOL); diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index cc09825298..fffe36bfb3 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -2198,6 +2198,7 @@ void RenderingServer::_bind_methods() { ClassDB::bind_method(D_METHOD("viewport_set_texture_mipmap_bias", "viewport", "mipmap_bias"), &RenderingServer::viewport_set_texture_mipmap_bias); ClassDB::bind_method(D_METHOD("viewport_set_update_mode", "viewport", "update_mode"), &RenderingServer::viewport_set_update_mode); ClassDB::bind_method(D_METHOD("viewport_set_clear_mode", "viewport", "clear_mode"), &RenderingServer::viewport_set_clear_mode); + ClassDB::bind_method(D_METHOD("viewport_get_render_target", "viewport"), &RenderingServer::viewport_get_render_target); ClassDB::bind_method(D_METHOD("viewport_get_texture", "viewport"), &RenderingServer::viewport_get_texture); ClassDB::bind_method(D_METHOD("viewport_set_disable_3d", "viewport", "disable"), &RenderingServer::viewport_set_disable_3d); ClassDB::bind_method(D_METHOD("viewport_set_disable_2d", "viewport", "disable"), &RenderingServer::viewport_set_disable_2d); @@ -2602,6 +2603,7 @@ void RenderingServer::_bind_methods() { ClassDB::bind_method(D_METHOD("canvas_item_add_line", "item", "from", "to", "color", "width", "antialiased"), &RenderingServer::canvas_item_add_line, DEFVAL(-1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("canvas_item_add_polyline", "item", "points", "colors", "width", "antialiased"), &RenderingServer::canvas_item_add_polyline, DEFVAL(-1.0), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("canvas_item_add_multiline", "item", "points", "colors", "width"), &RenderingServer::canvas_item_add_multiline, DEFVAL(-1.0)); ClassDB::bind_method(D_METHOD("canvas_item_add_rect", "item", "rect", "color"), &RenderingServer::canvas_item_add_rect); ClassDB::bind_method(D_METHOD("canvas_item_add_circle", "item", "pos", "radius", "color"), &RenderingServer::canvas_item_add_circle); ClassDB::bind_method(D_METHOD("canvas_item_add_texture_rect", "item", "rect", "texture", "tile", "modulate", "transpose"), &RenderingServer::canvas_item_add_texture_rect, DEFVAL(false), DEFVAL(Color(1, 1, 1)), DEFVAL(false)); diff --git a/servers/rendering_server.h b/servers/rendering_server.h index a283744443..6206088b41 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -837,6 +837,7 @@ public: virtual void viewport_set_clear_mode(RID p_viewport, ViewportClearMode p_clear_mode) = 0; + virtual RID viewport_get_render_target(RID p_viewport) const = 0; virtual RID viewport_get_texture(RID p_viewport) const = 0; enum ViewportEnvironmentMode { diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h index abe9f78ccc..7c76e7aa7b 100644 --- a/tests/core/string/test_string.h +++ b/tests/core/string/test_string.h @@ -395,6 +395,12 @@ TEST_CASE("[String] Insertion") { CHECK(s == "Who is Frederic Chopin?"); } +TEST_CASE("[String] Erasing") { + String s = "Josephine is such a cute girl!"; + s = s.erase(s.find("cute "), String("cute ").length()); + CHECK(s == "Josephine is such a girl!"); +} + TEST_CASE("[String] Number to string") { CHECK(String::num(0) == "0"); CHECK(String::num(0.0) == "0"); // No trailing zeros. |