class_compressedtexture2d.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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/CompressedTexture2D.xml.
  6. .. _class_CompressedTexture2D:
  7. CompressedTexture2D
  8. ===================
  9. **Inherits:** :ref:`Texture2D<class_Texture2D>` **<** :ref:`Texture<class_Texture>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Texture with 2 dimensions, optionally compressed.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A texture that is loaded from a ``.ctex`` file. This file format is internal to Godot; it is created by importing other image formats with the import system. **CompressedTexture2D** can use one of 4 compression methods (including a lack of any compression):
  15. - Uncompressed (uncompressed on the GPU)
  16. - Lossless (WebP or PNG, uncompressed on the GPU)
  17. - Lossy (WebP, uncompressed on the GPU)
  18. - VRAM Compressed (compressed on the GPU)
  19. Only **VRAM Compressed** actually reduces the memory usage on the GPU. The **Lossless** and **Lossy** compression methods will reduce the required storage on disk, but they will not reduce memory usage on the GPU as the texture is sent to the GPU uncompressed.
  20. Using **VRAM Compressed** also improves loading times, as VRAM-compressed textures are faster to load compared to textures using lossless or lossy compression. VRAM compression can exhibit noticeable artifacts and is intended to be used for 3D rendering, not 2D.
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +-----------------------------+----------------------------------------------------------------+----------------------------------------------------------------------------------------+
  27. | :ref:`String<class_String>` | :ref:`load_path<class_CompressedTexture2D_property_load_path>` | ``""`` |
  28. +-----------------------------+----------------------------------------------------------------+----------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | resource_local_to_scene | ``false`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
  30. +-----------------------------+----------------------------------------------------------------+----------------------------------------------------------------------------------------+
  31. .. rst-class:: classref-reftable-group
  32. Methods
  33. -------
  34. .. table::
  35. :widths: auto
  36. +---------------------------------------+-------------------------------------------------------------------------------------------------+
  37. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load<class_CompressedTexture2D_method_load>` **(** :ref:`String<class_String>` path **)** |
  38. +---------------------------------------+-------------------------------------------------------------------------------------------------+
  39. .. rst-class:: classref-section-separator
  40. ----
  41. .. rst-class:: classref-descriptions-group
  42. Property Descriptions
  43. ---------------------
  44. .. _class_CompressedTexture2D_property_load_path:
  45. .. rst-class:: classref-property
  46. :ref:`String<class_String>` **load_path** = ``""``
  47. .. rst-class:: classref-property-setget
  48. - :ref:`Error<enum_@GlobalScope_Error>` **load** **(** :ref:`String<class_String>` path **)**
  49. - :ref:`String<class_String>` **get_load_path** **(** **)**
  50. The **CompressedTexture2D**'s file path to a ``.ctex`` file.
  51. .. rst-class:: classref-section-separator
  52. ----
  53. .. rst-class:: classref-descriptions-group
  54. Method Descriptions
  55. -------------------
  56. .. _class_CompressedTexture2D_method_load:
  57. .. rst-class:: classref-method
  58. :ref:`Error<enum_@GlobalScope_Error>` **load** **(** :ref:`String<class_String>` path **)**
  59. Loads the texture from the specified ``path``.
  60. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  61. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  62. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  63. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  64. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  65. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`