Menu - Top - Home - Donate to Me

H3DU.MeshBuffer

Back to documentation index.

H3DU.MeshBuffer(mesh)

A geometric mesh in the form of buffer objects.

Parameters

Methods

H3DU.MeshBuffer#getBounds()

Finds the tightest bounding box that holds all vertices in the mesh buffer.

Return Value

An array of six numbers describing the tightest axis-aligned bounding box that fits all vertices in the mesh. The first three numbers are the smallest-valued X, Y, and Z coordinates, and the last three are the largest-valued X, Y, and Z coordinates. This calculation uses the attribute with the semantic POSITION and set index 0. If there is no such attribute, or no vertices are defined in this buffer, returns the array [Inf, Inf, Inf, -Inf, -Inf, -Inf]. (Type: Array.<number>)

H3DU.MeshBuffer#getPositions()

Gets an array of vertex positions held by this mesh buffer, arranged by primitive

Return Value

An array of primitives, each of which holds the vertices that make up that primitive. If this mesh holds triangles, each primitive will contain three vertices; if lines, two; and if points, one. Each vertex is a 3-element array containing that vertex's X, Y, and Z coordinates, in that order. (Type: Array.<Array.<number>>)

H3DU.MeshBuffer#primitiveCount()

Gets the number of primitives (triangles, lines, and points) composed by all shapes in this mesh.

Return Value

Return value. (Type: number)

H3DU.MeshBuffer#primitiveType()

Gets the type of primitive stored in this mesh buffer.

Return Value

Either H3DU.Mesh.TRIANGLES, H3DU.Mesh.LINES, or H3DU.Mesh.POINTS. (Type: number)

H3DU.MeshBuffer#setAttribute(name, index, buffer, startIndex, countPerVertex, stride)

Adds information about a buffer attribute to this mesh buffer (or sets an existing attribute's information). An attribute gives information about the per-vertex data used and stored in a vertex buffer.

Parameters

Return Value

This object.Throws an error if the given semantic is unsupported. (Type: H3DU.MeshBuffer)

H3DU.MeshBuffer#setIndices(indices, byteSize)

Sets the array of vertex indices used by this mesh buffer.

Parameters

Return Value

This object. (Type: H3DU.MeshBuffer)

H3DU.MeshBuffer#setPrimitiveType(primType)

Sets the type of graphics primitives stored in this mesh buffer.

Parameters

Return Value

This object. (Type: H3DU.MeshBuffer)

H3DU.MeshBuffer#vertexCount()

Gets the number of vertices in this mesh buffer

Return Value

Return value. (Type: number)

Back to documentation index.