mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
120 lines
6.2 KiB
ReStructuredText
120 lines
6.2 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ImageTextureLayered.xml.
|
|
|
|
.. _class_ImageTextureLayered:
|
|
|
|
ImageTextureLayered
|
|
===================
|
|
|
|
**Inherits:** :ref:`TextureLayered<class_TextureLayered>` **<** :ref:`Texture<class_Texture>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
**Inherited By:** :ref:`Cubemap<class_Cubemap>`, :ref:`CubemapArray<class_CubemapArray>`, :ref:`Texture2DArray<class_Texture2DArray>`
|
|
|
|
Base class for texture types which contain the data of multiple :ref:`ImageTexture<class_ImageTexture>`\ s. Each image is of the same size and format.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
Base class for :ref:`Texture2DArray<class_Texture2DArray>`, :ref:`Cubemap<class_Cubemap>` and :ref:`CubemapArray<class_CubemapArray>`. Cannot be used directly, but contains all the functions necessary for accessing the derived resource types. See also :ref:`Texture3D<class_Texture3D>`.
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Methods
|
|
-------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`create_from_images<class_ImageTextureLayered_method_create_from_images>`\ (\ images\: :ref:`Array<class_Array>`\[:ref:`Image<class_Image>`\]\ ) |
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`update_layer<class_ImageTextureLayered_method_update_layer>`\ (\ image\: :ref:`Image<class_Image>`, layer\: :ref:`int<class_int>`\ ) |
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_ImageTextureLayered_method_create_from_images:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Error<enum_@GlobalScope_Error>` **create_from_images**\ (\ images\: :ref:`Array<class_Array>`\[:ref:`Image<class_Image>`\]\ ) :ref:`🔗<class_ImageTextureLayered_method_create_from_images>`
|
|
|
|
Creates an **ImageTextureLayered** from an array of :ref:`Image<class_Image>`\ s. See :ref:`Image.create()<class_Image_method_create>` for the expected data format. 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.
|
|
|
|
Each :ref:`Image<class_Image>` represents one ``layer``.
|
|
|
|
::
|
|
|
|
# Fill in an array of Images with different colors.
|
|
var images = []
|
|
const LAYERS = 6
|
|
for i in LAYERS:
|
|
var image = Image.create_empty(128, 128, false, Image.FORMAT_RGB8)
|
|
if i % 3 == 0:
|
|
image.fill(Color.RED)
|
|
elif i % 3 == 1:
|
|
image.fill(Color.GREEN)
|
|
else:
|
|
image.fill(Color.BLUE)
|
|
images.push_back(image)
|
|
|
|
# Create and save a 2D texture array. The array of images must have at least 1 Image.
|
|
var texture_2d_array = Texture2DArray.new()
|
|
texture_2d_array.create_from_images(images)
|
|
ResourceSaver.save(texture_2d_array, "res://texture_2d_array.res", ResourceSaver.FLAG_COMPRESS)
|
|
|
|
# Create and save a cubemap. The array of images must have exactly 6 Images.
|
|
# The cubemap's images are specified in this order: X+, X-, Y+, Y-, Z+, Z-
|
|
# (in Godot's coordinate system, so Y+ is "up" and Z- is "forward").
|
|
var cubemap = Cubemap.new()
|
|
cubemap.create_from_images(images)
|
|
ResourceSaver.save(cubemap, "res://cubemap.res", ResourceSaver.FLAG_COMPRESS)
|
|
|
|
# Create and save a cubemap array. The array of images must have a multiple of 6 Images.
|
|
# Each cubemap's images are specified in this order: X+, X-, Y+, Y-, Z+, Z-
|
|
# (in Godot's coordinate system, so Y+ is "up" and Z- is "forward").
|
|
var cubemap_array = CubemapArray.new()
|
|
cubemap_array.create_from_images(images)
|
|
ResourceSaver.save(cubemap_array, "res://cubemap_array.res", ResourceSaver.FLAG_COMPRESS)
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_ImageTextureLayered_method_update_layer:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **update_layer**\ (\ image\: :ref:`Image<class_Image>`, layer\: :ref:`int<class_int>`\ ) :ref:`🔗<class_ImageTextureLayered_method_update_layer>`
|
|
|
|
Replaces the existing :ref:`Image<class_Image>` data at the given ``layer`` with this new image.
|
|
|
|
The given :ref:`Image<class_Image>` must have the same width, height, image format, and mipmapping flag as the rest of the referenced images.
|
|
|
|
If the image format is unsupported, it will be decompressed and converted to a similar and supported :ref:`Format<enum_Image_Format>`.
|
|
|
|
The update is immediate: it's synchronized with drawing.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
|
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|
|
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|
|
.. |void| replace:: :abbr:`void (No return value.)`
|