mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 18:29:11 +00:00
Merge branch 'master' into 3.2
This commit is contained in:
@@ -109,8 +109,7 @@ Execute this from the root folder of this repository:
|
||||
```sh
|
||||
virtualenv --system-site-packages env/
|
||||
. env/bin/activate
|
||||
pip3 install sphinx
|
||||
pip3 install sphinx_rtd_theme
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
Then do `make html` like above.
|
||||
|
||||
@@ -463,6 +463,18 @@ footer,
|
||||
background-color: var(--table-row-odd-background-color);
|
||||
}
|
||||
|
||||
/* Override table no-wrap */
|
||||
/* The first column cells are not verbose, no need to wrap them */
|
||||
.wy-table-responsive table td:not(:nth-child(1)),
|
||||
.wy-table-responsive table th:not(:nth-child(1)) {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/* Make sure not to wrap keyboard shortcuts */
|
||||
.wy-table-responsive table td kbd {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Code display tweaks */
|
||||
|
||||
code,
|
||||
|
||||
+19
-10
@@ -23,7 +23,7 @@ const registerOnScrollEvent = (function(){
|
||||
// Media query handler.
|
||||
return function(mediaQuery) {
|
||||
// We only apply this logic to the "desktop" resolution (defined by a media query at the bottom).
|
||||
// This handler is executed when the result of the query evaluation changes, which means that
|
||||
// This handler is executed when the result of the query evaluation changes, which means that
|
||||
// the page has moved between "desktop" and "mobile" states.
|
||||
|
||||
// When entering the "desktop" state, we register scroll events and adjust elements on the page.
|
||||
@@ -57,7 +57,7 @@ const registerOnScrollEvent = (function(){
|
||||
$menu.css('max-height', `calc(100% - ${menuHeightOffset_fixed}px)`);
|
||||
}
|
||||
else {
|
||||
// Between the top of the page and the threshold we calculate intermediate values
|
||||
// Between the top of the page and the threshold we calculate intermediate values
|
||||
// to guarantee a smooth transition.
|
||||
$search.css('margin-top', `-${currentScroll}px`);
|
||||
$menu.css('margin-top', `${menuTopMargin + (scrollTopPixels - currentScroll)}px`);
|
||||
@@ -138,12 +138,12 @@ const registerOnScrollEvent = (function(){
|
||||
};
|
||||
})();
|
||||
|
||||
// Subscribe to DOM changes in the sidebar container, because there is a
|
||||
// Subscribe to DOM changes in the sidebar container, because there is a
|
||||
// banner that gets added at a later point, that we might not catch otherwise.
|
||||
const registerSidebarObserver = (function(){
|
||||
return function(callback) {
|
||||
const sidebarContainer = document.querySelector('.wy-side-scroll');
|
||||
|
||||
|
||||
let sidebarEthical = null;
|
||||
const registerEthicalObserver = () => {
|
||||
if (sidebarEthical) {
|
||||
@@ -164,16 +164,16 @@ const registerSidebarObserver = (function(){
|
||||
if (mutation.type !== 'childList') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const ethicalObserver = new MutationObserver(ethicalObserverCallback);
|
||||
ethicalObserver.observe(sidebarEthical, ethicalObserverConfig);
|
||||
};
|
||||
registerEthicalObserver();
|
||||
|
||||
|
||||
// This observer watches over direct children of the main sidebar container.
|
||||
const observerConfig = { childList: true };
|
||||
const observerCallback = (mutationsList, observer) => {
|
||||
@@ -181,12 +181,12 @@ const registerSidebarObserver = (function(){
|
||||
if (mutation.type !== 'childList') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
callback();
|
||||
registerEthicalObserver();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const observer = new MutationObserver(observerCallback);
|
||||
observer.observe(sidebarContainer, observerConfig);
|
||||
};
|
||||
@@ -194,11 +194,20 @@ const registerSidebarObserver = (function(){
|
||||
|
||||
$(document).ready(() => {
|
||||
const mediaQuery = window.matchMedia('only screen and (min-width: 769px)');
|
||||
|
||||
|
||||
registerOnScrollEvent(mediaQuery);
|
||||
mediaQuery.addListener(registerOnScrollEvent);
|
||||
|
||||
registerSidebarObserver(() => {
|
||||
registerOnScrollEvent(mediaQuery);
|
||||
});
|
||||
|
||||
// Load instant.page to prefetch pages upon hovering. This makes navigation feel
|
||||
// snappier. The script is dynamically appended as Read the Docs doesn't have
|
||||
// a way to add scripts with a "module" attribute.
|
||||
const instantPageScript = document.createElement('script');
|
||||
instantPageScript.toggleAttribute('module');
|
||||
/*! instant.page v3.0.0 - (C) 2019 Alexandre Dieulot - https://instant.page/license */
|
||||
instantPageScript.innerText = 'let t,e;const n=new Set,o=document.createElement("link"),s=o.relList&&o.relList.supports&&o.relList.supports("prefetch")&&window.IntersectionObserver&&"isIntersecting"in IntersectionObserverEntry.prototype,i="instantAllowQueryString"in document.body.dataset,r="instantAllowExternalLinks"in document.body.dataset,a="instantWhitelist"in document.body.dataset;let c=65,d=!1,l=!1,u=!1;if("instantIntensity"in document.body.dataset){const t=document.body.dataset.instantIntensity;if("mousedown"==t.substr(0,"mousedown".length))d=!0,"mousedown-only"==t&&(l=!0);else if("viewport"==t.substr(0,"viewport".length))navigator.connection&&(navigator.connection.saveData||navigator.connection.effectiveType.includes("2g"))||("viewport"==t?document.documentElement.clientWidth*document.documentElement.clientHeight<45e4&&(u=!0):"viewport-all"==t&&(u=!0));else{const e=parseInt(t);isNaN(e)||(c=e)}}if(s){const n={capture:!0,passive:!0};if(l||document.addEventListener("touchstart",function(t){e=performance.now();const n=t.target.closest("a");if(!f(n))return;h(n.href)},n),d?document.addEventListener("mousedown",function(t){const e=t.target.closest("a");if(!f(e))return;h(e.href)},n):document.addEventListener("mouseover",function(n){if(performance.now()-e<1100)return;const o=n.target.closest("a");if(!f(o))return;o.addEventListener("mouseout",m,{passive:!0}),t=setTimeout(()=>{h(o.href),t=void 0},c)},n),u){let t;(t=window.requestIdleCallback?t=>{requestIdleCallback(t,{timeout:1500})}:t=>{t()})(()=>{const t=new IntersectionObserver(e=>{e.forEach(e=>{if(e.isIntersecting){const n=e.target;t.unobserve(n),h(n.href)}})});document.querySelectorAll("a").forEach(e=>{f(e)&&t.observe(e)})})}}function m(e){e.relatedTarget&&e.target.closest("a")==e.relatedTarget.closest("a")||t&&(clearTimeout(t),t=void 0)}function f(t){if(t&&t.href&&(!a||"instant"in t.dataset)&&(r||t.origin==location.origin||"instant"in t.dataset)&&["http:","https:"].includes(t.protocol)&&("http:"!=t.protocol||"https:"!=location.protocol)&&(i||!t.search||"instant"in t.dataset)&&!(t.hash&&t.pathname+t.search==location.pathname+location.search||"noInstant"in t.dataset))return!0}function h(t){if(n.has(t))return;const e=document.createElement("link");e.rel="prefetch",e.href=t,document.head.appendChild(e),n.add(t)}';
|
||||
document.head.appendChild(instantPageScript);
|
||||
});
|
||||
|
||||
@@ -39,9 +39,10 @@ reference documentation about the reStructuredText markup language.
|
||||
The 'Edit on GitHub' link
|
||||
-------------------------
|
||||
|
||||
If you're reading documentation on ``docs.godotengine.org``, you'll see an
|
||||
**Edit on GitHub** hyperlink at the top right of the page. Once you've created a
|
||||
GitHub account, you can propose changes to a page you're reading as follows:
|
||||
If you're reading documentation on `docs.godotengine.org <https://docs.godotengine.org>`_,
|
||||
you'll see an **Edit on GitHub** hyperlink at the top right of the page.
|
||||
Once you've created a GitHub account, you can propose changes to a page you're
|
||||
reading as follows:
|
||||
|
||||
1. Click the **Edit on GitHub** button.
|
||||
|
||||
@@ -55,11 +56,11 @@ GitHub account, you can propose changes to a page you're reading as follows:
|
||||
click the button labelled **Propose file change** when done.
|
||||
|
||||
5. On the following screens, click the **Create pull request** button until you
|
||||
see a message like ``Open. yourGitHubUsername wants to merge 1 commit into
|
||||
godotengine:master from yourGitHubUsername:patch-6``.
|
||||
see a message like *Username wants to merge 1 commit into
|
||||
godotengine:master from Username:patch-6*.
|
||||
|
||||
6. A reviewer will evaluate your changes and incorporate them into the docs if
|
||||
they're judged to improve them. You might also be asked to make
|
||||
they're acceptable. You might also be asked to make
|
||||
modifications to your changes before they're included.
|
||||
|
||||
What makes good documentation?
|
||||
@@ -121,9 +122,11 @@ You can help to translate the official Godot documentation on our `Hosted Weblat
|
||||
:alt: Translation state
|
||||
:align: center
|
||||
:target: https://hosted.weblate.org/engage/godot-engine/?utm_source=widget
|
||||
:width: 287
|
||||
:height: 66
|
||||
|
||||
There also is the official
|
||||
`Godot i18N repository <https://github.com/godotengine/godot-docs-l10n>`_
|
||||
`Godot i18n repository <https://github.com/godotengine/godot-docs-l10n>`_
|
||||
where you can see when the data was last synchronized.
|
||||
|
||||
License
|
||||
|
||||
@@ -49,12 +49,29 @@ if env_tags is not None:
|
||||
tags.add(tag.strip()) # noqa: F821
|
||||
|
||||
# Language / i18n
|
||||
supported_languages = ['en', 'de', 'es', 'fr', 'fi', 'it', 'ja', 'ko', 'pl', 'pt-br', 'ru', 'uk', 'zh-cn']
|
||||
supported_languages = {
|
||||
"en": "Godot Engine (%s) documentation in English",
|
||||
"de": "Godot Engine (%s) Dokumentation auf Deutsch",
|
||||
"es": "Documentación de Godot Engine (%s) en español",
|
||||
"fr": "Documentation de Godot Engine (%s) en français",
|
||||
"fi": "Godot Engine (%s) dokumentaatio suomeksi",
|
||||
"it": "Godot Engine (%s) documentazione in italiano",
|
||||
"ja": "Godot Engine (%s)の日本語のドキュメント",
|
||||
"ko": "Godot Engine (%s) 문서 (한국어)",
|
||||
"pl": "Dokumentacja Godot Engine (%s) w języku polskim",
|
||||
"pt-br": "Documentação da Godot Engine (%s) em Português Brasileiro",
|
||||
"ru": "Документация Godot Engine (%s) на русском языке",
|
||||
"uk": "Документація до Godot Engine (%s) українською мовою",
|
||||
"zh-cn": "Godot Engine (%s) 简体中文文档",
|
||||
}
|
||||
language = os.getenv("READTHEDOCS_LANGUAGE", "en")
|
||||
if not language in supported_languages:
|
||||
if not language in supported_languages.keys():
|
||||
print("Unknown language: " + language)
|
||||
print("Supported languages: " + ", ".join(supported_languages))
|
||||
print("This is an error or needs to be added to supported_languages in conf.py")
|
||||
print("Supported languages: " + ", ".join(supported_languages.keys()))
|
||||
print(
|
||||
"The configured language is either wrong, or it should be added to supported_languages in conf.py. Falling back to 'en'."
|
||||
)
|
||||
language = en
|
||||
|
||||
is_i18n = tags.has("i18n") # noqa: F821
|
||||
|
||||
@@ -93,6 +110,8 @@ html_theme_options = {
|
||||
"collapse_navigation": False,
|
||||
}
|
||||
|
||||
html_title = supported_languages[language] % version
|
||||
|
||||
# VCS options: https://docs.readthedocs.io/en/latest/vcs.html#github
|
||||
html_context = {
|
||||
"display_github": not is_i18n, # Integrate GitHub
|
||||
@@ -101,7 +120,7 @@ html_context = {
|
||||
"github_version": "master", # Version
|
||||
"conf_py_path": "/", # Path in the checkout to the docs root
|
||||
"godot_inject_language_links": True,
|
||||
"godot_docs_supported_languages": supported_languages,
|
||||
"godot_docs_supported_languages": list(supported_languages.keys()),
|
||||
"godot_docs_basepath": "https://docs.godotengine.org/",
|
||||
"godot_docs_suffix": ".html",
|
||||
"godot_default_lang": "en",
|
||||
@@ -168,6 +187,8 @@ rst_epilog = """
|
||||
.. |weblate_widget| image:: https://hosted.weblate.org/widgets/godot-engine/{image_locale}/godot-docs/287x66-white.png
|
||||
:alt: Translation status
|
||||
:target: https://hosted.weblate.org/engage/godot-engine{target_locale}/?utm_source=widget
|
||||
:width: 287
|
||||
:height: 66
|
||||
""".format(
|
||||
image_locale="-" if language == "en" else language,
|
||||
target_locale="" if language == "en" else "/" + language,
|
||||
|
||||
@@ -15,6 +15,9 @@ The source code is available on `GitHub <https://github.com/godotengine/godot>`_
|
||||
and while you can manually download it via the website, in general you want to
|
||||
do it via the ``git`` version control system.
|
||||
|
||||
If you are compiling in order to make contributions or pull requests, you should
|
||||
follow the instructions from the :ref:`Pull Request workflow <doc_pr_workflow>`.
|
||||
|
||||
If you don't know much about ``git`` yet, there are a great number of
|
||||
`tutorials <https://git-scm.com/book>`__ available on various websites.
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ Development Environment), here are setup instructions for some popular ones:
|
||||
- :ref:`Qt Creator <doc_configuring_an_ide_qtcreator>` (all desktop platforms)
|
||||
- :ref:`Kdevelop <doc_configuring_an_ide_kdevelop>` (all desktop platforms)
|
||||
- :ref:`Xcode <doc_configuring_an_ide_xcode>` (macOS)
|
||||
- :ref:`Visual Studio <doc_compiling_for_windows_install_vs>` (Windows)
|
||||
- :ref:`Visual Studio <doc_configuring_an_ide_vs>` (Windows)
|
||||
- :ref:`Visual Studio Code<doc_configuring_an_ide_vscode>` (all desktop platforms)
|
||||
- :ref:`Android Studio<doc_configuring_an_ide_android_studio>` (all desktop platforms)
|
||||
- :ref:`CLion<doc_configuring_an_ide_clion>` (all desktop platforms)
|
||||
@@ -263,6 +263,68 @@ Test it:
|
||||
- It should break at the point!
|
||||
|
||||
|
||||
.. _doc_configuring_an_ide_vs:
|
||||
|
||||
Visual Studio
|
||||
-------------
|
||||
|
||||
Visual Studio Community is free for non-commercial use and has many useful features,
|
||||
such as memory view, performance view, source control and more.
|
||||
You can get it `from Microsoft <https://visualstudio.microsoft.com/downloads/>`__.
|
||||
|
||||
Setup
|
||||
^^^^^
|
||||
|
||||
To start developing with Visual Studio, follow these steps:
|
||||
|
||||
- Open the Visual Studio Installer and install the C++ package:
|
||||
|
||||
.. image:: img/vs_1_install_cpp_package.png
|
||||
|
||||
- Open a Command Prompt or PowerShell window, use ``cd`` to reach the Godot source
|
||||
directory and run ``scons platform=windows vsproj=yes``.
|
||||
|
||||
- Now open the Godot folder by clicking **Open a project or solution** and choose
|
||||
``godot.sln``.
|
||||
- You can also double-click the ``godot.sln`` file in Explorer.
|
||||
|
||||
You can now start developing with Visual Studio.
|
||||
|
||||
Debugging
|
||||
^^^^^^^^^
|
||||
|
||||
Visual Studio features a powerful debugger. This allows the user to examine Godot's
|
||||
source code, stop at specific points in the code, make changes, and view them on the run.
|
||||
|
||||
.. note:: Debugging the Godot Engine inside the editor will require an extra setup step.
|
||||
|
||||
Because opening Godot opens the Project Manager at first instead of the project
|
||||
you're working on, the debugger will detach as soon as you open a project.
|
||||
This means that the debugger will stop, even though Godot is still running in
|
||||
another process.
|
||||
|
||||
To overcome this, you need to edit the debugging command line arguments in VS. In your
|
||||
project, click **Project > Project Properties**:
|
||||
|
||||
.. image:: img/vs_2_project_properties.png
|
||||
|
||||
Then add this to the command arguments:
|
||||
|
||||
.. image:: img/vs_3_debug_command_line.png
|
||||
|
||||
- The ``-e`` flag is for entering the editor directly (which skips the Project Manager).
|
||||
- The ``--path`` argument should be an *absolute* path to a project directory (not a
|
||||
`project.godot` file).
|
||||
|
||||
To learn more about command line arguments, refer to the
|
||||
:ref:`command line tutorial <doc_command_line_tutorial>`.
|
||||
|
||||
To check that everything is working, put a breakpoint in ``main.cpp`` and press F5 to
|
||||
start debugging.
|
||||
|
||||
.. image:: img/vs_4_debugging_main.png
|
||||
|
||||
|
||||
.. _doc_configuring_an_ide_vscode:
|
||||
|
||||
Visual Studio Code
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -11,47 +11,33 @@ to improve the user experience.
|
||||
Creating icons
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
In order to create new icons, you first need a vector graphics editor installed.
|
||||
For instance, you can use the open-source `Inkscape <https://inkscape.org/>`_ editor.
|
||||
To create new icons, you first need a vector graphics editor installed.
|
||||
For instance, you can use the open source `Inkscape <https://inkscape.org/>`_ editor.
|
||||
|
||||
Clone the ``godot-design`` repository containing all the original editor icons:
|
||||
Clone the ``godot`` repository containing all the editor icons:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://github.com/godotengine/godot-design
|
||||
git clone https://github.com/godotengine/godot
|
||||
|
||||
The icons must be created in a vector graphics editor in ``svg`` format. You
|
||||
can use ``engine/icons/inkscape_template.svg`` with default icon properties
|
||||
already set up.
|
||||
The icons must be created in a vector graphics editor in SVG format. There are
|
||||
two main requirements to follow:
|
||||
|
||||
Once you're satisfied with the icon's design, save the icon in
|
||||
``engine/icons/svg/`` folder. But in order for the engine to automatically
|
||||
pick up the icons, each icon's filename:
|
||||
- Icons must be 16×16. In Inkscape, you can configure the document size in
|
||||
**File > Document Properties**.
|
||||
- Lines should be snapped to pixels whenever possible to remain crisp at lower DPI.
|
||||
You can create a 16×16 grid in Inkscape to make this easier.
|
||||
|
||||
1. Must be prefixed with ``icon_``.
|
||||
|
||||
2. ``PascalCase`` name should be converted to ``snake_case``, so words
|
||||
are separated by ``_`` whenever case changes, and uppercase acronyms must
|
||||
also have all letters, numbers, and special characters separated as distinct
|
||||
words. Some examples:
|
||||
|
||||
+--------------------+----------------------------------+
|
||||
| Name | Filename |
|
||||
+====================+==================================+
|
||||
| ``Polygon2D`` | ``icon_polygon_2_d.svg`` |
|
||||
+--------------------+----------------------------------+
|
||||
| ``CSGPolygon`` | ``icon_c_s_g_polygon.svg`` |
|
||||
+--------------------+----------------------------------+
|
||||
| ``CPUParticles2D`` | ``icon_c_p_u_particles_2_d.svg`` |
|
||||
+--------------------+----------------------------------+
|
||||
| ``C#`` | ``icon_c_#.svg`` |
|
||||
+--------------------+----------------------------------+
|
||||
Once you're satisfied with the icon's design, save the icon in the cloned
|
||||
repository's ``editor/icons`` folder. The icon name should match the intended
|
||||
name in a case-sensitive manner. For example, to create an icon for
|
||||
CPUParticles2D, name the file ``CPUParticles2D.svg``.
|
||||
|
||||
Icon optimization
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Because the editor renders the ``svg``'s at runtime, they need to be small
|
||||
in size, so they can be efficiently parsed. Editor icons must be first
|
||||
Because the editor renders SVGs once at load time, they need to be small
|
||||
in size so they can be efficiently parsed. Editor icons must be first
|
||||
optimized before being added to the engine, to do so:
|
||||
|
||||
1. Add them to the ``engine/icons/svg`` folder.
|
||||
@@ -69,10 +55,8 @@ Integrating and sharing the icons
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you're contributing to the engine itself, you should make a pull request to
|
||||
add optimized icons to ``godot/editor/icons`` in the main repository. Recompile
|
||||
the engine to make sure it does pick up new icons for classes. Once merged,
|
||||
don't forget to add the original version of the icons to the ``godot-design``
|
||||
repository so that the icon can be improved upon by other contributors.
|
||||
add optimized icons to ``editor/icons`` in the main repository. Recompile the
|
||||
engine to make it pick up new icons for classes.
|
||||
|
||||
It's also possible to create custom icons within a module. If you're creating
|
||||
your own module and don't plan to integrate it with Godot, you don't need to
|
||||
@@ -89,10 +73,10 @@ If icons don't appear in the editor make sure that:
|
||||
|
||||
1. Each icon's filename matches the naming requirement as described previously.
|
||||
|
||||
2. ``modules/svg`` is enabled (should be enabled by default). Without it, icons
|
||||
won't appear in the editor at all.
|
||||
2. ``modules/svg`` is enabled (it should be enabled by default). Without it,
|
||||
icons won't appear in the editor at all.
|
||||
|
||||
References:
|
||||
~~~~~~~~~~~
|
||||
References
|
||||
~~~~~~~~~~
|
||||
|
||||
- `editor/icons <https://github.com/godotengine/godot/tree/master/editor/icons>`__
|
||||
|
||||
@@ -250,14 +250,10 @@ Text Editor
|
||||
+---------------------------+--------------------------+----------------------------+-------------------------------------------------+
|
||||
| Fold/Unfold Line | :kbd:`Alt + F` | :kbd:`Alt + F` | ``script_text_editor/toggle_fold_line`` |
|
||||
+---------------------------+--------------------------+----------------------------+-------------------------------------------------+
|
||||
| Clone Down | :kbd:`Ctrl + Shift + C` | :kbd:`Cmd + Shift + C` | ``script_text_editor/clone_down`` |
|
||||
| Clone Down | :kbd:`Ctrl + D` | :kbd:`Cmd + Shift + C` | ``script_text_editor/clone_down`` |
|
||||
+---------------------------+--------------------------+----------------------------+-------------------------------------------------+
|
||||
| Complete Symbol | :kbd:`Ctrl + Space` | :kbd:`Ctrl + Space` | ``script_text_editor/complete_symbol`` |
|
||||
+---------------------------+--------------------------+----------------------------+-------------------------------------------------+
|
||||
| Clone Down | :kbd:`Ctrl + D` | :kbd:`Cmd + D` | ``script_text_editor/clone_down`` |
|
||||
+---------------------------+--------------------------+----------------------------+-------------------------------------------------+
|
||||
| Complete Symbol | :kbd:`Ctrl + Space` | :kbd:`Cmd + Space` | ``script_text_editor/complete_symbol`` |
|
||||
+---------------------------+--------------------------+----------------------------+-------------------------------------------------+
|
||||
| Evaluate Selection | :kbd:`Ctrl + Shift + E` | :kbd:`Cmd + Shift + E` | ``script_text_editor/evaluate_selection`` |
|
||||
+---------------------------+--------------------------+----------------------------+-------------------------------------------------+
|
||||
| Trim Trailing Whitespace | :kbd:`Ctrl + Alt + T` | :kbd:`Cmd + Alt + T` | ``script_text_editor/trim_trailing_whitespace`` |
|
||||
|
||||
@@ -35,8 +35,8 @@ page in the Mono documentation.
|
||||
Setting up C# for Godot
|
||||
-----------------------
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
Windows (Visaul Studio)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Download and install the latest version of
|
||||
`Visual Studio <https://visualstudio.microsoft.com/downloads/>`_
|
||||
@@ -47,6 +47,22 @@ you can download just the
|
||||
instead.
|
||||
Make sure you at least have the .NET Framework 4.5 targeting pack installed, you can get it using any of the installers mentioned above inside the "Individual components" tab.
|
||||
|
||||
Windows (JetBrains Rider)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
JetBrains Rider comes with bundled MSBuild, so you just need a recent .NET Framework Developer Pack.
|
||||
Make sure to set the following preferences:
|
||||
|
||||
- In Godot:
|
||||
|
||||
- Mono External Editor to JetBrains Rider
|
||||
- Mono Build Tool to JetBrains Mono.
|
||||
|
||||
- In Rider:
|
||||
|
||||
- ``TargetFrameworkVersion`` in ``csproj`` should match the installed .NET Framework Developer Pack.
|
||||
- Install **Godot support** plugin.
|
||||
|
||||
macOS and Linux
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -294,3 +310,19 @@ Configuring VS 2019 for debugging
|
||||
|
||||
5. Run the game in Godot. It should hang at the Godot splash screen while it waits for your debugger to attach.
|
||||
6. In VS 2019, open your project and choose Extensions --> Mono --> Attach to Mono Debugger.
|
||||
|
||||
Configuring Visual Studio Code for debugging
|
||||
--------------------------------------------
|
||||
|
||||
To configure Visual Studio Code for debugging open up a project in Godot. Click on Project
|
||||
and open the project settings. Scroll down and click on Debugger Agent under the Mono
|
||||
category. Then turn on the setting "wait for debugger." Next, copy the port number
|
||||
and open up Visual Studio Code.
|
||||
|
||||
You need to download the Mono Debug extension from Microsoft. Then open the Godot
|
||||
project folder. Go to the run tab and click on create a launch.json file. Select C#
|
||||
Mono from the dropdown menu. When the launch.json file is automatically opened,
|
||||
change the port number to the number you copied previously and save the file. On the
|
||||
run tab, switch the run setting from launch to attach. Whenever you want to debug,
|
||||
make sure Wait for Debugger is turned on in Godot, run the project, and run the
|
||||
debugger in Visual Studio Code.
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
.. _doc_creating_script_templates:
|
||||
|
||||
Creating script templates
|
||||
=========================
|
||||
|
||||
Godot provides a way to use script templates as seen in the
|
||||
``Script Create Dialog`` while creating a new script:
|
||||
|
||||
.. image:: img/script_create_dialog_templates.png
|
||||
|
||||
A set of default script templates is provided by default, but it's also possible
|
||||
to modify existing and create new ones, both per project and the editor.
|
||||
|
||||
Locating the templates
|
||||
----------------------
|
||||
|
||||
There are two places where templates can be managed.
|
||||
|
||||
Editor-defined templates
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
These are available globally throughout any project. The location of these
|
||||
templates are determined per each OS:
|
||||
|
||||
- Windows: ``%APPDATA%\Godot\script_templates\``
|
||||
- Linux: ``$HOME/.local/share/godot/script_templates/``
|
||||
- macOS: ``$HOME/Library/Application Support/Godot/script_templates/``
|
||||
|
||||
If no ``script_templates`` is detected, Godot will create a default set of
|
||||
built-in templates automatically, so this logic can be used to reset the default
|
||||
templates in case you've accidentally overwritten them.
|
||||
|
||||
Project-defined templates
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The default path to search for templates is the
|
||||
``res://script_templates/`` directory. The path can be changed by configuring
|
||||
the ``editor/script_templates_search_path`` setting in the
|
||||
:ref:`ProjectSettings <class_ProjectSettings>`, both via code and the editor.
|
||||
|
||||
If no ``script_templates`` directory is found within a project, it is simply
|
||||
ignored.
|
||||
|
||||
Language support and overriding behavior
|
||||
----------------------------------------
|
||||
|
||||
Depending on whether a particular language implements a way to generate scripts
|
||||
out of templates, it's possible to create a template which can be recognized by
|
||||
that language according to template's file extension. For GDScript and C#, the
|
||||
extensions must be ``gd`` and ``cs`` respectively.
|
||||
|
||||
.. note:: The script templates have the same extension as the regular script
|
||||
files. This may lead to an issue of a script parser treating those templates as
|
||||
actual scripts within a project. To avoid this, make sure to ignore the
|
||||
directory containing them by creating a ``.gdignore`` file. The directory won't be
|
||||
visible throughout the project's filesystem anymore, yet the templates can be
|
||||
modified by an external text editor anytime.
|
||||
|
||||
The built-in editor templates are automatically shadowed by the project-specific
|
||||
templates given both scripts have the same filename.
|
||||
|
||||
Default template
|
||||
----------------
|
||||
|
||||
The ``Default`` template is always generated dynamically per language and cannot
|
||||
be configured nor overridden, but you can use these as the base for creating
|
||||
other templates.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
extends %BASE%
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a%INT_TYPE% = 2
|
||||
# var b%STRING_TYPE% = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready()%VOID_RETURN%:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta%FLOAT_TYPE%)%VOID_RETURN%:
|
||||
# pass
|
||||
|
||||
|
||||
.. code-tab:: csharp
|
||||
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public class %CLASS% : %BASE%
|
||||
{
|
||||
// Declare member variables here. Examples:
|
||||
// private int a = 2;
|
||||
// private string b = "text";
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// // Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
// public override void _Process(float delta)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
List of template placeholders
|
||||
-----------------------------
|
||||
|
||||
The following describes the complete list of built-in template placeholders
|
||||
which are currently implemented.
|
||||
|
||||
Base placeholders
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
+-------------+----------------------------------------------------------------+
|
||||
| Placeholder | Description |
|
||||
+=============+================================================================+
|
||||
| ``%CLASS%`` | The name of the new class (used in C# only). |
|
||||
+-------------+----------------------------------------------------------------+
|
||||
| ``%BASE%`` | The base type a new script inherits from. |
|
||||
+-------------+----------------------------------------------------------------+
|
||||
| ``%TS%`` | Indentation placeholder. The exact type and number of |
|
||||
| | whitespace characters used for indentation is determined by |
|
||||
| | the ``text_editor/indent/type`` and ``text_editor/indent/size``|
|
||||
| | settings in the :ref:`EditorSettings <class_EditorSettings>` |
|
||||
| | respectively. |
|
||||
+-------------+----------------------------------------------------------------+
|
||||
|
||||
Type placeholders
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
These are only relevant for GDScript with static typing. Whether these
|
||||
placeholders are actually replaced is determined by the
|
||||
``text_editor/completion/add_type_hints`` setting in the
|
||||
:ref:`EditorSettings <class_EditorSettings>`.
|
||||
|
||||
+-------------------+--------------+
|
||||
| Placeholder | Value |
|
||||
+===================+==============+
|
||||
| ``%INT_TYPE%`` | ``: int`` |
|
||||
+-------------------+--------------+
|
||||
| ``%STRING_TYPE%`` | ``: String`` |
|
||||
+-------------------+--------------+
|
||||
| ``%FLOAT_TYPE%`` | ``: float`` |
|
||||
+-------------------+--------------+
|
||||
| ``%VOID_RETURN%`` | ``-> void`` |
|
||||
+-------------------+--------------+
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -9,3 +9,4 @@ Scripting
|
||||
visual_script/index
|
||||
c_sharp/index
|
||||
cross_language_scripting
|
||||
creating_script_templates
|
||||
|
||||
@@ -420,5 +420,5 @@ disable it by setting "Export With Debug" off when you export the project.
|
||||
.. note:: While WASM is supported in all major browsers, it is still an emerging
|
||||
technology and you may find some things that don't work. Make sure
|
||||
you have updated your browser to the most recent version, and report
|
||||
any bugs you find at the `Godot Github repository
|
||||
any bugs you find at the `Godot GitHub repository
|
||||
<https://github.com/godotengine/godot/issues>`_.
|
||||
|
||||
@@ -14,7 +14,7 @@ send out a message that other nodes can listen for and respond to. For example,
|
||||
rather than continuously checking a button to see if it's being pressed, the
|
||||
button can emit a signal when it's pressed.
|
||||
|
||||
.. note:: You can read more about the observer pattern here: http://gameprogrammingpatterns.com/observer.html
|
||||
.. note:: You can read more about the observer pattern here: https://gameprogrammingpatterns.com/observer.html
|
||||
|
||||
Signals are a way to *decouple* your game objects, which leads to better organized
|
||||
and more manageable code. Instead of forcing game objects to expect other objects
|
||||
|
||||
@@ -213,8 +213,8 @@ of information. And you will update the state of your connected node
|
||||
.. note::
|
||||
|
||||
The Observer pattern, that signals derive from, still adds a bit of coupling between node branches. But it's generally lighter and more secure than accessing nodes directly to communicate between two separate classes. It can be okay for a parent node to get values from its children. But you'll want to favor signals if you're working with two separate branches.
|
||||
Read Game Programming Patterns for more information on the `Observer pattern <http://gameprogrammingpatterns.com/observer.html>`_.
|
||||
The `full book <http://gameprogrammingpatterns.com/contents.html>`_ is available online for free.
|
||||
Read Game Programming Patterns for more information on the `Observer pattern <https://gameprogrammingpatterns.com/observer.html>`_.
|
||||
The `full book <https://gameprogrammingpatterns.com/contents.html>`_ is available online for free.
|
||||
|
||||
With this in mind, let's connect the ``GUI`` to the ``Player``. Click on
|
||||
the ``Player`` node in the scene dock to select it. Head down to the
|
||||
|
||||
@@ -273,10 +273,10 @@ limited only by their imagination.
|
||||
Enumerations: int vs. string
|
||||
----------------------------
|
||||
|
||||
Most languages offer an enumeration type option. GDScript is no different,
|
||||
but unlike most other languages, it allows one to use either integers or
|
||||
strings for the enum values. The question then arises, "which should one
|
||||
use?"
|
||||
Most languages offer an enumeration type option. GDScript is no different, but
|
||||
unlike most other languages, it allows one to use either integers or strings for
|
||||
the enum values (the latter only when using the ``export`` keyword in GDScript).
|
||||
The question then arises, "which should one use?"
|
||||
|
||||
The short answer is, "whichever you are more comfortable with." This
|
||||
is a feature specific to GDScript and not Godot scripting in general;
|
||||
|
||||
@@ -76,7 +76,7 @@ Launcher icons are used by Android launcher apps to represent your application t
|
||||
|
||||
There are two types of icons required by Godot:
|
||||
|
||||
- **Main Icon:**: The "classic" icon. This will be used on all Android versions up to Android 8 (Oreo), exclusive. Must be at least 192×192 px.
|
||||
- **Main Icon:** The "classic" icon. This will be used on all Android versions up to Android 8 (Oreo), exclusive. Must be at least 192×192 px.
|
||||
- **Adaptive Icons:** Starting from Android 8 (inclusive), `Adaptive Icons <https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive>`_ were introduced. Applications will need to include separate background and foreground icons to have a native look. The user's launcher application will control the icon's animation and masking. Must be at least 432×432 px.
|
||||
|
||||
.. seealso:: It's important to adhere to some rules when designing adaptive icons. `Google Design has provided a nice article <https://medium.com/google-design/designing-adaptive-icons-515af294c783>`_ that helps to understand those rules and some of the capabilities of adaptive icons.
|
||||
|
||||
@@ -20,13 +20,18 @@ in the user's browser.
|
||||
Use ``python -m http.server`` with Python 3 to serve the
|
||||
current working directory at ``http://localhost:8000``.
|
||||
|
||||
.. attention:: `There are significant bugs when running HTML5 projects on iOS <https://github.com/godotengine/godot/issues/26554>`__
|
||||
(regardless of the browser). We recommend using
|
||||
:ref:`iOS' native export functionality <doc_exporting_for_ios>`
|
||||
instead, as it will also result in better performance.
|
||||
|
||||
WebGL 2
|
||||
-------
|
||||
|
||||
Until the *OpenGL ES 3* renderer is removed from Godot in favor of *Vulkan*,
|
||||
HTML5 export uses *WebGL 2* when the *GLES3* option is selected.
|
||||
|
||||
.. warning:: Usage of WebGL 2 is not recommended due to its expected removal
|
||||
.. warning:: Using WebGL 2 is not recommended due to its expected removal
|
||||
from Godot without replacement.
|
||||
|
||||
WebGL 2 is not supported in all browsers. **Firefox** and
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 148 KiB |
@@ -28,10 +28,11 @@ Godot Docs – *3.2* branch
|
||||
the "latest" (development) branch, but should be suitable to learn
|
||||
how to use stable Godot releases nevertheless.
|
||||
|
||||
Welcome to the official documentation of Godot Engine, the free and open source
|
||||
community-driven 2D and 3D game engine! If you are new to this documentation,
|
||||
we recommend that you read the :ref:`introduction page <doc_about_intro>` to
|
||||
get an overview of what this documentation has to offer.
|
||||
Welcome to the official documentation of `Godot Engine <https://godotengine.org>`__,
|
||||
the free and open source community-driven 2D and 3D game engine! If you are new
|
||||
to this documentation, we recommend that you read the
|
||||
:ref:`introduction page <doc_about_intro>` to get an overview of what this
|
||||
documentation has to offer.
|
||||
|
||||
The table of contents below and in the sidebar should let you easily access the
|
||||
documentation for your topic of interest. You can also use the search function
|
||||
|
||||
@@ -290,7 +290,7 @@ Add the following code to ``Player.gd``:
|
||||
// -------------------------------------------------------------------
|
||||
// Walking
|
||||
_dir = new Vector3();
|
||||
Transform camXform = _camera.GetGlobalTransform();
|
||||
Transform camXform = _camera.GlobalTransform;
|
||||
|
||||
Vector2 inputMovementVector = new Vector2();
|
||||
|
||||
|
||||
@@ -347,11 +347,11 @@ uses the mouse pointer. Here is the code for the Player, using ``move_and_slide(
|
||||
_velocity = new Vector2();
|
||||
if (Input.IsActionPressed("backward"))
|
||||
{
|
||||
_velocity = new Vector2(-speed/3, 0).Rotated(Rotation);
|
||||
_velocity = new Vector2(-Speed/3, 0).Rotated(Rotation);
|
||||
}
|
||||
if (Input.IsActionPressed("forward"))
|
||||
{
|
||||
_velocity = new Vector2(speed, 0).Rotated(Rotation);
|
||||
_velocity = new Vector2(Speed, 0).Rotated(Rotation);
|
||||
}
|
||||
if (Input.IsActionPressed("mouse_click"))
|
||||
{
|
||||
|
||||
@@ -44,6 +44,9 @@ replaced with their actual values during export.
|
||||
class. A splash image shown during the booting process can be accessed using this variable
|
||||
as well: ``$GODOT_BASENAME.png``.
|
||||
|
||||
- ``$GODOT_PROJECT_NAME``:
|
||||
The project name as defined in the Project Settings.
|
||||
|
||||
- ``$GODOT_HEAD_INCLUDE``:
|
||||
A custom string to include in the HTML document just before the end of the ``<head>`` tag. It
|
||||
is customized in the export options under the *Html / Head Include* section. While you fully
|
||||
|
||||
@@ -57,7 +57,7 @@ You should end up with a directory structure like this:
|
||||
.. image:: img/making_plugins-my_custom_mode_folder.png
|
||||
|
||||
``plugin.cfg`` is a simple INI file with metadata about your plugin.
|
||||
The name and description help people undersatnd what it does.
|
||||
The name and description help people understand what it does.
|
||||
Your name helps you get properly credited for your work.
|
||||
The version number helps others know if they have an outdated version;
|
||||
if you are unsure on how to come up with the version number, check out `Semantic Versioning <https://semver.org/>`_.
|
||||
|
||||
@@ -213,9 +213,9 @@ They can be initialized at the beginning like:
|
||||
|
||||
.. code-block:: glsl
|
||||
|
||||
float float_arr[3] = float[3] ( 1.0, 0.5, 0.0 ); // first constructor
|
||||
float float_arr[3] = float[3] (1.0, 0.5, 0.0); // first constructor
|
||||
|
||||
int int_arr[3] = int[] ( 2, 1, 0 ); // second constructor
|
||||
int int_arr[3] = int[] (2, 1, 0); // second constructor
|
||||
|
||||
vec2 vec2_arr[3] = { vec2(1.0, 1.0), vec2(0.5, 0.5), vec2(0.0, 0.0) }; // third constructor
|
||||
|
||||
@@ -226,7 +226,7 @@ You can declare multiple arrays (even with different sizes) in one expression:
|
||||
.. code-block:: glsl
|
||||
|
||||
float a[3] = float[3] (1.0, 0.5, 0.0),
|
||||
b[2] = {1.0, 0.5},
|
||||
b[2] = { 1.0, 0.5 },
|
||||
c[] = { 0.7 },
|
||||
d = 0.0,
|
||||
e[5];
|
||||
@@ -295,33 +295,33 @@ Operators
|
||||
|
||||
Godot shading language supports the same set of operators as GLSL ES 3.0. Below is the list of them in precedence order:
|
||||
|
||||
+-------------+-----------------------+--------------------+
|
||||
| Precedence | Class | Operator |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 1 (highest) | parenthetical grouping| **()** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 2 | unary | **+, -, !, ~** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 3 | multiplicative | **/, \*, %** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 4 | additive | **+, -** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 5 | bit-wise shift | **<<, >>** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 6 | relational | **<, >, <=, >=** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 7 | equality | **==, !=** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 8 | bit-wise and | **&** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 9 | bit-wise exclusive or | **^** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 10 | bit-wise inclusive or | **|** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 11 | logical and | **&&** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
| 12 (lowest) | logical inclusive or | **||** |
|
||||
+-------------+-----------------------+--------------------+
|
||||
+-------------+------------------------+------------------+
|
||||
| Precedence | Class | Operator |
|
||||
+-------------+------------------------+------------------+
|
||||
| 1 (highest) | parenthetical grouping | **()** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 2 | unary | **+, -, !, ~** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 3 | multiplicative | **/, \*, %** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 4 | additive | **+, -** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 5 | bit-wise shift | **<<, >>** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 6 | relational | **<, >, <=, >=** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 7 | equality | **==, !=** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 8 | bit-wise AND | **&** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 9 | bit-wise exclusive OR | **^** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 10 | bit-wise inclusive OR | **|** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 11 | logical AND | **&&** |
|
||||
+-------------+------------------------+------------------+
|
||||
| 12 (lowest) | logical inclusive OR | **||** |
|
||||
+-------------+------------------------+------------------+
|
||||
|
||||
Flow control
|
||||
------------
|
||||
@@ -513,25 +513,25 @@ It's important to understand that textures that are supplied as color require hi
|
||||
|
||||
Full list of hints below:
|
||||
|
||||
+----------------+-------------------------------+-------------------------------------+
|
||||
| Type | Hint | Description |
|
||||
+================+===============================+=====================================+
|
||||
| **vec4** | hint_color | Used as color |
|
||||
+----------------+-------------------------------+-------------------------------------+
|
||||
| **int, float** | hint_range(min,max [,step] ) | Used as range (with min/max/step) |
|
||||
+----------------+-------------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_albedo | Used as albedo color, default white |
|
||||
+----------------+-------------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_black_albedo | Used as albedo color, default black |
|
||||
+----------------+-------------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_normal | Used as normalmap |
|
||||
+----------------+-------------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_white | As value, default to white. |
|
||||
+----------------+-------------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_black | As value, default to black |
|
||||
+----------------+-------------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_aniso | As flowmap, default to right. |
|
||||
+----------------+-------------------------------+-------------------------------------+
|
||||
+----------------+-----------------------------+-------------------------------------+
|
||||
| Type | Hint | Description |
|
||||
+================+=============================+=====================================+
|
||||
| **vec4** | hint_color | Used as color |
|
||||
+----------------+-----------------------------+-------------------------------------+
|
||||
| **int, float** | hint_range(min,max [,step]) | Used as range (with min/max/step) |
|
||||
+----------------+-----------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_albedo | Used as albedo color, default white |
|
||||
+----------------+-----------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_black_albedo | Used as albedo color, default black |
|
||||
+----------------+-----------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_normal | Used as normalmap |
|
||||
+----------------+-----------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_white | As value, default to white. |
|
||||
+----------------+-----------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_black | As value, default to black |
|
||||
+----------------+-----------------------------+-------------------------------------+
|
||||
| **sampler2D** | hint_aniso | As flowmap, default to right. |
|
||||
+----------------+-----------------------------+-------------------------------------+
|
||||
|
||||
GDScript uses different variable types than GLSL does, so when passing variables from GDScript
|
||||
to shaders, Godot converts the type automatically. Below is a table of the corresponding types:
|
||||
@@ -577,202 +577,202 @@ When vec_type (float), vec_int_type, vec_uint_type, vec_bool_type nomenclature i
|
||||
.. note:: For a list of the functions that are not available in the GLES2 backend, please see the
|
||||
:ref:`Differences between GLES2 and GLES3 doc <doc_gles2_gles3_differences>`.
|
||||
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| Function | Description |
|
||||
+============================================================================+==================================================+
|
||||
| vec_type **radians** ( vec_type degrees ) | Convert degrees to radians |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **degrees** ( vec_type radians ) | Convert radians to degrees |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **sin** ( vec_type x ) | Sine |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **cos** ( vec_type x ) | Cosine |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **tan** ( vec_type x ) | Tangent |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **asin** ( vec_type x ) | Arc-Sine |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **acos** ( vec_type x ) | Arc-Cosine |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **atan** ( vec_type y_over_x ) | Arc-Tangent |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **atan** ( vec_type y, vec_type x ) | Arc-Tangent to convert vector to angle |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **sinh** ( vec_type x ) | Hyperbolic-Sine |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **cosh** ( vec_type x ) | Hyperbolic-Cosine |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **tanh** ( vec_type x ) | Hyperbolic-Tangent |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **asinh** ( vec_type x ) | Inverse-Hyperbolic-Sine |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **acosh** ( vec_type x ) | Inverse-Hyperbolic-Cosine |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **atanh** ( vec_type x ) | Inverse-Hyperbolic-Tangent |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **pow** ( vec_type x, vec_type y ) | Power |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **exp** ( vec_type x ) | Base-e Exponential |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **exp2** ( vec_type x ) | Base-2 Exponential |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **log** ( vec_type x ) | Natural Logarithm |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **log2** ( vec_type x ) | Base-2 Logarithm |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **sqrt** ( vec_type x ) | Square Root |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **inversesqrt** ( vec_type x ) | Inverse Square Root |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **abs** ( vec_type x ) | Absolute |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| ivec_type **abs** ( ivec_type x ) | Absolute |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **sign** ( vec_type x ) | Sign |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| ivec_type **sign** ( ivec_type x ) | Sign |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **floor** ( vec_type x ) | Floor |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **round** ( vec_type x ) | Round |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **roundEven** ( vec_type x ) | Round nearest even |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **trunc** ( vec_type x ) | Truncation |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **ceil** ( vec_type x ) | Ceil |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **fract** ( vec_type x ) | Fractional |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **mod** ( vec_type x, vec_type y ) | Remainder |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **mod** ( vec_type x , float y ) | Remainder |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **modf** ( vec_type x, out vec_type i ) | Fractional of x, with i has integer part |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **min** ( vec_type a, vec_type b ) | Minimum |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **max** ( vec_type a, vec_type b ) | Maximum |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **clamp** ( vec_type x, vec_type min, vec_type max ) | Clamp to Min-Max |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **mix** ( float a, float b, float c ) | Linear Interpolate |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **mix** ( vec_type a, vec_type b, float c ) | Linear Interpolate (Scalar Coef.) |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **mix** ( vec_type a, vec_type b, vec_type c ) | Linear Interpolate (Vector Coef.) |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **mix** ( vec_type a, vec_type b, bvec_type c ) | Linear Interpolate (Boolean-Vector Selection) |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **step** ( vec_type a, vec_type b ) | ``b[i] < a[i] ? 0.0 : 1.0`` |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **step** ( float a, vec_type b) | ``b[i] < a ? 0.0 : 1.0`` |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **smoothstep** ( vec_type a, vec_type b, vec_type c ) | Hermite Interpolate |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **smoothstep** ( float a, float b, vec_type c ) | Hermite Interpolate |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bvec_type **isnan** ( vec_type x ) | Scalar, or vector component being NaN |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bvec_type **isinf** ( vec_type x ) | Scalar, or vector component being INF |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| ivec_type **floatBitsToInt** ( vec_type x ) | Float->Int bit copying, no conversion |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| uvec_type **floatBitsToUint** ( vec_type x ) | Float->UInt bit copying, no conversion |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **intBitsToFloat** ( ivec_type x ) | Int->Float bit copying, no conversion |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **uintBitsToFloat** ( uvec_type x ) | UInt->Float bit copying, no conversion |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| float **length** ( vec_type x ) | Vector Length |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| float **distance** ( vec_type a, vec_type b ) | Distance between vectors i.e ``length(a - b)`` |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| float **dot** ( vec_type a, vec_type b ) | Dot Product |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec3 **cross** ( vec3 a, vec3 b ) | Cross Product |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **normalize** ( vec_type x ) | Normalize to unit length |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec3 **reflect** ( vec3 I, vec3 N ) | Reflect |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec3 **refract** ( vec3 I, vec3 N, float eta ) | Refract |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **faceforward** ( vec_type N, vec_type I, vec_type Nref ) | If dot(Nref, I) < 0, return N, otherwise –N |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| mat_type **matrixCompMult** ( mat_type x, mat_type y ) | Matrix Component Multiplication |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| mat_type **outerProduct** ( vec_type column, vec_type row ) | Matrix Outer Product |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| mat_type **transpose** ( mat_type m ) | Transpose Matrix |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| float **determinant** ( mat_type m ) | Matrix Determinant |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| mat_type **inverse** ( mat_type m ) | Inverse Matrix |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bvec_type **lessThan** ( vec_type x, vec_type y ) | Bool vector cmp on < int/uint/float vectors |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bvec_type **greaterThan** ( vec_type x, vec_type y ) | Bool vector cmp on > int/uint/float vectors |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bvec_type **lessThanEqual** ( vec_type x, vec_type y ) | Bool vector cmp on <= int/uint/float vectors |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bvec_type **greaterThanEqual** ( vec_type x, vec_type y ) | Bool vector cmp on >= int/uint/float vectors |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bvec_type **equal** ( vec_type x, vec_type y ) | Bool vector cmp on == int/uint/float vectors |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bvec_type **notEqual** ( vec_type x, vec_type y ) | Bool vector cmp on != int/uint/float vectors |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bool **any** ( bvec_type x ) | Any component is ``true`` |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bool **all** ( bvec_type x ) | All components are ``true`` |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| bvec_type **not** ( bvec_type x ) | Invert boolean vector |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| ivec2 **textureSize** ( sampler2D_type s, int lod ) | Get the size of a 2D texture |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| ivec3 **textureSize** ( sampler2DArray_type s, int lod ) | Get the size of a 2D texture array |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| ivec3 **textureSize** ( sampler3D s, int lod ) | Get the size of a 3D texture |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| ivec2 **textureSize** ( samplerCube s, int lod ) | Get the size of a Cube texture |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **texture** ( sampler2D_type s, vec2 uv [, float bias] ) | Perform a 2D texture read |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **texture** ( sampler2DArray_type s, vec3 uv [, float bias] ) | Perform a 2D texture array read |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **texture** ( sampler3D_type s, vec3 uv [, float bias] ) | Perform a 3D texture read |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4 **texture** ( samplerCube s, vec3 uv [, float bias] ) | Perform an Cube texture read |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **textureProj** ( sampler2D_type s, vec3 uv [, float bias] ) | Perform a 2D texture read with projection |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **textureProj** ( sampler2D_type s, vec4 uv [, float bias] ) | Perform a 2D texture read with projection |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **textureProj** ( sampler3D_type s, vec4 uv [, float bias] ) | Perform a 3D texture read with projection |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **textureLod** ( sampler2D_type s, vec2 uv, float lod ) | Perform a 2D texture read at custom mipmap |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **textureLod** ( sampler2DArray_type s, vec3 uv, float lod ) | Perform a 2D texture array read at custom mipmap |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **textureLod** ( sampler3D_type s, vec3 uv, float lod ) | Perform a 3D texture read at custom mipmap |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4 **textureLod** ( samplerCube s, vec3 uv, float lod ) | Perform a 3D texture read at custom mipmap |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **textureProjLod** ( sampler2D_type s, vec3 uv, float lod ) | Perform a 2D texture read with projection/lod |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **textureProjLod** ( sampler2D_type s, vec4 uv, float lod ) | Perform a 2D texture read with projection/lod |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **textureProjLod** ( sampler3D_type s, vec4 uv, float lod ) | Perform a 3D texture read with projection/lod |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **texelFetch** ( sampler2D_type s, ivec2 uv, int lod ) | Fetch a single texel using integer coords |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **texelFetch** ( sampler2DArray_type s, ivec3 uv, int lod ) | Fetch a single texel using integer coords |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec4_type **texelFetch** ( sampler3D_type s, ivec3 uv, int lod ) | Fetch a single texel using integer coords |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **dFdx** ( vec_type p ) | Derivative in x using local differencing |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **dFdy** ( vec_type p ) | Derivative in y using local differencing |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
| vec_type **fwidth** ( vec_type p ) | Sum of absolute derivative in x and y |
|
||||
+----------------------------------------------------------------------------+--------------------------------------------------+
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| Function | Description |
|
||||
+========================================================================+===============================================================+
|
||||
| vec_type **radians** (vec_type degrees) | Convert degrees to radians |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **degrees** (vec_type radians) | Convert radians to degrees |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **sin** (vec_type x) | Sine |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **cos** (vec_type x) | Cosine |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **tan** (vec_type x) | Tangent |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **asin** (vec_type x) | Arcsine |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **acos** (vec_type x) | Arccosine |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **atan** (vec_type y_over_x) | Arctangent |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **atan** (vec_type y, vec_type x) | Arctangent to convert vector to angle |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **sinh** (vec_type x) | Hyperbolic sine |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **cosh** (vec_type x) | Hyperbolic cosine |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **tanh** (vec_type x) | Hyperbolic tangent |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **asinh** (vec_type x) | Inverse hyperbolic sine |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **acosh** (vec_type x) | Inverse hyperbolic cosine |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **atanh** (vec_type x) | Inverse hyperbolic tangent |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **pow** (vec_type x, vec_type y) | Power (undefined if ``x`` < 0 or if ``x`` = 0 and ``y`` <= 0) |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **exp** (vec_type x) | Base-e exponential |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **exp2** (vec_type x) | Base-2 exponential |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **log** (vec_type x) | Natural logarithm |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **log2** (vec_type x) | Base-2 logarithm |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **sqrt** (vec_type x) | Square root |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **inversesqrt** (vec_type x) | Inverse square root |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **abs** (vec_type x) | Absolute |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| ivec_type **abs** (ivec_type x) | Absolute |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **sign** (vec_type x) | Sign |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| ivec_type **sign** (ivec_type x) | Sign |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **floor** (vec_type x) | Floor |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **round** (vec_type x) | Round |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **roundEven** (vec_type x) | Round to the nearest even number |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **trunc** (vec_type x) | Truncation |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **ceil** (vec_type x) | Ceil |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **fract** (vec_type x) | Fractional |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **mod** (vec_type x, vec_type y) | Remainder |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **mod** (vec_type x , float y) | Remainder |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **modf** (vec_type x, out vec_type i) | Fractional of ``x``, with ``i`` as integer part |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **min** (vec_type a, vec_type b) | Minimum |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **max** (vec_type a, vec_type b) | Maximum |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **clamp** (vec_type x, vec_type min, vec_type max) | Clamp to ``min..max`` |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **mix** (float a, float b, float c) | Linear interpolate |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **mix** (vec_type a, vec_type b, float c) | Linear interpolate (scalar coefficient) |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **mix** (vec_type a, vec_type b, vec_type c) | Linear interpolate (vector coefficient) |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **mix** (vec_type a, vec_type b, bvec_type c) | Linear interpolate (boolean-vector selection) |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **step** (vec_type a, vec_type b) | ``b[i] < a[i] ? 0.0 : 1.0`` |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **step** (float a, vec_type b) | ``b[i] < a ? 0.0 : 1.0`` |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **smoothstep** (vec_type a, vec_type b, vec_type c) | Hermite interpolate |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **smoothstep** (float a, float b, vec_type c) | Hermite interpolate |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bvec_type **isnan** (vec_type x) | Returns ``true`` if scalar or vector component is ``NaN`` |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bvec_type **isinf** (vec_type x) | Returns ``true`` if scalar or vector component is ``INF`` |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| ivec_type **floatBitsToInt** (vec_type x) | Float->Int bit copying, no conversion |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| uvec_type **floatBitsToUint** (vec_type x) | Float->UInt bit copying, no conversion |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **intBitsToFloat** (ivec_type x) | Int->Float bit copying, no conversion |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **uintBitsToFloat** (uvec_type x) | UInt->Float bit copying, no conversion |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| float **length** (vec_type x) | Vector length |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| float **distance** (vec_type a, vec_type b) | Distance between vectors i.e ``length(a - b)`` |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| float **dot** (vec_type a, vec_type b) | Dot product |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec3 **cross** (vec3 a, vec3 b) | Cross croduct |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **normalize** (vec_type x) | Normalize to unit length |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec3 **reflect** (vec3 I, vec3 N) | Reflect |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec3 **refract** (vec3 I, vec3 N, float eta) | Refract |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **faceforward** (vec_type N, vec_type I, vec_type Nref) | If ``dot(Nref, I)`` < 0, return N, otherwise –N |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| mat_type **matrixCompMult** (mat_type x, mat_type y) | Matrix component multiplication |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| mat_type **outerProduct** (vec_type column, vec_type row) | Matrix outer product |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| mat_type **transpose** (mat_type m) | Transpose matrix |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| float **determinant** (mat_type m) | Matrix determinant |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| mat_type **inverse** (mat_type m) | Inverse matrix |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bvec_type **lessThan** (vec_type x, vec_type y) | Bool vector comparison on < int/uint/float vectors |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bvec_type **greaterThan** (vec_type x, vec_type y) | Bool vector comparison on > int/uint/float vectors |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bvec_type **lessThanEqual** (vec_type x, vec_type y) | Bool vector comparison on <= int/uint/float vectors |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bvec_type **greaterThanEqual** (vec_type x, vec_type y) | Bool vector comparison on >= int/uint/float vectors |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bvec_type **equal** (vec_type x, vec_type y) | Bool vector comparison on == int/uint/float vectors |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bvec_type **notEqual** (vec_type x, vec_type y) | Bool vector comparison on != int/uint/float vectors |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bool **any** (bvec_type x) | Any component is ``true`` |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bool **all** (bvec_type x) | All components are ``true`` |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| bvec_type **not** (bvec_type x) | Invert boolean vector |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| ivec2 **textureSize** (sampler2D_type s, int lod) | Get the size of a 2D texture |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| ivec3 **textureSize** (sampler2DArray_type s, int lod) | Get the size of a 2D texture array |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| ivec3 **textureSize** (sampler3D s, int lod) | Get the size of a 3D texture |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| ivec2 **textureSize** (samplerCube s, int lod) | Get the size of a cubemap texture |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **texture** (sampler2D_type s, vec2 uv [, float bias]) | Perform a 2D texture read |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **texture** (sampler2DArray_type s, vec3 uv [, float bias]) | Perform a 2D texture array read |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **texture** (sampler3D_type s, vec3 uv [, float bias]) | Perform a 3D texture read |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4 **texture** (samplerCube s, vec3 uv [, float bias]) | Perform a cubemap texture read |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **textureProj** (sampler2D_type s, vec3 uv [, float bias]) | Perform a 2D texture read with projection |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **textureProj** (sampler2D_type s, vec4 uv [, float bias]) | Perform a 2D texture read with projection |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **textureProj** (sampler3D_type s, vec4 uv [, float bias]) | Perform a 3D texture read with projection |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **textureLod** (sampler2D_type s, vec2 uv, float lod) | Perform a 2D texture read at custom mipmap |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **textureLod** (sampler2DArray_type s, vec3 uv, float lod) | Perform a 2D texture array read at custom mipmap |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **textureLod** (sampler3D_type s, vec3 uv, float lod) | Perform a 3D texture read at custom mipmap |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4 **textureLod** (samplerCube s, vec3 uv, float lod) | Perform a 3D texture read at custom mipmap |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **textureProjLod** (sampler2D_type s, vec3 uv, float lod) | Perform a 2D texture read with projection/LOD |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **textureProjLod** (sampler2D_type s, vec4 uv, float lod) | Perform a 2D texture read with projection/LOD |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **textureProjLod** (sampler3D_type s, vec4 uv, float lod) | Perform a 3D texture read with projection/LOD |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **texelFetch** (sampler2D_type s, ivec2 uv, int lod) | Fetch a single texel using integer coordinates |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **texelFetch** (sampler2DArray_type s, ivec3 uv, int lod) | Fetch a single texel using integer coordinates |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec4_type **texelFetch** (sampler3D_type s, ivec3 uv, int lod) | Fetch a single texel using integer coordinates |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **dFdx** (vec_type p) | Derivative in ``x`` using local differencing |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **dFdy** (vec_type p) | Derivative in ``y`` using local differencing |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
| vec_type **fwidth** (vec_type p) | Sum of absolute derivative in ``x`` and ``y`` |
|
||||
+------------------------------------------------------------------------+---------------------------------------------------------------+
|
||||
|
||||
Reference in New Issue
Block a user