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...
CubemapArray
继承: ImageTextureLayered < TextureLayered < Texture < Resource < RefCounted < Object
Cubemap 数组,存储在一起并使用单个引用。
描述
CubemapArray 由 Cubemap 数组组成。与 Cubemap 一样由多个纹理组成,纹理的数量必须能被 6 整除(对应立方体的各个面)。
CubemapArray 的主要优点是可以使用单个纹理引用在着色器代码中访问。换句话说,你可以使用单个 CubemapArray 将多个 Cubemap 传递到着色器中。这些 Cubemap 在 GPU 上会被分配到相邻缓存区域中,因此用 CubemapArray 存储多个 Cubemap 最为高效。
Godot 内部使用 CubemapArray 来实现许多效果,例如将 ProjectSettings.rendering/reflections/sky_reflections/texture_array_reflections 设置为 true
时的 Sky。
要自己创建这样的纹理文件,请使用 Godot 编辑器的导入预设重新导入图像文件。要使用代码创建 CubemapArray,请在 CubemapArray 类的实例上使用 ImageTextureLayered.create_from_images()。
预期的图像顺序是 X+、X-、Y+、Y-、Z+、Z-(Godot 的坐标系中 Y+ 是“上”、Z- 是“前”)。你可以从下列模板中挑选一个作为基础:
使用默认垂直导入选项时多个图层会相互堆叠(第一个图层位于顶部)。你也可以在导入选项中选择水平布局(第一个图层位于左侧)。
注意:由于图形 API 限制,兼容性渲染器不支持 CubemapArray。
方法
create_placeholder() const |
方法说明
Resource create_placeholder() const 🔗
创建该资源的占位符版本(PlaceholderCubemapArray)。