Class: Raster

Raster

Raster class handles image loading and texture creation for OpenLIME. Provides functionality for:

  • Loading images from URLs or blobs
  • Converting images to WebGL textures
  • Handling different color formats
  • Supporting partial content requests
  • Managing CORS requests
  • Creating mipmaps for large textures

new Raster( [options])

Creates a new Raster instance.

Parameters:
Name Type Argument Description
options Object <optional>

Configuration options

Properties
Name Type Argument Default Description
format Raster#Format <optional>
'vec3'

Color format for image data:

  • 'vec3' for RGB images
  • 'vec4' for RGBA images
  • 'float' for coefficient data
Source:

Methods


<async> loadImage(tile, gl)

Loads an image tile and converts it to a WebGL texture. Supports both full and partial content requests.

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 WebGLRenderingContext

The WebGL rendering context

Source:
Throws:

If server doesn't support partial content requests when required

Type
Error
Returns:

Promise resolving to [texture, size]:

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

Type Definitions


Format

Defines the color format for image data storage in textures and renderbuffers.

Type:
  • 'vec3' | 'vec4' | 'float'
Properties:
Name Type Description
vec3 'vec3'

RGB format (3 components without alpha)

vec4 'vec4'

RGBA format (4 components with alpha)

float 'float'

Single-channel format for coefficient data

Source: