Skip to content

LabelImageRenderable ​

A textured plane that draws one 2D slice of integer label data.

Each label value is colored through a LabelColorMap. Values in the lookup table use its color, other values take a color from the cycle, and value 0 renders transparent unless the lookup table covers it. The image texture must hold scalar integer data. LabelLayer constructs and pools one instance per visible chunk, so most applications configure labels through the layer instead.

Extends RenderableObject and inherits all public properties and methods.

Constructor ​

Creates a label renderable drawing the given label texture. The texture's data type selects the matching label shader.

ts
new LabelImageRenderable(props): LabelImageRenderable;
ParameterDescription
props: LabelImageRenderablePropsInitialization properties.

Types ​

LabelImageRenderableProps ​

Initialization properties for constructing a label image renderable.

PropertyDescription
width: numberWidth of the label image in texels.
height: numberHeight of the label image in texels.
imageData: TextureScalar integer texture of label values.
colorMap: LabelColorMapPropsColors to apply to label values.
outlineSelected?: booleanOutlines the selected value. Defaults to false.
selectedValue?: number | nullThe selected label value. Defaults to null.

Properties ​

worldToTexCoord ​

A matrix mapping world space to the texture's normalized coordinate space. Layers derive it from the chunk's offset, scale, and shape.

ts
worldToTexCoord: mat4;

Accessors ​

type string overrides ​

Identifies the renderable type as LabelImageRenderable.

ts
get type(): string;

Methods ​

getUniforms() overrides ​

Returns the sampler, color map, and selection uniforms for the label image shaders.

ts
getUniforms(): {
  u_imageSampler: number;
  u_colorCycleSampler: number;
  u_colorLookupTableSampler: number;
  u_outlineSelected: number;
  u_selectedValue: number;
  u_worldToTexCoord: mat4;
};

setColorMap() void ​

Replaces the label color map. The previous color map textures are marked stale for GPU disposal.

ts
setColorMap(colorMap): void;
ParameterDescription
colorMap: LabelColorMapPropsThe new color map.

setSelectedValue() void ​

Sets the label value drawn as selected or null to clear the selection. The selected region is outlined when the renderable was constructed with outlineSelected.

ts
setSelectedValue(value): void;
ParameterDescription
value: number | nullThe label value to select.

Released under the MIT License