TextureArray.xml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TextureArray" inherits="TextureLayered" version="3.4">
  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. <method name="create">
  23. <return type="void" />
  24. <argument index="0" name="width" type="int" />
  25. <argument index="1" name="height" type="int" />
  26. <argument index="2" name="depth" type="int" />
  27. <argument index="3" name="format" type="int" enum="Image.Format" />
  28. <argument index="4" name="flags" type="int" default="7" />
  29. <description>
  30. Creates the TextureArray with specified [code]width[/code], [code]height[/code], and [code]depth[/code]. See [enum Image.Format] for [code]format[/code] options. See [enum TextureLayered.Flags] enumerator for [code]flags[/code] options.
  31. </description>
  32. </method>
  33. </methods>
  34. <constants>
  35. </constants>
  36. </class>