@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
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: getting-started/network-use
|
|
3
3
|
title: Network use
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.2"
|
|
6
4
|
summary: "What null3D downloads, when each file loads, the build's one download, and how to keep a page on its own origin."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Network use
|
|
10
8
|
|
|
11
|
-
> Roadmap step 0.2, first released in null3D 0.1.0. The API is experimental, so it can still change between versions.
|
|
12
|
-
|
|
13
9
|
null3D sends nothing to any server of its own. The engine and its add-ons have no telemetry, no analytics, no crash reporting and no update check. Every request they make is for a file that the page names, or a file that the build produced.
|
|
14
10
|
|
|
15
11
|
## What the engine downloads
|
|
16
12
|
|
|
17
|
-
The engine downloads its own files from the address where the page serves them. That address is the page's own origin, or a CDN that the page names. [Hosting](hosting.md#the-engines-files-on-a-cdn) covers the CDN case.
|
|
13
|
+
The engine downloads its own files from the address where the page serves them. That address is the page's own origin, or a CDN that the page names. [Hosting](hosting.md#the-engines-files-on-a-cdn) covers the CDN case.
|
|
18
14
|
|
|
19
15
|
| File | When it loads |
|
|
20
16
|
| --- | --- |
|
|
@@ -25,21 +21,25 @@ The engine downloads its own files from the address where the page serves them.
|
|
|
25
21
|
| The area light tables | On the first rectangle or tube light |
|
|
26
22
|
| A feature's first-use code module, such as a decoder's wrapper or a pass's setup | On the first use of that feature |
|
|
27
23
|
|
|
28
|
-
The table names what the engine ships. A feature may have both a shader module and a code module, and each loads at its own first use
|
|
24
|
+
The table names what the engine ships. A feature may have both a shader module and a code module, and each loads at its own first use. A page that never uses the feature downloads neither.
|
|
29
25
|
|
|
30
26
|
The engine builds each address with `new URL(..., import.meta.url)`. The bundler then ships that file beside the engine's code.
|
|
31
27
|
|
|
32
28
|
A repeat visit downloads less. The HTTP cache keeps the build's files, and the engine's cache of derived data keeps what it made from them, such as transcoded textures, in the browser's own storage. [Caches between visits](hosting.md#caches-between-visits) shows each cache.
|
|
33
29
|
|
|
30
|
+
The `preload` option of `createEngine` moves a feature's shader download to before the first frame, for a game that must fetch nothing while it plays.
|
|
31
|
+
|
|
34
32
|
The vendored decoders hold a download path of their own, and the engine never uses it. The engine hands each decoder its compiled WebAssembly, so a page can block every other origin.
|
|
35
33
|
|
|
36
34
|
## What your own code downloads
|
|
37
35
|
|
|
38
36
|
The engine downloads only the addresses that you give it:
|
|
39
37
|
|
|
40
|
-
- `assets.loadTexture`, `assets.loadGltf`, `assets.loadBinary`, `assets.loadJson` and `assets.
|
|
38
|
+
- `assets.loadTexture`, `assets.loadGltf`, `assets.loadBinary`, `assets.loadJson`, `assets.loadImageBitmap` and `assets.preload` download the addresses that you pass.
|
|
41
39
|
- A glTF file names more addresses inside it, for its buffers, images and extensions. The engine downloads those too. They may be on another origin, which must allow the page to read them.
|
|
42
|
-
-
|
|
40
|
+
- A page that replays a recording ([Record a session that went wrong](../guides/testing.md#record-a-session-that-went-wrong)) downloads that file from the address that the page gives. It uses no other address for it.
|
|
41
|
+
- The `downloads` option of `defineSketch` downloads the files that it names, as soon as the sketch's module has loaded. In [hold mode](../guides/testing.md#hold-mode), and while the engine records or replays a session, each file downloads only when the setup loads it. So every run stays the same.
|
|
42
|
+
- `@null3d/sound` downloads the sound files that the sketch names, each once, when the sound starts. It downloads its own mixer module, about 17 KB, from beside its code at the same time. So the files do not wait for the mixer.
|
|
43
43
|
- `@null3d/splats` downloads the SPZ file that you pass. A streamed cloud is fetched as its index and then only the chunk files that the view asks for, so a large cloud appears without the whole file. No other address is contacted.
|
|
44
44
|
|
|
45
45
|
A demo that loads a model makes these same calls. The file's address is the demo's choice.
|
|
@@ -50,31 +50,49 @@ A service worker can keep these files for a later visit. [Hosting](hosting.md#of
|
|
|
50
50
|
|
|
51
51
|
The Vite plugin needs the engine's compiled shader modules to build a page. It looks for them in this order:
|
|
52
52
|
|
|
53
|
-
1. The folder that the `NULL3D_ENGINE_SHADERS` setting names.
|
|
53
|
+
1. The folder that the `NULL3D_ENGINE_SHADERS` setting names. It must hold the engine's generated shader modules, including `shaders.ts`. With it set, the build makes no request.
|
|
54
54
|
2. A release file of the engine's GitHub repository. The plugin checks its SHA-256 hash against the value in the engine package.
|
|
55
55
|
3. The engine's own sources, built on the spot. This takes longer and needs no network.
|
|
56
56
|
|
|
57
57
|
So a build contacts GitHub only when `NULL3D_ENGINE_SHADERS` is unset and the cache holds no copy. The build machine makes that request, and a page never makes it.
|
|
58
58
|
|
|
59
|
-
The release asset holds the full set of shader modules. A
|
|
59
|
+
The release asset holds the full set of shader modules, which is thousands of files and gigabytes. A page downloads only the few that its device needs. A build without a list of permutation words copies every module into its output, and it warns with the size that it copied. A build with a list copies only the builds of the listed words, and downloads and compiles nothing more. [Build only the shader permutations you draw with](../guides/assets-pipeline.md#build-only-the-shader-permutations-you-draw-with) shows how to record the list.
|
|
60
60
|
|
|
61
61
|
In development, Vite keeps its own connection to the local dev server, for hot reload. That connection belongs to Vite, and it goes to the dev server, not to another server.
|
|
62
62
|
|
|
63
|
-
##
|
|
63
|
+
## The command-line tool
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
`bunx @null3d/cli` contacts no server of its own. It serves the page from a server on the same machine, and it drives a browser on that machine, unless you give `mcp` other addresses. When Playwright's browser is missing, the tool prints the command that installs it. You run that command yourself.
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
To draw on your computer's GPU, the tool uses one pinned version of Chrome for Testing. It downloads it once, from Google's Chrome for Testing releases on `storage.googleapis.com`, and checks its SHA-256 hash before it unpacks it. The tool makes no other request to that host, and a page never makes it.
|
|
68
|
+
|
|
69
|
+
| Case | What the tool downloads |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| First command that draws on the GPU | Chrome for Testing, once, hash checked |
|
|
72
|
+
| Hash does not match | The archive is deleted and nothing is installed ([E1437](../errors/E1437.md)). The command draws with the installed Google Chrome, or stops when `NULL3D_CHROME=testing` is set |
|
|
73
|
+
| `CI` is set | Nothing; it draws on the software GPU |
|
|
74
|
+
| `NULL3D_CHROME=installed` | Nothing; it draws with the installed Google Chrome |
|
|
75
|
+
| `mcp --connect` | Nothing; it starts no browser |
|
|
76
|
+
|
|
77
|
+
<details>
|
|
78
|
+
<summary>Technical details: the cache folder</summary>
|
|
68
79
|
|
|
69
|
-
|
|
80
|
+
The tool keeps the checked build in a cache folder that every project on the computer shares, with the hash that it checked. A copy in that folder without that record downloads again. The [command-line tool's page](../cli/null3d.md#chrome-for-testing) says where the folder is.
|
|
70
81
|
|
|
71
|
-
|
|
82
|
+
</details>
|
|
72
83
|
|
|
73
84
|
`check-addon` reads the allocations of an add-on's own code by asking the browser it started for a
|
|
74
85
|
heap profile. That browser listens on a loopback address on this machine, and the tool talks to it
|
|
75
86
|
over that address and its debugging socket. Nothing leaves the machine, and no address is a server
|
|
76
87
|
the tool chooses.
|
|
77
88
|
|
|
89
|
+
The `mcp` command talks to the agent over its standard input and output. By default it serves the page and drives the browser on this machine, as `shot` does.
|
|
90
|
+
|
|
91
|
+
- `--url` opens the dev server at the address that you give.
|
|
92
|
+
- `--connect` attaches to the Chrome debugging endpoint at the address that you give, and starts no browser, so it downloads no Chrome.
|
|
93
|
+
|
|
94
|
+
Either address may be on another machine. The command contacts no other address of its own choice.
|
|
95
|
+
|
|
78
96
|
A command that builds the page also runs the build's one download, the engine's generated shader modules, as the section above says. Set `NULL3D_ENGINE_SHADERS` on that command to keep the tool's whole run off every network.
|
|
79
97
|
|
|
80
98
|
## Check the claim
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: getting-started/project-structure
|
|
3
3
|
title: Project structure
|
|
4
|
-
|
|
5
|
-
since: "0.3"
|
|
6
|
-
summary: "Starting from the `empty` template with `bunx @null3d/cli create`; page.ts, sketch.ts, AGENTS.md and the agent hook; what runs where."
|
|
4
|
+
summary: "Starting from the `empty`, `product` or `game` template with `bunx @null3d/cli create`; page.ts, sketch.ts, AGENTS.md and the agent hook; what runs where."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Project structure
|
|
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. The `empty` template is the only template today.
|
|
12
|
-
|
|
13
9
|
```mermaid
|
|
14
10
|
flowchart LR
|
|
15
11
|
create["bunx @null3d/cli create"] --> project["my-game/"]
|
|
@@ -20,12 +16,20 @@ flowchart LR
|
|
|
20
16
|
sketch -- "scene data" --> draw["Render worker<br/>draws the canvas"]
|
|
21
17
|
```
|
|
22
18
|
|
|
23
|
-
`bunx @null3d/cli create` writes a new project from a template. Start with the
|
|
19
|
+
`bunx @null3d/cli create` writes a new project from a template. Start with the template closest to your app, then change its scene.
|
|
20
|
+
|
|
21
|
+
| Template | What its scene shows |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `empty` | A cube that turns, lit by a directional light and an ambient light. It is the smallest project, for a scene of your own. |
|
|
24
|
+
| `product` | A product viewer: shapes from `@null3d/geometry` with glazed, metal, wood and cloth materials on a turntable. A soft room light, shadows on a shadow catcher, the Neutral tone curve, and orbit controls with damping and limits. |
|
|
25
|
+
| `game` | A small game: a player that keys, a gamepad or a dragged finger moves, gems to pick up, rocks in instance batches, a follow camera and a score on the page. |
|
|
26
|
+
|
|
27
|
+
Each template holds the same project files, which the next sections list. The `product` template also pins `@null3d/controls` and `@null3d/geometry`.
|
|
24
28
|
|
|
25
29
|
## Make a project
|
|
26
30
|
|
|
27
31
|
```sh
|
|
28
|
-
bunx @null3d/cli create my-game
|
|
32
|
+
bunx @null3d/cli create my-game --template game
|
|
29
33
|
cd my-game
|
|
30
34
|
bun install
|
|
31
35
|
bunx vite
|
|
@@ -35,7 +39,7 @@ bunx vite
|
|
|
35
39
|
|
|
36
40
|
| Option | Effect | Without it |
|
|
37
41
|
| --- | --- | --- |
|
|
38
|
-
| `--template <name>` | The template to copy | `empty` |
|
|
42
|
+
| `--template <name>` | The template to copy: `empty`, `product` or `game` | `empty` |
|
|
39
43
|
|
|
40
44
|
The folder must not exist, or it must be empty. A folder with files stays as it is, and the command stops.
|
|
41
45
|
|
|
@@ -49,6 +53,7 @@ The folder must not exist, or it must be empty. A folder with files stays as it
|
|
|
49
53
|
| `vite.config.ts` | Vite with the null3D plugin, which sends the headers that the workers need. |
|
|
50
54
|
| `tsconfig.json` | The TypeScript settings that `bunx @null3d/cli test` checks the project with. |
|
|
51
55
|
| `package.json` | The project's name, scripts and packages. Every `@null3d/*` package takes one version. |
|
|
56
|
+
| `.gitignore` | The folders that git skips: `node_modules/`, `dist/`, `test-results/` and `.vite/`. |
|
|
52
57
|
| `AGENTS.md` | The rules for an AI agent that works in the project. |
|
|
53
58
|
| `.agent/agent-hook.mjs` | The hook that checks the rules before each command and each edit. |
|
|
54
59
|
| `.claude/settings.json` | The Claude Code settings that run the hook. |
|
|
@@ -58,12 +63,28 @@ The folder must not exist, or it must be empty. A folder with files stays as it
|
|
|
58
63
|
|
|
59
64
|
## The agent files
|
|
60
65
|
|
|
61
|
-
`AGENTS.md` names the installed null3D version and the `null3d-develop` skill. The
|
|
66
|
+
`AGENTS.md` names the installed null3D version and the `null3d-develop` skill. The template holds no copy of the skill. [Working with AI agents](../guides/agents.md) shows how to install it: as a Claude Code plugin, with `bunx skills add`, or by a copy of its folder. When the project has `.claude/skills/null3d-develop/SKILL.md`, an agent reads that file. Otherwise the agent reads the engine docs in `node_modules/@null3d/engine/docs/`, which match the installed version.
|
|
62
67
|
|
|
63
68
|
Claude Code runs the hook through `.claude/settings.json`, and Codex runs it through `.codex/hooks.json`. Both run the same file, `.agent/agent-hook.mjs`. Codex runs the hooks of a folder that you trust.
|
|
64
69
|
|
|
65
|
-
The hook
|
|
70
|
+
The hook is optional. To stop its checks, delete its entries in `.claude/settings.json` and `.codex/hooks.json`.
|
|
71
|
+
|
|
72
|
+
The hook refuses some commands so that they do not run. It flags some source rules and lets the edit go on.
|
|
73
|
+
|
|
74
|
+
| Rule | What the hook does | What the message gives |
|
|
75
|
+
| --- | --- | --- |
|
|
76
|
+
| A command that waits with `sleep` | Refuses the command | The fix |
|
|
77
|
+
| A command that stops a process by name | Refuses the command | The fix |
|
|
78
|
+
| A command that follows a log | Refuses the command | The fix |
|
|
79
|
+
| An object, array or string made in `onUpdate` | Flags it; the edit goes on | The file, the line and the fix |
|
|
80
|
+
| A DOM name in the sketch module | Flags it; the edit goes on | The file, the line and the fix |
|
|
81
|
+
| An import of a name that the installed engine does not export | Flags it; the edit goes on | The file, the line and the fix |
|
|
82
|
+
|
|
83
|
+
The hook reads its rules from the installed packages, which `bun install` writes. Before that install, the hook cannot check a call. It tells the agent to install the packages, and the call goes on.
|
|
84
|
+
|
|
85
|
+
<details>
|
|
86
|
+
<summary>Technical details: where the hook's rules come from</summary>
|
|
66
87
|
|
|
67
|
-
The hook
|
|
88
|
+
The hook takes every rule from `@null3d/cli/agent-rules`. That module holds each rule and its message once, so a project and any other null3D tool agree.
|
|
68
89
|
|
|
69
|
-
|
|
90
|
+
</details>
|
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: getting-started/third-party-notices
|
|
3
3
|
title: Third-party notices
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.2"
|
|
6
4
|
summary: "The third-party code in each null3D package, with its version and license, and the notices file that a build writes beside the page."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Third-party notices
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Some null3D packages ship code from other projects, as the original file or as a port of it. Each license asks a copy to carry its notice, so every such package ships a `THIRD-PARTY-NOTICES.txt` file with the full text.
|
|
9
|
+
Some null3D packages ship code from other projects, as the original file or as a port of it. Each license asks a copy to carry its notice, so every such package ships a `THIRD-PARTY-NOTICES.txt` file with the full text. A production build with the Vite plugin collects these notices into `null3d-third-party-notices.txt` beside the page. Keep that file with the build when you publish it, or show its text in your game's credits ([Hosting](hosting.md#publish-the-third-party-notices)).
|
|
14
10
|
|
|
15
11
|
## Each package
|
|
16
12
|
|
|
17
13
|
| Package | Third-party code | License | Where | Notices |
|
|
18
14
|
| --- | --- | --- | --- | --- |
|
|
19
|
-
| `@null3d/engine` |
|
|
20
|
-
| `@null3d/cli` | Basis Universal
|
|
21
|
-
| `@null3d/vite-plugin` | naga
|
|
15
|
+
| `@null3d/engine` | 13 projects, among them Basis Universal, Draco, meshoptimizer and three.js. See [The engine](#the-engine). | Apache License 2.0, BSD 3-Clause and MIT | `vendor/`, the shader modules, `panorama-worker.js`, `dist/wasm` | `THIRD-PARTY-NOTICES.txt` |
|
|
16
|
+
| `@null3d/cli` | Basis Universal, ufbx, three.js and the asset module's crates. See [The tools](#the-tools). | Apache License 2.0, BSD 3-Clause and MIT | `vendor/`, `dist/assets.wasm` | `THIRD-PARTY-NOTICES.txt` |
|
|
17
|
+
| `@null3d/vite-plugin` | naga, naga_oil and the shader compiler's crates, and the engine shaders it embeds. See [The tools](#the-tools). | MIT, Apache License 2.0, BSD 3-Clause and Zlib | `dist/shader-compiler.wasm` | `THIRD-PARTY-NOTICES.txt` |
|
|
22
18
|
| `@null3d/controls` | three.js 0.186.1, the math and the option names of its controls | MIT | `lib/index.js` | `THIRD-PARTY-NOTICES.txt` |
|
|
23
19
|
| `@null3d/geometry` | three.js 0.186.1, its generators, curves, paths and shapes; earcut 3.0.2 | MIT and ISC | `lib/index.js` | `THIRD-PARTY-NOTICES.txt` |
|
|
24
20
|
| `@null3d/three-compat` | three.js 0.186.1, its tone curves and its outline pass | MIT | `lib/index.js` | `THIRD-PARTY-NOTICES.txt` |
|
|
25
21
|
| `@null3d/grass` | None, its own code | None | `lib/index.js` | None |
|
|
26
22
|
| `@null3d/impostors` | None, its own code | None | `lib/index.js` | None |
|
|
27
23
|
| `@null3d/particles` | None, its own code | None | `lib/index.js` | None |
|
|
28
|
-
| `@null3d/
|
|
29
|
-
| `@null3d/
|
|
24
|
+
| `@null3d/sound` | The Rust core library and libm 0.2.16 in its mixer, beside its own code | MIT | `dist/sound.wasm` | `THIRD-PARTY-NOTICES.txt` |
|
|
25
|
+
| `@null3d/splats` | The Rust core library and libm 0.2.16 in its selection, beside its own code, which reads Niantic's published SPZ format | MIT | `dist/splats.wasm` | `THIRD-PARTY-NOTICES.txt` |
|
|
26
|
+
| `@null3d/terrain` | The Rust core library and libm 0.2.16 in its builder, beside its own code | MIT | `dist/terrain.wasm` | `THIRD-PARTY-NOTICES.txt` |
|
|
30
27
|
| `@null3d/water` | None, its own code | None | `lib/index.js` | None |
|
|
31
|
-
| `@null3d/wind` |
|
|
28
|
+
| `@null3d/wind` | The Rust standard library in its field module, beside its own code | MIT | `dist/wind.wasm` | `THIRD-PARTY-NOTICES.txt` |
|
|
32
29
|
|
|
33
30
|
The null3D packages themselves are offered under the MIT License or the Apache License 2.0. A production build writes the notices of every package that a page ships into `null3d-third-party-notices.txt`.
|
|
34
31
|
|
|
@@ -49,8 +46,8 @@ The null3D packages themselves are offered under the MIT License or the Apache L
|
|
|
49
46
|
| Qualcomm Snapdragon GSR 1: the render-scale upscale | BSD 3-Clause | the shader library |
|
|
50
47
|
| TinyEXR and OpenEXR, whose code the EXR decoders follow | BSD 3-Clause | `panorama-worker.js` |
|
|
51
48
|
| Linearly transformed cosines, the area light tables | BSD 3-Clause | `vendor/ltc` |
|
|
52
|
-
| SMAA, the
|
|
53
|
-
| The Rust crates of the core: the standard library, wasm-bindgen,
|
|
49
|
+
| SMAA 1x, the anti-aliasing of the optional [moment transparency layer](../api/materials.md#moment-transparency) | MIT | the renderer's moment layer tables and shaders |
|
|
50
|
+
| The Rust crates of the core: the standard library, wasm-bindgen, cfg-if, once_cell and dlmalloc | MIT or Apache License 2.0 | `dist/wasm` |
|
|
54
51
|
|
|
55
52
|
The full texts are in the engine's `THIRD-PARTY-NOTICES.txt`.
|
|
56
53
|
|
|
@@ -80,6 +77,7 @@ The command-line tool and the Vite plugin put no code in a page. Their packages
|
|
|
80
77
|
| The engine shaders in the module: KinoBokeh and Unity's post-processing stack v1 | MIT |
|
|
81
78
|
| The engine shaders in the module: AMD FidelityFX FSR 1's RCAS and SSSR's ray march | MIT |
|
|
82
79
|
| The engine shaders in the module: Qualcomm Snapdragon GSR 1 | BSD 3-Clause |
|
|
80
|
+
| The engine shaders in the module: SMAA 1x's three steps | MIT |
|
|
83
81
|
|
|
84
82
|
## The example add-ons
|
|
85
83
|
|
|
@@ -89,4 +87,4 @@ The command-line tool and the Vite plugin put no code in a page. Their packages
|
|
|
89
87
|
|
|
90
88
|
Each package's `THIRD-PARTY-NOTICES.txt` holds the full text. The engine's copy is also at `node_modules/@null3d/engine/THIRD-PARTY-NOTICES.txt` after an install.
|
|
91
89
|
|
|
92
|
-
|
|
90
|
+
The tools' notices stay out of the build's notices file, because a page ships none of their code.
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: guides/accessibility
|
|
3
3
|
title: Accessibility
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.1"
|
|
6
4
|
summary: "What the canvas tells assistive technology; keyboard use; reduced motion; pausing; loading and errors."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Accessibility
|
|
10
8
|
|
|
11
|
-
> Roadmap step 0.1, first released in null3D 0.1.0. The API is experimental, so it can still change between versions.
|
|
12
|
-
|
|
13
9
|
A screen reader sees a canvas as one element. It cannot see the objects drawn inside it. So the HTML around the canvas carries the meaning, and the sketch sends that HTML what it needs through messages.
|
|
14
10
|
|
|
15
11
|
## Tell assistive technology what the canvas is
|
|
@@ -37,6 +33,8 @@ engine.onSketchMessage((type, data) => {
|
|
|
37
33
|
});
|
|
38
34
|
```
|
|
39
35
|
|
|
36
|
+
The [deterministic simulation demo](https://github.com/null3d-engine/null3d/tree/main/examples/replay) writes a status line with `aria-live="polite"` as the user plays.
|
|
37
|
+
|
|
40
38
|
## Keyboard
|
|
41
39
|
|
|
42
40
|
The engine reads key presses from the whole window. It leaves them to the page while a text field, text area, drop-down list or editable element has focus.
|
|
@@ -45,6 +43,8 @@ The engine reads key presses from the whole window. It leaves them to the page w
|
|
|
45
43
|
- Never trap focus. The Tab key must always move on to the rest of the page.
|
|
46
44
|
- A canvas the user operates can take focus with `tabindex="0"`. Give it a visible focus outline.
|
|
47
45
|
|
|
46
|
+
The [input demo](https://github.com/null3d-engine/null3d/tree/main/examples/input) moves its robot with the arrow keys, the WASD keys and a gamepad, and turns the camera with the right stick.
|
|
47
|
+
|
|
48
48
|
## Motion
|
|
49
49
|
|
|
50
50
|
Some users get dizzy or sick from motion on screen, so their system asks every page for less of it. In the sketch, `preferences.reducedMotion` is true while it does. `preferences.onChange` calls a handler at the start of the first frame after the setting changes:
|
|
@@ -82,7 +82,7 @@ Motion that starts by itself and lasts more than five seconds needs a way to sto
|
|
|
82
82
|
|
|
83
83
|
## Loading and errors
|
|
84
84
|
|
|
85
|
-
- Give the loading indicator `role="progressbar"` and set `aria-valuenow` from the load progress.
|
|
85
|
+
- Give the loading indicator `role="progressbar"` and set `aria-valuenow` from the load progress. Within a phase, never let the value move back. When a new phase starts, name it in `aria-valuetext` ([Loading screens](loading-screens.md#show-progress-on-the-page)).
|
|
86
86
|
- Remove the indicator when `engine.firstFrame` resolves, so the user never waits in front of a blank canvas.
|
|
87
87
|
- `createEngine` rejects when the browser cannot run the engine. Show text that says so, and what the user can still do, or an image with a text alternative.
|
|
88
88
|
|
package/docs/guides/add-ons.md
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: guides/add-ons
|
|
3
3
|
title: Building an add-on
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.3"
|
|
6
4
|
summary: "One package with one entry; claim a namespace and the plugin interface range; import only the public entry points; compile the shaders on both paths; name a page; run the check."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Building an add-on
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
An add-on is a package that adds a feature above the engine's public API. It has one install and one import, and it reaches the engine only through the engine's public entry points. The engine's own add-ons work the same way.
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
`bunx @null3d/cli check-addon` runs gates on a folder before a listing publishes it. [The `null3d` command](../cli/null3d.md#check-addon) lists them. The sections on names, entry points, shaders, file sizes and the preset cost each have a gate. The sections on Rust and levels of detail are advice that no gate checks.
|
|
12
|
+
|
|
13
|
+
## Choose a way to add drawing
|
|
14
|
+
|
|
15
|
+
| What you want to draw | The call | Where in the frame it runs | GPU paths | The page |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| A surface's look, with the engine's lighting | a surface function | in the material's draw | both | [Surface functions](../shaders/surface-functions.md) |
|
|
18
|
+
| A material with WGSL of its own from end to end | `materials.shader` | in the object's draw | both | [Custom shaders](custom-shaders.md) |
|
|
19
|
+
| A full-screen effect over the scene color | `post.addEffect` | after the scene passes, before bloom | both | [Custom passes and render targets](custom-passes.md) |
|
|
20
|
+
| A scene drawn from another camera | `render.addPass` with `kind: 'scene'` | before the passes that show its texture | both | [Render graph API](../api/render.md) |
|
|
21
|
+
| A full-screen pass into a texture | `render.addPass` with `kind: 'fullscreen'` | before the passes that read its texture | both | [Render graph API](../api/render.md#full-screen-passes) |
|
|
22
|
+
| A compute pass | `render.addPass` with `kind: 'compute'` | before the passes that read its texture | WebGPU, with a WebGL2 fallback | [Render graph API](../api/render.md#compute-passes) |
|
|
23
|
+
| A draw from a vertex count | `scene.createVertexDraw` | with the scene's draws | both | [Vertex draws](../api/vertex-draws.md) |
|
|
24
|
+
| A draw from a feature | `scene.addFeatureDraw` | with the scene's draws | both | [Feature draws](../api/feature-draws.md) |
|
|
25
|
+
| A full-screen pass from a feature | `post.addFeatureEffect` | after the scene passes | both | [Feature effects](../api/feature-effects.md) |
|
|
26
|
+
| Instances whose count the GPU writes | `scene.addComputeInstances` | with the scene's draws | WebGPU | [Feature instances](../api/feature-instances.md) |
|
|
27
|
+
|
|
28
|
+
Tasks (`runTask`) are the CPU side, not a draw: they run on the job workers ([Tasks on the job workers](../api/tasks.md)).
|
|
14
29
|
|
|
15
30
|
## Claim the add-on's names
|
|
16
31
|
|
|
@@ -30,9 +45,19 @@ declareAddonNamespace({
|
|
|
30
45
|
});
|
|
31
46
|
```
|
|
32
47
|
|
|
33
|
-
The name
|
|
48
|
+
The name rules:
|
|
49
|
+
|
|
50
|
+
- lowercase letters, digits and underscores, starting with a letter;
|
|
51
|
+
- `null3d` belongs to the engine;
|
|
52
|
+
- error codes from 2000 to 9999, with the engine's codes below 2000;
|
|
53
|
+
- a held name, package or code range throws [E1225](../errors/E1225.md);
|
|
54
|
+
- a reload with the same package takes back its namespace.
|
|
55
|
+
|
|
56
|
+
A second add-on that takes a name is refused. [Namespaces](../api/features.md#namespaces) gives the full rules.
|
|
57
|
+
|
|
58
|
+
The plugin interface version changes only when a stable hook changes, so an add-on can span many engine releases. A page whose engine lies outside the declared range stops with [E1433](../errors/E1433.md) before it draws.
|
|
34
59
|
|
|
35
|
-
The
|
|
60
|
+
The message names the add-on, the range and the engine's interface. The version is `PLUGIN_INTERFACE_VERSION` in the engine that the add-on builds against. Widen the range only after the add-on works with the wider interface.
|
|
36
61
|
|
|
37
62
|
The engine's own add-ons leave the range out and pin the engine version exactly with `checkAddonVersion`, because they ship in step with the engine.
|
|
38
63
|
|
|
@@ -52,25 +77,49 @@ Keep setup, options, the public API and event handling in TypeScript. They run o
|
|
|
52
77
|
|
|
53
78
|
An add-on's meshes get levels of detail as a page's meshes do, with no call of the add-on's own. A far copy then draws a few dozen triangles instead of its full mesh. The engine hides a copy that covers less than a pixel.
|
|
54
79
|
|
|
55
|
-
|
|
80
|
+
The engine plans a mesh's levels when it holds 4,096 triangles or more. It plans a smaller mesh when it holds at least 256 and its copies hold 65,536 together. A mesh from `geometry.fromArrays` or a generator plans them at its first draw. The levels keep the mesh's vertex and triangle order, which raycasts and `updateVertices` read ([Levels of detail](../concepts/lod.md#levels-of-meshes-made-in-code)).
|
|
81
|
+
|
|
82
|
+
<details>
|
|
83
|
+
<summary>Technical details: when a mesh plans its levels</summary>
|
|
84
|
+
|
|
85
|
+
The plan runs on the job workers with the asset tool's planner. The levels keep their measured errors, so they switch in at once while the threshold stays small. They fade once the governor raises it past about one and a half pixels.
|
|
86
|
+
|
|
87
|
+
</details>
|
|
56
88
|
|
|
57
89
|
So make every mesh through `fromArrays` or a generator, and leave its `levels` option out. Arrays that a task of the add-on builds on a job worker go to `fromArrays` too, and the mesh then plans as any other. An add-on that returns arrays, such as a shape generator, leaves the mesh, and its levels, to the page.
|
|
58
90
|
|
|
59
|
-
Do not ask for levels mesh by mesh. The default picks the meshes whose levels save GPU time.
|
|
91
|
+
Do not ask for levels mesh by mesh. The default picks the meshes whose levels save GPU time.
|
|
92
|
+
|
|
93
|
+
`levels: true` and `await mesh.buildLevels()` plan at any size. Use `buildLevels()` to plan again after `updateVertices` gives a mesh a new shape, or to await the levels in a test. The one exception is a mesh of separate leaf cards. It asks for `levels: { cards: true }`, so each level thins its cards rather than dropping whole small pieces.
|
|
60
94
|
|
|
61
95
|
Opt a mesh out with `levels: false` only where levels are wrong for it, and say why in a comment beside the mesh:
|
|
62
96
|
|
|
63
97
|
| The mesh | Why it takes no levels | In the engine's add-ons |
|
|
64
98
|
| --- | --- | --- |
|
|
65
|
-
| A shader gives it its shape or its place | The levels would simplify a shape that never draws | Water surfaces, grass tufts, splat parts
|
|
99
|
+
| A shader gives it its shape or its place | The levels would simplify a shape that never draws | Water surfaces, grass tufts, splat parts |
|
|
66
100
|
| It has a level system of its own | The two systems would switch apart | Terrain blocks, which are the ground's quadtree and morph toward their parent block |
|
|
67
101
|
| It is the far stand-in of other meshes | It is already the coarsest level | Impostor cards, merged far cells |
|
|
68
102
|
| It keeps one size on the screen | Its levels would never switch | Gizmo handles |
|
|
69
103
|
| Its vertices change in every frame | The levels would measure a shape that the next frame replaces | None |
|
|
70
104
|
|
|
71
|
-
The engine refuses planned levels by itself in
|
|
105
|
+
The engine refuses planned levels by itself in some cases:
|
|
106
|
+
|
|
107
|
+
- a mesh with joints, morph targets or a vertex record (`targets`);
|
|
108
|
+
- a flat mesh;
|
|
109
|
+
- a mesh that a material with a displacement map or a custom `vertexOffset` draws;
|
|
110
|
+
- the first `updateVertices`;
|
|
111
|
+
- levels that `mesh.setLevels` gives.
|
|
72
112
|
|
|
73
|
-
|
|
113
|
+
A mesh that `mesh.setLevels` gives hand-made levels gets no planned levels on top, such as a generated plant's. Still pass `levels: false` for a mesh of the table, so the code states the decision where the mesh is made.
|
|
114
|
+
|
|
115
|
+
A mesh made in code gets pieces with its planned levels, so an add-on that takes the default gets them with no change. Each copy skips the pieces that the view leaves out or that face away. A mesh with `levels: false` gets none. A large mesh that takes no levels but spans the view, such as a merged far cell, asks for `levels: 'pieces'`, which sorts it into pieces by space alone ([Pieces of a large level](../concepts/lod.md#pieces-of-a-large-level)).
|
|
116
|
+
|
|
117
|
+
<details>
|
|
118
|
+
<summary>Technical details: which meshes get pieces</summary>
|
|
119
|
+
|
|
120
|
+
A smaller mesh that many copies draw, such as a building kit's walls, gets a piece for each way it faces. It gets them even when its levels are set by hand or come from a file that holds it once.
|
|
121
|
+
|
|
122
|
+
</details>
|
|
74
123
|
|
|
75
124
|
## Follow the preset and show the cost
|
|
76
125
|
|
|
@@ -114,11 +163,18 @@ The null3D Vite plugin compiles each `.wgsl` file that the add-on imports, for W
|
|
|
114
163
|
|
|
115
164
|
The engine's start stays small, and so does an add-on's. The files that the add-on loads after the first frame hold to a budget in each of three columns: raw bytes, gzip and Brotli. The check warns about each file that goes over its budget, with each column and its figure. An add-on is a choice, so an over-budget file does not fail the check.
|
|
116
165
|
|
|
117
|
-
A custom material's, a custom effect's and a custom tone curve's compiled builds load on first use
|
|
166
|
+
A custom material's, a custom effect's and a custom tone curve's compiled builds load on first use in files of their own. Those files take the budget for shader builds, which is larger than the budget for code ([Custom shaders](custom-shaders.md#where-the-builds-go)).
|
|
167
|
+
|
|
168
|
+
<details>
|
|
169
|
+
<summary>Technical details: how the size gate counts shader bytes</summary>
|
|
170
|
+
|
|
171
|
+
Not all compiled WGSL leaves the entry, though. A whole shader's or a sky layer's builds sit in the file that imports them, and so do an effect's pieces. The check counts those bytes as shader data, and holds them to the budget for shader builds. A file that holds both therefore answers both budgets.
|
|
172
|
+
|
|
173
|
+
</details>
|
|
118
174
|
|
|
119
175
|
## Name a page
|
|
120
176
|
|
|
121
|
-
The
|
|
177
|
+
The page, cost and allocation gates open a page of the add-on's project in a browser. The check takes the page of the first test in `null3d.json`, or the page that `--page` names:
|
|
122
178
|
|
|
123
179
|
```json
|
|
124
180
|
{ "tests": [{ "name": "demo", "page": "/index.html", "hold": 1.5 }] }
|
|
@@ -129,7 +185,8 @@ Without a page, the browser gates are skipped with a reason, and the other gates
|
|
|
129
185
|
## Run the check
|
|
130
186
|
|
|
131
187
|
```sh
|
|
132
|
-
bunx @null3d/cli check-addon
|
|
188
|
+
bunx @null3d/cli check-addon # the add-on in the current folder
|
|
189
|
+
bunx @null3d/cli check-addon packages/my-addon
|
|
133
190
|
```
|
|
134
191
|
|
|
135
192
|
It prints one line for each gate, and exits with 1 when one fails:
|
|
@@ -149,7 +206,14 @@ Use `--skip-browser` on a machine that has no GPU or no browser. Use `--skip-cos
|
|
|
149
206
|
|
|
150
207
|
The cost figures are measured, and the check prints them; it does not compare them with a number that the add-on claims. The page builds for production, so the figures match what a user gets.
|
|
151
208
|
|
|
152
|
-
The allocation gate counts the bytes that the add-on's own code allocates in each frame, on each quality preset.
|
|
209
|
+
The allocation gate counts the bytes that the add-on's own code allocates in each frame, on each quality preset. Aim at zero, since a frame that allocates feeds the garbage collector. The gate fails only when it cannot measure the add-on's code.
|
|
210
|
+
|
|
211
|
+
<details>
|
|
212
|
+
<summary>Technical details: how the allocation gate measures</summary>
|
|
213
|
+
|
|
214
|
+
It reads the heaps of the page's sketch worker and render worker, and names each function by its source file. A place counts as the add-on's own when its source file is in the add-on's folder, or in the add-on's copy under `node_modules`. The gate prints the page's figure beside it.
|
|
215
|
+
|
|
216
|
+
</details>
|
|
153
217
|
|
|
154
218
|
## Related pages
|
|
155
219
|
|
|
@@ -157,3 +221,10 @@ The allocation gate counts the bytes that the add-on's own code allocates in eac
|
|
|
157
221
|
- [E1433](../errors/E1433.md): the error for an add-on built for another plugin interface.
|
|
158
222
|
- [Custom shaders](custom-shaders.md): the WGSL that an add-on can use.
|
|
159
223
|
- [Custom passes and render targets](custom-passes.md): the engine's public hooks for extra drawing.
|
|
224
|
+
- [Feature descriptions](../api/features.md): one description of the render work.
|
|
225
|
+
- [Feature draws](../api/feature-draws.md): a draw from a feature.
|
|
226
|
+
- [Feature effects](../api/feature-effects.md): a full-screen pass from a feature.
|
|
227
|
+
- [Feature instances](../api/feature-instances.md): instances whose count the GPU writes.
|
|
228
|
+
- [Tasks on the job workers](../api/tasks.md): work on the job workers.
|
|
229
|
+
- [Terrain blocks with their own level system](https://github.com/null3d-engine/null3d/tree/main/examples/terrain): a 1.2 km valley whose far hills draw as coarser blocks.
|
|
230
|
+
- [Impostor cards as far stand-ins](https://github.com/null3d-engine/null3d/tree/main/examples/impostors): a forest whose far trees are cards from an atlas made in code.
|
package/docs/guides/agents.md
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: guides/agents
|
|
3
3
|
title: Working with AI agents
|
|
4
|
-
|
|
5
|
-
since: "0.1"
|
|
6
|
-
summary: "Installing the null3D skills in Claude Code, claude.ai and other agent tools; docs by ID; the test loop; the MCP server and AGENTS.md in templates (0.3)."
|
|
4
|
+
summary: "Installing the null3D skills in Claude Code, claude.ai and other agent tools; docs by ID; the test loop; the MCP server and the in-page inspector."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Working with AI agents
|
|
10
8
|
|
|
11
|
-
> Roadmap step 0.1, first released in null3D 0.1.0. The API is experimental, so it can still change between versions.
|
|
12
|
-
|
|
13
9
|
null3D comes with two agent skills. A skill is a folder of instructions that a coding agent loads when a task needs it.
|
|
14
10
|
|
|
15
11
|
| Skill | What it does |
|
|
@@ -47,7 +43,7 @@ To install by hand, copy each skill's folder from `.claude/skills/` in the relea
|
|
|
47
43
|
|
|
48
44
|
## Docs by ID
|
|
49
45
|
|
|
50
|
-
Every docs page has an ID, such as `concepts/architecture`: its path under `docs/` without `.md`. The skills name pages by ID
|
|
46
|
+
Every docs page has an ID, such as `concepts/architecture`: its path under `docs/` without `.md`. The skills name pages by ID.
|
|
51
47
|
|
|
52
48
|
## The test loop
|
|
53
49
|
|
|
@@ -60,7 +56,18 @@ An agent checks its work with the `null3d` command, which prints short lines of
|
|
|
60
56
|
|
|
61
57
|
`bunx @null3d/cli shot` draws one frame of a page, to look at a change that has no test yet.
|
|
62
58
|
|
|
63
|
-
##
|
|
59
|
+
## The MCP server
|
|
60
|
+
|
|
61
|
+
`bunx @null3d/cli mcp` starts a Model Context Protocol server for the project in the current folder. It runs over stdio, and an agent uses it to look inside the running scene and change it live. The server needs a development build, because a production build leaves the inspection channel out.
|
|
62
|
+
|
|
63
|
+
By default it starts the project's own Vite dev server and a headless Chrome; with `--connect <endpoint>` it drives a Chrome that you already run. [The `mcp` command](../cli/null3d.md#mcp) lists every option and tool.
|
|
64
|
+
|
|
65
|
+
Register the server in Claude Code with:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
claude mcp add null3d -- bunx @null3d/cli mcp
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Live changes are for exploring: the agent writes the final values into the sketch and its tests, and checks them with `bunx @null3d/cli test`.
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
- 0.3: project templates from `bunx @null3d/cli create`, each with an `AGENTS.md` for agents without skills.
|
|
73
|
+
The page also shows a panel of its own with `?inspect`, which lists the scene, selects an object and edits it. [The in-page inspector](debugging.md#the-in-page-inspector) describes it.
|