Skip to content

MeshSource ​

A source of static mesh geometry shared by one or more mesh layers.

Geometry is loaded on the first call to load and retained by the source. Each layer's renderable references the same CPU arrays and uses separate GPU buffers. The loader supports static, uncompressed GLB meshes. Scene transforms are baked into the geometry and missing normals are generated for flat shading. Materials, textures, and animation are ignored. The base geometry is rendered without skinning or morph deformations. Mesh layers supply their own color and lighting. Instancing and required glTF extensions are not supported.

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

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

Constructor ​

Creates a mesh source without loading its geometry.

ts
new MeshSource(props): MeshSource;
ParameterDescription
props: MeshSourcePropsInitialization properties.

Types ​

MeshSourceProps ​

Initialization properties for constructing a mesh source.

PropertyDescription
url: stringThe source URL passed to the mesh loader.

Properties ​

url ​

The source URL passed to the mesh loader.

ts
readonly url: string;

Methods ​

load() Promise<Geometry> ​

Returns the source's CPU geometry, loading it on the first call.

Concurrent and subsequent calls share the same promise and geometry. A failed load clears the cached promise so a later call can retry.

ts
load(): Promise<Geometry>;

Released under the MIT License