MeshGeometry(vertices, indices)

Class for representing a polygon mesh. The faces consist of triangles.

new MeshGeometry(vertices, indices)

Constructs a new mesh geometry.

Parameters:
Name Type Default Description
vertices TypedArray

The vertex buffer (Float32Array).

indices TypedArray null

The index buffer (Uint16Array/Uint32Array).

Author:

Members

aabb :AABB

An AABB enclosing the geometry.

backfaceCulling :Boolean

Whether back face culling is active or not. Only relevant for raycasting.

boundingSphere :BoundingSphere

A bounding sphere enclosing the geometry.

nullable indices :Uint16Array|Uint32Array

The index buffer.

Default Value:
  • null

vertices :Float32Array

The vertex buffer.

Methods

computeBoundingVolume() → {MeshGeometry}

Computes the internal bounding volumes of this mesh geometry.

Returns:
MeshGeometry -

A reference to this mesh geometry.

fromJSON(json) → {MeshGeometry}

Restores this instance from the given JSON object.

Parameters:
Name Type Description
json Object

The JSON object.

Returns:
MeshGeometry -

A reference to this mesh geometry.

intersectRay(ray, worldMatrix, closest, intersectionPoint, normal) → {Vector3}

Performs a ray intersection test with the geometry of the obstacle and stores the intersection point in the given result vector. If no intersection is detected, null is returned.

Parameters:
Name Type Default Description
ray Ray

The ray to test.

worldMatrix Matrix4

The matrix that transforms the geometry to world space.

closest Boolean

Whether the closest intersection point should be computed or not.

intersectionPoint Vector3

The intersection point.

normal Vector3 null

The normal vector of the respective triangle.

Returns:
Vector3 -

The result vector.

toJSON() → {Object}

Transforms this instance into a JSON object.

Returns:
Object -

The JSON object.

toTriangleSoup() → {MeshGeometry}

Returns a new geometry without containing indices. If the geometry is already non-indexed, the method performs no changes.

Returns:
MeshGeometry -

The new non-indexed geometry.