@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/resources.d.ts
CHANGED
|
@@ -73,8 +73,8 @@ export interface MeshLevelOptions {
|
|
|
73
73
|
/**
|
|
74
74
|
* The vertical field of view, in degrees, that checks the order of the levels when the mesh
|
|
75
75
|
* takes them. Each frame compares a level's error or coverage with the field of view of the
|
|
76
|
-
* view that draws it, so this option moves no switch. The default is 50,
|
|
77
|
-
*
|
|
76
|
+
* view that draws it, so this option moves no switch. The default is 50, a perspective
|
|
77
|
+
* camera's default.
|
|
78
78
|
*/
|
|
79
79
|
fov?: number;
|
|
80
80
|
}
|
|
@@ -131,8 +131,8 @@ export declare class MeshGeometry {
|
|
|
131
131
|
/** How many morph targets the mesh has. 0 for a mesh without any. */
|
|
132
132
|
readonly morphTargets: number;
|
|
133
133
|
/**
|
|
134
|
-
* The morph targets' names,
|
|
135
|
-
*
|
|
134
|
+
* The morph targets' names, in target order, or none when the mesh's arrays named none.
|
|
135
|
+
* `mesh.setMorphWeight` takes a name too.
|
|
136
136
|
*/
|
|
137
137
|
readonly morphTargetNames: readonly string[];
|
|
138
138
|
/** The geometry that made the mesh, whose scene says which objects use it. */
|
|
@@ -185,26 +185,24 @@ export declare class MeshGeometry {
|
|
|
185
185
|
get center(): readonly [number, number, number];
|
|
186
186
|
private boundsCenter;
|
|
187
187
|
/**
|
|
188
|
-
* Destroys the mesh
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
* throw E1101.
|
|
188
|
+
* Destroys the mesh. The engine frees its GPU memory and its other data at once, and later
|
|
189
|
+
* meshes take its room. Destroy the objects and instance batches that use it first, in the same
|
|
190
|
+
* frame or before. Its lower levels go with it, since a level draws its base's vertices. Throws
|
|
191
|
+
* E1111 while one still uses it, and E1101 for a mesh that is destroyed already. Later calls
|
|
192
|
+
* that pass the mesh throw E1101.
|
|
194
193
|
*/
|
|
195
194
|
destroy(): void;
|
|
196
195
|
/**
|
|
197
|
-
* Writes new values into one attribute of the mesh's vertices
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* alpha. The mesh keeps the bounding sphere it was made with, so give objects that draw
|
|
196
|
+
* Writes new values into one attribute of the mesh's vertices. `values` holds the attribute's
|
|
197
|
+
* values of every vertex, in the array type the mesh was made with, as `geometry.fromArrays`
|
|
198
|
+
* takes them. Only vertices `start` to `start + count - 1` change, which the next frame uploads.
|
|
199
|
+
* The defaults update every vertex. Colors take three or four values per vertex: three keep each
|
|
200
|
+
* vertex's alpha. The mesh keeps the bounding sphere it was made with, so give objects that draw
|
|
203
201
|
* vertices outside it bounds with `setBounds`. The four-number vertex record takes updates as
|
|
204
202
|
* `targets`. Joints, weights, and a mesh with joints or morph targets take no updates. A level
|
|
205
|
-
* that draws its base mesh's vertices writes them, so the base and every level of it draw the
|
|
206
|
-
*
|
|
207
|
-
*
|
|
203
|
+
* that draws its base mesh's vertices writes them, so the base and every level of it draw the new
|
|
204
|
+
* values. The levels that `buildLevels` or the automatic default planned measured the old shape,
|
|
205
|
+
* so the first update takes them away, and the mesh plans no automatic levels again;
|
|
208
206
|
* `buildLevels` plans them for the new shape. Throws E1206 for values that do not fit the mesh,
|
|
209
207
|
* and E1101 for a destroyed mesh. Allocates nothing, so a call in every frame makes no garbage.
|
|
210
208
|
*/
|
|
@@ -215,19 +213,19 @@ export declare class MeshGeometry {
|
|
|
215
213
|
*/
|
|
216
214
|
get levels(): readonly MeshLevel[];
|
|
217
215
|
/**
|
|
218
|
-
* Gives the mesh lower levels of detail, from the most detailed down
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* more cheaply; a level without one draws with the level before's material. A bound that
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
216
|
+
* Gives the mesh lower levels of detail, from the most detailed down. A mesh takes at most 15
|
|
217
|
+
* lower levels. Every object and instance batch that draws the mesh then picks one level per
|
|
218
|
+
* frame. It draws the coarsest level whose error covers fewer pixels on the screen than the
|
|
219
|
+
* `lodThreshold` quality setting. A level may name a material of its own, so a far level shades
|
|
220
|
+
* more cheaply; a level without one draws with the level before's material. A bound that covers
|
|
221
|
+
* fewer pixels than the threshold draws nothing, so the mesh's last level holds no geometry. The
|
|
222
|
+
* shadow maps pick their own levels, by each map's texel size, so a caster's shadow shows the
|
|
223
|
+
* detail that the map can hold. An empty list takes the levels away. Morphed objects, and
|
|
224
|
+
* materials that blend or let light through, draw the base mesh. A skinned object draws a level
|
|
225
|
+
* while the level names the base mesh's own vertices. Destroying a level's mesh takes every level
|
|
226
|
+
* away. Levels set here win over the ones that `buildLevels` or the automatic default plans: a
|
|
227
|
+
* plan that runs ends, and the planned levels go. Throws E1221 for levels the mesh cannot take,
|
|
228
|
+
* and E1101 for a destroyed mesh.
|
|
231
229
|
*/
|
|
232
230
|
setLevels(levels: readonly MeshLevel[], options?: MeshLevelOptions): void;
|
|
233
231
|
/**
|
|
@@ -531,9 +529,9 @@ export type UpdatableAttribute = 'positions' | 'normals' | 'uvs' | 'uvs1' | 'col
|
|
|
531
529
|
*/
|
|
532
530
|
export type IntegerArray = Int8Array | Uint8Array | Int16Array | Uint16Array;
|
|
533
531
|
/**
|
|
534
|
-
* One attribute's numbers with a note on how its integers read
|
|
535
|
-
*
|
|
536
|
-
*
|
|
532
|
+
* One attribute's numbers with a note on how its integers read. Normalized integers read as
|
|
533
|
+
* fractions: from 0 to 1 when unsigned, and from -1 to 1 when signed. Plain integers read as whole
|
|
534
|
+
* numbers.
|
|
537
535
|
*
|
|
538
536
|
* @category api/geometry
|
|
539
537
|
*/
|
|
@@ -541,9 +539,9 @@ export interface VertexArray {
|
|
|
541
539
|
/** The numbers, as `MeshArrays` takes them. */
|
|
542
540
|
array: Float32Array | IntegerArray | readonly number[];
|
|
543
541
|
/**
|
|
544
|
-
* True when the integers are normalized. The default is false, as in
|
|
545
|
-
*
|
|
546
|
-
*
|
|
542
|
+
* True when the integers are normalized. The default is false, as in glTF. It applies to
|
|
543
|
+
* positions and texture coordinates. The other attributes read integers one way only, so they
|
|
544
|
+
* refuse a value that says otherwise.
|
|
547
545
|
*/
|
|
548
546
|
normalized?: boolean;
|
|
549
547
|
}
|
|
@@ -556,29 +554,28 @@ export interface VertexArray {
|
|
|
556
554
|
*/
|
|
557
555
|
export type VertexValues = Float32Array | IntegerArray | readonly number[] | VertexArray;
|
|
558
556
|
/**
|
|
559
|
-
* A mesh's morph targets,
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
* `setMorphWeight`, and clips animate.
|
|
557
|
+
* A mesh's morph targets, as glTF stores them. Each list holds one array per target, of three
|
|
558
|
+
* numbers per vertex, or for colors as many as the mesh's `colors` hold. They say how far the
|
|
559
|
+
* target moves the vertex's position, normal, tangent or color at weight 1. Every list has the same
|
|
560
|
+
* number of targets, from 1 to 256. A mesh's targets move its vertices by their weights, which each
|
|
561
|
+
* object sets with `setMorphWeight`, and clips animate.
|
|
565
562
|
*
|
|
566
563
|
* @category api/geometry
|
|
567
564
|
*/
|
|
568
565
|
export interface MorphTargets {
|
|
569
|
-
/** For each target, how far it moves each position.
|
|
566
|
+
/** For each target, how far it moves each position. */
|
|
570
567
|
positions?: readonly (Float32Array | readonly number[])[];
|
|
571
|
-
/** For each target, how far it turns each normal.
|
|
568
|
+
/** For each target, how far it turns each normal. */
|
|
572
569
|
normals?: readonly (Float32Array | readonly number[])[];
|
|
573
570
|
/**
|
|
574
|
-
* For each target, how far it turns each tangent's direction: three numbers per vertex, as
|
|
575
|
-
*
|
|
571
|
+
* For each target, how far it turns each tangent's direction: three numbers per vertex, as glTF
|
|
572
|
+
* gives them.
|
|
576
573
|
*/
|
|
577
574
|
tangents?: readonly (Float32Array | readonly number[])[];
|
|
578
575
|
/**
|
|
579
576
|
* For each target, how far it changes each vertex color: three or four numbers per vertex, as
|
|
580
|
-
* many as the mesh's `colors` hold, in linear color.
|
|
581
|
-
*
|
|
577
|
+
* many as the mesh's `colors` hold, in linear color. A morphed color is clamped to the range 0 to
|
|
578
|
+
* 1, as the glTF specification asks. Needs `colors`.
|
|
582
579
|
*/
|
|
583
580
|
colors?: readonly (Float32Array | readonly number[])[];
|
|
584
581
|
/** The targets' names, one per target, which `setMorphWeight` takes in place of numbers. */
|
|
@@ -586,8 +583,7 @@ export interface MorphTargets {
|
|
|
586
583
|
}
|
|
587
584
|
/**
|
|
588
585
|
* The arrays of a mesh for `geometry.fromArrays`. Each array holds its values for vertex 0, then
|
|
589
|
-
* vertex 1, and so on
|
|
590
|
-
* them.
|
|
586
|
+
* vertex 1, and so on. The engine copies them.
|
|
591
587
|
*
|
|
592
588
|
* An attribute can come as 32-bit floats, or as the 8-bit and 16-bit integers that glTF's
|
|
593
589
|
* `KHR_mesh_quantization` allows for it. The mesh keeps that type on the GPU. Smaller types take
|
|
@@ -599,48 +595,44 @@ export interface MorphTargets {
|
|
|
599
595
|
*/
|
|
600
596
|
export interface MeshArrays {
|
|
601
597
|
/**
|
|
602
|
-
* Three numbers per vertex: x, y and z.
|
|
603
|
-
*
|
|
598
|
+
* Three numbers per vertex: x, y and z. Takes floats, or 8-bit or 16-bit integers, normalized or
|
|
599
|
+
* plain.
|
|
604
600
|
*/
|
|
605
601
|
positions: VertexValues;
|
|
606
602
|
/**
|
|
607
|
-
* Three numbers per vertex: a direction of length 1 away from the surface.
|
|
608
|
-
* `
|
|
609
|
-
*
|
|
603
|
+
* Three numbers per vertex: a direction of length 1 away from the surface. Pass normals, or set
|
|
604
|
+
* `computeNormals` instead. Takes floats, or an `Int8Array` or `Int16Array`, whose integers read
|
|
605
|
+
* as fractions from -1 to 1.
|
|
610
606
|
*/
|
|
611
607
|
normals?: VertexValues;
|
|
612
608
|
/**
|
|
613
|
-
* Texture coordinates: two numbers per vertex, u and v.
|
|
614
|
-
*
|
|
609
|
+
* Texture coordinates: two numbers per vertex, u and v. Takes floats, or 8-bit or 16-bit
|
|
610
|
+
* integers, normalized or plain.
|
|
615
611
|
*/
|
|
616
612
|
uvs?: VertexValues;
|
|
617
613
|
/**
|
|
618
614
|
* A second set of texture coordinates, two numbers per vertex, such as those of a light map.
|
|
619
|
-
*
|
|
615
|
+
* Takes the same types as `uvs`.
|
|
620
616
|
*/
|
|
621
617
|
uvs1?: VertexValues;
|
|
622
618
|
/**
|
|
623
|
-
* Linear colors, three numbers per vertex from 0 to 1, or four with alpha.
|
|
624
|
-
* `
|
|
625
|
-
* fractions from 0 to 1.
|
|
619
|
+
* Linear colors, three numbers per vertex from 0 to 1, or four with alpha. Takes floats, or a
|
|
620
|
+
* `Uint8Array` or `Uint16Array`, whose integers read as fractions from 0 to 1.
|
|
626
621
|
*/
|
|
627
622
|
colors?: VertexValues;
|
|
628
623
|
/**
|
|
629
|
-
* Four numbers per vertex: the direction in which u grows along the surface, then 1 or -1 for
|
|
630
|
-
*
|
|
631
|
-
* `normals`.
|
|
624
|
+
* Four numbers per vertex: the direction in which u grows along the surface, then 1 or -1 for the
|
|
625
|
+
* direction in which v grows. Takes the same types as `normals`.
|
|
632
626
|
*/
|
|
633
627
|
tangents?: VertexValues;
|
|
634
628
|
/**
|
|
635
629
|
* The joints that move each vertex of a skinned mesh: four joint indices per vertex, in a
|
|
636
|
-
* `Uint8Array`, a `Uint16Array` or a plain array.
|
|
637
|
-
* `weights` with them.
|
|
630
|
+
* `Uint8Array`, a `Uint16Array` or a plain array. Give `weights` with them.
|
|
638
631
|
*/
|
|
639
632
|
joints?: VertexValues;
|
|
640
633
|
/**
|
|
641
|
-
* How much each of a vertex's four joints moves it: four numbers per vertex, which add up to
|
|
642
|
-
*
|
|
643
|
-
* whose integers read as fractions from 0 to 1.
|
|
634
|
+
* How much each of a vertex's four joints moves it: four numbers per vertex, which add up to 1.
|
|
635
|
+
* Takes floats, or a `Uint8Array` or `Uint16Array`, whose integers read as fractions from 0 to 1.
|
|
644
636
|
*/
|
|
645
637
|
weights?: VertexValues;
|
|
646
638
|
/**
|
|
@@ -654,17 +646,16 @@ export interface MeshArrays {
|
|
|
654
646
|
/**
|
|
655
647
|
* Three vertex indices per triangle, counter-clockwise when you look at its front. 16-bit and
|
|
656
648
|
* 32-bit indices both work. Without indices, each three vertices in a row make a triangle.
|
|
657
|
-
* Like three.js's `setIndex`.
|
|
658
649
|
*/
|
|
659
650
|
indices?: Uint16Array | Uint32Array | readonly number[];
|
|
660
651
|
/**
|
|
661
|
-
* Computes the normals from the triangles
|
|
662
|
-
*
|
|
652
|
+
* Computes the normals from the triangles: each vertex gets the average of its triangles'
|
|
653
|
+
* normals, weighted by their areas.
|
|
663
654
|
*/
|
|
664
655
|
computeNormals?: boolean;
|
|
665
656
|
/**
|
|
666
|
-
* Computes the tangents from the positions, the normals and `uvs`,
|
|
667
|
-
*
|
|
657
|
+
* Computes the tangents on the job workers, from the positions, the normals and `uvs`, with Eric
|
|
658
|
+
* Lengyel's method.
|
|
668
659
|
*/
|
|
669
660
|
computeTangents?: boolean;
|
|
670
661
|
/**
|
|
@@ -687,8 +678,7 @@ export interface MeshArrays {
|
|
|
687
678
|
levels?: LevelsOption;
|
|
688
679
|
}
|
|
689
680
|
/**
|
|
690
|
-
* Mesh generators
|
|
691
|
-
* from arrays.
|
|
681
|
+
* Mesh generators for common shapes, and meshes from arrays.
|
|
692
682
|
*
|
|
693
683
|
* @category api/geometry
|
|
694
684
|
*/
|
|
@@ -722,32 +712,31 @@ export declare class Geometry {
|
|
|
722
712
|
* number.
|
|
723
713
|
*/
|
|
724
714
|
private shape;
|
|
725
|
-
/** A box,
|
|
715
|
+
/** A box, centered on its origin. */
|
|
726
716
|
box(options?: BoxOptions): MeshGeometry;
|
|
727
|
-
/** A sphere,
|
|
717
|
+
/** A sphere with its poles on the Y axis, or a part of one. */
|
|
728
718
|
sphere(options?: SphereOptions): MeshGeometry;
|
|
729
|
-
/** A flat rectangle
|
|
719
|
+
/** A flat rectangle in the XY plane that faces +Z. */
|
|
730
720
|
plane(options?: PlaneOptions): MeshGeometry;
|
|
731
|
-
/** A cylinder,
|
|
721
|
+
/** A cylinder on the Y axis, closed at each end unless `openEnded` is true. */
|
|
732
722
|
cylinder(options?: CylinderOptions): MeshGeometry;
|
|
733
|
-
/** A cone
|
|
723
|
+
/** A cone on the Y axis: a cylinder whose top is a point. */
|
|
734
724
|
cone(options?: ConeOptions): MeshGeometry;
|
|
735
|
-
/** A torus
|
|
725
|
+
/** A torus: a tube bent into a ring around the Z axis. */
|
|
736
726
|
torus(options?: TorusOptions): MeshGeometry;
|
|
737
|
-
/** A capsule
|
|
727
|
+
/** A capsule: a cylinder on the Y axis with a half sphere on each end. */
|
|
738
728
|
capsule(options?: CapsuleOptions): MeshGeometry;
|
|
739
|
-
/** A flat circle,
|
|
729
|
+
/** A flat circle in the XY plane that faces +Z, or a slice of one. */
|
|
740
730
|
circle(options?: CircleOptions): MeshGeometry;
|
|
741
|
-
/** A flat ring,
|
|
731
|
+
/** A flat ring: a disc with a hole, in the XY plane, that faces +Z. */
|
|
742
732
|
ring(options?: RingOptions): MeshGeometry;
|
|
743
733
|
/**
|
|
744
|
-
* A mesh from arrays of vertex attributes and triangle indices
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
* do not fit the vertices or whose lists hold different numbers of targets.
|
|
734
|
+
* A mesh from arrays of vertex attributes and triangle indices. The mesh keeps the attributes it
|
|
735
|
+
* gets, each in the type of number it came in, and meshes whose attributes have the same types
|
|
736
|
+
* share GPU buffers. A mesh can have any number of vertices. Throws E1206 when an array's length
|
|
737
|
+
* does not fit the vertex count, when its attribute does not take its type of number, when an
|
|
738
|
+
* index names no vertex, for a value that is not a finite number, and for morph targets whose
|
|
739
|
+
* arrays do not fit the vertices or whose lists hold different numbers of targets.
|
|
751
740
|
*/
|
|
752
741
|
fromArrays(arrays: MeshArrays): MeshGeometry;
|
|
753
742
|
}
|
|
@@ -775,11 +764,10 @@ export interface MaterialOptions {
|
|
|
775
764
|
/**
|
|
776
765
|
* How a material uses its alpha: its opacity, times its base color map's alpha, and times its
|
|
777
766
|
* mesh's vertex alpha with `vertexColors`. The `opaque` mode ignores the alpha. The `mask` mode
|
|
778
|
-
* draws nothing where the alpha falls below `alphaCutoff`, and draws the rest opaque
|
|
779
|
-
*
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
* `transparent: true` does. Blended objects draw after the opaque ones, farthest first.
|
|
767
|
+
* draws nothing where the alpha falls below `alphaCutoff`, and draws the rest opaque. The `hash`
|
|
768
|
+
* mode draws each point of the surface opaque or not at all, by a pattern that stays on the mesh.
|
|
769
|
+
* The alpha then sets how much of the surface draws. The `blend` mode blends the surface over what
|
|
770
|
+
* lies behind it. Blended objects draw after the opaque ones, farthest first.
|
|
783
771
|
*
|
|
784
772
|
* @category api/materials
|
|
785
773
|
*/
|
|
@@ -788,29 +776,27 @@ export type AlphaMode = 'opaque' | 'mask' | 'hash' | 'blend';
|
|
|
788
776
|
* How a blended surface meets what lies behind it. The `normal` blending covers it as far as the
|
|
789
777
|
* alpha says. The `additive` blending adds the surface's light, for glows and fire. The `multiply`
|
|
790
778
|
* blending tints it, for stains and tinted glass. The `weighted` blending covers it as `normal`
|
|
791
|
-
* does, but blends the surfaces of this blending in any order, by a weighted average
|
|
792
|
-
*
|
|
793
|
-
*
|
|
779
|
+
* does, but blends the surfaces of this blending in any order, by a weighted average. Use it for
|
|
780
|
+
* smoke, dense particles and many overlapping panes, where sorting by object leaves surfaces in the
|
|
781
|
+
* wrong order.
|
|
794
782
|
*
|
|
795
783
|
* @category api/materials
|
|
796
784
|
*/
|
|
797
785
|
export type Blending = 'normal' | 'additive' | 'multiply' | 'weighted';
|
|
798
786
|
/**
|
|
799
|
-
* A depth bias
|
|
800
|
-
*
|
|
801
|
-
* toward the camera, as in three.js.
|
|
787
|
+
* A depth bias. It moves a surface's depth before the depth test, so a decal on a wall wins the
|
|
788
|
+
* depth test and does not fight with the wall. Negative values pull the surface toward the camera.
|
|
802
789
|
*
|
|
803
790
|
* @category api/materials
|
|
804
791
|
*/
|
|
805
792
|
export interface DepthBias {
|
|
806
793
|
/**
|
|
807
|
-
* Steps of the depth buffer's smallest difference
|
|
808
|
-
*
|
|
794
|
+
* Steps of the depth buffer's smallest difference. A fraction rounds to the nearest whole
|
|
795
|
+
* number, as WebGPU takes it. The default is 0.
|
|
809
796
|
*/
|
|
810
797
|
constant?: number;
|
|
811
798
|
/**
|
|
812
|
-
* A factor of how steeply the surface's depth changes across the screen
|
|
813
|
-
* `polygonOffsetFactor`. The default is 0.
|
|
799
|
+
* A factor of how steeply the surface's depth changes across the screen. The default is 0.
|
|
814
800
|
*/
|
|
815
801
|
slopeScale?: number;
|
|
816
802
|
}
|
|
@@ -837,20 +823,18 @@ export interface StandardValues extends MaterialOptions {
|
|
|
837
823
|
*/
|
|
838
824
|
normalScale?: readonly [number, number];
|
|
839
825
|
/**
|
|
840
|
-
* How strongly the bump map bends normals
|
|
841
|
-
*
|
|
842
|
-
* default is 1.
|
|
826
|
+
* How strongly the bump map bends normals: the change of its red channel from one pixel to the
|
|
827
|
+
* next times this. Negative values turn bumps into dents. The default is 1.
|
|
843
828
|
*/
|
|
844
829
|
bumpScale?: number;
|
|
845
830
|
/**
|
|
846
|
-
* How far the displacement map's white moves each vertex along its normal, in the mesh's units
|
|
847
|
-
*
|
|
831
|
+
* How far the displacement map's white moves each vertex along its normal, in the mesh's units.
|
|
832
|
+
* The default is 1.
|
|
848
833
|
*/
|
|
849
834
|
displacementScale?: number;
|
|
850
835
|
/**
|
|
851
836
|
* How far the displacement map moves every vertex along its normal, added to its texel's
|
|
852
|
-
* share of `displacementScale`, in the mesh's units
|
|
853
|
-
* default is 0.
|
|
837
|
+
* share of `displacementScale`, in the mesh's units. The default is 0.
|
|
854
838
|
*/
|
|
855
839
|
displacementBias?: number;
|
|
856
840
|
/** How much the occlusion map darkens ambient light, from 0 to 1. The default is 1. */
|
|
@@ -858,30 +842,27 @@ export interface StandardValues extends MaterialOptions {
|
|
|
858
842
|
/** The factor of the light map's light: 0 or more. The default is 1. */
|
|
859
843
|
lightMapIntensity?: number;
|
|
860
844
|
/**
|
|
861
|
-
* The index of refraction of the surface's non-metallic part, 1 or more
|
|
862
|
-
*
|
|
863
|
-
*
|
|
864
|
-
* model does.
|
|
845
|
+
* The index of refraction of the surface's non-metallic part, 1 or more. It sets how much
|
|
846
|
+
* light the surface reflects when seen head on: `((ior - 1) / (ior + 1))^2`. The default is
|
|
847
|
+
* 1.5, which reflects 4%, as glTF's metallic-roughness model does.
|
|
865
848
|
*/
|
|
866
849
|
ior?: number;
|
|
867
850
|
/**
|
|
868
|
-
* The strength of the specular reflection of the surface's non-metallic part, from 0 to 1
|
|
869
|
-
*
|
|
870
|
-
*
|
|
851
|
+
* The strength of the specular reflection of the surface's non-metallic part, from 0 to 1. It
|
|
852
|
+
* scales the reflection at every angle, so 0 leaves only diffuse light. Metals ignore it. The
|
|
853
|
+
* default is 1.
|
|
871
854
|
*/
|
|
872
855
|
specularIntensity?: number;
|
|
873
856
|
/**
|
|
874
857
|
* The color that tints the specular reflection of the surface's non-metallic part when seen head
|
|
875
|
-
* on
|
|
876
|
-
*
|
|
877
|
-
*
|
|
878
|
-
* light. The default is white.
|
|
858
|
+
* on. At grazing angles the reflection stays white, and metals ignore it. It takes the forms
|
|
859
|
+
* that `color` takes, and its three linear components may also exceed 1, as glTF allows, to
|
|
860
|
+
* reflect more than the index of refraction gives, up to all the light. The default is white.
|
|
879
861
|
*/
|
|
880
862
|
specularColor?: ColorInput;
|
|
881
863
|
/**
|
|
882
|
-
* The factor of the scene environment's light on the surface, 0 or more
|
|
883
|
-
*
|
|
884
|
-
* default is 1.
|
|
864
|
+
* The factor of the scene environment's light on the surface, 0 or more. It multiplies the
|
|
865
|
+
* intensity that `scene.setEnvironment` gives. The default is 1.
|
|
885
866
|
*/
|
|
886
867
|
envIntensity?: number;
|
|
887
868
|
/** Where the maps sit on the texture coordinates. The default leaves them as they are. */
|
|
@@ -893,40 +874,36 @@ export interface StandardValues extends MaterialOptions {
|
|
|
893
874
|
mapUvTransforms?: MapUvTransforms;
|
|
894
875
|
/**
|
|
895
876
|
* How much of the light behind the surface passes through it, from 0 to 1, for glass and clear
|
|
896
|
-
* water
|
|
897
|
-
*
|
|
898
|
-
*
|
|
899
|
-
*
|
|
900
|
-
*
|
|
901
|
-
*
|
|
902
|
-
* pixels that remain, as three.js's `alphaTest` does. The default is 0.
|
|
877
|
+
* water. That share of the diffuse light becomes the light from behind, and the reflections
|
|
878
|
+
* stay. Roughness blurs what shows through. Give it when you create the material, even as 0, to
|
|
879
|
+
* change it later. A material created without it lets no light through. Such a material draws
|
|
880
|
+
* after the opaque objects, with the blended ones, and only opaque objects show through it. It
|
|
881
|
+
* takes the `opaque`, `mask` or `blend` alpha mode. A mask decides which pixels draw, and the
|
|
882
|
+
* light from behind fills the pixels that remain. The default is 0.
|
|
903
883
|
*/
|
|
904
884
|
transmission?: number;
|
|
905
885
|
/**
|
|
906
|
-
* The thickness of the volume under the surface, in the mesh's own units, 0 or more
|
|
907
|
-
*
|
|
908
|
-
*
|
|
886
|
+
* The thickness of the volume under the surface, in the mesh's own units, 0 or more. Light that
|
|
887
|
+
* passes through bends by `ior` over this distance, and the volume's color absorbs part of it.
|
|
888
|
+
* 0 is a thin wall, which bends no light. The default is 0.
|
|
909
889
|
*/
|
|
910
890
|
thickness?: number;
|
|
911
891
|
/**
|
|
912
892
|
* The color that white light takes after it travels `attenuationDistance` through the
|
|
913
|
-
* volume,
|
|
914
|
-
* white, which absorbs nothing.
|
|
893
|
+
* volume, in the forms that `color` takes. The default is white, which absorbs nothing.
|
|
915
894
|
*/
|
|
916
895
|
attenuationColor?: ColorInput;
|
|
917
896
|
/**
|
|
918
897
|
* The distance in world units over which light in the volume takes `attenuationColor`, above
|
|
919
|
-
* 0
|
|
920
|
-
* `Infinity`.
|
|
898
|
+
* 0. `Infinity` absorbs nothing. The default is `Infinity`.
|
|
921
899
|
*/
|
|
922
900
|
attenuationDistance?: number;
|
|
923
901
|
/**
|
|
924
|
-
* The strength of the volume's dispersion, 0 or more, as
|
|
925
|
-
*
|
|
926
|
-
*
|
|
927
|
-
*
|
|
928
|
-
*
|
|
929
|
-
* `transmission`, and the default is 0.
|
|
902
|
+
* The strength of the volume's dispersion, 0 or more, as glTF's `KHR_materials_dispersion`
|
|
903
|
+
* gives it: 20 divided by the Abbe number, so a diamond's 0.36 is weak and rutile's 2.04 is
|
|
904
|
+
* strong. The light from behind bends by a slightly different index of refraction for each
|
|
905
|
+
* color, so a prism or a gem separates it into colors at its edges. 0 bends every color alike.
|
|
906
|
+
* It shows only with `transmission`, and the default is 0.
|
|
930
907
|
*/
|
|
931
908
|
dispersion?: number;
|
|
932
909
|
/**
|
|
@@ -964,67 +941,63 @@ export interface StandardValues extends MaterialOptions {
|
|
|
964
941
|
*/
|
|
965
942
|
subsurfaceColor?: ColorInput;
|
|
966
943
|
/**
|
|
967
|
-
* How much of a clear coat covers the surface, from 0 to 1, as
|
|
968
|
-
*
|
|
969
|
-
*
|
|
970
|
-
*
|
|
971
|
-
* change it later. The default is 0.
|
|
944
|
+
* How much of a clear coat covers the surface, from 0 to 1: a thin, shiny layer, as on car
|
|
945
|
+
* paint, varnish or a wet stone, with its own highlights and reflection. It dims what lies
|
|
946
|
+
* below it where it reflects light. Give it, or another option of a clear coat or a sheen, when
|
|
947
|
+
* you create the material, to change it later. The default is 0.
|
|
972
948
|
*/
|
|
973
949
|
clearcoat?: number;
|
|
974
|
-
/** How rough the clear coat is, from 0 (a mirror) to 1
|
|
950
|
+
/** How rough the clear coat is, from 0 (a mirror) to 1. The default is 0. */
|
|
975
951
|
clearcoatRoughness?: number;
|
|
976
952
|
/**
|
|
977
|
-
* How strongly the coat normal map bends the coat's normals along u and along v
|
|
978
|
-
* `
|
|
953
|
+
* How strongly the coat normal map bends the coat's normals along u and along v. The default is
|
|
954
|
+
* `[1, 1]`, and negative values flip a direction.
|
|
979
955
|
*/
|
|
980
956
|
clearcoatNormalScale?: readonly [number, number];
|
|
981
957
|
/**
|
|
982
|
-
* The color of a sheen, the soft glow at grazing angles of velvet, cloth and fuzz,
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
*
|
|
958
|
+
* The color of a sheen, the soft glow at grazing angles of velvet, cloth and fuzz, in the forms
|
|
959
|
+
* that `color` takes. The color alone sets the sheen's strength, so black gives none. Give it,
|
|
960
|
+
* or another option of a clear coat or a sheen, when you create the material, to change it
|
|
961
|
+
* later. The default is black.
|
|
986
962
|
*/
|
|
987
963
|
sheenColor?: ColorInput;
|
|
988
|
-
/** How rough the sheen is, from 0 to 1
|
|
964
|
+
/** How rough the sheen is, from 0 to 1: rougher sheens spread wider. The default is 1. */
|
|
989
965
|
sheenRoughness?: number;
|
|
990
966
|
/**
|
|
991
|
-
* How much a thin film above the surface tints its reflection, from 0 to 1,
|
|
992
|
-
*
|
|
993
|
-
*
|
|
994
|
-
* The default is 0.
|
|
967
|
+
* How much a thin film above the surface tints its reflection, from 0 to 1: soap bubbles, oil
|
|
968
|
+
* and beetle shells show the colors of the film's thickness. Give it, or another option of
|
|
969
|
+
* iridescence, when you create the material, to change it later. The default is 0.
|
|
995
970
|
*/
|
|
996
971
|
iridescence?: number;
|
|
997
972
|
/**
|
|
998
|
-
* The thin film's index of refraction, 1 or more
|
|
999
|
-
*
|
|
1000
|
-
* default is 1.3.
|
|
973
|
+
* The thin film's index of refraction, 1 or more: 1 makes the film reflect as the surface does,
|
|
974
|
+
* and a value near 2 shows its colors most strongly. The default is 1.3.
|
|
1001
975
|
*/
|
|
1002
976
|
iridescenceIor?: number;
|
|
1003
977
|
/**
|
|
1004
|
-
* The thinnest and thickest parts of the film, in nanometers
|
|
1005
|
-
*
|
|
1006
|
-
* `[100, 400]`.
|
|
978
|
+
* The thinnest and thickest parts of the film, in nanometers: the map's green channel mixes
|
|
979
|
+
* between them. The default is `[100, 400]`.
|
|
1007
980
|
*/
|
|
1008
981
|
iridescenceThicknessRange?: readonly [number, number];
|
|
1009
982
|
/**
|
|
1010
983
|
* How far the specular reflection stretches along one direction of the surface, from 0 (round)
|
|
1011
|
-
* to 1
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
* The default is 0.
|
|
984
|
+
* to 1: brushed metal shows a highlight across its grooves rather than around. A material with
|
|
985
|
+
* a map takes the stretch's direction from the mesh's tangents or from the map's coordinates; a
|
|
986
|
+
* material without one takes a frame square to the surface. Give it, or `anisotropyRotation`,
|
|
987
|
+
* when you create the material, to change it later. The default is 0.
|
|
1016
988
|
*/
|
|
1017
989
|
anisotropy?: number;
|
|
1018
990
|
/**
|
|
1019
|
-
* The direction along which the reflection stretches, in radians from the surface's tangent
|
|
1020
|
-
*
|
|
991
|
+
* The direction along which the reflection stretches, in radians from the surface's tangent.
|
|
992
|
+
* The default is 0.
|
|
1021
993
|
*/
|
|
1022
994
|
anisotropyRotation?: number;
|
|
1023
995
|
}
|
|
1024
996
|
/**
|
|
1025
|
-
* Where a material's maps sit on the texture coordinates
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
997
|
+
* Where a material's maps sit on the texture coordinates. The engine turns the coordinates by
|
|
998
|
+
* `rotation` about their origin, scales them by `repeat`, and then adds `offset`:
|
|
999
|
+
* u' = repeat.u × (u cos r + v sin r) + offset.u, and v' = repeat.v × (v cos r − u sin r) + offset.v.
|
|
1000
|
+
* A transform that leaves a value out takes its default.
|
|
1028
1001
|
*
|
|
1029
1002
|
* @category api/materials
|
|
1030
1003
|
*/
|
|
@@ -1056,18 +1029,17 @@ export interface StandardMaps {
|
|
|
1056
1029
|
/** Normals in tangent space, in linear color, which `normalScale` scales. */
|
|
1057
1030
|
normalMap?: Texture;
|
|
1058
1031
|
/**
|
|
1059
|
-
* Heights in red, in linear color, which bend the normals
|
|
1060
|
-
* `bumpScale`. A normal map wins over it,
|
|
1032
|
+
* Heights in red, in linear color, which bend the normals by the change of the height from one
|
|
1033
|
+
* pixel to the next, times `bumpScale`. A normal map wins over it, and so does a wireframe.
|
|
1061
1034
|
*/
|
|
1062
1035
|
bumpMap?: Texture;
|
|
1063
1036
|
/**
|
|
1064
1037
|
* Heights in red, in linear color, which move each vertex along its normal by
|
|
1065
|
-
* `displacementScale` and `displacementBias
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1069
|
-
*
|
|
1070
|
-
* outlines and debug views see the mesh before it moves.
|
|
1038
|
+
* `displacementScale` and `displacementBias`. Shadows and the depth prepass follow the moved
|
|
1039
|
+
* vertices, and culling grows each object's bounds to hold them. Without a normal or bump map,
|
|
1040
|
+
* the map's slope also bends the normals, so the light follows the new shape. The vertex shader
|
|
1041
|
+
* reads the map at its full size, so the mesh needs vertices about as dense as the detail it
|
|
1042
|
+
* should show. Raycasts, outlines and debug views see the mesh before it moves.
|
|
1071
1043
|
*/
|
|
1072
1044
|
displacementMap?: Texture;
|
|
1073
1045
|
/**
|
|
@@ -1171,30 +1143,28 @@ export interface MaterialFeatures {
|
|
|
1171
1143
|
/** Takes the scene's fog. False keeps the material's color at every distance. The default is true. */
|
|
1172
1144
|
fog?: boolean;
|
|
1173
1145
|
/**
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1180
|
-
* default is true.
|
|
1146
|
+
* False keeps the color as the display shows it. The tone curve leaves it alone: the 8-bit path
|
|
1147
|
+
* decides that in the shader of the material's own build, and the HDR path's final pass reads a
|
|
1148
|
+
* mask of these surfaces and skips the curve where one draws. A blended surface keeps the curve
|
|
1149
|
+
* on the HDR path, since a blended pixel mixes two surfaces. The vignette and the sRGB encoding
|
|
1150
|
+
* still apply, and the exposure already scales the material's colors, so the color shows
|
|
1151
|
+
* brighter than the same color tone mapped. The default is true.
|
|
1181
1152
|
*/
|
|
1182
1153
|
toneMapped?: boolean;
|
|
1183
1154
|
/** How the material uses its alpha. The default is `opaque`. */
|
|
1184
1155
|
alphaMode?: AlphaMode;
|
|
1185
1156
|
/**
|
|
1186
|
-
* With the `mask` alpha mode, smooths the cut edges with MSAA
|
|
1187
|
-
* `
|
|
1188
|
-
*
|
|
1189
|
-
*
|
|
1190
|
-
*
|
|
1157
|
+
* With the `mask` alpha mode, smooths the cut edges with MSAA: the alpha fades over about one
|
|
1158
|
+
* pixel above `alphaCutoff`, and covers that share of the pixel. Without MSAA the mask cuts as
|
|
1159
|
+
* without it. False gives hard cut edges. A custom material takes it where its WGSL sets or
|
|
1160
|
+
* reads the surface's `alpha`, and a development build throws E1217 otherwise. The default is
|
|
1161
|
+
* true.
|
|
1191
1162
|
*/
|
|
1192
1163
|
alphaToCoverage?: boolean;
|
|
1193
1164
|
/**
|
|
1194
1165
|
* With the `blend` alpha mode and `doubleSided`, draws both faces in one draw, in the mesh's
|
|
1195
|
-
* order
|
|
1196
|
-
*
|
|
1197
|
-
* false.
|
|
1166
|
+
* order. By default such a surface draws its back faces first and then its front faces, so its
|
|
1167
|
+
* near side always covers its far side. The default is false.
|
|
1198
1168
|
*/
|
|
1199
1169
|
forceSinglePass?: boolean;
|
|
1200
1170
|
/** With the `blend` alpha mode, how the surface meets what lies behind it. The default is `normal`. */
|
|
@@ -1202,25 +1172,25 @@ export interface MaterialFeatures {
|
|
|
1202
1172
|
/** False to write no depth, so the surface hides nothing behind it. The default is true. */
|
|
1203
1173
|
depthWrite?: boolean;
|
|
1204
1174
|
/**
|
|
1205
|
-
* False to draw the surface whatever lies in front of it. It then writes no depth either
|
|
1206
|
-
*
|
|
1175
|
+
* False to draw the surface whatever lies in front of it. It then writes no depth either. The
|
|
1176
|
+
* default is true.
|
|
1207
1177
|
*/
|
|
1208
1178
|
depthTest?: boolean;
|
|
1209
1179
|
/**
|
|
1210
|
-
* False to write no color, so the surface shows nothing itself and hides what lies behind it
|
|
1211
|
-
*
|
|
1212
|
-
*
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
1215
|
-
*
|
|
1180
|
+
* False to write no color, so the surface shows nothing itself and hides what lies behind it by
|
|
1181
|
+
* the depth it writes. Its objects draw before the opaque objects that write color, so nothing
|
|
1182
|
+
* behind it shows through. With the `mask` or `hash` alpha mode, the parts that the alpha drops
|
|
1183
|
+
* write no depth either, so the surface cuts a shape out of the space it holds. A blended
|
|
1184
|
+
* surface keeps its place among the blended objects, which `setRenderOrder` orders. The default
|
|
1185
|
+
* is true.
|
|
1216
1186
|
*/
|
|
1217
1187
|
colorWrite?: boolean;
|
|
1218
|
-
/** Moves the surface's depth
|
|
1188
|
+
/** Moves the surface's depth before the depth test. The default is no bias. */
|
|
1219
1189
|
depthBias?: DepthBias;
|
|
1220
1190
|
/**
|
|
1221
|
-
* Draws the edges of each triangle as lines one pixel wide, with the material's own shading
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1191
|
+
* Draws the edges of each triangle as lines one pixel wide, with the material's own shading.
|
|
1192
|
+
* Edges that two triangles share draw twice. Its shadows draw lines too. Flat shading and bump
|
|
1193
|
+
* maps have no effect on it. The default is false.
|
|
1224
1194
|
*/
|
|
1225
1195
|
wireframe?: boolean;
|
|
1226
1196
|
}
|
|
@@ -1245,14 +1215,15 @@ export interface StandardBaseOptions extends StandardValues, MaterialFeatures {
|
|
|
1245
1215
|
*/
|
|
1246
1216
|
flatShading?: boolean;
|
|
1247
1217
|
/**
|
|
1248
|
-
* Where a light map's texture coordinates start
|
|
1249
|
-
* each light map on a mesh with its own scale and
|
|
1250
|
-
* two numbers, and needs a `lightMap`. The default
|
|
1218
|
+
* Where a light map's texture coordinates start: the engine adds it to the coordinates after
|
|
1219
|
+
* `lightMapRepeat` scales them. A bake places each light map on a mesh with its own scale and
|
|
1220
|
+
* offset, apart from the other maps. It takes two numbers, and needs a `lightMap`. The default
|
|
1221
|
+
* leaves the coordinates alone.
|
|
1251
1222
|
*/
|
|
1252
1223
|
lightMapOffset?: readonly [number, number];
|
|
1253
1224
|
/**
|
|
1254
|
-
* How a light map's texture coordinates stretch
|
|
1255
|
-
* numbers, and needs a `lightMap`. The default is `[1, 1]`.
|
|
1225
|
+
* How a light map's texture coordinates stretch: the engine multiplies the coordinates by it.
|
|
1226
|
+
* It takes two numbers, and needs a `lightMap`. The default is `[1, 1]`.
|
|
1256
1227
|
*/
|
|
1257
1228
|
lightMapRepeat?: readonly [number, number];
|
|
1258
1229
|
/**
|
|
@@ -1348,8 +1319,7 @@ export interface UnlitOptions extends UnlitValues, MaterialFeatures {
|
|
|
1348
1319
|
export interface ShadowCatcherValues extends MaterialOptions {
|
|
1349
1320
|
}
|
|
1350
1321
|
/**
|
|
1351
|
-
* Options of `materials.shadowCatcher`, a material that draws only the shadows that fall on it
|
|
1352
|
-
* three.js's `ShadowMaterial`.
|
|
1322
|
+
* Options of `materials.shadowCatcher`, a material that draws only the shadows that fall on it.
|
|
1353
1323
|
*
|
|
1354
1324
|
* @category api/materials
|
|
1355
1325
|
*/
|
|
@@ -1438,9 +1408,10 @@ export interface ShaderOptions<Wgsl extends string | CompiledWgsl = string | Com
|
|
|
1438
1408
|
* the WGSL calls `sceneDepth(uv)` or `sceneDistance(uv)`, and the engine binds the copy of the
|
|
1439
1409
|
* opaque scene's depth. A material that declares it draws after that copy exists, so it reads
|
|
1440
1410
|
* it in the transparent pass; a surface that draws earlier reads 0, the far plane. A material
|
|
1441
|
-
* that declares it
|
|
1442
|
-
*
|
|
1443
|
-
* sampled textures. The engine checks that the declaration and
|
|
1411
|
+
* that declares it samples at most six textures of its own, as every custom material does. Its
|
|
1412
|
+
* maps' group gives the copy a slot that those textures leave free, under WebGPU's limit of
|
|
1413
|
+
* sixteen sampled textures in the fragment stage. The engine checks that the declaration and
|
|
1414
|
+
* the WGSL agree.
|
|
1444
1415
|
*/
|
|
1445
1416
|
sceneInputs?: readonly SceneInput[];
|
|
1446
1417
|
/**
|
|
@@ -1490,6 +1461,11 @@ export declare class Material<Values extends MaterialOptions = MaterialOptions>
|
|
|
1490
1461
|
private bump;
|
|
1491
1462
|
/** The displacement map's scale and bias, which `set` changes one at a time, where it has one. */
|
|
1492
1463
|
private displacement;
|
|
1464
|
+
private inspectorNumbersGiven;
|
|
1465
|
+
private inspectorEmissive;
|
|
1466
|
+
private inspectorColorGiven;
|
|
1467
|
+
private inspectorEmissiveGiven;
|
|
1468
|
+
private inspectorBlending;
|
|
1493
1469
|
/**
|
|
1494
1470
|
* Where each map sits on the texture coordinates, as `set` last gave them: for every slot, the
|
|
1495
1471
|
* offset's two numbers, the scale's two and the rotation, so an animation can change one pair
|
|
@@ -1525,20 +1501,18 @@ export declare class Material<Values extends MaterialOptions = MaterialOptions>
|
|
|
1525
1501
|
/** Each map's transform, which a value makes where the material has none. */
|
|
1526
1502
|
private uvValues;
|
|
1527
1503
|
/**
|
|
1528
|
-
* Destroys the material
|
|
1529
|
-
*
|
|
1530
|
-
*
|
|
1531
|
-
*
|
|
1532
|
-
*
|
|
1533
|
-
* pass it, throw E1101.
|
|
1504
|
+
* Destroys the material. Objects and instance batches that still use it draw nothing until
|
|
1505
|
+
* `setMaterial` gives them another material. Once no object uses it, its place in the engine's
|
|
1506
|
+
* table of materials goes to the next material. When the last material of a custom material's
|
|
1507
|
+
* WGSL goes, the engine frees that WGSL's pipelines. The material's textures stay, so destroy
|
|
1508
|
+
* them apart. Later calls on the material, and calls that pass it, throw E1101.
|
|
1534
1509
|
*/
|
|
1535
1510
|
destroy(): void;
|
|
1536
1511
|
}
|
|
1537
1512
|
/**
|
|
1538
1513
|
* Material factories. The standard material follows glTF's metallic-roughness model and shades
|
|
1539
|
-
* with
|
|
1540
|
-
*
|
|
1541
|
-
* light's shadows, as three.js's `ShadowMaterial`.
|
|
1514
|
+
* with Lambert diffuse light and a GGX highlight. The unlit material shows its color whatever the
|
|
1515
|
+
* lights. The shadow-catcher material shows only the main directional light's shadows.
|
|
1542
1516
|
*
|
|
1543
1517
|
* @category api/materials
|
|
1544
1518
|
*/
|
|
@@ -1555,33 +1529,30 @@ export declare class Materials {
|
|
|
1555
1529
|
*/
|
|
1556
1530
|
private createId;
|
|
1557
1531
|
/**
|
|
1558
|
-
* A lit material with glTF's metallic-roughness model
|
|
1559
|
-
* `MeshStandardMaterial`.
|
|
1532
|
+
* A lit material with glTF's metallic-roughness model.
|
|
1560
1533
|
*/
|
|
1561
1534
|
standard(options?: StandardOptions): Material<StandardValues>;
|
|
1562
1535
|
/**
|
|
1563
1536
|
* A decal's material: the standard material, projected onto every opaque surface inside the
|
|
1564
|
-
* box of each object that it draws
|
|
1565
|
-
*
|
|
1566
|
-
*
|
|
1567
|
-
*
|
|
1568
|
-
*
|
|
1569
|
-
*
|
|
1537
|
+
* box of each object that it draws. Give it to a mesh of `geometry.box()`: the object's
|
|
1538
|
+
* position, rotation and scale place the box, and the material's maps stretch over the box's x
|
|
1539
|
+
* and y sides, seen along its z axis. The surfaces inside take its color, roughness, metalness,
|
|
1540
|
+
* normal map and emissive light, lit by the scene's lights, and blend with them as far as its
|
|
1541
|
+
* alpha says. A decal draws after the opaque objects, and marks no blended surface. It casts no
|
|
1542
|
+
* shadow.
|
|
1570
1543
|
*/
|
|
1571
1544
|
decal(options?: DecalOptions): Material<DecalValues>;
|
|
1572
1545
|
/**
|
|
1573
|
-
* A material that ignores lights and shows its color unlit
|
|
1574
|
-
*
|
|
1575
|
-
* them to that material.
|
|
1546
|
+
* A material that ignores lights and shows its color unlit. The exposure and the tone mapping
|
|
1547
|
+
* still apply to it.
|
|
1576
1548
|
*/
|
|
1577
1549
|
unlit(options?: UnlitOptions): Material<UnlitValues>;
|
|
1578
1550
|
/**
|
|
1579
|
-
* A material that draws only the shadows that fall on it
|
|
1580
|
-
*
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1583
|
-
*
|
|
1584
|
-
* three.js's. The material blends, so it draws in the transparent pass after the opaque
|
|
1551
|
+
* A material that draws only the shadows that fall on it: its `color` where the main
|
|
1552
|
+
* directional light's shadow falls, and nothing where the light reaches it, at `opacity`. The
|
|
1553
|
+
* mesh must receive shadows (`setReceiveShadows(true)`). Every shadow that falls on the surface
|
|
1554
|
+
* comes from the main directional light; point and spot lights cast none onto it. The default
|
|
1555
|
+
* color is black. The material blends, so it draws in the transparent pass after the opaque
|
|
1585
1556
|
* objects, and the scene's fog leaves it alone. It takes no texture maps.
|
|
1586
1557
|
*/
|
|
1587
1558
|
shadowCatcher(options?: ShadowCatcherOptions): Material<ShadowCatcherValues>;
|