Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

PlaceholderTextureLayered

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

派生: PlaceholderCubemap, PlaceholderCubemapArray, PlaceholderTexture2DArray

二维纹理数组的占位类。

描述

加载使用 TextureLayered 子类的项目时,使用这个类的情况有两种:

  • 运行使用专用服务器模式导出的项目,仅保留纹理的尺寸(因为游戏逻辑可能依赖纹理的尺寸,可能用来定位其他元素)。这样能够显著减小导出的 PCK 的大小。

  • 由于引擎版本或构建不同而缺失这个子类(例如禁用了某些模块)。

注意:设计这个类的目的并不是作为渲染的实际纹理。不保证能够在着色器和材质中正常工作(例如对 UV 进行计算)。

属性

int

layers

1

Vector2i

size

Vector2i(1, 1)


属性说明

int layers = 1

  • void set_layers ( int value )

  • int get_layers ( )

纹理数组中的层数。


Vector2i size = Vector2i(1, 1)

各层纹理的尺寸(单位为像素)。