Geometry

new Geometry()
THREE: THREE.BufferGeometry

Vertex data store. Holds named attributes (position, normal, uv, color) plus an optional triangle index. Per-vertex color is first-class alongside positions and UVs.

Differs from THREE.js

No GPU buffers exist. setPositions/setNormals/setUVs/setColors are convenience wrappers over setAttribute.

Properties

NameTypeDescription
id

number

Auto-incrementing unique identifier.

name

string

Optional display name.

attributes

Map<string, Attribute>

Named vertex attribute map (read-only).

index

Uint16Array|Uint32Array|undefined

Triangle index list (read-only).

boundingBox

Box3|undefined

Computed bounding box. Not set automatically.

boundingSphere

Sphere|undefined

Computed bounding sphere. Set by computeBoundingSphere().

Methods

MethodDescription
setPositions(array: Float32Array | number[]): this

Sets the position attribute from a flat XYZ array.

setNormals(array: Float32Array | number[]): this

Sets the normal attribute from a flat XYZ array.

setUVs(array: Float32Array | number[]): this

Sets the uv attribute from a flat UV array.

setColors(array: Float32Array | number[]): this

Sets the per-vertex color attribute from a flat RGB array (0–1 range).

setIndex(array: Uint16Array | Uint32Array | number[]): this

Sets the triangle index list. Automatically chooses Uint16Array or Uint32Array.

getAttribute(name: string): Attribute|undefined

Returns a named attribute, or undefined if not present.

setAttribute(name: string, attribute: Attribute): this

Adds or replaces a named attribute.

deleteAttribute(name: string): boolean

Removes a named attribute. Returns true if it existed.

computeVertexNormals(): this

Computes flat per-vertex normals from the position attribute using cross products.

computeBoundingSphere(): this

Computes a minimal bounding sphere from the position attribute and stores it in boundingSphere.

dispose(): void

Clears all attributes and the index, freeing memory.