Class: MeshGeometry

MeshGeometry

A geometry used to batch multiple meshes with the same texture.

new MeshGeometry (…options)

Name Type Description
options MeshGeometryOptions

The options of the mesh geometry.

Extends

Members

indices Uint32Array

The indices of the mesh.

positions Float32Array

The positions of the mesh.

positions

Set the positions of the mesh. When setting the positions, its important that the uvs array is at least as long as the positions array. otherwise the geometry will not be valid.

uvs Float32Array

The UVs of the mesh.

uvs

Set the UVs of the mesh. Its important that the uvs array you set is at least as long as the positions array. otherwise the geometry will not be valid.

Inherited Properties

From class Geometry

attributes Record<string, Attribute> readonly inherited

A record of the attributes of the geometry.

bounds Bounds inherited

Returns the bounds of the geometry.

buffers Buffer[] readonly inherited

The buffers that the attributes use

indexBuffer Buffer inherited

The index buffer of the geometry

instanceCount number inherited

the instance count of the geometry to draw

Default Value:
  • 1

topology Topology inherited

The topology of the geometry.

uid number readonly inherited

The unique id of the geometry.

Inherited Methods

From class Geometry

addAttribute (name, attributeOption) void inherited

Adds an attribute to the geometry.

Name Type Description
name string

The name of the attribute to add.

attributeOption AttributeOption

The attribute option to add.

addIndex (indexBuffer) void inherited

Adds an index buffer to the geometry.

Name Type Description
indexBuffer Buffer | TypedArray | number[]

The index buffer to add. Can be a Buffer, TypedArray, or an array of numbers.

destroy (destroyBuffers) void inherited

destroys the geometry.

Name Type Default Description
destroyBuffers boolean false

destroy the buffers associated with this geometry

getAttribute (id) Attribute inherited

Returns the requested attribute.

Name Type Description
id string

The name of the attribute required

Returns:
Type Description
Attribute
  • The attribute requested.

getBuffer (id) Buffer inherited

Returns the requested buffer.

Name Type Description
id string

The name of the buffer required.

Returns:
Type Description
Buffer
  • The buffer requested.

getIndex () Buffer inherited

Returns the index buffer

Returns:
Type Description
Buffer
  • The index buffer.

getSize () number inherited

Used to figure out how many vertices there are in this geometry

Returns:
Type Description
number the number of vertices in the geometry