Document Texture, CompressedTexture and Placeholder classes

This commit is contained in:
Hugo Locurcio 2022-10-24 23:19:32 +02:00
parent 340fb33e54
commit 17e75c830f
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
24 changed files with 155 additions and 21 deletions

View file

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="CompressedCubemap" inherits="CompressedTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="CompressedCubemap" inherits="CompressedTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
6-sided texture typically used in 3D rendering, optionally compressed.
</brief_description> </brief_description>
<description> <description>
A cubemap that is loaded from a [code].ccube[/code] file. This file format is internal to Godot; it is created by importing other image formats with the import system. [CompressedCubemap] can use one of 4 compresson methods:
- Uncompressed (uncompressed on the GPU)
- Lossless (WebP or PNG, uncompressed on the GPU)
- Lossy (WebP, uncompressed on the GPU)
- VRAM Compressed (compressed on the GPU)
Only [b]VRAM Compressed[/b] actually reduces the memory usage on the GPU. The [b]Lossless[/b] and [b]Lossy[/b] compression methods will reduce the required storage on disk, but they will not reduce memory usage on the GPU as the texture is sent to the GPU uncompressed.
Using [b]VRAM Compressed[/b] also improves loading times, as VRAM-compressed textures are faster to load compared to textures using lossless or lossy compression. VRAM compression can exhibit noticeable artifacts and is intended to be used for 3D rendering, not 2D.
See [Cubemap] for a general description of cubemaps.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="CompressedCubemapArray" inherits="CompressedTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="CompressedCubemapArray" inherits="CompressedTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Array of 6-sided textures typically used in 3D rendering, optionally compressed.
</brief_description> </brief_description>
<description> <description>
A cubemap array that is loaded from a [code].ccubearray[/code] file. This file format is internal to Godot; it is created by importing other image formats with the import system. [CompressedCubemapArray] can use one of 4 compresson methods:
- Uncompressed (uncompressed on the GPU)
- Lossless (WebP or PNG, uncompressed on the GPU)
- Lossy (WebP, uncompressed on the GPU)
- VRAM Compressed (compressed on the GPU)
Only [b]VRAM Compressed[/b] actually reduces the memory usage on the GPU. The [b]Lossless[/b] and [b]Lossy[/b] compression methods will reduce the required storage on disk, but they will not reduce memory usage on the GPU as the texture is sent to the GPU uncompressed.
Using [b]VRAM Compressed[/b] also improves loading times, as VRAM-compressed textures are faster to load compared to textures using lossless or lossy compression. VRAM compression can exhibit noticeable artifacts and is intended to be used for 3D rendering, not 2D.
See [CubemapArray] for a general description of cubemap arrays.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -1,10 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="CompressedTexture2D" inherits="Texture2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="CompressedTexture2D" inherits="Texture2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
A [code].ctex[/code] texture. Texture with 2 dimensions, optionally compressed.
</brief_description> </brief_description>
<description> <description>
A texture that is loaded from a [code].ctex[/code] file. A texture that is loaded from a [code].ctex[/code] file. This file format is internal to Godot; it is created by importing other image formats with the import system. [CompressedTexture2D] can use one of 4 compression methods (including a lack of any compression):
- Uncompressed (uncompressed on the GPU)
- Lossless (WebP or PNG, uncompressed on the GPU)
- Lossy (WebP, uncompressed on the GPU)
- VRAM Compressed (compressed on the GPU)
Only [b]VRAM Compressed[/b] actually reduces the memory usage on the GPU. The [b]Lossless[/b] and [b]Lossy[/b] compression methods will reduce the required storage on disk, but they will not reduce memory usage on the GPU as the texture is sent to the GPU uncompressed.
Using [b]VRAM Compressed[/b] also improves loading times, as VRAM-compressed textures are faster to load compared to textures using lossless or lossy compression. VRAM compression can exhibit noticeable artifacts and is intended to be used for 3D rendering, not 2D.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -13,13 +19,13 @@
<return type="int" enum="Error" /> <return type="int" enum="Error" />
<param index="0" name="path" type="String" /> <param index="0" name="path" type="String" />
<description> <description>
Loads the texture from the given path. Loads the texture from the specified [param path].
</description> </description>
</method> </method>
</methods> </methods>
<members> <members>
<member name="load_path" type="String" setter="load" getter="get_load_path" default="&quot;&quot;"> <member name="load_path" type="String" setter="load" getter="get_load_path" default="&quot;&quot;">
The CompressedTexture's file path to a [code].ctex[/code] file. The [CompressedTexture2D]'s file path to a [code].ctex[/code] file.
</member> </member>
<member name="resource_local_to_scene" type="bool" setter="set_local_to_scene" getter="is_local_to_scene" overrides="Resource" default="false" /> <member name="resource_local_to_scene" type="bool" setter="set_local_to_scene" getter="is_local_to_scene" overrides="Resource" default="false" />
</members> </members>

View file

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="CompressedTexture2DArray" inherits="CompressedTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="CompressedTexture2DArray" inherits="CompressedTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Array of 2-dimensional textures, optionally compressed.
</brief_description> </brief_description>
<description> <description>
A texture array that is loaded from a [code].ctexarray[/code] file. This file format is internal to Godot; it is created by importing other image formats with the import system. [CompressedTexture2DArray] can use one of 4 compresson methods:
- Uncompressed (uncompressed on the GPU)
- Lossless (WebP or PNG, uncompressed on the GPU)
- Lossy (WebP, uncompressed on the GPU)
- VRAM Compressed (compressed on the GPU)
Only [b]VRAM Compressed[/b] actually reduces the memory usage on the GPU. The [b]Lossless[/b] and [b]Lossy[/b] compression methods will reduce the required storage on disk, but they will not reduce memory usage on the GPU as the texture is sent to the GPU uncompressed.
Using [b]VRAM Compressed[/b] also improves loading times, as VRAM-compressed textures are faster to load compared to textures using lossless or lossy compression. VRAM compression can exhibit noticeable artifacts and is intended to be used for 3D rendering, not 2D.
See [Texture2DArray] for a general description of texture arrays.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="CompressedTexture3D" inherits="Texture3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="CompressedTexture3D" inherits="Texture3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Texture with 3 dimensions, optionally compressed.
</brief_description> </brief_description>
<description> <description>
[CompressedTexture3D] is the VRAM-compressed counterpart of [ImageTexture3D]. The file extension for [CompressedTexture3D] files is [code].ctex3d[/code]. This file format is internal to Godot; it is created by importing other image formats with the import system.
[CompressedTexture3D] uses VRAM compression, which allows to reduce memory usage on the GPU when rendering the texture. This also improves loading times, as VRAM-compressed textures are faster to load compared to textures using lossless compression. VRAM compression can exhibit noticeable artifacts and is intended to be used for 3D rendering, not 2D.
See [Texture3D] for a general description of 3D textures.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -11,11 +15,13 @@
<return type="int" enum="Error" /> <return type="int" enum="Error" />
<param index="0" name="path" type="String" /> <param index="0" name="path" type="String" />
<description> <description>
Loads the texture from the specified [param path].
</description> </description>
</method> </method>
</methods> </methods>
<members> <members>
<member name="load_path" type="String" setter="load" getter="get_load_path" default="&quot;&quot;"> <member name="load_path" type="String" setter="load" getter="get_load_path" default="&quot;&quot;">
The [CompressedTexture3D]'s file path to a [code].ctex3d[/code] file.
</member> </member>
</members> </members>
</class> </class>

View file

@ -1,8 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="CompressedTextureLayered" inherits="TextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="CompressedTextureLayered" inherits="TextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Base class for texture arrays that can optionally be compressed.
</brief_description> </brief_description>
<description> <description>
A texture array that is loaded from a [code].ctexarray[/code] file. This file format is internal to Godot; it is created by importing other image formats with the import system. [CompressedTexture2D] can use one of 4 compresson methods:
- Uncompressed (uncompressed on the GPU)
- Lossless (WebP or PNG, uncompressed on the GPU)
- Lossy (WebP, uncompressed on the GPU)
- VRAM Compressed (compressed on the GPU)
Only [b]VRAM Compressed[/b] actually reduces the memory usage on the GPU. The [b]Lossless[/b] and [b]Lossy[/b] compression methods will reduce the required storage on disk, but they will not reduce memory usage on the GPU as the texture is sent to the GPU uncompressed.
Using [b]VRAM Compressed[/b] also improves loading times, as VRAM-compressed textures are faster to load compared to textures using lossless or lossy compression. VRAM compression can exhibit noticeable artifacts and is intended to be used for 3D rendering, not 2D.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -11,11 +19,13 @@
<return type="int" enum="Error" /> <return type="int" enum="Error" />
<param index="0" name="path" type="String" /> <param index="0" name="path" type="String" />
<description> <description>
Loads the texture at [param path].
</description> </description>
</method> </method>
</methods> </methods>
<members> <members>
<member name="load_path" type="String" setter="load" getter="get_load_path" default="&quot;&quot;"> <member name="load_path" type="String" setter="load" getter="get_load_path" default="&quot;&quot;">
The path the texture should be loaded from.
</member> </member>
</members> </members>
</class> </class>

View file

@ -4,8 +4,9 @@
6-sided texture typically used in 3D rendering. 6-sided texture typically used in 3D rendering.
</brief_description> </brief_description>
<description> <description>
A cubemap is made of 6 textures organized in layers. They are typically used for faking reflections (see [ReflectionProbe]) in 3D rendering. It can be used to make an object look as if it's reflecting its surroundings. This usually delivers much better performance than other reflection methods. A cubemap is made of 6 textures organized in layers. They are typically used for faking reflections in 3D rendering (see [ReflectionProbe]). It can be used to make an object look as if it's reflecting its surroundings. This usually delivers much better performance than other reflection methods.
This resource is typically used as a uniform in custom shaders. Few core Godot methods make use of Cubemap resources. This resource is typically used as a uniform in custom shaders. Few core Godot methods make use of [Cubemap] resources.
To create such a texture file yourself, reimport your image files using the Godot Editor import presets.
[b]Note:[/b] Godot doesn't support using cubemaps in a [PanoramaSkyMaterial]. You can use [url=https://danilw.github.io/GLSL-howto/cubemap_to_panorama_js/cubemap_to_panorama.html]this tool[/url] to convert a cubemap to an equirectangular sky map. [b]Note:[/b] Godot doesn't support using cubemaps in a [PanoramaSkyMaterial]. You can use [url=https://danilw.github.io/GLSL-howto/cubemap_to_panorama_js/cubemap_to_panorama.html]this tool[/url] to convert a cubemap to an equirectangular sky map.
</description> </description>
<tutorials> <tutorials>

View file

@ -5,8 +5,9 @@
</brief_description> </brief_description>
<description> <description>
[CubemapArray]s are made of an array of [Cubemap]s. Accordingly, like [Cubemap]s they are made of multiple textures the amount of which must be divisible by 6 (one image for each face of the cube). The primary benefit of [CubemapArray]s is that they can be accessed in shader code using a single texture reference. In other words, you can pass multiple [Cubemap]s into a shader using a single [CubemapArray]. [CubemapArray]s are made of an array of [Cubemap]s. Accordingly, like [Cubemap]s they are made of multiple textures the amount of which must be divisible by 6 (one image for each face of the cube). The primary benefit of [CubemapArray]s is that they can be accessed in shader code using a single texture reference. In other words, you can pass multiple [Cubemap]s into a shader using a single [CubemapArray].
Generally, [CubemapArray]s provide a more efficient way for storing multiple [Cubemap]s, than storing multiple [Cubemap]s themselves in an array. Generally, [CubemapArray]s provide a more efficient way for storing multiple [Cubemap]s compared to storing multiple [Cubemap]s themselves in an array.
Internally Godot, uses [CubemapArray]s for many effects including the [Sky], if you set [member ProjectSettings.rendering/reflections/sky_reflections/texture_array_reflections] to [code]true[/code]. Internally, Godot uses [CubemapArray]s for many effects including the [Sky], if you set [member ProjectSettings.rendering/reflections/sky_reflections/texture_array_reflections] to [code]true[/code].
To create such a texture file yourself, reimport your image files using the Godot Editor import presets.
[b]Note:[/b] [CubemapArray] is not supported in the OpenGL 3 rendering backend. [b]Note:[/b] [CubemapArray] is not supported in the OpenGL 3 rendering backend.
</description> </description>
<tutorials> <tutorials>

View file

@ -118,7 +118,7 @@
<param index="2" name="use_mipmaps" type="bool" /> <param index="2" name="use_mipmaps" type="bool" />
<param index="3" name="format" type="int" enum="Image.Format" /> <param index="3" name="format" type="int" enum="Image.Format" />
<description> <description>
Creates an empty image of given size and format. See [enum Format] constants. If [param use_mipmaps] is [code]true[/code] then generate mipmaps for this image. See the [method generate_mipmaps]. Creates an empty image of given size and format. See [enum Format] constants. If [param use_mipmaps] is [code]true[/code], then generate mipmaps for this image. See the [method generate_mipmaps].
</description> </description>
</method> </method>
<method name="create_from_data" qualifiers="static"> <method name="create_from_data" qualifiers="static">

View file

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="ImageTexture3D" inherits="Texture3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="ImageTexture3D" inherits="Texture3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Texture with 3 dimensions.
</brief_description> </brief_description>
<description> <description>
[ImageTexture3D] is a 3-dimensional [ImageTexture] that has a width, height, and depth. See also [ImageTextureLayered].
3D textures are typically used to store density maps for [FogMaterial], color correction LUTs for [Environment], vector fields for [GPUParticlesAttractorVectorField3D] and collision maps for [GPUParticlesCollisionSDF3D]. 3D textures can also be used in custom shaders.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -16,12 +19,14 @@
<param index="4" name="use_mipmaps" type="bool" /> <param index="4" name="use_mipmaps" type="bool" />
<param index="5" name="data" type="Image[]" /> <param index="5" name="data" type="Image[]" />
<description> <description>
Creates the [ImageTexture3D] with specified [param width], [param height], and [param depth]. See [enum Image.Format] for [param format] options. If [param use_mipmaps] is [code]true[/code], then generate mipmaps for the [ImageTexture3D].
</description> </description>
</method> </method>
<method name="update"> <method name="update">
<return type="void" /> <return type="void" />
<param index="0" name="data" type="Image[]" /> <param index="0" name="data" type="Image[]" />
<description> <description>
Replaces the texture's existing data with the layers specified in [code]data[/code]. The size of [code]data[/code] must match the parameters that were used for [method create]. In other words, the texture cannot be resized or have its format changed by calling [method update].
</description> </description>
</method> </method>
</methods> </methods>

View file

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="ImageTextureLayered" inherits="TextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="ImageTextureLayered" inherits="TextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Base class for texture types which contain the data of multiple [ImageTexture]s. Each image is of the same size and format.
</brief_description> </brief_description>
<description> <description>
Base class for [Texture2DArray], [Cubemap] and [CubemapArray]. Cannot be used directly, but contains all the functions necessary for accessing the derived resource types. See also [Texture3D].
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -11,7 +13,7 @@
<return type="int" enum="Error" /> <return type="int" enum="Error" />
<param index="0" name="images" type="Image[]" /> <param index="0" name="images" type="Image[]" />
<description> <description>
Creates an [ImageTextureLayered] from an array of [Image]s. The first image decides the width, height, image format and mipmapping setting. The other images must have the same width, height, image format and mipmapping setting. Creates an [ImageTextureLayered] from an array of [Image]s. See [method Image.create] for the expected data format. The first image decides the width, height, image format and mipmapping setting. The other images [i]must[/i] have the same width, height, image format and mipmapping setting.
Each [Image] represents one [code]layer[/code]. Each [Image] represents one [code]layer[/code].
</description> </description>
</method> </method>
@ -23,7 +25,7 @@
Replaces the existing [Image] data at the given [code]layer[/code] with this new image. Replaces the existing [Image] data at the given [code]layer[/code] with this new image.
The given [Image] must have the same width, height, image format and mipmapping setting (a [code]bool[/code] value) as the rest of the referenced images. The given [Image] must have the same width, height, image format and mipmapping setting (a [code]bool[/code] value) as the rest of the referenced images.
If the image format is unsupported, it will be decompressed and converted to a similar and supported [enum Image.Format]. If the image format is unsupported, it will be decompressed and converted to a similar and supported [enum Image.Format].
The update is immediate: synced with the draw. The update is immediate: it's synchronized with drawing.
</description> </description>
</method> </method>
</methods> </methods>

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="PlaceholderCubemap" inherits="PlaceholderTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="PlaceholderCubemap" inherits="PlaceholderTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Placeholder class for a cubemap texture.
</brief_description> </brief_description>
<description> <description>
This class is used when loading a project that uses a [Cubemap] subclass in 2 conditions:
- When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly.
- When this subclass is missing due to using a different engine version or build (e.g. modules disabled).
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="PlaceholderCubemapArray" inherits="PlaceholderTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="PlaceholderCubemapArray" inherits="PlaceholderTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Placeholder class for a cubemap texture array.
</brief_description> </brief_description>
<description> <description>
This class is used when loading a project that uses a [CubemapArray] subclass in 2 conditions:
- When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly.
- When this subclass is missing due to using a different engine version or build (e.g. modules disabled).
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="PlaceholderMaterial" inherits="Material" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="PlaceholderMaterial" inherits="Material" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Placeholder class for a material.
</brief_description> </brief_description>
<description> <description>
This class is used when loading a project that uses a [Material] subclass in 2 conditions:
- When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly.
- When this subclass is missing due to using a different engine version or build (e.g. modules disabled).
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -1,13 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="PlaceholderMesh" inherits="Mesh" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="PlaceholderMesh" inherits="Mesh" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Placeholder class for a mesh.
</brief_description> </brief_description>
<description> <description>
This class is used when loading a project that uses a [Mesh] subclass in 2 conditions:
- When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly.
- When this subclass is missing due to using a different engine version or build (e.g. modules disabled).
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
<members> <members>
<member name="aabb" type="AABB" setter="set_aabb" getter="get_aabb" default="AABB(0, 0, 0, 0, 0, 0)"> <member name="aabb" type="AABB" setter="set_aabb" getter="get_aabb" default="AABB(0, 0, 0, 0, 0, 0)">
The smallest [AABB] enclosing this mesh in local space.
</member> </member>
</members> </members>
</class> </class>

View file

@ -1,14 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="PlaceholderTexture2D" inherits="Texture2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="PlaceholderTexture2D" inherits="Texture2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Placeholder class for a 2-dimensional texture.
</brief_description> </brief_description>
<description> <description>
This class is used when loading a project that uses a [Texture2D] subclass in 2 conditions:
- When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly.
- When this subclass is missing due to using a different engine version or build (e.g. modules disabled).
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
<members> <members>
<member name="resource_local_to_scene" type="bool" setter="set_local_to_scene" getter="is_local_to_scene" overrides="Resource" default="false" /> <member name="resource_local_to_scene" type="bool" setter="set_local_to_scene" getter="is_local_to_scene" overrides="Resource" default="false" />
<member name="size" type="Vector2" setter="set_size" getter="get_size" default="Vector2(1, 1)"> <member name="size" type="Vector2" setter="set_size" getter="get_size" default="Vector2(1, 1)">
The texture's size (in pixels).
</member> </member>
</members> </members>
</class> </class>

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="PlaceholderTexture2DArray" inherits="PlaceholderTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="PlaceholderTexture2DArray" inherits="PlaceholderTextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Placeholder class for a 2-dimensional texture array.
</brief_description> </brief_description>
<description> <description>
This class is used when loading a project that uses a [Texture2D] subclass in 2 conditions:
- When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly.
- When this subclass is missing due to using a different engine version or build (e.g. modules disabled).
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -1,13 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="PlaceholderTexture3D" inherits="Texture3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="PlaceholderTexture3D" inherits="Texture3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Placeholder class for a 3-dimensional texture.
</brief_description> </brief_description>
<description> <description>
This class is used when loading a project that uses a [Texture3D] subclass in 2 conditions:
- When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly.
- When this subclass is missing due to using a different engine version or build (e.g. modules disabled).
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
<members> <members>
<member name="size" type="Vector3i" setter="set_size" getter="get_size" default="Vector3i(1, 1, 1)"> <member name="size" type="Vector3i" setter="set_size" getter="get_size" default="Vector3i(1, 1, 1)">
The texture's size (in pixels).
</member> </member>
</members> </members>
</class> </class>

View file

@ -1,15 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="PlaceholderTextureLayered" inherits="TextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="PlaceholderTextureLayered" inherits="TextureLayered" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Placeholder class for a 2-dimensional texture array.
</brief_description> </brief_description>
<description> <description>
This class is used when loading a project that uses a [TextureLayered] subclass in 2 conditions:
- When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly.
- When this subclass is missing due to using a different engine version or build (e.g. modules disabled).
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
<members> <members>
<member name="layers" type="int" setter="set_layers" getter="get_layers" default="1"> <member name="layers" type="int" setter="set_layers" getter="get_layers" default="1">
The number of layers in the texture array.
</member> </member>
<member name="size" type="Vector2i" setter="set_size" getter="get_size" default="Vector2i(1, 1)"> <member name="size" type="Vector2i" setter="set_size" getter="get_size" default="Vector2i(1, 1)">
The size of each texture layer (in pixels).
</member> </member>
</members> </members>
</class> </class>

View file

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="Texture" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="Texture" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Base class for all texture types.
</brief_description> </brief_description>
<description> <description>
[Texture] is the base class for all texture types. Common texture types are [Texture2D] and [ImageTexture]. See also [Image].
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -19,6 +19,8 @@
<param index="2" name="modulate" type="Color" /> <param index="2" name="modulate" type="Color" />
<param index="3" name="transpose" type="bool" /> <param index="3" name="transpose" type="bool" />
<description> <description>
Called when the entire [Texture2D] is requested to be drawn over a [CanvasItem], with the top-left offset specified in [param pos]. [param modulate] specifies a multiplier for the colors being drawn, while [param transpose] specifies whether drawing should be performed in column-major order instead of row-major order (resulting in 90-degree clockwise rotation).
[b]Note:[/b] This is only used in 2D rendering, not 3D.
</description> </description>
</method> </method>
<method name="_draw_rect" qualifiers="virtual const"> <method name="_draw_rect" qualifiers="virtual const">
@ -29,6 +31,8 @@
<param index="3" name="modulate" type="Color" /> <param index="3" name="modulate" type="Color" />
<param index="4" name="transpose" type="bool" /> <param index="4" name="transpose" type="bool" />
<description> <description>
Called when the [Texture2D] is requested to be drawn onto [CanvasItem]'s specified [param rect]. [param modulate] specifies a multiplier for the colors being drawn, while [param transpose] specifies whether drawing should be performed in column-major order instead of row-major order (resulting in 90-degree clockwise rotation).
[b]Note:[/b] This is only used in 2D rendering, not 3D.
</description> </description>
</method> </method>
<method name="_draw_rect_region" qualifiers="virtual const"> <method name="_draw_rect_region" qualifiers="virtual const">
@ -40,21 +44,26 @@
<param index="4" name="transpose" type="bool" /> <param index="4" name="transpose" type="bool" />
<param index="5" name="clip_uv" type="bool" /> <param index="5" name="clip_uv" type="bool" />
<description> <description>
Called when a part of the [Texture2D] specified by [param src_rect]'s coordinates is requested to be drawn onto [CanvasItem]'s specified [param rect]. [param modulate] specifies a multiplier for the colors being drawn, while [param transpose] specifies whether drawing should be performed in column-major order instead of row-major order (resulting in 90-degree clockwise rotation).
[b]Note:[/b] This is only used in 2D rendering, not 3D.
</description> </description>
</method> </method>
<method name="_get_height" qualifiers="virtual const"> <method name="_get_height" qualifiers="virtual const">
<return type="int" /> <return type="int" />
<description> <description>
Called when the [Texture2D]'s height is queried.
</description> </description>
</method> </method>
<method name="_get_width" qualifiers="virtual const"> <method name="_get_width" qualifiers="virtual const">
<return type="int" /> <return type="int" />
<description> <description>
Called when the [Texture2D]'s width is queried.
</description> </description>
</method> </method>
<method name="_has_alpha" qualifiers="virtual const"> <method name="_has_alpha" qualifiers="virtual const">
<return type="bool" /> <return type="bool" />
<description> <description>
Called when the presence of an alpha channel in the [Texture2D] is queried.
</description> </description>
</method> </method>
<method name="_is_pixel_opaque" qualifiers="virtual const"> <method name="_is_pixel_opaque" qualifiers="virtual const">
@ -62,6 +71,7 @@
<param index="0" name="x" type="int" /> <param index="0" name="x" type="int" />
<param index="1" name="y" type="int" /> <param index="1" name="y" type="int" />
<description> <description>
Called when a pixel's opaque state in the [Texture2D] is queried at the specified [code](x, y)[/code] position.
</description> </description>
</method> </method>
<method name="draw" qualifiers="const"> <method name="draw" qualifiers="const">
@ -100,7 +110,7 @@
<method name="get_height" qualifiers="const"> <method name="get_height" qualifiers="const">
<return type="int" /> <return type="int" />
<description> <description>
Returns the texture height. Returns the texture height in pixels.
</description> </description>
</method> </method>
<method name="get_image" qualifiers="const"> <method name="get_image" qualifiers="const">
@ -113,13 +123,13 @@
<method name="get_size" qualifiers="const"> <method name="get_size" qualifiers="const">
<return type="Vector2" /> <return type="Vector2" />
<description> <description>
Returns the texture size. Returns the texture size in pixels.
</description> </description>
</method> </method>
<method name="get_width" qualifiers="const"> <method name="get_width" qualifiers="const">
<return type="int" /> <return type="int" />
<description> <description>
Returns the texture width. Returns the texture width in pixels.
</description> </description>
</method> </method>
<method name="has_alpha" qualifiers="const"> <method name="has_alpha" qualifiers="const">

View file

@ -4,8 +4,9 @@
A single texture resource which consists of multiple, separate images. Each image has the same dimensions and number of mipmap levels. A single texture resource which consists of multiple, separate images. Each image has the same dimensions and number of mipmap levels.
</brief_description> </brief_description>
<description> <description>
A Texture2DArray is different from a Texture3D: The Texture2DArray does not support trilinear interpolation between the [Image]s, i.e. no blending. A Texture2DArray is different from a Texture3D: The Texture2DArray does not support trilinear interpolation between the [Image]s, i.e. no blending. See also [Cubemap] and [CubemapArray], which are texture arrays with specialized cubemap functions.
A Texture2DArray is also different from an [AtlasTexture]: In a Texture2DArray, all images are treated separately. In an atlas, the regions (i.e. the single images) can be of different sizes. Furthermore, you usually need to add a padding around the regions, to prevent accidental UV mapping to more than one region. The same goes for mipmapping: Mipmap chains are handled separately for each layer. In an atlas, the slicing has to be done manually in the fragment shader. A Texture2DArray is also different from an [AtlasTexture]: In a Texture2DArray, all images are treated separately. In an atlas, the regions (i.e. the single images) can be of different sizes. Furthermore, you usually need to add a padding around the regions, to prevent accidental UV mapping to more than one region. The same goes for mipmapping: Mipmap chains are handled separately for each layer. In an atlas, the slicing has to be done manually in the fragment shader.
To create such a texture file yourself, reimport your image files using the Godot Editor import presets.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="Texture3D" inherits="Texture" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="Texture3D" inherits="Texture" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
Base class for 3-dimensionnal textures.
</brief_description> </brief_description>
<description> <description>
Base class for [ImageTexture3D] and [CompressedTexture3D]. Cannot be used directly, but contains all the functions necessary for accessing the derived resource types. [Texture3D] is the base class for all 3-dimensional texture types. See also [TextureLayered].
All images need to have the same width, height and number of mipmap levels.
To create such a texture file yourself, reimport your image files using the Godot Editor import presets.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -10,61 +14,73 @@
<method name="_get_data" qualifiers="virtual const"> <method name="_get_data" qualifiers="virtual const">
<return type="Image[]" /> <return type="Image[]" />
<description> <description>
Called when the [Texture3D]'s data is queried.
</description> </description>
</method> </method>
<method name="_get_depth" qualifiers="virtual const"> <method name="_get_depth" qualifiers="virtual const">
<return type="int" /> <return type="int" />
<description> <description>
Called when the [Texture3D]'s depth is queried.
</description> </description>
</method> </method>
<method name="_get_format" qualifiers="virtual const"> <method name="_get_format" qualifiers="virtual const">
<return type="int" enum="Image.Format" /> <return type="int" enum="Image.Format" />
<description> <description>
Called when the [Texture3D]'s format is queried.
</description> </description>
</method> </method>
<method name="_get_height" qualifiers="virtual const"> <method name="_get_height" qualifiers="virtual const">
<return type="int" /> <return type="int" />
<description> <description>
Called when the [Texture3D]'s height is queried.
</description> </description>
</method> </method>
<method name="_get_width" qualifiers="virtual const"> <method name="_get_width" qualifiers="virtual const">
<return type="int" /> <return type="int" />
<description> <description>
Called when the [Texture3D]'s width is queried.
</description> </description>
</method> </method>
<method name="_has_mipmaps" qualifiers="virtual const"> <method name="_has_mipmaps" qualifiers="virtual const">
<return type="bool" /> <return type="bool" />
<description> <description>
Called when the presence of mipmaps in the [Texture3D] is queried.
</description> </description>
</method> </method>
<method name="get_data" qualifiers="const"> <method name="get_data" qualifiers="const">
<return type="Image[]" /> <return type="Image[]" />
<description> <description>
Returns the [Texture3D]'s data as an array of [Image]s. Each [Image] represents a [i]slice[/i] of the [Texture3D], with different slices mapping to different depth (Z axis) levels.
</description> </description>
</method> </method>
<method name="get_depth" qualifiers="const"> <method name="get_depth" qualifiers="const">
<return type="int" /> <return type="int" />
<description> <description>
Returns the [Texture3D]'s depth in pixels. Depth is typically represented by the Z axis (a dimension not present in [Texture2D]).
</description> </description>
</method> </method>
<method name="get_format" qualifiers="const"> <method name="get_format" qualifiers="const">
<return type="int" enum="Image.Format" /> <return type="int" enum="Image.Format" />
<description> <description>
Returns the current format being used by this texture. See [enum Image.Format] for details.
</description> </description>
</method> </method>
<method name="get_height" qualifiers="const"> <method name="get_height" qualifiers="const">
<return type="int" /> <return type="int" />
<description> <description>
Returns the [Texture3D]'s height in pixels. Width is typically represented by the Y axis.
</description> </description>
</method> </method>
<method name="get_width" qualifiers="const"> <method name="get_width" qualifiers="const">
<return type="int" /> <return type="int" />
<description> <description>
Returns the [Texture3D]'s width in pixels. Width is typically represented by the X axis.
</description> </description>
</method> </method>
<method name="has_mipmaps" qualifiers="const"> <method name="has_mipmaps" qualifiers="const">
<return type="bool" /> <return type="bool" />
<description> <description>
Returns [code]true[/code] if the [Texture3D] has generated mipmaps.
</description> </description>
</method> </method>
</methods> </methods>

View file

@ -4,12 +4,11 @@
Base class for texture types which contain the data of multiple [Image]s. Each image is of the same size and format. Base class for texture types which contain the data of multiple [Image]s. Each image is of the same size and format.
</brief_description> </brief_description>
<description> <description>
Base class for [Texture2DArray], [Cubemap] and [CubemapArray]. Cannot be used directly, but contains all the functions necessary for accessing the derived resource types. Base class for [ImageTextureLayered]. Cannot be used directly, but contains all the functions necessary for accessing the derived resource types. See also [Texture3D].
Data is set on a per-layer basis. For [Texture2DArray]s, the layer specifies the array layer. Data is set on a per-layer basis. For [Texture2DArray]s, the layer specifies the array layer.
All images need to have the same width, height and number of mipmap levels. All images need to have the same width, height and number of mipmap levels.
A [TextureLayered] can be loaded with [code]method ResourceFormatLoader.load[/code]. A [TextureLayered] can be loaded with [method ResourceLoader.load].
To create such a texture file yourself, re-import your image files using the Godot Editor import presets. Internally, Godot maps these files to their respective counterparts in the target rendering driver (Vulkan, GLES3).
Internally, Godot maps these files to their respective counterparts in the target rendering driver (GLES3, Vulkan).
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -17,37 +16,44 @@
<method name="_get_format" qualifiers="virtual const"> <method name="_get_format" qualifiers="virtual const">
<return type="int" enum="Image.Format" /> <return type="int" enum="Image.Format" />
<description> <description>
Called when the [TextureLayered]'s format is queried.
</description> </description>
</method> </method>
<method name="_get_height" qualifiers="virtual const"> <method name="_get_height" qualifiers="virtual const">
<return type="int" /> <return type="int" />
<description> <description>
Called when the the [TextureLayered]'s height is queried.
</description> </description>
</method> </method>
<method name="_get_layer_data" qualifiers="virtual const"> <method name="_get_layer_data" qualifiers="virtual const">
<return type="Image" /> <return type="Image" />
<param index="0" name="layer_index" type="int" /> <param index="0" name="layer_index" type="int" />
<description> <description>
Called when the data for a layer in the [TextureLayered] is queried.
</description> </description>
</method> </method>
<method name="_get_layered_type" qualifiers="virtual const"> <method name="_get_layered_type" qualifiers="virtual const">
<return type="int" /> <return type="int" />
<description> <description>
Called when the layers' type in the [TextureLayered] is queried.
</description> </description>
</method> </method>
<method name="_get_layers" qualifiers="virtual const"> <method name="_get_layers" qualifiers="virtual const">
<return type="int" /> <return type="int" />
<description> <description>
Called when the number of layers in the [TextureLayered] is queried.
</description> </description>
</method> </method>
<method name="_get_width" qualifiers="virtual const"> <method name="_get_width" qualifiers="virtual const">
<return type="int" /> <return type="int" />
<description> <description>
Called when the [TextureLayered]'s width queried.
</description> </description>
</method> </method>
<method name="_has_mipmaps" qualifiers="virtual const"> <method name="_has_mipmaps" qualifiers="virtual const">
<return type="bool" /> <return type="bool" />
<description> <description>
Called when the presence of mipmaps in the [TextureLayered] is queried.
</description> </description>
</method> </method>
<method name="get_format" qualifiers="const"> <method name="get_format" qualifiers="const">
@ -59,7 +65,7 @@
<method name="get_height" qualifiers="const"> <method name="get_height" qualifiers="const">
<return type="int" /> <return type="int" />
<description> <description>
Returns the height of the texture. Height is typically represented by the Y-axis. Returns the height of the texture in pixels. Height is typically represented by the Y axis.
</description> </description>
</method> </method>
<method name="get_layer_data" qualifiers="const"> <method name="get_layer_data" qualifiers="const">
@ -72,6 +78,7 @@
<method name="get_layered_type" qualifiers="const"> <method name="get_layered_type" qualifiers="const">
<return type="int" enum="TextureLayered.LayeredType" /> <return type="int" enum="TextureLayered.LayeredType" />
<description> <description>
Returns the [TextureLayered]'s type. The type determines how the data is accessed, with cubemaps having special types.
</description> </description>
</method> </method>
<method name="get_layers" qualifiers="const"> <method name="get_layers" qualifiers="const">
@ -83,7 +90,7 @@
<method name="get_width" qualifiers="const"> <method name="get_width" qualifiers="const">
<return type="int" /> <return type="int" />
<description> <description>
Returns the width of the texture. Width is typically represented by the X-axis. Returns the width of the texture in pixels. Width is typically represented by the X axis.
</description> </description>
</method> </method>
<method name="has_mipmaps" qualifiers="const"> <method name="has_mipmaps" qualifiers="const">
@ -95,10 +102,13 @@
</methods> </methods>
<constants> <constants>
<constant name="LAYERED_TYPE_2D_ARRAY" value="0" enum="LayeredType"> <constant name="LAYERED_TYPE_2D_ARRAY" value="0" enum="LayeredType">
Texture is a generic [Texture2DArray].
</constant> </constant>
<constant name="LAYERED_TYPE_CUBEMAP" value="1" enum="LayeredType"> <constant name="LAYERED_TYPE_CUBEMAP" value="1" enum="LayeredType">
Texture is a [Cubemap], with each side in its own layer (6 in total).
</constant> </constant>
<constant name="LAYERED_TYPE_CUBEMAP_ARRAY" value="2" enum="LayeredType"> <constant name="LAYERED_TYPE_CUBEMAP_ARRAY" value="2" enum="LayeredType">
Texture is a [CubemapArray], with each cubemap being made of 6 layers.
</constant> </constant>
</constants> </constants>
</class> </class>