Skip to content

MeshLayer ​

A layer that renders a static mesh with an opaque color and overhead lighting.

Mesh layer loads its MeshSource when attached to a viewport and creates one MeshRenderable. The mesh writes scene depth so VolumeLayer can composite volume samples in front of its surface. Detaching the layer releases the renderable's GPU buffers while the source retains its CPU geometry for reuse.

ts
const source = new MeshSource({ url: "https://example.com/mesh.glb" });

const layer = new MeshLayer({
  source,
  color: Color.RED,
  ambientStrength: 0.25,
  diffuseStrength: 0.75,
});

viewport.addLayer(layer);

Extends Layer and inherits all public properties and methods.

Constructor ​

Creates a mesh layer for the given source and appearance settings.

ts
new MeshLayer(props): MeshLayer;
ParameterDescription
props: MeshLayerPropsInitialization properties.

Types ​

MeshLayerProps ​

Initialization properties for constructing a mesh layer.

PropertyDescription
source: MeshSourceThe mesh source to load geometry from.
color?: ColorLikeThe mesh color. Alpha is ignored. Defaults to Color.WHITE.
ambientStrength?: numberAmbient lighting contribution. Defaults to 0.25.
diffuseStrength?: numberDiffuse lighting contribution. Defaults to 0.75.

Properties ​

type overrides ​

Identifies the layer type as MeshLayer.

ts
readonly type: "MeshLayer" = "MeshLayer";

Methods ​

update() boolean overrides ​

Returns false because the mesh is static. Loading and readiness changes are handled when the layer is attached.

ts
update(): boolean;

Released under the MIT License