Skip to content

Latest commit

 

History

History
94 lines (77 loc) · 2.76 KB

File metadata and controls

94 lines (77 loc) · 2.76 KB

ImageTextureCubeArrayLoader

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

Loader Characteristic
File Format JSON manifest
File Extension .json
File Type Text
Data Format Record<number, ImageType>[]
Supported APIs load, parse

Usage

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

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

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

Option Type Default Description
core.baseUrl string - Base URL used to resolve relative member paths when parsing an in-memory manifest.

Output

Returns an array of cubemap objects keyed by WebGL cubemap face enum.