Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This file provides high-signal context, architectural invariants, and authoring
| `.glb` / `.usdz` 3D viewer + 1-tap AR handoff (no scripting) | `<three-live>` | `three-live-viewer.min.js` | `< 31 KB gz` |
| Procedural `<script type="text/three">` + `InstancedMesh` + `KHR_interactivity` + AR | `<three-live>` | `three-live.min.js` | `< 78 KB gz` |
| Add-on: PBR Next, HDRI/SH, multi-light `shadow-maps`, `bloom`/`outline`, `KHR_materials_variants`, `meshopt`, `lod`, hotspots | `<three-live>` | `three-live-studio.min.js` | `< 36 KB gz` |
| Add-on: 2D `Shape`/`ExtrudeGeometry`, 3D `SweepGeometry`/`HelixGeometry`/`LoftGeometry`, 3D `CSG` BSP Booleans, 3D stroke-font `TextGeometry` | `<three-live>` | `three-live-cad.min.js` | `< 17 KB gz` |
| Add-on: 2D `Shape`/`ExtrudeGeometry`, 3D `SweepGeometry`/`HelixGeometry`/`LoftGeometry`, `PatternInstancer` arrays, 3D `CSG` BSP Booleans, 3D stroke-font `TextGeometry` | `<three-live>` | `three-live-cad.min.js` | `< 20 KB gz` |
| Domain Kit (a la carte): Parametric `THREE.Mechanical` gears, bevel gears, ISO bolts/nuts/washers, bearings, pillow blocks, couplers, springs | `<three-live>` | `three-live-kit-mechanical.min.js` | `< 18 KB gz` |
| Domain Kit (a la carte): Parametric `THREE.Architecture` walls, slabs, stairs, roofs, 10-style doors & windows, railings, columns, archways | `<three-live>` | `three-live-kit-architecture.min.js` | `< 16 KB gz` |
| Domain Kit (a la carte): Parametric `THREE.Industrial` process pipes, valves, pumps, pallet racks, conveyors, ladders, catwalks, tanks | `<three-live>` | `three-live-kit-industrial.min.js` | `< 14 KB gz` |
Expand All @@ -43,13 +43,13 @@ This file provides high-signal context, architectural invariants, and authoring
| Add-on: bring-your-own-LLM scene editing (`editScene()`, `undoEdit()`), Tap & Speak & Talk-to-Select | `<three-live>` | `three-live-ai.min.js` | `< 33 KB gz` |
| Add-on: opt-in WebGPU `GPURenderBundle` scene accelerator (`renderer="auto\|webgpu\|webgl2"`) | `<three-live>` | `three-live-webgpu.min.js` | `< 23 KB gz` |
| Add-on: opt-in Loop-Free `THREE.TSL` & `MeshStandardNodeMaterial` compiler (`extras.tsl` -> GLSL/WGSL/USDZ) | `<three-live>` | `three-live-tsl.min.js` | `< 19 KB gz` |
| Full 3D viewer + studio + CAD/CSG/Text + procedural + animation + IK + AI + WebGPU + TSL (domain kits excluded) | `<three-live>` | `three-live-full.min.js` | `< 231 KB gz` |
| Full 3D viewer + studio + CAD/CSG/Text + procedural + animation + IK + AI + WebGPU + TSL (domain kits excluded) | `<three-live>` | `three-live-full.min.js` | `< 233 KB gz` |
| 6DoF WebXR + spatial traits (`grab`, `scale`, `billboard`, `anchor`) + `<div slot="spatial">` | `<xr-live>` | `xr-live.min.js` | `< 90 KB gz` |
| Add-on: hardware XR depth occlusion, heightfield physics, 25-joint hands, simulator, WebMCP | `<xr-live>` | `xr-live-sensors.min.js` | `< 10 KB gz` |
| Add-on bundle with all 15 modular `<xr-live>` spatial UX, world, splat, audio & AI plugins | `<xr-live>` | `xr-live-spatial.min.js` | `< 63 KB gz` |
| Add-on bundle with the 6 simulation plugins (character, agents, rigid-body/joints, hit zones, objectives, audio) | `<xr-live>` | `xr-live-sim.min.js` | `< 30 KB gz` |
| Add-on: opt-in WebGPU Gaussian Splatting compute & `drawIndirect` render accelerator | `<xr-live>` | `xr-live-webgpu.min.js` | `< 12 KB gz` |
| Full Spatial Computing + Depth Physics + 25-Joint Hands + all 15 spatial + 6 sim + WebGPU + TSL plugins | `<xr-live>` | `xr-live-full.min.js` | `< 340 KB gz` |
| Full Spatial Computing + Depth Physics + 25-Joint Hands + all 15 spatial + 6 sim + WebGPU + TSL plugins | `<xr-live>` | `xr-live-full.min.js` | `< 342 KB gz` |
<!-- mdformat on -->

---
Expand Down Expand Up @@ -181,6 +181,17 @@ This file provides high-signal context, architectural invariants, and authoring
`DiscreteComponentGeometry` (`smd-chip` `0402`..`2512`,
`electrolytic-cap`, `tactile-switch`, `led-domed`, `crystal-hc49`),
`jedecPackageSpec('TQFP-32')`.
- **Pattern Arrays (no manual trig/matrix loops):**
`THREE.PatternInstancer.linear(geo, mat, { count, step | span,
direction, centered, rotationStep, scaleRange, colors })`,
`.grid(geo, mat, { counts: [nx, ny, nz], spacing, checkerboard })`,
`.circular(geo, mat, { count, radius, axis, startAngle, angleSpan,
axialStep, alignRadial })`, `.alongCurve(geo, mat, { count, path,
alignTangent })` (local +Z follows the tangent), or
`new THREE.Pattern(geo, mat, { mode, ... })`; each returns an
`InstancedMesh` (max 10,000 instances). `THREE.PatternInstancer.toGeometry(inst)`
bakes it into one `BufferGeometry` (`<= 100,000` vertices), and
`THREE.CSG.subtract(plate, inst)` accepts an `InstancedMesh` cutter.
- **GPU Instancing:** `const inst = new THREE.InstancedMesh(geo, mat,
count); inst.setMatrixAt(i, mat4); inst.setColorAt(i, color);` (exports
`EXT_mesh_gpu_instancing` and USDZ `PointInstancer`; the WebGL2 renderer
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,18 +453,19 @@ live Three.js scenes:
Three.js compiler in `xr-live.min.js`).
* **Core 3D, CAD, procedural, animation, and WebGPU plugins (`three-live`, 20
plugins):** Optional domain bundles (`three-live-studio.min.js` at
`< 36 KB gz`, `three-live-cad.min.js` at `< 17 KB gz`,
`< 36 KB gz`, `three-live-cad.min.js` at `< 20 KB gz`,
`three-live-procedural.min.js` at `< 31 KB gz`,
`three-live-animation.min.js` at `< 11 KB gz`, `three-live-ai.min.js` at
`< 33 KB gz`, `three-live-webgpu.min.js` at `< 23 KB gz`, and
`three-live-tsl.min.js` at `< 19 KB gz`, or `< 231 KB gz` combined in
`three-live-tsl.min.js` at `< 19 KB gz`, or `< 233 KB gz` combined in
`three-live-full.min.js`) add `KHR_interactivity` behavior graphs, PBR Next
materials, `KHR_materials_variants`, `EXT_meshopt_compression`, HDRI and
spherical-harmonics lighting, contact shadows, multi-light depth shadow maps
(`shadow-maps` / `shadowMapsPlugin`), 3D hotspots, post-processing (`bloom`
and `outline`), automatic multi-tier Level-of-Detail (`lod` / `THREE.LOD` /
`MSFT_lod`), 2D `Shape`/`ExtrudeGeometry`, 3D `SweepGeometry`,
`HelixGeometry`, and multi-profile `LoftGeometry`, 3D `CSG` Booleans, 3D
`HelixGeometry`, multi-profile `LoftGeometry`, declarative
`PatternInstancer` arrays, 3D `CSG` Booleans, 3D
vector `TextGeometry`, 64-joint GPU skeletal skinning, morph targets,
keyframe cross-fading, two-bone / FABRIK inverse kinematics (`ik`),
loop-free `THREE.TSL` procedural node materials (`tslPlugin` /
Expand Down Expand Up @@ -521,7 +522,7 @@ plugins:
| **`webxr`** | `ar`, `ar-modes`, `ar-scale`, `ar-placement` | Zero-server runtime `.glb` and `.usdz` packaging for 1-tap mobile AR handoff across Android Scene Viewer, iOS Quick Look, and WebXR. |
| **`postprocessing`** | `bloom`, `outline`, `tone-mapping`, `xr.bloom`, `xr.outline` | Dual-Kawase mipmap bloom, selection/hover silhouette outlines, and `neutral`, `aces`, `agx`, `reinhard`, and `none` tone mapping. |
| **`lod`** | `THREE.LOD`, `xr.lod`, `MSFT_lod` | Distance-based multi-tier Level-of-Detail switching with hysteresis, far-distance culling, automatic vertex-clustering mesh decimation (`decimateGeometry`), and `MSFT_lod` / `KHR_node_visibility` export. |
| **`cad`** | `THREE.Shape`, `THREE.ExtrudeGeometry`, `THREE.SweepGeometry`, `THREE.HelixGeometry`, `THREE.LoftGeometry`, `THREE.CSG`, `THREE.TextGeometry` | 2D `Path`/`Shape` with ear-clipping hole triangulation, `ExtrudeGeometry` with beveling and `extrudePath`, twist-free Bishop-frame `SweepGeometry`, cylindrical/conical `HelixGeometry` (`HelixCurve3`), multi-profile `LoftGeometry` (axial & spline spine with hollow-vessel `wallThickness`), 3D BSP `CSG` Booleans (`union`, `subtract`, `intersect`), and stroke-font `TextGeometry`. |
| **`cad`** | `THREE.Shape`, `THREE.ExtrudeGeometry`, `THREE.SweepGeometry`, `THREE.HelixGeometry`, `THREE.LoftGeometry`, `THREE.PatternInstancer`, `THREE.CSG`, `THREE.TextGeometry` | 2D `Path`/`Shape` with ear-clipping hole triangulation, `ExtrudeGeometry` with beveling and `extrudePath`, twist-free Bishop-frame `SweepGeometry`, cylindrical/conical `HelixGeometry` (`HelixCurve3`), multi-profile `LoftGeometry` (axial & spline spine with hollow-vessel `wallThickness`), `PatternInstancer` linear/grid/circular/along-curve `InstancedMesh` arrays (`toGeometry` bakes them for `CSG`), 3D BSP `CSG` Booleans (`union`, `subtract`, `intersect`), and stroke-font `TextGeometry`. |
| **`kit-mechanical`** | `THREE.Mechanical.*`, `SpurGearGeometry`, `BevelGearGeometry`, `BoltGeometry`, `PillowBlockGeometry`, `metricFastener` | A la carte domain kit (`three-live-kit-mechanical.min.js` / `three-live-kits.min.js`): 15 watertight 2-manifold parametric mechanical CAD parts (`SpurGearGeometry`, `BevelGearGeometry`, `InternalRingGearGeometry`, `RackGeometry`, `PulleyGeometry` (`v-belt`/`flat`/`timing`), ISO metric `BoltGeometry`, `NutGeometry`, `WasherGeometry`, `ShaftGeometry`, `ShaftCouplerGeometry`, `BearingGeometry`, `PillowBlockGeometry`, `HelicalSpringGeometry`, `FlangePlateGeometry`, `ProfileExtrusionGeometry`, `metricFastener('M8x25')`, `gearMeshDistance(g1, g2)`). |
| **`kit-architecture`** | `THREE.Architecture.*`, `WallGeometry`, `SlabGeometry`, `StaircaseGeometry`, `DoorGeometry`, `WindowGeometry`, `codeStairSpec` | A la carte domain kit (`three-live-kit-architecture.min.js` / `three-live-kits.min.js`): 9 watertight 2-manifold building & AEC elements (`WallGeometry` with rectangular/semicircular/segmental/Gothic `openings`, `SlabGeometry` with stairwell/skylight openings, `StaircaseGeometry` in `straight`, `l-shape`, `u-shape`, and `spiral` modes, `RoofGeometry` in 6 roof styles, 10-style `DoorGeometry` across 5 operations, 10-style `WindowGeometry`, `RailingGeometry`, `ColumnGeometry`, `ArchwayGeometry`, `codeStairSpec`). |
| **`kit-industrial`** | `THREE.Industrial.*`, `PipeRunGeometry`, `ValveGeometry`, `CentrifugalPumpGeometry`, `PalletRackGeometry`, `nominalPipeSpec` | A la carte domain kit (`three-live-kit-industrial.min.js` / `three-live-kits.min.js`): 10 watertight 2-manifold process plant, factory & warehouse assets (`PipeRunGeometry` with 3D Bishop-frame routing & weld-neck flanges, `PipeFittingGeometry`, `ValveGeometry`, `CentrifugalPumpGeometry`, `PalletRackGeometry`, `ConveyorGeometry`, `IndustrialLadderGeometry` with OSHA safety cage, `CatwalkPlatformGeometry`, `SafetyBarrierGeometry`, `StorageTankGeometry`, `nominalPipeSpec('DN100')`). |
Expand Down Expand Up @@ -599,7 +600,7 @@ Every web bundle targets `es2020`, strips full license blocks
| **`three-live`** | **`three-live-viewer.min.js`** | **`< 31 KB gz`** | Lean `.glb` and `.usdz` WebGL2 PBR viewer, TRS animations, orbit controls, and AR packager. |
| | **`three-live.min.js`** | **`< 78 KB gz`** | Standard `<three-live>` + **`three-author`** (live Three.js compiler, `InstancedMesh` GPU instancing, `KHR_interactivity` compiler, 5 tone-mapping modes, contact shadows) + AR packager. |
| | **`three-live-studio.min.js`** | **`< 36 KB gz`** | Add-on plugin: PBR Next extensions, HDRI and SH irradiance, multi-light depth shadow maps (`shadow-maps` / `shadowMapsPlugin`), `bloom`/`outline` post-processing, `KHR_materials_variants`, `EXT_meshopt_compression`, `KHR_interactivity` VM, `lod` (`THREE.LOD` / `MSFT_lod`), 3D hotspots, and WebXR AR. |
| | **`three-live-cad.min.js`** | **`< 17 KB gz`** | Add-on plugin: 2D `Path`/`Shape` with ear-clipping hole triangulation, `ExtrudeGeometry` with beveling and `extrudePath`, 3D Bishop-frame `SweepGeometry`, `HelixGeometry` (`HelixCurve3`), multi-profile `LoftGeometry`, 3D `CSG` BSP Booleans (`union`, `subtract`, `intersect`), and 3D stroke-font `TextGeometry`. |
| | **`three-live-cad.min.js`** | **`< 20 KB gz`** | Add-on plugin: 2D `Path`/`Shape` with ear-clipping hole triangulation, `ExtrudeGeometry` with beveling and `extrudePath`, 3D Bishop-frame `SweepGeometry`, `HelixGeometry` (`HelixCurve3`), multi-profile `LoftGeometry`, `PatternInstancer` (`linear`, `grid`, `circular`, `alongCurve`, `toGeometry`), 3D `CSG` BSP Booleans (`union`, `subtract`, `intersect`), and 3D stroke-font `TextGeometry`. |
| | **`three-live-kit-mechanical.min.js`** | **`< 18 KB gz`** | A la carte domain kit (`THREE.Mechanical`, NOT included in `three-live-full`): 15 watertight 2-manifold parametric mechanical machine parts (`SpurGearGeometry`, `BevelGearGeometry`, `InternalRingGearGeometry`, `RackGeometry`, `PulleyGeometry`, `BoltGeometry`, `NutGeometry`, `WasherGeometry`, `ShaftGeometry`, `ShaftCouplerGeometry`, `BearingGeometry`, `PillowBlockGeometry`, `HelicalSpringGeometry`, `FlangePlateGeometry`, `ProfileExtrusionGeometry`) plus `metricFastener` and `gearMeshDistance`. |
| | **`three-live-kit-architecture.min.js`** | **`< 16 KB gz`** | A la carte domain kit (`THREE.Architecture`, NOT included in `three-live-full`): 9 watertight 2-manifold building & AEC parts (`WallGeometry`, `SlabGeometry`, `StaircaseGeometry`, `RoofGeometry`, `DoorGeometry`, `WindowGeometry`, `RailingGeometry`, `ColumnGeometry`, `ArchwayGeometry`) plus IBC `codeStairSpec`. |
| | **`three-live-kit-industrial.min.js`** | **`< 14 KB gz`** | A la carte domain kit (`THREE.Industrial`, NOT included in `three-live-full`): 10 watertight 2-manifold process, factory & warehouse parts (`PipeRunGeometry`, `PipeFittingGeometry`, `ValveGeometry`, `CentrifugalPumpGeometry`, `PalletRackGeometry`, `ConveyorGeometry`, `IndustrialLadderGeometry`, `CatwalkPlatformGeometry`, `SafetyBarrierGeometry`, `StorageTankGeometry`) plus ASME `nominalPipeSpec`. |
Expand All @@ -611,14 +612,14 @@ Every web bundle targets `es2020`, strips full license blocks
| | **`three-live-animation.min.js`** | **`< 11 KB gz`** | Add-on plugin: 64-joint GPU skeletal skinning, morph targets, animation cross-fading, and two-bone / FABRIK inverse kinematics (`ik` / `THREE.IKSolver`). |
| | **`three-live-webgpu.min.js`** | **`< 23 KB gz`** | Opt-in WebGPU `GPURenderBundle` scene accelerator (`renderer="auto\|webgpu\|webgl2"`): compiles multi-thousand-part CAD and glTF assemblies into pre-recorded render bundles backed by storage buffers, with `depth24plus` 2D-array shadow depth passes + 16-tap Vogel-disk PCF, 1×1-scissor `pickMeshGPU`, Loop-Free TSL `GPURenderBundle` WGSL compilation, and automatic WebGL2 fallback for WebXR, `bloom`/`outline`, transmission, and custom shaders. |
| | **`three-live-tsl.min.js`** | **`< 19 KB gz`** | Opt-in Loop-Free `THREE.TSL` & `MeshStandardNodeMaterial` shader graph compiler (`extras.tsl`): compiles bounded 45-op node materials across WebGL2 GLSL ES 300, WebGPU WGSL `GPURenderBundle`s, and `.usdz` `MaterialX` / `UsdShade` with 60 Hz `setMaterialUniform` updates and `TSL.time` animation. |
| | **`three-live-full.min.js`** | **`< 231 KB gz`** | All-in-one 3D engine bundle (`three-live` + `studio` + `cad` + `procedural` + `animation` + `ai` + `webgpu` + `tsl`, all 20 engine plugins auto-registered; domain kits are loaded separately via `three-live-kits.min.js`). |
| | **`three-live-full.min.js`** | **`< 233 KB gz`** | All-in-one 3D engine bundle (`three-live` + `studio` + `cad` + `procedural` + `animation` + `ai` + `webgpu` + `tsl`, all 20 engine plugins auto-registered; domain kits are loaded separately via `three-live-kits.min.js`). |
| **`xr-live`** | **`xr-live-viewer.min.js`** | **`< 56 KB gz`** | Lean `.glb` and `.usdz` WebXR viewer + spatial traits (`grab`, `scale`, `billboard`, `anchor`), `<div slot="spatial">`, and mobile AR bridge. |
| | **`xr-live.min.js`** | **`< 90 KB gz`** | Standard `<xr-live>` + **`three-author`** (live Three.js compiler) + runtime USDZ and GLB compiler. |
| | **`xr-live-sensors.min.js`** | **`< 10 KB gz`** | Add-on plugin: Hardware XR sensors (`XRDepthManager`, `XRHeightfieldPhysics`, 25-joint `XRHandGestureClassifier`), `XRDesktopSimulator`, Spatial Audio, Skybox, and WebMCP tools. |
| | **`xr-live-spatial.min.js`** | **`< 63 KB gz`** | Add-on plugin bundle registering all 15 spatial plugins (`head-follow`, `manipulation-handles`, `world-understanding`, `gemini-live`, `spatial-paint`, `depth-particles`, `splat-loader`, `spatial-measure`, `magnetic-snap`, `gaze-dwell`, `exploded-view`, `persistent-anchors`, `spatial-locomotion`, `shared-room`, `spatial-audio`). |
| | **`xr-live-sim.min.js`** | **`< 31 KB gz`** | Add-on simulation plugin bundle registering all six simulation plugins (`character-controller`, `steering-agents`, `rigid-body` + mechanical `joint` constraints, `hit-zones`, `objectives`, `synth-audio`). |
| | **`xr-live-webgpu.min.js`** | **`< 12 KB gz`** | Opt-in WebGPU Gaussian Splatting compute and render accelerator (`splat-renderer="auto\|webgpu\|hybrid\|webgl2"`): WGSL 2-pass tiled radix sort, fp16 SH degrees 1–3, `drawIndirect` anisotropic quads, and WebXR / mixed-scene `mapAsync` coprocessor fallback. |
| | **`xr-live-full.min.js`** | **`< 340 KB gz`** | All-in-one 3D, XR, simulation, TSL, and WebGPU bundle (`three-live-full` + `xr-live` + `xr-live-sensors` + all 15 spatial plugins + all 6 simulation plugins + `xr-live-webgpu`). |
| | **`xr-live-full.min.js`** | **`< 342 KB gz`** | All-in-one 3D, XR, simulation, TSL, and WebGPU bundle (`three-live-full` + `xr-live` + `xr-live-sensors` + all 15 spatial plugins + all 6 simulation plugins + `xr-live-webgpu`). |
<!-- mdformat on -->

### Safe execution for live, AI-generated Three.js
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/ai_edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Rules:\n\
- Change only what the instruction asks; keep every other object, name, and value as it is.\n\
- Give new meshes and groups descriptive `.name` values; keep existing names stable.\n\
- Keep objects resting on y = 0 and within view of the camera.\n\
- Supported: core geometries and materials (MeshStandardMaterial / MeshPhysicalMaterial with PBR maps, and MeshStandardNodeMaterial with loop-free THREE.TSL colorNode / emissiveNode / roughnessNode / metalnessNode / opacityNode / bumpNode / positionNode), lights, Group, InstancedMesh, THREE.CSG, THREE.SweepGeometry / HelixGeometry / LoftGeometry, domain kits when loaded (THREE.Mechanical, THREE.Architecture, THREE.Industrial, THREE.Science, THREE.Electronics), THREE.CanvasTexture, THREE.ProceduralTexture presets (wood, marble, brick, concrete, brushedMetal, rust, leather, fabric, carbonFiber, checkerboard, grid), and declarative mesh.userData.xr traits. Optional per-frame motion: function animate(t) { ... }.\n\
- Supported: core geometries and materials (MeshStandardMaterial / MeshPhysicalMaterial with PBR maps, and MeshStandardNodeMaterial with loop-free THREE.TSL colorNode / emissiveNode / roughnessNode / metalnessNode / opacityNode / bumpNode / positionNode), lights, Group, InstancedMesh, THREE.CSG, THREE.SweepGeometry / HelixGeometry / LoftGeometry / PatternInstancer, domain kits when loaded (THREE.Mechanical, THREE.Architecture, THREE.Industrial, THREE.Science, THREE.Electronics), THREE.CanvasTexture, THREE.ProceduralTexture presets (wood, marble, brick, concrete, brushedMetal, rust, leather, fabric, carbonFiber, checkerboard, grid), and declarative mesh.userData.xr traits. Optional per-frame motion: function animate(t) { ... }.\n\
- Keep every userData.xr.material preset; add a prompt (AI texture) only when the instruction asks for a specific surface.";

/// Largest script accepted from a model (matches `SECURITY_3D_MAX_SCRIPT_BYTES`).
Expand Down
Loading