Skip to main content

TextureCubeArrayLoader

From-v4.4

A loader for texture cube arrays described by a JSON manifest.

LoaderCharacteristic
File FormatJSON manifest
File Extension.json
File TypeText
Data FormatTexture
Supported APIsload, parse

Usage

import {load} from '@loaders.gl/core';
import {TextureCubeArrayLoader} from '@loaders.gl/textures';

const imageCubeArray = await load(
'environment.image-texture-cube-array.json',
TextureCubeArrayLoader
);

Member faces are parsed with ImageLoader by default. If you pass a loader array to load(), those additional loaders are also available for cube-array faces and mip levels.

Manifest

{
"shape": "image-texture-cube-array",
"layers": [
{
"faces": {
"+X": "sky-right.png",
"-X": "sky-left.png",
"+Y": "sky-top.png",
"-Y": "sky-bottom.png",
"+Z": "sky-front.png",
"-Z": "sky-back.png"
}
},
{
"faces": {
"+X": "irr-right.png",
"-X": "irr-left.png",
"+Y": "irr-top.png",
"-Y": "irr-bottom.png",
"+Z": "irr-front.png",
"-Z": "irr-back.png"
}
}
]
}

Each layer is a cubemap manifest fragment. Each face entry can be either:

  • a single image path
  • an array of image paths representing mip levels
  • a template source object

Template source example:

{
"shape": "image-texture-cube-array",
"layers": [
{
"faces": {
"+X": {"mipLevels": "auto", "template": "cube-{index}-{face}-{lod}.png"},
"-X": {"mipLevels": "auto", "template": "cube-{index}-{face}-{lod}.png"},
"+Y": {"mipLevels": "auto", "template": "cube-{index}-{face}-{lod}.png"},
"-Y": {"mipLevels": "auto", "template": "cube-{index}-{face}-{lod}.png"},
"+Z": {"mipLevels": "auto", "template": "cube-{index}-{face}-{lod}.png"},
"-Z": {"mipLevels": "auto", "template": "cube-{index}-{face}-{lod}.png"}
}
}
]
}

Supported template placeholders are {lod}, {index}, {face}, {direction}, {axis}, and {sign}. Use \\{ and \\} to include literal braces in filenames.

Options

OptionTypeDefaultDescription
core.baseUrlstring-Base URL used to resolve relative member paths when parsing an in-memory manifest.

Output

Returns a Texture with:

  • shape: 'texture'
  • type: 'cube-array'
  • data: one cubemap per layer, with one mip chain per face