Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/threejs_4_deno/src/core/Geometry.js>Geometry

A simple transformation of three.js for use within a Deno workflow
Go to Latest
class Geometry
import { Geometry } from "https://deno.land/x/threejs_4_deno@v121/src/core/Geometry.js";

Base class for geometries

Constructors

new
Geometry()

Properties

animation: AnimationClip
animations: AnimationClip[]
bones: Bone[]
boundingBox: Box3 | null

Bounding box.

boundingSphere: Sphere | null

Bounding sphere.

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.

colorsNeedUpdate: boolean

Set to true if the colors array has been updated.

elementsNeedUpdate: boolean

Set to true if the faces array has been updated.

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.

faceVertexUvs: 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.

groupsNeedUpdate: boolean
id: number

Unique number of this geometry instance

readonly
isGeometry: true
lineDistances: number[]
lineDistancesNeedUpdate: boolean

Set to true if the linedistances array has been updated.

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(), ... ] }
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.

name: string

Name for this geometry. Default is an empty string.

normalsNeedUpdate: boolean

Set to true if the normals array has been updated.

skinIndices: Vector4[]

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

skinWeights: Vector4[]

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

type: string
uuid: string
uvsNeedUpdate: boolean

Set to true if the uvs array has been updated.

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.

verticesNeedUpdate: boolean

Set to true if the vertices array has been updated.

Methods

Bakes matrix transform directly into vertex coordinates.

clone(): this

Creates a new clone of the Geometry.

Computes bounding box of the geometry, updating Geometry.boundingBox attribute.

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.

Computes face normals.

Compute vertex normals, but duplicating face normals.

Computes morph normals.

computeVertexNormals(areaWeighted?: boolean): void

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

copy(source: Geometry): this
dispose(): void

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

lookAt(vector: Vector3): void
merge(
geometry: Geometry,
matrix?: Matrix,
materialIndexOffset?: number,
): void
mergeMesh(mesh: Mesh): void
mergeVertices(): number

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

rotateX(angle: number): Geometry
rotateY(angle: number): Geometry
rotateZ(angle: number): Geometry
scale(
x: number,
y: number,
z: number,
): Geometry
setFromPoints(points: Array<Vector2> | Array<Vector3>): this
toJSON(): any
translate(
x: number,
y: number,
z: number,
): Geometry