Skip to main content

Built-in Geometries

@luma.gl/engine exports several ready-made geometry classes. All of them extend Geometry and populate standard shader attributes such as positions, normals, and texCoords.

Overview

ClassNotes
ConeGeometryCone with optional caps.
CubeGeometryUnit cube geometry.
CylinderGeometryCylinder built on top of TruncatedConeGeometry.
IcoSphereGeometryIcosahedron-based sphere approximation.
PlaneGeometryGrid plane in x,y, x,z, or y,z.
SphereGeometryLatitude/longitude sphere.
TruncatedConeGeometryGeneralized cone or frustum primitive.

Common Pattern

import {SphereGeometry} from '@luma.gl/engine';

const geometry = new SphereGeometry({radius: 2});

Selected Constructor Props

ConeGeometry

  • radius?
  • cap?
  • Inherits radial, vertical, height, and axis options from TruncatedConeGeometry

CylinderGeometry

  • radius?
  • Inherits cap, radial, vertical, height, and axis options from TruncatedConeGeometry

TruncatedConeGeometry

  • topRadius?
  • bottomRadius?
  • topCap?
  • bottomCap?
  • height?
  • nradial?
  • nvertical?
  • verticalAxis?

PlaneGeometry

  • type?
  • xlen?, ylen?, zlen?
  • nx?, ny?, nz?
  • offset?

SphereGeometry

  • radius?
  • nlat?
  • nlong?

IcoSphereGeometry

  • iterations?

Remarks

  • These classes are convenience wrappers around typed-array geometry generation.
  • Most built-in primitives generate indexed geometry by default. CubeGeometry({indices: false}) and PlaneGeometry({unpack: true}) are non-indexed variants.
  • When uploaded through Model or makeGPUGeometry(), built-in primitives are interleaved into one vertex buffer plus an optional index buffer.