A function that loads an array of images. Primarily intended for loading:
TEXTURE_2D_ARRAY
or TEXTURE_3D
texturesTEXTURE_2D
texture or one TEXTURE_CUBE
face.Loading an array of images
import '@loaders.gl/polyfills'; // only needed for Node.js support
import {loadImageArray} from `@loaders.gl/images`;
const images = await loadImageArray(count, ({index}) => `filename-${index}`);
for (const image of images) {
...
}
import '@loaders.gl/polyfills'; // only needed for Node.js support
import {loadImageArray} from `@loaders.gl/images`;
const images = await loadImageArray(count, ({index}) => `filename-${index}`, {
mipLevels: 'auto'
});
for (const imageArray of images) {
for (const lodImage of imageArray) {
...
}
}
the getUrl
callback will be called for each image with the following parameters:
Parameter | Description |
---|---|
index | The index of the image being loaded, from 0 to count - 1 . |
lod | The mip level image being loaded, from 0 to mipLevels - 1 . |
Note: In addition to these values, all options
passed in to loadImageArray
are also available in the getUrl
method.
Parameters:
count
: Number of images to load.getUrl
: A function that generates the url for each image, it is called for each image with the index
of that image.options
: Supports the same options as ImageLoader
.Returns
Accepts the same options as ImageLoader
, and
Option | Type | Default | Description | |
---|---|---|---|---|
image.mipLevels | `Number | String` | 0 | If 'auto' or non-zero, loads an array of mip images. |
Number of mip level images to load: Use 0
to indicate a single image with no mips. Supplying the string 'auto'
will infer the mipLevel from the size of the lod
=0
image.
ImageLoader
for details about the type of the returned images.