@procgeo/lib
v0.1.0
Published
Procedural geometry library inspired by Houdini SOPs -- WASM bindings with full TypeScript types
Downloads
101
Maintainers
Readme
@procgeo/lib
Procedural geometry library inspired by Houdini SOPs. Runs in the browser and Node.js via WebAssembly.
Install
npm install @procgeo/libUsage
import init, { createBox, subdivide, computeNormals, smooth } from '@procgeo/lib';
await init();
const box = createBox({ size: [2, 2, 2] });
const subdiv = subdivide(box, { depth: 2, mode: 'catmullClark' });
const smoothed = smooth(subdiv, { iterations: 3, strength: 0.5 });
const geo = computeNormals(smoothed);
console.log(`${geo.numPoints} points, ${geo.numPrims} prims`);
// Export
const obj = geo.toObj(); // OBJ string
const glb = geo.toGlb(); // GLB Uint8ArrayMonaco / Editor Autocomplete
Import the bundled type definitions for rich editor support:
import types from '@procgeo/lib/types';Three.js Integration
See @procgeo/three for Three.js helpers.
Available SOPs
Creation: createBox, createGrid, createSphere, createLine, createCircle, createTube, createTorus, createIcosphere, createTeapot, createMetaball, createHelix, createSpiral
Manipulation: transform, computeNormals, subdivide, smooth, polyExtrude, polyBevel, polyWire, polyReduce, polyFill, clip, reverse, scatter, copyToPoints, fuse, color, voronoiFracture, booleanOp, bend, revolve, resample, quadRemesh, quadWild, merge
Attributes: attribCreate, attribDelete, attribRename, attribPromote, attribTransfer, attribCopy, attribRandomize, attribSort, attribBlur, attribFill, attribNoise, enumerateAttrib, measure
Groups: groupCreate, groupCombine, blast, deleteSop
Image (COP): copNoise, copConstant, copRamp, copCheckerboard, copBlur, copResize, copFlip, copMirror, copRotate, copSwirl, copChannelSwap, copComposite, copCustomShader, copLoadImage
Export: geo.toObj(), geo.toGlb()
