npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@adatechnology/game-shapes-three

v0.5.1

Published

three.js drawing of @adatechnology/game-shapes buffers: BufferGeometry with three's own type and prototype, meshes per batch, part groups, InstancedMesh and LOD; a geometry namespace whose constructors are made by game-shapes (for ported code that reads n

Downloads

8,747

Readme

@adatechnology/game-shapes-three

The three.js side of @adatechnology/game-shapes: buffers become geometries, meshes, part groups, InstancedMesh and LOD. three.js is passed in by the host; the package never imports it.

Install

pnpm add @adatechnology/game-shapes @adatechnology/game-shapes-three three

Browser without a bundler: dist/index.global.js exposes GameShapesThree (game-shapes is bundled in; three.js is yours).

Usage

import * as THREE from 'three'
import { generate } from '@adatechnology/game-shapes'
import { shapeGeometries, toGeometry, toObject3D, mergeByMaterial } from '@adatechnology/game-shapes-three'

// a whole shape: one mesh per (part, material), part groups at their pivots, instances, a LOD when there are levels
const { object, parts, meshes, instanced, points, materials } = toObject3D(THREE, generate(schema), { materials: { wood: myWood } })
scene.add(object)
parts.door.rotation.y = 1.2

// three's constructors, made by game-shapes (bit-identical, instances of three's classes, template cache)
const T = shapeGeometries(THREE)
const handle = new T.CylinderGeometry(0.05, 0.065, 1.1, 10) // instanceof THREE.CylinderGeometry, type 'CylinderGeometry'

// one primitive or one batch
const geometry = toGeometry(THREE, buildPrimitive({ kind: 'torus', radius: 0.3, tube: 0.02 }))

| Export | What it does | |---|---| | toGeometry(THREE, primitiveOrBatch, { copy }) | A BufferGeometry; a primitive gets three's type, parameters and the prototype of the class it reproduces, its attributes in three's order, its index and groups. copy: false shares the arrays (read-only) | | shapeGeometries(THREE, { cache }) | A namespace equal to THREE except BoxGeometry, CylinderGeometry, ConeGeometry, SphereGeometry, PlaneGeometry, CircleGeometry, RingGeometry, LatheGeometry, TorusGeometry and ExtrudeGeometry (one straight-edged shape; curves, several shapes, a path or a custom uv generator fall back to three). Hand it as T to code ported from the teams | | toObject3D(THREE, buffers, { materials, materialFor, shadows, copy, name }) | { object, near, parts, meshes, instanced, points, materials }; meshes are named static:<material> / part:<id> with userData.material, userData.part and userData.ranges; levels after the first are static (parts baked at rest), and cullDistance ends the LOD | | createMaterials(THREE, hints, ids) | MeshStandardMaterial per id from the schema's material hints (vertex colours on) | | mergeByMaterial(THREE, root, space) | Every visible mesh under root baked into space and joined per material (non-indexed), on game-shapes' merge; the same bytes game-props3d's version gave | | releaseObject3D(roots, { keep }) | Frees the GPU side of trees taken out of the scene for good: geometries, materials, textures (maps and shader uniforms) and skeletons, except what a tree in keep (the scene) still uses or what is marked userData.shared. Returns how many it freed | | discardObject3D(objects, { keep }) | removeFromParent() plus releaseObject3D for one object or a list (one walk of the scene), keeping what the rest of its scene draws: the one call for something that leaves the game | | isMesh(object) | Type guard for a mesh (or a skinned or instanced one) met while walking a tree with traverse | | coincidentFacesOf(root, { eps, minArea, includeHidden }) | Faces under root that z-fight: triangles on the same plane (within 1 mm), facing the same way, that overlap more than 1 cm². Walks every drawn mesh in world space (instances too; decals with polygonOffset are skipped) and names both meshes in each hit. Every package's catalog test runs it on each piece (see CLAUDE.md §13) | | markShared(...resources) | Marks a palette, kit or catalog resource as shared on purpose, so the release never frees it; same as userData.shared = true without touching the resource (digests and goldens stay) | | markPositionsWritten(mesh, v0, v1) / rangesWrittenSince(attribute, version) | Declares, right after the one needsUpdate = true of a write, which vertex range of a merged mesh it changed, and reads back the ranges written since a version. The destruction renderer measures each part's range of a merged mesh as a collider: a declared write re-measures only the parts in that range; a write that flags needsUpdate and declares nothing re-measures every part of the mesh |

Português

Desenho three.js das formas do game-shapes: geometria com o tipo e o protótipo da classe do three, malha por lote, grupos de peça, instâncias e LOD; o shapeGeometries(THREE) é o T que o código portado dos times recebe para continuar escrevendo new T.CylinderGeometry(...).

Tudo o que sai da cena para sempre passa por discardObject3D ou releaseObject3D (regra de memória do kit, CLAUDE.md seção 7): o three.js só libera a GPU no dispose().