VolumeRenderable
A ray-marched box that draws multi-channel volumetric data.
The renderable draws a unit box and ray marches through 3D chunk textures in the fragment shader. Up to 4 channels blend in a single pass and all loaded channels must share one texture data type. Front faces are culled and depth testing is off by default. VolumeLayer constructs and pools one instance per spatial chunk group, streams chunk textures in with updateVolumeWithChunk, and sizes the box through the transform.
Extends RenderableObject and inherits all public properties and methods.
Constructor
Creates an empty volume renderable.
new VolumeRenderable(props?): VolumeRenderable;| Parameter | Description |
|---|---|
props: VolumeRenderableProps | Initialization properties. Defaults to {}. |
Types
VolumeRenderableProps
Initialization properties for constructing a volume renderable.
| Property | Description |
|---|---|
channelProps?: ChannelProps[] | Channel appearance settings. Defaults to []. |
Properties
voxelScale
World size of a voxel along each axis. Layers set it from the chunk scale so ray march steps account for anisotropic voxels. Defaults to [1, 1, 1].
voxelScale: vec3;Accessors
type string overrides
Identifies the renderable type as VolumeRenderable.
get type(): string;Methods
updateVolumeWithChunk() void
Loads or refreshes the texture for the chunk's channel. The channel index comes from the chunk and the texture's data type selects the volume shader, so every channel must share one data type. Chunks without a texture are ignored.
updateVolumeWithChunk(chunk): void;| Parameter | Description |
|---|---|
chunk: Chunk | The chunk holding the channel texture. |
clearLoadedChannels() void
Marks all channels as not loaded so they stop rendering until the next chunk update. The textures themselves are kept.
clearLoadedChannels(): void;reset() void
Clears all textures and channel state so the renderable can be pooled and reused for another chunk.
reset(): void;getUniforms() Record<string, number[] | number> overrides
Returns per-channel sampler, color, contrast, opacity, and visibility uniforms for up to 4 loaded channels plus the voxel scale.
getUniforms(): Record<string, number[] | number>;setChannelProps() void
Replaces the appearance settings for all channels.
setChannelProps(channels): void;| Parameter | Description |
|---|---|
channels: ChannelProps[] | The new channel settings. |
setChannelProperty() void
Updates one property of the channel at the given index and revalidates it against the channel's texture when available.
setChannelProperty<K>(channelIndex, property, value): void;Type Parameters
| Type Parameter |
|---|
K extends keyof ChannelProps |
| Parameter | Description |
|---|---|
channelIndex: number | The channel to update. |
property: K | The property name to set. |
value: Required<ChannelProps>[K] | The new value. |