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.
new LabelImageRenderable(props): LabelImageRenderable;| Parameter | Description |
|---|---|
props: LabelImageRenderableProps | Initialization properties. |
Types
LabelImageRenderableProps
Initialization properties for constructing a label image renderable.
| Property | Description |
|---|---|
width: number | Width of the label image in texels. |
height: number | Height of the label image in texels. |
imageData: Texture | Scalar integer texture of label values. |
colorMap: LabelColorMapProps | Colors to apply to label values. |
outlineSelected?: boolean | Outlines the selected value. Defaults to false. |
selectedValue?: number | null | The 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.
worldToTexCoord: mat4;Accessors
type string overrides
Identifies the renderable type as LabelImageRenderable.
get type(): string;Methods
getUniforms() overrides
Returns the sampler, color map, and selection uniforms for the label image shaders.
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.
setColorMap(colorMap): void;| Parameter | Description |
|---|---|
colorMap: LabelColorMapProps | The 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.
setSelectedValue(value): void;| Parameter | Description |
|---|---|
value: number | null | The label value to select. |