@ignifx/core 0.15.0 → 0.17.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/decoders/draco3dgltf.LICENSE.md +201 -0
- package/decoders/draco_decoder.js +116 -0
- package/decoders/draco_decoder_gltf.wasm +0 -0
- package/decoders/vendored.json +22 -0
- package/dist/{decoders-CHJ7vduE.js → decoders-BUQrlS8U.js} +3 -2
- package/dist/decoders-BUQrlS8U.js.map +1 -0
- package/dist/{environment-DPi0_0SP.js → environment-CMpzGXTz.js} +2 -2
- package/dist/{environment-DPi0_0SP.js.map → environment-CMpzGXTz.js.map} +1 -1
- package/dist/{ignifx-error-oYdVnT1S.js → ignifx-error-Der0bpHK.js} +7 -1
- package/dist/ignifx-error-Der0bpHK.js.map +1 -0
- package/dist/index.d.ts +29 -14609
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1715 -4899
- package/dist/index.js.map +1 -1
- package/dist/{instanced-mesh-instance-NnODkvqK.js → instanced-mesh-instance-BMhREEfx.js} +3 -2
- package/dist/{instanced-mesh-instance-NnODkvqK.js.map → instanced-mesh-instance-BMhREEfx.js.map} +1 -1
- package/dist/{material-plugin-BUlqLsap.js → material-plugin-B-hartHR.js} +2 -2
- package/dist/{material-plugin-BUlqLsap.js.map → material-plugin-B-hartHR.js.map} +1 -1
- package/dist/node-DznSvwap.js +301 -0
- package/dist/node-DznSvwap.js.map +1 -0
- package/dist/{post-effect-BHl7U56q.js → post-effect-CuoYvrhb.js} +3 -30
- package/dist/post-effect-CuoYvrhb.js.map +1 -0
- package/dist/{post-effect-compiler-CRek8VxQ.js → post-effect-compiler-Bps8QbiJ.js} +3 -3
- package/dist/{post-effect-compiler-CRek8VxQ.js.map → post-effect-compiler-Bps8QbiJ.js.map} +1 -1
- package/dist/prefab-overrides-76IhcF-e.d.ts +14925 -0
- package/dist/prefab-overrides-76IhcF-e.d.ts.map +1 -0
- package/dist/prefab-overrides-DGiGTSN-.js +2396 -0
- package/dist/prefab-overrides-DGiGTSN-.js.map +1 -0
- package/dist/prefab.d.ts +2 -0
- package/dist/prefab.js +2 -0
- package/dist/reflection-probe-C0pzGrG_.js +1883 -0
- package/dist/reflection-probe-C0pzGrG_.js.map +1 -0
- package/dist/reflection-probes-B8_vK9YR.js +551 -0
- package/dist/reflection-probes-B8_vK9YR.js.map +1 -0
- package/dist/{render-texture-C_TnaSz2.js → render-texture-UqRHRLQy.js} +15 -2
- package/dist/{render-texture-C_TnaSz2.js.map → render-texture-UqRHRLQy.js.map} +1 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/{shader-material-B6p66wB8.js → shader-material-Cjfq7nFS.js} +5 -16
- package/dist/{shader-material-B6p66wB8.js.map → shader-material-Cjfq7nFS.js.map} +1 -1
- package/dist/{shader-material-C0TAUr4t.js → shader-material-DCjYDdkh.js} +2 -2
- package/dist/{shader-material-C0TAUr4t.js.map → shader-material-DCjYDdkh.js.map} +1 -1
- package/dist/{shader-pragma-BKCoZTTA.js → shader-pragma-cjEC-EPK.js} +2 -2
- package/dist/{shader-pragma-BKCoZTTA.js.map → shader-pragma-cjEC-EPK.js.map} +1 -1
- package/dist/{surface-shader-BaK0kvBB.js → surface-shader-D40hXQ8c.js} +4 -4
- package/dist/{surface-shader-BaK0kvBB.js.map → surface-shader-D40hXQ8c.js.map} +1 -1
- package/dist/{vec3-D-0Y2mzE.js → vec3-Cc19wl4r.js} +3 -300
- package/dist/vec3-Cc19wl4r.js.map +1 -0
- package/package.json +11 -5
- package/dist/decoders-CHJ7vduE.js.map +0 -1
- package/dist/ignifx-error-oYdVnT1S.js.map +0 -1
- package/dist/json-CzZZ6K4x.js +0 -24
- package/dist/json-CzZZ6K4x.js.map +0 -1
- package/dist/post-effect-BHl7U56q.js.map +0 -1
- package/dist/vec3-D-0Y2mzE.js.map +0 -1
|
@@ -1,303 +1,6 @@
|
|
|
1
1
|
import { n as EPSILON, u as lerp } from "./math-utils-BcDnL-gi.js";
|
|
2
2
|
import { n as Mat4 } from "./mat4-D6exvAuO.js";
|
|
3
|
-
import { addToScene, cloneTransformNode, createBox, createCapsule, createCylinder, createGround, createMeshFromData, createPlane, createSphere, createTorus,
|
|
4
|
-
//#region src/lite/node.ts
|
|
5
|
-
/** The single key ignifx owns inside Lite's open `metadata` record. */
|
|
6
|
-
const METADATA_KEY = "ignifx";
|
|
7
|
-
/** Number of elements in a 4x4 matrix. */
|
|
8
|
-
const MATRIX_LENGTH = 16;
|
|
9
|
-
/**
|
|
10
|
-
* Creates a pure transform node at the origin with an identity rotation and unit scale.
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* The node is deliberately **not** added to any Lite scene: a transform node is only a matrix
|
|
14
|
-
* provider, and `worldMatrix` is valid the moment the node exists (see rule 5 in the module
|
|
15
|
-
* documentation). Renderable Lite objects created by components are parented under it and added
|
|
16
|
-
* with `addToScene` separately.
|
|
17
|
-
*
|
|
18
|
-
* @param name - A human-readable name; Lite never uses it for lookup and it need not be unique.
|
|
19
|
-
* @returns A fresh, unparented transform node.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* const node = createNode("Player");
|
|
24
|
-
* node.position.set(1, 2, 3);
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
function createNode(name) {
|
|
30
|
-
return createTransformNode(name);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Releases a pure transform node.
|
|
34
|
-
*
|
|
35
|
-
* @remarks
|
|
36
|
-
* Lite requires nothing to release a transform node that was never added to a scene: verified in
|
|
37
|
-
* `lib/scene/transform-node.js` and `lib/scene/scene-node.js`, the node is a plain object holding
|
|
38
|
-
* three observable values, one `Float32Array` for the cached world matrix, and closures — no GPU
|
|
39
|
-
* resource, no ref count, no scene registry. (Reference counting in `lib/resource/ref-count.js`
|
|
40
|
-
* applies to meshes and their GPU buffers only, and `disposeScene` never walks transform nodes.)
|
|
41
|
-
*
|
|
42
|
-
* What *does* need doing is breaking the parent link: a linked parent keeps a reference to this
|
|
43
|
-
* node's world-matrix state so it can invalidate it, so a node dropped while still parented is
|
|
44
|
-
* retained by its parent. This function therefore unlinks the node and drops the ignifx tag. It
|
|
45
|
-
* leaves the node's own `children` alone: the kernel destroys children before parents
|
|
46
|
-
* (`docs/architecture/01-lifecycle-and-time.md` §3 step 9), so each child unlinks itself first.
|
|
47
|
-
*
|
|
48
|
-
* @param node - A node from {@link createNode}.
|
|
49
|
-
*
|
|
50
|
-
* @internal
|
|
51
|
-
*/
|
|
52
|
-
function disposeNode(node) {
|
|
53
|
-
linkParent(node, null);
|
|
54
|
-
const metadata = node.metadata;
|
|
55
|
-
if (metadata !== void 0) delete metadata[METADATA_KEY];
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Links `child` under `parent`, **keeping the child's local values** — its world transform moves
|
|
59
|
-
* with the new parent. This is `setParent(parent, { worldPositionStays: false })` in
|
|
60
|
-
* `docs/architecture/02-scene-graph.md` §5.1.
|
|
61
|
-
*
|
|
62
|
-
* @remarks
|
|
63
|
-
* Lite has no public helper for this case (its own `setParent` preserves the world transform), so
|
|
64
|
-
* the adapter does the linking itself: it assigns `child.parent`, which is the setter that
|
|
65
|
-
* re-registers the child's world-matrix state with the new parent and invalidates the subtree, and
|
|
66
|
-
* maintains the `children` arrays on both the old and the new parent so tree traversal stays
|
|
67
|
-
* consistent. Passing the parent the child already has is a no-op.
|
|
68
|
-
*
|
|
69
|
-
* @param child - The node to move.
|
|
70
|
-
* @param parent - The new parent, or `null` to detach the child to world space.
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```ts
|
|
74
|
-
* linkParent(child, parent); // child keeps localPosition; its world position changes
|
|
75
|
-
* ```
|
|
76
|
-
*
|
|
77
|
-
* @internal
|
|
78
|
-
*/
|
|
79
|
-
function linkParent(child, parent) {
|
|
80
|
-
const previous = child.parent;
|
|
81
|
-
if (previous === parent) return;
|
|
82
|
-
const previousChildren = childrenOf(previous);
|
|
83
|
-
if (previousChildren !== null) {
|
|
84
|
-
const index = previousChildren.indexOf(child);
|
|
85
|
-
if (index >= 0) previousChildren.splice(index, 1);
|
|
86
|
-
}
|
|
87
|
-
child.parent = parent;
|
|
88
|
-
if (parent !== null && !parent.children.includes(child)) parent.children.push(child);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Reparents `child` under `parent` **keeping its world transform**, by delegating to Lite's own
|
|
92
|
-
* `setParent`. This is `setParent(parent, { worldPositionStays: true })`, the ignifx default
|
|
93
|
-
* (`docs/architecture/02-scene-graph.md` §5.1).
|
|
94
|
-
*
|
|
95
|
-
* @remarks
|
|
96
|
-
* Lite snapshots the child's world matrix, relinks the node (maintaining both `children` arrays),
|
|
97
|
-
* then decomposes `inverse(parentWorld) × childWorld` back into local TRS. Two documented caveats
|
|
98
|
-
* carry straight through to ignifx:
|
|
99
|
-
*
|
|
100
|
-
* - **Singular parent matrices.** When the parent's world matrix has a collapsed axis it cannot be
|
|
101
|
-
* inverted, so no local transform can reproduce the child's world. Lite then keeps the parent
|
|
102
|
-
* link and copies the child's world *position* into its local position, leaving rotation and
|
|
103
|
-
* scale uncompensated. Non-uniform-but-invertible parents are fine; zero scale on any axis is
|
|
104
|
-
* not.
|
|
105
|
-
* - **Canonical, not sign-faithful, decomposition.** The local TRS comes from `decomposeMat4`,
|
|
106
|
-
* which folds a reflection into a negative Y scale. The world matrix is reproduced exactly, but a
|
|
107
|
-
* child that had a negative X scale comes back with a negative Y scale and a different rotation.
|
|
108
|
-
*
|
|
109
|
-
* A third caveat in Lite's TSDoc — that `child.parent` links are only established by `addToScene`,
|
|
110
|
-
* so a node from a freshly loaded asset must have its container added before it is reparented —
|
|
111
|
-
* does not apply to nodes ignifx creates, because {@link linkParent} establishes the link itself.
|
|
112
|
-
*
|
|
113
|
-
* @param child - The node to move.
|
|
114
|
-
* @param parent - The new parent, or `null` to detach the child to world space.
|
|
115
|
-
*
|
|
116
|
-
* @internal
|
|
117
|
-
*/
|
|
118
|
-
function reparentKeepingWorld(child, parent) {
|
|
119
|
-
setParent(child, parent);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Copies a node's world matrix into `out`.
|
|
123
|
-
*
|
|
124
|
-
* @remarks
|
|
125
|
-
* Allocation-free on the ignifx side, which is why the destination is a parameter: Lite's
|
|
126
|
-
* `worldMatrix` getter may recompute up the parent chain, and the object it returns is Lite's own
|
|
127
|
-
* cache — never hold on to it. Lite documents `Mat4` as opaque ("callers MUST NOT depend on the
|
|
128
|
-
* underlying storage"); it is a `Float32Array` in 1.27.0 (`lib/math/_matrix-allocator.js`), so
|
|
129
|
-
* copying element by element is the only supported read.
|
|
130
|
-
*
|
|
131
|
-
* @param node - The node to read.
|
|
132
|
-
* @param out - A sink of at least 16 elements, written in column-major order.
|
|
133
|
-
* @returns `out`, for chaining.
|
|
134
|
-
*
|
|
135
|
-
* @internal
|
|
136
|
-
*/
|
|
137
|
-
function readWorldMatrix(node, out) {
|
|
138
|
-
const matrix = node.worldMatrix;
|
|
139
|
-
for (let index = 0; index < MATRIX_LENGTH; index += 1) out[index] = matrix[index] ?? 0;
|
|
140
|
-
return out;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Reads a node's world-matrix version — the counter that increases whenever the node's world
|
|
144
|
-
* matrix is invalidated, by its own TRS or by any ancestor's.
|
|
145
|
-
*
|
|
146
|
-
* @remarks
|
|
147
|
-
* Snapshot it to detect movement without comparing matrices; systems that maintain acceleration
|
|
148
|
-
* structures do exactly that (`docs/architecture/02-scene-graph.md` §9). The counter is
|
|
149
|
-
* monotonically increasing but not a change *count*: it moves on invalidation, not on
|
|
150
|
-
* recomputation, and a bulk `position.set(...)` bumps it even when the values are unchanged.
|
|
151
|
-
*
|
|
152
|
-
* @param node - The node to read.
|
|
153
|
-
* @returns The current version.
|
|
154
|
-
*
|
|
155
|
-
* @internal
|
|
156
|
-
*/
|
|
157
|
-
function worldMatrixVersion(node) {
|
|
158
|
-
return node.worldMatrixVersion;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Shows or hides **one** node, without touching its subtree.
|
|
162
|
-
*
|
|
163
|
-
* @remarks
|
|
164
|
-
* Lite's `visible` is per node — the renderer reads each node's own flag, and `setSubtreeVisible`
|
|
165
|
-
* is only a bulk helper that materialises a cascade at write time. ignifx already materialises
|
|
166
|
-
* `activeInHierarchy` over the subtree itself, so it writes one flag per entity: correct for a
|
|
167
|
-
* subtree that mixes active and inactive entities, and linear rather than quadratic.
|
|
168
|
-
*
|
|
169
|
-
* @param node - The node to show or hide.
|
|
170
|
-
* @param visible - `true` to show it, `false` to hide it.
|
|
171
|
-
*
|
|
172
|
-
* @internal
|
|
173
|
-
*/
|
|
174
|
-
function setNodeSelfVisible(node, visible) {
|
|
175
|
-
node.visible = visible;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Writes the ignifx identity into a node's Lite metadata bag, under the single `ignifx` key.
|
|
179
|
-
*
|
|
180
|
-
* @remarks
|
|
181
|
-
* `LiteMetadata` is an open record (`{ gltf?: GltfMetadata; [key: string]: unknown }`), so the tag
|
|
182
|
-
* coexists with the `gltf.extras` a glTF load writes. The metadata object is created on demand;
|
|
183
|
-
* nodes ignifx never tags keep `metadata` undefined.
|
|
184
|
-
*
|
|
185
|
-
* @param node - The node to tag.
|
|
186
|
-
* @param tag - The owning entity, and the component that created the node when it is not the
|
|
187
|
-
* entity's own transform.
|
|
188
|
-
*
|
|
189
|
-
* @internal
|
|
190
|
-
*/
|
|
191
|
-
function tagNode(node, tag) {
|
|
192
|
-
const metadata = node.metadata ??= {};
|
|
193
|
-
metadata[METADATA_KEY] = tag;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Reads the ignifx identity back from a node.
|
|
197
|
-
*
|
|
198
|
-
* @param node - The node to read; it may be any Lite node, including one ignifx never created.
|
|
199
|
-
* @returns The tag {@link tagNode} wrote, or `null` when the node carries none.
|
|
200
|
-
*
|
|
201
|
-
* @internal
|
|
202
|
-
*/
|
|
203
|
-
function readNodeTag(node) {
|
|
204
|
-
const metadata = node.metadata;
|
|
205
|
-
if (metadata === void 0) return null;
|
|
206
|
-
const value = metadata[METADATA_KEY];
|
|
207
|
-
if (typeof value !== "object" || value === null || !("entity" in value)) return null;
|
|
208
|
-
const entity = value.entity;
|
|
209
|
-
if (typeof entity !== "number") return null;
|
|
210
|
-
const component = "component" in value ? value.component : void 0;
|
|
211
|
-
return typeof component === "number" ? {
|
|
212
|
-
entity,
|
|
213
|
-
component
|
|
214
|
-
} : { entity };
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* The `children` array of a world-matrix provider, when it has one.
|
|
218
|
-
*
|
|
219
|
-
* @remarks
|
|
220
|
-
* `SceneNode.parent` is typed as the minimal {@link IWorldMatrixProvider}, which declares no
|
|
221
|
-
* `children`, but every parent ignifx links is a scene node. Lite's own `setParent` solves this the
|
|
222
|
-
* same way (`lib/scene/set-parent.js`), and the array check keeps a non-node provider — a camera,
|
|
223
|
-
* say — from being treated as a tree node.
|
|
224
|
-
*
|
|
225
|
-
* @param provider - The candidate parent.
|
|
226
|
-
* @returns The provider's children, or `null` when it is not a tree node.
|
|
227
|
-
*/
|
|
228
|
-
function childrenOf(provider) {
|
|
229
|
-
if (provider === null || !("children" in provider)) return null;
|
|
230
|
-
const children = provider.children;
|
|
231
|
-
return Array.isArray(children) ? children : null;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* The node's local position as a live, writable view.
|
|
235
|
-
*
|
|
236
|
-
* @remarks
|
|
237
|
-
* Zero-copy: the returned object *is* Lite's `ObservableVec3` over the node's TRS, so `.x += 1`,
|
|
238
|
-
* `.set(x, y, z)`, and `.copyFrom(v)` write straight through and invalidate the subtree's world
|
|
239
|
-
* matrices (`docs/architecture/02-scene-graph.md` §5). Never hold it past the node's lifetime.
|
|
240
|
-
*
|
|
241
|
-
* @param node - The node to view.
|
|
242
|
-
* @returns The live local position.
|
|
243
|
-
*
|
|
244
|
-
* @internal
|
|
245
|
-
*/
|
|
246
|
-
function localPosition(node) {
|
|
247
|
-
return node.position;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* The node's local rotation as a live, writable view.
|
|
251
|
-
*
|
|
252
|
-
* @param node - The node to view.
|
|
253
|
-
* @returns The live local rotation quaternion.
|
|
254
|
-
*
|
|
255
|
-
* @internal
|
|
256
|
-
*/
|
|
257
|
-
function localRotation(node) {
|
|
258
|
-
return node.rotationQuaternion;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* The node's local scale as a live, writable view.
|
|
262
|
-
*
|
|
263
|
-
* @param node - The node to view.
|
|
264
|
-
* @returns The live local scale.
|
|
265
|
-
*
|
|
266
|
-
* @internal
|
|
267
|
-
*/
|
|
268
|
-
function localScale(node) {
|
|
269
|
-
return node.scaling;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Renames a node.
|
|
273
|
-
*
|
|
274
|
-
* @remarks
|
|
275
|
-
* Lite never uses the name for lookup, so this is purely for debugging and for the names that show
|
|
276
|
-
* up in Lite-side tooling; ignifx keeps `Entity.name` as the source of truth and mirrors it here.
|
|
277
|
-
*
|
|
278
|
-
* @param node - The node to rename.
|
|
279
|
-
* @param name - The new name.
|
|
280
|
-
*
|
|
281
|
-
* @internal
|
|
282
|
-
*/
|
|
283
|
-
function setNodeName(node, name) {
|
|
284
|
-
node.name = name;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* The parent a node is currently linked to, when that parent is itself a scene node.
|
|
288
|
-
*
|
|
289
|
-
* @param node - The node to read.
|
|
290
|
-
* @returns The parent node, or `null` when the node is unparented or its parent is a bare
|
|
291
|
-
* world-matrix provider such as a camera.
|
|
292
|
-
*
|
|
293
|
-
* @internal
|
|
294
|
-
*/
|
|
295
|
-
function parentNode(node) {
|
|
296
|
-
const parent = node.parent;
|
|
297
|
-
if (parent === null || !("children" in parent)) return null;
|
|
298
|
-
return parent;
|
|
299
|
-
}
|
|
300
|
-
//#endregion
|
|
3
|
+
import { addToScene, cloneTransformNode, createBox, createCapsule, createCylinder, createGround, createMeshFromData, createPlane, createSphere, createTorus, removeFromScene, setSubtreeVisible, updateMeshColors, updateMeshNormals, updateMeshPositions, updateMeshUvs } from "@babylonjs/lite";
|
|
301
4
|
//#region src/lite/gpu/mesh.ts
|
|
302
5
|
/**
|
|
303
6
|
* Creates a box template.
|
|
@@ -1509,6 +1212,6 @@ const VEC3_BACKWARD = Object.freeze({
|
|
|
1509
1212
|
z: -1
|
|
1510
1213
|
});
|
|
1511
1214
|
//#endregion
|
|
1512
|
-
export { setMeshReceiveShadows as A,
|
|
1215
|
+
export { setMeshReceiveShadows as A, overrideSubtreeMaterials as C, setMeshId as D, setMeshBounds as E, updateMeshPositions$1 as F, updateMeshUvs$1 as I, setMeshSubtreeVisible as M, updateMeshColors$1 as N, setMeshMaterial as O, updateMeshNormals$1 as P, disposeMeshTemplate as S, removeMeshFromScene as T, createMeshFromGeometry as _, VEC3_ONE as a, createTorusMesh as b, VEC3_ZERO as c, cloneMeshUnderNode as d, collectSubtreeMeshes as f, createGroundMesh as g, createCylinderMesh as h, VEC3_LEFT as i, setMeshRenderOrder as j, setMeshPickable as k, Vec3 as l, createCapsuleMesh as m, VEC3_DOWN as n, VEC3_RIGHT as o, createBoxMesh as p, VEC3_FORWARD as r, VEC3_UP as s, VEC3_BACKWARD as t, addMeshToScene as u, createPlaneMesh as v, recomputeMeshBounds as w, detachMeshBounds as x, createSphereMesh as y };
|
|
1513
1216
|
|
|
1514
|
-
//# sourceMappingURL=vec3-
|
|
1217
|
+
//# sourceMappingURL=vec3-Cc19wl4r.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vec3-Cc19wl4r.js","names":["updateMeshPositions","updateMeshNormals","updateMeshUvs","updateMeshColors"],"sources":["../src/lite/gpu/mesh.ts","../src/math/vec3.ts"],"sourcesContent":["import {\n addToScene,\n cloneTransformNode,\n createBox,\n createCapsule,\n createCylinder,\n createGround,\n createMeshFromData,\n createPlane,\n createSphere,\n createTorus,\n removeFromScene,\n setSubtreeVisible,\n updateMeshColors as liteUpdateMeshColors,\n updateMeshNormals as liteUpdateMeshNormals,\n updateMeshPositions as liteUpdateMeshPositions,\n updateMeshUvs as liteUpdateMeshUvs,\n} from \"@babylonjs/lite\";\nimport type {\n BoxOptions,\n CapsuleOptions,\n CylinderOptions,\n EngineContext,\n GroundOptions,\n Material,\n Mesh,\n PlaneOptions,\n SceneContext,\n SceneNode,\n SphereOptions,\n TorusOptions,\n} from \"@babylonjs/lite\";\n\n/**\n * Mesh half of the Babylon Lite adapter (`docs/architecture/07-rendering.md` §2.3). Every function\n * here needs a WebGPU device — `createMeshFromData` uploads four vertex buffers through\n * `engine._device` (`lib/mesh/mesh.js`, `uploadMeshToGPU`) and the null engine has no `_device` —\n * so the whole module lives under `src/lite/gpu/` and is covered by the browser test project.\n *\n * Everything here is `@internal`.\n *\n * ## Ownership, cloning, and disposal (verified against `@babylonjs/lite@1.27.0`)\n *\n * - `cloneTransformNode(mesh)` (`index.d.ts` 1776, `lib/scene/transform-node.js`) shallow-clones a\n * mesh: the clone gets a fresh transform and **the same `_gpu` wrapper object**, with\n * `retain(_gpu)` bumping a reference count. So N clones of one template share exactly one set of\n * GPU buffers — that is spike S2.4's \"instancing shares GPU buffers\", and it is provable by\n * object identity rather than by measuring memory.\n * - Disposal is driven entirely by scene membership. `removeFromScene` calls `unregisterMeshScene`,\n * and only when the mesh has left its **last** scene does it queue `disposeMeshGpu`, which calls\n * `release(_gpu)` and destroys the buffers only when the count drops to one\n * (`lib/scene/scene-remove.js`, `lib/mesh/mesh-dispose.js`, `lib/resource/ref-count.js`). A\n * template that is never added to a scene therefore keeps its buffers alive no matter how many\n * clones come and go — which is what `docs/architecture/07-rendering.md` §2.3 means by \"the\n * template's buffers stay alive while the asset is retained\".\n * - The flip side is that Lite exports **no** mesh disposer. The only public way to release a\n * template's buffers is {@link disposeMeshTemplate}: add it to a scene and take it out again.\n * - `removeFromScene` also recursively removes a mesh's `children` and nulls its `parent`, so\n * removing a `Model`'s root removes the whole instantiated subtree in one call.\n * - Hiding is `setSubtreeVisible` (exported as `setMeshVisible` too, `index.d.ts` 11199): it\n * cascades `visible` down the subtree and bumps a global visibility epoch. Never remove a mesh\n * from the scene to hide it — that disposes it.\n *\n * ## Updating a mesh's vertices (verified against `lib/mesh/mesh-factories.js`)\n *\n * `updateMesh*` writes the GPU buffer and **nothing else**. Three consequences, all of them\n * surprising enough to be worth stating where the calls are:\n *\n * 1. **The retained CPU arrays are not replaced.** `createMeshFromData` keeps `_cpuPositions`,\n * `_cpuNormals`, `_cpuUvs` and `_cpuIndices` — the arrays it was handed — and Lite's CPU ray\n * pick reads them (`lib/picking/ray-pick.js`). Only `updateMeshGeometry`/`resizeMeshGeometry`\n * re-retain, through `retainMeshGeometry`. So an update that hands over a *different* array\n * leaves picking looking at the old geometry, while an update after mutating the retained array\n * in place leaves picking exact. `MeshAsset` keeps its own copy in step for that reason.\n * 2. **Bounds are not recomputed.** `retainMeshGeometry` is what calls `computeAabb` and writes\n * `boundMin`/`boundMax`; the partial updaters do not. `Mesh`'s own declaration says a consumer\n * \"MAY overwrite these with a wider hand-computed box\", so {@link setMeshBounds} exists and\n * `MeshAsset.updatePositions` uses it.\n * 3. **A cloned template cannot be updated at all.** `writeVertexAttributeRange` throws\n * (`ThrowLiteError(360)`) when `mesh._gpu._refCount > 1`, and cloning a mesh retains that very\n * wrapper. A `MeshAsset` a `MeshRenderer` has drawn is therefore frozen; a mesh meant to be\n * edited is a renderable of its own, which is the shape the terrain chunk adapter uses.\n */\n\n/**\n * The Babylon Lite mesh a `MeshAsset` template and a `MeshRenderer` clone are, re-exported under an\n * ignifx name so feature code can name the type without importing `@babylonjs/lite`\n * (`CONSTITUTION.md` §3.4, coding standards §4).\n *\n * @remarks\n * Unstable: it is Lite's own type, reachable only through documented `.lite` escape hatches, and it\n * is excluded from the stability guarantees of `CONSTITUTION.md` Article IV.\n *\n * @public\n */\nexport type LiteMesh = Mesh;\n\n/**\n * Creates a box template.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - A uniform size, or per-axis dimensions.\n * @returns The mesh. It belongs to no scene yet.\n *\n * @example\n * ```ts\n * const template = createBoxMesh(engine, { size: 2 });\n * const instance = cloneMeshUnderNode(template, entityNode);\n * addMeshToScene(scene, instance);\n * ```\n *\n * @internal\n */\nexport function createBoxMesh(engine: EngineContext, options?: number | BoxOptions): Mesh {\n return createBox(engine, options);\n}\n\n/**\n * Creates a sphere template.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Segment count and diameters.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createSphereMesh(engine: EngineContext, options?: SphereOptions): Mesh {\n return createSphere(engine, options);\n}\n\n/**\n * Creates a plane template in the XY plane.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Size, or width and height.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createPlaneMesh(engine: EngineContext, options?: PlaneOptions): Mesh {\n return createPlane(engine, options);\n}\n\n/**\n * Creates a subdivided ground template in the XZ plane.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Width, height, subdivisions, and UV scale.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createGroundMesh(engine: EngineContext, options?: GroundOptions): Mesh {\n return createGround(engine, options);\n}\n\n/**\n * Creates a cylinder template along the Y axis.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Height, diameters, and tessellation.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createCylinderMesh(engine: EngineContext, options?: CylinderOptions): Mesh {\n return createCylinder(engine, options);\n}\n\n/**\n * Creates a capsule template along the Y axis.\n *\n * @remarks\n * `height` is the **total** height including both caps (`index.d.ts` 1523), which is the same\n * convention `@ignifx/physics`'s capsule collider uses, so a renderer and a collider built from one\n * pair of numbers line up.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Height, radius, and tessellation.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createCapsuleMesh(engine: EngineContext, options?: CapsuleOptions): Mesh {\n return createCapsule(engine, options);\n}\n\n/**\n * Creates a torus template in the XZ plane.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Diameter, thickness, and tessellation.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createTorusMesh(engine: EngineContext, options?: TorusOptions): Mesh {\n return createTorus(engine, options);\n}\n\n/**\n * Creates a mesh from raw vertex data.\n *\n * @remarks\n * Lite keeps a reference to the arrays that are handed in — it does not copy them — and uses them\n * for CPU ray picking and bounds (`lib/mesh/mesh-factories.js`). Callers must not mutate them\n * afterwards.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param name - A debug name.\n * @param positions - Three floats per vertex.\n * @param normals - Three floats per vertex.\n * @param indices - Three indices per triangle.\n * @param uvs - Two floats per vertex, or omitted.\n * @param uvs2 - Two floats per vertex for the second UV set, or omitted.\n * @param tangents - Four floats per vertex, or omitted.\n * @param colors - Four floats per vertex, or omitted.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createMeshFromGeometry(\n engine: EngineContext,\n name: string,\n positions: Float32Array,\n normals: Float32Array,\n indices: Uint32Array,\n uvs?: Float32Array,\n uvs2?: Float32Array,\n tangents?: Float32Array,\n colors?: Float32Array,\n): Mesh {\n return createMeshFromData(engine, name, positions, normals, indices, uvs, uvs2, tangents, colors);\n}\n\n/**\n * Re-uploads part of a mesh's position buffer.\n *\n * @remarks\n * A no-op range is accepted; an out-of-range one, or a mesh whose GPU geometry has co-owners,\n * throws a Lite error (see the module note). It does **not** refresh the CPU picking geometry or\n * the bounds.\n *\n * @param engine - The engine that owns the buffer.\n * @param mesh - The mesh to update.\n * @param positions - Three floats per vertex, read from index 0.\n * @param vertexOffset - The first destination vertex to overwrite.\n * @param vertexCount - How many vertices to write.\n *\n * @internal\n */\nexport function updateMeshPositions(\n engine: EngineContext,\n mesh: Mesh,\n positions: Float32Array,\n vertexOffset: number,\n vertexCount: number,\n): void {\n liteUpdateMeshPositions(engine, mesh, positions, vertexOffset, vertexCount);\n}\n\n/**\n * Re-uploads part of a mesh's normal buffer.\n *\n * @param engine - The engine that owns the buffer.\n * @param mesh - The mesh to update.\n * @param normals - Three floats per vertex.\n * @param vertexOffset - The first destination vertex to overwrite.\n * @param vertexCount - How many vertices to write.\n *\n * @internal\n */\nexport function updateMeshNormals(\n engine: EngineContext,\n mesh: Mesh,\n normals: Float32Array,\n vertexOffset: number,\n vertexCount: number,\n): void {\n liteUpdateMeshNormals(engine, mesh, normals, vertexOffset, vertexCount);\n}\n\n/**\n * Re-uploads part of a mesh's UV buffer.\n *\n * @remarks\n * Lite makes it a no-op when the mesh was created without UVs, rather than an error.\n *\n * @param engine - The engine that owns the buffer.\n * @param mesh - The mesh to update.\n * @param uvs - Two floats per vertex.\n * @param vertexOffset - The first destination vertex to overwrite.\n * @param vertexCount - How many vertices to write.\n *\n * @internal\n */\nexport function updateMeshUvs(\n engine: EngineContext,\n mesh: Mesh,\n uvs: Float32Array,\n vertexOffset: number,\n vertexCount: number,\n): void {\n liteUpdateMeshUvs(engine, mesh, uvs, vertexOffset, vertexCount);\n}\n\n/**\n * Re-uploads part of a mesh's vertex-colour buffer.\n *\n * @remarks\n * The colour attribute is `vec4`, and Lite makes the call a no-op when the mesh was created without\n * colours.\n *\n * @param engine - The engine that owns the buffer.\n * @param mesh - The mesh to update.\n * @param colors - Four floats per vertex.\n * @param vertexOffset - The first destination vertex to overwrite.\n * @param vertexCount - How many vertices to write.\n *\n * @internal\n */\nexport function updateMeshColors(\n engine: EngineContext,\n mesh: Mesh,\n colors: Float32Array,\n vertexOffset: number,\n vertexCount: number,\n): void {\n liteUpdateMeshColors(engine, mesh, colors, vertexOffset, vertexCount);\n}\n\n/**\n * Writes a mesh's object-local bounding box.\n *\n * @remarks\n * `Mesh.boundMin`/`boundMax` are declared consumer-writable, and writing them is the only way to\n * keep the shadow fit, the thin-instance culler and the Havok shape extents honest after a partial\n * vertex update — none of the partial updaters recomputes them. The existing arrays are mutated in\n * place when they are there, so repeated sculpting allocates nothing.\n *\n * @param mesh - The mesh to re-bound.\n * @param minX - The smallest X.\n * @param minY - The smallest Y.\n * @param minZ - The smallest Z.\n * @param maxX - The largest X.\n * @param maxY - The largest Y.\n * @param maxZ - The largest Z.\n *\n * @internal\n */\nexport function setMeshBounds(\n mesh: Mesh,\n minX: number,\n minY: number,\n minZ: number,\n maxX: number,\n maxY: number,\n maxZ: number,\n): void {\n const boundMin = mesh.boundMin;\n if (boundMin === undefined) {\n mesh.boundMin = [minX, minY, minZ];\n } else {\n boundMin[0] = minX;\n boundMin[1] = minY;\n boundMin[2] = minZ;\n }\n const boundMax = mesh.boundMax;\n if (boundMax === undefined) {\n mesh.boundMax = [maxX, maxY, maxZ];\n } else {\n boundMax[0] = maxX;\n boundMax[1] = maxY;\n boundMax[2] = maxZ;\n }\n}\n\n/**\n * Gives a cloned mesh bounding-box arrays of its own.\n *\n * @remarks\n * `cloneMeshNode` shallow-spreads the template (`lib/scene/transform-node.js`), so a clone starts\n * out sharing the template's `boundMin`/`boundMax` arrays and {@link setMeshBounds} — which mutates\n * in place — would write through to the template and to every other clone. Any caller that re-bounds\n * one clone alone has to call this first.\n *\n * @param mesh - The clone.\n *\n * @internal\n */\nexport function detachMeshBounds(mesh: Mesh): void {\n const boundMin = mesh.boundMin;\n if (boundMin !== undefined) {\n mesh.boundMin = [boundMin[0], boundMin[1], boundMin[2]];\n }\n const boundMax = mesh.boundMax;\n if (boundMax !== undefined) {\n mesh.boundMax = [boundMax[0], boundMax[1], boundMax[2]];\n }\n}\n\n/**\n * Recomputes a mesh's object-local bounding box from a position array and writes it.\n *\n * @remarks\n * The partial vertex updaters leave `boundMin`/`boundMax` alone (see the module note), and every\n * consumer that fits a shadow cascade, culls a thin instance, or measures a Havok shape reads them.\n * One linear pass, no allocation. A position array too short to hold one vertex leaves the bounds\n * as they were.\n *\n * @param mesh - The mesh to re-bound.\n * @param positions - Three floats per vertex.\n *\n * @internal\n */\nexport function recomputeMeshBounds(mesh: Mesh, positions: Float32Array): void {\n if (positions.length < 3) {\n return;\n }\n let minX = Number.POSITIVE_INFINITY;\n let minY = Number.POSITIVE_INFINITY;\n let minZ = Number.POSITIVE_INFINITY;\n let maxX = Number.NEGATIVE_INFINITY;\n let maxY = Number.NEGATIVE_INFINITY;\n let maxZ = Number.NEGATIVE_INFINITY;\n for (let index = 0; index + 2 < positions.length; index += 3) {\n const x = positions[index] ?? 0;\n const y = positions[index + 1] ?? 0;\n const z = positions[index + 2] ?? 0;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n minZ = z < minZ ? z : minZ;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n maxZ = z > maxZ ? z : maxZ;\n }\n setMeshBounds(mesh, minX, minY, minZ, maxX, maxY, maxZ);\n}\n\n/**\n * Clones a template — mesh or transform-node subtree — and parents the clone under an entity node.\n *\n * @remarks\n * The clone shares the template's GPU buffers (see the module note). Cloning a mesh whose buffers\n * were already released throws, which is Lite's way of telling you the template outlived its asset.\n *\n * Only the `parent` link is written; the clone is deliberately **not** pushed into the parent's\n * `children` array, for the same reason cameras and lights are not (`./camera.ts`): ignifx\n * transform nodes are never added to a Lite scene, so nothing in Lite walks their children, and\n * `removeFromScene` nulls a removed mesh's `parent` without touching the array it was listed in —\n * so maintaining it would only create a stale entry to clean up.\n *\n * @param template - The mesh or subtree to clone.\n * @param parent - The entity's transform node, or `null` for world space.\n * @returns The cloned root. Add it to the scene with {@link addMeshToScene}.\n *\n * @internal\n */\nexport function cloneMeshUnderNode(template: SceneNode, parent: SceneNode | null): SceneNode {\n const clone = cloneTransformNode(template);\n clone.parent = parent;\n return clone;\n}\n\n/**\n * Adds a mesh — or a transform-node subtree containing meshes — to a render scene.\n *\n * @remarks\n * `addToScene` recurses into `children` and re-parents each one, so a whole instantiated model goes\n * in with one call. When the scene is already registered, the mesh joins Lite's runtime\n * material-swap queue and appears once its material family's renderable has been rebuilt\n * (`docs/architecture/07-rendering.md` §1.1 and ADR-0014).\n *\n * @param scene - The render scene.\n * @param node - The mesh or subtree root to add.\n *\n * @internal\n */\nexport function addMeshToScene(scene: SceneContext, node: SceneNode): void {\n addToScene(scene, node);\n}\n\n/**\n * Removes a mesh — and everything under it — from a render scene, releasing its GPU buffers when it\n * has left its last scene.\n *\n * @remarks\n * This is destruction, not hiding: use {@link setMeshSubtreeVisible} to hide.\n *\n * @param scene - The render scene.\n * @param node - The mesh or subtree root to remove.\n *\n * @internal\n */\nexport function removeMeshFromScene(scene: SceneContext, node: SceneNode): void {\n removeFromScene(scene, node);\n}\n\n/**\n * Shows or hides a mesh and everything under it.\n *\n * @param node - The subtree root.\n * @param visible - `true` to show it, `false` to hide it.\n *\n * @internal\n */\nexport function setMeshSubtreeVisible(node: SceneNode, visible: boolean): void {\n setSubtreeVisible(node, visible);\n}\n\n/**\n * Assigns a mesh's material.\n *\n * @remarks\n * `Mesh.material` is an accessor once the mesh has joined a scene: writing it queues a material\n * swap on every scene the mesh belongs to (`lib/scene/mesh-scene-registry.js`,\n * `installMaterialSetter`). Assigning the material the mesh already has is a no-op.\n *\n * @param mesh - The mesh to change.\n * @param material - The material to draw it with.\n *\n * @internal\n */\nexport function setMeshMaterial(mesh: Mesh, material: Material): void {\n mesh.material = material;\n}\n\n/**\n * Sets whether a mesh is darkened by shadow maps.\n *\n * @param mesh - The mesh to change.\n * @param receiveShadows - `true` to sample shadow maps on this mesh.\n *\n * @internal\n */\nexport function setMeshReceiveShadows(mesh: Mesh, receiveShadows: boolean): void {\n mesh.receiveShadows = receiveShadows;\n}\n\n/**\n * Sets a mesh's sort key within its phase. Lower values are drawn first.\n *\n * @param mesh - The mesh to change.\n * @param renderOrder - The sort key; it only orders within the opaque or the transparent phase.\n *\n * @internal\n */\nexport function setMeshRenderOrder(mesh: Mesh, renderOrder: number): void {\n mesh.renderOrder = renderOrder;\n}\n\n/**\n * Sets whether picking considers a mesh at all.\n *\n * @remarks\n * `pickable === false` removes the mesh from both the GPU picker's candidate list and the CPU ray\n * test, so it neither occludes nor returns a hit (`index.d.ts` 7214, `lib/picking/ray-pick.js`).\n *\n * @param mesh - The mesh to change.\n * @param pickable - `true` to allow picking.\n *\n * @internal\n */\nexport function setMeshPickable(mesh: Mesh, pickable: boolean): void {\n mesh.pickable = pickable;\n}\n\n/**\n * Gives a mesh the string id Lite's light include/exclude sets match on.\n *\n * @param mesh - The mesh to name.\n * @param id - The id. It should be unique within the scene.\n *\n * @internal\n */\nexport function setMeshId(mesh: Mesh, id: string): void {\n mesh.id = id;\n}\n\n/**\n * Replaces the materials of every mesh in a subtree whose current material carries one of the given\n * names.\n *\n * @remarks\n * `Material.name` is \"populated by loaders from the source asset (e.g. the glTF material name) so\n * callers can look a material up by name\" (`index.d.ts`), which is the identifier\n * `docs/architecture/07-rendering.md` §2.4 means by \"by material name\". Assigning `Mesh.material`\n * queues a material swap on every scene the mesh belongs to; assigning the material a mesh already\n * has is a no-op, so re-running this is cheap.\n *\n * @param node - The subtree root.\n * @param overrides - Source material name to replacement material.\n * @returns How many meshes were re-materialled.\n *\n * @internal\n */\nexport function overrideSubtreeMaterials(node: SceneNode, overrides: ReadonlyMap<string, Material>): number {\n let changed = 0;\n if (\"material\" in node) {\n // A scene node that carries `material` is a mesh —\n // the same structural test Lite's own scene walk uses.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const mesh = node as Mesh;\n const name = mesh.material.name;\n const replacement = name === undefined ? undefined : overrides.get(name);\n if (replacement !== undefined && replacement !== mesh.material) {\n mesh.material = replacement;\n changed += 1;\n }\n }\n const children = node.children;\n for (let index = 0; index < children.length; index += 1) {\n const child = children[index];\n if (child !== undefined) {\n changed += overrideSubtreeMaterials(child, overrides);\n }\n }\n return changed;\n}\n\n/**\n * Releases a template mesh's GPU buffers.\n *\n * @remarks\n * Lite exports no mesh disposer: a mesh's buffers are freed only when it leaves its last scene\n * (`lib/scene/scene-remove.js`). A template that was never added to a scene therefore has to be\n * added and removed to be released, which is exactly what this does. Two consequences the caller\n * must respect:\n *\n * 1. The template must carry no material, or the round trip will build and immediately tear down a\n * renderable for it. Templates created by the factories above start with none.\n * 2. Any clone still alive keeps the shared buffers: the reference count only reaches zero when the\n * last co-owner has gone. Releasing the template while clones are in a scene is safe, but the\n * template can no longer be cloned afterwards.\n *\n * @param scene - Any scene on the template's engine; it is used only as the round trip's vehicle.\n * @param template - The template to release.\n *\n * @internal\n */\nexport function disposeMeshTemplate(scene: SceneContext, template: Mesh): void {\n addToScene(scene, template);\n removeFromScene(scene, template);\n}\n\n/**\n * Collects every mesh in a subtree — the root included — in depth-first order.\n *\n * @remarks\n * A scene node that carries `material` is a mesh: the same structural test\n * {@link overrideSubtreeMaterials} and Lite's own scene walk use (`index.d.ts` 7156 declares\n * `material` on `Mesh` and nowhere on `SceneNode`, 10104).\n *\n * Call it **once**, when the subtree is instantiated. The clone tree `instantiateContainer` built\n * never changes shape afterwards, so walking it again every frame would put a recursion on the\n * render path for an answer that cannot have moved (coding standards §7).\n *\n * @param node - The subtree root.\n * @param out - The list the meshes are appended to; it is not cleared first.\n *\n * @internal\n */\nexport function collectSubtreeMeshes(node: SceneNode, out: Mesh[]): void {\n if (\"material\" in node) {\n // See the note above.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n out.push(node as Mesh);\n }\n const children = node.children;\n for (let index = 0; index < children.length; index += 1) {\n const child = children[index];\n if (child !== undefined) {\n collectSubtreeMeshes(child, out);\n }\n }\n}\n","import { Mat4 } from \"./mat4.js\";\nimport { EPSILON, lerp } from \"./math-utils.js\";\nimport type { Mat4Like, MutableVec3, Vec3Like } from \"./types.js\";\n\n/**\n * A 3-component vector: a position or a direction in metres, or a per-axis scale. ignifx is\n * left-handed with Y up and +Z forward (ADR-0011), so {@link Vec3.forward} is `(0, 0, 1)` and\n * {@link Vec3.right} is `(1, 0, 0)`.\n *\n * The fields are plain mutable numbers, which is what makes a `Vec3` interchangeable with Babylon\n * Lite's `{ x, y, z }` vectors and with the live {@link MutableVec3} views a `Transform` exposes.\n *\n * Three families of operations, and the names say which is which:\n *\n * - instance methods mutate the receiver and return `this` (`a.add(b)` means `a += b`);\n * - `ToRef` statics write into a final `out` argument, allocate nothing, and are safe when `out`\n * aliases an input — these are what per-frame code uses (coding standards section 7);\n * - the remaining statics return a fresh vector and are documented as allocating.\n *\n * @example\n * ```ts\n * // convenience code\n * const offset = Vec3.add(position, Vec3.scale(direction, distance));\n *\n * // per-frame code: no allocation\n * Vec3.scaleToRef(direction, distance, scratch);\n * Vec3.addToRef(position, scratch, position);\n * ```\n *\n * @public\n */\nexport class Vec3 {\n /** The X component; positive is right. */\n x: number;\n /** The Y component; positive is up. */\n y: number;\n /** The Z component; positive is forward. */\n z: number;\n\n /**\n * Creates a vector.\n *\n * @param x - The X component. Defaults to 0.\n * @param y - The Y component. Defaults to 0.\n * @param z - The Z component. Defaults to 0.\n */\n constructor(x: number = 0, y: number = 0, z: number = 0) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n\n /**\n * Assigns every component at once.\n *\n * @param x - The new X component.\n * @param y - The new Y component.\n * @param z - The new Z component.\n * @returns This vector.\n */\n set(x: number, y: number, z: number): this {\n this.x = x;\n this.y = y;\n this.z = z;\n return this;\n }\n\n /**\n * Copies every component from another vector.\n *\n * @param v - The vector to read.\n * @returns This vector.\n */\n copyFrom(v: Vec3Like): this {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n return this;\n }\n\n /**\n * Copies this vector into a new one.\n *\n * @returns A new vector. **Allocates.**\n */\n clone(): Vec3 {\n return new Vec3(this.x, this.y, this.z);\n }\n\n /**\n * Adds another vector to this one.\n *\n * @param v - The vector to add.\n * @returns This vector.\n */\n add(v: Vec3Like): this {\n this.x += v.x;\n this.y += v.y;\n this.z += v.z;\n return this;\n }\n\n /**\n * Adds a scaled vector to this one — the \"move by velocity times delta time\" step, without a\n * temporary.\n *\n * @param v - The vector to add.\n * @param scale - The factor to multiply `v` by first.\n * @returns This vector.\n *\n * @example\n * ```ts\n * position.addScaled(velocity, time.deltaTime);\n * ```\n */\n addScaled(v: Vec3Like, scale: number): this {\n this.x += v.x * scale;\n this.y += v.y * scale;\n this.z += v.z * scale;\n return this;\n }\n\n /**\n * Subtracts another vector from this one.\n *\n * @param v - The vector to subtract.\n * @returns This vector.\n */\n subtract(v: Vec3Like): this {\n this.x -= v.x;\n this.y -= v.y;\n this.z -= v.z;\n return this;\n }\n\n /**\n * Multiplies this vector by another component by component.\n *\n * @param v - The vector to multiply by.\n * @returns This vector.\n */\n multiply(v: Vec3Like): this {\n this.x *= v.x;\n this.y *= v.y;\n this.z *= v.z;\n return this;\n }\n\n /**\n * Multiplies every component by a number.\n *\n * @param scale - The factor.\n * @returns This vector.\n */\n scale(scale: number): this {\n this.x *= scale;\n this.y *= scale;\n this.z *= scale;\n return this;\n }\n\n /**\n * Flips this vector to point the other way.\n *\n * @returns This vector.\n */\n negate(): this {\n this.x = -this.x;\n this.y = -this.y;\n this.z = -this.z;\n return this;\n }\n\n /**\n * Scales this vector to unit length. A zero-length vector is left at zero rather than becoming\n * `NaN`, so callers can normalize an unchecked direction safely.\n *\n * @returns This vector.\n */\n normalize(): this {\n const length = Math.hypot(this.x, this.y, this.z);\n if (length === 0) {\n return this;\n }\n return this.scale(1 / length);\n }\n\n /**\n * Replaces this vector with its cross product with another (`this = this x v`).\n *\n * @param v - The right-hand vector.\n * @returns This vector.\n */\n cross(v: Vec3Like): this {\n return Vec3.crossToRef(this, v, this);\n }\n\n /**\n * Moves this vector towards a target by an interpolant.\n *\n * @param target - The vector reached at `t === 1`.\n * @param t - The interpolant; not clamped.\n * @returns This vector.\n */\n lerp(target: Vec3Like, t: number): this {\n return Vec3.lerpToRef(this, target, t, this);\n }\n\n /**\n * The dot product of this vector with another.\n *\n * @param v - The other vector.\n * @returns The dot product.\n */\n dot(v: Vec3Like): number {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n }\n\n /**\n * The length of this vector, in metres.\n *\n * @returns The length.\n */\n length(): number {\n return Math.hypot(this.x, this.y, this.z);\n }\n\n /**\n * The squared length of this vector. Prefer it over `length()` when comparing distances:\n * it skips the square root.\n *\n * @returns The squared length.\n */\n lengthSquared(): number {\n return this.x * this.x + this.y * this.y + this.z * this.z;\n }\n\n /**\n * The distance from this vector to another, in metres.\n *\n * @param v - The other position.\n * @returns The distance.\n */\n distance(v: Vec3Like): number {\n return Math.hypot(this.x - v.x, this.y - v.y, this.z - v.z);\n }\n\n /**\n * The squared distance from this vector to another.\n *\n * @param v - The other position.\n * @returns The squared distance.\n */\n distanceSquared(v: Vec3Like): number {\n return Vec3.distanceSquared(this, v);\n }\n\n /**\n * Compares this vector with another, component by component, with a tolerance.\n *\n * @param v - The vector to compare against.\n * @param epsilon - The largest per-component difference still considered equal.\n * @returns `true` when every component matches within `epsilon`.\n */\n equalsWithEpsilon(v: Vec3Like, epsilon: number = EPSILON): boolean {\n return Vec3.equalsWithEpsilon(this, v, epsilon);\n }\n\n /**\n * Writes this vector into a `Float32Array`, for GPU upload. The output comes first to mirror\n * Babylon Lite's `ObservableVec3.toArray`, the shape the adapter has to interoperate with.\n *\n * @param out - The array to write into.\n * @param offset - The index of the X component. Defaults to 0.\n * @returns `out`.\n */\n toArray(out: Float32Array, offset: number = 0): Float32Array {\n out[offset] = this.x;\n out[offset + 1] = this.y;\n out[offset + 2] = this.z;\n return out;\n }\n\n /**\n * The zero vector.\n *\n * @returns A new `(0, 0, 0)`. **Allocates**; use {@link VEC3_ZERO} when a read-only value will do.\n */\n static zero(): Vec3 {\n return new Vec3(0, 0, 0);\n }\n\n /**\n * The vector whose components are all one.\n *\n * @returns A new `(1, 1, 1)`. **Allocates.**\n */\n static one(): Vec3 {\n return new Vec3(1, 1, 1);\n }\n\n /**\n * The world up direction.\n *\n * @returns A new `(0, 1, 0)`. **Allocates**; see {@link VEC3_UP}.\n */\n static up(): Vec3 {\n return new Vec3(0, 1, 0);\n }\n\n /**\n * The world down direction.\n *\n * @returns A new `(0, -1, 0)`. **Allocates.**\n */\n static down(): Vec3 {\n return new Vec3(0, -1, 0);\n }\n\n /**\n * The world right direction.\n *\n * @returns A new `(1, 0, 0)`. **Allocates**; see {@link VEC3_RIGHT}.\n */\n static right(): Vec3 {\n return new Vec3(1, 0, 0);\n }\n\n /**\n * The world left direction.\n *\n * @returns A new `(-1, 0, 0)`. **Allocates.**\n */\n static left(): Vec3 {\n return new Vec3(-1, 0, 0);\n }\n\n /**\n * The world forward direction. ignifx is left-handed, so forward is **+Z** (ADR-0011).\n *\n * @returns A new `(0, 0, 1)`. **Allocates**; see {@link VEC3_FORWARD}.\n */\n static forward(): Vec3 {\n return new Vec3(0, 0, 1);\n }\n\n /**\n * The world backward direction.\n *\n * @returns A new `(0, 0, -1)`. **Allocates.**\n */\n static backward(): Vec3 {\n return new Vec3(0, 0, -1);\n }\n\n /**\n * Copies any vector-shaped value into a `Vec3`.\n *\n * @param v - The vector to copy.\n * @returns A new vector. **Allocates.**\n *\n * @example\n * ```ts\n * const position = Vec3.from(node.position); // snapshot of a live Lite view\n * ```\n */\n static from(v: Vec3Like): Vec3 {\n return new Vec3(v.x, v.y, v.z);\n }\n\n /**\n * Adds two vectors.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new vector. **Allocates**; use {@link Vec3.addToRef} in per-frame code.\n */\n static add(a: Vec3Like, b: Vec3Like): Vec3 {\n return Vec3.addToRef(a, b, new Vec3());\n }\n\n /**\n * Subtracts one vector from another.\n *\n * @param a - The vector to subtract from.\n * @param b - The vector to subtract.\n * @returns A new vector holding `a - b`. **Allocates.**\n */\n static subtract(a: Vec3Like, b: Vec3Like): Vec3 {\n return Vec3.subtractToRef(a, b, new Vec3());\n }\n\n /**\n * Multiplies a vector by a number.\n *\n * @param v - The vector to scale.\n * @param scale - The factor.\n * @returns A new vector. **Allocates.**\n */\n static scale(v: Vec3Like, scale: number): Vec3 {\n return Vec3.scaleToRef(v, scale, new Vec3());\n }\n\n /**\n * The cross product of two vectors.\n *\n * @param a - The left-hand vector.\n * @param b - The right-hand vector.\n * @returns A new vector holding `a x b`. **Allocates.**\n */\n static cross(a: Vec3Like, b: Vec3Like): Vec3 {\n return Vec3.crossToRef(a, b, new Vec3());\n }\n\n /**\n * A unit-length copy of a vector.\n *\n * @param v - The vector to normalize.\n * @returns A new vector. **Allocates.**\n */\n static normalize(v: Vec3Like): Vec3 {\n return Vec3.normalizeToRef(v, new Vec3());\n }\n\n /**\n * Linearly interpolates between two vectors.\n *\n * @param a - The vector returned at `t === 0`.\n * @param b - The vector returned at `t === 1`.\n * @param t - The interpolant; not clamped.\n * @returns A new vector. **Allocates.**\n */\n static lerp(a: Vec3Like, b: Vec3Like, t: number): Vec3 {\n return Vec3.lerpToRef(a, b, t, new Vec3());\n }\n\n /**\n * Writes `a + b` into `out`.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static addToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n out.set(a.x + b.x, a.y + b.y, a.z + b.z);\n return out;\n }\n\n /**\n * Writes `a - b` into `out`.\n *\n * @param a - The vector to subtract from.\n * @param b - The vector to subtract.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static subtractToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n out.set(a.x - b.x, a.y - b.y, a.z - b.z);\n return out;\n }\n\n /**\n * Writes the component-wise product `a * b` into `out`.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static multiplyToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n out.set(a.x * b.x, a.y * b.y, a.z * b.z);\n return out;\n }\n\n /**\n * Writes `v * scale` into `out`.\n *\n * @param v - The vector to scale.\n * @param scale - The factor.\n * @param out - The vector to write; may alias `v`.\n * @returns `out`.\n */\n static scaleToRef<TOut extends MutableVec3>(v: Vec3Like, scale: number, out: TOut): TOut {\n out.set(v.x * scale, v.y * scale, v.z * scale);\n return out;\n }\n\n /**\n * Writes `-v` into `out`.\n *\n * @param v - The vector to flip.\n * @param out - The vector to write; may alias `v`.\n * @returns `out`.\n */\n static negateToRef<TOut extends MutableVec3>(v: Vec3Like, out: TOut): TOut {\n out.set(-v.x, -v.y, -v.z);\n return out;\n }\n\n /**\n * Writes a unit-length copy of `v` into `out`. A zero-length input is written as zero rather than\n * `NaN`.\n *\n * @param v - The vector to normalize.\n * @param out - The vector to write; may alias `v`.\n * @returns `out`.\n */\n static normalizeToRef<TOut extends MutableVec3>(v: Vec3Like, out: TOut): TOut {\n const length = Math.hypot(v.x, v.y, v.z);\n if (length === 0) {\n out.set(0, 0, 0);\n return out;\n }\n const inv = 1 / length;\n out.set(v.x * inv, v.y * inv, v.z * inv);\n return out;\n }\n\n /**\n * Writes `a x b` into `out`.\n *\n * @param a - The left-hand vector.\n * @param b - The right-hand vector.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static crossToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n const ax = a.x;\n const ay = a.y;\n const az = a.z;\n const bx = b.x;\n const by = b.y;\n const bz = b.z;\n out.set(ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx);\n return out;\n }\n\n /**\n * Writes the interpolation of `a` and `b` into `out`.\n *\n * @param a - The vector written at `t === 0`.\n * @param b - The vector written at `t === 1`.\n * @param t - The interpolant; not clamped.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static lerpToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, t: number, out: TOut): TOut {\n out.set(lerp(a.x, b.x, t), lerp(a.y, b.y, t), lerp(a.z, b.z, t));\n return out;\n }\n\n /**\n * Writes the component-wise minimum of two vectors into `out`.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static minToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n out.set(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z));\n return out;\n }\n\n /**\n * Writes the component-wise maximum of two vectors into `out`.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static maxToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n out.set(Math.max(a.x, b.x), Math.max(a.y, b.y), Math.max(a.z, b.z));\n return out;\n }\n\n /**\n * Transforms a **position** by a matrix into `out`: the matrix's translation is applied and the\n * result is divided by w, so a projection matrix gives clip-space coordinates.\n *\n * @param v - The position to transform, in metres.\n * @param m - The transformation, column-major.\n * @param out - The vector to write; may alias `v`.\n * @returns `out`.\n *\n * @example\n * ```ts\n * Vec3.transformCoordinatesToRef(localPoint, node.worldMatrix, worldPoint);\n * ```\n */\n static transformCoordinatesToRef<TOut extends MutableVec3>(v: Vec3Like, m: Mat4Like, out: TOut): TOut {\n return Mat4.transformPointToRef(m, v, out);\n }\n\n /**\n * Transforms a **direction** by a matrix into `out`, ignoring the matrix's translation.\n *\n * @param v - The direction to transform.\n * @param m - The transformation, column-major.\n * @param out - The vector to write; may alias `v`.\n * @returns `out`.\n */\n static transformNormalToRef<TOut extends MutableVec3>(v: Vec3Like, m: Mat4Like, out: TOut): TOut {\n return Mat4.transformDirectionToRef(m, v, out);\n }\n\n /**\n * The dot product of two vectors.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns The dot product.\n */\n static dot(a: Vec3Like, b: Vec3Like): number {\n return a.x * b.x + a.y * b.y + a.z * b.z;\n }\n\n /**\n * The length of a vector, in metres.\n *\n * @param v - The vector to measure.\n * @returns The length.\n */\n static length(v: Vec3Like): number {\n return Math.hypot(v.x, v.y, v.z);\n }\n\n /**\n * The squared length of a vector.\n *\n * @param v - The vector to measure.\n * @returns The squared length.\n */\n static lengthSquared(v: Vec3Like): number {\n return v.x * v.x + v.y * v.y + v.z * v.z;\n }\n\n /**\n * The distance between two positions, in metres.\n *\n * @param a - The first position.\n * @param b - The second position.\n * @returns The distance.\n */\n static distance(a: Vec3Like, b: Vec3Like): number {\n return Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);\n }\n\n /**\n * The squared distance between two positions. Compare squared distances to avoid a square root.\n *\n * @param a - The first position.\n * @param b - The second position.\n * @returns The squared distance.\n */\n static distanceSquared(a: Vec3Like, b: Vec3Like): number {\n const dx = a.x - b.x;\n const dy = a.y - b.y;\n const dz = a.z - b.z;\n return dx * dx + dy * dy + dz * dz;\n }\n\n /**\n * Compares two vectors component by component, with a tolerance.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @param epsilon - The largest per-component difference still considered equal.\n * @returns `true` when every component matches within `epsilon`.\n */\n static equalsWithEpsilon(a: Vec3Like, b: Vec3Like, epsilon: number = EPSILON): boolean {\n return Math.abs(a.x - b.x) <= epsilon && Math.abs(a.y - b.y) <= epsilon && Math.abs(a.z - b.z) <= epsilon;\n }\n}\n\n/**\n * The frozen zero vector, `(0, 0, 0)`. Read-only: pass it anywhere a {@link Vec3Like} is wanted, and\n * call {@link Vec3.zero} when you need a vector you can write to.\n *\n * @public\n */\nexport const VEC3_ZERO: Vec3Like = Object.freeze({ x: 0, y: 0, z: 0 });\n\n/**\n * The frozen vector whose components are all one, `(1, 1, 1)` — the identity scale.\n *\n * @public\n */\nexport const VEC3_ONE: Vec3Like = Object.freeze({ x: 1, y: 1, z: 1 });\n\n/**\n * The frozen world up direction, `(0, 1, 0)`.\n *\n * @public\n */\nexport const VEC3_UP: Vec3Like = Object.freeze({ x: 0, y: 1, z: 0 });\n\n/**\n * The frozen world down direction, `(0, -1, 0)`.\n *\n * @public\n */\nexport const VEC3_DOWN: Vec3Like = Object.freeze({ x: 0, y: -1, z: 0 });\n\n/**\n * The frozen world right direction, `(1, 0, 0)`.\n *\n * @public\n */\nexport const VEC3_RIGHT: Vec3Like = Object.freeze({ x: 1, y: 0, z: 0 });\n\n/**\n * The frozen world left direction, `(-1, 0, 0)`.\n *\n * @public\n */\nexport const VEC3_LEFT: Vec3Like = Object.freeze({ x: -1, y: 0, z: 0 });\n\n/**\n * The frozen world forward direction, `(0, 0, 1)`. ignifx is left-handed, so forward is +Z\n * (ADR-0011).\n *\n * @public\n */\nexport const VEC3_FORWARD: Vec3Like = Object.freeze({ x: 0, y: 0, z: 1 });\n\n/**\n * The frozen world backward direction, `(0, 0, -1)`.\n *\n * @public\n */\nexport const VEC3_BACKWARD: Vec3Like = Object.freeze({ x: 0, y: 0, z: -1 });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiHA,SAAgB,cAAc,QAAuB,SAAqC;CACxF,OAAO,UAAU,QAAQ,OAAO;AAClC;;;;;;;;;;AAWA,SAAgB,iBAAiB,QAAuB,SAA+B;CACrF,OAAO,aAAa,QAAQ,OAAO;AACrC;;;;;;;;;;AAWA,SAAgB,gBAAgB,QAAuB,SAA8B;CACnF,OAAO,YAAY,QAAQ,OAAO;AACpC;;;;;;;;;;AAWA,SAAgB,iBAAiB,QAAuB,SAA+B;CACrF,OAAO,aAAa,QAAQ,OAAO;AACrC;;;;;;;;;;AAWA,SAAgB,mBAAmB,QAAuB,SAAiC;CACzF,OAAO,eAAe,QAAQ,OAAO;AACvC;;;;;;;;;;;;;;;AAgBA,SAAgB,kBAAkB,QAAuB,SAAgC;CACvF,OAAO,cAAc,QAAQ,OAAO;AACtC;;;;;;;;;;AAWA,SAAgB,gBAAgB,QAAuB,SAA8B;CACnF,OAAO,YAAY,QAAQ,OAAO;AACpC;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,uBACd,QACA,MACA,WACA,SACA,SACA,KACA,MACA,UACA,QACM;CACN,OAAO,mBAAmB,QAAQ,MAAM,WAA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CAClC;;;;;;;;;CAUA,OAAO,kBAAkB,GAAa,GAAa,UAAkB,SAAkB;EACrF,OAAO,KAAK,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,WAAW,KAAK,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,WAAW,KAAK,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK;CACpG;AACF;;;;;;;AAQA,MAAa,YAAsB,OAAO,OAAO;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE,CAAC;;;;;;AAOrE,MAAa,WAAqB,OAAO,OAAO;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE,CAAC;;;;;;AAOpE,MAAa,UAAoB,OAAO,OAAO;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE,CAAC;;;;;;AAOnE,MAAa,YAAsB,OAAO,OAAO;CAAE,GAAG;CAAG,GAAG;CAAI,GAAG;AAAE,CAAC;;;;;;AAOtE,MAAa,aAAuB,OAAO,OAAO;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE,CAAC;;;;;;AAOtE,MAAa,YAAsB,OAAO,OAAO;CAAE,GAAG;CAAI,GAAG;CAAG,GAAG;AAAE,CAAC;;;;;;;AAQtE,MAAa,eAAyB,OAAO,OAAO;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE,CAAC;;;;;;AAOxE,MAAa,gBAA0B,OAAO,OAAO;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ignifx/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "ignifx core: app, world, entities, components, scripts, and the Babylon Lite adapter boundary.",
|
|
5
5
|
"homepage": "https://ignifx.com",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"import": "./dist/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./prefab": {
|
|
25
|
+
"types": "./dist/prefab.d.ts",
|
|
26
|
+
"import": "./dist/prefab.js"
|
|
27
|
+
},
|
|
24
28
|
"./package.json": "./package.json"
|
|
25
29
|
},
|
|
26
30
|
"publishConfig": {
|
|
@@ -56,7 +60,9 @@
|
|
|
56
60
|
"decoders/uastc_rgba8_srgb_v2.wasm",
|
|
57
61
|
"decoders/uastc_rgba8_unorm_v2.wasm",
|
|
58
62
|
"decoders/zstddec.wasm",
|
|
59
|
-
"decoders/meshopt_decoder.js"
|
|
63
|
+
"decoders/meshopt_decoder.js",
|
|
64
|
+
"decoders/draco_decoder.js",
|
|
65
|
+
"decoders/draco_decoder_gltf.wasm"
|
|
60
66
|
]
|
|
61
67
|
}
|
|
62
68
|
},
|
|
@@ -64,9 +70,9 @@
|
|
|
64
70
|
"build": "tsdown",
|
|
65
71
|
"typecheck": "tsc --build tsconfig.json tsconfig.test.json",
|
|
66
72
|
"test": "vitest run --project node --project node-isolated --root ../.. packages/core",
|
|
67
|
-
"api-report": "api-extractor run --verbose",
|
|
68
|
-
"docs:api": "typedoc",
|
|
69
|
-
"api-report:update": "api-extractor run --local --verbose",
|
|
73
|
+
"api-report": "api-extractor run --verbose && api-extractor run --verbose -c api-extractor.prefab.json",
|
|
74
|
+
"docs:api": "typedoc && typedoc --options typedoc.prefab.json",
|
|
75
|
+
"api-report:update": "api-extractor run --local --verbose && api-extractor run --local --verbose -c api-extractor.prefab.json",
|
|
70
76
|
"pack-check": "publint && attw --pack . --profile esm-only"
|
|
71
77
|
}
|
|
72
78
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decoders-CHJ7vduE.js","names":[],"sources":["../src/lite/gpu/decoders.ts"],"sourcesContent":["import {\n getOrCreateSampler,\n loadBasisTexture2D,\n loadKtx2Texture2D,\n setKtx2DecoderUrl,\n setMeshoptBaseUrl,\n} from \"@babylonjs/lite\";\nimport type { EngineContext, Texture2D, Texture2DOptions } from \"@babylonjs/lite\";\n\n/**\n * The compressed-texture and decoder half of the Babylon Lite adapter\n * (`docs/architecture/07-rendering.md` §7). Imported only dynamically, from `./texture.ts` and\n * `../../render/decoder-urls.ts`, so a game that loads no KTX2 texture and no glTF carries none of\n * Lite's KTX2, Basis or meshopt glue.\n *\n * Everything here is `@internal`.\n *\n * ## The decoders (verified against `@babylonjs/lite@1.34.0`)\n *\n * `loadKtx2Texture2D` (`index.d.ts` 7892) and the glTF `KHR_texture_basisu` path inject\n * `babylon.ktx2Decoder.js` as a `<script>` and read the `KTX2DECODER` global it defines; that\n * script then fetches its transcoders (`msc_basis_transcoder.js` and `.wasm` for ETC1S,\n * `uastc_*.wasm` for UASTC, `zstddec.wasm` for Zstandard supercompression). glTF\n * `EXT_meshopt_compression` injects `meshopt_decoder.js`. Every one of them comes from\n * `https://cdn.babylonjs.com/` unless `setKtx2DecoderUrl` (12484) and `setMeshoptBaseUrl` (12538)\n * say otherwise (`lib/texture/ktx2-loader.js`, `lib/loader-gltf/meshopt-decode.js`). Both setters\n * write process-wide state, and the KTX2 decoder is loaded once: a URL set after the first KTX2\n * load is ignored until a failed load clears Lite's cached promise.\n *\n * `loadBasisTexture2D` (7771) has no such setter. It always fetches `basis_transcoder.js` and its\n * WASM from `https://cdn.babylonjs.com/basisTranscoder/1/` (`lib/texture/basis-loader.js`), so a\n * `.basis` file cannot load under a `script-src 'self'` policy until Lite adds one.\n *\n * ## Transcode targets\n *\n * Lite picks them; the public API has no override. Its caps come from the device features\n * `texture-compression-{astc,bc,etc2}`, which `createEngine` requests whenever the adapter has\n * them (`lib/engine/engine.js`). The decoder's decision tree (`@babylonjs/ktx2decoder`\n * `transcodeDecisionTree.js`) then gives:\n *\n * - ETC1S: ETC2 (RGB, or RGBA with alpha) when `etc2` is present, else BC7 when `bc` is, else RGBA8.\n * - UASTC: ASTC 4×4 when `astc` is present, else BC7 when `bc` is, else ETC2 when `etc2` is, else\n * RGBA8.\n *\n * So a Windows or Linux desktop GPU gets BC7, Apple silicon gets ETC2 (ETC1S) or ASTC (UASTC),\n * and a device with no compression feature gets uncompressed RGBA8. `.basis` uses Lite's own\n * order: BC7, ASTC 4×4, ETC2, BC3, BC1, RGBA8.\n */\n\n/**\n * Where Lite should load its decoders from. A `null` field leaves Lite's default for that decoder.\n *\n * @internal\n */\nexport interface LiteDecoderUrls {\n /** The URL of `babylon.ktx2Decoder.js`, or `null` for Lite's CDN default. */\n readonly ktx2Decoder: string | null;\n /**\n * Overrides for the decoder's transcoder modules: class name in the `KTX2DECODER` namespace →\n * static property → URL, the second argument of `setKtx2DecoderUrl`. Ignored when\n * {@link LiteDecoderUrls.ktx2Decoder} is `null`.\n */\n readonly ktx2Transcoders: Readonly<Record<string, Readonly<Record<string, string>>>>;\n /** The directory `meshopt_decoder.js` is served from, or `null` for Lite's CDN default. */\n readonly meshoptBaseUrl: string | null;\n}\n\n/**\n * Points Lite at the given decoder locations.\n *\n * @param urls - The locations; `null` fields are left as they are.\n *\n * @internal\n */\nexport function applyLiteDecoderUrls(urls: LiteDecoderUrls): void {\n if (urls.ktx2Decoder !== null) {\n // `setKtx2DecoderUrl` keeps its own reference; a copy keeps the caller's object frozen-safe.\n const transcoders: Record<string, Record<string, string>> = {};\n for (const [name, properties] of Object.entries(urls.ktx2Transcoders)) {\n transcoders[name] = { ...properties };\n }\n setKtx2DecoderUrl(urls.ktx2Decoder, transcoders);\n }\n if (urls.meshoptBaseUrl !== null) {\n setMeshoptBaseUrl(urls.meshoptBaseUrl);\n }\n}\n\n/**\n * Loads a `.ktx2` texture through Lite's KTX2 decoder and gives it the requested sampler.\n *\n * @remarks\n * `loadKtx2Texture2D` takes only the URL and the sRGB flag. It uploads the file's own mip chain as\n * stored, with a fixed repeat/linear sampler; the sampler is rebuilt here from `options`.\n *\n * ## Orientation: rows as stored\n *\n * Compressed blocks cannot be flipped at upload, so `invertY` has no effect: the file's first row\n * lands at the top of the GPU texture, which is what a PNG gets with `invertY: false`. Lite marks\n * the handle `invertY` and documents that materials flip V for it (`index.d.ts` 14966), but in\n * 1.34 no material reads the flag, and a props-built PBR material ignores `setTextureTransform`\n * too (its UV-transform variant is enabled only by the glTF builder). Measured in\n * `test/assets/ktx2.browser.test.ts`: a top-row-first `.ktx2` draws upside down next to the same\n * PNG loaded with the default `invertY: true`, and a `.ktx2` encoded from the vertically flipped\n * image draws the same. So a `.ktx2` meant to replace a PNG under the default sidecar is encoded\n * flipped (Basis `setYFlip(true)`); `mipMaps` and `premultiplyAlpha` do not apply either.\n *\n * @param engine - The engine that owns the GPU texture.\n * @param url - Where to fetch the file from.\n * @param options - Colour space and sampler.\n * @returns The texture, transcoded to the device's best compressed format. Its reference count\n * starts at one, like `loadTexture2D`'s.\n *\n * @internal\n */\nexport async function loadKtx2TextureWithOptions(\n engine: EngineContext,\n url: string,\n options: Texture2DOptions,\n): Promise<Texture2D> {\n const texture = await loadKtx2Texture2D(engine, url, options.srgb ?? false);\n const hasMips = texture.texture.mipLevelCount > 1;\n const minFilter = options.minFilter ?? \"linear\";\n const magFilter = options.magFilter ?? \"linear\";\n const mipmapFilter: GPUMipmapFilterMode = hasMips ? \"linear\" : \"nearest\";\n // WebGPU accepts anisotropy only when every filter is linear; this is Lite's own rule for\n // `loadTexture2D`.\n const allLinear = minFilter === \"linear\" && magFilter === \"linear\" && mipmapFilter === \"linear\";\n texture.sampler = getOrCreateSampler(engine, {\n addressModeU: options.addressModeU ?? \"repeat\",\n addressModeV: options.addressModeV ?? \"repeat\",\n minFilter,\n magFilter,\n mipmapFilter,\n maxAnisotropy: allLinear ? 4 : 1,\n });\n return texture;\n}\n\n/**\n * Loads a `.basis` texture through Lite's Basis Universal loader.\n *\n * @remarks\n * Sampler and sRGB options apply; `mipMaps` and `invertY` are ignored by Lite. The transcoder always\n * comes from the Babylon CDN (see the module comment).\n *\n * @param engine - The engine that owns the GPU texture.\n * @param url - Where to fetch the file from.\n * @param options - Colour space and sampler.\n * @returns The texture.\n *\n * @internal\n */\nexport function loadBasisTextureWithOptions(\n engine: EngineContext,\n url: string,\n options: Texture2DOptions,\n): Promise<Texture2D> {\n return loadBasisTexture2D(engine, url, options);\n}\n"],"mappings":";;;;;;;;;AA0EA,SAAgB,qBAAqB,MAA6B;CAChE,IAAI,KAAK,gBAAgB,MAAM;EAE7B,MAAM,cAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,eAAe,OAAO,QAAQ,KAAK,eAAe,GAClE,YAAY,QAAQ,EAAE,GAAG,WAAW;EAEtC,kBAAkB,KAAK,aAAa,WAAW;CACjD;CACA,IAAI,KAAK,mBAAmB,MAC1B,kBAAkB,KAAK,cAAc;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,eAAsB,2BACpB,QACA,KACA,SACoB;CACpB,MAAM,UAAU,MAAM,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ,KAAK;CAC1E,MAAM,UAAU,QAAQ,QAAQ,gBAAgB;CAChD,MAAM,YAAY,QAAQ,aAAa;CACvC,MAAM,YAAY,QAAQ,aAAa;CACvC,MAAM,eAAoC,UAAU,WAAW;CAG/D,MAAM,YAAY,cAAc,YAAY,cAAc,YAAY,iBAAiB;CACvF,QAAQ,UAAU,mBAAmB,QAAQ;EAC3C,cAAc,QAAQ,gBAAgB;EACtC,cAAc,QAAQ,gBAAgB;EACtC;EACA;EACA;EACA,eAAe,YAAY,IAAI;CACjC,CAAC;CACD,OAAO;AACT;;;;;;;;;;;;;;;AAgBA,SAAgB,4BACd,QACA,KACA,SACoB;CACpB,OAAO,mBAAmB,QAAQ,KAAK,OAAO;AAChD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ignifx-error-oYdVnT1S.js","names":[],"sources":["../src/errors/error-codes.ts","../src/errors/ignifx-error.ts"],"sourcesContent":["/**\n * The error code registry data: the subsystem ranges from\n * `docs/architecture/15-devtools-and-diagnostics.md` §1, the codes `@ignifx/core` itself owns, and\n * the format rule every code must satisfy.\n *\n * This module is pure data plus one predicate; it imports nothing, which is what lets\n * {@link IgnifxError} depend on it without a cycle (coding standards §4).\n */\n\n/**\n * The two-digit prefix each subsystem owns inside the `IGX-####` space\n * (`docs/architecture/15-devtools-and-diagnostics.md` §1). A code is the prefix followed by a\n * two-digit ordinal, so `rendering` owns `IGX-0700` through `IGX-0799`.\n *\n * @example\n * ```ts\n * const code = `IGX-${ErrorRange.rendering}01` satisfies ErrorCode; // \"IGX-0701\"\n * ```\n *\n * @public\n */\nexport const ErrorRange = {\n /** App lifecycle, phases, time, coroutines, destruction. */\n lifecycle: \"01\",\n /** Components, scripts, and their registration. */\n components: \"02\",\n /** Scenes, scene instances, layers. */\n scenes: \"03\",\n /** The extension host and its contract. */\n extensions: \"04\",\n /** Asset handles, loaders, and caching. */\n assets: \"05\",\n /** Schemas, scene/prefab JSON, references. */\n serialization: \"06\",\n /** The renderer and the Babylon Lite adapter. */\n rendering: \"07\",\n /** Input devices, actions, and bindings. */\n input: \"08\",\n /** 3D physics. */\n physics: \"09\",\n /** Audio buses, sources, and clips. */\n audio: \"10\",\n /** The 2D toolkit. */\n twoD: \"11\",\n /** The 3D toolkit. */\n threeD: \"12\",\n /** The UI overlay. */\n ui: \"13\",\n /** Platform integration (browser, Electron). */\n platform: \"14\",\n /** Devtools, logging, and diagnostics. */\n devtools: \"15\",\n /** Terrain assets, chunks, and queries. */\n terrain: \"16\",\n /** Particle systems, 3D and 2D. */\n particles: \"17\",\n /** The editor host package and its Vite plugin. */\n editorHost: \"18\",\n} as const;\n\n/**\n * The union of the two-digit subsystem prefixes declared by `ErrorRange`.\n *\n * @public\n */\nexport type ErrorRange = (typeof ErrorRange)[keyof typeof ErrorRange];\n\n/**\n * The first digit of the range reserved for extensions published outside the `@ignifx` scope\n * (`IGX-9000` through `IGX-9999`). First-party subsystems never allocate here.\n *\n * @public\n */\nexport const THIRD_PARTY_ERROR_PREFIX = \"9\";\n\n/**\n * The shape of every ignifx diagnostic code: the literal `IGX-` followed by four digits.\n *\n * @remarks\n * The template literal is the widest useful type; it accepts strings such as `\"IGX-1\"` that are not\n * real codes. {@link isValidErrorCode} is the runtime check, `CoreErrorCode` is the narrowed\n * string-literal union for the codes this package owns, and extensions narrow their own the same\n * way.\n *\n * @public\n */\nexport type ErrorCode = `IGX-${number}`;\n\n/**\n * Every diagnostic code `@ignifx/core` can throw, keyed by an intention-revealing name so call\n * sites read as prose and the compiler catches typos (coding standards §5.2 — `as const` objects in\n * place of enums).\n *\n * @example\n * ```ts\n * throw new IgnifxError(CoreErrorCode.mutationAfterDestroy, \"The entity has been destroyed.\", {\n * context: { entity: entity.uid },\n * });\n * ```\n *\n * @remarks\n * Code blocks reserved for other first-party packages, which cannot import this table\n * (`docs/architecture/00-overview.md` §2): `@ignifx/cli` owns `IGX-1401`–`IGX-1419`; `@ignifx/electron`\n * owns `IGX-1460`–`IGX-1499` (core's own platform codes therefore stop at `IGX-1459`); `@ignifx/devtools`\n * owns `IGX-1550`–`IGX-1599` (core's own devtools-range codes stop at `IGX-1549`);\n * `@ignifx/vite-plugin` owns `IGX-0550`–`IGX-0599` and `IGX-0650`–`IGX-0699`. Core allocates its\n * own codes from the bottom of each range and, in the platform range, from `IGX-1420` upward —\n * which is where `app.platform` and `app.storage` live, because storage is a *platform* service:\n * the same three calls resolve to IndexedDB, a directory, or the Electron bridge depending only on\n * the host, so a failure is a platform failure and not a serialization or asset one.\n *\n * @public\n */\nexport const CoreErrorCode = {\n /** An entity, component, or app was used after it had been destroyed or disposed. */\n mutationAfterDestroy: \"IGX-0101\",\n /** `destroyImmediate()` was called from inside a lifecycle callback. */\n destroyImmediateInCallback: \"IGX-0102\",\n /** A signal handler asked for deferred delivery on a signal that has no scheduler. */\n deferredSignalWithoutScheduler: \"IGX-0103\",\n /** A signal handler threw and no handler-error reporter was installed. */\n signalHandlerThrew: \"IGX-0104\",\n /** `app.step()` was called while Babylon Lite's render loop was driving the frames. */\n stepOutsideHeadless: \"IGX-0105\",\n /** An app was used after `app.dispose()` had run. */\n appDisposed: \"IGX-0106\",\n /** A part of the app was reached before `createApp()` had finished building it. */\n appNotReady: \"IGX-0107\",\n /** A `Time` property was set to a value outside its documented domain. */\n invalidTimeValue: \"IGX-0108\",\n /** A `app.tweens.to(...)` option was outside its documented domain. */\n invalidTweenOptions: \"IGX-0109\",\n /** A tweened field is not a number, `Vec2`, `Vec3`, or `Quat`, or is not writable. */\n tweenFieldNotTweenable: \"IGX-0110\",\n /** A coroutine was started in an edit-mode app by a script whose class does not run in edit mode. */\n coroutineInEditMode: \"IGX-0111\",\n /** A component declared through `requires` is missing from the entity. */\n requiredComponentMissing: \"IGX-0201\",\n /** A second instance of a component type that does not allow multiples was added. */\n multipleComponentsNotAllowed: \"IGX-0202\",\n /** Two component types were registered under the same `typeId`. */\n duplicateComponentTypeId: \"IGX-0203\",\n /** A component without a `typeId` was serialized. */\n componentTypeIdMissing: \"IGX-0204\",\n /** `Transform` was removed or disabled; every entity must keep exactly one enabled transform. */\n transformIsNotRemovable: \"IGX-0205\",\n /** A component's engine-assigned state was read before the engine attached it to an entity. */\n componentNotAttached: \"IGX-0206\",\n /** A hot-reloaded class kept the `\"patch\"` policy while its schema shape changed. */\n hotReloadSchemaChanged: \"IGX-0207\",\n /** `app.hotReload.apply()` was called from inside a lifecycle callback. */\n hotReloadInsideCallback: \"IGX-0208\",\n /** A component class's `static requires` chain loops, through the class itself or a class it requires. */\n requiresCycle: \"IGX-0209\",\n /** A scene was instantiated before it had finished loading. */\n sceneNotLoaded: \"IGX-0301\",\n /** Instantiating a scene would place an instance inside itself. */\n sceneInstanceCycle: \"IGX-0302\",\n /** A layer name that the project settings do not declare was used. */\n unknownLayer: \"IGX-0303\",\n /** Two layer slots were given the same name. */\n duplicateLayerName: \"IGX-0304\",\n /** The project settings declare more layer names than the 32 available slots. */\n tooManyLayers: \"IGX-0305\",\n /** Reparenting an entity under its own descendant would make the scene tree cyclic. */\n parentingCycle: \"IGX-0306\",\n /** A scene file names a component `typeId` that no extension has registered. */\n unknownComponentTypeId: \"IGX-0307\",\n /** A file handed to the scene loader does not carry the `ignifx.scene` format header. */\n notASceneFile: \"IGX-0308\",\n /** An operation that only accepts a scene root was given an entity that has a parent. */\n entityIsNotSceneRoot: \"IGX-0309\",\n /** Two extensions defined the same app property. */\n appPropertyAlreadyDefined: \"IGX-0401\",\n /** The `requires` graph of the registered extensions contains a cycle. */\n extensionRequiresCycle: \"IGX-0402\",\n /** An extension declares a `requires` entry that was never registered. */\n extensionMissing: \"IGX-0403\",\n /** An extension's `engine` range does not match the running core version. */\n extensionEngineMismatch: \"IGX-0404\",\n /** `ctx.require()` asked for a service that no earlier extension registered. */\n serviceNotRegistered: \"IGX-0405\",\n /** Two extensions were registered under the same name. */\n duplicateExtensionName: \"IGX-0406\",\n /** `ctx.settings()` asked for a settings section that was never registered. */\n unknownSettingsSection: \"IGX-0407\",\n /** A project settings section did not validate against the schema its extension registered. */\n invalidSettings: \"IGX-0408\",\n /** An extension dispatched a physics callback from outside the fixed loop. */\n physicsCallbackOutsideFixedStep: \"IGX-0409\",\n /** A second, different simulation scene was handed to a world that already has one. */\n simulationSceneAlreadySet: \"IGX-0410\",\n /** One `Extension` object was handed to a second app while the first still runs it. */\n extensionInstalledTwice: \"IGX-0411\",\n /** An asset's value was read before the asset finished loading. */\n assetNotLoaded: \"IGX-0501\",\n /** An asset load was aborted through its `AbortSignal`. */\n assetLoadAborted: \"IGX-0502\",\n /** An asset promise outlived the app that owned it. */\n assetAppDisposed: \"IGX-0503\",\n /** No registered loader claims the address's type or extension. */\n assetNoLoader: \"IGX-0504\",\n /** An asset load failed after its last retry. */\n assetLoadFailed: \"IGX-0505\",\n /** Two loaders were registered for the same asset type. */\n duplicateAssetLoader: \"IGX-0506\",\n /** A `.mesh.json` file names an unknown primitive, or an option the primitive does not take or cannot use. */\n invalidMeshFile: \"IGX-0507\",\n /** A serialized number was `NaN` or infinite. */\n nonFiniteNumber: \"IGX-0601\",\n /** A serialized `$entity`/`$component` reference could not be resolved. */\n unresolvedReference: \"IGX-0602\",\n /** A scene, prefab, or manifest declares a format version this build cannot read. */\n unsupportedFormatVersion: \"IGX-0603\",\n /** A scene instance's override hash does not match the scene file it was recorded against. */\n instanceHashMismatch: \"IGX-0604\",\n /** A value had the wrong JavaScript or JSON type for its schema field kind. */\n schemaTypeMismatch: \"IGX-0605\",\n /** A value had the right type but fell outside its schema field's declared value domain. */\n schemaOutOfRange: \"IGX-0606\",\n /**\n * A property bag named a field the schema does not declare, or a schema declaration named a field\n * it may not use: not identifier-like, a `Component`/`Script` member, or an `Object.prototype`\n * member such as `constructor` or `__proto__`.\n */\n schemaUnknownField: \"IGX-0607\",\n /** A scene file failed structural validation against the generated scene-file JSON Schema. */\n sceneFileInvalid: \"IGX-0608\",\n /** An instance override declares a `path` the override grammar does not accept. */\n invalidOverridePath: \"IGX-0609\",\n /** WebGPU is not available in the current environment. */\n webGpuUnavailable: \"IGX-0701\",\n /** A runtime handle was used after disposal, or was not created by ignifx. */\n invalidRuntime: \"IGX-0702\",\n /** Shadows were requested from a light kind Babylon Lite cannot shadow. */\n shadowsUnsupportedForLight: \"IGX-0703\",\n /** A rendering feature opt-in was requested after the render scene had been registered. */\n renderingFeatureTooLate: \"IGX-0704\",\n /** A second `Environment` was enabled in one world; the most recent one wins. */\n multipleEnvironments: \"IGX-0705\",\n /** A world rendered with no enabled camera, so nothing was drawn. */\n noEnabledCamera: \"IGX-0706\",\n /** A screenshot was requested with no render loop running, so no frame will ever be presented. */\n screenshotNeedsRenderLoop: \"IGX-0707\",\n /** A material file declares a family this build cannot construct. */\n unsupportedMaterialKind: \"IGX-0708\",\n /** An asset file does not carry the format header its loader requires. */\n invalidAssetFile: \"IGX-0709\",\n /** A `PostProcessStack` was attached without the `postProcessing` rendering feature. */\n postProcessingFeatureOff: \"IGX-0710\",\n /** An `Environment.skybox` asks for a background the environment it installed cannot draw. */\n skyboxFixedAtLoad: \"IGX-0711\",\n /** A shader material was asked for a uniform, texture, or storage buffer its shader never declared. */\n unknownShaderBinding: \"IGX-0712\",\n /** A shader uniform was written with a value whose shape does not match its declared type. */\n shaderValueMismatch: \"IGX-0713\",\n /** A shader declares a main-light uniform, but the world has no enabled directional light. */\n shaderLightUniformWithoutLight: \"IGX-0714\",\n /** A shader failed to compile or rebuild; the previous material stays in use. */\n shaderCompileFailed: \"IGX-0715\",\n /** A surface shader was attached without the `materialPlugins` rendering feature. */\n surfaceShaderFeatureOff: \"IGX-0716\",\n /** An `InstancedMeshRenderer` setting Lite fixes at scene registration was changed afterwards. */\n instancingSettingTooLate: \"IGX-0717\",\n /** A shader-material method was called on a PBR or Standard material. */\n notAShaderMaterial: \"IGX-0718\",\n /** A `.wgsl` file carries an `@ignifx` pragma this build cannot read. */\n invalidShaderPragma: \"IGX-0719\",\n /** A storage buffer update reaches past the buffer's capacity. */\n storageBufferOutOfRange: \"IGX-0720\",\n /** More instances were written to an `InstancedMeshRenderer` than its capacity holds. */\n instancedCapacityExceeded: \"IGX-0721\",\n /** Pixel data handed to a texture does not match its declared size. */\n invalidPixelData: \"IGX-0722\",\n /** A surface shader cannot run on its host: no hook, a hook the host lacks, or a Standard host. */\n surfaceHookMissing: \"IGX-0723\",\n /** A shader-material mesh was left out of an ESM shadow caster list, which Lite cannot render for it. */\n shaderMaterialEsmCasterSkipped: \"IGX-0724\",\n /** A `MeshAsset` vertex update named a range the geometry cannot hold. */\n invalidGeometryUpdate: \"IGX-0725\",\n /** The surface shaders attached to one material declare more samplers than fit beside the host material. */\n surfaceSamplerBudgetExceeded: \"IGX-0726\",\n /** An `InstancedMeshRenderer` declares a LOD partner with `gpuCulling` off, so the partner never draws. */\n instancingLodWithoutCulling: \"IGX-0727\",\n /** `app.renderer.openOverlay()` was called on a headless app, or before `app.start()` registered the render scene. */\n overlayNeedsRenderScene: \"IGX-0728\",\n /** A render texture was rendered into or read on a headless app, or before `app.start()` started the render loop. */\n renderTextureNeedsRenderLoop: \"IGX-0729\",\n /** `app.renderer.createRenderTexture` was given a side that is not a whole number from 1 to 4096. */\n invalidRenderTextureSize: \"IGX-0730\",\n /** A render texture was used after `dispose()`, or with another app's renderer. */\n renderTextureUnusable: \"IGX-0731\",\n /** `app.renderer.renderToTexture` was given a camera that is not attached to an entity. */\n renderTextureCameraDetached: \"IGX-0732\",\n /** The host exposes no Web Crypto implementation. */\n cryptoUnavailable: \"IGX-1420\",\n /** A storage namespace name is not a legal namespace segment. */\n storageInvalidNamespace: \"IGX-1421\",\n /** A storage key is empty, too long, or contains a control character. */\n storageInvalidKey: \"IGX-1422\",\n /** A value handed to `app.storage.set` has no JSON form. */\n storageValueNotSerializable: \"IGX-1423\",\n /** The storage backend refused a write because the host is out of quota or disk space. */\n storageQuotaExceeded: \"IGX-1424\",\n /** The storage backend failed for a reason the engine cannot classify. */\n storageBackendFailed: \"IGX-1425\",\n /** A stored value could not be read back; the store was damaged or written by something else. */\n storageValueCorrupt: \"IGX-1426\",\n /** An error code was registered twice. */\n duplicateErrorCode: \"IGX-1501\",\n /** An error code does not match `IGX-####` in a known range. */\n malformedErrorCode: \"IGX-1502\",\n /** A diagnostics counter group was registered twice. */\n duplicateDiagnosticsGroup: \"IGX-1503\",\n /** A diagnostics counter name was not declared when its group was registered. */\n unknownDiagnosticsCounter: \"IGX-1504\",\n /** A `switch` over a union reached a case the type system said was impossible. */\n unreachableCase: \"IGX-1505\",\n /** `app.hotReload.reloadScene()` was given an instance that was not built from a scene asset. */\n sceneNotReloadable: \"IGX-1506\",\n} as const;\n\n/**\n * The union of the codes `@ignifx/core` owns. Use it to narrow `catch` blocks to core failures.\n *\n * @public\n */\nexport type CoreErrorCode = (typeof CoreErrorCode)[keyof typeof CoreErrorCode];\n\n/**\n * The one-line message template for every `CoreErrorCode`. Templates name context keys in\n * braces (`{entity}`); the throwing call site substitutes the values it has and puts the same\n * identifiers in {@link IgnifxError.context} so production builds stay useful without the prose.\n *\n * @public\n */\nexport const CORE_ERROR_MESSAGES: Readonly<Record<CoreErrorCode, string>> = {\n \"IGX-0101\": \"{target} has been destroyed and can no longer be used.\",\n \"IGX-0102\": \"destroyImmediate() cannot run inside the {phase} callback; use destroy() instead.\",\n \"IGX-0103\": \"Deferred signal delivery needs a scheduler; construct the signal with a deferred queue.\",\n \"IGX-0104\": \"A signal handler threw.\",\n \"IGX-0105\": \"step() is only available in headless mode or while the render loop is stopped.\",\n \"IGX-0106\": \"The app has been disposed; {member} is no longer available.\",\n \"IGX-0107\": \"{member} is not available until createApp() resolves.\",\n \"IGX-0108\": \"{property} must be {domain}; got {value}.\",\n \"IGX-0109\": \"The tween option {option} must be {domain}; got {value}.\",\n \"IGX-0110\": \"{field} is not a number, Vec2, Vec3, or Quat on the tween target.\",\n \"IGX-0111\": \"{script} cannot start a coroutine in edit mode because its class does not run in edit mode.\",\n \"IGX-0201\": \"{component} requires {required} on the same entity.\",\n \"IGX-0202\": \"{component} does not allow multiple instances on one entity.\",\n \"IGX-0203\": \"The component type id {typeId} is already registered by {owner}.\",\n \"IGX-0204\": \"{component} cannot be serialized because it has no typeId.\",\n \"IGX-0205\": \"Transform cannot be removed or disabled.\",\n \"IGX-0206\": \"{component} is not attached to an entity yet.\",\n \"IGX-0207\":\n '{component} changed its schema shape under the \"patch\" hot-reload policy; its instances were re-created.',\n \"IGX-0208\": \"app.hotReload.apply() cannot run inside the {phase} callback; apply it between frames.\",\n \"IGX-0209\": \"{component} has a static requires cycle: {cycle}.\",\n \"IGX-0301\": \"The scene {scene} is not loaded yet.\",\n \"IGX-0302\": \"Instantiating {scene} under {entity} would nest the scene inside itself.\",\n \"IGX-0303\": \"{layer} is not a layer declared in the project settings.\",\n \"IGX-0304\": \"The layer name {layer} is declared twice.\",\n \"IGX-0305\": \"The project settings declare {count} layers; at most {limit} fit in the 32 slots.\",\n \"IGX-0306\": \"{entity} cannot be parented to {parent}, which is inside its own subtree.\",\n \"IGX-0307\": \"{typeId} is not a registered component type.\",\n \"IGX-0308\": \"{file} is not an ignifx scene file.\",\n \"IGX-0309\": \"{entity} is not a scene root; only roots can move between scene instances.\",\n \"IGX-0401\": \"The app property {property} is already defined by {owner}.\",\n \"IGX-0402\": \"The extension requires graph contains a cycle: {cycle}.\",\n \"IGX-0403\": \"{extension} requires {required}, which is not registered.\",\n \"IGX-0404\": \"{extension} supports engine {range} but the running core is {version}.\",\n \"IGX-0405\": \"The service {service} required by {extension} is not registered.\",\n \"IGX-0406\": \"The extension name {extension} is registered twice.\",\n \"IGX-0407\": \"{section} is not a registered settings section.\",\n \"IGX-0408\": \"The {section} settings section is invalid: {issues}.\",\n \"IGX-0409\": \"Physics callbacks are dispatched inside the fixed loop only; {callback} was not.\",\n \"IGX-0410\": \"A world has one simulation scene, and this world already has a different one.\",\n \"IGX-0411\": \"The {extension} extension object is already installed in another app that has not been disposed.\",\n \"IGX-0501\": \"The asset {asset} has no value yet because it is still loading.\",\n \"IGX-0502\": \"Loading {asset} was aborted.\",\n \"IGX-0503\": \"The app that owned the asset {asset} was disposed before loading finished.\",\n \"IGX-0504\": \"No loader is registered for {asset}.\",\n \"IGX-0505\": \"Loading {asset} from {url} failed after {attempts} attempts.\",\n \"IGX-0506\": \"A loader for the asset type {type} is already registered.\",\n \"IGX-0507\": \"{file} is not a valid mesh file: {problem}\",\n \"IGX-0601\": \"{field} must be a finite number.\",\n \"IGX-0602\": \"The reference {reference} in {scene} could not be resolved.\",\n \"IGX-0603\": \"{file} declares format version {version}, which this build cannot read.\",\n \"IGX-0604\": \"The overrides recorded for {scene} do not match the scene file.\",\n \"IGX-0605\": \"{field} has the wrong type for a {kind} field.\",\n \"IGX-0606\": \"{field} is outside the declared value domain.\",\n \"IGX-0607\": \"{field} is not a field this schema declares, or not a name a schema field may use.\",\n \"IGX-0608\": \"{file} does not match the scene file schema.\",\n \"IGX-0609\": \"{path} is not a valid instance override path.\",\n \"IGX-0701\": \"WebGPU is not available in this environment.\",\n \"IGX-0702\": \"This handle was already disposed, or was not created by ignifx.\",\n \"IGX-0703\": \"Babylon Lite has no shadow generator for a {lightType} light.\",\n \"IGX-0704\": \"The rendering feature {feature} must be enabled before the scene is registered.\",\n \"IGX-0705\": \"{entity} enabled a second Environment in this world; the most recent one wins.\",\n \"IGX-0706\": \"This world has no enabled camera, so nothing is drawn.\",\n \"IGX-0707\": \"captureScreenshot() needs a running render loop; a headless app never presents a frame.\",\n \"IGX-0708\": \"{asset} declares the material kind {kind}, which this build cannot construct.\",\n \"IGX-0709\": \"{file} is not an {format} file.\",\n \"IGX-0710\": \"{entity} attached a PostProcessStack, but rendering.features.postProcessing is off.\",\n \"IGX-0711\":\n \"{entity} asks for an Environment.skybox that {asset} was not loaded with; declare it in the .environment.json.\",\n \"IGX-0712\": \"{name} is not a uniform, texture, storage buffer, or plugin binding that is declared.\",\n \"IGX-0713\": \"{name} on {material} expects {expected}, not {actual}.\",\n \"IGX-0714\": \"{material} declares {name}, but this world has no enabled directional light; zeros are uploaded.\",\n \"IGX-0715\": \"{asset} failed to compile; the previous material stays in use. {message}\",\n \"IGX-0716\": \"{material} carries a surface shader, but rendering.features.materialPlugins is off.\",\n \"IGX-0717\": \"{entity} changed {field} on an InstancedMeshRenderer after the scene was registered.\",\n \"IGX-0718\": \"{material} is a {kind} material; {method} needs a shader material.\",\n \"IGX-0719\": \"{asset} line {line}: {message}\",\n \"IGX-0720\": \"{buffer}: an update of {bytes} bytes at offset {offset} exceeds the {capacity}-byte buffer.\",\n \"IGX-0721\": \"{entity}: {count} instances exceed the capacity of {capacity}.\",\n \"IGX-0722\": \"{asset}: {bytes} bytes of pixel data do not match {width}x{height} RGBA.\",\n \"IGX-0723\":\n \"A surface shader or post effect declares no hook this host can run: displace, surface, composite, or mainFragment.\",\n \"IGX-0724\":\n \"{entity} uses a shader material under ESM shadows; Babylon Lite 1.27.0 cannot render it into an ESM map, so it casts no shadow. Use pcf shadows or castShadows: false.\",\n \"IGX-0725\": \"{asset}: an update of {count} vertices at offset {offset} does not fit the {total}-vertex mesh.\",\n \"IGX-0726\": \"{samplers} plugin samplers are declared; {budget} fit beside a textured PBR material.\",\n \"IGX-0727\":\n \"{entity} declares an InstancedMeshRenderer lod with gpuCulling off; the LOD mesh never draws. Turn gpuCulling on.\",\n \"IGX-0728\": \"openOverlay() needs a canvas-backed app whose render scene is registered.\",\n \"IGX-0729\": \"{member} needs a canvas-backed app whose render loop is running.\",\n \"IGX-0730\": \"A render texture of {width}x{height}: each side must be a whole number from 1 to {max}.\",\n \"IGX-0731\": \"{member}: the render texture is disposed or belongs to another app.\",\n \"IGX-0732\": \"renderToTexture() needs a camera attached to an entity.\",\n \"IGX-1420\": \"This host does not expose Web Crypto.\",\n \"IGX-1421\": \"{namespace} is not a valid storage namespace.\",\n \"IGX-1422\": \"That storage key is empty, too long, or contains a control character.\",\n \"IGX-1423\": \"The value stored at {key} has no JSON form.\",\n \"IGX-1424\": \"The {backend} storage backend has no quota left for {operation}.\",\n \"IGX-1425\": \"The {backend} storage backend could not {operation}.\",\n \"IGX-1426\": \"The value stored at {key} could not be read back.\",\n \"IGX-1501\": \"The error code {code} is already registered by {owner}.\",\n \"IGX-1502\": \"{code} is not a valid IGX-#### code in a known range.\",\n \"IGX-1503\": \"The diagnostics group {group} is already registered.\",\n \"IGX-1504\": \"{counter} is not a counter of the diagnostics group {group}.\",\n \"IGX-1505\": \"Unreachable case reached for {what}.\",\n \"IGX-1506\": \"The scene instance {scene} was not built from a scene asset, so it cannot be reloaded.\",\n};\n\n/** The fixed length of an `IGX-####` code. */\nconst ERROR_CODE_LENGTH = 8;\n\n/** Where the four digits start inside an `IGX-####` code. */\nconst ERROR_CODE_DIGITS_OFFSET = 4;\n\n/** The characters allowed in the numeric part of a code. */\nconst DIGITS = \"0123456789\";\n\n/**\n * Reports whether a string is a well-formed ignifx error code.\n *\n * @remarks\n * The rule has exactly two parts and the `ignifx/error-code-format` lint rule mirrors it:\n *\n * 1. the string is `IGX-` followed by four ASCII digits, and\n * 2. the first two digits are one of the fifteen `ErrorRange` prefixes, or the first digit is\n * {@link THIRD_PARTY_ERROR_PREFIX} (the third-party block `IGX-9000`–`IGX-9999`).\n *\n * @param code - The candidate code.\n * @returns `true` when the code is well formed and inside an allocated range. The signature is a\n * type predicate, so a validated string narrows to {@link ErrorCode} without a type assertion.\n *\n * @example\n * ```ts\n * isValidErrorCode(\"IGX-0701\"); // true — rendering\n * isValidErrorCode(\"IGX-9042\"); // true — third party\n * isValidErrorCode(\"IGX-1801\"); // false — no subsystem owns 18\n * ```\n *\n * @public\n */\nexport function isValidErrorCode(code: string): code is ErrorCode {\n // The literal below is the prefix the `ignifx/error-code-format` rule looks for. This function is\n // the validator that rule mirrors, not a throw site, so the rule is switched off for one line.\n // eslint-disable-next-line ignifx/error-code-format -- see the comment above\n if (code.length !== ERROR_CODE_LENGTH || !code.startsWith(\"IGX-\")) {\n return false;\n }\n const digits = code.slice(ERROR_CODE_DIGITS_OFFSET);\n for (const digit of digits) {\n if (!DIGITS.includes(digit)) {\n return false;\n }\n }\n const prefix = digits.slice(0, 2);\n if (prefix.startsWith(THIRD_PARTY_ERROR_PREFIX)) {\n return true;\n }\n for (const range of Object.values(ErrorRange)) {\n if (range === prefix) {\n return true;\n }\n }\n return false;\n}\n","import { CoreErrorCode, type ErrorCode } from \"./error-codes.js\";\n\n/**\n * The identifiers that make a failure actionable: entity and component uids, asset keys, layer\n * names, extension names. Values are primitives so the whole record survives being sent to a\n * devtools panel or a log sink without cloning engine objects.\n *\n * @public\n */\nexport type ErrorContext = Readonly<Record<string, string | number | boolean | null>>;\n\n/**\n * How much of an error is spelled out in `Error.message`.\n *\n * @remarks\n * `\"development\"` writes the full sentence, the context values, and the hint. `\"production\"` keeps\n * the code and the *names* of the context keys and drops every value and the prose, so shipped\n * games neither leak content paths nor pay for message strings (`CONSTITUTION.md` §3.9). The\n * structured `code`, `context`, and `hint` properties are populated in both modes.\n *\n * @public\n */\nexport type ErrorFormatMode = \"development\" | \"production\";\n\n/**\n * Options accepted by {@link IgnifxError}. Extends the standard `ErrorOptions`, so `cause` keeps\n * the original failure when an error is wrapped.\n *\n * @public\n */\nexport interface IgnifxErrorOptions extends ErrorOptions {\n /** Identifiers that locate the failure. Defaults to an empty record. */\n readonly context?: ErrorContext;\n /** One sentence telling the developer what to do about it. Defaults to `null`. */\n readonly hint?: string | null;\n /** How verbose `message` should be. Defaults to `\"development\"`. */\n readonly mode?: ErrorFormatMode;\n}\n\n/** Shared empty context so the common case allocates nothing. */\nconst EMPTY_CONTEXT: ErrorContext = {};\n\n/**\n * Builds the `Error.message` of an {@link IgnifxError}.\n *\n * @remarks\n * Development messages read `IGX-0201: Mover requires Rigidbody. [entity=01J…] Hint: add it.`\n * Production messages read `IGX-0201 [entity]` — enough to look the code up in the registry and to\n * know which identifiers the `context` property carries, with no prose in the bundle.\n *\n * @param code - The stable diagnostic code.\n * @param message - The actionable development sentence.\n * @param context - Identifiers that locate the failure.\n * @param hint - A remedy sentence, or `null`.\n * @param mode - Whether to format for development or production.\n * @returns The formatted message.\n *\n * @example\n * ```ts\n * formatErrorMessage(\"IGX-0303\", \"Enemy is not a declared layer.\", { layer: \"Enemy\" }, null, \"production\");\n * // \"IGX-0303 [layer]\"\n * ```\n *\n * @public\n */\nexport function formatErrorMessage(\n code: ErrorCode,\n message: string,\n context: ErrorContext,\n hint: string | null,\n mode: ErrorFormatMode,\n): string {\n const keys = Object.keys(context);\n if (mode === \"production\") {\n return keys.length === 0 ? code : `${code} [${keys.join(\", \")}]`;\n }\n let formatted = `${code}: ${message}`;\n if (keys.length > 0) {\n const parts: string[] = [];\n for (const key of keys) {\n parts.push(`${key}=${String(context[key] ?? null)}`);\n }\n formatted += ` [${parts.join(\", \")}]`;\n }\n if (hint !== null && hint.length > 0) {\n formatted += ` Hint: ${hint}`;\n }\n return formatted;\n}\n\n/**\n * The error every ignifx API throws for misuse (`CONSTITUTION.md` §3.9). It always carries a stable\n * `IGX-####` `code` and the `context` identifiers needed to find the offending object,\n * so a production build can compact the human-readable half without losing meaning.\n *\n * @example\n * ```ts\n * try {\n * world.instantiate(scene);\n * } catch (error) {\n * if (isIgnifxError(error) && error.code === CoreErrorCode.sceneNotLoaded) {\n * await scene.load();\n * }\n * }\n * ```\n *\n * @public\n */\nexport class IgnifxError extends Error {\n /** The stable diagnostic code for this failure. */\n readonly code: ErrorCode;\n\n /** Identifiers that locate the failure (entity uid, component type id, asset key, …). */\n readonly context: ErrorContext;\n\n /** One sentence telling the developer how to fix it, or `null` when there is nothing to add. */\n readonly hint: string | null;\n\n /**\n * Creates an ignifx error.\n *\n * @param code - The stable `IGX-####` code for the failure.\n * @param message - An actionable description of what went wrong, used in development mode.\n * @param options - Context, hint, format mode, and the standard `cause`.\n */\n constructor(code: ErrorCode, message: string, options?: IgnifxErrorOptions) {\n const context = options?.context ?? EMPTY_CONTEXT;\n const hint = options?.hint ?? null;\n super(formatErrorMessage(code, message, context, hint, options?.mode ?? \"development\"), options);\n this.name = \"IgnifxError\";\n this.code = code;\n this.context = context;\n this.hint = hint;\n }\n}\n\n/**\n * Narrows an unknown value — a `catch` binding, a rejected promise, a signal payload — to an\n * {@link IgnifxError}.\n *\n * @param value - The value to test.\n * @returns `true` when the value is an ignifx error produced by this copy of `@ignifx/core`.\n *\n * @example\n * ```ts\n * app.onError.connect((report) => {\n * if (isIgnifxError(report.error)) {\n * console.warn(report.error.code, report.error.context);\n * }\n * });\n * ```\n *\n * @public\n */\nexport function isIgnifxError(value: unknown): value is IgnifxError {\n return value instanceof IgnifxError;\n}\n\n/**\n * The default branch of an exhaustive `switch` (coding standards §5.2). The compiler rejects the\n * call as soon as a new union member is left unhandled, and at runtime it throws rather than\n * falling through silently.\n *\n * @param value - The value the type system proved impossible.\n * @param what - What was being switched over, for the message.\n * @throws IgnifxError with code `IGX-1505`; the function never returns.\n *\n * @example\n * ```ts\n * switch (level) {\n * case \"debug\":\n * return 10;\n * default:\n * return assertNever(level, \"log level\");\n * }\n * ```\n *\n * @public\n */\nexport function assertNever(value: never, what: string): never {\n throw new IgnifxError(CoreErrorCode.unreachableCase, `Unreachable case reached for ${what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H"}
|
package/dist/json-CzZZ6K4x.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//#region src/schema/json.ts
|
|
2
|
-
/**
|
|
3
|
-
* Sets a key on an object being built from JSON as an own, enumerable data property — what
|
|
4
|
-
* `JSON.parse` does. A plain `target[key] = value` treats the key `__proto__` as the prototype
|
|
5
|
-
* setter, so a file carrying that key would change the copy's prototype instead of holding data.
|
|
6
|
-
*
|
|
7
|
-
* @param target - The object under construction.
|
|
8
|
-
* @param key - The key, taken from parsed JSON.
|
|
9
|
-
* @param value - The value.
|
|
10
|
-
*
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
function setOwnJsonProperty(target, key, value) {
|
|
14
|
-
Object.defineProperty(target, key, {
|
|
15
|
-
value,
|
|
16
|
-
enumerable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
configurable: true
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
export { setOwnJsonProperty as t };
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=json-CzZZ6K4x.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-CzZZ6K4x.js","names":[],"sources":["../src/schema/json.ts"],"sourcesContent":["/**\n * The JSON value model the serializer works in. Scene and prefab files are UTF-8 JSON\n * (`docs/architecture/06-serialization-and-scene-format.md` §1), so every encoded schema value is\n * one of these shapes. The type is recursive rather than `unknown` so that encoders cannot smuggle\n * a `Date`, a `Map`, or an `undefined` into a file (coding standards §5.2 bans `any`).\n *\n * @public\n */\nexport type JsonValue = string | number | boolean | null | JsonArray | JsonObject;\n\n/**\n * A JSON array. Read-only because encoded values are snapshots: callers copy before mutating.\n *\n * @public\n */\nexport type JsonArray = readonly JsonValue[];\n\n/**\n * A JSON object. Keys are emitted in the canonical order defined by\n * `docs/architecture/06-serialization-and-scene-format.md` §1, so two saves of the same state\n * produce byte-identical files.\n *\n * @public\n */\nexport type JsonObject = { readonly [key: string]: JsonValue };\n\n/**\n * Sets a key on an object being built from JSON as an own, enumerable data property — what\n * `JSON.parse` does. A plain `target[key] = value` treats the key `__proto__` as the prototype\n * setter, so a file carrying that key would change the copy's prototype instead of holding data.\n *\n * @param target - The object under construction.\n * @param key - The key, taken from parsed JSON.\n * @param value - The value.\n *\n * @internal\n */\nexport function setOwnJsonProperty<T>(target: Record<string, T>, key: string, value: T): void {\n Object.defineProperty(target, key, { value, enumerable: true, writable: true, configurable: true });\n}\n"],"mappings":";;;;;;;;;;;;AAqCA,SAAgB,mBAAsB,QAA2B,KAAa,OAAgB;CAC5F,OAAO,eAAe,QAAQ,KAAK;EAAE;EAAO,YAAY;EAAM,UAAU;EAAM,cAAc;CAAK,CAAC;AACpG"}
|