@kite3d/engine 0.18.0 → 0.19.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring.d.ts +1 -1
- package/dist/authoring.js +7 -7
- package/dist/authoring.js.map +1 -1
- package/dist/authoringValidation.d.ts +2 -5
- package/dist/authoringValidation.js +266 -289
- package/dist/authoringValidation.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1145 -1440
- package/dist/index.js.map +1 -1
- package/dist/projectFormat.js +70 -81
- package/dist/projectFormat.js.map +1 -1
- package/dist/runtime/createGame.d.ts +1 -1
- package/dist/runtime/index.d.ts +0 -2
- package/dist/runtime/projectFormat.d.ts +7 -14
- package/dist/runtime.js +14086 -15497
- package/dist/runtime.js.map +1 -1
- package/dist/sceneSerialization.js +57 -52
- package/dist/sceneSerialization.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/src/authoring.ts +3 -3
- package/src/authoringValidation.ts +3 -40
- package/src/index.ts +0 -2
- package/src/runtime/createGame.ts +1 -5
- package/src/runtime/index.ts +0 -2
- package/src/runtime/projectFormat.ts +20 -47
- package/src/sceneSerialization.ts +10 -2
- package/dist/generatorParams.d.ts +0 -23
- package/dist/plugins/GeneratorComponent.d.ts +0 -44
- package/src/generatorParams.ts +0 -182
- package/src/plugins/GeneratorComponent.ts +0 -287
|
@@ -1,422 +1,399 @@
|
|
|
1
|
-
import { Box3 as
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { Box3 as X, Vector3 as V, Frustum as ue, Matrix4 as ce, EntityComponentPlugin as fe } from "threepipe";
|
|
2
|
+
import { getTrackedRuntimeObjects as de, getRuntimeObjectMetadata as U, getAuthoringMetadata as G, KITE3D_AUTHORING_METADATA_KEY as v } from "./authoring.js";
|
|
3
|
+
const x = 1e-6;
|
|
4
|
+
function xe(e) {
|
|
5
5
|
const t = e.scene;
|
|
6
6
|
if (!(t != null && t.modelRoot)) throw new Error("Authoring validation requires viewer.scene.modelRoot");
|
|
7
7
|
t.updateMatrixWorld(!0);
|
|
8
|
-
const
|
|
9
|
-
let
|
|
10
|
-
t.modelRoot.traverse((
|
|
11
|
-
if (
|
|
12
|
-
u += 1;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
for (const c of i) {
|
|
20
|
-
const f = n.get(c.metadata.sourceId || "");
|
|
21
|
-
(!f || f.metadata.role !== "generator") && G(r, {
|
|
22
|
-
code: "MISSING_AUTHORING_SOURCE",
|
|
23
|
-
severity: "error",
|
|
24
|
-
message: `Generator output source "${c.metadata.sourceId || "(missing)"}" is not present beneath modelRoot.`,
|
|
25
|
-
object: _(c.object)
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
for (const c of o)
|
|
29
|
-
a.has(c.metadata.id) || G(r, {
|
|
30
|
-
code: "GENERATOR_PREVIEW_MISSING",
|
|
31
|
-
severity: "error",
|
|
32
|
-
message: "An authored generator needs a bounded stopped-mode preview.",
|
|
33
|
-
object: _(c.object)
|
|
34
|
-
});
|
|
35
|
-
r.push(...re(t, n));
|
|
36
|
-
const S = u === 0 && o.length === 0;
|
|
37
|
-
(m === 0 || R === 0) && r.push({
|
|
8
|
+
const n = [], r = Z(t.modelRoot), i = [];
|
|
9
|
+
let s = 0, a = 0, o = 0, u = 0;
|
|
10
|
+
t.modelRoot.traverse((d) => {
|
|
11
|
+
if (d === t.modelRoot || (s += 1, !$(d)) || (a += 1, !he(d, t.modelRoot))) return;
|
|
12
|
+
o += 1, ye(d) && (u += 1);
|
|
13
|
+
const l = new X().setFromObject(d);
|
|
14
|
+
!l.isEmpty() && B(l.min) && B(l.max) && i.push({ object: d, bounds: l });
|
|
15
|
+
}), n.push(...ee(t, r));
|
|
16
|
+
const c = s === 0;
|
|
17
|
+
(o === 0 || u === 0) && n.push({
|
|
38
18
|
code: "NO_VISIBLE_AUTHORED_CONTENT",
|
|
39
|
-
severity:
|
|
40
|
-
message:
|
|
19
|
+
severity: c ? "warning" : "error",
|
|
20
|
+
message: c ? "The scene is empty; add authored content when you are ready." : o === 0 ? "No visible renderable authored content exists beneath modelRoot." : "Visible authored renderables are not selectable."
|
|
41
21
|
});
|
|
42
|
-
const
|
|
22
|
+
const R = t.defaultCamera || t.mainCamera, C = t.defaultCamera ? "scene.defaultCamera" : "scene.mainCamera", w = c ? { useful: !1, framed: 0, inside: 0 } : le(R, C, i, n), p = n.filter(({ severity: d }) => d === "error"), A = !p.some(({ code: d }) => d === "MISSING_AUTHORING_SOURCE" || d === "RUNTIME_SOURCE_DRIFT"), y = p.length === 0;
|
|
43
23
|
return {
|
|
44
|
-
ok:
|
|
45
|
-
status:
|
|
46
|
-
summary:
|
|
47
|
-
issues:
|
|
24
|
+
ok: y,
|
|
25
|
+
status: y ? "pass" : "fail",
|
|
26
|
+
summary: y ? "Stopped-mode authored representation passed." : `${p.length} authoring check(s) failed.`,
|
|
27
|
+
issues: n,
|
|
48
28
|
checks: {
|
|
49
|
-
visibleAuthoredContent:
|
|
50
|
-
selectableAuthoredContent:
|
|
51
|
-
relationshipsValid:
|
|
52
|
-
|
|
53
|
-
cameraUseful: y.useful
|
|
29
|
+
visibleAuthoredContent: o > 0,
|
|
30
|
+
selectableAuthoredContent: u > 0,
|
|
31
|
+
relationshipsValid: A,
|
|
32
|
+
cameraUseful: w.useful
|
|
54
33
|
},
|
|
55
34
|
metrics: {
|
|
56
|
-
authoredObjectCount:
|
|
57
|
-
renderableCount:
|
|
58
|
-
visibleRenderableCount:
|
|
59
|
-
selectableCount:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
cameraFramedRenderableCount: y.framed,
|
|
63
|
-
cameraInsideRenderableCount: y.inside
|
|
35
|
+
authoredObjectCount: s,
|
|
36
|
+
renderableCount: a,
|
|
37
|
+
visibleRenderableCount: o,
|
|
38
|
+
selectableCount: u,
|
|
39
|
+
cameraFramedRenderableCount: w.framed,
|
|
40
|
+
cameraInsideRenderableCount: w.inside
|
|
64
41
|
}
|
|
65
42
|
};
|
|
66
43
|
}
|
|
67
|
-
function
|
|
44
|
+
function Ee(e) {
|
|
68
45
|
const t = e.scene;
|
|
69
46
|
if (!(t != null && t.modelRoot)) throw new Error("Runtime cleanup validation requires viewer.scene.modelRoot");
|
|
70
47
|
t.updateMatrixWorld(!0);
|
|
71
|
-
const
|
|
72
|
-
let
|
|
73
|
-
for (const
|
|
74
|
-
|
|
75
|
-
t.traverse((
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
const u =
|
|
79
|
-
u ?
|
|
48
|
+
const n = ee(t, Z(t.modelRoot)), r = de(t), i = /* @__PURE__ */ new Set();
|
|
49
|
+
let s = 0;
|
|
50
|
+
for (const o of r)
|
|
51
|
+
Q(o, i) || i.add(o);
|
|
52
|
+
t.traverse((o) => {
|
|
53
|
+
if (o === t || o === t.modelRoot || ge(o, t.modelRoot) || be(o, t)) return;
|
|
54
|
+
$(o) && (s += 1);
|
|
55
|
+
const u = Ae(o);
|
|
56
|
+
u ? Q(u, i) || i.add(u) : $(o) && i.add(o);
|
|
80
57
|
});
|
|
81
|
-
for (const
|
|
82
|
-
|
|
58
|
+
for (const o of i)
|
|
59
|
+
M(n, {
|
|
83
60
|
code: "RUNTIME_OBJECT_AFTER_STOP",
|
|
84
61
|
severity: "error",
|
|
85
|
-
message:
|
|
86
|
-
object:
|
|
62
|
+
message: U(o) ? "A tracked runtime object remains after Stop." : "An unmarked renderable remains outside modelRoot after Stop.",
|
|
63
|
+
object: k(o)
|
|
87
64
|
});
|
|
88
|
-
const a = !
|
|
65
|
+
const a = !n.some(({ severity: o }) => o === "error");
|
|
89
66
|
return {
|
|
90
67
|
ok: a,
|
|
91
68
|
status: a ? "pass" : "fail",
|
|
92
|
-
summary: a ? "Runtime cleanup passed." : `${
|
|
93
|
-
issues:
|
|
94
|
-
trackedObjectCount:
|
|
95
|
-
outsideRenderableCount:
|
|
69
|
+
summary: a ? "Runtime cleanup passed." : `${n.filter(({ severity: o }) => o === "error").length} runtime cleanup check(s) failed.`,
|
|
70
|
+
issues: n,
|
|
71
|
+
trackedObjectCount: r.length,
|
|
72
|
+
outsideRenderableCount: s
|
|
96
73
|
};
|
|
97
74
|
}
|
|
98
|
-
function
|
|
75
|
+
function J(e) {
|
|
99
76
|
const t = "scene" in e ? e.scene : e;
|
|
100
77
|
if (!(t != null && t.modelRoot)) throw new Error("A semantic snapshot requires scene.modelRoot");
|
|
101
78
|
return {
|
|
102
79
|
schemaVersion: 1,
|
|
103
|
-
scene: t.modelRoot.children.filter((
|
|
104
|
-
var
|
|
105
|
-
return ((
|
|
106
|
-
}).map((
|
|
80
|
+
scene: t.modelRoot.children.filter((n) => {
|
|
81
|
+
var r;
|
|
82
|
+
return ((r = n.userData) == null ? void 0 : r.excludeFromExport) !== !0;
|
|
83
|
+
}).map((n) => te(n))
|
|
107
84
|
};
|
|
108
85
|
}
|
|
109
86
|
function Oe(e, t) {
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
const
|
|
87
|
+
const n = m(I(e)), r = m(I(t)), i = JSON.stringify(n), s = JSON.stringify(r), a = [];
|
|
88
|
+
z(n, r, "", a);
|
|
89
|
+
const o = a.map((c) => ({
|
|
113
90
|
code: "PERSISTENCE_DRIFT",
|
|
114
91
|
severity: "error",
|
|
115
|
-
message: `Saved authoring semantics changed at ${
|
|
116
|
-
...
|
|
92
|
+
message: `Saved authoring semantics changed at ${c.path || "/"}.`,
|
|
93
|
+
...c
|
|
117
94
|
})), u = a.length === 0;
|
|
118
95
|
return {
|
|
119
96
|
ok: u,
|
|
120
97
|
status: u ? "pass" : "fail",
|
|
121
98
|
summary: u ? "Save/Reload semantic equivalence passed." : `${a.length} persisted semantic difference(s) found.`,
|
|
122
|
-
issues:
|
|
99
|
+
issues: o,
|
|
123
100
|
changes: a,
|
|
124
|
-
beforeBytes:
|
|
125
|
-
afterBytes:
|
|
101
|
+
beforeBytes: i.length,
|
|
102
|
+
afterBytes: s.length
|
|
126
103
|
};
|
|
127
104
|
}
|
|
128
105
|
let b;
|
|
129
|
-
function
|
|
106
|
+
function Ne(e) {
|
|
130
107
|
if (!b) throw new Error("registerGameValidation must be called while createGame is active");
|
|
131
108
|
return b.registerGameValidation(e);
|
|
132
109
|
}
|
|
133
|
-
function
|
|
110
|
+
function Te(e) {
|
|
134
111
|
if (!b) throw new Error("publishGameTelemetry must be called while createGame is active");
|
|
135
112
|
return b.publishGameTelemetry(e);
|
|
136
113
|
}
|
|
137
|
-
function
|
|
114
|
+
function Ie() {
|
|
138
115
|
const e = /* @__PURE__ */ new Set();
|
|
139
|
-
let t,
|
|
140
|
-
const
|
|
116
|
+
let t, n = !1;
|
|
117
|
+
const r = Object.freeze({
|
|
141
118
|
get telemetry() {
|
|
142
119
|
return t;
|
|
143
120
|
},
|
|
144
|
-
validate: () =>
|
|
145
|
-
}),
|
|
146
|
-
registerGameValidation(
|
|
147
|
-
if (
|
|
148
|
-
return e.add(
|
|
121
|
+
validate: () => i.runGameValidation()
|
|
122
|
+
}), i = {
|
|
123
|
+
registerGameValidation(s) {
|
|
124
|
+
if (n || typeof s != "function") throw new Error("Game validation must be a function on an active game");
|
|
125
|
+
return e.add(s), () => e.delete(s);
|
|
149
126
|
},
|
|
150
|
-
publishGameTelemetry(
|
|
151
|
-
if (
|
|
127
|
+
publishGameTelemetry(s) {
|
|
128
|
+
if (n || !s || typeof s != "object" || Array.isArray(s))
|
|
152
129
|
throw new Error("Game telemetry must be an object on an active game");
|
|
153
|
-
const a = pe(
|
|
130
|
+
const a = pe(s);
|
|
154
131
|
return t = a, () => {
|
|
155
132
|
t === a && (t = void 0);
|
|
156
133
|
};
|
|
157
134
|
},
|
|
158
135
|
async runGameValidation() {
|
|
159
|
-
const
|
|
160
|
-
for (const
|
|
136
|
+
const s = [];
|
|
137
|
+
for (const o of e)
|
|
161
138
|
try {
|
|
162
|
-
const u = await
|
|
163
|
-
u === void 0 || u === !0 ?
|
|
139
|
+
const u = await o();
|
|
140
|
+
u === void 0 || u === !0 ? s.push({ status: "pass", summary: "Project validation passed." }) : u === !1 ? s.push({ status: "fail", summary: "Project validation failed." }) : u && ["pass", "fail"].includes(u.status) && typeof u.summary == "string" ? s.push(u) : s.push({ status: "fail", summary: "Project validation returned an invalid result." });
|
|
164
141
|
} catch (u) {
|
|
165
|
-
|
|
142
|
+
s.push({ status: "fail", summary: `Project validation threw: ${Re(u)}` });
|
|
166
143
|
}
|
|
167
|
-
const a =
|
|
144
|
+
const a = s.filter(({ status: o }) => o === "fail");
|
|
168
145
|
return {
|
|
169
146
|
ok: a.length === 0,
|
|
170
147
|
status: a.length ? "fail" : "pass",
|
|
171
|
-
summary: a.length ? a.map(({ summary:
|
|
172
|
-
results:
|
|
148
|
+
summary: a.length ? a.map(({ summary: o }) => o).join(" ") : "Project validations passed.",
|
|
149
|
+
results: s
|
|
173
150
|
};
|
|
174
151
|
},
|
|
175
152
|
dispose() {
|
|
176
|
-
|
|
153
|
+
n = !0, e.clear(), t = void 0, b === i && (b = void 0), typeof window < "u" && window.kite3dGame === r && delete window.kite3dGame;
|
|
177
154
|
}
|
|
178
155
|
};
|
|
179
|
-
return b == null || b.dispose(), b =
|
|
156
|
+
return b == null || b.dispose(), b = i, typeof window < "u" && (window.kite3dGame = r), i;
|
|
180
157
|
}
|
|
181
|
-
function
|
|
158
|
+
function Z(e) {
|
|
182
159
|
const t = /* @__PURE__ */ new Map();
|
|
183
|
-
return e.traverse((
|
|
184
|
-
if (
|
|
185
|
-
const
|
|
186
|
-
|
|
160
|
+
return e.traverse((n) => {
|
|
161
|
+
if (n === e) return;
|
|
162
|
+
const r = G(n);
|
|
163
|
+
r && !r.sourceId ? t.set(r.id, { object: n, metadata: r }) : r || t.set(n.uuid, { object: n, metadata: { role: "direct", id: n.uuid } });
|
|
187
164
|
}), t;
|
|
188
165
|
}
|
|
189
|
-
function
|
|
190
|
-
const
|
|
191
|
-
return e.traverse((
|
|
192
|
-
const
|
|
193
|
-
if (!(
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
196
|
-
|
|
166
|
+
function ee(e, t) {
|
|
167
|
+
const n = [];
|
|
168
|
+
return e.traverse((r) => {
|
|
169
|
+
const i = G(r);
|
|
170
|
+
if (!(i != null && i.sourceId)) return;
|
|
171
|
+
const s = t.get(i.sourceId);
|
|
172
|
+
if (!s) {
|
|
173
|
+
M(n, {
|
|
197
174
|
code: "MISSING_AUTHORING_SOURCE",
|
|
198
175
|
severity: "error",
|
|
199
|
-
message: `Authored source "${
|
|
200
|
-
object:
|
|
176
|
+
message: `Authored source "${i.sourceId}" is not present beneath modelRoot.`,
|
|
177
|
+
object: k(r)
|
|
201
178
|
});
|
|
202
179
|
return;
|
|
203
180
|
}
|
|
204
|
-
const a =
|
|
205
|
-
if (!a || a.kind === "effect"
|
|
206
|
-
const
|
|
207
|
-
JSON.stringify(
|
|
181
|
+
const a = U(r);
|
|
182
|
+
if (!a || a.kind === "effect") return;
|
|
183
|
+
const o = new Set(a.overrides || []);
|
|
184
|
+
JSON.stringify(P(s.object, o)) !== JSON.stringify(P(r, o)) && M(n, {
|
|
208
185
|
code: "RUNTIME_SOURCE_DRIFT",
|
|
209
186
|
severity: "error",
|
|
210
187
|
message: "A runtime copy differs from its authored source in a non-mutable field.",
|
|
211
|
-
object:
|
|
188
|
+
object: k(r)
|
|
212
189
|
});
|
|
213
|
-
}),
|
|
214
|
-
}
|
|
215
|
-
function le(e, t,
|
|
216
|
-
var
|
|
217
|
-
let
|
|
218
|
-
const
|
|
219
|
-
let u = `${
|
|
220
|
-
const
|
|
221
|
-
if (e &&
|
|
222
|
-
e.updateMatrixWorld(!0), (
|
|
223
|
-
const
|
|
224
|
-
for (const { bounds: h } of
|
|
225
|
-
const
|
|
226
|
-
a = !
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
for (const { object: h, bounds:
|
|
230
|
-
if (we(h) || !
|
|
231
|
-
const
|
|
232
|
-
if (!g ||
|
|
233
|
-
|
|
190
|
+
}), n;
|
|
191
|
+
}
|
|
192
|
+
function le(e, t, n, r) {
|
|
193
|
+
var w, p, A, y, d;
|
|
194
|
+
let i = 0, s = 0, a = !1;
|
|
195
|
+
const o = `${t}${e != null && e.name ? ` "${e.name}"` : ""}`;
|
|
196
|
+
let u = `${o} must be finite and face visible authored content.`;
|
|
197
|
+
const c = e == null ? void 0 : e.projectionMatrix, R = e == null ? void 0 : e.matrixWorldInverse;
|
|
198
|
+
if (e && B(e.position) && c && R && n.length) {
|
|
199
|
+
e.updateMatrixWorld(!0), (w = e.updateProjectionMatrix) == null || w.call(e);
|
|
200
|
+
const l = e.getWorldPosition(new V()), N = new X().makeEmpty();
|
|
201
|
+
for (const { bounds: h } of n) N.union(h);
|
|
202
|
+
const re = N.getCenter(new V()), D = (p = e.getWorldDirection) == null ? void 0 : p.call(e, new V()), W = re.clone().sub(l);
|
|
203
|
+
a = !D || W.lengthSq() === 0 || D.dot(W.normalize()) > 0;
|
|
204
|
+
const oe = new ue().setFromProjectionMatrix(new ce().multiplyMatrices(c, R));
|
|
205
|
+
i = n.filter(({ bounds: h }) => oe.intersectsBox(h)).length;
|
|
206
|
+
for (const { object: h, bounds: ie } of n) {
|
|
207
|
+
if (we(h) || !j(ie, l)) continue;
|
|
208
|
+
const T = h, g = T.geometry, se = T.isInstancedMesh || T.isSkinnedMesh || ((y = (A = g == null ? void 0 : g.morphAttributes) == null ? void 0 : A.position) == null ? void 0 : y.length);
|
|
209
|
+
if (!g || se || h.matrixWorld.determinant() === 0) {
|
|
210
|
+
H(r, h);
|
|
234
211
|
continue;
|
|
235
212
|
}
|
|
236
|
-
(
|
|
237
|
-
const ae = h.worldToLocal(
|
|
238
|
-
!g.boundingBox || !
|
|
213
|
+
(d = g.computeBoundingBox) == null || d.call(g);
|
|
214
|
+
const ae = h.worldToLocal(l.clone());
|
|
215
|
+
!g.boundingBox || !j(g.boundingBox, ae) || (T.isMesh && g.type === "BoxGeometry" ? s += 1 : H(r, h));
|
|
239
216
|
}
|
|
240
|
-
|
|
217
|
+
s ? u = `${o} is inside ${s} visible authored mesh(es).` : i ? a || (u = `${o} faces away from visible authored content.`) : u = `No visible authored renderable intersects ${o}'s frustum.`;
|
|
241
218
|
}
|
|
242
|
-
const
|
|
243
|
-
return
|
|
219
|
+
const C = !!(e && n.length && i > 0 && s === 0 && a);
|
|
220
|
+
return C || r.push({ code: "CAMERA_NOT_USEFUL", severity: "error", message: u }), { useful: C, framed: i, inside: s };
|
|
244
221
|
}
|
|
245
|
-
function
|
|
246
|
-
return t.x > e.min.x +
|
|
222
|
+
function j(e, t) {
|
|
223
|
+
return t.x > e.min.x + x && t.x < e.max.x - x && t.y > e.min.y + x && t.y < e.max.y - x && t.z > e.min.z + x && t.z < e.max.z - x;
|
|
247
224
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
225
|
+
function H(e, t) {
|
|
226
|
+
M(e, {
|
|
250
227
|
code: "CAMERA_CONTAINMENT_UNVERIFIED",
|
|
251
228
|
severity: "warning",
|
|
252
229
|
message: "The camera intersects local geometry bounds, but hollow or imported mesh containment is unverified.",
|
|
253
|
-
object:
|
|
230
|
+
object: k(t)
|
|
254
231
|
});
|
|
255
232
|
}
|
|
256
|
-
function
|
|
257
|
-
var
|
|
258
|
-
const
|
|
259
|
-
type:
|
|
260
|
-
geometry:
|
|
261
|
-
children: e.children.map((a) =>
|
|
233
|
+
function P(e, t, n = !0) {
|
|
234
|
+
var s;
|
|
235
|
+
const r = e, i = {
|
|
236
|
+
type: ne(e),
|
|
237
|
+
geometry: m((s = r.geometry) == null ? void 0 : s.parameters),
|
|
238
|
+
children: e.children.map((a) => P(a, /* @__PURE__ */ new Set(), !1))
|
|
262
239
|
};
|
|
263
|
-
return (!
|
|
240
|
+
return (!n || !t.has("visible")) && (i.visible = e.visible), (!n || !t.has("position")) && (i.position = E(e.position)), (!n || !t.has("rotation")) && (i.rotation = E(e.rotation)), (!n || !t.has("scale")) && (i.scale = E(e.scale)), r.material && (!n || !t.has("material")) && (i.material = Array.isArray(r.material) ? r.material.map(L) : L(r.material)), i;
|
|
264
241
|
}
|
|
265
|
-
function
|
|
266
|
-
var
|
|
242
|
+
function L(e) {
|
|
243
|
+
var n, r, i, s;
|
|
267
244
|
const t = e;
|
|
268
|
-
return
|
|
245
|
+
return m({
|
|
269
246
|
type: t == null ? void 0 : t.type,
|
|
270
|
-
color: (
|
|
271
|
-
emissive: (
|
|
247
|
+
color: (r = (n = t == null ? void 0 : t.color) == null ? void 0 : n.getHex) == null ? void 0 : r.call(n),
|
|
248
|
+
emissive: (s = (i = t == null ? void 0 : t.emissive) == null ? void 0 : i.getHex) == null ? void 0 : s.call(i),
|
|
272
249
|
opacity: t == null ? void 0 : t.opacity,
|
|
273
250
|
transparent: t == null ? void 0 : t.transparent,
|
|
274
251
|
metalness: t == null ? void 0 : t.metalness,
|
|
275
252
|
roughness: t == null ? void 0 : t.roughness
|
|
276
253
|
});
|
|
277
254
|
}
|
|
278
|
-
function
|
|
279
|
-
const t =
|
|
280
|
-
return
|
|
255
|
+
function te(e) {
|
|
256
|
+
const t = G(e);
|
|
257
|
+
return m({
|
|
281
258
|
name: e.name,
|
|
282
|
-
type:
|
|
259
|
+
type: ne(e),
|
|
283
260
|
visible: e.visible,
|
|
284
|
-
position:
|
|
285
|
-
rotation:
|
|
286
|
-
scale:
|
|
261
|
+
position: E(e.position),
|
|
262
|
+
rotation: E(e.rotation),
|
|
263
|
+
scale: E(e.scale),
|
|
287
264
|
components: me(e),
|
|
288
265
|
...t ? { authoring: t } : {},
|
|
289
|
-
children: e.children.filter((
|
|
290
|
-
var
|
|
291
|
-
return ((
|
|
292
|
-
}).map((
|
|
266
|
+
children: e.children.filter((n) => {
|
|
267
|
+
var r;
|
|
268
|
+
return ((r = n.userData) == null ? void 0 : r.excludeFromExport) !== !0;
|
|
269
|
+
}).map((n) => te(n))
|
|
293
270
|
});
|
|
294
271
|
}
|
|
295
272
|
function me(e) {
|
|
296
|
-
var
|
|
273
|
+
var r;
|
|
297
274
|
const t = fe.ObjectToComponents.get(e);
|
|
298
275
|
if (t != null && t.length)
|
|
299
|
-
return t.map((
|
|
300
|
-
const
|
|
301
|
-
return
|
|
302
|
-
id:
|
|
303
|
-
type:
|
|
304
|
-
state: Object.fromEntries(a.map((
|
|
276
|
+
return t.map((i) => {
|
|
277
|
+
const s = i.constructor, a = (s.StateProperties || []).map((o) => typeof o == "string" ? o : o.name || o.key).filter((o) => !!o);
|
|
278
|
+
return m({
|
|
279
|
+
id: i.uuid,
|
|
280
|
+
type: s.ComponentType || i.constructor.name,
|
|
281
|
+
state: Object.fromEntries(a.map((o) => [o, S(i[o])]))
|
|
305
282
|
});
|
|
306
|
-
}).sort(
|
|
307
|
-
const
|
|
308
|
-
return
|
|
309
|
-
const a =
|
|
310
|
-
return
|
|
311
|
-
}).sort(
|
|
312
|
-
}
|
|
313
|
-
function
|
|
314
|
-
if (typeof e == "string") return
|
|
315
|
-
if (e instanceof Uint8Array) return
|
|
316
|
-
if (
|
|
317
|
-
if (
|
|
318
|
-
if (
|
|
319
|
-
if (
|
|
283
|
+
}).sort(F);
|
|
284
|
+
const n = (r = e.userData) == null ? void 0 : r.EntityComponentPlugin;
|
|
285
|
+
return f(n) ? Object.entries(n).map(([i, s]) => {
|
|
286
|
+
const a = f(s) ? s : {};
|
|
287
|
+
return m({ id: i, type: a.type, state: S(a.state) });
|
|
288
|
+
}).sort(F) : [];
|
|
289
|
+
}
|
|
290
|
+
function I(e) {
|
|
291
|
+
if (typeof e == "string") return I(JSON.parse(e));
|
|
292
|
+
if (e instanceof Uint8Array) return I(JSON.parse(new TextDecoder().decode(e)));
|
|
293
|
+
if (f(e) && f(e.document)) return q(e.document);
|
|
294
|
+
if (f(e) && e.schemaVersion === 1 && Array.isArray(e.scene)) return e;
|
|
295
|
+
if (f(e) && f(e.asset)) return q(e);
|
|
296
|
+
if (f(e) && "scene" in e || f(e) && "modelRoot" in e) return J(e);
|
|
320
297
|
throw new Error("Persistence comparison requires a semantic snapshot, viewer, scene, or serialized glTF document");
|
|
321
298
|
}
|
|
322
|
-
function
|
|
323
|
-
const t = Array.isArray(e.nodes) ? e.nodes : [],
|
|
324
|
-
const u = typeof
|
|
325
|
-
const
|
|
326
|
-
return
|
|
327
|
-
}).sort(
|
|
328
|
-
return
|
|
299
|
+
function q(e) {
|
|
300
|
+
const t = Array.isArray(e.nodes) ? e.nodes : [], n = Array.isArray(e.scenes) ? e.scenes : [], r = typeof e.scene == "number" ? e.scene : 0, i = f(n[r]) ? n[r] : {}, s = Array.isArray(i.nodes) ? i.nodes : [], a = (o) => {
|
|
301
|
+
const u = typeof o == "number" && f(t[o]) ? t[o] : {}, c = f(u.extras) ? u.extras : {}, R = f(c[v]) ? c[v] : void 0, C = f(c.EntityComponentPlugin) ? c.EntityComponentPlugin : {}, w = Object.entries(C).map(([d, l]) => {
|
|
302
|
+
const N = f(l) ? l : {};
|
|
303
|
+
return m({ id: d, type: N.type, state: S(N.state) });
|
|
304
|
+
}).sort(F), p = _(u.translation, [0, 0, 0]), A = _(u.rotation, [0, 0, 0, 1]), y = _(u.scale, [1, 1, 1]);
|
|
305
|
+
return m({
|
|
329
306
|
name: typeof u.name == "string" ? u.name : "",
|
|
330
307
|
type: typeof u.mesh == "number" ? "Mesh" : typeof u.camera == "number" ? "Camera" : "Group",
|
|
331
|
-
visible:
|
|
332
|
-
position: { x:
|
|
333
|
-
quaternion: { x:
|
|
308
|
+
visible: c.visible !== !1,
|
|
309
|
+
position: { x: p[0], y: p[1], z: p[2] },
|
|
310
|
+
quaternion: { x: A[0], y: A[1], z: A[2], w: A[3] },
|
|
334
311
|
scale: { x: y[0], y: y[1], z: y[2] },
|
|
335
|
-
components:
|
|
336
|
-
...
|
|
312
|
+
components: w,
|
|
313
|
+
...R ? { authoring: S(R) } : {},
|
|
337
314
|
children: (Array.isArray(u.children) ? u.children : []).map(a)
|
|
338
315
|
});
|
|
339
316
|
};
|
|
340
|
-
return { schemaVersion: 1, scene:
|
|
317
|
+
return { schemaVersion: 1, scene: s.map(a) };
|
|
341
318
|
}
|
|
342
|
-
function
|
|
343
|
-
if (
|
|
319
|
+
function z(e, t, n, r) {
|
|
320
|
+
if (r.length >= 50 || Object.is(e, t) || e === t) return;
|
|
344
321
|
if (!e || !t || typeof e != "object" || typeof t != "object" || Array.isArray(e) !== Array.isArray(t)) {
|
|
345
|
-
|
|
322
|
+
r.push({ path: n || "/", before: e, after: t });
|
|
346
323
|
return;
|
|
347
324
|
}
|
|
348
325
|
if (Array.isArray(e) && Array.isArray(t)) {
|
|
349
|
-
const
|
|
350
|
-
for (let u = 0; u <
|
|
351
|
-
const
|
|
352
|
-
|
|
326
|
+
const o = Math.max(e.length, t.length);
|
|
327
|
+
for (let u = 0; u < o; u += 1) {
|
|
328
|
+
const c = K(e[u]) || K(t[u]);
|
|
329
|
+
z(e[u], t[u], `${n}/${Y(c || String(u))}`, r);
|
|
353
330
|
}
|
|
354
331
|
return;
|
|
355
332
|
}
|
|
356
|
-
const
|
|
357
|
-
for (const
|
|
333
|
+
const i = e, s = t, a = [.../* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(s)])].sort();
|
|
334
|
+
for (const o of a) z(i[o], s[o], `${n}/${Y(o)}`, r);
|
|
358
335
|
}
|
|
359
|
-
function
|
|
360
|
-
if (!(!
|
|
336
|
+
function K(e) {
|
|
337
|
+
if (!(!f(e) || typeof e.name != "string"))
|
|
361
338
|
return e.name || void 0;
|
|
362
339
|
}
|
|
363
|
-
function
|
|
364
|
-
var
|
|
365
|
-
if (typeof e == "number") return
|
|
340
|
+
function S(e, t = /* @__PURE__ */ new WeakSet(), n = 0) {
|
|
341
|
+
var s;
|
|
342
|
+
if (typeof e == "number") return O(e);
|
|
366
343
|
if (e === null || typeof e == "string" || typeof e == "boolean") return e;
|
|
367
344
|
if (e === void 0 || typeof e == "function") return;
|
|
368
|
-
if (Array.isArray(e)) return e.map((a) =>
|
|
369
|
-
if (typeof e != "object" ||
|
|
345
|
+
if (Array.isArray(e)) return e.map((a) => S(a, t, n + 1));
|
|
346
|
+
if (typeof e != "object" || n > 5) return String(e);
|
|
370
347
|
if (t.has(e)) return "[Circular]";
|
|
371
348
|
t.add(e);
|
|
372
|
-
const
|
|
373
|
-
if (
|
|
374
|
-
if (
|
|
375
|
-
return
|
|
376
|
-
const
|
|
377
|
-
for (const a of Object.keys(
|
|
349
|
+
const r = e;
|
|
350
|
+
if (r.isColor && r.getHexString) return `#${r.getHexString()}`;
|
|
351
|
+
if (r.toArray && /Vector|Euler|Quaternion/.test(((s = e.constructor) == null ? void 0 : s.name) || ""))
|
|
352
|
+
return r.toArray().map((a) => S(a, t, n + 1));
|
|
353
|
+
const i = {};
|
|
354
|
+
for (const a of Object.keys(r).sort()) {
|
|
378
355
|
if (a.startsWith("_") || ["id", "uuid", "uiConfig", "object", "ctx", "body", "world"].includes(a)) continue;
|
|
379
|
-
const
|
|
380
|
-
|
|
356
|
+
const o = S(r[a], t, n + 1);
|
|
357
|
+
o !== void 0 && (i[a] = o);
|
|
381
358
|
}
|
|
382
|
-
return
|
|
359
|
+
return i;
|
|
383
360
|
}
|
|
384
|
-
function
|
|
385
|
-
return typeof e == "number" ?
|
|
386
|
-
const
|
|
387
|
-
return
|
|
361
|
+
function m(e) {
|
|
362
|
+
return typeof e == "number" ? O(e) : Array.isArray(e) ? e.map(m) : f(e) ? Object.fromEntries(Object.keys(e).sort().flatMap((t) => {
|
|
363
|
+
const n = m(e[t]);
|
|
364
|
+
return n === void 0 ? [] : [[t, n]];
|
|
388
365
|
})) : e;
|
|
389
366
|
}
|
|
390
|
-
function
|
|
391
|
-
return { x:
|
|
367
|
+
function E(e) {
|
|
368
|
+
return { x: O(e.x), y: O(e.y), z: O(e.z) };
|
|
392
369
|
}
|
|
393
|
-
function
|
|
370
|
+
function O(e) {
|
|
394
371
|
if (!Number.isFinite(e)) return null;
|
|
395
372
|
const t = Math.round(e * 1e6) / 1e6;
|
|
396
373
|
return Object.is(t, -0) ? 0 : t;
|
|
397
374
|
}
|
|
398
|
-
function
|
|
399
|
-
return !Array.isArray(e) || e.some((
|
|
375
|
+
function _(e, t) {
|
|
376
|
+
return !Array.isArray(e) || e.some((n) => typeof n != "number") ? t : e.map((n) => O(n) ?? 0);
|
|
400
377
|
}
|
|
401
378
|
function pe(e) {
|
|
402
|
-
const t = typeof structuredClone == "function" ? structuredClone(e) : JSON.parse(JSON.stringify(e)),
|
|
403
|
-
if (!(!
|
|
404
|
-
for (const
|
|
405
|
-
Object.freeze(
|
|
379
|
+
const t = typeof structuredClone == "function" ? structuredClone(e) : JSON.parse(JSON.stringify(e)), n = (r) => {
|
|
380
|
+
if (!(!r || typeof r != "object" || Object.isFrozen(r))) {
|
|
381
|
+
for (const i of Object.values(r)) n(i);
|
|
382
|
+
Object.freeze(r);
|
|
406
383
|
}
|
|
407
384
|
};
|
|
408
|
-
return
|
|
385
|
+
return n(t), t;
|
|
409
386
|
}
|
|
410
|
-
function
|
|
411
|
-
e.some((
|
|
412
|
-
var
|
|
413
|
-
return
|
|
387
|
+
function M(e, t) {
|
|
388
|
+
e.some((n) => {
|
|
389
|
+
var r, i;
|
|
390
|
+
return n.code === t.code && ((r = n.object) == null ? void 0 : r.uuid) === ((i = t.object) == null ? void 0 : i.uuid) && n.path === t.path;
|
|
414
391
|
}) || e.push(t);
|
|
415
392
|
}
|
|
416
|
-
function
|
|
393
|
+
function k(e) {
|
|
417
394
|
return { uuid: e.uuid, name: e.name || "(unnamed)" };
|
|
418
395
|
}
|
|
419
|
-
function
|
|
396
|
+
function $(e) {
|
|
420
397
|
const t = e;
|
|
421
398
|
return !!(t.isMesh || t.isLine || t.isPoints || t.isSprite);
|
|
422
399
|
}
|
|
@@ -425,64 +402,64 @@ function ye(e) {
|
|
|
425
402
|
return ((t = e.userData) == null ? void 0 : t.selectable) !== !1 && !e.isWidget;
|
|
426
403
|
}
|
|
427
404
|
function he(e, t) {
|
|
428
|
-
for (let
|
|
429
|
-
if (!
|
|
430
|
-
if (
|
|
405
|
+
for (let n = e; n; n = n.parent) {
|
|
406
|
+
if (!n.visible) return !1;
|
|
407
|
+
if (n === t) return !0;
|
|
431
408
|
}
|
|
432
409
|
return !1;
|
|
433
410
|
}
|
|
434
411
|
function ge(e, t) {
|
|
435
|
-
for (let
|
|
436
|
-
if (
|
|
412
|
+
for (let n = e; n; n = n.parent)
|
|
413
|
+
if (n === t) return !0;
|
|
437
414
|
return !1;
|
|
438
415
|
}
|
|
439
416
|
function be(e, t) {
|
|
440
417
|
if (e === t.mainCamera || e === t.defaultCamera) return !0;
|
|
441
|
-
for (let
|
|
442
|
-
if (
|
|
418
|
+
for (let n = e; n; n = n.parent)
|
|
419
|
+
if (n.isWidget) return !0;
|
|
443
420
|
return !1;
|
|
444
421
|
}
|
|
445
|
-
function
|
|
422
|
+
function Ae(e) {
|
|
446
423
|
for (let t = e; t; t = t.parent)
|
|
447
|
-
if (
|
|
424
|
+
if (U(t)) return t;
|
|
448
425
|
}
|
|
449
|
-
function
|
|
450
|
-
for (let
|
|
451
|
-
if (t.has(
|
|
426
|
+
function Q(e, t) {
|
|
427
|
+
for (let n = e.parent; n; n = n.parent)
|
|
428
|
+
if (t.has(n)) return !0;
|
|
452
429
|
return !1;
|
|
453
430
|
}
|
|
454
431
|
function we(e) {
|
|
455
432
|
var t;
|
|
456
|
-
for (let
|
|
457
|
-
if ((t =
|
|
433
|
+
for (let n = e; n; n = n.parent)
|
|
434
|
+
if ((t = G(n)) != null && t.allowCameraInside) return !0;
|
|
458
435
|
return !1;
|
|
459
436
|
}
|
|
460
|
-
function
|
|
437
|
+
function B(e) {
|
|
461
438
|
return Number.isFinite(e.x) && Number.isFinite(e.y) && Number.isFinite(e.z);
|
|
462
439
|
}
|
|
463
|
-
function
|
|
440
|
+
function ne(e) {
|
|
464
441
|
const t = e;
|
|
465
442
|
return t.isMesh ? "Mesh" : t.isCamera ? "Camera" : t.isLight ? "Light" : e.children.length ? "Group" : e.type;
|
|
466
443
|
}
|
|
467
|
-
function
|
|
444
|
+
function F(e, t) {
|
|
468
445
|
return JSON.stringify(e).localeCompare(JSON.stringify(t));
|
|
469
446
|
}
|
|
470
|
-
function
|
|
447
|
+
function Y(e) {
|
|
471
448
|
return e.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
472
449
|
}
|
|
473
|
-
function
|
|
450
|
+
function Re(e) {
|
|
474
451
|
return e instanceof Error ? e.message : String(e);
|
|
475
452
|
}
|
|
476
|
-
function
|
|
453
|
+
function f(e) {
|
|
477
454
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
478
455
|
}
|
|
479
456
|
export {
|
|
480
|
-
|
|
481
|
-
|
|
457
|
+
xe as authoringQualityReport,
|
|
458
|
+
Ie as installGameHooks,
|
|
482
459
|
Oe as persistenceReport,
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
460
|
+
Te as publishGameTelemetry,
|
|
461
|
+
Ne as registerGameValidation,
|
|
462
|
+
Ee as runtimeCleanupReport,
|
|
463
|
+
J as semanticSceneSnapshot
|
|
487
464
|
};
|
|
488
465
|
//# sourceMappingURL=authoringValidation.js.map
|