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 的边距。对小的调整很有用。如果设置了该属性(编辑器中的“w”和“h”)的 Rect2.size,则绘制的纹理将被调整大小以适合该边距。