Skip to content

Latest commit

 

History

History
84 lines (62 loc) · 2.37 KB

File metadata and controls

84 lines (62 loc) · 2.37 KB

TextureArrayLoader

From-v5.0

A loader for texture arrays described by a JSON manifest.

Loader Characteristic
File Format JSON manifest
File Extension .json
File Type Text
Data Format Texture
Supported APIs load, parse

Usage

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

const images = await load('texture-array.image-texture-array.json', TextureArrayLoader);

Member images are parsed with ImageBitmapLoader by default, returning native ImageBitmap in browsers and the installed Node.js ImageBitmap polyfill when @loaders.gl/polyfills is present.

Manifest

Texture array:

{
  "shape": "image-texture-array",
  "layers": ["layer-0.png", "layer-1.png"]
}

Texture array with mipmaps:

{
  "shape": "image-texture-array",
  "layers": [
    ["layer-0-0.png", "layer-0-1.png"],
    ["layer-1-0.png", "layer-1-1.png"]
  ]
}

Each entry in layers 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-array",
  "layers": [
    {"mipLevels": "auto", "template": "layer-{index}-{lod}.png"},
    {"mipLevels": "auto", "template": "layer-{index}-{lod}.png"}
  ]
}

Supported template placeholders are {lod} and {index}. 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 a Texture with:

  • shape: 'texture'
  • type: '2d-array'
  • data: one mip chain per array layer