:github_url: hide .. _class_RDTextureFormat: RDTextureFormat =============== **繼承:** :ref:`RefCounted` **<** :ref:`Object` 紋理格式(由 :ref:`RenderingDevice` 使用)。 .. rst-class:: classref-introduction-group 說明 ---- 這個物件由 :ref:`RenderingDevice` 使用。 .. rst-class:: classref-reftable-group 屬性 ---- .. table:: :widths: auto +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`array_layers` | ``1`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`depth` | ``1`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | :ref:`DataFormat` | :ref:`format` | ``8`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`height` | ``1`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`is_discardable` | ``false`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`is_resolve_buffer` | ``false`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`mipmaps` | ``1`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | :ref:`TextureSamples` | :ref:`samples` | ``0`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | :ref:`TextureType` | :ref:`texture_type` | ``1`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | |bitfield|\[:ref:`TextureUsageBits`\] | :ref:`usage_bits` | ``0`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`width` | ``1`` | +------------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------+ .. rst-class:: classref-reftable-group 方法 ---- .. table:: :widths: auto +--------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`add_shareable_format`\ (\ format\: :ref:`DataFormat`\ ) | +--------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`remove_shareable_format`\ (\ format\: :ref:`DataFormat`\ ) | +--------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 屬性說明 -------- .. _class_RDTextureFormat_property_array_layers: .. rst-class:: classref-property :ref:`int` **array_layers** = ``1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_array_layers**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_array_layers**\ (\ ) 紋理的層數。僅適用於 2D 紋理陣列。 .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_property_depth: .. rst-class:: classref-property :ref:`int` **depth** = ``1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_depth**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_depth**\ (\ ) 紋理的深度(單位為圖元)。2D 紋理始終為 ``1``\ 。 .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_property_format: .. rst-class:: classref-property :ref:`DataFormat` **format** = ``8`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_format**\ (\ value\: :ref:`DataFormat`\ ) - :ref:`DataFormat` **get_format**\ (\ ) 紋理的圖元資料格式。 .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_property_height: .. rst-class:: classref-property :ref:`int` **height** = ``1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_height**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_height**\ (\ ) 紋理的高度(單位為圖元)。 .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_property_is_discardable: .. rst-class:: classref-property :ref:`bool` **is_discardable** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_is_discardable**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **get_is_discardable**\ (\ ) If a texture is discardable, its contents do not need to be preserved between frames. This flag is only relevant when the texture is used as target in a draw list. This information is used by :ref:`RenderingDevice` to figure out if a texture's contents can be discarded, eliminating unnecessary writes to memory and boosting performance. .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_property_is_resolve_buffer: .. rst-class:: classref-property :ref:`bool` **is_resolve_buffer** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_is_resolve_buffer**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **get_is_resolve_buffer**\ (\ ) The texture will be used as the destination of a resolve operation. .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_property_mipmaps: .. rst-class:: classref-property :ref:`int` **mipmaps** = ``1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_mipmaps**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_mipmaps**\ (\ ) 紋理中可用的 mipmap 數。 .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_property_samples: .. rst-class:: classref-property :ref:`TextureSamples` **samples** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_samples**\ (\ value\: :ref:`TextureSamples`\ ) - :ref:`TextureSamples` **get_samples**\ (\ ) 對紋理進行取樣時所使用的樣本數。 .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_property_texture_type: .. rst-class:: classref-property :ref:`TextureType` **texture_type** = ``1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_texture_type**\ (\ value\: :ref:`TextureType`\ ) - :ref:`TextureType` **get_texture_type**\ (\ ) 紋理型別。 .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_property_usage_bits: .. rst-class:: classref-property |bitfield|\[:ref:`TextureUsageBits`\] **usage_bits** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_usage_bits**\ (\ value\: |bitfield|\[:ref:`TextureUsageBits`\]\ ) - |bitfield|\[:ref:`TextureUsageBits`\] **get_usage_bits**\ (\ ) 紋理的用途位,決定使用該紋理時能做什麼。 .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_property_width: .. rst-class:: classref-property :ref:`int` **width** = ``1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_width**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_width**\ (\ ) 紋理的寬度(單位為圖元)。 .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 方法說明 -------- .. _class_RDTextureFormat_method_add_shareable_format: .. rst-class:: classref-method |void| **add_shareable_format**\ (\ format\: :ref:`DataFormat`\ ) :ref:`🔗` Adds ``format`` as a valid format for the corresponding :ref:`RDTextureView`'s :ref:`RDTextureView.format_override` property. If any format is added as shareable, then the main :ref:`format` must also be added. .. rst-class:: classref-item-separator ---- .. _class_RDTextureFormat_method_remove_shareable_format: .. rst-class:: classref-method |void| **remove_shareable_format**\ (\ format\: :ref:`DataFormat`\ ) :ref:`🔗` Removes ``format`` from the list of valid formats that the corresponding :ref:`RDTextureView`'s :ref:`RDTextureView.format_override` property can be set to. .. |virtual| replace:: :abbr:`virtual (本方法通常需要使用者覆寫才能生效。)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (本方法沒有副作用。不會修改該實例的任何成員變數。)` .. |vararg| replace:: :abbr:`vararg (本方法除了這裡描述的參數外,還可以接受任意數量的參數。)` .. |constructor| replace:: :abbr:`constructor (本方法用於建構一個型別。)` .. |static| replace:: :abbr:`static (本方法無需實例即可呼叫,因此可以直接使用類別名稱呼叫。)` .. |operator| replace:: :abbr:`operator (本方法描述將本型別作為左運算元時可用的有效運算子。)` .. |bitfield| replace:: :abbr:`BitField (此值是由下列旗標組成的位元遮罩整數。)` .. |void| replace:: :abbr:`void (無回傳值。)`