@null3d/engine 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -0
- package/THIRD-PARTY-NOTICES.txt +0 -1
- package/dist/wasm/single/null3d.js +25 -10
- package/dist/wasm/single/null3d_bg.wasm +0 -0
- package/dist/wasm/threaded/null3d.js +25 -10
- package/dist/wasm/threaded/null3d_bg.wasm +0 -0
- package/docs/api/animation.md +114 -86
- package/docs/api/assets.md +135 -49
- package/docs/api/cameras.md +45 -12
- package/docs/api/controls.md +88 -62
- package/docs/api/debug.md +116 -41
- package/docs/api/engine.md +117 -35
- package/docs/api/feature-draws.md +23 -17
- package/docs/api/feature-effects.md +11 -11
- package/docs/api/feature-instances.md +70 -19
- package/docs/api/features.md +77 -47
- package/docs/api/geometry.md +132 -82
- package/docs/api/grass.md +55 -13
- package/docs/api/impostors.md +175 -22
- package/docs/api/input.md +24 -18
- package/docs/api/lights.md +78 -51
- package/docs/api/lines.md +41 -33
- package/docs/api/materials.md +248 -121
- package/docs/api/math.md +12 -13
- package/docs/api/objects.md +47 -22
- package/docs/api/page.md +58 -7
- package/docs/api/particles.md +33 -20
- package/docs/api/points.md +19 -31
- package/docs/api/post.md +75 -42
- package/docs/api/quality.md +42 -17
- package/docs/api/raycast.md +65 -51
- package/docs/api/reference/animation.md +10 -11
- package/docs/api/reference/assets.md +25 -22
- package/docs/api/reference/cameras.md +8 -4
- package/docs/api/reference/controls.md +134 -25
- package/docs/api/reference/debug.md +81 -14
- package/docs/api/reference/engine.md +58 -17
- package/docs/api/reference/feature-draws.md +3 -4
- package/docs/api/reference/feature-effects.md +2 -3
- package/docs/api/reference/feature-instances.md +5 -4
- package/docs/api/reference/features.md +7 -4
- package/docs/api/reference/geometry.md +287 -97
- package/docs/api/reference/grass.md +63 -3
- package/docs/api/reference/impostors.md +208 -13
- package/docs/api/reference/input.md +4 -5
- package/docs/api/reference/lights.md +13 -12
- package/docs/api/reference/lines.md +10 -11
- package/docs/api/reference/materials.md +54 -53
- package/docs/api/reference/math.md +35 -24
- package/docs/api/reference/objects.md +11 -12
- package/docs/api/reference/particles.md +31 -6
- package/docs/api/reference/points.md +6 -7
- package/docs/api/reference/post.md +21 -20
- package/docs/api/reference/quality.md +8 -5
- package/docs/api/reference/raycast.md +7 -8
- package/docs/api/reference/render.md +5 -4
- package/docs/api/reference/scene.md +52 -30
- package/docs/api/reference/sketch.md +15 -11
- package/docs/api/reference/sound.md +234 -0
- package/docs/api/reference/splats.md +42 -3
- package/docs/api/reference/sprites.md +7 -8
- package/docs/api/reference/tasks.md +16 -3
- package/docs/api/reference/terrain.md +27 -5
- package/docs/api/reference/textures.md +5 -6
- package/docs/api/reference/three-compat.md +18 -7
- package/docs/api/reference/time.md +1 -2
- package/docs/api/reference/ui.md +12 -9
- package/docs/api/reference/vertex-draws.md +5 -6
- package/docs/api/reference/water.md +153 -9
- package/docs/api/reference/wind.md +17 -4
- package/docs/api/render.md +73 -29
- package/docs/api/scene.md +164 -60
- package/docs/api/sketch.md +102 -15
- package/docs/api/sound.md +205 -0
- package/docs/api/splats.md +46 -12
- package/docs/api/sprites.md +10 -24
- package/docs/api/tasks.md +33 -24
- package/docs/api/terrain.md +42 -22
- package/docs/api/textures.md +68 -19
- package/docs/api/three-compat.md +15 -7
- package/docs/api/time.md +3 -5
- package/docs/api/ui.md +19 -23
- package/docs/api/vertex-draws.md +13 -12
- package/docs/api/water.md +262 -35
- package/docs/api/wind.md +63 -17
- package/docs/cli/null3d.md +177 -27
- package/docs/concepts/architecture.md +73 -27
- package/docs/concepts/assets.md +57 -33
- package/docs/concepts/backends.md +69 -27
- package/docs/concepts/color-management.md +54 -36
- package/docs/concepts/culling.md +68 -47
- package/docs/concepts/handles.md +14 -5
- package/docs/concepts/instances.md +74 -25
- package/docs/concepts/large-worlds.md +18 -8
- package/docs/concepts/lighting.md +155 -87
- package/docs/concepts/lod.md +126 -44
- package/docs/concepts/materials.md +58 -27
- package/docs/concepts/particle-buffer.md +48 -35
- package/docs/concepts/post-processing.md +84 -43
- package/docs/concepts/quality-preset-tables.md +56 -52
- package/docs/concepts/quality-presets.md +164 -52
- package/docs/concepts/render-graph.md +69 -29
- package/docs/concepts/render-layers.md +11 -21
- package/docs/concepts/shadows.md +105 -52
- package/docs/concepts/static-dynamic.md +22 -7
- package/docs/cookbook/index.md +164 -120
- package/docs/data/threejs-mapping.json +362 -367
- package/docs/errors/E1101.md +23 -5
- package/docs/errors/E1102.md +11 -3
- package/docs/errors/E1103.md +11 -3
- package/docs/errors/E1104.md +11 -3
- package/docs/errors/E1105.md +13 -5
- package/docs/errors/E1106.md +11 -3
- package/docs/errors/E1107.md +15 -5
- package/docs/errors/E1108.md +11 -3
- package/docs/errors/E1109.md +32 -6
- package/docs/errors/E1110.md +23 -5
- package/docs/errors/E1111.md +11 -3
- package/docs/errors/E1112.md +11 -3
- package/docs/errors/E1203.md +12 -4
- package/docs/errors/E1204.md +11 -3
- package/docs/errors/E1205.md +11 -3
- package/docs/errors/E1206.md +28 -6
- package/docs/errors/E1207.md +11 -3
- package/docs/errors/E1208.md +12 -3
- package/docs/errors/E1209.md +11 -3
- package/docs/errors/E1213.md +27 -5
- package/docs/errors/E1214.md +14 -6
- package/docs/errors/E1215.md +31 -6
- package/docs/errors/E1216.md +31 -6
- package/docs/errors/E1217.md +29 -6
- package/docs/errors/E1218.md +22 -6
- package/docs/errors/E1219.md +11 -3
- package/docs/errors/E1220.md +24 -5
- package/docs/errors/E1221.md +24 -5
- package/docs/errors/E1222.md +11 -3
- package/docs/errors/E1223.md +39 -6
- package/docs/errors/E1224.md +11 -3
- package/docs/errors/E1225.md +11 -3
- package/docs/errors/E1301.md +11 -3
- package/docs/errors/E1302.md +11 -3
- package/docs/errors/E1303.md +11 -3
- package/docs/errors/E1304.md +11 -3
- package/docs/errors/E1305.md +13 -3
- package/docs/errors/E1306.md +11 -3
- package/docs/errors/E1307.md +40 -0
- package/docs/errors/E1401.md +11 -3
- package/docs/errors/E1402.md +13 -5
- package/docs/errors/E1403.md +11 -3
- package/docs/errors/E1404.md +13 -3
- package/docs/errors/E1405.md +15 -4
- package/docs/errors/E1406.md +31 -5
- package/docs/errors/E1407.md +11 -3
- package/docs/errors/E1408.md +11 -3
- package/docs/errors/E1409.md +11 -3
- package/docs/errors/E1410.md +13 -5
- package/docs/errors/E1411.md +11 -3
- package/docs/errors/E1412.md +29 -6
- package/docs/errors/E1413.md +11 -3
- package/docs/errors/E1414.md +11 -3
- package/docs/errors/E1415.md +11 -3
- package/docs/errors/E1416.md +27 -6
- package/docs/errors/E1417.md +11 -3
- package/docs/errors/E1418.md +12 -3
- package/docs/errors/E1419.md +13 -5
- package/docs/errors/E1420.md +14 -6
- package/docs/errors/E1421.md +11 -3
- package/docs/errors/E1422.md +12 -3
- package/docs/errors/E1423.md +12 -3
- package/docs/errors/E1424.md +24 -5
- package/docs/errors/E1425.md +11 -3
- package/docs/errors/E1426.md +11 -3
- package/docs/errors/E1430.md +11 -3
- package/docs/errors/E1431.md +11 -3
- package/docs/errors/E1432.md +11 -3
- package/docs/errors/E1433.md +11 -3
- package/docs/errors/E1434.md +15 -6
- package/docs/errors/E1435.md +11 -3
- package/docs/errors/E1436.md +11 -3
- package/docs/errors/E1437.md +14 -6
- package/docs/errors/E1501.md +41 -6
- package/docs/errors/E1502.md +13 -3
- package/docs/errors/E1503.md +11 -3
- package/docs/errors/E1504.md +11 -3
- package/docs/errors/E1505.md +23 -5
- package/docs/errors/E1506.md +11 -3
- package/docs/errors/index.md +54 -30
- package/docs/getting-started/cdn.md +32 -10
- package/docs/getting-started/first-scene.md +21 -13
- package/docs/getting-started/hosting.md +152 -63
- package/docs/getting-started/install.md +44 -28
- package/docs/getting-started/network-use.md +33 -15
- package/docs/getting-started/project-structure.md +33 -12
- package/docs/getting-started/third-party-notices.md +12 -14
- package/docs/guides/accessibility.md +5 -5
- package/docs/guides/add-ons.md +86 -15
- package/docs/guides/agents.md +16 -9
- package/docs/guides/assets-pipeline.md +259 -82
- package/docs/guides/audio.md +115 -128
- package/docs/guides/baked-light-data.md +44 -23
- package/docs/guides/car-paint.md +38 -32
- package/docs/guides/content-pages.md +63 -35
- package/docs/guides/custom-passes.md +65 -22
- package/docs/guides/custom-shaders.md +59 -39
- package/docs/guides/debugging.md +74 -10
- package/docs/guides/deploying.md +85 -6
- package/docs/guides/deterministic-simulation.md +24 -17
- package/docs/guides/first-use-shaders.md +83 -45
- package/docs/guides/lens-kit.md +29 -26
- package/docs/guides/loading-screens.md +132 -47
- package/docs/guides/multiple-views.md +63 -13
- package/docs/guides/performance.md +192 -38
- package/docs/guides/phones.md +78 -15
- package/docs/guides/physics.md +7 -11
- package/docs/guides/screens.md +47 -33
- package/docs/guides/start-time.md +363 -0
- package/docs/guides/testing.md +152 -95
- package/docs/guides/ui-overlays.md +19 -14
- package/docs/guides/video-textures.md +14 -13
- package/docs/images/api/animation/character.webp +0 -0
- package/docs/images/api/animation/look-at-ring.webp +0 -0
- package/docs/images/api/animation/morph-tulips.webp +0 -0
- package/docs/images/api/animation/skeleton-lines.webp +0 -0
- package/docs/images/api/controls/gizmo-handles.webp +0 -0
- package/docs/images/api/controls/walk-and-fly.webp +0 -0
- package/docs/images/api/debug/debug-shapes.webp +0 -0
- package/docs/images/api/debug/levels-view.webp +0 -0
- package/docs/images/api/engine/transparent-canvas.webp +0 -0
- package/docs/images/api/feature-draws/feature-draw-clouds.webp +0 -0
- package/docs/images/api/feature-instances/compute-instances.webp +0 -0
- package/docs/images/api/feature-instances/instances-shadow.webp +0 -0
- package/docs/images/api/geometry/extra-shapes.webp +0 -0
- package/docs/images/api/geometry/generators.webp +0 -0
- package/docs/images/api/geometry/mesh-arrays.webp +0 -0
- package/docs/images/api/geometry/vertex-updates.webp +0 -0
- package/docs/images/api/grass/grass-grove.webp +0 -0
- package/docs/images/api/grass/grass-presets.webp +0 -0
- package/docs/images/api/grass/grass-shadow.webp +0 -0
- package/docs/images/api/impostors/impostor-handover.webp +0 -0
- package/docs/images/api/impostors/impostor-shadow.webp +0 -0
- package/docs/images/api/impostors/impostors-forest.webp +0 -0
- package/docs/images/api/lights/spot-cookies.webp +0 -0
- package/docs/images/api/lines/lines-lit.webp +0 -0
- package/docs/images/api/lines/lines-widths.webp +0 -0
- package/docs/images/api/materials/coat-and-sheen.webp +0 -0
- package/docs/images/api/materials/decals.webp +0 -0
- package/docs/images/api/materials/iridescence-and-anisotropy.webp +0 -0
- package/docs/images/api/materials/relief.webp +0 -0
- package/docs/images/api/materials/shader-inputs.webp +0 -0
- package/docs/images/api/materials/standard-grid.webp +0 -0
- package/docs/images/api/materials/subsurface.webp +0 -0
- package/docs/images/api/materials/translucency.webp +0 -0
- package/docs/images/api/objects/objects-turntable.webp +0 -0
- package/docs/images/api/particles/campfire.webp +0 -0
- package/docs/images/api/points/galaxy.webp +0 -0
- package/docs/images/api/reference/textures/texture-wrap.webp +0 -0
- package/docs/images/api/render/fullscreen-glow.webp +0 -0
- package/docs/images/api/render/reflection-mirror.webp +0 -0
- package/docs/images/api/render/security-camera.webp +0 -0
- package/docs/images/api/scene/aurora-sky-layer.webp +0 -0
- package/docs/images/api/sound/sound-demo.webp +0 -0
- package/docs/images/api/splats/splats-demo.webp +0 -0
- package/docs/images/api/sprites/sprites-lines.webp +0 -0
- package/docs/images/api/terrain/terrain-demo.webp +0 -0
- package/docs/images/api/textures/canvas-screen.webp +0 -0
- package/docs/images/api/textures/mipmaps.webp +0 -0
- package/docs/images/api/vertex-draws/rain.webp +0 -0
- package/docs/images/api/water/ocean.webp +0 -0
- package/docs/images/api/water/water-demo.webp +0 -0
- package/docs/images/api/water/water-rain.webp +0 -0
- package/docs/images/api/water/waterfall.webp +0 -0
- package/docs/images/concepts/assets/gltf-model.webp +0 -0
- package/docs/images/concepts/color-management/tone-mapped.webp +0 -0
- package/docs/images/concepts/culling/far-from-origin.webp +0 -0
- package/docs/images/concepts/instances/instances.webp +0 -0
- package/docs/images/concepts/instances/per-row-colors.webp +0 -0
- package/docs/images/concepts/large-worlds/large-world.webp +0 -0
- package/docs/images/concepts/lighting/area-lights.webp +0 -0
- package/docs/images/concepts/lighting/atmosphere.webp +0 -0
- package/docs/images/concepts/lighting/environment.webp +0 -0
- package/docs/images/concepts/lighting/light-shafts.webp +0 -0
- package/docs/images/concepts/lighting/reflection-probes.webp +0 -0
- package/docs/images/concepts/lod/forest.webp +0 -0
- package/docs/images/concepts/materials/weighted-transparency.webp +0 -0
- package/docs/images/concepts/post-processing/auto-exposure.webp +0 -0
- package/docs/images/concepts/post-processing/bounce-light.webp +0 -0
- package/docs/images/concepts/post-processing/depth-of-field.webp +0 -0
- package/docs/images/concepts/post-processing/post-effects-alley.webp +0 -0
- package/docs/images/concepts/post-processing/sharpen.webp +0 -0
- package/docs/images/concepts/post-processing/ssr-wet-street.webp +0 -0
- package/docs/images/concepts/render-layers/layers-cottages.webp +0 -0
- package/docs/images/concepts/shadows/hero-shadow.webp +0 -0
- package/docs/images/cookbook/index/picking.webp +0 -0
- package/docs/images/cookbook/index/time-of-day.webp +0 -0
- package/docs/images/errors/E1431/area-lights-no-tables.webp +0 -0
- package/docs/images/guides/custom-passes/reflection-water.webp +0 -0
- package/docs/images/guides/deterministic-simulation/replay-demo.webp +0 -0
- package/docs/images/guides/multiple-views/split-screen.webp +0 -0
- package/docs/images/guides/performance/overdraw-view.webp +0 -0
- package/docs/images/guides/testing/hold-mode-frame.webp +0 -0
- package/docs/images/index/showcase-island.webp +0 -0
- package/docs/images/porting/threejs-shaders/dissolve.webp +0 -0
- package/docs/images/shaders/builtins/builtins.webp +0 -0
- package/docs/images/shaders/surface-functions/custom-surface.webp +0 -0
- package/docs/images/shaders/surface-functions/vertex-offset.webp +0 -0
- package/docs/images/shots.json +2231 -0
- package/docs/index.md +18 -23
- package/docs/moves.json +1 -0
- package/docs/nav.json +300 -0
- package/docs/pages.md +230 -209
- package/docs/porting/react-three-fiber.md +225 -6
- package/docs/porting/threejs-loop-and-threads.md +217 -7
- package/docs/porting/threejs-mapping.md +1249 -233
- package/docs/porting/threejs-materials.md +218 -6
- package/docs/porting/threejs-overview.md +240 -7
- package/docs/porting/threejs-postprocessing.md +4 -8
- package/docs/porting/threejs-shaders.md +301 -6
- package/docs/porting/threejs-unsupported.md +83 -7
- package/docs/porting/verification.md +178 -6
- package/docs/shaders/builtins.md +15 -4
- package/docs/shaders/library.md +72 -45
- package/docs/shaders/surface-functions.md +59 -23
- package/docs/shaders/wgsl-rules.md +12 -5
- package/lib/debug/channel.d.ts +103 -0
- package/lib/debug/channel.js +269 -0
- package/lib/debug/debug.d.ts +11 -9
- package/lib/debug/draw.d.ts +11 -2
- package/lib/debug/draw.js +57 -6
- package/lib/debug/inspector.d.ts +60 -0
- package/lib/debug/inspector.js +475 -0
- package/lib/debug/overlay-look.d.ts +6 -0
- package/lib/debug/overlay-look.js +29 -7
- package/lib/debug/overlay.js +15 -11
- package/lib/debug/stats-options.d.ts +13 -0
- package/lib/debug/stats-panel.d.ts +22 -7
- package/lib/debug/stats-panel.js +80 -13
- package/lib/debug/stats.d.ts +2 -3
- package/lib/errors/codes.d.ts +17 -3
- package/lib/errors/codes.js +117 -105
- package/lib/errors/engine-error.js +25 -10
- package/lib/errors/fixes.d.ts +1 -0
- package/lib/errors/fixes.js +20 -19
- package/lib/generated/core.d.ts +1 -1
- package/lib/generated/core.js +1 -1
- package/lib/gpu/early-builds.d.ts +68 -0
- package/lib/gpu/early-builds.js +158 -0
- package/lib/gpu/pipeline-name.d.ts +6 -0
- package/lib/gpu/pipeline-name.js +23 -0
- package/lib/gpu/variants.d.ts +8 -2
- package/lib/gpu/variants.js +39 -7
- package/lib/gpu/webgl2/backend.d.ts +63 -2
- package/lib/gpu/webgl2/backend.js +226 -8
- package/lib/gpu/webgl2/programs.d.ts +18 -0
- package/lib/gpu/webgl2/programs.js +5 -2
- package/lib/gpu/webgpu/backend.d.ts +89 -2
- package/lib/gpu/webgpu/backend.js +255 -8
- package/lib/gpu/webgpu/pipelines.d.ts +13 -0
- package/lib/gpu/webgpu/pipelines.js +28 -14
- package/lib/index.d.ts +7 -5
- package/lib/index.js +3 -2
- package/lib/math/color.d.ts +5 -5
- package/lib/math/color.js +5 -5
- package/lib/math/mat4.d.ts +6 -12
- package/lib/math/mat4.js +6 -12
- package/lib/math/namespaces/quat.d.ts +3 -3
- package/lib/math/namespaces/quat.js +3 -3
- package/lib/math/quat.d.ts +8 -12
- package/lib/math/quat.js +8 -12
- package/lib/math/random.d.ts +2 -3
- package/lib/math/random.js +2 -3
- package/lib/math/types.d.ts +4 -4
- package/lib/math/vec3.d.ts +3 -6
- package/lib/math/vec3.js +3 -6
- package/lib/page/capabilities.d.ts +8 -8
- package/lib/page/capabilities.js +39 -25
- package/lib/page/check-store.d.ts +14 -2
- package/lib/page/check-store.js +34 -11
- package/lib/page/engine.d.ts +117 -31
- package/lib/page/engine.js +438 -99
- package/lib/page/first-frame.d.ts +16 -0
- package/lib/page/first-frame.js +35 -0
- package/lib/page/frame-stats.d.ts +34 -1
- package/lib/page/frame-stats.js +15 -0
- package/lib/page/label-loop.d.ts +7 -3
- package/lib/page/label-loop.js +26 -14
- package/lib/page/labels.d.ts +3 -3
- package/lib/page/pipeline-store.d.ts +25 -0
- package/lib/page/pipeline-store.js +84 -0
- package/lib/page/start-marker.d.ts +4 -1
- package/lib/page/start-marker.js +5 -2
- package/lib/page/stats-switch.js +2 -0
- package/lib/page/switches.d.ts +38 -6
- package/lib/page/switches.js +29 -5
- package/lib/quality/check.d.ts +24 -3
- package/lib/quality/check.js +21 -7
- package/lib/quality/chooser.d.ts +6 -0
- package/lib/quality/chooser.js +8 -0
- package/lib/quality/governor.d.ts +98 -6
- package/lib/quality/governor.js +250 -20
- package/lib/quality/preset-docs.d.ts +16 -1
- package/lib/quality/preset-docs.js +3 -0
- package/lib/quality/presets.d.ts +84 -7
- package/lib/quality/presets.js +94 -2
- package/lib/render/draw.d.ts +3 -2
- package/lib/render/draw.js +15 -5
- package/lib/render/load-draw.d.ts +7 -5
- package/lib/render/load-draw.js +7 -5
- package/lib/render/loss.d.ts +28 -10
- package/lib/render/loss.js +50 -22
- package/lib/render/recovery.d.ts +20 -0
- package/lib/render/recovery.js +44 -4
- package/lib/render/renderer.d.ts +85 -9
- package/lib/render/renderer.js +181 -42
- package/lib/render/scene-renderer.d.ts +19 -1
- package/lib/render/scene-renderer.js +25 -1
- package/lib/render/webgl2-renderers.js +8 -5
- package/lib/render/webgpu-renderers.js +5 -4
- package/lib/scene/animation.d.ts +28 -32
- package/lib/scene/animation.js +12 -15
- package/lib/scene/assets.d.ts +61 -86
- package/lib/scene/assets.js +103 -236
- package/lib/scene/background.d.ts +14 -18
- package/lib/scene/background.js +5 -2
- package/lib/scene/baked-light.d.ts +2 -2
- package/lib/scene/color.d.ts +3 -3
- package/lib/scene/downloads.d.ts +2 -0
- package/lib/scene/downloads.js +371 -0
- package/lib/scene/environment.d.ts +7 -7
- package/lib/scene/environment.js +1 -1
- package/lib/scene/fake-call-values.js +3 -3
- package/lib/scene/fog.d.ts +11 -4
- package/lib/scene/fog.js +8 -2
- package/lib/scene/frame-cameras.d.ts +35 -4
- package/lib/scene/frame-cameras.js +86 -10
- package/lib/scene/gltf.d.ts +33 -3
- package/lib/scene/gltf.js +78 -49
- package/lib/scene/grading.d.ts +2 -2
- package/lib/scene/grading.js +3 -3
- package/lib/scene/ktx2.d.ts +9 -1
- package/lib/scene/ktx2.js +3 -2
- package/lib/scene/level-rule.d.ts +121 -0
- package/lib/scene/level-rule.js +130 -0
- package/lib/scene/lines.d.ts +13 -17
- package/lib/scene/lines.js +3 -3
- package/lib/scene/lut.d.ts +1 -2
- package/lib/scene/lut.js +1 -2
- package/lib/scene/particles.d.ts +7 -3
- package/lib/scene/particles.js +3 -1
- package/lib/scene/picks.d.ts +2 -2
- package/lib/scene/pointer-events.d.ts +4 -7
- package/lib/scene/post.d.ts +39 -43
- package/lib/scene/post.js +4 -1
- package/lib/scene/prefab.d.ts +7 -8
- package/lib/scene/prefab.js +7 -8
- package/lib/scene/property-animation.d.ts +1 -1
- package/lib/scene/property-animation.js +1 -1
- package/lib/scene/queries.d.ts +7 -13
- package/lib/scene/resources.d.ts +238 -261
- package/lib/scene/resources.js +179 -81
- package/lib/scene/scene.d.ts +167 -120
- package/lib/scene/scene.js +243 -103
- package/lib/scene/serial-loads.d.ts +29 -0
- package/lib/scene/serial-loads.js +68 -0
- package/lib/scene/shader-preloads.d.ts +34 -0
- package/lib/scene/shader-preloads.js +38 -0
- package/lib/scene/sprites.d.ts +14 -17
- package/lib/scene/sprites.js +5 -6
- package/lib/scene/textures.d.ts +11 -12
- package/lib/scene/textures.js +9 -10
- package/lib/scene/time-of-day.d.ts +11 -7
- package/lib/scene/time-of-day.js +11 -8
- package/lib/scene/vertex-draws.d.ts +5 -4
- package/lib/scene/vertex-draws.js +7 -5
- package/lib/shader-artifact.json +1 -0
- package/lib/shared/core.d.ts +5 -0
- package/lib/shared/core.js +1 -0
- package/lib/shared/import-once.d.ts +6 -0
- package/lib/shared/import-once.js +19 -0
- package/lib/shared/labels.d.ts +5 -2
- package/lib/shared/labels.js +5 -2
- package/lib/shared/metrics.d.ts +38 -0
- package/lib/shared/metrics.js +62 -1
- package/lib/shared/permutation-words.d.ts +2 -0
- package/lib/shared/permutation-words.js +8 -0
- package/lib/shared/recording.d.ts +13 -5
- package/lib/shared/recording.js +31 -10
- package/lib/shared/run-task.js +7 -1
- package/lib/shared/sketch-data.d.ts +9 -0
- package/lib/shared/sketch-data.js +57 -0
- package/lib/shared/task-pending.d.ts +12 -0
- package/lib/shared/task-pending.js +61 -1
- package/lib/shared/tasks.js +79 -32
- package/lib/shared/version.d.ts +17 -1
- package/lib/shared/version.js +19 -1
- package/lib/shared/wasm.d.ts +12 -4
- package/lib/shared/wasm.js +50 -27
- package/lib/shared/worker-start.d.ts +7 -0
- package/lib/shared/worker-start.js +27 -0
- package/lib/sketch/define-sketch.d.ts +51 -7
- package/lib/sketch/define-sketch.js +2 -1
- package/lib/sketch/input.d.ts +2 -2
- package/lib/sketch/preset-check.d.ts +20 -6
- package/lib/sketch/preset-check.js +42 -17
- package/lib/sketch/quality.d.ts +69 -11
- package/lib/sketch/quality.js +54 -13
- package/lib/sketch/runner.d.ts +80 -9
- package/lib/sketch/runner.js +390 -52
- package/lib/sketch/ui.d.ts +5 -8
- package/lib/sketch/ui.js +4 -2
- package/lib/stats.d.ts +1 -0
- package/lib/workers/probe-worker.d.ts +5 -0
- package/lib/workers/probe-worker.js +13 -4
- package/lib/workers/protocol.d.ts +71 -13
- package/lib/workers/protocol.js +4 -0
- package/lib/workers/render-worker.js +29 -5
- package/lib/workers/sketch-worker.js +108 -16
- package/package.json +2 -2
package/docs/api/wind.md
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: api/wind
|
|
3
3
|
title: "Wind (@null3d/wind)"
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.3"
|
|
6
4
|
summary: "createWind: one field of air that plants, flags, smoke and water read, from an analytic wind of place and time with traveling gusts and pushes, held in a grid that follows the camera."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Wind (@null3d/wind)
|
|
10
8
|
|
|
11
|
-
> Roadmap step 0.3, first released in null3D 0.1.0. The API is experimental, so it can still change between versions.
|
|
12
|
-
|
|
13
9
|
```mermaid
|
|
14
10
|
flowchart LR
|
|
15
11
|
base["setBase: speed<br/>and heading"] --> field["The field: a grid<br/>about the camera"]
|
|
@@ -21,7 +17,9 @@ flowchart LR
|
|
|
21
17
|
cpu["sample: the<br/>mirror on the CPU"] --> page
|
|
22
18
|
```
|
|
23
19
|
|
|
24
|
-
`@null3d/wind` makes the air in a scene. One field moves every plant, flag and smoke card that reads it, so a gust that crosses a field reaches all of them together. The air is solved: a grid that follows the camera carries it from frame to frame.
|
|
20
|
+
`@null3d/wind` makes the air in a scene. One field moves every plant, flag and smoke card that reads it, so a gust that crosses a field reaches all of them together. The air is solved: a grid that follows the camera carries it from frame to frame.
|
|
21
|
+
|
|
22
|
+
A gust therefore bends through the scene, and a body leaves a wake that outlives it. A steady wind slows near the ground, and swirls turn without piling up. A page can also shove the air at a point, as a body moving through it does.
|
|
25
23
|
|
|
26
24
|
```sh
|
|
27
25
|
bun add @null3d/wind
|
|
@@ -54,7 +52,14 @@ export default defineSketch((ctx) => {
|
|
|
54
52
|
});
|
|
55
53
|
```
|
|
56
54
|
|
|
57
|
-
Call `update` once in each frame. It places the box about the camera and sends the field's values to the GPU. The add-on's calls make no object of their own, so a sketch may make them in every frame. A
|
|
55
|
+
Call `update` once in each frame. It places the box about the camera and sends the field's values to the GPU. The add-on's calls make no object of their own, so a sketch may make them in every frame. A sketch that pushes in every frame keeps one two-number array for the place, rather than a new one each time.
|
|
56
|
+
|
|
57
|
+
<details>
|
|
58
|
+
<summary>Technical details: allocation in a frame</summary>
|
|
59
|
+
|
|
60
|
+
A `read` in each frame also takes the task's promise, which the engine makes. Until the browser has optimized the add-on's functions, a fraction that crosses one of its calls becomes an object, as in the engine's own steps.
|
|
61
|
+
|
|
62
|
+
</details>
|
|
58
63
|
|
|
59
64
|
## The calls
|
|
60
65
|
|
|
@@ -74,11 +79,21 @@ Call `update` once in each frame. It places the box about the camera and sends t
|
|
|
74
79
|
|
|
75
80
|
The ring holds the three newest pushes, and each fades over three seconds. A page that pushes often therefore keeps a wake behind the body it moves. The newest gust has a slot of its own, so a page's pushes never push its gust out. A gust's wave travels for as long as its reach holds it.
|
|
76
81
|
|
|
77
|
-
`read`
|
|
82
|
+
`read` works out the air on the engine's job workers, up to about five thousand places a call. The answer gives the air at the frame's own time and lands before the next frame's update.
|
|
83
|
+
|
|
84
|
+
<details>
|
|
85
|
+
<summary>Technical details: how read queues its asks</summary>
|
|
86
|
+
|
|
87
|
+
The field's walk over the pushes runs in the add-on's WebAssembly, on the engine's job workers. A call that arrives while an answer is still on its way sends one more ask when that answer comes. A third call that arrives before either answer replaces the queued one: the newest ask wins, the one it replaces is dropped, and its array keeps the numbers it held. A page that asks in every frame therefore queues about one ask a frame, and the add-on reports a dropped ask once.
|
|
88
|
+
|
|
89
|
+
</details>
|
|
78
90
|
|
|
79
91
|
## Reading the field in your own WGSL
|
|
80
92
|
|
|
81
|
-
A material reads the field with one texture. `field.texture` holds the air over `field.origin` and `field.size`. The shader build resolves only the engine's library. So your WGSL holds copies of the add-on's two blocks: the steady field, which every reader shares, and the sampling function. Copy both from `shaders/field.wgsl` in the package, or
|
|
93
|
+
A material reads the field with one texture. `field.texture` holds the air over `field.origin` and `field.size`. The shader build resolves only the engine's library. So your WGSL holds copies of the add-on's two blocks: the steady field, which every reader shares, and the sampling function. Copy both from `shaders/field.wgsl` in the package, or open the two blocks below.
|
|
94
|
+
|
|
95
|
+
<details>
|
|
96
|
+
<summary>Technical details: the steady field block to copy (wind-steady)</summary>
|
|
82
97
|
|
|
83
98
|
```wgsl
|
|
84
99
|
#import null3d::noise::{value3}
|
|
@@ -223,6 +238,11 @@ fn wind_steady(air: WindAir, p: vec3f) -> vec3f {
|
|
|
223
238
|
// </wind-steady>
|
|
224
239
|
```
|
|
225
240
|
|
|
241
|
+
</details>
|
|
242
|
+
|
|
243
|
+
<details>
|
|
244
|
+
<summary>Technical details: the sampling block to copy (wind-sample)</summary>
|
|
245
|
+
|
|
226
246
|
```wgsl
|
|
227
247
|
// <wind-sample>
|
|
228
248
|
/// The air's steady settings as a reader holds them: the base wind in the first vector, the gust in
|
|
@@ -269,7 +289,11 @@ fn wind_sample(world: vec3f, origin: vec2f, size: f32, layer: i32, air: WindAir)
|
|
|
269
289
|
// </wind-sample>
|
|
270
290
|
```
|
|
271
291
|
|
|
272
|
-
|
|
292
|
+
</details>
|
|
293
|
+
|
|
294
|
+
Inside the box, the sampling function gives the air with one texture read. Outside it, it works the air out from the steady field, at the height that the grid samples at. So the two meet at the box's edge, and a plant past the box moves with the air at its own place.
|
|
295
|
+
|
|
296
|
+
A page's pushes and a gust that the page sends turn the air inside the box, so a plant past the box does not see them. A device that keeps no grid works the air out everywhere.
|
|
273
297
|
|
|
274
298
|
```ts
|
|
275
299
|
const leaf = ctx.materials.shader({
|
|
@@ -323,19 +347,21 @@ The box follows the camera, so update the material's `origin` values in each fra
|
|
|
323
347
|
|
|
324
348
|
A vertex offset that reads the field orders the pass before every pass that draws the material. The shadows and the motion vectors therefore move with the plant.
|
|
325
349
|
|
|
326
|
-
Trees and plants sway through such a material. The forest demo
|
|
350
|
+
Trees and plants sway through such a material. The [forest demo](https://github.com/null3d-engine/null3d/tree/main/examples/forest) draws the bark of its trees made in code with one custom material, and their leaf cards with a standard material. The bark's vertex offset samples this field's block at each vertex, as the example above does. Its sway fades to nothing at the material's `swayDistance`. So a tree past it stands still, and its far shadow cascades keep their layers.
|
|
351
|
+
|
|
352
|
+
A tree loaded from a glTF file sways the same way: give its meshes such a material with `setMaterial`. The grass package, [`@null3d/grass`](grass.md), reads the field for its blades. Its `swayDistanceFor(preset)` gives each quality preset's sway distance.
|
|
327
353
|
|
|
328
354
|
Every reader takes the field as a plain texture and its box, so it needs no code from this add-on. A page's own material reads it, as the forest demo's does. The grass package's blades read it, and the water add-on's `wind` option lifts a water surface. They read the same sampling block, and each copy costs the reader one of its material's six texture slots. Tests hold the readers' blocks equal to this page's.
|
|
329
355
|
|
|
330
356
|
## What the field is
|
|
331
357
|
|
|
332
|
-
The field keeps its state between frames. One pass holds two states and steps the air forward by
|
|
358
|
+
The field keeps its state between frames. One pass holds two states and steps the air forward by the preset's step interval at a time. It runs as many steps as the sketch time owes.
|
|
333
359
|
|
|
334
360
|
Each cycle pulls the air toward an analytic field of place and time. It injects the pushes and the gust, and keeps the eddies with vorticity confinement. It solves the pressure, and takes the pressure's slope out of the air, so the air never piles up. A wake therefore lasts after the body that made it has gone, and a gust sent upwind crosses the scene.
|
|
335
361
|
|
|
336
362
|
The air starts when a page makes the wind, so a field made late in a sketch runs no air from before it.
|
|
337
363
|
|
|
338
|
-
|
|
364
|
+
In [hold mode](../guides/testing.md#hold-mode), the engine steps the sketch's updates up to the held time. The first frame that draws runs the air that the hold owes, up to ten seconds of it. So a held picture carries the air that the hold built. Two held pages at two times within ten seconds of the wind's start therefore differ by the air that moved between them. A longer hold runs only ten seconds of air.
|
|
339
365
|
|
|
340
366
|
Beyond its box the field carries on. The box sets the detail, not the field's extent. So a plant past the box reads the air at its own place.
|
|
341
367
|
|
|
@@ -356,9 +382,12 @@ The add-on declares its work to the engine as one feature. The preset gives its
|
|
|
356
382
|
|
|
357
383
|
Low keeps no grid: every reader works the air out from the steady field. A page that gives `grid` keeps it, whatever the preset says. At Low, that page still gets a field, at the add-on's own step and pressure count. WebGL2 takes its own step row, 66 ms at Medium and above, because a step costs far more there.
|
|
358
384
|
|
|
359
|
-
The grid is one flat slice at the crown's height
|
|
385
|
+
The grid is one flat slice at the crown's height, with no layered or volume grid. High and Ultra use the flat 128 and 256 grids.
|
|
360
386
|
|
|
361
|
-
The field's own budget is 0.5, 1.2, 4.9 and 6.25 ms a frame from Low to Ultra.
|
|
387
|
+
The field's own budget is 0.5, 1.2, 4.9 and 6.25 ms a frame from Low to Ultra.
|
|
388
|
+
|
|
389
|
+
- The governor lowers the field's share by a quarter at each of its steps, down to a quarter of the budget. The field still moves at the lowest step: the step interval reaches at most 133 ms, and the pressure count stays above zero.
|
|
390
|
+
- The overlay row reads the field's cost in a frame, which grows when a slow display owes the field more than one cycle in that frame. This example is the Medium row, with an example GPU time: `wind gpu 0.62 ms windStepMs 33 · windPressureSteps 16 · windSpringTrees 8 · windGrid 64 · budget 1.2 of 1.2 ms · memory 0.1 MiB`.
|
|
362
391
|
|
|
363
392
|
A preset change that changes the grid makes the grid again at the new size. The air starts empty on the new grid. A reader takes `field.texture` again after that, because the texture is a new one.
|
|
364
393
|
|
|
@@ -369,7 +398,24 @@ A preset change that changes the grid makes the grid again at the new size. The
|
|
|
369
398
|
- A vertex inside the box costs one texture read. A vertex outside it costs the steady field's arithmetic instead: four reads of the engine's value noise, with a few trigonometric and exponential calls.
|
|
370
399
|
- A WebGL2 device whose float targets fail the engine's probe cannot hold the grid, so it keeps no pass. There `field.size` is zero and a reader's samples are the steady field worked out, so a plant still moves. The texture it declares holds a single black texel that it never reaches.
|
|
371
400
|
- With no grid, every reader works the steady field out: the base wind, the swirl, the preset's own traveling gust and the gust that a page sends. A reader takes that gust in the fourth vector of its settings, so the surface, the leaves or the blades it draws answer it. The sent gust travels from the place it was sent and fades over 8 s. A push reaches readers only through the grid, so a point with no grid, or beyond the box, reads no push.
|
|
372
|
-
- The add-on makes no object of its own in a frame, and its texture exists only while something reads it. `read` sends one request to a job worker and takes the task's promise.
|
|
401
|
+
- The add-on makes no object of its own in a frame, and its texture exists only while something reads it. `read` sends one request to a job worker and takes the task's promise. The engine's repository measures the bytes with `bun run bench:allocation --wind`.
|
|
402
|
+
|
|
403
|
+
<details>
|
|
404
|
+
<summary>Technical details: what the calls allocate</summary>
|
|
405
|
+
|
|
406
|
+
Where the page shares its memory, the worker writes the answer in place; otherwise the answer comes back as one buffer. The add-on's WebAssembly holds the walk over the pushes and the places, so a page's own motion costs the sketch's thread one message and one copy of the answer. Each fraction that the add-on works out reaches a call in an array that the add-on made once, so a call the browser does not inline boxes none of them.
|
|
407
|
+
|
|
408
|
+
</details>
|
|
409
|
+
|
|
410
|
+
## Related pages
|
|
411
|
+
|
|
412
|
+
- [Grass](grass.md): reads the field for its blades.
|
|
413
|
+
- [Water](water.md): its `wind` option lifts a water surface.
|
|
414
|
+
- [Materials](materials.md): a custom material's vertex offset reads the field.
|
|
415
|
+
- [Add-on feature descriptions](features.md): the feature that declares the field's work.
|
|
416
|
+
- [Quality API](quality.md): the presets that set the field's grid and steps.
|
|
417
|
+
- [Plants in the field](https://github.com/null3d-engine/null3d/tree/main/examples/vegetation-wind): a grove of oaks, birches and firs that sway in the field. The plant material lives in the shared helper `examples/lib/sway.ts`, which the sketch imports.
|
|
418
|
+
|
|
419
|
+
## API reference
|
|
373
420
|
|
|
374
|
-
[The API reference](reference/wind.md) lists every export of this page with its type and
|
|
375
|
-
description. The engine's doc comments make it.
|
|
421
|
+
[The API reference](reference/wind.md) lists every export of this page with its type and description. The engine's doc comments make it.
|
package/docs/cli/null3d.md
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: cli/null3d
|
|
3
3
|
title: "The `null3d` command"
|
|
4
|
-
|
|
5
|
-
since: "0.1"
|
|
6
|
-
summary: "create, test, bench, check-addon, shot, upgrade, assets, docs, port, skills, mcp, doctor."
|
|
4
|
+
summary: "create, test, bench, check-addon, shot, upgrade, assets, mcp, shaders record."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# The `null3d` command
|
|
10
8
|
|
|
11
|
-
>
|
|
9
|
+
> `test` runs image tests, and no behavior tests.
|
|
12
10
|
|
|
13
11
|
The `@null3d/cli` package holds the `null3d` command. You need no command to build or run a sketch: Vite and the null3D Vite plugin do that. The command does jobs that a bundler does not do, such as drawing a frame of your scene with no person watching.
|
|
14
12
|
|
|
@@ -22,20 +20,34 @@ bunx @null3d/cli --version
|
|
|
22
20
|
|
|
23
21
|
The command needs Node 20.19 or later, or Node 22.12 or later, as Vite 8 does.
|
|
24
22
|
|
|
23
|
+
| Command | What it does |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| [`create`](#create) | Write a new project from a template. |
|
|
26
|
+
| [`shot`](#shot) | Draw a frame of your scene in a headless browser, and save it. |
|
|
27
|
+
| [`test`](#test) | Run image tests on your sketch. |
|
|
28
|
+
| [Timed scripts](#timed-scripts) | The script format that `shot` and `test` read. |
|
|
29
|
+
| [`bench`](#bench) | Run the benchmark protocol on a page. |
|
|
30
|
+
| [`mcp`](#mcp) | Connect a coding agent to the live scene. |
|
|
31
|
+
| [`check-addon`](#check-addon) | Run the engine's checks for add-ons on a package. |
|
|
32
|
+
| [`assets`](#assets) | Optimize and convert models and textures. |
|
|
33
|
+
| [`upgrade`](#upgrade) | Update a project's packages to one version. |
|
|
34
|
+
| [Where the commands draw](#where-the-commands-draw) | Which GPU and browser each command uses. |
|
|
35
|
+
|
|
25
36
|
## create
|
|
26
37
|
|
|
27
38
|
`create` writes a new project from a template. The project runs with Vite, and it holds the rules and the hook that an AI agent uses.
|
|
28
39
|
|
|
29
40
|
```sh
|
|
30
41
|
bunx @null3d/cli create my-game
|
|
31
|
-
bunx @null3d/cli create my-
|
|
42
|
+
bunx @null3d/cli create my-viewer --template product
|
|
43
|
+
bunx @null3d/cli create my-game --template game
|
|
32
44
|
```
|
|
33
45
|
|
|
34
46
|
| Option | Effect | Without it |
|
|
35
47
|
| --- | --- | --- |
|
|
36
|
-
| `--template <name>` | The template to copy | `empty` |
|
|
48
|
+
| `--template <name>` | The template to copy: `empty`, a turning cube; `product`, a product viewer; or `game`, a small game | `empty` |
|
|
37
49
|
|
|
38
|
-
The folder must not exist, or it must be empty.
|
|
50
|
+
The folder must not exist, or it must be empty. A folder that holds `.claude/settings.json` or `.codex/hooks.json` gets its own message, because those files can hold your own hooks. The command writes its own version into the project's package pins, and it installs nothing. Run `bun install` in the new folder, then `bunx vite`. [Project structure](../getting-started/project-structure.md) lists the files and explains the agent hook.
|
|
39
51
|
|
|
40
52
|
## shot
|
|
41
53
|
|
|
@@ -54,6 +66,8 @@ flowchart LR
|
|
|
54
66
|
bunx @null3d/cli shot --out shot.png --time 1.5 --size 1280x720 --gpu webgl2
|
|
55
67
|
```
|
|
56
68
|
|
|
69
|
+
`--page` keeps the page's own query, and the engine adds its switches beside it. A page that reads its address and passes the state as [start data](../api/page.md#start-data) draws that state in the held frame: `bunx @null3d/cli shot --page "/?stop=city"`. A [`test`](#test) entry's `page` takes a query in the same way.
|
|
70
|
+
|
|
57
71
|
| Option | Effect | Without it |
|
|
58
72
|
| --- | --- | --- |
|
|
59
73
|
| `--out <file.png>` | The image to write. The JSON file beside it takes its name, such as `shot.json` | `shot.png` |
|
|
@@ -92,7 +106,7 @@ The summary lists what the page logged, with the first lines of each entry. The
|
|
|
92
106
|
| `tier` | The GPU path that drew the frame: `webgpu`, `webgpu-compat` or `webgl2` |
|
|
93
107
|
| `width`, `height` | The image's size in pixels |
|
|
94
108
|
| `image` | The image's file name, in the JSON file's folder |
|
|
95
|
-
| `stats` | The frame's figures in the form that `engine.measure()` returns: CPU time by thread and phase, draw calls, uploads and pipelines. The held frame is the first frame that the engine draws, so it builds
|
|
109
|
+
| `stats` | The frame's figures in the form that `engine.measure()` returns: CPU time by thread and phase, draw calls, uploads and pipelines. The held frame is the first frame that the engine draws, so it builds the pipelines that frame uses and uploads the whole scene |
|
|
96
110
|
| `code`, `error` | When no frame was drawn: the error's code, or `null`, and what went wrong |
|
|
97
111
|
| `ms` | Time from opening the page to the engine's result, in milliseconds |
|
|
98
112
|
| `errors` | The page's uncaught errors and console errors, then the dev server's errors |
|
|
@@ -116,7 +130,7 @@ A page that opens with `?record` records each frame's step and the input that th
|
|
|
116
130
|
bunx @null3d/cli shot --replay bug.n3dr --out bug.png
|
|
117
131
|
```
|
|
118
132
|
|
|
119
|
-
The command serves the file to the page, runs the recording's frames in order with their recorded steps and input, and draws the last one. It reads no live input, and `--time` and `--script` cannot be given with it: the recording sets every frame's time. The summary names the frames, the final sketch time and the sketch that recorded them.
|
|
133
|
+
The command serves the file to the page, runs the recording's frames in order with their recorded steps and input, and draws the last one. The sketch's setup reads the [start data](../api/page.md#start-data) that the recording keeps, not the data of the page that plays it. It reads no live input, and `--time` and `--script` cannot be given with it: the recording sets every frame's time. The summary names the frames, the final sketch time and the sketch that recorded them.
|
|
120
134
|
|
|
121
135
|
A recording stops at 600 seconds of sketch time, and its file says so. A sketch that reads the quality preset or the device's capabilities can draw differently on a replay, because the replay picks this computer's own preset. [Testing your sketch](../guides/testing.md#record-a-session-that-went-wrong) gives the whole workflow.
|
|
122
136
|
|
|
@@ -185,6 +199,61 @@ Every image is a hold from time 0 that performs the script up to its step. So an
|
|
|
185
199
|
|
|
186
200
|
The engine reads the script only in hold mode. A page that you run with Vite never performs one, and its input stays the user's.
|
|
187
201
|
|
|
202
|
+
## mcp
|
|
203
|
+
|
|
204
|
+
`mcp` starts a Model Context Protocol server for the project in the current folder, over stdio. An agent lists and changes the live scene's objects, captures a frame, and reads the frame figures, the errors and the render graph. It can also switch the quality preset or the GPU path.
|
|
205
|
+
|
|
206
|
+
The page needs a development build: a production build leaves the inspection channel out. The page must also start the engine as it loads. A held page and a replay page publish no inspection bridge, so the command cannot drive them.
|
|
207
|
+
|
|
208
|
+
```mermaid
|
|
209
|
+
flowchart LR
|
|
210
|
+
agent["A coding agent"] --> mcp["bunx @null3d/cli mcp"]
|
|
211
|
+
mcp --> server["Your project's own<br/>Vite dev server"]
|
|
212
|
+
mcp --> browser["A headless browser,<br/>or your open Chrome"]
|
|
213
|
+
browser --> page["Your page"]
|
|
214
|
+
page --> bridge["window.__null3dInspector"]
|
|
215
|
+
bridge --> worker["The sketch worker<br/>reads and changes the scene"]
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
By default the command starts the project's own Vite dev server and a headless Chrome, as `shot` does. With `--connect` it attaches to a Chrome that already runs with a debugging port. It then drives the tab that already shows the page, so the agent sees exactly what you see.
|
|
219
|
+
|
|
220
|
+
```sh
|
|
221
|
+
claude mcp add null3d -- bunx @null3d/cli mcp
|
|
222
|
+
claude mcp add null3d-session -- bunx @null3d/cli mcp --connect http://127.0.0.1:9222
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
For the second form, start Chrome with `--remote-debugging-port=9222` and open the page from your Vite dev server. Every development build publishes the inspection bridge, so the page needs no switch. `?inspect` only opens the in-page panel. The command drives the first tab whose path is the `--page` path. When no tab has that path, it drives the first tab that publishes the bridge.
|
|
226
|
+
|
|
227
|
+
| Option | Effect | Without it |
|
|
228
|
+
| --- | --- | --- |
|
|
229
|
+
| `--page <path>` | The page to open, from the server's root. With `--connect`, the path of the tab to drive | `/` |
|
|
230
|
+
| `--gpu <tier>` | Opens the server's own page on `webgpu`, `compat` or `webgl2`. `--connect` ignores it | The engine picks the path |
|
|
231
|
+
| `--size <width>x<height>` | The headless browser's window in CSS pixels. `--connect` ignores it | `1280x720` |
|
|
232
|
+
| `--timeout <seconds>` | How long the page may take to publish the inspector | 60 |
|
|
233
|
+
| `--url <address>` | Uses a dev server that already runs, instead of starting one. The command still starts its own headless browser | The command starts the dev server |
|
|
234
|
+
| `--connect <address>` | Attaches to Chrome's debugging endpoint and drives the tab that shows the page. Give `--url` or `--connect`, not both | The command starts its own browser |
|
|
235
|
+
|
|
236
|
+
### Objects in a call
|
|
237
|
+
|
|
238
|
+
A call names an object by its name, or by its slot as `#<slot>`, such as `#12`. A whole number names a slot too. `#camera` names the active camera. When several objects share a name, the call takes one of them, so name another by its slot. `list_objects` gives each object's slot.
|
|
239
|
+
|
|
240
|
+
`list_objects` takes two optional arguments. `filter` keeps the objects whose name or kind holds the text, and `limit` gives the most objects to return. A listing returns at most 50,000 objects. It also gives the count of objects that matched, and whether it left some out.
|
|
241
|
+
|
|
242
|
+
| Tool | What it does |
|
|
243
|
+
| --- | --- |
|
|
244
|
+
| `list_objects` | Names, slots, handles, kinds, static or dynamic, visibility, layers, parents and children, with a filter and a limit |
|
|
245
|
+
| `get_object` | Reads one object's transform, flags and material |
|
|
246
|
+
| `set_transform` | Changes a transform, visibility, the static or dynamic flag, or layers |
|
|
247
|
+
| `set_material` | Changes a mesh's material values |
|
|
248
|
+
| `capture` | Returns a PNG of the current frame |
|
|
249
|
+
| `stats` | Frame figures: frame rates, CPU and GPU time, draw calls, triangles, objects, uploads, memory, the path and the preset |
|
|
250
|
+
| `errors` | The engine errors, and the console's errors and warnings |
|
|
251
|
+
| `render_graph` | The compiled render graph as DOT text |
|
|
252
|
+
| `set_quality` | Switches the preset, or changes quality settings |
|
|
253
|
+
| `set_gpu` | Switches the GPU path and reloads the page, your own tab too with `--connect` |
|
|
254
|
+
|
|
255
|
+
Live changes are for exploring. Write the final values into the sketch and its tests. [Debugging](../guides/debugging.md#the-mcp-server) shows the calls and the in-page inspector behind them.
|
|
256
|
+
|
|
188
257
|
## test
|
|
189
258
|
|
|
190
259
|
```mermaid
|
|
@@ -237,7 +306,7 @@ bunx @null3d/cli test --update-references
|
|
|
237
306
|
| --- | --- | --- |
|
|
238
307
|
| `name` | The test's name in lowercase words joined by dashes. It names the test's image files | Required |
|
|
239
308
|
| `sketch` | A sketch module to draw, from your project's folder. A query after the path reaches the sketch ([Testing your sketch](../guides/testing.md#frames-that-stay-the-same-on-every-run)) | Give `sketch` or `page` |
|
|
240
|
-
| `page` | A page of your project to open instead, from the dev server's root | Give `sketch` or `page` |
|
|
309
|
+
| `page` | A page of your project to open instead, from the dev server's root, with any query of its own, such as `/?stop=city` | Give `sketch` or `page` |
|
|
241
310
|
| `hold` | The sketch time to hold at, in seconds, from 0 to 600 | Give `hold` or `script` |
|
|
242
311
|
| `script` | A [timed script](#timed-scripts), from your project's folder. Each of its shot steps draws an image, under the name `<name>-<shot>` | Give `hold` or `script` |
|
|
243
312
|
| `size` | The image's width and height in pixels, such as `640x360` | `320x180` |
|
|
@@ -253,7 +322,7 @@ Each image test compares its image with a reference image in `tests/references/<
|
|
|
253
322
|
|
|
254
323
|
Each run saves its images in `test-results/null3d/<environment>/<tier>/`: `<name>.png`, and `<name>-diff.png` when the image differs from its reference. The diff marks the pixels that differ in red. Keep `test-results/` out of git.
|
|
255
324
|
|
|
256
|
-
An image passes when at most 0.1% of its pixels differ from the reference. A pixel differs when its color moves more than 10% of the color range. Pixels on the anti-aliased edges of shapes never count.
|
|
325
|
+
An image passes when at most 0.1% of its pixels differ from the reference. A pixel differs when its color moves more than 10% of the color range. Pixels on the anti-aliased edges of shapes never count.
|
|
257
326
|
|
|
258
327
|
A new test has no reference, so its first run fails and saves the image. Open the image. When it is right, run `bunx @null3d/cli test --update-references` to keep it as the reference. Do the same after a change that alters an image on purpose, and check the new references in your git diff before you commit them. With `--update-references`, an image that matches its reference leaves the reference as it is.
|
|
259
328
|
|
|
@@ -262,7 +331,7 @@ A new test has no reference, so its first run fails and saves the image. Open th
|
|
|
262
331
|
```text
|
|
263
332
|
PASS type check (tsc --noEmit)
|
|
264
333
|
SKIP lint: the project's package.json has no lint script
|
|
265
|
-
The images are drawn in Chrome
|
|
334
|
+
The images are drawn in Chrome 156.0.8078.80 on this computer's GPU, and compared with the references in tests/references/chrome-real-gpu.
|
|
266
335
|
PASS start on webgpu: it matches the reference (image test-results/null3d/chrome-real-gpu/webgpu/start.png)
|
|
267
336
|
FAIL start on webgl2: 2.280% of pixels differ from the reference, and at most 0.100% may (image test-results/null3d/chrome-real-gpu/webgl2/start.png, reference tests/references/chrome-real-gpu/webgl2/start.png, diff test-results/null3d/chrome-real-gpu/webgl2/start-diff.png)
|
|
268
337
|
FAIL harbor-at-night on webgpu: there is no reference yet. When the image is right, bunx @null3d/cli test --update-references keeps it as the reference (image test-results/null3d/chrome-real-gpu/webgpu/harbor-at-night.png)
|
|
@@ -283,13 +352,16 @@ An image test also fails in these cases, and its line says why:
|
|
|
283
352
|
flowchart LR
|
|
284
353
|
bench["bunx @null3d/cli bench"] --> build["A production build<br/>with your Vite config"]
|
|
285
354
|
build --> page["A headless browser opens<br/>your page with ?bench"]
|
|
286
|
-
page -->
|
|
355
|
+
page --> first["The first frame<br/>and the preset check"]
|
|
356
|
+
first --> warm["Warm-up,<br/>not measured"]
|
|
287
357
|
warm --> measure["engine.measure"]
|
|
288
358
|
measure -->|"next run"| page
|
|
289
359
|
measure --> json["bench.json"]
|
|
290
360
|
```
|
|
291
361
|
|
|
292
|
-
`bench` measures the engine on your page. It builds your project for production with your Vite config, into a temporary folder, and serves the build. A production build has none of the engine's development checks, so the engine runs as your users get it.
|
|
362
|
+
`bench` measures the engine on your page. It builds your project for production with your Vite config, into a temporary folder, and serves the build. A production build has none of the engine's development checks, so the engine runs as your users get it.
|
|
363
|
+
|
|
364
|
+
Then `bench` opens your page in a headless browser with the `?bench` switch, once for each run. Each run waits for the engine's first frame and for the end of its [preset check](../concepts/quality-presets.md#the-preset-check). It then lets the page play for the warm-up, and measures it with `engine.measure` ([Performance guide](../guides/performance.md#measure)). So a run measures the preset that plays, not the start. Your page needs no benchmark code.
|
|
293
365
|
|
|
294
366
|
```sh
|
|
295
367
|
bunx @null3d/cli bench --gpu webgpu,webgl2
|
|
@@ -301,10 +373,10 @@ bunx @null3d/cli bench --gpu webgpu,webgl2
|
|
|
301
373
|
| `--gpu <tiers>` | The GPU paths to measure, joined by commas: `webgpu`, `compat` and `webgl2` | The engine picks the path |
|
|
302
374
|
| `--runs <count>` | Fresh runs on each GPU path | 5 |
|
|
303
375
|
| `--seconds <seconds>` | How long each run measures | 30 |
|
|
304
|
-
| `--warmup <seconds>` | How long each run lets the page
|
|
376
|
+
| `--warmup <seconds>` | How long each run lets the page play, after its first frame and the preset check, before it measures | 5 |
|
|
305
377
|
| `--size <width>x<height>` | The browser window's size in CSS pixels | `1280x720` |
|
|
306
378
|
| `--out <file.json>` | The JSON file to write | `bench.json` |
|
|
307
|
-
| `--timeout <seconds>` | How long the page may take to start the engine | 60 |
|
|
379
|
+
| `--timeout <seconds>` | How long the page may take to start the engine, draw its first frame and end the preset check | 60 |
|
|
308
380
|
|
|
309
381
|
With more than one GPU path, `bench` takes one run on each path in turn. A computer that slows down during the command then slows every path alike. The runs take several minutes, so `bench` prints a line after each run.
|
|
310
382
|
|
|
@@ -340,7 +412,7 @@ When a run fails, `bench` says why after the figures of its path, and exits with
|
|
|
340
412
|
| `environment`, `browser` | Where the runs drew, as for `shot`, and the browser's version |
|
|
341
413
|
| `warmupSeconds`, `measureSeconds` | The warm-up and the measured time of each run |
|
|
342
414
|
| `paths` | One entry for each GPU path: `gpu`, the tier that `--gpu` forced or `null`; `tier`, the path that the engine drew with; `summary`, the medians and the spread of the runs; and `runs` |
|
|
343
|
-
| `runs` | Each run's figures from `engine.measure` in `stats`, with its GPU path and the engine's mode, or `ok: false` and the `error` that stopped it |
|
|
415
|
+
| `runs` | Each run's figures from `engine.measure` in `stats`, with its GPU path and the engine's mode, or `ok: false` and the `error` that stopped it. The mode names the preset that played, after the preset check |
|
|
344
416
|
| `error` | What stopped `bench` before its runs, such as a production build that failed |
|
|
345
417
|
| `errors`, `warnings` | What the pages and the server logged, each entry once |
|
|
346
418
|
|
|
@@ -354,12 +426,15 @@ When a run fails, `bench` says why after the figures of its path, and exits with
|
|
|
354
426
|
|
|
355
427
|
## check-addon
|
|
356
428
|
|
|
357
|
-
`check-addon` runs the engine's gates on one add-on package.
|
|
429
|
+
`check-addon` runs the engine's checks for add-ons, called gates, on one add-on package. Run it before you release or publish an add-on. It prints one line for each gate, and exits with 1 when a gate fails. [Building an add-on](../guides/add-ons.md) gives the rules that the gates check.
|
|
358
430
|
|
|
359
431
|
```sh
|
|
360
|
-
bunx @null3d/cli check-addon
|
|
432
|
+
bunx @null3d/cli check-addon # the add-on in the current folder
|
|
433
|
+
bunx @null3d/cli check-addon packages/my-addon
|
|
361
434
|
```
|
|
362
435
|
|
|
436
|
+
It checks the add-on in the folder that you name, or in the current folder without one.
|
|
437
|
+
|
|
363
438
|
| Gate | What it checks |
|
|
364
439
|
| --- | --- |
|
|
365
440
|
| package | the folder has a manifest with a name and an entry file |
|
|
@@ -367,7 +442,8 @@ bunx @null3d/cli check-addon addons/splats
|
|
|
367
442
|
| interface | the entry declares the plugin interface range that it works with, or, for a `@null3d/...` package, pins the exact engine version |
|
|
368
443
|
| shaders | a build compiles the add-on's WGSL for WebGPU and WebGL2 |
|
|
369
444
|
| sizes | each file that the add-on loads after the start holds to its budget: its own code to the budget for code, and the compiled WGSL that the build inlined in it to the budget for shader builds. The gate warns, and does not fail, when a file goes over a budget |
|
|
370
|
-
| page | the page starts from another origin under the strict policy
|
|
445
|
+
| page | the page starts from another origin under the strict policy |
|
|
446
|
+
| cost | the page's cost per frame, measured on each quality preset |
|
|
371
447
|
| allocation | the bytes per frame that the add-on's own code allocates, on each quality preset |
|
|
372
448
|
|
|
373
449
|
The shader and size gates build the add-on with the Vite and the null3D plugin that it installs. The page gates take the page of the first test in `null3d.json`, or the page that `--page` names. The page gates are skipped when there is no page.
|
|
@@ -378,13 +454,21 @@ The shader and size gates build the add-on with the Vite and the null3D plugin t
|
|
|
378
454
|
| `--skip-browser` | Runs no gate that opens a browser | The page gates run |
|
|
379
455
|
| `--skip-cost` | Leaves out the cost gate alone, for a machine whose load would show in the figures. The page and allocation gates still run | The cost gate runs |
|
|
380
456
|
|
|
381
|
-
Each page gate draws as `bench` does: with Chrome on the computer's GPU, or with Playwright's Chromium on SwiftShader when the CI variable is set. The cost gate measures the production build on each quality preset. It prints the GPU time per frame where the device times it, and the CPU time otherwise.
|
|
457
|
+
Each page gate draws as `bench` does: with Chrome on the computer's GPU, or with Playwright's Chromium on SwiftShader when the CI variable is set. The cost gate measures the production build on each quality preset. Like `bench`, it waits for the first frame and the end of the preset check before it measures. It prints the GPU time per frame where the device times it, and the CPU time otherwise.
|
|
382
458
|
|
|
383
|
-
The allocation gate samples the heaps of the page's sketch and render workers. It names each function by the source file that the build's map gives it. It prints the bytes per frame that the add-on's own code allocated on each preset, and the page's own figure beside it. A source file counts as the add-on's own when the file is in its folder, or in its copy under `node_modules`.
|
|
459
|
+
The allocation gate samples the heaps of the page's sketch and render workers. It names each function by the source file that the build's map gives it. It prints the bytes per frame that the add-on's own code allocated on each preset, and the page's own figure beside it. A source file counts as the add-on's own when the file is in its folder, or in its copy under `node_modules`.
|
|
460
|
+
|
|
461
|
+
The gate fails when it cannot measure the page, such as on a page that runs no engine worker. It also fails when the page ran none of the add-on's own code, because then it measured other code. It never fails on a figure. The gate holds at most 250,000 sampled objects for each worker in each sample, and samples a page that allocates faster less finely.
|
|
462
|
+
|
|
463
|
+
On the software GPU, the page's animation frames outrun the engine's drawn frames, so the figure there is lower than on a real GPU.
|
|
384
464
|
|
|
385
465
|
## assets
|
|
386
466
|
|
|
387
|
-
`assets optimize` makes glTF models smaller and faster to load and draw. It merges equal meshes, materials and textures into one copy. It stores each mesh's vertices as 8-bit and 16-bit integers, in the order that the GPU reads them fastest. It stores each animation clip at the rate of keys that the engine keeps, so the engine copies the keys at load. It encodes each texture as a KTX2 file with every mip level.
|
|
467
|
+
`assets optimize` makes glTF models smaller and faster to load and draw. It merges equal meshes, materials and textures into one copy. It stores each mesh's vertices as 8-bit and 16-bit integers, in the order that the GPU reads them fastest. It stores each animation clip at the rate of keys that the engine keeps, so the engine copies the keys at load. It encodes each texture as a KTX2 file with every mip level.
|
|
468
|
+
|
|
469
|
+
Each model becomes one `.glb` file in the output folder, with its textures in a `textures` folder beside it. It prints a budget report for each model, which ends with the shader features and permutation bits the model needs.
|
|
470
|
+
|
|
471
|
+
The report also gives the pipeline keys they make and each preset whose texture memory budget the model's textures pass. The shader list goes into the model too, so the engine downloads those shader files as it loads the model.
|
|
388
472
|
|
|
389
473
|
```sh
|
|
390
474
|
bunx @null3d/cli assets optimize models/ public/models/ --lod --max-texture-size 1024
|
|
@@ -451,7 +535,7 @@ bunx @null3d/cli assets pack-orm textures/brick_orm.ktx2 --occlusion brick_ao.pn
|
|
|
451
535
|
| `--metalness <image>` | The metalness map | Black |
|
|
452
536
|
| `--max-texture-size <pixels>` | The largest side of a `.ktx2` texture: a power of two up to 2048 | 2048 |
|
|
453
537
|
|
|
454
|
-
`assets normal-from-bump` makes a normal map from a height map, such as a
|
|
538
|
+
`assets normal-from-bump` makes a normal map from a height map, such as a bump map.
|
|
455
539
|
|
|
456
540
|
```sh
|
|
457
541
|
bunx @null3d/cli assets normal-from-bump textures/stone_bump.png textures/stone_normal.ktx2 --scale 2
|
|
@@ -459,12 +543,78 @@ bunx @null3d/cli assets normal-from-bump textures/stone_bump.png textures/stone_
|
|
|
459
543
|
|
|
460
544
|
| Option | Effect | Without it |
|
|
461
545
|
| --- | --- | --- |
|
|
462
|
-
| `--scale <number>` | The strength of the slopes, as
|
|
546
|
+
| `--scale <number>` | The strength of the slopes, as the standard material's [`bumpScale`](../api/materials.md) | 1 |
|
|
463
547
|
| `--clamp` | The map does not tile, so the edge texels take no neighbors from the opposite edge | The map tiles |
|
|
464
548
|
| `--max-texture-size <pixels>` | The largest side of a `.ktx2` texture: a power of two up to 2048 | 2048 |
|
|
465
549
|
|
|
466
550
|
Both exit with 1 when an image cannot be read. [The asset pipeline](../guides/assets-pipeline.md#pack-occlusion-roughness-and-metalness) says what each makes.
|
|
467
551
|
|
|
552
|
+
`assets impostor` bakes a model's impostor atlases ahead of time, for the cards of [`@null3d/impostors`](../api/impostors.md). It draws every mesh of the model's scene from each cell of an octahedral grid. It uses the add-on's own bake, so the atlases match a bake in the sketch texel for texel.
|
|
553
|
+
|
|
554
|
+
```sh
|
|
555
|
+
bunx @null3d/cli assets impostor models/pine.glb --out public/trees --views 25 --texels 64
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
| Option | Effect | Without it |
|
|
559
|
+
| --- | --- | --- |
|
|
560
|
+
| `--out <folder>` | The folder for the three files | The model's folder |
|
|
561
|
+
| `--views <count>` | The fewest views in the grid: the command takes the squarest grid that holds them | 25, a five by five grid |
|
|
562
|
+
| `--texels <count>` | The texels on each side of a cell | 64 |
|
|
563
|
+
|
|
564
|
+
It writes three files, named after the model. `pine-impostor.json` describes the bake: its grid, the card's size, its room and its depth. The image `pine-impostor-color.png` holds the color atlas in sRGB. The image `pine-impostor-surface.png` holds the normals, the depth and the coverage. Each image is upright: its top left cell is the grid's first cell. In the sketch, the add-on's `loadImpostorAtlas` loads the three files ([Impostors](../api/impostors.md#load-a-baked-atlas)).
|
|
565
|
+
|
|
566
|
+
The bake reads each material's base color factor and texture, its alpha mode and cutoff, and whether it draws both sides. A base color texture must be a PNG or JPEG image. So bake the source model, not a model that `assets optimize` wrote with KTX2 textures. The command draws triangle lists alone, and leaves out points and lines. An atlas holds at most 4,096 texels on a side. It exits with 1 when the model cannot be read or baked.
|
|
567
|
+
|
|
568
|
+
## shaders record
|
|
569
|
+
|
|
570
|
+
```mermaid
|
|
571
|
+
flowchart LR
|
|
572
|
+
record["bunx @null3d/cli<br/>shaders record"] --> pages["Each page with<br/>?permutations=record:<br/>held at low and high,<br/>and live, on both GPU paths"]
|
|
573
|
+
pages --> list["shader-permutations.txt:<br/>one word on each line"]
|
|
574
|
+
list --> plugin["null3d({ shaders:<br/>{ list } })"]
|
|
575
|
+
plugin --> build["A production build that<br/>copies only those builds"]
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
`shaders record` writes the list of the shader permutation words that your pages draw with. The Vite plugin's `shaders.list` option names the list, and a production build then copies only the builds of those words. Without a list, a build copies the engine's whole shader set: thousands of files and gigabytes, although a page downloads a few of them. [Build only the shader permutations you draw with](../guides/assets-pipeline.md#build-only-the-shader-permutations-you-draw-with) explains the list.
|
|
579
|
+
|
|
580
|
+
```sh
|
|
581
|
+
bunx @null3d/cli shaders record
|
|
582
|
+
bunx @null3d/cli shaders record --page / --page /level-2.html --live /
|
|
583
|
+
bunx @null3d/cli shaders record --live / --scroll
|
|
584
|
+
bunx @null3d/cli shaders record --base http://localhost:8080 --live /game.html --click "#play"
|
|
585
|
+
bunx @null3d/cli shaders record --manual --gpu webgl2 --preset low
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
| Option | Effect | Without it |
|
|
589
|
+
| --- | --- | --- |
|
|
590
|
+
| `--base <url>` | The address of a server that serves the pages with a development build of the engine | The command starts the project's own Vite dev server in the current folder |
|
|
591
|
+
| `--page <path>` | A page to record in hold mode, at the low and high presets on WebGPU and on WebGL2. Repeat it for each page. A path that names its own `hold=` time keeps it | `/`, when no `--live` page is named either |
|
|
592
|
+
| `--live <path>` | A page to record live on both GPU paths. It draws for five seconds, and the recorder presses every button of its controls HUD. Repeat it for each page | `/`, when no `--page` is named either |
|
|
593
|
+
| `--scroll` | Scrolls each live page down to its end, one window's height at a time. After each step it waits until the page has asked for nothing for half a second, at least one second and at most fifteen | The live pages stay at their top |
|
|
594
|
+
| `--click <selector>` | An element to press after each page loads, for a page whose engine starts on a click | No element is pressed |
|
|
595
|
+
| `--extra <words>` | Words to add by hand, as hexadecimal numbers joined by commas, such as `0x10,0x14` | Only the recorded words |
|
|
596
|
+
| `--out <file>` | The list to write | `shader-permutations.txt` |
|
|
597
|
+
| `--replace` | Writes the run's words alone | The words join those that the list holds |
|
|
598
|
+
| `--manual` | Opens the `--live` page, or `/`, in a browser window for you to play through. Enter saves its words, and Ctrl-C asks before it discards them | The pages load headless and the recorder drives them |
|
|
599
|
+
| `--gpu <path>` | With `--manual`: `webgpu` or `webgl2` | The engine picks the GPU path |
|
|
600
|
+
| `--preset <name>` | With `--manual`: `low`, `medium`, `high` or `ultra` | The engine picks the preset |
|
|
601
|
+
|
|
602
|
+
The command loads up to four pages at once in a headless browser, each with the engine's recording switch, `?permutations=record`. A held page publishes its words once its held frame has drawn. The recorder stops a live page once it has driven it through its states, and then the page publishes its words.
|
|
603
|
+
|
|
604
|
+
A page that fails gets a second try. A second failure stops the run with the page's errors, so no list leaves out a page's words. The run's words join those that the list holds already. So each level or mode can be recorded in a run of its own into one list. The list holds each word once, in order:
|
|
605
|
+
|
|
606
|
+
```text
|
|
607
|
+
# The permutation words that this project draws with, one hexadecimal word on each line.
|
|
608
|
+
# Written by bunx @null3d/cli shaders record. A word added by hand keeps the run working
|
|
609
|
+
# where a path cannot be recorded.
|
|
610
|
+
0x00000000
|
|
611
|
+
0x00000020
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
With `--manual`, the command opens one page in a window on your screen. Play through its menus, settings and levels, then press Enter in the terminal. Run it on both GPU paths at the low and high presets, as the automatic run records them. A reload starts a new recording, so record each page in a run of its own. A project's browser tests can write the list too, with `saveRecordedWords` from `@null3d/cli/shaders`, as [Record from your browser tests](../guides/assets-pipeline.md#record-from-your-browser-tests) shows.
|
|
615
|
+
|
|
616
|
+
A production build ignores the recording switch, so a page that `--base` names must come from a development build: the dev server, or `vite build --mode development`. The plugin's `urlSwitches` option also lets a production build read it. Record again after the project gains a feature that draws with a new word. A build whose list lacks a word stops the pipeline that needs it, with a message that names the word.
|
|
617
|
+
|
|
468
618
|
## upgrade
|
|
469
619
|
|
|
470
620
|
```mermaid
|
|
@@ -503,7 +653,7 @@ Run it after you upgrade the engine alone, or when a page stops with [E1432](../
|
|
|
503
653
|
|
|
504
654
|
## Where the commands draw
|
|
505
655
|
|
|
506
|
-
`shot`, `test` and `
|
|
656
|
+
`shot`, `test`, `bench`, `check-addon` and `shaders record` draw with Chrome for Testing on your computer's GPU. So does `mcp`, unless `--connect` drives your own Chrome. When the `CI` variable is set, they draw with Playwright's Chromium on SwiftShader, a GPU in software. Most CI machines have no GPU. Set `CI=1` to draw the software GPU's images on your own computer:
|
|
507
657
|
|
|
508
658
|
```sh
|
|
509
659
|
CI=1 bunx @null3d/cli shot --out ci-shot.png
|
|
@@ -517,7 +667,7 @@ The two draw the edges of objects a little differently, so keep reference images
|
|
|
517
667
|
Chrome for Testing is Google's build of Chrome for automated runs. The tool pins one version of it on every platform. So a reference image drawn on one computer matches another's. A release of the tool may move the pin to a newer Chrome, and its notes say so when pages draw differently.
|
|
518
668
|
|
|
519
669
|
- **First use.** The first command that draws downloads the pinned build for your platform, about 200 MB. It prints what it downloads and how far it has got. Later commands reuse it.
|
|
520
|
-
- **The check.** The tool records the SHA-256 hash of the pinned build's archive on each platform. It checks the download against that hash before it unpacks it. An archive with another hash is deleted, and the
|
|
670
|
+
- **The check.** The tool records the SHA-256 hash of the pinned build's archive on each platform. It checks the download against that hash before it unpacks it. An archive with another hash is deleted, and the tool installs nothing ([E1437](../errors/E1437.md)). The command then falls back, as the next items say. The tool keeps the hash it checked beside the build, and it trusts a cached build only with that record.
|
|
521
671
|
- **Where it lives.** `null3d/chrome-for-testing/<version>` under `$XDG_CACHE_HOME` when that is set, or under `~/.cache`. Every project on the computer shares it. Delete the folder to download it again.
|
|
522
672
|
- **Why not Google Chrome.** On macOS, Google Chrome makes keys in the keychain each time it starts. It keeps them when it closes early, as a headless run often does. Many runs fill the keychain and slow its service down. Chrome for Testing has no access to the keychain.
|
|
523
673
|
- **When the download fails.** This includes a download whose hash does not match. The command draws with your installed Google Chrome instead. It warns that this may leave keys in the keychain on macOS. Its pictures can differ a little from the references when its version differs.
|