TextureArray.xml 1.0 KB

123456789101112131415161718192021222324252627
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TextureArray" inherits="TextureLayered" version="3.3">
  3. <brief_description>
  4. Array of textures stored in a single primitive.
  5. </brief_description>
  6. <description>
  7. [TextureArray]s store an array of [Image]s in a single [Texture] primitive. Each layer of the texture array has its own mipmap chain. This makes it is a good alternative to texture atlases.
  8. [TextureArray]s must be displayed using shaders. After importing your file as a [TextureArray] and setting the appropriate Horizontal and Vertical Slices, display it by setting it as a uniform to a shader, for example:
  9. [codeblock]
  10. shader_type canvas_item;
  11. uniform sampler2DArray tex;
  12. uniform int index;
  13. void fragment() {
  14. COLOR = texture(tex, vec3(UV.x, UV.y, float(index)));
  15. }
  16. [/codeblock]
  17. Set the integer uniform "index" to show a particular part of the texture as defined by the Horizontal and Vertical Slices in the importer.
  18. </description>
  19. <tutorials>
  20. </tutorials>
  21. <methods>
  22. </methods>
  23. <constants>
  24. </constants>
  25. </class>