@null3d/engine 0.1.0 → 0.1.2
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/dist/wasm/single/null3d.js +10 -8
- package/dist/wasm/single/null3d_bg.wasm +0 -0
- package/dist/wasm/threaded/null3d.js +10 -8
- package/dist/wasm/threaded/null3d_bg.wasm +0 -0
- package/docs/api/animation.md +96 -24
- package/docs/api/assets.md +99 -29
- package/docs/api/cameras.md +38 -7
- package/docs/api/controls.md +47 -23
- package/docs/api/debug.md +105 -35
- package/docs/api/engine.md +108 -32
- package/docs/api/feature-draws.md +21 -15
- package/docs/api/feature-effects.md +8 -8
- package/docs/api/feature-instances.md +68 -17
- package/docs/api/features.md +68 -37
- package/docs/api/geometry.md +83 -14
- package/docs/api/grass.md +55 -13
- package/docs/api/impostors.md +92 -50
- package/docs/api/input.md +22 -9
- package/docs/api/lights.md +67 -16
- package/docs/api/lines.md +38 -13
- package/docs/api/materials.md +187 -59
- package/docs/api/math.md +6 -6
- package/docs/api/objects.md +40 -15
- package/docs/api/page.md +58 -7
- package/docs/api/particles.md +36 -11
- package/docs/api/points.md +18 -8
- package/docs/api/post.md +57 -23
- package/docs/api/quality.md +36 -16
- package/docs/api/raycast.md +57 -24
- package/docs/api/reference/animation.md +1 -2
- package/docs/api/reference/assets.md +7 -4
- package/docs/api/reference/cameras.md +3 -2
- package/docs/api/reference/controls.md +59 -2
- package/docs/api/reference/debug.md +58 -6
- package/docs/api/reference/engine.md +40 -10
- 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 +132 -21
- package/docs/api/reference/grass.md +62 -2
- package/docs/api/reference/impostors.md +120 -16
- package/docs/api/reference/input.md +1 -2
- package/docs/api/reference/lights.md +4 -3
- package/docs/api/reference/lines.md +3 -4
- package/docs/api/reference/materials.md +7 -6
- package/docs/api/reference/math.md +13 -2
- package/docs/api/reference/objects.md +2 -3
- package/docs/api/reference/particles.md +31 -6
- package/docs/api/reference/points.md +2 -3
- package/docs/api/reference/post.md +4 -3
- package/docs/api/reference/quality.md +1 -2
- package/docs/api/reference/raycast.md +1 -2
- package/docs/api/reference/render.md +4 -3
- package/docs/api/reference/scene.md +24 -5
- package/docs/api/reference/sketch.md +11 -11
- package/docs/api/reference/sound.md +33 -2
- package/docs/api/reference/splats.md +42 -3
- package/docs/api/reference/sprites.md +2 -3
- package/docs/api/reference/tasks.md +16 -3
- package/docs/api/reference/terrain.md +26 -5
- package/docs/api/reference/textures.md +1 -2
- package/docs/api/reference/three-compat.md +18 -7
- package/docs/api/reference/time.md +1 -2
- package/docs/api/reference/ui.md +10 -7
- package/docs/api/reference/vertex-draws.md +2 -3
- package/docs/api/reference/water.md +78 -5
- package/docs/api/reference/wind.md +15 -2
- package/docs/api/render.md +67 -25
- package/docs/api/scene.md +129 -36
- package/docs/api/sketch.md +45 -19
- package/docs/api/sound.md +48 -12
- package/docs/api/splats.md +42 -15
- package/docs/api/sprites.md +8 -6
- package/docs/api/tasks.md +31 -22
- package/docs/api/terrain.md +44 -12
- package/docs/api/textures.md +61 -12
- package/docs/api/three-compat.md +15 -7
- package/docs/api/time.md +3 -5
- package/docs/api/ui.md +18 -10
- package/docs/api/vertex-draws.md +13 -12
- package/docs/api/water.md +111 -67
- package/docs/api/wind.md +61 -15
- package/docs/cli/null3d.md +90 -15
- package/docs/concepts/architecture.md +69 -23
- package/docs/concepts/assets.md +57 -16
- package/docs/concepts/backends.md +68 -24
- package/docs/concepts/color-management.md +42 -13
- package/docs/concepts/culling.md +68 -47
- package/docs/concepts/handles.md +14 -5
- package/docs/concepts/instances.md +72 -23
- package/docs/concepts/large-worlds.md +17 -7
- package/docs/concepts/lighting.md +117 -44
- package/docs/concepts/lod.md +128 -33
- package/docs/concepts/materials.md +43 -12
- package/docs/concepts/particle-buffer.md +48 -35
- package/docs/concepts/post-processing.md +77 -14
- package/docs/concepts/quality-preset-tables.md +3 -2
- package/docs/concepts/quality-presets.md +122 -39
- package/docs/concepts/render-graph.md +56 -21
- package/docs/concepts/render-layers.md +9 -5
- package/docs/concepts/shadows.md +96 -25
- package/docs/concepts/static-dynamic.md +22 -7
- package/docs/cookbook/index.md +163 -119
- package/docs/data/threejs-mapping.json +301 -340
- 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 +11 -3
- 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 +23 -6
- package/docs/errors/E1308.md +31 -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 +11 -3
- 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 +53 -29
- package/docs/getting-started/cdn.md +15 -9
- package/docs/getting-started/first-scene.md +20 -12
- package/docs/getting-started/hosting.md +113 -63
- package/docs/getting-started/install.md +39 -24
- package/docs/getting-started/network-use.md +31 -21
- package/docs/getting-started/project-structure.md +20 -8
- package/docs/getting-started/third-party-notices.md +6 -10
- package/docs/guides/accessibility.md +4 -4
- package/docs/guides/add-ons.md +83 -13
- package/docs/guides/agents.md +13 -14
- package/docs/guides/assets-pipeline.md +294 -72
- package/docs/guides/audio.md +17 -15
- package/docs/guides/baked-light-data.md +44 -23
- package/docs/guides/car-paint.md +37 -31
- package/docs/guides/content-pages.md +86 -29
- package/docs/guides/custom-passes.md +59 -17
- package/docs/guides/custom-shaders.md +54 -37
- package/docs/guides/debugging.md +31 -41
- package/docs/guides/deploying.md +10 -27
- package/docs/guides/deterministic-simulation.md +23 -16
- package/docs/guides/first-use-shaders.md +83 -45
- package/docs/guides/lens-kit.md +29 -26
- package/docs/guides/loading-screens.md +74 -30
- package/docs/guides/multiple-views.md +22 -11
- package/docs/guides/performance.md +188 -37
- package/docs/guides/phones.md +71 -19
- package/docs/guides/physics.md +6 -10
- package/docs/guides/screens.md +41 -29
- package/docs/guides/start-time.md +126 -85
- package/docs/guides/testing.md +137 -98
- package/docs/guides/ui-overlays.md +17 -12
- 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 +14 -23
- package/docs/moves.json +1 -0
- package/docs/nav.json +300 -0
- package/docs/pages.md +230 -212
- package/docs/porting/react-three-fiber.md +2 -6
- package/docs/porting/threejs-loop-and-threads.md +1 -5
- package/docs/porting/threejs-mapping.md +1248 -234
- package/docs/porting/threejs-materials.md +10 -5
- package/docs/porting/threejs-overview.md +26 -6
- package/docs/porting/threejs-postprocessing.md +2 -6
- package/docs/porting/threejs-shaders.md +16 -14
- package/docs/porting/threejs-unsupported.md +6 -6
- package/docs/porting/verification.md +0 -4
- package/docs/shaders/builtins.md +15 -4
- package/docs/shaders/library.md +9 -6
- package/docs/shaders/surface-functions.md +51 -16
- package/docs/shaders/wgsl-rules.md +12 -5
- package/lib/debug/debug.d.ts +2 -2
- package/lib/debug/draw.d.ts +2 -2
- package/lib/debug/draw.js +8 -4
- 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 +21 -6
- package/lib/debug/stats-panel.js +80 -13
- package/lib/errors/codes.d.ts +17 -3
- package/lib/errors/codes.js +116 -105
- package/lib/errors/engine-error.js +1 -1
- package/lib/errors/fixes.d.ts +1 -0
- package/lib/errors/fixes.js +19 -18
- package/lib/generated/shader-permutations.d.ts +6 -0
- package/lib/generated/shader-permutations.js +6 -0
- package/lib/gpu/variants.d.ts +8 -2
- package/lib/gpu/variants.js +39 -7
- package/lib/gpu/webgl2/programs.js +1 -1
- package/lib/gpu/webgpu/pipelines.js +13 -13
- package/lib/index.d.ts +1 -1
- package/lib/page/capabilities.d.ts +1 -1
- package/lib/page/engine.d.ts +29 -7
- package/lib/page/engine.js +79 -7
- package/lib/page/label-loop.js +9 -4
- package/lib/page/stats-switch.js +2 -0
- package/lib/page/switches.d.ts +6 -4
- package/lib/page/switches.js +20 -4
- package/lib/scene/baked-light.d.ts +2 -2
- package/lib/scene/fake-call-values.js +2 -2
- package/lib/scene/frame-cameras.d.ts +16 -4
- package/lib/scene/frame-cameras.js +28 -10
- package/lib/scene/gltf.d.ts +1 -1
- package/lib/scene/level-rule.d.ts +6 -5
- package/lib/scene/level-rule.js +2 -2
- package/lib/scene/particles.d.ts +7 -3
- package/lib/scene/particles.js +3 -1
- package/lib/scene/post.d.ts +3 -2
- package/lib/scene/resources.d.ts +15 -9
- package/lib/scene/scene.d.ts +18 -2
- package/lib/scene/scene.js +47 -5
- package/lib/scene/time-of-day.d.ts +10 -5
- package/lib/scene/time-of-day.js +11 -7
- package/lib/shader-artifact.json +1 -1
- package/lib/shared/labels.d.ts +5 -2
- package/lib/shared/labels.js +5 -2
- package/lib/shared/permutation-words.d.ts +8 -0
- package/lib/shared/permutation-words.js +14 -0
- package/lib/shared/recording.d.ts +13 -5
- package/lib/shared/recording.js +31 -10
- package/lib/shared/sketch-data.d.ts +9 -0
- package/lib/shared/sketch-data.js +57 -0
- package/lib/shared/tier.d.ts +9 -0
- package/lib/shared/tier.js +4 -1
- package/lib/shared/version.d.ts +1 -1
- package/lib/shared/version.js +1 -1
- package/lib/sketch/define-sketch.d.ts +16 -7
- package/lib/sketch/define-sketch.js +2 -1
- package/lib/sketch/runner.d.ts +4 -0
- package/lib/sketch/runner.js +5 -0
- package/lib/sketch/ui.js +4 -2
- package/lib/stats.d.ts +1 -0
- package/lib/workers/protocol.d.ts +10 -0
- package/lib/workers/render-worker.js +4 -1
- package/lib/workers/sketch-worker.js +4 -1
- package/package.json +1 -1
package/docs/api/debug.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: api/debug
|
|
3
3
|
title: Debug drawing and stats
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.1"
|
|
6
4
|
summary: "debug.line, box, sphere, arrow, axes, grid, frustum, light and skeleton; the stats overlay, debug.frameStats and @null3d/engine/stats; engine.measure and its figures; debug.view, the ?view switch and add-on views; debug.shadowCamera; the in-page inspector and engine.inspect."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Debug drawing and stats
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Debug drawing shows where things are in the scene: lines, boxes, spheres, arrows, axes, grids, camera frustums, lights and skeletons. Debug views draw the whole scene with one debug shading, such as its normals, its wireframe or its shadows. The overlay of `debug.stats` shows the engine's frame figures over the top-right corner of the canvas, and `debug.frameStats` gives them to the sketch. On the page, `engine.measure` measures the running engine.
|
|
9
|
+
Debug drawing shows where things are in the scene: lines, boxes, spheres, arrows, axes, grids, camera frustums, lights and skeletons. Debug views draw the whole scene with one debug shading, such as its normals, its wireframe or its shadows. The overlay of `debug.stats` shows the engine's frame figures over the top-right or bottom-right corner of the canvas, and `debug.frameStats` gives them to the sketch. On the page, `engine.measure` measures the running engine.
|
|
14
10
|
|
|
15
11
|
## Debug drawing
|
|
16
12
|
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
Debug drawing.
|
|
16
|
+
|
|
17
17
|
```mermaid
|
|
18
18
|
flowchart LR
|
|
19
19
|
calls["ctx.debug calls<br/>in onUpdate"] --> points["The frame's points:<br/>64-bit positions and colors"]
|
|
@@ -21,7 +21,14 @@ flowchart LR
|
|
|
21
21
|
relative --> pass["One draw of every line,<br/>after the opaque objects"]
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
`ctx.debug` draws lines over the scene for one frame. Call it in `onUpdate` in every frame that needs the drawing. Each call adds the lines of its shape.
|
|
24
|
+
`ctx.debug` draws lines over the scene for one frame. Call it in `onUpdate` in every frame that needs the drawing. Each call adds the lines of its shape.
|
|
25
|
+
|
|
26
|
+
<details>
|
|
27
|
+
<summary>Technical details: how the lines draw</summary>
|
|
28
|
+
|
|
29
|
+
When the frame draws, the engine moves each point relative to the camera in 64-bit floats. Then it draws every line in one call, after the opaque objects. So lines stay precise far from the origin, as objects do, and objects in front of a line hide it. The extra frame that [hold mode](../guides/testing.md#hold-mode) draws for a pass that reads the frame before runs no `onUpdate`, so it draws the lines of the last `onUpdate` again.
|
|
30
|
+
|
|
31
|
+
</details>
|
|
25
32
|
|
|
26
33
|
```ts
|
|
27
34
|
export default defineSketch(({ scene, materials, geometry, debug }) => {
|
|
@@ -79,7 +86,7 @@ Debug drawing works in development builds only. In a production build, every dra
|
|
|
79
86
|
|
|
80
87
|
```mermaid
|
|
81
88
|
flowchart LR
|
|
82
|
-
|
|
89
|
+
view["debug.view('normals')"] --> core["Every mesh's pipeline<br/>takes the debug shading"]
|
|
83
90
|
core --> frame["The next frame draws the view,<br/>clears to black, no tone mapping"]
|
|
84
91
|
```
|
|
85
92
|
|
|
@@ -126,16 +133,23 @@ export default defineSketch(({ debug, input }) => {
|
|
|
126
133
|
- The first frame of a view builds its GPU pipelines, so objects can be missing from a few frames after a change.
|
|
127
134
|
- The wireframe view keeps an edge list for each mesh once it has shown, which takes twice the GPU memory of the mesh's triangle indices.
|
|
128
135
|
- The levels view reads the level of each draw from the culling that picks it. Each level is a bucket of its own, so the view needs no shader for each material. Its first frame builds the pipelines that carry the level code, so the levels can be missing for a few frames after a change.
|
|
129
|
-
- `debug.cullingSpheres(true)` draws the bounding sphere that culling tests for each of the first 128 objects whose mesh has levels, until `debug.cullingSpheres(false)`. Use it beside the levels view to see why the size rule hid a copy.
|
|
136
|
+
- `debug.cullingSpheres(true)` draws the bounding sphere that culling tests for each of the first 128 objects whose mesh has levels, until `debug.cullingSpheres(false)`. Use it beside the levels view to see why the size rule hid a copy.
|
|
137
|
+
- It reads the mesh's own sphere around the object's origin, so it does not draw the sphere that `setBounds` gave an object. Instance batch rows draw no sphere. `debug.cullingSpheresDrawn()` gives the spheres that the last frame drew, which is zero while the switch is off, so a page can tell that the switch drew them rather than nothing.
|
|
130
138
|
- Debug views work in development builds only. In a release build, `debug.view` does nothing, and the build holds none of the views' shaders or drawing code. A few small parts stay, because the engine shares them: the scene's traversal of objects whose meshes have levels, and the culling's level code. Together they add about 2.4 KB after Brotli to a single-threaded build, and less to a pipelined one. In a development build, a name that the engine does not know, and that no add-on feature registers, fails with [E1213](../errors/E1213.md).
|
|
131
139
|
|
|
140
|
+

|
|
141
|
+
|
|
142
|
+
The levels view.
|
|
143
|
+
|
|
132
144
|
### The view from the address
|
|
133
145
|
|
|
134
|
-
`?view=<name>` picks any debug view on any page, as `?stats` does: in development builds, and in a production build only when the Vite plugin's `urlSwitches` option is on. The views themselves draw in development builds only, as the section above says. A person, or `bunx @null3d/cli shot --page '/your-page?view=levels'`, can then see any demo's levels with no code change. A name that no view has draws the materials.
|
|
146
|
+
`?view=<name>` picks any debug view on any page, as `?stats` does: in development builds, and in a production build only when the Vite plugin's `urlSwitches` option is on. The views themselves draw in development builds only, as the section above says. A person, or `bunx @null3d/cli shot --page '/your-page?view=levels'`, can then see any demo's levels with no code change. A name that no view has draws the materials. The [forest demo](https://github.com/null3d-engine/null3d/tree/main/examples/forest) shows its levels with `?view=levels`.
|
|
135
147
|
|
|
136
148
|
### Views from add-ons
|
|
137
149
|
|
|
138
|
-
An add-on adds a view of its own through the `debugViews` field of its [feature description](features.md#the-fields). Each view gives its name and a `set` callback, which hears when the view starts and stops. The add-on draws the view itself, with its own materials or its own debug drawing. Picking an add-on's view clears the engine's own view, so the two never draw together.
|
|
150
|
+
An add-on adds a view of its own through the `debugViews` field of its [feature description](features.md#the-fields). Each view gives its name and a `set` callback, which hears when the view starts and stops. The add-on draws the view itself, with its own materials or its own debug drawing. Picking an add-on's view clears the engine's own view, so the two never draw together.
|
|
151
|
+
|
|
152
|
+
A name that no feature has registered yet clears it too. A view's name must not name one of the engine's views, and each name belongs to one add-on. The [water demo](https://github.com/null3d-engine/null3d/tree/main/examples/water) registers a view of its own, which `?view=water-bounds` shows.
|
|
139
153
|
|
|
140
154
|
```ts
|
|
141
155
|
host.add(
|
|
@@ -185,34 +199,43 @@ flowchart LR
|
|
|
185
199
|
page["The page's own meters:<br/>heap, page memory"] --> card
|
|
186
200
|
```
|
|
187
201
|
|
|
188
|
-
The stats overlay sits over the top-right corner of the canvas. Its header is a button with a ring gauge and the frame rate, such as `58 fps`.
|
|
202
|
+
The stats overlay sits over the top-right corner of the canvas, or over its bottom-right corner when the `corner` option asks. Its header is a button with a ring gauge and the frame rate, such as `58 fps`.
|
|
203
|
+
|
|
204
|
+
A click on it, or Enter or Space while it has the focus, opens a card of figures and closes the card again. At the top right the card opens under the header, and at the bottom right above it. The card holds four tabs, which show one group of figures at a time. Four ways show the overlay:
|
|
189
205
|
|
|
190
206
|
- `createEngine({ stats: true })` shows it from the first frame.
|
|
191
207
|
- `engine.stats(true)` on the page shows it, and `engine.stats(false)` hides it.
|
|
192
|
-
- The `?stats` switch in the page's address shows it, and `?stats=off` hides it. `?stats=collapsed` and `?stats=open` show it with its card closed or open. Production builds read the switch only when the Vite plugin's `urlSwitches` option is on.
|
|
208
|
+
- The `?stats` switch in the page's address shows it, and `?stats=off` hides it. `?stats=collapsed` and `?stats=open` show it with its card closed or open. The switches `?stats=top-right` and `?stats=bottom-right` show it in that corner. A comma joins a start state and a corner: `?stats=collapsed,bottom-right`. Production builds read the switch only when the Vite plugin's `urlSwitches` option is on.
|
|
193
209
|
- `debug.stats(true)` in the sketch shows it, and `debug.stats(false)` hides it.
|
|
194
210
|
|
|
195
|
-
|
|
211
|
+
The three calls also take options in place of `true`:
|
|
196
212
|
|
|
197
213
|
| Option | What it sets | Default |
|
|
198
214
|
| --- | --- | --- |
|
|
199
215
|
| `collapsed` | True starts the overlay with its card closed, so only the header shows | `false` |
|
|
216
|
+
| `corner` | The canvas's corner that the header sits in: `'top-right'` or `'bottom-right'` | `'top-right'` |
|
|
200
217
|
|
|
201
218
|
```ts
|
|
202
219
|
const engine = await createEngine({
|
|
203
220
|
canvas,
|
|
204
221
|
sketch: new URL('./sketch.ts', import.meta.url),
|
|
205
|
-
stats: { collapsed: true },
|
|
222
|
+
stats: { collapsed: true, corner: 'bottom-right' },
|
|
206
223
|
});
|
|
207
224
|
```
|
|
208
225
|
|
|
209
|
-
The page and the sketch show and hide the same overlay, and the last call wins, from either side. So the sketch's `debug.stats(false)` hides an overlay that the page showed, and the page's `engine.stats(false)` hides one that the sketch showed. Options add up: a call changes only the options that it names, and an overlay that shows again keeps them. Each `debug.stats` call sends a message to the page, so call it when the choice changes, not in every frame.
|
|
226
|
+
The page and the sketch show and hide the same overlay, and the last call wins, from either side. So the sketch's `debug.stats(false)` hides an overlay that the page showed, and the page's `engine.stats(false)` hides one that the sketch showed. Options add up: a call changes only the options that it names, and an overlay that shows again keeps them. Each `debug.stats` call sends a message to the page, so call it when the choice changes, not in every frame.
|
|
227
|
+
|
|
228
|
+
The page draws the overlay and updates it four times a second. A held engine for image tests shows no overlay.
|
|
229
|
+
|
|
230
|
+
The header stays in the corner when the card opens, and the card opens under it or above it, aligned to the right. At the bottom right, the header sits at the bottom of the part of the canvas that is on screen. So a canvas taller than the screen, or a full-screen canvas under a phone browser's toolbar, still shows it. There it keeps clear of a phone's home bar, on a page whose viewport reaches under it (`viewport-fit=cover`).
|
|
210
231
|
|
|
211
|
-
The
|
|
232
|
+
The card's height stops at the room on screen beside the header, and the figures under its tabs scroll past that. The header of the card and its tabs always show. The room is the screen's, so a card over a small canvas can run past the canvas onto the page. Only the header button, the card's two symbols, its tab buttons and figures that scroll take the pointer. Drags anywhere else on the overlay reach the canvas.
|
|
212
233
|
|
|
213
234
|
### The card
|
|
214
235
|
|
|
215
|
-
The card is 360 pixels wide and takes its height from the tab that shows, so a short tab leaves no empty card. Switching tabs can therefore make the card taller or shorter. Four tabs show one section at a time: `Frame`, `Memory`, `Steps` and `Systems`.
|
|
236
|
+
The card is 360 pixels wide and takes its height from the tab that shows, so a short tab leaves no empty card. Switching tabs can therefore make the card taller or shorter. Four tabs show one section at a time: `Frame`, `Memory`, `Steps` and `Systems`.
|
|
237
|
+
|
|
238
|
+
A click on a tab shows it, the arrow keys move between tabs, and Home and End go to the first and last. The card's own header keeps these figures in view on every tab: the mode's symbol, the display's symbol, the display's refresh rate and the target with its interval, such as `120 Hz ≥60 fps · 16.7 ms` (or `60 fps · 16.7 ms` where the target is the display's full rate).
|
|
216
239
|
|
|
217
240
|
| Tab | What it shows |
|
|
218
241
|
| --- | --- |
|
|
@@ -223,17 +246,29 @@ The card is 360 pixels wide and takes its height from the tab that shows, so a s
|
|
|
223
246
|
|
|
224
247
|
The overlay updates every tab on each refresh, so a tab shows current figures the moment it is chosen. It gathers nothing extra for a tab that does not show: the figures come from the frame records that the engine writes anyway and from the same GPU timing pass, whichever tab is open.
|
|
225
248
|
|
|
226
|
-
|
|
249
|
+
### The target
|
|
250
|
+
|
|
251
|
+
The overlay judges each frame against the engine's own [target frame rate](../concepts/quality-presets.md#the-target-frame-rate): the one that the preset check and the quality governor defend. It is the display's refresh rate, at most 60 frames a second, unless the page's `targetFps` option asks for more. The `?fps=` switch caps it too. The engine still draws at the display's full rate when the GPU allows it.
|
|
227
252
|
|
|
228
|
-
|
|
253
|
+
So on a 120 Hz display the card reads `120 Hz ≥60 fps · 16.7 ms`: the engine draws up to 120 frames per second and defends 60. With `targetFps: 'display'`, the same card reads `120 fps · 8.3 ms`.
|
|
254
|
+
|
|
255
|
+
The display symbol is a button whose tooltip explains the figures, as the mode's symbol does.
|
|
256
|
+
|
|
257
|
+
### The work bars
|
|
258
|
+
|
|
259
|
+
Each thread has its own bar, because the threads run at the same time. The bars come in this order: `Sketch`, `Drawing`, `Jobs`, `Page`, then `GPU`. A thread that the engine's thread mode does not run has no bar. Every bar spans twice the target's interval, so the target's dark mark sits in the middle of each. Where the display refreshes faster than the target, a faint second mark shows the display's interval, such as 8.3 ms at 120 Hz. Each bar is colored by who did the work:
|
|
229
260
|
|
|
230
261
|
- Your code: the sketch's own callbacks, the `update` phase.
|
|
231
262
|
- Engine: every other phase on the thread, such as commands, culling, recording, uploads and replay.
|
|
232
263
|
- GPU: the GPU's time, from one frame in eleven.
|
|
233
264
|
|
|
234
|
-
A bar stacks parts only where the parts add up to the time beside it. A thread's phases run one after another, so they stack. The `Jobs` bar shows the slowest job worker, with the count of job workers that run beside its name, such as `Jobs ×6`.
|
|
265
|
+
A bar stacks parts only where the parts add up to the time beside it. A thread's phases run one after another, so they stack. The `Jobs` bar shows the slowest job worker, with the count of job workers that run beside its name, such as `Jobs ×6`.
|
|
266
|
+
|
|
267
|
+
The engine starts job workers only as the work grows, so a small scene shows no `Jobs` bar. The job workers share one step of the frame, and the frame waits for the slowest of them. So a sum or a mean would mislead.
|
|
235
268
|
|
|
236
|
-
|
|
269
|
+
### The thread modes
|
|
270
|
+
|
|
271
|
+
The first symbol is a button whose tooltip explains the mode. The tooltip shows while the pointer is on the symbol or the symbol has the keyboard's focus, and a tap shows or hides it.
|
|
237
272
|
|
|
238
273
|
| Mode | Symbol | Bars |
|
|
239
274
|
| --- | --- | --- |
|
|
@@ -241,13 +276,27 @@ A bar stacks parts only where the parts add up to the time beside it. A thread's
|
|
|
241
276
|
| Low latency | A clock | One thread prepares and then draws each frame. One bar, `Sketch + drawing`, stacks your code, the engine's sketch steps, then the drawing, and must fit the target |
|
|
242
277
|
| Single thread | A clock | Without shared memory, the page's thread prepares and draws each frame. It shows as one `Sketch + drawing` bar too |
|
|
243
278
|
|
|
244
|
-
|
|
279
|
+
### The colors
|
|
280
|
+
|
|
281
|
+
A work bar's parts are blue for your code, purple for the engine's work, and green for the GPU. The memory bar keeps those meanings: purple for the engine's memory, green for the GPU's textures and buffers, and blue for the page's JavaScript heap. The chrome is amber: the active tab's underline, the header's border and the whole-page note's dot mark it.
|
|
282
|
+
|
|
283
|
+
A work bar's time is green below 80% of the target's interval, amber up to the interval, and red past it. The ring gauge in the header fills with the frame rate as a share of the target. It is green from 90% of the target, the share that a preset must hold in the preset check. It is amber from 75%, and red below.
|
|
284
|
+
|
|
285
|
+
### Held back by
|
|
286
|
+
|
|
287
|
+
While the frame rate is below 90% of the target, a line under the GPU bar names the bar furthest past the target's mark: `Held back by: GPU`, `Drawing`, `Sketch`, `Sketch + drawing`, `Jobs` or `Page`. When no bar passes the mark, it reads `Held back by: outside the engine`. The rest of the page's code, or the browser, then holds the frame back.
|
|
245
288
|
|
|
246
|
-
|
|
289
|
+
### The add-ons' rows
|
|
247
290
|
|
|
248
|
-
|
|
291
|
+
A feature that an add-on declares with `settings`, `budget`, `gpu` or `memory` gets one row in the Steps tab, such as `water gpu 0.42 ms reflectionEvery 1 budget 1.7 of 1.7 ms`. The row names the feature, its one GPU timing scope, its own settings, its budget and the memory that it reports. The budget shows now and at full quality. A feature names its GPU scope with the render passes that carry its work, and the overlay adds up their time.
|
|
249
292
|
|
|
250
|
-
|
|
293
|
+
A feature whose work records inside a pass of the engine's own reads `gpu not measured`. On WebGL2 no pass is timed alone, so every feature reads that. [Add-on feature descriptions](features.md#stats) explains the figures.
|
|
294
|
+
|
|
295
|
+
### Figures that the browser gives
|
|
296
|
+
|
|
297
|
+
The frame rate, the work bars, the engine's and the GPU's memory and the counts show in every browser that runs the engine. The page's JavaScript heap comes from `performance.memory`, and the whole page's memory from `performance.measureUserAgentSpecificMemory`. Some browsers have neither. Where the browser lacks one, the overlay leaves it out, and the memory total adds up what it lists. Where the GPU path has no timer queries, the GPU bar reads `not measured` and stays empty.
|
|
298
|
+
|
|
299
|
+
### Frame figures in the sketch
|
|
251
300
|
|
|
252
301
|
`debug.frameStats()` gives the sketch the engine's figures that the overlay shows. Each figure per frame is a mean over the frames of the last window, about half a second of presented frames. The figures change when a window ends. Only the page can measure its JavaScript heap and its memory, so those figures show only on the overlay.
|
|
253
302
|
|
|
@@ -294,7 +343,8 @@ The engine counts every draw of every pass on the thread that draws. That covers
|
|
|
294
343
|
|
|
295
344
|
- A draw of triangles adds its vertices or indices over 3, times its instances. A draw of lines adds no triangles.
|
|
296
345
|
- A draw adds its instances to `objects`. So an object counts once in each pass that draws it. A box that casts shadows into 4 cascades counts 5 times, and 6 with the depth prepass. Each part of a mesh with several materials counts once, because each part is an object of its own.
|
|
297
|
-
- On WebGPU, the GPU culls most objects itself, and only the GPU knows how many it drew. The engine copies those counts back from the GPU on one frame in eleven. It does so while the overlay's card is open, and after the sketch's first call of `debug.frameStats()`.
|
|
346
|
+
- On WebGPU, the GPU culls most objects itself, and only the GPU knows how many it drew. The engine copies those counts back from the GPU on one frame in eleven. It does so while the overlay's card is open, and after the sketch's first call of `debug.frameStats()`.
|
|
347
|
+
- A development build copies them back in any case, so that it can warn about copies that the culling shader drops. The counts arrive a few frames late, and each frame adds the newest of them. Until then, the WebGPU figures count only the draws that the CPU issues.
|
|
298
348
|
- So in a production build on WebGPU, `engine.measure` counts only the draws that the CPU issues, unless the card is open or the sketch has called `debug.frameStats()`. A scene that the GPU culls can then show almost no triangles. Call `debug.frameStats()` once in the sketch to count them all, at the cost that [Cost](#cost) gives.
|
|
299
349
|
|
|
300
350
|
### Memory figures
|
|
@@ -307,11 +357,31 @@ The engine counts every draw of every pass on the thread that draws. That covers
|
|
|
307
357
|
| `JS heap` | The JavaScript heap of the page's own thread, from `performance.memory`, where the browser gives it |
|
|
308
358
|
| Whole page | The memory of the whole page and its workers, from `performance.measureUserAgentSpecificMemory`, where the browser gives it |
|
|
309
359
|
|
|
310
|
-
The memory bar's parts add up to the total beside `Memory`. The whole page's figure is not that total, so it has its own line.
|
|
360
|
+
The memory bar's parts add up to the total beside `Memory`. The whole page's figure is not that total, so it has its own line. Beside the browser's figure, the overlay gives the figure with the shared memory counted once.
|
|
361
|
+
|
|
362
|
+
`measurePageMemory()` from `@null3d/engine/stats` takes one measurement the same way, for a page that wants the browser's own breakdown. Until the first one ends, the line reads `measuring`. The page asks for one measurement at a time. If the browser never answers, the line hides.
|
|
363
|
+
|
|
364
|
+
<details>
|
|
365
|
+
<summary>Technical details: how the page measures its memory</summary>
|
|
366
|
+
|
|
367
|
+
The browser counts a shared memory once for each thread that holds it. Every engine thread holds the engine's WebAssembly memory, so the browser's figure counts it many times. The browser answers once every worker has run the measurement, or after about a minute.
|
|
368
|
+
|
|
369
|
+
While a measurement runs, the engine's idle job workers leave the job loop to run it between frame jobs, so it does not wait on them. When no answer comes within two minutes of the first request, the page asks no more for the rest of its life. An answer that comes later still shows.
|
|
370
|
+
|
|
371
|
+
</details>
|
|
372
|
+
|
|
373
|
+
### Memory by system
|
|
374
|
+
|
|
375
|
+
`Memory by system` is a development build's list of each engine table and allocator. Each row gives three figures: the bytes that the area uses, reserves and has used at most. Each figure's tooltip gives its exact bytes.
|
|
376
|
+
|
|
377
|
+
The register runs only while the card is open, and only in a development build, so a production page pays nothing for it. The figures name faults that a single memory total hides: a table that keeps a high-water mark after a scene shrinks shows in its peak, and an arena that grew for a frame shows the same.
|
|
378
|
+
|
|
379
|
+
<details>
|
|
380
|
+
<summary>Technical details: the tables of Memory by system</summary>
|
|
311
381
|
|
|
312
|
-
|
|
382
|
+
The rows cover the scene's own rows and world output, the instance batches, the grid cells, the level table and the frame builder's bucket-key scratch. After them come the shadow casters' table, the other draw tables, the upload arenas, the recorded draw lists and the animation table.
|
|
313
383
|
|
|
314
|
-
|
|
384
|
+
</details>
|
|
315
385
|
|
|
316
386
|
### GPU memory
|
|
317
387
|
|
|
@@ -332,21 +402,21 @@ A texture counts every mip level of every layer, as the GPU stores it. A compres
|
|
|
332
402
|
- With the overlay hidden and no call of `debug.frameStats()`, the figures cost the frame almost nothing. The engine's threads write them anyway, for `engine.measure`. The counts of triangles and objects add a few operations per draw call.
|
|
333
403
|
- With the card closed, the overlay costs nothing more. Its header reads the frame rate from the frame intervals that the engine records anyway. It times nothing on the GPU, reads nothing back and measures no memory.
|
|
334
404
|
- While the card is open, the engine times one frame in eleven on the GPU, as `engine.measure` does. On WebGPU it also copies the counts of the culled draws back on those frames. The sketch thread publishes the memory of textures and meshes in the first frame that samples, then every eighth frame. The thread that draws copies its two GPU memory totals each frame, and the page measures its own memory. Closing the card stops all of it.
|
|
335
|
-
- The sketch's first call of `debug.frameStats()` turns the same sampling on for the rest of the engine's life. Reading the figures allocates nothing, so a sketch can call it every frame.
|
|
405
|
+
- The sketch's first call of `debug.frameStats()` turns the same sampling on for the rest of the engine's life. Reading the figures allocates nothing, so a sketch can call it every frame. The engine's allocation benchmark checks it in every frame.
|
|
336
406
|
- The overlay's code downloads at its first showing, and the figures' code at the first call of `debug.frameStats()` or the overlay's first showing. Pages that never call them download neither.
|
|
337
407
|
- Both work in every build, production builds included. A development build's figures include the cost of its development checks, so read frame times from a production build ([Measure fairly](../guides/performance.md#measure-fairly)).
|
|
338
408
|
- The overlay lives in a shadow root with its own style sheet, so the page's styles do not change it. It works under a Content Security Policy without `'unsafe-inline'`.
|
|
339
409
|
|
|
340
410
|
### The same overlay for another engine
|
|
341
411
|
|
|
342
|
-
`@null3d/engine/stats` exports the overlay's panel, its figure types, a text layout of the figures and the page's meters. A page that draws with another engine, such as three.js, shows its own figures in the same panel. The same code measures both engines' page figures, so a comparison of the two stays fair.
|
|
412
|
+
`@null3d/engine/stats` exports the overlay's panel, its figure types, a text layout of the figures and the page's meters. A page that draws with another engine, such as three.js, shows its own figures in the same panel. The same code measures both engines' page figures, so a comparison of the two stays fair. The [battle comparison](https://github.com/null3d-engine/null3d/tree/main/examples/compare/battle) shows the panel over its three.js half.
|
|
343
413
|
|
|
344
|
-
`new StatsPanel(canvas, options)` puts the panel over the canvas's top-right corner, as the engine puts its overlay. Its header button opens and closes the card. `collapsed: true` starts it closed. `onToggle` tells the page when it opens or closes, so the page measures its costly figures only while the card is open.
|
|
414
|
+
`new StatsPanel(canvas, options)` puts the panel over the canvas's top-right corner, as the engine puts its overlay. Its header button opens and closes the card. The option `collapsed: true` starts it closed. The option `corner: 'bottom-right'` puts it over the canvas's bottom-right corner. The callback `onToggle` tells the page when it opens or closes, so the page measures its costly figures only while the card is open.
|
|
345
415
|
|
|
346
416
|
- `showRate(frames, fps, refreshHz, maxTargetFps?)` shows the frame rate in the header.
|
|
347
417
|
- `update(figures, frame)` shows a set of figures in the card. `frame` gives the display's refresh rate, whether the GPU's work is timed, and how the threads share each frame. A renderer that prepares and draws each frame on one thread passes `mode: 'one-thread'`. It names that thread in `bothSteps`.
|
|
348
|
-
- `follow()` keeps the panel on the canvas's corner. Call it as the figures come.
|
|
349
|
-
- `setCollapsed(collapsed)` opens or closes the card from code, and `remove()` takes the panel off the page.
|
|
418
|
+
- `follow()` keeps the panel on the canvas's corner and the card within the screen. Call it as the figures come.
|
|
419
|
+
- `setCollapsed(collapsed)` opens or closes the card from code, `setCorner(corner)` moves the panel to the other corner, and `remove()` takes the panel off the page.
|
|
350
420
|
|
|
351
421
|
The panel judges the figures against the engine's own target: the display's refresh rate, at most 60 frames a second. A page that sets null3D's `targetFps` to a higher rate passes the same highest target as `maxTargetFps`, in `showRate` and in `frame`. A figure that the page does not know is `null`, and the card leaves it out.
|
|
352
422
|
|
|
@@ -443,7 +513,7 @@ These figures time the GPU's work only. Work that the browser does outside the p
|
|
|
443
513
|
|
|
444
514
|
## The in-page inspector
|
|
445
515
|
|
|
446
|
-
`?inspect` opens a panel over the canvas that lists the scene's objects, outlines the one you select and edits its fields. On the page, `engine.inspect(call, args)` runs the same calls from your own code, and `window.__null3dInspector` holds them for the MCP server. These exist in a development build only. A held page or a replay publishes no bridge and opens no panel. [The in-page inspector](../guides/debugging.md#the-in-page-inspector) lists the calls.
|
|
516
|
+
`?inspect` opens a panel at the left edge of the page, over the canvas, that lists the scene's objects, outlines the one you select and edits its fields. On the page, `engine.inspect(call, args)` runs the same calls from your own code, and `window.__null3dInspector` holds them for [the MCP server](../guides/debugging.md#the-mcp-server), which lets a coding agent read and change the scene. These exist in a development build only. A held page or a replay publishes no bridge and opens no panel. [The in-page inspector](../guides/debugging.md#the-in-page-inspector) lists the calls.
|
|
447
517
|
|
|
448
518
|
## API reference
|
|
449
519
|
|