Class: Raster16Bit

Raster16Bit

Raster16Bit class extends Raster to handle 16-bit textures with WebGL 2.0. Provides functionality for:

  • Loading 16-bit images from URLs or blobs via custom data loaders
  • Converting data to appropriate WebGL 2.0 texture formats
  • Supporting various 16-bit formats (float, int, uint)
  • Creating appropriate texture parameters for 16-bit data
  • Support for custom data loaders for specialized formats

new Raster16Bit( [options])

Creates a new Raster16Bit instance.

Parameters:
Name Type Argument Description
options Object <optional>

Configuration options

Properties
Name Type Argument Default Description
format Raster16Bit#Format <optional>
'rgb16ui'

16-bit data format

useHalfFloat boolean <optional>
false

Use HALF_FLOAT type instead of FLOAT for better performance when applicable

flipY boolean <optional>
false

Whether to flip the image vertically during loading

premultiplyAlpha boolean <optional>
false

Whether to premultiply alpha during loading

dataLoader DataLoaderCallback <optional>
null

Custom data loader callback

dataLoaderOptions Object <optional>
{}

Options to pass to the data loader

debug boolean <optional>
false

Enable debug output

Source:

Methods


<async> loadImage(tile, gl)

Loads a 16-bit image tile and converts it to a WebGL texture. Overrides parent method to handle 16-bit specific formats.

Parameters:
Name Type Description
tile Object

The tile to load

Properties
Name Type Argument Description
url string

URL of the image

start number <optional>

Start byte for partial requests

end number <optional>

End byte for partial requests

gl WebGL2RenderingContext

The WebGL2 rendering context

Source:
Throws:

If context is not WebGL2

Type
Error
Returns:

Promise resolving to [texture, size]:

  • texture: WebGLTexture object
  • size: Size of the image in bytes (width * height * components * bytesPerComponent)
Type
Promise.<Array>

Type Definitions


Format

Defines the 16-bit format for image data storage in textures.

Type:
  • 'r16f' | 'rg16f' | 'rgb16f' | 'rgba16f' | 'r16ui' | 'rg16ui' | 'rgb16ui' | 'rgba16ui' | 'r16i' | 'rg16i' | 'rgb16i' | 'rgba16i' | 'depth16'
Properties:
Name Type Description
r16f 'r16f'

Single-channel 16-bit floating point format

rg16f 'rg16f'

Two-channel 16-bit floating point format

rgb16f 'rgb16f'

Three-channel 16-bit floating point format

rgba16f 'rgba16f'

Four-channel 16-bit floating point format

r16ui 'r16ui'

Single-channel 16-bit unsigned integer format

rg16ui 'rg16ui'

Two-channel 16-bit unsigned integer format

rgb16ui 'rgb16ui'

Three-channel 16-bit unsigned integer format

rgba16ui 'rgba16ui'

Four-channel 16-bit unsigned integer format

r16i 'r16i'

Single-channel 16-bit signed integer format

rg16i 'rg16i'

Two-channel 16-bit signed integer format

rgb16i 'rgb16i'

Three-channel 16-bit signed integer format

rgba16i 'rgba16i'

Four-channel 16-bit signed integer format

depth16 'depth16'

16-bit depth texture format

Source: