Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
AtlasTexture
繼承: Texture2D < Texture < Resource < RefCounted < Object
從另一個 Texture2D 裁剪出的紋理。
說明
Texture2D 資源,只會繪製其 atlas 紋理中由 region 定義的區域,並可另外設定 margin 以進行微調。
可以從同一個 atlas 裁剪出多個 AtlasTexture 資源。將許多小型紋理打包到單一大型紋理中,可減少顯示記憶體占用並降低繪製呼叫次數。
注意:AtlasTexture 無法用於 AnimatedTexture,且在 TextureRect、Sprite2D 等節點中不會正確平鋪。若需平鋪 AtlasTexture,請改變其 region。
屬性
|
||
|
||
|
||
resource_local_to_scene |
|
屬性說明
包含該圖集的紋理。可以是任何繼承自 Texture2D 的型別,包括其他 AtlasTexture。
若為 true,則會裁剪 region 之外的區域,以避免周圍紋理像素滲色。
Rect2 margin = Rect2(0, 0, 0, 0) 🔗
環繞 region 的邊距,適用於微調。如果設定此屬性的 Rect2.size(在編輯器中的「w」與「h」),則繪製的紋理會縮放以符合邊距。
Rect2 region = Rect2(0, 0, 0, 0) 🔗
The region used to draw the atlas. If either dimension of the region's size is 0, the value from atlas size will be used for that axis instead.
Note: The image size is always an integer, so the actual region size is rounded down.