Skip to content

feat: add glTF shape geometry and culling - #100

Draft
ibgreen wants to merge 1 commit into
masterfrom
agent/gltf-shapes-geometry
Draft

feat: add glTF shape geometry and culling#100
ibgreen wants to merge 1 commit into
masterfrom
agent/gltf-shapes-geometry

Conversation

@ibgreen

@ibgreen ibgreen commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a renderer-independent @math.gl/geometry package with typed-array Geometry storage, indexed unpacking, and tessellators for the glTF box, capsule, cylinder, plane, and sphere shapes
  • port/adapt the basic luma.gl convenience primitives: cube, cone, truncated cone, and icosphere
  • add matching BoxShape, CapsuleShape, CylinderShape, PlaneShape, and SphereShape analytic volumes to @math.gl/culling
  • document the new module and shape-query API, including luma.gl/TDL attribution

Semantics and scope

The defaults and coordinate conventions follow the active glTF 2.1 draft at KhronosGroup/glTF@726e078.

The geometry package is CPU-only and uses glTF attribute semantics (POSITION, NORMAL, TEXCOORD_0); it has no luma.gl/GPU dependency. PlaneGeometry requires finite dimensions because an infinite surface cannot be tessellated.

The culling shapes support point containment/distance, plane and CullingVolume classification, nearest ray hits, invertible affine transforms, AABBs, and conservative bounding spheres. PlaneShape preserves the glTF negative-Y inside half-space and supports finite, partially infinite, or infinite surface extents. Distance is exact for rigid/uniform transforms and estimated for non-uniform scale or shear. Pairwise shape-vs-shape collision and glTF JSON parsing are intentionally out of scope.

Verification

  • yarn build
  • yarn lint
  • yarn test node — 3,205 assertions passing
  • yarn --cwd website build
  • repository pre-commit hook (lint + full Node suite)

Tests cover defaults and validation, tapered/contained capsules, finite and partially infinite planes, point/distance/ray/plane/frustum queries, affine transforms, bounds, 16/32-bit indices, attribute finiteness, winding, and tessellated-mesh parity with analytic shapes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant