Mirror Engine
V5
How To
Mirror Engine Logo

Mirror Engine API


Mirror Engine API / BoxGeometry

Class: BoxGeometry

A procedural box-shaped geometry.

The size, shape and tesselation properties of the box can be controlled via constructor options. By default, a box centered on the object space origin with a width, length and height of 1.0 unit and 1 segment in either axis (2 triangles per face).

Note that the box is created with UVs in the range of 0 to 1 on each face.

Extends

Constructors

new BoxGeometry()

new BoxGeometry(opts?: {
  calculateTangents: boolean;
  halfExtents: Vec3;
  heightSegments: number;
  lengthSegments: number;
  widthSegments: number;
  yOffset: number;
 }): BoxGeometry

Create a new BoxGeometry instance.

Parameters

opts?

An object that specifies optional inputs for the function as follows:

calculateTangents?

boolean

Generate tangent information (defaults to false).

halfExtents?

Vec3

The half dimensions of the box in each axis (defaults to [0.5, 0.5, 0.5]).

heightSegments?

number

The number of divisions along the Y axis of the box (defaults to 1).

lengthSegments?

number

The number of divisions along the Z axis of the box (defaults to 1).

widthSegments?

number

The number of divisions along the X axis of the box (defaults to 1).

yOffset?

number

Move the box vertically by given offset in local space. Pass 0.5 to generate the box with pivot point at the bottom face. Defaults to 0.

Returns

BoxGeometry

Overrides

Geometry.constructor

Properties

blendIndices

blendIndices: undefined | number[];

Blend indices.

Inherited from

Geometry.blendIndices


blendWeights

blendWeights: undefined | number[];

Blend weights.

Inherited from

Geometry.blendWeights


colors

colors: undefined | number[];

Colors.

Inherited from

Geometry.colors

Methods

calculateNormals()

calculateNormals(): void

Generates normal information from the positions and triangle indices.

Returns

void

Inherited from

Geometry.calculateNormals


calculateTangents()

calculateTangents(): void

Generates tangent information from the positions, normals, texture coordinates and triangle indices.

Returns

void

Inherited from

Geometry.calculateTangents

Mirror Engine Logo