@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/errors/index.md
CHANGED
|
@@ -1,92 +1,116 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: errors/index
|
|
3
3
|
title: Error codes
|
|
4
|
-
|
|
5
|
-
since: "0.1"
|
|
4
|
+
generated: true
|
|
6
5
|
summary: Every EngineError code with its cause and fix.
|
|
7
6
|
---
|
|
8
7
|
|
|
9
8
|
# Error codes
|
|
10
9
|
|
|
11
|
-
Every error the engine
|
|
10
|
+
Every error the engine reports is an `EngineError` with a code. Its message names the call and the object, says what failed and how to fix it, and links to the code's page here. [Where problems appear](../guides/debugging.md#where-problems-appear) says where each kind of error reaches your code.
|
|
11
|
+
|
|
12
|
+
Codes from E2000 to E9999 belong to add-ons. An add-on's message starts with its name, such as `splats E2101`, and the add-on's page lists its codes: [Gaussian splats](../api/splats.md), [Sound](../api/sound.md).
|
|
13
|
+
|
|
14
|
+
## Objects, handles and engine memory
|
|
12
15
|
|
|
13
16
|
| Code | Error | What happened |
|
|
14
17
|
| --- | --- | --- |
|
|
15
|
-
| [E1101](E1101.md) | Stale handle | A call used an object after
|
|
18
|
+
| [E1101](E1101.md) | Stale handle | A call used an object, instance batch or resource after you destroyed it. The engine reuses the freed slot, but a call through the old handle never changes the object that takes it. |
|
|
16
19
|
| [E1102](E1102.md) | Too many objects | The scene, the table of instance batches or the queue of changes for the next frame is full. The message names which one, and how many it holds. |
|
|
17
20
|
| [E1103](E1103.md) | Object from another engine | A call received an object that this engine did not create. |
|
|
18
21
|
| [E1104](E1104.md) | Parent loop | A call would make an object its own ancestor: the new parent is the object itself or one of its descendants. |
|
|
19
|
-
| [E1105](E1105.md) | Unknown command | The engine core received a structural change it does not know, so the
|
|
22
|
+
| [E1105](E1105.md) | Unknown command | The engine core received a structural change it does not know, so the engine's JavaScript and its core come from different builds. |
|
|
20
23
|
| [E1106](E1106.md) | Object never created | A call such as `setVisible` or `setParent` queued a change for an object that the engine never created. The engine creates an object when the next frame starts. When that fails, for example because its parent was destroyed, the object never joins the scene. |
|
|
21
|
-
| [E1107](E1107.md) | Object created twice | The engine core received a second create command for one object, so the
|
|
24
|
+
| [E1107](E1107.md) | Object created twice | The engine core received a second create command for one object, so the engine's JavaScript and its core disagree about the scene. The core skips that command, and the scene keeps running. |
|
|
22
25
|
| [E1108](E1108.md) | Value out of range | A call received a number outside the range it takes. Examples are a row past the capacity of an instance batch, an opacity above 1, a negative radius, and a camera's far plane that does not lie beyond its near plane. |
|
|
23
|
-
| [E1109](E1109.md) | Engine memory full | The engine could not create or grow its WebAssembly memory. A page with worker threads gives the engine 1 GiB by default, and
|
|
24
|
-
| [E1110](E1110.md) | Unmarked write to a static object | A static object's position, rotation, scale or bounding sphere changed without a setter. The engine
|
|
26
|
+
| [E1109](E1109.md) | Engine memory full | The engine could not create or grow its WebAssembly memory. A page with worker threads gives the engine 1 GiB by default, and the memory option of `createEngine()` can raise it to 4 GiB. Many instance rows, a mesh of millions of vertices, or the first frame that copies every mesh can fill it. |
|
|
27
|
+
| [E1110](E1110.md) | Unmarked write to a static object | A static object's position, rotation, scale or bounding sphere changed without a setter. The engine updates a static object only in a frame where a setter marks it or its parent moves. A row of a static instance, sprite or point batch that changed without `markDirty()` raises it too. |
|
|
25
28
|
| [E1111](E1111.md) | Mesh or model still in use | A call to destroy() named a mesh, or a model that assets.loadGltf loaded, while an object or an instance batch still uses it. For a model, that includes objects that use one of its meshes or materials, and objects that its animation clips move. The engine keeps the mesh or model, so nothing draws freed memory. |
|
|
26
29
|
| [E1112](E1112.md) | Unsupported cookie texture | A spot light's map copies its picture once, when the texture's texels reach the GPU. A video's texture and a render pass's texture change every frame, and a 3D or cube texture holds more than one image, so none of them fits the copy. |
|
|
30
|
+
|
|
31
|
+
## Values passed to calls
|
|
32
|
+
|
|
33
|
+
| Code | Error | What happened |
|
|
34
|
+
| --- | --- | --- |
|
|
27
35
|
| [E1203](E1203.md) | Invalid number | A call received a number that is not finite, such as NaN or Infinity. |
|
|
28
36
|
| [E1204](E1204.md) | Invalid color | A call received a color that is not a hex string, a number from 0 to 0xffffff, or three numbers from 0 to 1. |
|
|
29
37
|
| [E1205](E1205.md) | Unknown input name | An input call received a name that no key, button or action has, or `input.actions.define()` received an action name that a key or button already has. `on()` and `off()` received an event type that objects do not have. Names are case-sensitive: `KeyW` is the W key, and `keyW` names nothing. |
|
|
30
|
-
| [E1206](E1206.md) | Invalid mesh arrays |
|
|
38
|
+
| [E1206](E1206.md) | Invalid mesh arrays | A call that builds or updates a mesh, a line or a set of points got arrays that do not fit. An array can have the wrong length, an index can name no vertex, or a value can be NaN or Infinity. |
|
|
31
39
|
| [E1207](E1207.md) | Invalid layer mask | A call that sets layers received a number that is not a 32-bit layer mask: a fraction, NaN, or a number past 32 bits. |
|
|
32
40
|
| [E1208](E1208.md) | Invalid texture | A call that makes or updates a texture received something it cannot use. It can be an option the engine does not know, or an image without pixels or larger than the device takes. It can also be data that does not fit the texture's size and format, or numbers that make no color grading table. With a KTX2 file, it can be an option that the file cannot take, or an update of its texture. |
|
|
33
41
|
| [E1209](E1209.md) | Too many textures | A material whose shader reads more textures than a WebGL2 shader stage has units. The engine numbers the textures that a program reads, and WebGL2 gives every stage at least 16 units, as many as the device reports. The lit shader reads most of them, so a custom material or add-on draw reaches the limit with its own textures, beside the maps and the shadows. |
|
|
34
|
-
| [E1213](E1213.md) | Invalid setting | A call received a setting that it does not have, or a value that the setting does not take.
|
|
35
|
-
| [E1214](E1214.md) | Invalid sketch option | defineSketch() received an option out of its range. fixedRate must be a number above 0, and maxFixedSteps a whole number of 1 or more. The engine checks the options before it runs the setup function. |
|
|
36
|
-
| [E1215](E1215.md) | Invalid custom WGSL | materials.shader()
|
|
37
|
-
| [E1216](E1216.md) | Invalid uniform or texture | A custom material's or effect's uniforms or textures did not match its WGSL. The
|
|
38
|
-
| [E1217](E1217.md) | Invalid material option | A material factory or scene.createLines()
|
|
39
|
-
| [E1218](E1218.md) | Invalid animation call | An
|
|
42
|
+
| [E1213](E1213.md) | Invalid setting | A call received a setting that it does not have, or a value that the setting does not take. A tone mapping that the engine does not know, or a grading control outside its range, are examples. |
|
|
43
|
+
| [E1214](E1214.md) | Invalid sketch option | defineSketch() received an option out of its range. fixedRate must be a number above 0, and maxFixedSteps a whole number of 1 or more. downloads must be an array of file addresses: an empty string, or a string that is not an address, fails. The engine checks the options before it runs the setup function. |
|
|
44
|
+
| [E1215](E1215.md) | Invalid custom WGSL | `materials.shader()`, `post.addEffect()`, `post.set()` or `scene.setSkyLayer()` received WGSL that it cannot draw with. The engine takes only WGSL that the null3D Vite plugin compiled, as a shader of the kind that the call takes. |
|
|
45
|
+
| [E1216](E1216.md) | Invalid uniform or texture | A custom material's or effect's uniforms or textures did not match its WGSL. The options take the names of the fields of `struct Uniforms` and of the WGSL's texture declarations. Give each one a value or texture of the type that its declaration takes, and leave standard values such as `color` to `set()`. |
|
|
46
|
+
| [E1217](E1217.md) | Invalid material option | A material factory or scene.createLines() got an option value that it does not take, or two options that cannot go together. The message names the option and the rule it breaks. |
|
|
47
|
+
| [E1218](E1218.md) | Invalid animation call | An animation call, or animation data that the engine loads, named something that does not exist or gave a value out of range. The call can be an animator call, a morph-weight call or `animateProperty()`. |
|
|
40
48
|
| [E1219](E1219.md) | Invalid label | ui.trackLabel() or ui.untrackLabel() got an id that is not a string with at least one character. Or trackLabel() got a transform that is not 'screen', 'world' or 'billboard', or a rotation that is not a number for a label that faces the camera. Or the sketch tracked more labels at once than createEngine's maxLabels option allows: 4,096 by default. A label that is a plane of the scene counts against maxLabels3d instead, which holds 256 by default. |
|
|
41
|
-
| [E1220](E1220.md) | Invalid render pass | render
|
|
42
|
-
| [E1221](E1221.md) | Invalid levels of detail | mesh.setLevels() received levels that the mesh cannot take, or a glTF file's MSFT_lod levels could not become them. Each level
|
|
49
|
+
| [E1220](E1220.md) | Invalid render pass | A render pass call got options that it does not take, or a pass of a kind that it does not work on. The message names the call and the rule that it breaks. |
|
|
50
|
+
| [E1221](E1221.md) | Invalid levels of detail | `mesh.setLevels()` received levels that the mesh cannot take, or a glTF file's MSFT_lod levels could not become them. Each level gives one of an error, a distance and a coverage, and the switch distances grow from level to level. |
|
|
43
51
|
| [E1222](E1222.md) | Invalid light probe grid texture | scene.setLightProbeGrid() received a texture that is not a 3D texture. A probe grid sample reads a 3D texture, so the frame cannot bind a texture array in its place. setLightProbeGrid() also refuses a texture that is not live. |
|
|
44
|
-
| [E1223](E1223.md) | Invalid feature description |
|
|
52
|
+
| [E1223](E1223.md) | Invalid feature description | A call that registers a feature, a feature draw, a full-screen effect, a sky layer or a compute pass got a description it cannot take. The message names the value and the rule that it breaks. |
|
|
45
53
|
| [E1224](E1224.md) | Material cannot draw a mesh | scene.overrideMaterial received a sprite, point or line material. Such a material draws the rows of its batch, or a sprite or line of its own, rather than the surface of a mesh, so it cannot stand in for every mesh of the pass. |
|
|
46
54
|
| [E1225](E1225.md) | Add-on name clash | An add-on registered a name that the engine or another add-on holds: its namespace, its shader library, an error-code range, a quality key, or the name of a feature, output or lighting slot. A namespace also names the package that owns it, so a second add-on that takes the name is refused even when its other fields match, while a reload of the same package keeps its namespace. Two add-ons cannot share a name, a range or a key, because the engine would have two answers for one of them. |
|
|
55
|
+
|
|
56
|
+
## Browsers and GPUs
|
|
57
|
+
|
|
58
|
+
| Code | Error | What happened |
|
|
59
|
+
| --- | --- | --- |
|
|
47
60
|
| [E1301](E1301.md) | No usable GPU path | The browser offers neither WebGPU nor WebGL2 for the way the engine was asked to draw. |
|
|
48
61
|
| [E1302](E1302.md) | GPU lost | The browser took the GPU away while the engine drew, for example after a driver reset or a GPU crash, and the engine could not carry on. No new GPU device started, or the GPU was lost more than twice within a minute. The engine stopped drawing. |
|
|
49
62
|
| [E1303](E1303.md) | WebAssembly SIMD missing | The browser runs WebAssembly without SIMD, which the engine's core needs. |
|
|
50
63
|
| [E1304](E1304.md) | GPU out of memory | The GPU had no room for a buffer or texture that the engine made after the start. The objects that use it draw wrong or not at all. The engine reports the first time this happens on each GPU device, and draws on. |
|
|
51
64
|
| [E1305](E1305.md) | GPU rejected work | The GPU path refused a command that the engine gave it after the start, such as a buffer larger than the device allows. The objects that the command made or drew are missing, and the canvas can stay black. The engine reports the first time this happens on each GPU device, and draws on. |
|
|
52
65
|
| [E1306](E1306.md) | Safari before 18 | The browser runs the WebKit engine of a Safari before 18, which null3D does not support. Every browser on iPhone and iPad runs WebKit, so Chrome, Edge and Firefox there count too. |
|
|
66
|
+
| [E1307](E1307.md) | Pipeline not built | After the start, the GPU's driver could not build one pipeline that draws objects of the scene. The objects that draw with it are missing from the pass that the message names, and the engine draws on. |
|
|
67
|
+
|
|
68
|
+
## Setup, loading and runtime
|
|
69
|
+
|
|
70
|
+
| Code | Error | What happened |
|
|
71
|
+
| --- | --- | --- |
|
|
53
72
|
| [E1401](E1401.md) | Not a sketch module | The module passed to createEngine as the sketch does not export a sketch as its default export. |
|
|
54
|
-
| [E1402](E1402.md) | Engine core out of date | The engine core WebAssembly file lacks functions that the
|
|
73
|
+
| [E1402](E1402.md) | Engine core out of date | The engine core's WebAssembly file lacks functions that the engine's JavaScript calls, so the two come from different builds. Development builds check this when the core loads. When null3D's own dev server serves the engine from a checkout of its repository, the check also compares the stamp of the Rust sources that the core was built from with the stamp of the checkout's sources. A core built before a merge or an edit of those sources then fails at once, before it can run with code that expects another core. |
|
|
55
74
|
| [E1403](E1403.md) | Engine core not ready | An engine call ran before the engine core started in this worker, or the core started twice. |
|
|
56
75
|
| [E1404](E1404.md) | Engine thread failed | An engine thread, or the drawing on the page, hit an error it could not handle, such as a trap in the engine core. After the start, the thread stops its loop: the engine draws no new frames, and engine.onFailure receives this error. During the start, createEngine() stops the engine and rejects with this error. |
|
|
57
76
|
| [E1405](E1405.md) | Engine thread did not start | An engine worker failed while the engine started. The worker's script, the engine core or the renderer did not start there, or the sketch's setup function threw an error without an engine code. |
|
|
58
|
-
| [E1406](E1406.md) | Engine file not downloaded | A file of the engine core did not download whole, or a file that a call loads the first time
|
|
77
|
+
| [E1406](E1406.md) | Engine file not downloaded | A file of the engine core did not download whole, or a file that a call loads the first time it runs. The server answered with an error, sent another file in its place, such as a web page, or the connection broke off. |
|
|
59
78
|
| [E1407](E1407.md) | Invalid hold time | The ?hold= switch or the hold option of createEngine gave a hold time that is not a number of seconds from 0 to 600. |
|
|
60
79
|
| [E1408](E1408.md) | Hold failed | The sketch or the engine failed in hold mode, before the engine read the held frame back. A live engine logs an error in the sketch and carries on. Hold mode stops at the first one, so a test fails at once. |
|
|
61
80
|
| [E1409](E1409.md) | Invalid memory maximum | The memory option of createEngine asked for a maximum that is not a whole number of MiB from 256 to 4096. |
|
|
62
|
-
| [E1410](E1410.md) | Sketch module not loaded | The sketch module that createEngine got did not load
|
|
81
|
+
| [E1410](E1410.md) | Sketch module not loaded | The sketch module that `createEngine()` got did not load: it did not download, or its code threw while the module loaded. The engine imports a module that does not load once more after a short wait, and notes that second import in the console. The error comes only when the second import fails too, and it gives the reason of the first. A module whose code threw is not downloaded again, since it would throw again. |
|
|
63
82
|
| [E1411](E1411.md) | Asset not downloaded | A loading call could not download its file. The server answered with an error, such as 404 for a missing file, or the network failed. |
|
|
64
|
-
| [E1412](E1412.md) | Asset not decoded | A loading call downloaded its file but could not read it. The
|
|
83
|
+
| [E1412](E1412.md) | Asset not decoded | A loading call downloaded its file but could not read it. The message says what in the file the engine could not read, with its line where it has one. |
|
|
65
84
|
| [E1413](E1413.md) | Asset from another origin blocked | A loading call could not read a file from another origin. The browser reads such a file only when its server allows the page's origin with an Access-Control-Allow-Origin header. The browser gives no reason, so the server may also have been unreachable. |
|
|
66
85
|
| [E1414](E1414.md) | Frame not captured | engine.capture() could not give an image of a frame. The engine had stopped, or the thread that draws could not read the frame back from the GPU or encode it. The thread that draws can also stop taking messages, as when a GPU call never returns: the engine then fails the request once its wait for the answer has taken longer than its limit, instead of leaving the call to wait with no end. |
|
|
67
86
|
| [E1415](E1415.md) | Page thread already runs a sketch | createEngine() was asked to run a sketch on the page's thread while another engine still runs its sketch there. The page's copy of the engine core serves one engine at a time. This happens with sketchThread: 'main', and in the single-threaded build, which runs every sketch on the page's thread. |
|
|
68
|
-
| [E1416](E1416.md) | glTF file not read | assets.loadGltf()
|
|
87
|
+
| [E1416](E1416.md) | glTF file not read | assets.loadGltf() could not read a file as a glTF 2.0 model. The file is broken, it goes past a limit of the engine, or the rewriteUrl option refused an address that it names. The message names the part that failed. |
|
|
69
88
|
| [E1417](E1417.md) | glTF feature not supported | A glTF file needs an extension that the engine does not read, as its extensionsRequired list says. When a foundation add-on reads that extension, the message names the package to import, such as "Import @null3d/splats, which reads it", and that add-on registers the handler that loads the file. Or a call asked a model for something it cannot give, such as instance batches of a model with no meshes. |
|
|
70
89
|
| [E1418](E1418.md) | WebAssembly blocked by the page | The page's Content-Security-Policy does not allow WebAssembly, so the engine core, the KTX2 transcoder, the meshopt decoder or the Draco decoder could not compile. A policy allows it only when its script-src, or its default-src without a script-src, holds 'wasm-unsafe-eval'. |
|
|
71
|
-
| [E1419](E1419.md) | Canvas held by another engine | createEngine() got a canvas that another engine still draws on, or a canvas whose drawing thread ended, so no engine can draw on it again. That thread ends when it fails,
|
|
72
|
-
| [E1420](E1420.md) | Engine stopped | Sketch code called the engine after the engine stopped, from a timer, a promise or an event handler that outlived destroy(). The call did nothing. |
|
|
90
|
+
| [E1419](E1419.md) | Canvas held by another engine | `createEngine()` got a canvas that another engine still draws on, or a canvas whose drawing thread ended, so no engine can draw on it again. That thread ends when it fails, when the canvas leaves the page, or when the browser refuses memory for a new engine. A canvas serves one engine at a time, but after `destroy()` a new engine can start on it. |
|
|
91
|
+
| [E1420](E1420.md) | Engine stopped | Sketch code called the engine after the engine stopped, from a timer, a promise or an event handler that outlived destroy(). The call did nothing. engine.firstFrame rejects with it too when the page destroys the engine before its first frame. |
|
|
73
92
|
| [E1421](E1421.md) | Unknown feature to preload | createEngine()'s preload option names a feature whose shaders the engine does not have. The features are ao, background, bloom, coat_sheen, coverage, cutout, dof, effect_groups, hash, lines, lod_fade, morph, occlusion, row_values, skinning, sky, sprites, transmission and views, and instance_index and texcoords for the engine's own tests. |
|
|
74
93
|
| [E1422](E1422.md) | Engine file blocked by the page | The engine's files come from another origin than the page, such as a CDN, and the page's Content-Security-Policy blocks one of them. The engine starts each worker from a blob: address that imports the worker's script from that origin, and downloads its .wasm files from there. So the policy's worker-src must allow blob: and the other origin, and its script-src and connect-src must allow the other origin too. Firefox checks the modules that a worker imports against worker-src. |
|
|
75
94
|
| [E1423](E1423.md) | Engine file without CORS | The engine's files come from another origin than the page, such as a CDN. One of them came without a CORS header, or did not download. A page loads a module or a .wasm file from another origin only when the response carries Access-Control-Allow-Origin. |
|
|
76
|
-
| [E1424](E1424.md) | Custom shader builds not downloaded | A
|
|
95
|
+
| [E1424](E1424.md) | Custom shader builds not downloaded | A file that holds a custom shader's builds did not download, so the engine draws no new frames. The server answered with an error, sent another file in its place, such as a web page, or the connection broke off. |
|
|
77
96
|
| [E1425](E1425.md) | Pointer lock refused | engine.requestPointerLock() asked the browser to lock the pointer to the canvas, and the browser refused or ended the lock before it began. Browsers lock the pointer only right after the user clicks or presses a key. They never lock it on phones or in some frames, and they refuse for a moment after the user pressed Esc. |
|
|
78
97
|
| [E1426](E1426.md) | Pointer lock with input off | engine.requestPointerLock() asked for the pointer lock on an engine started with input: false. The lock is part of the engine's input: the sketch reads the mouse's movement through the engine's listeners, which that option turns off. So the engine takes no lock, and leaves the lock to the code that records the page's input. |
|
|
79
98
|
| [E1430](E1430.md) | Too many reflection probes | scene.createReflectionProbe() would make a 17th reflection probe, and a scene has at most 16. Or the scene's first probe needs 6 views of the scene for its captures. The scene and its passes share 32 views, and its passes left fewer than 6. |
|
|
80
99
|
| [E1431](E1431.md) | Area lights' tables missing | The sketch made a rectangle or tube light, and the file of the area lights' fitted tables did not download. The engine's package ships the file, area-light-tables.bin, beside its code, and the engine downloads it with the first area light. Until the file arrives, area lights give no light. A server or a build that leaves out the file, or a Content-Security-Policy whose connect-src blocks its address, stops the download. |
|
|
81
100
|
| [E1432](E1432.md) | Add-on for another engine version | An add-on package loaded beside an engine of another version. Each add-on ships in step with the engine and pins the engine version that it was built for, so a page may mix no two versions. The message names the add-on, its version and the engine version. |
|
|
82
101
|
| [E1433](E1433.md) | Add-on for another plugin interface | An add-on from another developer loaded against a plugin interface that its declared range does not include, or the add-on declares no range of whole versions. An outside add-on declares the plugin interface versions that it works with, because it ships on its own schedule. The engine's own add-ons pin the engine version instead. The message names the add-on, the range it declares and this engine's plugin interface version. |
|
|
83
|
-
| [E1434](E1434.md) | Baked light file not read | assets.loadLightProbeGrid() or assets.loadLightMap() downloaded a file that
|
|
102
|
+
| [E1434](E1434.md) | Baked light file not read | assets.loadLightProbeGrid() or assets.loadLightMap() downloaded a file that this engine cannot read as baked light data. The file may not be JSON, may have the wrong format marker, version or kind, or may have a field whose size does not match the counts or size that the file gives. The message names the fault. |
|
|
84
103
|
| [E1435](E1435.md) | Recording not read | createEngine() could not read the recording that ?replay= names, or the recording does not match this page. The file may not be a null3D recording, may come from another version of the format, may be cut short, or may name keys or fixed steps that this engine does not have. The message names the fault. |
|
|
85
104
|
| [E1436](E1436.md) | Pick lost with the GPU | A pick waited for the GPU to copy its pixel back when the browser took the GPU away. The engine started a new device, but the frame that recorded the pick drew on the lost device, so its read never lands. The pick is rejected rather than repeated on the new device. |
|
|
86
|
-
| [E1437](E1437.md) | Chrome for Testing refused | The null3D command-line tool did not install Chrome for Testing, the browser that draws on the computer's GPU. The archive
|
|
87
|
-
|
|
105
|
+
| [E1437](E1437.md) | Chrome for Testing refused | The null3D command-line tool did not install Chrome for Testing, the browser that draws on the computer's GPU. The archive does not have the SHA-256 hash that the tool records for the pinned version, or the tool has no build for this platform. The tool deletes a refused archive before it unpacks it, and the command then draws with the installed Google Chrome. |
|
|
106
|
+
|
|
107
|
+
## Render graph
|
|
108
|
+
|
|
109
|
+
| Code | Error | What happened |
|
|
110
|
+
| --- | --- | --- |
|
|
111
|
+
| [E1501](E1501.md) | Render space full | The scene needs more room than the renderer has. The message names the full part, such as the material table, the texture table, the culling pass or the shadow atlas. A frame that fails draws nothing, and the canvas keeps the last whole frame. |
|
|
88
112
|
| [E1502](E1502.md) | Pass input missing | A render pass uses a target or buffer that no pass creates, or reads one that no pass running in the frame writes. The render graph checks the sketch's passes when render.addPass() or render.removePass() changes them, and every pass before the frame draws. |
|
|
89
113
|
| [E1503](E1503.md) | Target created twice | Two render passes create the same target, or a pass creates a target that the render graph keeps between frames. A sketch's pass whose texture has the name of a target of the engine's own passes does this. Each target has one creator, which sets its format and size. |
|
|
90
114
|
| [E1504](E1504.md) | Render pass cycle | Render passes need each other in a loop, so no order runs each pass after the passes whose output it reads. A sketch's pass that reads its own texture makes such a loop. |
|
|
91
|
-
| [E1505](E1505.md) | Pass targets do not match | A render pass draws into targets that one GPU render pass cannot hold together. A target can have another size than the pass, or the
|
|
115
|
+
| [E1505](E1505.md) | Pass targets do not match | A render pass draws into targets that one GPU render pass cannot hold together. A target can have another size or sample count than the pass, or the pass can name no target. |
|
|
92
116
|
| [E1506](E1506.md) | Feature draw after the first frame | A draw whose instance count the GPU writes was created after the engine recorded its first frame, on a device that draws its scene directly. The direct path counts every draw on the CPU and keeps no indirect draw, so the frame has nowhere to copy the count. The frame records no draw. |
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: getting-started/cdn
|
|
3
3
|
title: Try null3D from a CDN
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.2"
|
|
6
4
|
summary: "The CDN build; its production and development entries; one HTML file with no bundler; import maps; the policy and CORS headers; both thread modes; what needs a build step."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Try null3D from a CDN
|
|
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
|
A page can draw a null3D scene with no build step: one HTML file that imports the engine from a CDN. This suits a quick trial, a documentation example or a CodePen-style page. A project that grows past a trial uses Vite and the plugin, as [Install null3D](install.md) shows.
|
|
14
10
|
|
|
15
11
|
```mermaid
|
|
@@ -21,9 +17,14 @@ flowchart LR
|
|
|
21
17
|
|
|
22
18
|
## Make the CDN build
|
|
23
19
|
|
|
24
|
-
The build holds the engine's JavaScript, its shaders, both WebAssembly builds and its vendor files, with each foundation add-on under `addons/<name>/`. The npm package leaves the built shaders out, because they are large and a Vite build supplies them. A page with no build step therefore needs this folder.
|
|
20
|
+
The CDN build comes from the engine's source, not from npm. It holds the engine's JavaScript, its shaders, both WebAssembly builds and its vendor files, with each foundation add-on under `addons/<name>/`. The npm package leaves the built shaders out, because they are large and a Vite build supplies them. A page with no build step therefore needs this folder.
|
|
21
|
+
|
|
22
|
+
Install Bun and the Rust toolchain through [rustup](https://rustup.rs), then run these commands in a clone of the [repository](https://github.com/null3d-engine/null3d#development):
|
|
25
23
|
|
|
26
24
|
```sh
|
|
25
|
+
git clone https://github.com/null3d-engine/null3d.git
|
|
26
|
+
cd null3d
|
|
27
|
+
bun install
|
|
27
28
|
bun run build
|
|
28
29
|
bun run build:cdn
|
|
29
30
|
```
|
|
@@ -40,6 +41,8 @@ Give every file a CORS header, because the engine imports its modules and downlo
|
|
|
40
41
|
Access-Control-Allow-Origin: *
|
|
41
42
|
```
|
|
42
43
|
|
|
44
|
+
Send each `.wasm` file with `Content-Type: application/wasm`, with nothing after it, and let browsers keep the files. Chrome then keeps the compiled engine core, and a repeat visit skips most of its compile ([Let Chrome keep the compiled core](hosting.md#let-chrome-keep-the-compiled-core)). The folder's file names hold no hash of their content. So upload each engine version under a prefix of its own, such as `https://cdn.example.com/null3d/0.1.0/`. Then serve its files with `Cache-Control: public, max-age=31536000, immutable`, so a repeat visit takes them from the browser's cache.
|
|
45
|
+
|
|
43
46
|
## Production and development entries
|
|
44
47
|
|
|
45
48
|
The build holds the engine's entry point twice. Both draw the same scene. They differ in the checks that run and in the switches that the page's address can set.
|
|
@@ -51,16 +54,21 @@ The build holds the engine's entry point twice. Both draw the same scene. They d
|
|
|
51
54
|
|
|
52
55
|
The development entry runs the same checks as the Vite dev server. A bad argument throws an error with its code, such as [E1203](../errors/E1203.md), and a call on a destroyed object throws [E1101](../errors/E1101.md). Debug drawing and debug views draw only in a development build, such as this entry ([Debugging](../guides/debugging.md#development-checks)). The entry also reads the switches in the page's address, such as `?gpu=`, `?hold=` and `?preset=` ([Switches for tests](../guides/testing.md#switches-for-tests)).
|
|
53
56
|
|
|
54
|
-
In each frame, some of those checks read every static object and a share of the rows of static batches. So a large scene runs slower from the development entry than from the production entry. Time a page, judge its frame rate or compare it with
|
|
57
|
+
In each frame, some of those checks read every static object and a share of the rows of static batches. So a large scene runs slower from the development entry than from the production entry. Time a page, judge its frame rate or compare it with another engine only from the production entry. A demo from the development entry is fine to try, but its frame rate is not what your users get.
|
|
55
58
|
|
|
56
59
|
The production entry behaves like a production build from Vite and the plugin. The checks never run, and the page ignores address switches, so a link cannot change how it runs. Its files still hold the checks' code, which a Vite build removes from the download.
|
|
57
60
|
|
|
58
61
|
Use one entry for the whole page: the page's import, the sketch's import, the import map and each add-on. An add-on's development entry is `addons/<name>/lib-dev/index.js`. A page that mixes the two loads two copies of the engine's code.
|
|
59
62
|
|
|
63
|
+
<details>
|
|
64
|
+
<summary>Technical details: telling the entries apart, and a benchmark build</summary>
|
|
65
|
+
|
|
60
66
|
To see which entry a page runs, read the address that it imports. On a page with the [isolation headers](#both-thread-modes), the `?threads=off` switch also tells them apart. With it, `engine.mode.build` is `'single'` from the development entry and `'threaded'` from the production entry.
|
|
61
67
|
|
|
62
68
|
A benchmark page may time a production build and still set switches, such as `?gpu=webgl2`. It needs a third form. `bun run build:cdn --url-switches` makes the production entry read the address switches. Use that build for benchmark pages only, and never ship it, because a link can then change how the page runs.
|
|
63
69
|
|
|
70
|
+
</details>
|
|
71
|
+
|
|
64
72
|
## One HTML file
|
|
65
73
|
|
|
66
74
|
Save this page, change the CDN address to your own, and serve it from a web server. A browser refuses the modules and workers of a page opened from a file on disk.
|
|
@@ -110,6 +118,20 @@ The sketch is a module at a `blob:` address, which the page makes from the strin
|
|
|
110
118
|
|
|
111
119
|
The page imports the production entry. While you work on the page, change both `lib/index.js` addresses to `lib-dev/index.js`, so the development checks run and their errors name your mistakes.
|
|
112
120
|
|
|
121
|
+
## Start the core early
|
|
122
|
+
|
|
123
|
+
The engine core is the start's largest file. A page built with Vite and the null3D plugin starts the core's download from a small script in its head. That script runs before the page's own scripts. A page with no build step adds that script itself, as the first tag in its head:
|
|
124
|
+
|
|
125
|
+
```html
|
|
126
|
+
<script type="module" async src="https://cdn.example.com/null3d/lib/page/early-core.js"></script>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The script picks the build that `createEngine` will pick, and starts its download. The engine takes that download when it starts, so the core does not wait for the page's own scripts. Take the script from the page's entry: `lib-dev/page/early-core.js` with the development entry.
|
|
130
|
+
|
|
131
|
+
The build loads the engine as many small modules, and each thread finds them in several rounds of imports, one after another. So a page with no build step starts more slowly than a Vite build. Serve the folder over HTTP/2 or HTTP/3, as most CDNs do, so each round's requests go out at once.
|
|
132
|
+
|
|
133
|
+
Give the folder the headers of [Make the CDN build](#make-the-cdn-build) above, so a repeat visit downloads none of it. [A fast start](../guides/start-time.md) gives the other steps.
|
|
134
|
+
|
|
113
135
|
## Import maps
|
|
114
136
|
|
|
115
137
|
An import map gives the engine its package name, as a bundled project has it. Then the sketch and the page write `@null3d/engine`:
|
|
@@ -153,9 +175,9 @@ Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' b
|
|
|
153
175
|
```
|
|
154
176
|
|
|
155
177
|
- `blob:` in `script-src`: the page makes the sketch module at a `blob:` address.
|
|
156
|
-
- `
|
|
157
|
-
|
|
158
|
-
-
|
|
178
|
+
- `'unsafe-inline'` in `script-src` and `style-src`: the example page holds its script and style inline.
|
|
179
|
+
|
|
180
|
+
The `blob:` in `worker-src`, and the CDN in `script-src`, `worker-src` and `connect-src`, are there for the reasons that [Hosting](hosting.md#the-engines-files-on-a-cdn) gives, with the error that each missing item causes.
|
|
159
181
|
|
|
160
182
|
Missing items give [E1422](../errors/E1422.md), [E1423](../errors/E1423.md) or [E1418](../errors/E1418.md), as [Hosting](hosting.md#the-engines-files-on-a-cdn) lists them.
|
|
161
183
|
|
|
@@ -209,7 +231,7 @@ export default defineSketch((ctx) => {
|
|
|
209
231
|
|
|
210
232
|
An import map can name an add-on for the page's own modules, but a worker reads no import map. Name the add-on by its full address in the sketch, as the example does.
|
|
211
233
|
|
|
212
|
-
The build also writes `null3d-third-party-notices.txt`, with the license notices of the engine and of each add-on that ships other projects' code. Keep that file with the folder when you publish it, or show its text in your credits.
|
|
234
|
+
The build also writes `null3d-third-party-notices.txt`, with the license notices of the engine and of each add-on that ships other projects' code. Keep that file with the folder when you publish it, or show its text in your credits ([Third-party notices](third-party-notices.md)).
|
|
213
235
|
|
|
214
236
|
## Related pages
|
|
215
237
|
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: getting-started/first-scene
|
|
3
3
|
title: Your first scene
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.1"
|
|
6
4
|
summary: "page.ts with createEngine; sketch.ts with defineSketch; camera, light, mesh; running it with Vite."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Your first scene
|
|
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
|
```mermaid
|
|
14
10
|
flowchart LR
|
|
15
11
|
html["index.html<br/>the canvas"] --> page["page.ts<br/>main thread: createEngine"]
|
|
@@ -19,7 +15,7 @@ flowchart LR
|
|
|
19
15
|
|
|
20
16
|
A null3D project has two modules. The page module, `page.ts`, runs on the page's main thread: it creates the engine and keeps the HTML. The sketch module, `sketch.ts`, builds the 3D scene and updates it every frame, in a worker of its own. This page builds a turning box with a camera and two lights.
|
|
21
17
|
|
|
22
|
-
Put the four files below in one folder. The project needs the `@null3d/engine` package, and Vite with the `@null3d/vite-plugin` package: [Install null3D](install.md) lists them.
|
|
18
|
+
Put the four files below in one folder. The project needs the `@null3d/engine` package, and Vite with the `@null3d/vite-plugin` package: [Install null3D](install.md) lists them. `bunx @null3d/cli create` writes this same project for you, with the two modules in `src/`. See [Project structure](project-structure.md).
|
|
23
19
|
|
|
24
20
|
## The HTML page
|
|
25
21
|
|
|
@@ -47,19 +43,26 @@ CSS sets the canvas's size. The engine draws at that size times the screen's pix
|
|
|
47
43
|
|
|
48
44
|
```ts
|
|
49
45
|
// page.ts
|
|
50
|
-
import { createEngine } from '@null3d/engine';
|
|
46
|
+
import { createEngine, EngineError } from '@null3d/engine';
|
|
51
47
|
|
|
52
48
|
const canvas = document.querySelector('canvas')!;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
try {
|
|
50
|
+
const engine = await createEngine({
|
|
51
|
+
canvas,
|
|
52
|
+
sketch: new URL('./sketch.ts', import.meta.url),
|
|
53
|
+
});
|
|
54
|
+
await engine.firstFrame; // the first frame is on the screen
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (!(error instanceof EngineError)) throw error;
|
|
57
|
+
const note = document.createElement('p');
|
|
58
|
+
note.textContent = 'This browser cannot show the 3D scene.';
|
|
59
|
+
canvas.replaceWith(note);
|
|
60
|
+
}
|
|
58
61
|
```
|
|
59
62
|
|
|
60
63
|
`createEngine` picks the GPU path, starts the engine's threads and runs the sketch's setup. It resolves once the setup has run. `engine.firstFrame` resolves once the GPU has finished the first frame, which is the moment to remove a loading screen.
|
|
61
64
|
|
|
62
|
-
`createEngine` rejects with an `EngineError` when the browser cannot run the engine. Examples are Safari before 18 ([E1306](../errors/E1306.md)), a browser without WebAssembly SIMD ([E1303](../errors/E1303.md)), and one without a usable GPU path ([E1301](../errors/E1301.md)).
|
|
65
|
+
`createEngine` rejects with an `EngineError` when the browser cannot run the engine. Examples are Safari before 18 ([E1306](../errors/E1306.md)), a browser without WebAssembly SIMD ([E1303](../errors/E1303.md)), and one without a usable GPU path ([E1301](../errors/E1301.md)). The `catch` above shows the page without the scene. [Debugging](../guides/debugging.md#where-problems-appear) lists every error the start can give, and `engine.onFailure` for failures after the start.
|
|
63
66
|
|
|
64
67
|
## The sketch module
|
|
65
68
|
|
|
@@ -96,7 +99,7 @@ The module's default export is `defineSketch(setup)`. The engine calls `setup` o
|
|
|
96
99
|
|
|
97
100
|
- The camera's `fov` is vertical, in degrees, and `target` turns the camera toward a point. `setActiveCamera` draws the scene from it.
|
|
98
101
|
- The directional light's `direction` is the way its light travels, like sunlight. The ambient light lights every surface equally.
|
|
99
|
-
- `geometry.box`
|
|
102
|
+
- `geometry.box` makes a box centered on its origin. Its `width`, `height` and `depth` are 1 by default. `materials.standard` shades with glTF's physically based metallic-roughness model.
|
|
100
103
|
- `dynamic: true` says that the cube moves in most frames. Objects are static by default, and a static object costs nothing in a frame where it does not change.
|
|
101
104
|
|
|
102
105
|
The sketch worker has no `document` and no `window`. The page keeps the HTML, and the two sides talk through [messages](../api/page.md).
|
|
@@ -123,6 +126,11 @@ Open the address that Vite prints. `bunx vite build` writes the production files
|
|
|
123
126
|
|
|
124
127
|
## Next steps
|
|
125
128
|
|
|
129
|
+
- [Show a model](../cookbook/index.md#a-loading-screen-for-models): load a glTF file and an environment, and wait for the first frame.
|
|
130
|
+
- [Orbit controls](../api/controls.md): let the user turn and zoom the camera.
|
|
131
|
+
- [Lighting and environment](../concepts/lighting.md): light types, environment maps and fog.
|
|
132
|
+
- [Project structure](project-structure.md): start from the `product` template, which has orbit controls and soft studio light.
|
|
133
|
+
- glTF model example: a full sketch that shows a model on a turntable.
|
|
126
134
|
- [Objects and transforms](../api/objects.md): move, turn, parent and hide objects.
|
|
127
135
|
- [Static and dynamic objects](../concepts/static-dynamic.md): when to pass `dynamic: true`.
|
|
128
136
|
- [Instances and batching](../concepts/instances.md): draw thousands of copies of one mesh.
|