Class BoxGeometry

CubeGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided within the (optional) 'width', 'height', & 'depth' constructor arguments.

Hierarchy

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(width: number, height: number, depth: number, widthSegments?: number, heightSegments?: number, depthSegments?: number): BoxGeometry

Parameters

  • width: number

    — Width of the sides on the X axis.

  • height: number

    — Height of the sides on the Y axis.

  • depth: number

    — Depth of the sides on the Z axis.

  • widthSegments?: number optional

    — Number of segmented faces along the width of the sides.

  • heightSegments?: number optional

    — Number of segmented faces along the height of the sides.

  • depthSegments?: number optional

    — Number of segmented faces along the depth of the sides.

Returns

BoxGeometry

Properties

public boundingBox: BoundingBox3D

Bounding box.

public boundingSphere: BoundingSphere

Bounding sphere.

public buffersNeedUpdate: boolean

Set to true if an array has changed in length.

public colors: Color[]

Array of vertex colors, matching number and order of vertices. Used in ParticleSystem, Line and Ribbon. Meshes use per-face-use-of-vertex colors embedded directly in faces. To signal an update in this array, Geometry.colorsNeedUpdate needs to be set to true.

public colorsNeedUpdate: boolean

Set to true if the colors array has been updated.

public dynamic: boolean

Set to true if attribute buffers will need to change in runtime (using "dirty" flags). Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU. Defaults to true.

public elementsNeedUpdate: boolean

Set to true if the faces array has been updated.

public faceVertexUvs: Array<THREE.Vector2[][]>

Array of face UV layers. Each UV layer is an array of UV matching order and number of vertices in faces. To signal an update in this array, Geometry.uvsNeedUpdate needs to be set to true.

public faces: Face3[]

Array of triangles or/and quads. The array of faces describe how each vertex in the model is connected with each other. To signal an update in this array, Geometry.elementsNeedUpdate needs to be set to true.

public hasTangents: boolean

True if geometry has tangents. Set in Geometry.computeTangents.

public id: number

Unique number of this geometry instance

public lineDistances: Array<number>

public lineDistancesNeedUpdate: boolean

Set to true if the linedistances array has been updated.

public morphColors: MorphColor[]

Array of morph colors. Morph colors have similar structure as morph targets, each color set is a Javascript object:

morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] }

public morphNormals: MorphNormals[]

Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object:

morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] }

public morphTargets: MorphTarget[]

Array of morph targets. Each morph target is a Javascript object:

{ name: "targetName", vertices: [ new THREE.Vector3(), ... ] }

Morph vertices match number and order of primary vertices.

public name: string

Name for this geometry. Default is an empty string.

public normalsNeedUpdate: boolean

Set to true if the normals array has been updated.

public skinIndices: Array<number>

Array of skinning indices, matching number and order of vertices.

public skinWeights: Array<number>

Array of skinning weights, matching number and order of vertices.

public tangentsNeedUpdate: boolean

Set to true if the tangents in the faces has been updated.

public uvsNeedUpdate: boolean

Set to true if the uvs array has been updated.

public vertices: Vector3[]

The array of vertices hold every position of points of the model. To signal an update in this array, Geometry.verticesNeedUpdate needs to be set to true.

public verticesNeedUpdate: boolean

Set to true if the vertices array has been updated.

Methods

public applyMatrix(matrix: Matrix4)

Bakes matrix transform directly into vertex coordinates.

Parameters

public clone(): Geometry

Creates a new clone of the Geometry.

Returns

Geometry

public computeBoundingBox()

Computes bounding box of the geometry, updating {@link Geometry.boundingBox} attribute.

public computeBoundingSphere()

Computes bounding sphere of the geometry, updating Geometry.boundingSphere attribute. Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, otherwise they are null.

public computeFaceNormals()

Computes face normals.

public computeLineDistances()

public computeMorphNormals()

Computes morph normals.

public computeTangents()

Computes vertex tangents. Based on http://www.terathon.com/code/tangent.html Geometry must have vertex UVs (layer 0 will be used).

public computeVertexNormals(areaWeighted?: boolean)

Computes vertex normals by averaging face normals. Face normals must be existing / computed beforehand.

Parameters

  • areaWeighted?: boolean optional

public dispose()

Removes The object from memory. Don't forget to call this method when you remove an geometry because it can cuase meomory leaks.

public makeGroups(usesFaceMaterial: boolean, maxVerticesInGroup: number)

Parameters

  • usesFaceMaterial: boolean
  • maxVerticesInGroup: number

public merge(geometry: Geometry, matrix: Matrix, materialIndexOffset: number)

Parameters

public mergeVertices(): number

Checks for duplicate vertices using hashmap. Duplicated vertices are removed and faces' vertices are updated.

Returns

number