@null3d/engine 0.0.0 → 0.1.0
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 +19 -6
- package/dist/wasm/single/null3d_bg.wasm +0 -0
- package/dist/wasm/threaded/null3d.js +19 -6
- package/dist/wasm/threaded/null3d_bg.wasm +0 -0
- package/docs/api/animation.md +23 -67
- package/docs/api/assets.md +42 -26
- package/docs/api/cameras.md +8 -6
- package/docs/api/controls.md +46 -44
- package/docs/api/debug.md +13 -8
- package/docs/api/engine.md +17 -11
- package/docs/api/feature-draws.md +3 -3
- package/docs/api/feature-effects.md +3 -3
- package/docs/api/feature-instances.md +2 -2
- package/docs/api/features.md +14 -15
- package/docs/api/geometry.md +56 -75
- package/docs/api/grass.md +1 -1
- package/docs/api/impostors.md +120 -9
- package/docs/api/input.md +4 -11
- package/docs/api/lights.md +14 -38
- package/docs/api/lines.md +8 -25
- package/docs/api/materials.md +69 -70
- package/docs/api/math.md +6 -7
- package/docs/api/objects.md +13 -13
- package/docs/api/particles.md +2 -14
- package/docs/api/points.md +3 -25
- package/docs/api/post.md +22 -23
- package/docs/api/quality.md +11 -6
- package/docs/api/raycast.md +13 -32
- package/docs/api/reference/animation.md +9 -9
- package/docs/api/reference/assets.md +18 -18
- package/docs/api/reference/cameras.md +5 -2
- package/docs/api/reference/controls.md +75 -23
- package/docs/api/reference/debug.md +23 -8
- package/docs/api/reference/engine.md +22 -10
- package/docs/api/reference/geometry.md +161 -82
- package/docs/api/reference/grass.md +1 -1
- package/docs/api/reference/impostors.md +92 -1
- package/docs/api/reference/input.md +3 -3
- package/docs/api/reference/lights.md +9 -9
- package/docs/api/reference/lines.md +7 -7
- package/docs/api/reference/materials.md +48 -48
- package/docs/api/reference/math.md +22 -22
- package/docs/api/reference/objects.md +9 -9
- package/docs/api/reference/points.md +4 -4
- package/docs/api/reference/post.md +18 -18
- package/docs/api/reference/quality.md +7 -3
- package/docs/api/reference/raycast.md +6 -6
- package/docs/api/reference/render.md +2 -2
- package/docs/api/reference/scene.md +29 -26
- package/docs/api/reference/sketch.md +4 -0
- package/docs/api/reference/sound.md +203 -0
- package/docs/api/reference/sprites.md +5 -5
- package/docs/api/reference/terrain.md +2 -1
- package/docs/api/reference/textures.md +4 -4
- package/docs/api/reference/ui.md +3 -3
- package/docs/api/reference/vertex-draws.md +3 -3
- package/docs/api/reference/water.md +77 -6
- package/docs/api/reference/wind.md +2 -2
- package/docs/api/render.md +12 -10
- package/docs/api/scene.md +40 -29
- package/docs/api/sketch.md +64 -3
- package/docs/api/sound.md +169 -0
- package/docs/api/splats.md +7 -0
- package/docs/api/sprites.md +4 -20
- package/docs/api/tasks.md +2 -2
- package/docs/api/terrain.md +2 -14
- package/docs/api/textures.md +9 -9
- package/docs/api/ui.md +3 -15
- package/docs/api/water.md +198 -15
- package/docs/api/wind.md +5 -5
- package/docs/cli/null3d.md +93 -18
- package/docs/concepts/architecture.md +10 -10
- package/docs/concepts/assets.md +2 -19
- package/docs/concepts/backends.md +7 -5
- package/docs/concepts/color-management.md +15 -26
- package/docs/concepts/culling.md +1 -1
- package/docs/concepts/instances.md +5 -5
- package/docs/concepts/large-worlds.md +1 -1
- package/docs/concepts/lighting.md +50 -55
- package/docs/concepts/lod.md +2 -15
- package/docs/concepts/materials.md +16 -16
- package/docs/concepts/post-processing.md +7 -29
- package/docs/concepts/quality-preset-tables.md +53 -50
- package/docs/concepts/quality-presets.md +56 -27
- package/docs/concepts/render-graph.md +19 -14
- package/docs/concepts/render-layers.md +3 -17
- package/docs/concepts/shadows.md +10 -28
- package/docs/concepts/static-dynamic.md +2 -2
- package/docs/cookbook/index.md +1 -1
- package/docs/data/threejs-mapping.json +136 -102
- package/docs/errors/E1214.md +3 -3
- package/docs/errors/E1307.md +23 -0
- package/docs/errors/E1420.md +3 -3
- package/docs/errors/index.md +3 -2
- package/docs/getting-started/cdn.md +17 -1
- package/docs/getting-started/first-scene.md +1 -1
- package/docs/getting-started/hosting.md +50 -9
- package/docs/getting-started/install.md +8 -7
- package/docs/getting-started/network-use.md +10 -2
- package/docs/getting-started/project-structure.md +15 -6
- package/docs/getting-started/third-party-notices.md +8 -6
- package/docs/guides/accessibility.md +1 -1
- package/docs/guides/add-ons.md +3 -2
- package/docs/guides/agents.md +16 -5
- package/docs/guides/assets-pipeline.md +13 -12
- package/docs/guides/audio.md +109 -124
- package/docs/guides/car-paint.md +1 -1
- package/docs/guides/content-pages.md +10 -6
- package/docs/guides/custom-passes.md +9 -8
- package/docs/guides/custom-shaders.md +6 -3
- package/docs/guides/debugging.md +78 -4
- package/docs/guides/deploying.md +105 -5
- package/docs/guides/deterministic-simulation.md +1 -1
- package/docs/guides/first-use-shaders.md +4 -4
- package/docs/guides/loading-screens.md +78 -33
- package/docs/guides/multiple-views.md +41 -2
- package/docs/guides/performance.md +6 -3
- package/docs/guides/phones.md +12 -1
- package/docs/guides/physics.md +1 -1
- package/docs/guides/screens.md +7 -5
- package/docs/guides/start-time.md +328 -0
- package/docs/guides/testing.md +23 -5
- package/docs/guides/ui-overlays.md +3 -3
- package/docs/index.md +12 -8
- package/docs/pages.md +26 -23
- package/docs/porting/react-three-fiber.md +228 -5
- package/docs/porting/threejs-loop-and-threads.md +220 -6
- package/docs/porting/threejs-mapping.md +86 -84
- package/docs/porting/threejs-materials.md +212 -5
- package/docs/porting/threejs-overview.md +218 -5
- package/docs/porting/threejs-postprocessing.md +2 -2
- package/docs/porting/threejs-shaders.md +298 -5
- package/docs/porting/threejs-unsupported.md +82 -6
- package/docs/porting/verification.md +181 -5
- package/docs/shaders/builtins.md +1 -1
- package/docs/shaders/library.md +63 -39
- package/docs/shaders/surface-functions.md +11 -10
- package/docs/shaders/wgsl-rules.md +1 -1
- package/lib/debug/channel.d.ts +103 -0
- package/lib/debug/channel.js +269 -0
- package/lib/debug/debug.d.ts +9 -7
- package/lib/debug/draw.d.ts +9 -0
- package/lib/debug/draw.js +49 -2
- package/lib/debug/inspector.d.ts +60 -0
- package/lib/debug/inspector.js +475 -0
- package/lib/debug/stats-panel.d.ts +1 -1
- package/lib/debug/stats.d.ts +2 -3
- package/lib/errors/codes.js +8 -2
- package/lib/errors/engine-error.js +25 -10
- package/lib/errors/fixes.d.ts +1 -0
- package/lib/errors/fixes.js +3 -2
- 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/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 +4 -1
- 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 +15 -1
- package/lib/index.d.ts +6 -4
- 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 +7 -7
- 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 +103 -26
- package/lib/page/engine.js +420 -97
- 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 +17 -10
- 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/switches.d.ts +32 -2
- package/lib/page/switches.js +9 -1
- 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/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 +1 -1
- package/lib/scene/fog.d.ts +11 -4
- package/lib/scene/fog.js +8 -2
- package/lib/scene/frame-cameras.d.ts +19 -0
- package/lib/scene/frame-cameras.js +58 -0
- package/lib/scene/gltf.d.ts +32 -2
- 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 +120 -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/picks.d.ts +2 -2
- package/lib/scene/pointer-events.d.ts +4 -7
- package/lib/scene/post.d.ts +38 -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 +225 -254
- package/lib/scene/resources.js +179 -81
- package/lib/scene/scene.d.ts +149 -118
- package/lib/scene/scene.js +196 -98
- 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 +3 -4
- package/lib/scene/time-of-day.js +2 -3
- 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/metrics.d.ts +38 -0
- package/lib/shared/metrics.js +62 -1
- package/lib/shared/run-task.js +7 -1
- 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 +35 -0
- 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 +76 -9
- package/lib/sketch/runner.js +385 -52
- package/lib/sketch/ui.d.ts +5 -8
- package/lib/workers/probe-worker.d.ts +5 -0
- package/lib/workers/probe-worker.js +13 -4
- package/lib/workers/protocol.d.ts +61 -13
- package/lib/workers/protocol.js +4 -0
- package/lib/workers/render-worker.js +25 -4
- package/lib/workers/sketch-worker.js +104 -15
- package/package.json +2 -2
package/lib/scene/lut.js
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* A color grading table, which `assets.loadLut` loads from a file and `assets.lutFromData` makes
|
|
6
6
|
* from numbers. It is a 3D texture that maps each color of the picture to its graded color. Give
|
|
7
|
-
* it to `post.set({ lut })`, which applies it to every pixel after the tone mapping
|
|
8
|
-
* `LUTPass` does.
|
|
7
|
+
* it to `post.set({ lut })`, which applies it to every pixel after the tone mapping.
|
|
9
8
|
*
|
|
10
9
|
* @category api/assets
|
|
11
10
|
*/
|
package/lib/scene/picks.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export interface PickHit {
|
|
|
14
14
|
instance: number;
|
|
15
15
|
/**
|
|
16
16
|
* Where on the surface the pixel landed, as the first texture coordinates of the hit triangle
|
|
17
|
-
* blended across its three corners
|
|
18
|
-
*
|
|
17
|
+
* blended across its three corners. Read `hasUv` first: the numbers mean nothing when it is
|
|
18
|
+
* false.
|
|
19
19
|
*/
|
|
20
20
|
uv?: Vec2Like;
|
|
21
21
|
/**
|
|
@@ -40,16 +40,13 @@ export interface ObjectPointerEvent {
|
|
|
40
40
|
readonly normal: Vec3Like;
|
|
41
41
|
/** The distance from the ray's origin to the hit, in meters. */
|
|
42
42
|
readonly distance: number;
|
|
43
|
-
/**
|
|
44
|
-
* The index of the hit triangle in its mesh, as three.js's `faceIndex`, or -1 for a sprite, a
|
|
45
|
-
* point or a line.
|
|
46
|
-
*/
|
|
43
|
+
/** The index of the hit triangle in its mesh, or -1 for a sprite, a point or a line. */
|
|
47
44
|
readonly triangle: number;
|
|
48
45
|
/**
|
|
49
46
|
* Where on the surface the ray hit, as the first texture coordinates of the hit triangle
|
|
50
|
-
* blended across its three corners
|
|
51
|
-
*
|
|
52
|
-
*
|
|
47
|
+
* blended across its three corners. Read `hasUv` first: the numbers mean nothing when it is
|
|
48
|
+
* false. An in-world screen turns a click into a texel of its image with these, without working
|
|
49
|
+
* out where the surface lies in space.
|
|
53
50
|
*/
|
|
54
51
|
readonly uv: Vec2Like;
|
|
55
52
|
/**
|
package/lib/scene/post.d.ts
CHANGED
|
@@ -13,11 +13,12 @@ import { ShaderTemplates } from './shader-templates.js';
|
|
|
13
13
|
import type { UniformValues } from './wgsl-uniforms.js';
|
|
14
14
|
export type { GradingSettings, SplitToningSettings, WhiteBalanceSettings, } from './grading.js';
|
|
15
15
|
/**
|
|
16
|
-
* How the engine maps the scene's high dynamic range color to the screen.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* How the engine maps the scene's high dynamic range color to the screen. The `'agx'` curve is
|
|
17
|
+
* AgX, the curve of Blender and Filament. The `'agx-punchy'` curve is AgX with Filament's punchy
|
|
18
|
+
* look, which adds contrast and color. The `'neutral'` curve is Khronos PBR Neutral, which keeps
|
|
19
|
+
* base colors as they are until they near white. The `'aces'` curve is a fit of the ACES filmic
|
|
20
|
+
* curve, which first scales the color by 1 / 0.6 and shifts the hues of bright colors. The value
|
|
21
|
+
* `'none'` clips the exposed color at 1.
|
|
21
22
|
*
|
|
22
23
|
* @category api/post
|
|
23
24
|
*/
|
|
@@ -39,9 +40,9 @@ export type ToneCurve = CompiledWgsl | `${string}toneCurve${string}`;
|
|
|
39
40
|
export declare function exposureOfEv100(ev100: number): number;
|
|
40
41
|
/**
|
|
41
42
|
* How bloom's glow meets the scene's color. The `'mix'` blend moves each pixel's color toward the
|
|
42
|
-
* glow by the intensity, which keeps the image's total light. The `'add'` blend adds the glow,
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* glow by the intensity, which keeps the image's total light. The `'add'` blend adds the glow, so
|
|
44
|
+
* the image gains light. The `'screen'` blend screens it, so the glow adds less where the scene is
|
|
45
|
+
* already bright.
|
|
45
46
|
*
|
|
46
47
|
* @category api/post
|
|
47
48
|
*/
|
|
@@ -82,7 +83,7 @@ export interface BloomSettings {
|
|
|
82
83
|
weights?: readonly number[];
|
|
83
84
|
}
|
|
84
85
|
/**
|
|
85
|
-
* Ambient occlusion's settings,
|
|
86
|
+
* Ambient occlusion's settings, for ground-truth ambient occlusion (GTAO). A setting that a call
|
|
86
87
|
* leaves out keeps its value.
|
|
87
88
|
*
|
|
88
89
|
* @category api/post
|
|
@@ -90,7 +91,7 @@ export interface BloomSettings {
|
|
|
90
91
|
export interface AoSettings {
|
|
91
92
|
/**
|
|
92
93
|
* How far from a surface the search for what hides it reaches, in world units: 0 or more, and
|
|
93
|
-
* 0.25 by default
|
|
94
|
+
* 0.25 by default.
|
|
94
95
|
*/
|
|
95
96
|
radius?: number;
|
|
96
97
|
/**
|
|
@@ -105,8 +106,7 @@ export interface AoSettings {
|
|
|
105
106
|
*/
|
|
106
107
|
distanceExponent?: number;
|
|
107
108
|
/**
|
|
108
|
-
* From 0 to 1: how much less the farther steps of the search count. It is 1 by default
|
|
109
|
-
* `GTAOPass`'s `distanceFallOff`.
|
|
109
|
+
* From 0 to 1: how much less the farther steps of the search count. It is 1 by default.
|
|
110
110
|
*/
|
|
111
111
|
distanceFalloff?: number;
|
|
112
112
|
/** The power that the occlusion is raised to: 0 or more, and 1 by default. Above 1 it darkens. */
|
|
@@ -117,33 +117,31 @@ export interface AoSettings {
|
|
|
117
117
|
*/
|
|
118
118
|
samples?: number;
|
|
119
119
|
/**
|
|
120
|
-
* From 0 to 1: how much of the occlusion reaches the ambient light. It is 1 by default
|
|
121
|
-
* `GTAOPass`'s `blendIntensity`.
|
|
120
|
+
* From 0 to 1: how much of the occlusion reaches the ambient light. It is 1 by default.
|
|
122
121
|
*/
|
|
123
122
|
intensity?: number;
|
|
124
123
|
}
|
|
125
124
|
/**
|
|
126
|
-
* Screen-space reflections' settings
|
|
127
|
-
* call leaves out keeps its value.
|
|
125
|
+
* Screen-space reflections' settings. A setting that a call leaves out keeps its value.
|
|
128
126
|
*
|
|
129
127
|
* @category api/post
|
|
130
128
|
*/
|
|
131
129
|
export interface SsrSettings {
|
|
132
130
|
/**
|
|
133
131
|
* From 0 to 1: how much of the environment's reflection the screen's reflection replaces where
|
|
134
|
-
* a ray hits, and 1 by default
|
|
135
|
-
*
|
|
132
|
+
* a ray hits, and 1 by default. The material's Fresnel term, metalness and specular values
|
|
133
|
+
* still weigh the reflection.
|
|
136
134
|
*/
|
|
137
135
|
intensity?: number;
|
|
138
136
|
/**
|
|
139
|
-
* How far a reflected ray travels, in world units: above 0, and 100 by default
|
|
140
|
-
*
|
|
137
|
+
* How far a reflected ray travels, in world units: above 0, and 100 by default. Reflections
|
|
138
|
+
* fade out over the last fifth of it.
|
|
141
139
|
*/
|
|
142
140
|
maxDistance?: number;
|
|
143
141
|
/**
|
|
144
|
-
* How far behind a surface on the screen a ray may pass and still hit it, in world units
|
|
145
|
-
* more, and 0.5 by default
|
|
146
|
-
*
|
|
142
|
+
* How far behind a surface on the screen a ray may pass and still hit it, in world units. It is
|
|
143
|
+
* 0 or more, and 0.5 by default. Thin objects need a small value, or objects behind them
|
|
144
|
+
* reflect as if they were solid.
|
|
147
145
|
*/
|
|
148
146
|
thickness?: number;
|
|
149
147
|
/**
|
|
@@ -316,23 +314,22 @@ export interface PostSettings {
|
|
|
316
314
|
/**
|
|
317
315
|
* How the engine maps high dynamic range color to the screen: a built-in curve's name, or a
|
|
318
316
|
* custom tone curve's WGSL. The default is `'agx-punchy'`, which keeps the hues of bright colors
|
|
319
|
-
* on their way to white and keeps the picture's contrast.
|
|
320
|
-
*
|
|
321
|
-
* color, as bloom does; on a device without an HDR target the built-in curve stays.
|
|
317
|
+
* on their way to white and keeps the picture's contrast. A custom curve needs HDR color, as
|
|
318
|
+
* bloom does; on a device without an HDR target the built-in curve stays.
|
|
322
319
|
*/
|
|
323
320
|
toneMapping?: ToneMapping | ToneCurve;
|
|
324
321
|
/**
|
|
325
|
-
* Scales the scene's color before the tone mapping,
|
|
326
|
-
*
|
|
327
|
-
*
|
|
322
|
+
* Scales the scene's color before the tone mapping: 2 is one stop brighter, and 0.5 one stop
|
|
323
|
+
* darker. It is 0 or more, and 1 by default. With `ev100`, it scales the camera's exposure, as
|
|
324
|
+
* exposure compensation does.
|
|
328
325
|
*/
|
|
329
326
|
exposure?: number;
|
|
330
327
|
/**
|
|
331
328
|
* The camera's exposure value at ISO 100, for lights in real units: 15 suits a sunny day lit by
|
|
332
329
|
* a sun of 100,000 lux, 12 an overcast day, and 7 a lit room. It scales the scene's color by
|
|
333
330
|
* 1 / (1.2 × 2^ev100), as Filament and Bevy do, so each step up is one stop darker. It is a
|
|
334
|
-
* number from -20 to 30,
|
|
335
|
-
*
|
|
331
|
+
* number from -20 to 30. The default, `false`, turns it off, for scenes whose lights have small
|
|
332
|
+
* intensities, such as a sun of 3.
|
|
336
333
|
*/
|
|
337
334
|
ev100?: number | false;
|
|
338
335
|
/**
|
|
@@ -343,21 +340,20 @@ export interface PostSettings {
|
|
|
343
340
|
bloom?: BloomSettings | false;
|
|
344
341
|
/**
|
|
345
342
|
* Ambient occlusion: darkens the ambient light where nearby surfaces hide a surface from the
|
|
346
|
-
* sky,
|
|
347
|
-
*
|
|
348
|
-
* and `false` turns it off. It is off by default, and draws only where the
|
|
349
|
-
* `aoScale` is above 0.
|
|
343
|
+
* sky, found with ground-truth ambient occlusion (GTAO). It darkens only the light that comes
|
|
344
|
+
* from all around, so direct light keeps its strength. Settings turn it on, `{}` with the
|
|
345
|
+
* values it had, and `false` turns it off. It is off by default, and draws only where the
|
|
346
|
+
* quality setting `aoScale` is above 0.
|
|
350
347
|
*/
|
|
351
348
|
ao?: AoSettings | false;
|
|
352
349
|
/**
|
|
353
350
|
* A color grading table from `assets.loadLut` or `assets.lutFromData`, which maps each pixel's
|
|
354
|
-
* color after the tone mapping
|
|
355
|
-
* by default.
|
|
351
|
+
* color after the tone mapping. `false` turns it off. It is off by default.
|
|
356
352
|
*/
|
|
357
353
|
lut?: Lut | false;
|
|
358
354
|
/**
|
|
359
|
-
* The share of the table's color in each pixel, from 0 for none to 1 for all of it
|
|
360
|
-
*
|
|
355
|
+
* The share of the table's color in each pixel, from 0 for none to 1 for all of it. It is 1 by
|
|
356
|
+
* default.
|
|
361
357
|
*/
|
|
362
358
|
lutIntensity?: number;
|
|
363
359
|
/**
|
|
@@ -380,10 +376,9 @@ export interface PostSettings {
|
|
|
380
376
|
outline?: OutlineSettings | false;
|
|
381
377
|
/**
|
|
382
378
|
* Depth of field: blurs what lies in front of and behind the focus distance, as a camera lens
|
|
383
|
-
* does
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
* `dofSamples` is above 0.
|
|
379
|
+
* does. The near and far fields blur apart. It runs after the custom effects and before bloom.
|
|
380
|
+
* Settings turn it on, `{}` with the values it had, and `false` turns it off. It is off by
|
|
381
|
+
* default, and draws only where the quality setting `dofSamples` is above 0.
|
|
387
382
|
*/
|
|
388
383
|
dof?: DofSettings | false;
|
|
389
384
|
/**
|
package/lib/scene/post.js
CHANGED
|
@@ -15,6 +15,7 @@ import { EngineError } from '../errors/engine-error.js';
|
|
|
15
15
|
import { reasonOf } from '../errors/message.js';
|
|
16
16
|
import * as C from '../generated/core.js';
|
|
17
17
|
import { hexValue, invalidColor } from '../math/hex.js';
|
|
18
|
+
import { importOnce } from '../shared/import-once.js';
|
|
18
19
|
import { writeLinearColor } from './color.js';
|
|
19
20
|
import { EffectChain } from './effects.js';
|
|
20
21
|
import { Lut } from './lut.js';
|
|
@@ -911,13 +912,15 @@ function checkGrading(grading) {
|
|
|
911
912
|
checkRange('grading.splitToning.balance', split.balance, -1, 1);
|
|
912
913
|
checkRange('grading.splitToning.strength', split.strength, 0, 1);
|
|
913
914
|
}
|
|
915
|
+
/** The full-screen feature adapter's module, shared by every call that waits for it. */
|
|
916
|
+
const featureEffectCode = importOnce(() => import('./feature-effects.js'));
|
|
914
917
|
/**
|
|
915
918
|
* The full-screen feature adapter, which loads at the first call that places a feature, so a page
|
|
916
919
|
* that places none downloads none of it. Throws E1406 when its code does not download.
|
|
917
920
|
*/
|
|
918
921
|
async function loadFeatureEffects(call) {
|
|
919
922
|
try {
|
|
920
|
-
return await
|
|
923
|
+
return await featureEffectCode();
|
|
921
924
|
}
|
|
922
925
|
catch (error) {
|
|
923
926
|
throw new EngineError('E1406', `the feature effect code did not download for ${call}(): ${reasonOf(error)}.`);
|
package/lib/scene/prefab.d.ts
CHANGED
|
@@ -90,14 +90,13 @@ export declare class Prefab {
|
|
|
90
90
|
readonly textures: readonly Texture[];
|
|
91
91
|
private destroyed;
|
|
92
92
|
/**
|
|
93
|
-
* Destroys the model
|
|
94
|
-
* texture
|
|
95
|
-
*
|
|
96
|
-
* the
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* the model throw E1101.
|
|
93
|
+
* Destroys the model. It frees the GPU memory and the engine data of every mesh, material and
|
|
94
|
+
* texture that the load made, and of its skeleton and animation clips. Destroy the copies that
|
|
95
|
+
* `scene.instantiate` and `scene.createInstances` made first, and the objects that use one of
|
|
96
|
+
* its meshes or materials, in the same frame or before. Throws E1111 while one still does, and
|
|
97
|
+
* E1101 for a model that is destroyed already. Materials of your own that map one of the
|
|
98
|
+
* model's textures draw with their colors alone afterwards. Later calls that pass the model
|
|
99
|
+
* throw E1101.
|
|
101
100
|
*/
|
|
102
101
|
destroy(): void;
|
|
103
102
|
/** The names of the model's clips, which a copy's animator plays. */
|
package/lib/scene/prefab.js
CHANGED
|
@@ -67,14 +67,13 @@ export class Prefab {
|
|
|
67
67
|
this.properties = properties;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* Destroys the model
|
|
71
|
-
* texture
|
|
72
|
-
*
|
|
73
|
-
* the
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* the model throw E1101.
|
|
70
|
+
* Destroys the model. It frees the GPU memory and the engine data of every mesh, material and
|
|
71
|
+
* texture that the load made, and of its skeleton and animation clips. Destroy the copies that
|
|
72
|
+
* `scene.instantiate` and `scene.createInstances` made first, and the objects that use one of
|
|
73
|
+
* its meshes or materials, in the same frame or before. Throws E1111 while one still does, and
|
|
74
|
+
* E1101 for a model that is destroyed already. Materials of your own that map one of the
|
|
75
|
+
* model's textures draw with their colors alone afterwards. Later calls that pass the model
|
|
76
|
+
* throw E1101.
|
|
78
77
|
*/
|
|
79
78
|
destroy() {
|
|
80
79
|
const call = 'prefab.destroy';
|
|
@@ -144,7 +144,7 @@ export declare class PropertyAnimation {
|
|
|
144
144
|
get loop(): boolean;
|
|
145
145
|
/** The rate of the animation's time: 1 plays it as made, and a negative rate plays it backward. */
|
|
146
146
|
get speed(): number;
|
|
147
|
-
/** Sets the animation's time in seconds
|
|
147
|
+
/** Sets the animation's time in seconds. */
|
|
148
148
|
setTime(seconds: number): void;
|
|
149
149
|
/** Starts or stops the time, without changing the value that the target holds. */
|
|
150
150
|
setPaused(paused: boolean): void;
|
|
@@ -220,7 +220,7 @@ export class PropertyAnimation {
|
|
|
220
220
|
get speed() {
|
|
221
221
|
return this.rate;
|
|
222
222
|
}
|
|
223
|
-
/** Sets the animation's time in seconds
|
|
223
|
+
/** Sets the animation's time in seconds. */
|
|
224
224
|
setTime(seconds) {
|
|
225
225
|
this.seconds = seconds;
|
|
226
226
|
}
|
package/lib/scene/queries.d.ts
CHANGED
|
@@ -12,8 +12,7 @@ import type { PointBatch, SpriteBatch } from './sprites.js';
|
|
|
12
12
|
export interface QueryOptions {
|
|
13
13
|
/**
|
|
14
14
|
* The layers to test, as a 32-bit mask like `Object3D.setLayers` takes. A query tests an object
|
|
15
|
-
* when their masks share a layer. The default is layer 0 alone, as for a camera
|
|
16
|
-
* three.js's `Raycaster`.
|
|
15
|
+
* when their masks share a layer. The default is layer 0 alone, as for a camera.
|
|
17
16
|
*/
|
|
18
17
|
layers?: number;
|
|
19
18
|
}
|
|
@@ -27,14 +26,12 @@ export interface RaycastOptions extends QueryOptions {
|
|
|
27
26
|
maxDistance?: number;
|
|
28
27
|
/**
|
|
29
28
|
* When set, a ray hits a point that it passes within this many meters of, whatever the point's
|
|
30
|
-
* size
|
|
31
|
-
* square that a point draws.
|
|
29
|
+
* size. By default a ray hits the square that a point draws.
|
|
32
30
|
*/
|
|
33
31
|
pointThreshold?: number;
|
|
34
32
|
/**
|
|
35
33
|
* When set, a ray hits a line that it passes within this many meters of, whatever the line's
|
|
36
|
-
* width
|
|
37
|
-
* within half its width.
|
|
34
|
+
* width. By default a ray hits a line within half its width.
|
|
38
35
|
*/
|
|
39
36
|
lineThreshold?: number;
|
|
40
37
|
}
|
|
@@ -74,16 +71,13 @@ export interface RaycastHit extends OverlapHit {
|
|
|
74
71
|
normal: Vec3Like;
|
|
75
72
|
/** The distance from the ray's origin to the hit, in meters. */
|
|
76
73
|
distance: number;
|
|
77
|
-
/**
|
|
78
|
-
* The index of the hit triangle in its mesh, as three.js's `faceIndex`, or -1 for a sprite, a
|
|
79
|
-
* point or a line.
|
|
80
|
-
*/
|
|
74
|
+
/** The index of the hit triangle in its mesh, or -1 for a sprite, a point or a line. */
|
|
81
75
|
triangle: number;
|
|
82
76
|
/**
|
|
83
77
|
* Where on the surface the ray hit, as the first texture coordinates of the hit triangle
|
|
84
|
-
* blended across its three corners
|
|
85
|
-
*
|
|
86
|
-
*
|
|
78
|
+
* blended across its three corners. Give the hit object an array of two numbers, as it has
|
|
79
|
+
* arrays for `point` and `normal`, and every raycast fills it. Read `hasUv` first: the numbers
|
|
80
|
+
* mean nothing when it is false.
|
|
87
81
|
*/
|
|
88
82
|
uv?: Vec2Like;
|
|
89
83
|
/**
|