class_portablecompressedtexture2d.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/PortableCompressedTexture2D.xml.
  6. .. _class_PortableCompressedTexture2D:
  7. PortableCompressedTexture2D
  8. ===========================
  9. **Inherits:** :ref:`Texture2D<class_Texture2D>` **<** :ref:`Texture<class_Texture>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Provides a compressed texture for disk and/or VRAM in a way that is portable.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This class allows storing compressed textures as self contained (not imported) resources.
  15. For 2D usage (compressed on disk, uncompressed on VRAM), the lossy and lossless modes are recommended. For 3D usage (compressed on VRAM) it depends on the target platform.
  16. If you intend to only use desktop, S3TC or BPTC are recommended. For only mobile, ETC2 is recommended.
  17. For portable, self contained 3D textures that work on both desktop and mobile, Basis Universal is recommended (although it has a small quality cost and longer compression time as a tradeoff).
  18. This resource is intended to be created from code.
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +-----------------------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  25. | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`_data<class_PortableCompressedTexture2D_property__data>` | ``PackedByteArray()`` |
  26. +-----------------------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`keep_compressed_buffer<class_PortableCompressedTexture2D_property_keep_compressed_buffer>` | ``false`` |
  28. +-----------------------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | resource_local_to_scene | ``false`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
  30. +-----------------------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  31. | :ref:`Vector2<class_Vector2>` | :ref:`size_override<class_PortableCompressedTexture2D_property_size_override>` | ``Vector2(0, 0)`` |
  32. +-----------------------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  33. .. rst-class:: classref-reftable-group
  34. Methods
  35. -------
  36. .. table::
  37. :widths: auto
  38. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`create_from_image<class_PortableCompressedTexture2D_method_create_from_image>` **(** :ref:`Image<class_Image>` image, :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` compression_mode, :ref:`bool<class_bool>` normal_map=false, :ref:`float<class_float>` lossy_quality=0.8 **)** |
  40. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` | :ref:`get_compression_mode<class_PortableCompressedTexture2D_method_get_compression_mode>` **(** **)** |const| |
  42. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Format<enum_Image_Format>` | :ref:`get_format<class_PortableCompressedTexture2D_method_get_format>` **(** **)** |const| |
  44. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`is_keeping_all_compressed_buffers<class_PortableCompressedTexture2D_method_is_keeping_all_compressed_buffers>` **(** **)** |static| |
  46. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`set_keep_all_compressed_buffers<class_PortableCompressedTexture2D_method_set_keep_all_compressed_buffers>` **(** :ref:`bool<class_bool>` keep **)** |static| |
  48. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. .. rst-class:: classref-section-separator
  50. ----
  51. .. rst-class:: classref-descriptions-group
  52. Enumerations
  53. ------------
  54. .. _enum_PortableCompressedTexture2D_CompressionMode:
  55. .. rst-class:: classref-enumeration
  56. enum **CompressionMode**:
  57. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_LOSSLESS:
  58. .. rst-class:: classref-enumeration-constant
  59. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_LOSSLESS** = ``0``
  60. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_LOSSY:
  61. .. rst-class:: classref-enumeration-constant
  62. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_LOSSY** = ``1``
  63. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_BASIS_UNIVERSAL:
  64. .. rst-class:: classref-enumeration-constant
  65. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_BASIS_UNIVERSAL** = ``2``
  66. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_S3TC:
  67. .. rst-class:: classref-enumeration-constant
  68. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_S3TC** = ``3``
  69. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_ETC2:
  70. .. rst-class:: classref-enumeration-constant
  71. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_ETC2** = ``4``
  72. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_BPTC:
  73. .. rst-class:: classref-enumeration-constant
  74. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_BPTC** = ``5``
  75. .. rst-class:: classref-section-separator
  76. ----
  77. .. rst-class:: classref-descriptions-group
  78. Property Descriptions
  79. ---------------------
  80. .. _class_PortableCompressedTexture2D_property__data:
  81. .. rst-class:: classref-property
  82. :ref:`PackedByteArray<class_PackedByteArray>` **_data** = ``PackedByteArray()``
  83. .. container:: contribute
  84. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_PortableCompressedTexture2D_property_keep_compressed_buffer:
  88. .. rst-class:: classref-property
  89. :ref:`bool<class_bool>` **keep_compressed_buffer** = ``false``
  90. .. rst-class:: classref-property-setget
  91. - void **set_keep_compressed_buffer** **(** :ref:`bool<class_bool>` value **)**
  92. - :ref:`bool<class_bool>` **is_keeping_compressed_buffer** **(** **)**
  93. When running on the editor, this class will keep the source compressed data in memory. Otherwise, the source compressed data is lost after loading and the resource can't be re saved.
  94. This flag allows to keep the compressed data in memory if you intend it to persist after loading.
  95. .. rst-class:: classref-item-separator
  96. ----
  97. .. _class_PortableCompressedTexture2D_property_size_override:
  98. .. rst-class:: classref-property
  99. :ref:`Vector2<class_Vector2>` **size_override** = ``Vector2(0, 0)``
  100. .. rst-class:: classref-property-setget
  101. - void **set_size_override** **(** :ref:`Vector2<class_Vector2>` value **)**
  102. - :ref:`Vector2<class_Vector2>` **get_size_override** **(** **)**
  103. Allow overriding the texture size (for 2D only).
  104. .. rst-class:: classref-section-separator
  105. ----
  106. .. rst-class:: classref-descriptions-group
  107. Method Descriptions
  108. -------------------
  109. .. _class_PortableCompressedTexture2D_method_create_from_image:
  110. .. rst-class:: classref-method
  111. void **create_from_image** **(** :ref:`Image<class_Image>` image, :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` compression_mode, :ref:`bool<class_bool>` normal_map=false, :ref:`float<class_float>` lossy_quality=0.8 **)**
  112. Initializes the compressed texture from a base image. The compression mode must be provided.
  113. \ ``normal_map`` is recommended to ensure optimum quality if this image will be used as a normal map.
  114. If lossy compression is requested, the quality setting can optionally be provided. This maps to Lossy WebP compression quality.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_PortableCompressedTexture2D_method_get_compression_mode:
  118. .. rst-class:: classref-method
  119. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **get_compression_mode** **(** **)** |const|
  120. Return the compression mode used (valid after initialized).
  121. .. rst-class:: classref-item-separator
  122. ----
  123. .. _class_PortableCompressedTexture2D_method_get_format:
  124. .. rst-class:: classref-method
  125. :ref:`Format<enum_Image_Format>` **get_format** **(** **)** |const|
  126. Return the image format used (valid after initialized).
  127. .. rst-class:: classref-item-separator
  128. ----
  129. .. _class_PortableCompressedTexture2D_method_is_keeping_all_compressed_buffers:
  130. .. rst-class:: classref-method
  131. :ref:`bool<class_bool>` **is_keeping_all_compressed_buffers** **(** **)** |static|
  132. Return whether the flag is overridden for all textures of this type.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_PortableCompressedTexture2D_method_set_keep_all_compressed_buffers:
  136. .. rst-class:: classref-method
  137. void **set_keep_all_compressed_buffers** **(** :ref:`bool<class_bool>` keep **)** |static|
  138. Overrides the flag globally for all textures of this type. This is used primarily by the editor.
  139. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  140. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  141. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  142. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  143. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  144. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  145. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`