0.2.0-dev Download ZIP
83 lines ·4.5 KB Raw
| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="PortableCompressedTexture2D" inherits="Texture2D" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Provides a compressed texture for disk and/or VRAM in a way that is portable. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | This class allows storing compressed textures as self contained (not imported) resources. |
| 8 | 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. |
| 9 | If you intend to only use desktop, S3TC or BPTC are recommended. For only mobile, ETC2 is recommended. |
| 10 | 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). |
| 11 | This resource is intended to be created from code. |
| 12 | </description> |
| 13 | <tutorials> |
| 14 | </tutorials> |
| 15 | <methods> |
| 16 | <method name="create_from_image"> |
| 17 | <return type="void" /> |
| 18 | <param index="0" name="image" type="Image" /> |
| 19 | <param index="1" name="compression_mode" type="int" enum="PortableCompressedTexture2D.CompressionMode" /> |
| 20 | <param index="2" name="normal_map" type="bool" default="false" /> |
| 21 | <param index="3" name="lossy_quality" type="float" default="0.8" /> |
| 22 | <description> |
| 23 | Initializes the compressed texture from a base image. The compression mode must be provided. |
| 24 | [param normal_map] is recommended to ensure optimum quality if this image will be used as a normal map. |
| 25 | If lossy compression is requested, the quality setting can optionally be provided. This maps to Lossy WebP compression quality. |
| 26 | </description> |
| 27 | </method> |
| 28 | <method name="get_compression_mode" qualifiers="const"> |
| 29 | <return type="int" enum="PortableCompressedTexture2D.CompressionMode" /> |
| 30 | <description> |
| 31 | Return the compression mode used (valid after initialized). |
| 32 | </description> |
| 33 | </method> |
| 34 | <method name="is_keeping_all_compressed_buffers" qualifiers="static"> |
| 35 | <return type="bool" /> |
| 36 | <description> |
| 37 | Returns [code]true[/code] if the flag is overridden for all textures of this type. |
| 38 | </description> |
| 39 | </method> |
| 40 | <method name="set_basisu_compressor_params"> |
| 41 | <return type="void" /> |
| 42 | <param index="0" name="uastc_level" type="int" /> |
| 43 | <param index="1" name="rdo_quality_loss" type="float" /> |
| 44 | <description> |
| 45 | Sets the compressor parameters for Basis Universal compression. See also the settings in [ResourceImporterTexture]. |
| 46 | [b]Note:[/b] This method must be called before [method create_from_image] for this to work. |
| 47 | </description> |
| 48 | </method> |
| 49 | <method name="set_keep_all_compressed_buffers" qualifiers="static"> |
| 50 | <return type="void" /> |
| 51 | <param index="0" name="keep" type="bool" /> |
| 52 | <description> |
| 53 | If [param keep] is [code]true[/code], overrides the flag globally for all textures of this type. This is used primarily by the editor. |
| 54 | </description> |
| 55 | </method> |
| 56 | </methods> |
| 57 | <members> |
| 58 | <member name="keep_compressed_buffer" type="bool" setter="set_keep_compressed_buffer" getter="is_keeping_compressed_buffer" default="false"> |
| 59 | If [code]true[/code], when running in the editor, this texture will keep the source-compressed data in memory, allowing the data to persist after loading. Otherwise, the source-compressed data is lost after loading and the texture can't be re-saved. |
| 60 | [b]Note:[/b] This property must be set before [method create_from_image] for this to work. |
| 61 | </member> |
| 62 | <member name="resource_local_to_scene" type="bool" setter="set_local_to_scene" getter="is_local_to_scene" overrides="Resource" default="false" /> |
| 63 | <member name="size_override" type="Vector2" setter="set_size_override" getter="get_size_override" default="Vector2(0, 0)"> |
| 64 | Allows overriding the texture's size (for 2D only). |
| 65 | </member> |
| 66 | </members> |
| 67 | <constants> |
| 68 | <constant name="COMPRESSION_MODE_LOSSLESS" value="0" enum="CompressionMode"> |
| 69 | </constant> |
| 70 | <constant name="COMPRESSION_MODE_LOSSY" value="1" enum="CompressionMode"> |
| 71 | </constant> |
| 72 | <constant name="COMPRESSION_MODE_BASIS_UNIVERSAL" value="2" enum="CompressionMode"> |
| 73 | </constant> |
| 74 | <constant name="COMPRESSION_MODE_S3TC" value="3" enum="CompressionMode"> |
| 75 | </constant> |
| 76 | <constant name="COMPRESSION_MODE_ETC2" value="4" enum="CompressionMode"> |
| 77 | </constant> |
| 78 | <constant name="COMPRESSION_MODE_BPTC" value="5" enum="CompressionMode"> |
| 79 | </constant> |
| 80 | <constant name="COMPRESSION_MODE_ASTC" value="6" enum="CompressionMode"> |
| 81 | </constant> |
| 82 | </constants> |
| 83 | </class> |