Skip to content
On this page

Class: MeshPrimitive ​

WebSG.MeshPrimitive

The MeshPrimitive class represents a single primitive of a mesh.

Table of contents ​

Constructors ​

Accessors ​

Methods ​

Constructors ​

constructor ​

• new MeshPrimitive()

Accessors ​

indices ​

• get indices(): undefined | Accessor

Returns the Accessor for the indices of the mesh primitive.

Returns ​

undefined | Accessor

Defined in ​

websg.d.ts:543


material ​

• get material(): undefined | Material

Returns the Material of the mesh primitive.

Returns ​

undefined | Material

Defined in ​

websg.d.ts:555

• set material(material): void

Sets the Material for the mesh primitive.

Parameters ​

NameTypeDescription
materialundefined | MaterialThe Material to set.

Returns ​

void

Defined in ​

websg.d.ts:561


mode ​

• get mode(): MeshPrimitiveMode

Returns the current rendering mode of the mesh primitive.

Returns ​

MeshPrimitiveMode

Defined in ​

websg.d.ts:538

Methods ​

getAttribute ​

▸ getAttribute(name): undefined | Accessor

Returns the Accessor for the specified attribute name.

Parameters ​

NameTypeDescription
nameMeshPrimitiveAttributeThe attribute name.

Returns ​

undefined | Accessor

The Accessor for the attribute or undefined if not found.

Defined in ​

websg.d.ts:550


setDrawRange ​

▸ setDrawRange(start, count): MeshPrimitive

Sets the draw range for the mesh primitive.

Parameters ​

NameTypeDescription
startnumberThe starting index for the draw range.
countnumberThe number of indices in the draw range.

Returns ​

MeshPrimitive

Defined in ​

websg.d.ts:568


thirdroomSetHologramMaterialEnabled ​

▸ thirdroomSetHologramMaterialEnabled(enabled): MeshPrimitive

Enables or disables the hologram material for the mesh primitive.

Parameters ​

NameTypeDescription
enabledbooleanWhether to enable or disable the hologram material. This API is experimental and may change or be removed in future releases.

Returns ​

MeshPrimitive

Defined in ​

websg.d.ts:575