class_portablecompressedtexture2d.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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:`bool<class_bool>` | :ref:`keep_compressed_buffer<class_PortableCompressedTexture2D_property_keep_compressed_buffer>` | ``false`` |
  26. +-------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | resource_local_to_scene | ``false`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
  28. +-------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  29. | :ref:`Vector2<class_Vector2>` | :ref:`size_override<class_PortableCompressedTexture2D_property_size_override>` | ``Vector2(0, 0)`` |
  30. +-------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  31. .. rst-class:: classref-reftable-group
  32. Methods
  33. -------
  34. .. table::
  35. :widths: auto
  36. +--------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | |void| | :ref:`create_from_image<class_PortableCompressedTexture2D_method_create_from_image>`\ (\ image\: :ref:`Image<class_Image>`, compression_mode\: :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>`, normal_map\: :ref:`bool<class_bool>` = false, lossy_quality\: :ref:`float<class_float>` = 0.8\ ) |
  38. +--------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` | :ref:`get_compression_mode<class_PortableCompressedTexture2D_method_get_compression_mode>`\ (\ ) |const| |
  40. +--------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Format<enum_Image_Format>` | :ref:`get_format<class_PortableCompressedTexture2D_method_get_format>`\ (\ ) |const| |
  42. +--------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`bool<class_bool>` | :ref:`is_keeping_all_compressed_buffers<class_PortableCompressedTexture2D_method_is_keeping_all_compressed_buffers>`\ (\ ) |static| |
  44. +--------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | |void| | :ref:`set_keep_all_compressed_buffers<class_PortableCompressedTexture2D_method_set_keep_all_compressed_buffers>`\ (\ keep\: :ref:`bool<class_bool>`\ ) |static| |
  46. +--------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. .. rst-class:: classref-section-separator
  48. ----
  49. .. rst-class:: classref-descriptions-group
  50. Enumerations
  51. ------------
  52. .. _enum_PortableCompressedTexture2D_CompressionMode:
  53. .. rst-class:: classref-enumeration
  54. enum **CompressionMode**: :ref:`🔗<enum_PortableCompressedTexture2D_CompressionMode>`
  55. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_LOSSLESS:
  56. .. rst-class:: classref-enumeration-constant
  57. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_LOSSLESS** = ``0``
  58. .. container:: contribute
  59. There is currently no description for this enum. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  60. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_LOSSY:
  61. .. rst-class:: classref-enumeration-constant
  62. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_LOSSY** = ``1``
  63. .. container:: contribute
  64. There is currently no description for this enum. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  65. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_BASIS_UNIVERSAL:
  66. .. rst-class:: classref-enumeration-constant
  67. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_BASIS_UNIVERSAL** = ``2``
  68. .. container:: contribute
  69. There is currently no description for this enum. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  70. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_S3TC:
  71. .. rst-class:: classref-enumeration-constant
  72. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_S3TC** = ``3``
  73. .. container:: contribute
  74. There is currently no description for this enum. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  75. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_ETC2:
  76. .. rst-class:: classref-enumeration-constant
  77. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_ETC2** = ``4``
  78. .. container:: contribute
  79. There is currently no description for this enum. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  80. .. _class_PortableCompressedTexture2D_constant_COMPRESSION_MODE_BPTC:
  81. .. rst-class:: classref-enumeration-constant
  82. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **COMPRESSION_MODE_BPTC** = ``5``
  83. .. container:: contribute
  84. There is currently no description for this enum. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  85. .. rst-class:: classref-section-separator
  86. ----
  87. .. rst-class:: classref-descriptions-group
  88. Property Descriptions
  89. ---------------------
  90. .. _class_PortableCompressedTexture2D_property_keep_compressed_buffer:
  91. .. rst-class:: classref-property
  92. :ref:`bool<class_bool>` **keep_compressed_buffer** = ``false`` :ref:`🔗<class_PortableCompressedTexture2D_property_keep_compressed_buffer>`
  93. .. rst-class:: classref-property-setget
  94. - |void| **set_keep_compressed_buffer**\ (\ value\: :ref:`bool<class_bool>`\ )
  95. - :ref:`bool<class_bool>` **is_keeping_compressed_buffer**\ (\ )
  96. 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.
  97. This flag allows to keep the compressed data in memory if you intend it to persist after loading.
  98. .. rst-class:: classref-item-separator
  99. ----
  100. .. _class_PortableCompressedTexture2D_property_size_override:
  101. .. rst-class:: classref-property
  102. :ref:`Vector2<class_Vector2>` **size_override** = ``Vector2(0, 0)`` :ref:`🔗<class_PortableCompressedTexture2D_property_size_override>`
  103. .. rst-class:: classref-property-setget
  104. - |void| **set_size_override**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  105. - :ref:`Vector2<class_Vector2>` **get_size_override**\ (\ )
  106. Allow overriding the texture size (for 2D only).
  107. .. rst-class:: classref-section-separator
  108. ----
  109. .. rst-class:: classref-descriptions-group
  110. Method Descriptions
  111. -------------------
  112. .. _class_PortableCompressedTexture2D_method_create_from_image:
  113. .. rst-class:: classref-method
  114. |void| **create_from_image**\ (\ image\: :ref:`Image<class_Image>`, compression_mode\: :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>`, normal_map\: :ref:`bool<class_bool>` = false, lossy_quality\: :ref:`float<class_float>` = 0.8\ ) :ref:`🔗<class_PortableCompressedTexture2D_method_create_from_image>`
  115. Initializes the compressed texture from a base image. The compression mode must be provided.
  116. \ ``normal_map`` is recommended to ensure optimum quality if this image will be used as a normal map.
  117. If lossy compression is requested, the quality setting can optionally be provided. This maps to Lossy WebP compression quality.
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_PortableCompressedTexture2D_method_get_compression_mode:
  121. .. rst-class:: classref-method
  122. :ref:`CompressionMode<enum_PortableCompressedTexture2D_CompressionMode>` **get_compression_mode**\ (\ ) |const| :ref:`🔗<class_PortableCompressedTexture2D_method_get_compression_mode>`
  123. Return the compression mode used (valid after initialized).
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_PortableCompressedTexture2D_method_get_format:
  127. .. rst-class:: classref-method
  128. :ref:`Format<enum_Image_Format>` **get_format**\ (\ ) |const| :ref:`🔗<class_PortableCompressedTexture2D_method_get_format>`
  129. Return the image format used (valid after initialized).
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_PortableCompressedTexture2D_method_is_keeping_all_compressed_buffers:
  133. .. rst-class:: classref-method
  134. :ref:`bool<class_bool>` **is_keeping_all_compressed_buffers**\ (\ ) |static| :ref:`🔗<class_PortableCompressedTexture2D_method_is_keeping_all_compressed_buffers>`
  135. Return whether the flag is overridden for all textures of this type.
  136. .. rst-class:: classref-item-separator
  137. ----
  138. .. _class_PortableCompressedTexture2D_method_set_keep_all_compressed_buffers:
  139. .. rst-class:: classref-method
  140. |void| **set_keep_all_compressed_buffers**\ (\ keep\: :ref:`bool<class_bool>`\ ) |static| :ref:`🔗<class_PortableCompressedTexture2D_method_set_keep_all_compressed_buffers>`
  141. Overrides the flag globally for all textures of this type. This is used primarily by the editor.
  142. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  143. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  144. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  145. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  146. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  147. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  148. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  149. .. |void| replace:: :abbr:`void (No return value.)`