VoxelCell

external class VoxelCell(source)

A cell from a VoxelPrimitive.

Provides access to properties associated with one cell of a voxel primitive.

Do not construct this directly. Access it through picking using Scene.pickVoxel.

// On left click, display all the properties for a voxel cell in the console log.
handler.setInputAction(function(movement) {
const voxelCell = scene.pickVoxel(movement.position);
if (voxelCell instanceof VoxelCell) {
const propertyIds = voxelCell.getPropertyIds();
const length = propertyIds.length;
for (let i = 0; i < length; ++i) {
const propertyId = propertyIds[i];
console.log(`{propertyId}: ${voxelCell.getProperty(propertyId)}`);
}
}
}, ScreenSpaceEventType.LEFT_CLICK);

Parameters

primitive

The voxel primitive containing the cell

tileIndex

The index of the tile

sampleIndex

The index of the sample within the tile, containing metadata for this cell

See also

Properties

Link copied to clipboard

Get a copy of the oriented bounding box containing the cell.

Link copied to clipboard

All objects returned by Scene.pick have a primitive property. This returns the VoxelPrimitive containing the cell.

Link copied to clipboard

Get the sample index of the cell.

Link copied to clipboard

Get the index of the tile containing the cell.

Functions

Link copied to clipboard

Returns an array of metadata property names for the feature.

Link copied to clipboard
fun getProperty(name: String): Any

Returns a copy of the value of the metadata in the cell with the given name.

Link copied to clipboard

Returns true if the feature contains this property.