AtlasTexture

继承: Texture2D < Texture < Resource < RefCounted < Object

A texture that crops out part of another Texture2D.

描述

Texture2D resource that draws only part of its atlas texture, as defined by the region. An additional margin can also be set, which is useful for small adjustments.

Multiple AtlasTexture resources can be cropped from the same atlas. Packing many smaller textures into a singular large texture helps to optimize video memory costs and render calls.

Note: AtlasTexture cannot be used in an AnimatedTexture, and will not tile properly in nodes such as TextureRect or Sprite2D. To tile an AtlasTexture, modify its region instead.

属性


属性说明

Texture2D atlas

The texture that contains the atlas. Can be any type inheriting from Texture2D, including another AtlasTexture.


bool filter_clip = false

  • void set_filter_clip ( value: bool )
  • bool has_filter_clip ( )

If true, the area outside of the region is clipped to avoid bleeding of the surrounding texture pixels.


Rect2 margin = Rect2(0, 0, 0, 0)

  • void set_margin ( value: Rect2 )
  • Rect2 get_margin ( )

The margin around the region. Useful for small adjustments. If the Rect2.size of this property ("w" and "h" in the editor) is set, the drawn texture is resized to fit within the margin.


Rect2 region = Rect2(0, 0, 0, 0)

  • void set_region ( value: Rect2 )
  • Rect2 get_region ( )

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.

1

本方法通常需要用户覆盖才能生效。

2

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。