@kite3d/engine 0.16.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/dist/index.js +194 -204
- package/dist/index.js.map +1 -1
- package/dist/projectFormat.js +69 -53
- package/dist/projectFormat.js.map +1 -1
- package/dist/runtime/projectFormat.d.ts +2 -0
- package/dist/runtime.js +28 -23
- package/dist/runtime.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/runtime/createGame.ts +2 -18
- package/src/runtime/projectFormat.ts +25 -0
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { EntityComponentPlugin as L, Object3DComponent as oa, Vector3 as F, literalStrings as
|
|
1
|
+
import * as ve from "threepipe";
|
|
2
|
+
import { EntityComponentPlugin as L, Object3DComponent as oa, Vector3 as F, literalStrings as Ca, Quaternion as C, BufferAttribute as ie, BufferGeometry as ia, Box3 as se, ConvexHull as xe, Mesh as xa, MathUtils as Pe, SphereGeometry as Ia, BoxGeometry as Fa, PlaneGeometry as Va, LineMaterial2 as Ae, Wireframe as Y, WireframeGeometry3 as X, CylinderGeometry as De, Float32BufferAttribute as Da, Object3DWidgetsPlugin as ce, AHelperWidget as Me, Group as Ie, MeshStandardMaterial as Fe, Object3D as Ee, uiFolderContainer as Sa, generateUUID as Ne, AViewerPluginSync as Ce, Matrix4 as Ya, FrameFadePlugin as Se, uiInput as Be, uiMonitor as Le, uiNumber as ne, ThreeSerialization as Ba, TypeSystem as ze, serialize as oe, uiToggle as de, uiConfig as re, copyObject3DUserData as Re, getPartialProps as Ue, setPartialProps as Ge, ThreeViewer as _e, GBufferPlugin as Te, PopmotionPlugin as Oe, GLTFAnimationPlugin as Qe, GLTFMeshOptDecodePlugin as We, KTX2LoadPlugin as qe, KTXLoadPlugin as Ke, PLYLoadPlugin as He, Rhino3dmLoadPlugin as Je, STLLoadPlugin as Ve, USDZLoadPlugin as Ye } from "threepipe";
|
|
3
3
|
export * from "threepipe";
|
|
4
|
-
import { getAuthoringMetadata as ma, setAuthoringMetadata as
|
|
5
|
-
import { KITE3D_AUTHORING_METADATA_KEY as
|
|
6
|
-
import { Vec3 as y, Quaternion as da, Box as K, Cylinder as
|
|
7
|
-
import { installGameHooks as
|
|
8
|
-
import { authoringQualityReport as
|
|
9
|
-
import { parsePackageJSON as
|
|
10
|
-
import { readProjectGeneratorStates as Nb, settingsKey as Cb, updateProjectGeneratorState as Sb, validateSceneSource as Bb } from "./projectFormat.js";
|
|
4
|
+
import { getAuthoringMetadata as ma, setAuthoringMetadata as he } from "./authoring.js";
|
|
5
|
+
import { KITE3D_AUTHORING_METADATA_KEY as ub, KITE3D_RUNTIME_METADATA_KEY as jb, RuntimeObjectOwner as yb, getRuntimeObjectMetadata as kb, getTrackedRuntimeObjects as wb, isRuntimeObject as vb } from "./authoring.js";
|
|
6
|
+
import { Vec3 as y, Quaternion as da, Box as K, Cylinder as Xe, Sphere as le, ConvexPolyhedron as Ze, Trimesh as $e, Body as N, Shape as q, ConeTwistConstraint as Q, Material as La, World as fe, ContactMaterial as pe } from "cannon-es";
|
|
7
|
+
import { installGameHooks as at, runtimeCleanupReport as et } from "./authoringValidation.js";
|
|
8
|
+
import { authoringQualityReport as Pb, persistenceReport as Ab, publishGameTelemetry as Db, registerGameValidation as Mb, semanticSceneSnapshot as Ib } from "./authoringValidation.js";
|
|
9
|
+
import { parsePackageJSON as tt, parsePackageJsonSettingsConfig as bt, parseAssetsJSONManifest as it, createProjectAssetURLModifier as st, isDependencyModuleSpecifier as ge } from "./projectFormat.js";
|
|
10
|
+
import { assetUrlPrefix as Eb, readProjectGeneratorStates as Nb, settingsKey as Cb, updateProjectGeneratorState as Sb, validateSceneSource as Bb } from "./projectFormat.js";
|
|
11
11
|
import { RUNTIME_VERSION as zb } from "./version.js";
|
|
12
12
|
import { PROJECT_MIGRATIONS as Ub } from "./migrations.js";
|
|
13
13
|
import { serializeSceneGltf as _b, serializeSceneGltfDocument as Tb } from "./sceneSerialization.js";
|
|
@@ -511,7 +511,7 @@ ka.ComponentType = "HtmlUiComponent", ka.StateProperties = [
|
|
|
511
511
|
"interactable",
|
|
512
512
|
{
|
|
513
513
|
key: "positionMode",
|
|
514
|
-
type:
|
|
514
|
+
type: Ca(ht)
|
|
515
515
|
},
|
|
516
516
|
"offsetX",
|
|
517
517
|
"offsetY",
|
|
@@ -519,7 +519,7 @@ ka.ComponentType = "HtmlUiComponent", ka.StateProperties = [
|
|
|
519
519
|
"visible",
|
|
520
520
|
"appendToBody"
|
|
521
521
|
];
|
|
522
|
-
let
|
|
522
|
+
let Ea = ka;
|
|
523
523
|
const ga = /* @__PURE__ */ new WeakMap();
|
|
524
524
|
let lt = 0;
|
|
525
525
|
const wa = class wa extends oa {
|
|
@@ -571,14 +571,14 @@ const wa = class wa extends oa {
|
|
|
571
571
|
for (const n of e) pt(n);
|
|
572
572
|
this.ctx.ecp.removeComponent(a, this.uuid);
|
|
573
573
|
const s = ma(a);
|
|
574
|
-
return (s == null ? void 0 : s.role) === "generator" && !s.sourceId &&
|
|
574
|
+
return (s == null ? void 0 : s.role) === "generator" && !s.sourceId && he(a, {
|
|
575
575
|
role: "direct",
|
|
576
576
|
id: s.id,
|
|
577
577
|
...s.allowCameraInside !== void 0 ? { allowCameraInside: s.allowCameraInside } : {}
|
|
578
578
|
}), a.userData.kite3dBakedFrom = b, a._sChildren = [...a.children], (i = a.setDirty) == null || i.call(a, { change: "userData.kite3dBakedFrom", source: "kite3d bake" }), e.length;
|
|
579
579
|
}
|
|
580
580
|
destroy() {
|
|
581
|
-
return this.runRevision += 1,
|
|
581
|
+
return this.runRevision += 1, me(this.object), super.destroy();
|
|
582
582
|
}
|
|
583
583
|
};
|
|
584
584
|
wa.ComponentType = "Generator", wa.StateProperties = ["module", "params"];
|
|
@@ -592,7 +592,7 @@ async function ft({
|
|
|
592
592
|
revision: i = 0,
|
|
593
593
|
isCurrent: n
|
|
594
594
|
}) {
|
|
595
|
-
if (
|
|
595
|
+
if (me(t), !b) return [];
|
|
596
596
|
const l = gt(t), p = ut(b, s);
|
|
597
597
|
i && p.searchParams.set("kite3d-generator", String(i));
|
|
598
598
|
const j = await yt(p.href);
|
|
@@ -602,22 +602,22 @@ async function ft({
|
|
|
602
602
|
node: t,
|
|
603
603
|
params: a,
|
|
604
604
|
viewer: e,
|
|
605
|
-
engine:
|
|
605
|
+
engine: ve
|
|
606
606
|
}), M = jt(k);
|
|
607
607
|
for (const [o, c] of M.entries())
|
|
608
|
-
c.parent !== t && (
|
|
608
|
+
c.parent !== t && (Xa(c, l.id, o), t.add(c));
|
|
609
609
|
const m = t.children.filter((o) => !P.has(o));
|
|
610
610
|
if (n && !n()) {
|
|
611
|
-
for (const o of m)
|
|
611
|
+
for (const o of m) ue(o);
|
|
612
612
|
return [];
|
|
613
613
|
}
|
|
614
|
-
return m.forEach((o, c) =>
|
|
614
|
+
return m.forEach((o, c) => Xa(o, l.id, c)), m;
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function me(t) {
|
|
617
617
|
for (const a of [...t.children])
|
|
618
|
-
a.userData.kite3dGenerated === !0 &&
|
|
618
|
+
a.userData.kite3dGenerated === !0 && ue(a);
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function Xa(t, a, e = 0) {
|
|
621
621
|
let b = 0;
|
|
622
622
|
t.traverse((s) => {
|
|
623
623
|
s.userData.kite3dGenerated = !0, s.userData.excludeFromExport = !0, a && (s.userData.kite3dAuthoring = {
|
|
@@ -638,7 +638,7 @@ function gt(t) {
|
|
|
638
638
|
const a = ma(t);
|
|
639
639
|
if ((a == null ? void 0 : a.role) === "generator" && !a.sourceId) return a;
|
|
640
640
|
const e = typeof t.userData.gltfUUID == "string" && t.userData.gltfUUID.trim() ? t.userData.gltfUUID.trim() : (a == null ? void 0 : a.id) || mt(t);
|
|
641
|
-
return
|
|
641
|
+
return he(t, { role: "generator", id: e }), ma(t);
|
|
642
642
|
}
|
|
643
643
|
function mt(t) {
|
|
644
644
|
var e;
|
|
@@ -649,22 +649,22 @@ function mt(t) {
|
|
|
649
649
|
}
|
|
650
650
|
return `generator:${a.reverse().join("/")}`;
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function ue(t) {
|
|
653
653
|
t.removeFromParent();
|
|
654
654
|
const a = /* @__PURE__ */ new Set();
|
|
655
655
|
t.traverse((e) => {
|
|
656
656
|
const b = e;
|
|
657
|
-
|
|
657
|
+
Ma(b.geometry, a);
|
|
658
658
|
const s = Array.isArray(b.material) ? b.material : [b.material];
|
|
659
659
|
for (const i of s)
|
|
660
660
|
if (!(!i || typeof i != "object")) {
|
|
661
661
|
for (const n of Object.values(i))
|
|
662
|
-
n && typeof n == "object" && "isTexture" in n &&
|
|
663
|
-
|
|
662
|
+
n && typeof n == "object" && "isTexture" in n && Ma(n, a);
|
|
663
|
+
Ma(i, a);
|
|
664
664
|
}
|
|
665
665
|
});
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function Ma(t, a) {
|
|
668
668
|
var e;
|
|
669
669
|
!t || typeof t != "object" || a.has(t) || (a.add(t), (e = t.dispose) == null || e.call(t));
|
|
670
670
|
}
|
|
@@ -702,14 +702,14 @@ function ua(t) {
|
|
|
702
702
|
const a = Pt(t);
|
|
703
703
|
if (a.length === 0) return null;
|
|
704
704
|
if (a.length === 1)
|
|
705
|
-
return
|
|
705
|
+
return Za(a[0]);
|
|
706
706
|
let e;
|
|
707
707
|
const b = [];
|
|
708
708
|
for (; e = a.pop(); )
|
|
709
|
-
b.push(At(
|
|
709
|
+
b.push(At(Za(e)));
|
|
710
710
|
return xt(b);
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function Za(t) {
|
|
713
713
|
const a = t.geometry.clone();
|
|
714
714
|
return t.updateMatrixWorld(), t.matrixWorld.decompose(wt, vt, fa), a.scale(fa.x, fa.y, fa.z), a;
|
|
715
715
|
}
|
|
@@ -727,9 +727,9 @@ function xt(t) {
|
|
|
727
727
|
for (let n = 0; n < i.count; n++)
|
|
728
728
|
e[b++] = i.getX(n), e[b++] = i.getY(n), e[b++] = i.getZ(n);
|
|
729
729
|
}
|
|
730
|
-
return new ia().setAttribute("position", new
|
|
730
|
+
return new ia().setAttribute("position", new ie(e, 3));
|
|
731
731
|
}
|
|
732
|
-
function
|
|
732
|
+
function je(t) {
|
|
733
733
|
const a = t.attributes.position, e = new Float32Array(a.count * 3);
|
|
734
734
|
for (let b = 0; b < a.count; b++)
|
|
735
735
|
e[b * 3] = a.getX(b), e[b * 3 + 1] = a.getY(b), e[b * 3 + 2] = a.getZ(b);
|
|
@@ -762,19 +762,19 @@ function At(t, a = 1e-4) {
|
|
|
762
762
|
let c = "";
|
|
763
763
|
c += `${~~(s.getX(o) * P)},`, c += `${~~(s.getY(o) * P)},`, c += `${~~(s.getZ(o) * P)},`, c in e ? l.push(e[c]) : (p.push(s.getX(o)), p.push(s.getY(o)), p.push(s.getZ(o)), e[c] = n, l.push(n), n++);
|
|
764
764
|
}
|
|
765
|
-
const k = new
|
|
765
|
+
const k = new ie(
|
|
766
766
|
new Float32Array(p),
|
|
767
767
|
s.itemSize,
|
|
768
768
|
s.normalized
|
|
769
769
|
), M = new ia();
|
|
770
770
|
return M.setAttribute("position", k), M.setIndex(l), M;
|
|
771
771
|
}
|
|
772
|
-
const
|
|
772
|
+
const $a = Math.PI / 2;
|
|
773
773
|
var _ = /* @__PURE__ */ ((t) => (t.BOX = "Box", t.CYLINDER = "Cylinder", t.SPHERE = "Sphere", t.HULL = "ConvexPolyhedron", t.MESH = "Trimesh", t))(_ || {});
|
|
774
|
-
const
|
|
774
|
+
const ye = function(t, a = {}) {
|
|
775
775
|
let e;
|
|
776
776
|
if (a.type === "Box")
|
|
777
|
-
return
|
|
777
|
+
return ee(t);
|
|
778
778
|
if (a.type === "Cylinder")
|
|
779
779
|
return Bt(t, a);
|
|
780
780
|
if (a.type === "Sphere")
|
|
@@ -789,7 +789,7 @@ const ke = function(t, a = {}) {
|
|
|
789
789
|
switch (e.type) {
|
|
790
790
|
case "BoxGeometry":
|
|
791
791
|
case "BoxBufferGeometry":
|
|
792
|
-
return
|
|
792
|
+
return ae(e);
|
|
793
793
|
case "CylinderGeometry":
|
|
794
794
|
case "CylinderBufferGeometry":
|
|
795
795
|
return St(e);
|
|
@@ -801,15 +801,15 @@ const ke = function(t, a = {}) {
|
|
|
801
801
|
return zt(e);
|
|
802
802
|
case "TubeGeometry":
|
|
803
803
|
case "BufferGeometry":
|
|
804
|
-
return
|
|
804
|
+
return ee(t);
|
|
805
805
|
default:
|
|
806
806
|
return console.warn(
|
|
807
807
|
'Unrecognized geometry: "%s". Using bounding box as shape.',
|
|
808
808
|
e.type
|
|
809
|
-
),
|
|
809
|
+
), ae(e);
|
|
810
810
|
}
|
|
811
811
|
}, Dt = function(t, a = {}, e) {
|
|
812
|
-
if (e = e ||
|
|
812
|
+
if (e = e || ye(t, a), !e)
|
|
813
813
|
return null;
|
|
814
814
|
const { type: b, params: s, offset: i, orientation: n } = e;
|
|
815
815
|
let l;
|
|
@@ -824,11 +824,11 @@ function Mt(t) {
|
|
|
824
824
|
return new K(new y(a || 0.025, e || 0.025, b || 0.025));
|
|
825
825
|
}
|
|
826
826
|
function It(t) {
|
|
827
|
-
const { radiusTop: a, radiusBottom: e, height: b, segments: s } = t, i = new
|
|
827
|
+
const { radiusTop: a, radiusBottom: e, height: b, segments: s } = t, i = new Xe(a, e, b, s);
|
|
828
828
|
return i.radiusTop = e, i.radiusBottom = e, i.height = b, i.numSegments = s, i;
|
|
829
829
|
}
|
|
830
830
|
function Ft(t) {
|
|
831
|
-
return new
|
|
831
|
+
return new le(t.radius);
|
|
832
832
|
}
|
|
833
833
|
function Et(t) {
|
|
834
834
|
const { faces: a, vertices: e } = t, b = [];
|
|
@@ -838,20 +838,20 @@ function Et(t) {
|
|
|
838
838
|
e[i + 1],
|
|
839
839
|
e[i + 2]
|
|
840
840
|
));
|
|
841
|
-
return new
|
|
841
|
+
return new Ze({
|
|
842
842
|
faces: a,
|
|
843
843
|
vertices: b
|
|
844
844
|
});
|
|
845
845
|
}
|
|
846
846
|
function Nt(t) {
|
|
847
847
|
const { vertices: a, indices: e } = t;
|
|
848
|
-
return new
|
|
848
|
+
return new $e(
|
|
849
849
|
a,
|
|
850
850
|
e
|
|
851
851
|
);
|
|
852
852
|
}
|
|
853
|
-
function
|
|
854
|
-
if (!
|
|
853
|
+
function ae(t) {
|
|
854
|
+
if (!je(t).length) return null;
|
|
855
855
|
t.computeBoundingBox();
|
|
856
856
|
const e = t.boundingBox;
|
|
857
857
|
return {
|
|
@@ -863,10 +863,10 @@ function ee(t) {
|
|
|
863
863
|
}
|
|
864
864
|
};
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function ee(t) {
|
|
867
867
|
const a = t.clone();
|
|
868
868
|
a.quaternion.set(0, 0, 0, 1), a.updateMatrixWorld();
|
|
869
|
-
const e = new
|
|
869
|
+
const e = new se().setFromObject(a);
|
|
870
870
|
if (!isFinite(e.min.lengthSq())) return null;
|
|
871
871
|
const b = e.translate(a.position.negate()).getCenter(new F());
|
|
872
872
|
return {
|
|
@@ -890,7 +890,7 @@ function Ct(t) {
|
|
|
890
890
|
a.attributes.position.getY(i) + (Math.random() - 0.5) * e,
|
|
891
891
|
a.attributes.position.getZ(i) + (Math.random() - 0.5) * e
|
|
892
892
|
);
|
|
893
|
-
const [b, s] = Gt(new
|
|
893
|
+
const [b, s] = Gt(new xe().setFromObject(new xa(a)));
|
|
894
894
|
return {
|
|
895
895
|
type: "ConvexPolyhedron",
|
|
896
896
|
params: {
|
|
@@ -909,16 +909,16 @@ function St(t) {
|
|
|
909
909
|
height: a.height,
|
|
910
910
|
segments: a.radialSegments
|
|
911
911
|
},
|
|
912
|
-
orientation: new da().setFromEuler(
|
|
912
|
+
orientation: new da().setFromEuler(Pe.degToRad(-90), 0, 0, "XYZ").normalize()
|
|
913
913
|
};
|
|
914
914
|
}
|
|
915
915
|
function Bt(t, a) {
|
|
916
|
-
const e = ["x", "y", "z"], b = a.cylinderAxis || "y", s = e.splice(e.indexOf(b), 1) && e, i = new
|
|
916
|
+
const e = ["x", "y", "z"], b = a.cylinderAxis || "y", s = e.splice(e.indexOf(b), 1) && e, i = new se().setFromObject(t);
|
|
917
917
|
if (!isFinite(i.min.lengthSq())) return null;
|
|
918
918
|
const n = i.max[b] - i.min[b], l = 0.5 * Math.max(
|
|
919
919
|
pa(i.max, s[0]) - pa(i.min, s[0]),
|
|
920
920
|
pa(i.max, s[1]) - pa(i.min, s[1])
|
|
921
|
-
), p = b === "y" ?
|
|
921
|
+
), p = b === "y" ? $a : 0, j = b === "z" ? $a : 0;
|
|
922
922
|
return {
|
|
923
923
|
type: "Cylinder",
|
|
924
924
|
params: {
|
|
@@ -972,7 +972,7 @@ function Rt(t, a) {
|
|
|
972
972
|
};
|
|
973
973
|
}
|
|
974
974
|
function Ut(t) {
|
|
975
|
-
const a =
|
|
975
|
+
const a = je(t);
|
|
976
976
|
if (!a.length) return null;
|
|
977
977
|
const e = new Uint32Array(a.length);
|
|
978
978
|
for (let b = 0; b < a.length; b++)
|
|
@@ -1115,13 +1115,13 @@ const _t = ["static", "dynamic", "kinematic"], va = class va extends oa {
|
|
|
1115
1115
|
};
|
|
1116
1116
|
va.ComponentType = "Cannon3DBodyComponent", va.StateProperties = ["mass", {
|
|
1117
1117
|
key: "type",
|
|
1118
|
-
type:
|
|
1118
|
+
type: Ca(_t)
|
|
1119
1119
|
}, "isTrigger", "material"];
|
|
1120
1120
|
let ja = va;
|
|
1121
1121
|
function Tt() {
|
|
1122
1122
|
const a = new y(), e = new y(), b = new y();
|
|
1123
1123
|
new da();
|
|
1124
|
-
const s = new
|
|
1124
|
+
const s = new Ia(1), i = new Fa(1, 1, 1), n = new Va(10, 10, 10, 10), l = new Ae({
|
|
1125
1125
|
color: 65280,
|
|
1126
1126
|
linewidth: 3,
|
|
1127
1127
|
// in world units with size attenuation, pixels otherwise
|
|
@@ -1185,7 +1185,7 @@ function Tt() {
|
|
|
1185
1185
|
break;
|
|
1186
1186
|
}
|
|
1187
1187
|
case g: {
|
|
1188
|
-
const A = new
|
|
1188
|
+
const A = new De(
|
|
1189
1189
|
c.radiusTop,
|
|
1190
1190
|
c.radiusBottom,
|
|
1191
1191
|
c.height,
|
|
@@ -1247,7 +1247,7 @@ function Tt() {
|
|
|
1247
1247
|
function m(c, d) {
|
|
1248
1248
|
if (!c) return !1;
|
|
1249
1249
|
const { geometry: r } = c;
|
|
1250
|
-
return r instanceof
|
|
1250
|
+
return r instanceof Ia && d.type === q.types.SPHERE || r instanceof Fa && d.type === q.types.BOX || r instanceof Va && d.type === q.types.PLANE || // geometry.id === (shape as ComplexShape).geometryId && shape.type === Shape.types.BOX ||
|
|
1251
1251
|
// geometry.id === (shape as ComplexShape).geometryId && shape.type === Shape.types.SPHERE ||
|
|
1252
1252
|
// geometry.id === (shape as ComplexShape).geometryId && shape.type === Shape.types.PLANE ||
|
|
1253
1253
|
r.id === d.geometryId && d.type === q.types.CONVEXPOLYHEDRON || r.id === d.geometryId && d.type === q.types.TRIMESH || r.id === d.geometryId && d.type === q.types.HEIGHTFIELD;
|
|
@@ -1265,7 +1265,7 @@ function Tt() {
|
|
|
1265
1265
|
updateMesh: o
|
|
1266
1266
|
};
|
|
1267
1267
|
}
|
|
1268
|
-
const Ot = Tt(),
|
|
1268
|
+
const Ot = Tt(), Na = {
|
|
1269
1269
|
autoBox: _.BOX,
|
|
1270
1270
|
autoCylinder: _.CYLINDER,
|
|
1271
1271
|
autoSphere: _.SPHERE,
|
|
@@ -1277,7 +1277,7 @@ const Ot = Tt(), Ca = {
|
|
|
1277
1277
|
convex: _.HULL,
|
|
1278
1278
|
trimesh: _.MESH
|
|
1279
1279
|
// plane: ShapeType.PLANE,
|
|
1280
|
-
}, Qt = Object.keys(
|
|
1280
|
+
}, Qt = Object.keys(Na), Wt = {
|
|
1281
1281
|
box: { x: 1, y: 1, z: 1 },
|
|
1282
1282
|
sphere: { radius: 1 },
|
|
1283
1283
|
cylinder: { radiusTop: 1, radiusBottom: 1, height: 1, segments: 8 },
|
|
@@ -1300,7 +1300,7 @@ const Ot = Tt(), Ca = {
|
|
|
1300
1300
|
Object.entries(a).forEach(([b, s]) => {
|
|
1301
1301
|
e[b] = s.slice ? s.slice() : s;
|
|
1302
1302
|
}), this.params = {
|
|
1303
|
-
type:
|
|
1303
|
+
type: Na[this.type],
|
|
1304
1304
|
params: e,
|
|
1305
1305
|
offset: new y(),
|
|
1306
1306
|
orientation: new da()
|
|
@@ -1325,18 +1325,18 @@ const Ot = Tt(), Ca = {
|
|
|
1325
1325
|
const l = this.object.__cannonShapes.indexOf(this.result);
|
|
1326
1326
|
l !== -1 && this.object.__cannonShapes.splice(l, 1);
|
|
1327
1327
|
}
|
|
1328
|
-
const e =
|
|
1329
|
-
b ? this.result = Dt(this.object, void 0, b) : this.result = H.EmptyResult, this.object.__cannonShapes.includes(this.result) || this.object.__cannonShapes.push(this.result), a && this.bodyRef && this.bodyRef.refreshShapes(), (i = (s = this.object).setDirty) == null || i.call(s), (n = this.ctx.plugin(
|
|
1328
|
+
const e = Na[this.type], b = this.params ?? (e ? ye(this.object, { type: e }) : null);
|
|
1329
|
+
b ? this.result = Dt(this.object, void 0, b) : this.result = H.EmptyResult, this.object.__cannonShapes.includes(this.result) || this.object.__cannonShapes.push(this.result), a && this.bodyRef && this.bodyRef.refreshShapes(), (i = (s = this.object).setDirty) == null || i.call(s), (n = this.ctx.plugin(ce)) == null || n.refreshObject(this.object);
|
|
1330
1330
|
}
|
|
1331
1331
|
};
|
|
1332
1332
|
H.ComponentType = "Cannon3DShapeComponent", H.StateProperties = [{
|
|
1333
1333
|
key: "type",
|
|
1334
|
-
type:
|
|
1334
|
+
type: Ca(Qt)
|
|
1335
1335
|
}], H.EmptyResult = { shape: new K(new y(0.025, 0.025, 0.025)) };
|
|
1336
1336
|
let ca = H;
|
|
1337
|
-
class ya extends
|
|
1337
|
+
class ya extends Me {
|
|
1338
1338
|
constructor(a) {
|
|
1339
|
-
super(a, !1), this.autoUpgradeChildren = !1, this._shapes = [], this._meshes = /* @__PURE__ */ new WeakMap(), this._gp = new
|
|
1339
|
+
super(a, !1), this.autoUpgradeChildren = !1, this._shapes = [], this._meshes = /* @__PURE__ */ new WeakMap(), this._gp = new Ie(), this.attach(a), this.add(this._gp), this.visible = !1;
|
|
1340
1340
|
}
|
|
1341
1341
|
update() {
|
|
1342
1342
|
var s;
|
|
@@ -1412,7 +1412,7 @@ let na = class extends oa {
|
|
|
1412
1412
|
}
|
|
1413
1413
|
init(t, a) {
|
|
1414
1414
|
var e;
|
|
1415
|
-
super.init(t, a), this._cannon = this.ctx.plugin(z), this._removeRagdoll(), this._visualMaterial || (this._visualMaterial = new
|
|
1415
|
+
super.init(t, a), this._cannon = this.ctx.plugin(z), this._removeRagdoll(), this._visualMaterial || (this._visualMaterial = new Fe({ color: 8947848 })), this._meshContainer || (this._meshContainer = new Ee(), this._meshContainer.name = `RagdollMeshes_${this.object.uuid}`, (e = this.ctx.viewer) == null || e.scene.add(this._meshContainer)), this._findCharacterMeshes(), this._buildBoneMap(), this.autoCreateOnInit && (this._createRagdoll(), this._deactivateBodies()), this._updateMeshVisibility();
|
|
1416
1416
|
}
|
|
1417
1417
|
destroy() {
|
|
1418
1418
|
var t;
|
|
@@ -1526,7 +1526,7 @@ let na = class extends oa {
|
|
|
1526
1526
|
}
|
|
1527
1527
|
_createRagdoll() {
|
|
1528
1528
|
if (!this._cannon) return;
|
|
1529
|
-
const t = this.scale, a = this.angle, e = this.angleShoulders, b = this.twistAngle, s = 0.5 * t, i = 0.4 * t, n = 0.4 * t, l = 0.2 * t, p = 0.2 * t, j = 0.1 * t, P = 0.25 * t, k = 0.6 * t, M = 0.4 * t, m = 0.5 * t, o = 0.2 * t, c = 0.2 * t, d = 0.5 * t, r = new
|
|
1529
|
+
const t = this.scale, a = this.angle, e = this.angleShoulders, b = this.twistAngle, s = 0.5 * t, i = 0.4 * t, n = 0.4 * t, l = 0.2 * t, p = 0.2 * t, j = 0.1 * t, P = 0.25 * t, k = 0.6 * t, M = 0.4 * t, m = 0.5 * t, o = 0.2 * t, c = 0.2 * t, d = 0.5 * t, r = new le(P), h = new K(
|
|
1530
1530
|
new y(i * 0.5, l * 0.5, l * 0.5)
|
|
1531
1531
|
), f = new K(
|
|
1532
1532
|
new y(n * 0.5, p * 0.5, p * 0.5)
|
|
@@ -1546,20 +1546,20 @@ let na = class extends oa {
|
|
|
1546
1546
|
A.z + ba.z
|
|
1547
1547
|
);
|
|
1548
1548
|
}, I = (O, ba = !1) => {
|
|
1549
|
-
var
|
|
1549
|
+
var Ja;
|
|
1550
1550
|
let Pa;
|
|
1551
1551
|
if (ba)
|
|
1552
|
-
Pa = new
|
|
1552
|
+
Pa = new Ia(P, 16, 16);
|
|
1553
1553
|
else {
|
|
1554
1554
|
const Aa = O.shapes[0];
|
|
1555
|
-
Pa = new
|
|
1555
|
+
Pa = new Fa(
|
|
1556
1556
|
Aa.halfExtents.x * 2,
|
|
1557
1557
|
Aa.halfExtents.y * 2,
|
|
1558
1558
|
Aa.halfExtents.z * 2
|
|
1559
1559
|
);
|
|
1560
1560
|
}
|
|
1561
1561
|
const la = new xa(Pa, this._visualMaterial);
|
|
1562
|
-
return la.position.set(O.position.x, O.position.y, O.position.z), (
|
|
1562
|
+
return la.position.set(O.position.x, O.position.y, O.position.z), (Ja = this._meshContainer) == null || Ja.add(la), this._meshes.push(la), la;
|
|
1563
1563
|
}, E = new N({
|
|
1564
1564
|
mass: this.mass,
|
|
1565
1565
|
position: D(new F(s / 2, d / 2, 0)),
|
|
@@ -1640,7 +1640,7 @@ let na = class extends oa {
|
|
|
1640
1640
|
};
|
|
1641
1641
|
for (const O of this._bodies)
|
|
1642
1642
|
this._cannon.world.addBody(O);
|
|
1643
|
-
const
|
|
1643
|
+
const Ua = new Q($, G, {
|
|
1644
1644
|
pivotA: new y(0, -P - j / 2, 0),
|
|
1645
1645
|
pivotB: new y(0, k / 2, 0),
|
|
1646
1646
|
axisA: y.UNIT_Y,
|
|
@@ -1648,15 +1648,15 @@ let na = class extends oa {
|
|
|
1648
1648
|
angle: a,
|
|
1649
1649
|
twistAngle: b
|
|
1650
1650
|
});
|
|
1651
|
-
this._constraints.push(
|
|
1652
|
-
const
|
|
1651
|
+
this._constraints.push(Ua);
|
|
1652
|
+
const Ga = new Q(E, R, {
|
|
1653
1653
|
pivotA: new y(0, d / 2, 0),
|
|
1654
1654
|
pivotB: new y(0, -m / 2, 0),
|
|
1655
1655
|
axisA: y.UNIT_Y,
|
|
1656
1656
|
axisB: y.UNIT_Y,
|
|
1657
1657
|
angle: a,
|
|
1658
1658
|
twistAngle: b
|
|
1659
|
-
}),
|
|
1659
|
+
}), _a = new Q(S, U, {
|
|
1660
1660
|
pivotA: new y(0, d / 2, 0),
|
|
1661
1661
|
pivotB: new y(0, -m / 2, 0),
|
|
1662
1662
|
axisA: y.UNIT_Y,
|
|
@@ -1664,15 +1664,15 @@ let na = class extends oa {
|
|
|
1664
1664
|
angle: a,
|
|
1665
1665
|
twistAngle: b
|
|
1666
1666
|
});
|
|
1667
|
-
this._constraints.push(
|
|
1668
|
-
const
|
|
1667
|
+
this._constraints.push(Ga, _a);
|
|
1668
|
+
const Ta = new Q(R, B, {
|
|
1669
1669
|
pivotA: new y(0, m / 2, 0),
|
|
1670
1670
|
pivotB: new y(s / 2, -M / 2, 0),
|
|
1671
1671
|
axisA: y.UNIT_Y,
|
|
1672
1672
|
axisB: y.UNIT_Y,
|
|
1673
1673
|
angle: a,
|
|
1674
1674
|
twistAngle: b
|
|
1675
|
-
}),
|
|
1675
|
+
}), Oa = new Q(U, B, {
|
|
1676
1676
|
pivotA: new y(0, m / 2, 0),
|
|
1677
1677
|
pivotB: new y(-s / 2, -M / 2, 0),
|
|
1678
1678
|
axisA: y.UNIT_Y,
|
|
@@ -1680,8 +1680,8 @@ let na = class extends oa {
|
|
|
1680
1680
|
angle: a,
|
|
1681
1681
|
twistAngle: b
|
|
1682
1682
|
});
|
|
1683
|
-
this._constraints.push(
|
|
1684
|
-
const
|
|
1683
|
+
this._constraints.push(Ta, Oa);
|
|
1684
|
+
const Qa = new Q(B, G, {
|
|
1685
1685
|
pivotA: new y(0, M / 2, 0),
|
|
1686
1686
|
pivotB: new y(0, -k / 2, 0),
|
|
1687
1687
|
axisA: y.UNIT_Y,
|
|
@@ -1689,15 +1689,15 @@ let na = class extends oa {
|
|
|
1689
1689
|
angle: a,
|
|
1690
1690
|
twistAngle: b
|
|
1691
1691
|
});
|
|
1692
|
-
this._constraints.push(
|
|
1693
|
-
const
|
|
1692
|
+
this._constraints.push(Qa);
|
|
1693
|
+
const Wa = new Q(G, J, {
|
|
1694
1694
|
pivotA: new y(s / 2, k / 2, 0),
|
|
1695
1695
|
pivotB: new y(-i / 2, 0, 0),
|
|
1696
1696
|
axisA: y.UNIT_Z,
|
|
1697
1697
|
axisB: y.UNIT_Z,
|
|
1698
1698
|
angle: e,
|
|
1699
1699
|
twistAngle: b
|
|
1700
|
-
}),
|
|
1700
|
+
}), qa = new Q(G, V, {
|
|
1701
1701
|
pivotA: new y(-s / 2, k / 2, 0),
|
|
1702
1702
|
pivotB: new y(i / 2, 0, 0),
|
|
1703
1703
|
axisA: y.UNIT_Z,
|
|
@@ -1705,15 +1705,15 @@ let na = class extends oa {
|
|
|
1705
1705
|
angle: e,
|
|
1706
1706
|
twistAngle: b
|
|
1707
1707
|
});
|
|
1708
|
-
this._constraints.push(
|
|
1709
|
-
const
|
|
1708
|
+
this._constraints.push(Wa, qa);
|
|
1709
|
+
const Ka = new Q(aa, J, {
|
|
1710
1710
|
pivotA: new y(-n / 2, 0, 0),
|
|
1711
1711
|
pivotB: new y(i / 2, 0, 0),
|
|
1712
1712
|
axisA: y.UNIT_Z,
|
|
1713
1713
|
axisB: y.UNIT_Z,
|
|
1714
1714
|
angle: a,
|
|
1715
1715
|
twistAngle: b
|
|
1716
|
-
}),
|
|
1716
|
+
}), Ha = new Q(ea, V, {
|
|
1717
1717
|
pivotA: new y(n / 2, 0, 0),
|
|
1718
1718
|
pivotB: new y(-i / 2, 0, 0),
|
|
1719
1719
|
axisA: y.UNIT_Z,
|
|
@@ -1721,17 +1721,17 @@ let na = class extends oa {
|
|
|
1721
1721
|
angle: a,
|
|
1722
1722
|
twistAngle: b
|
|
1723
1723
|
});
|
|
1724
|
-
this._constraints.push(
|
|
1725
|
-
neckJoint:
|
|
1726
|
-
leftKneeJoint:
|
|
1727
|
-
rightKneeJoint:
|
|
1728
|
-
leftHipJoint:
|
|
1729
|
-
rightHipJoint:
|
|
1730
|
-
spineJoint:
|
|
1731
|
-
leftShoulder:
|
|
1732
|
-
rightShoulder:
|
|
1733
|
-
leftElbowJoint:
|
|
1734
|
-
rightElbowJoint:
|
|
1724
|
+
this._constraints.push(Ka, Ha), this._ragdollConstraints = {
|
|
1725
|
+
neckJoint: Ua,
|
|
1726
|
+
leftKneeJoint: Ga,
|
|
1727
|
+
rightKneeJoint: _a,
|
|
1728
|
+
leftHipJoint: Ta,
|
|
1729
|
+
rightHipJoint: Oa,
|
|
1730
|
+
spineJoint: Qa,
|
|
1731
|
+
leftShoulder: Wa,
|
|
1732
|
+
rightShoulder: qa,
|
|
1733
|
+
leftElbowJoint: Ka,
|
|
1734
|
+
rightElbowJoint: Ha
|
|
1735
1735
|
};
|
|
1736
1736
|
for (const O of this._constraints)
|
|
1737
1737
|
this._cannon.world.addConstraint(O);
|
|
@@ -1936,36 +1936,36 @@ na.StateProperties = [
|
|
|
1936
1936
|
"hideRagdollMeshes"
|
|
1937
1937
|
];
|
|
1938
1938
|
na = Kt([
|
|
1939
|
-
|
|
1939
|
+
Sa("Ragdoll")
|
|
1940
1940
|
], na);
|
|
1941
1941
|
var Ht = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, W = (t, a, e, b) => {
|
|
1942
1942
|
for (var s = b > 1 ? void 0 : b ? Jt(a, e) : a, i = t.length - 1, n; i >= 0; i--)
|
|
1943
1943
|
(n = t[i]) && (s = (b ? n(a, e, s) : n(s)) || s);
|
|
1944
1944
|
return b && s && Ht(a, e, s), s;
|
|
1945
1945
|
};
|
|
1946
|
-
let T = class extends
|
|
1946
|
+
let T = class extends La {
|
|
1947
1947
|
constructor() {
|
|
1948
|
-
super(...arguments), this.uuid =
|
|
1948
|
+
super(...arguments), this.uuid = Ne();
|
|
1949
1949
|
}
|
|
1950
1950
|
};
|
|
1951
1951
|
W([
|
|
1952
|
-
|
|
1952
|
+
Be()
|
|
1953
1953
|
], T.prototype, "name", 2);
|
|
1954
1954
|
W([
|
|
1955
|
-
|
|
1955
|
+
Le()
|
|
1956
1956
|
], T.prototype, "uuid", 2);
|
|
1957
1957
|
W([
|
|
1958
|
-
|
|
1958
|
+
ne()
|
|
1959
1959
|
], T.prototype, "friction", 2);
|
|
1960
1960
|
W([
|
|
1961
|
-
|
|
1961
|
+
ne()
|
|
1962
1962
|
], T.prototype, "restitution", 2);
|
|
1963
1963
|
T = W([
|
|
1964
|
-
|
|
1964
|
+
Sa("Cannon Material")
|
|
1965
1965
|
], T);
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1966
|
+
Ba.MakeSerializable(La, "CannonMaterial", ["friction", "restitution"]);
|
|
1967
|
+
Ba.MakeSerializable(T, "CannonMaterial", ["name", "uuid", "friction", "restitution"]);
|
|
1968
|
+
Ba.MakeSerializable(pe, "CannonContactMaterial", [
|
|
1969
1969
|
/* 'materials', */
|
|
1970
1970
|
"friction",
|
|
1971
1971
|
"restitution",
|
|
@@ -1974,7 +1974,7 @@ La.MakeSerializable(ge, "CannonContactMaterial", [
|
|
|
1974
1974
|
"frictionEquationStiffness",
|
|
1975
1975
|
"frictionEquationRelaxation"
|
|
1976
1976
|
]);
|
|
1977
|
-
|
|
1977
|
+
ze.AddClass({
|
|
1978
1978
|
key: "CannonMaterial",
|
|
1979
1979
|
getId(t) {
|
|
1980
1980
|
return t.uuid;
|
|
@@ -1987,7 +1987,7 @@ Re.AddClass({
|
|
|
1987
1987
|
},
|
|
1988
1988
|
ctor: T
|
|
1989
1989
|
});
|
|
1990
|
-
let z = class extends
|
|
1990
|
+
let z = class extends Ce {
|
|
1991
1991
|
// @uiButton('Make Root Bodies')
|
|
1992
1992
|
// makeRootBodies = () => {
|
|
1993
1993
|
// this._viewer?.scene.modelRoot.children.forEach((child) => {
|
|
@@ -2011,16 +2011,16 @@ let z = class extends Se {
|
|
|
2011
2011
|
// // this._viewer?.setDirty()
|
|
2012
2012
|
// }
|
|
2013
2013
|
constructor(t = !0, a = !1) {
|
|
2014
|
-
super(), this._world = new
|
|
2014
|
+
super(), this._world = new fe(), this.enabled = !0, this.running = !0, this.nextSteps = 0, this.stepPhysics = {
|
|
2015
2015
|
stepCount: 100,
|
|
2016
2016
|
delta: 0.1,
|
|
2017
2017
|
step: () => {
|
|
2018
2018
|
this.nextSteps = this.stepPhysics.stepCount;
|
|
2019
2019
|
}
|
|
2020
|
-
}, this.defaultMaterial = new T("default"), this.dependencies = [L], this._v1 = new F(), this._v2 = new F(), this._s2 = new F(), this._q1 = new C(), this._q2 = new C(), this._m1 = new
|
|
2020
|
+
}, this.defaultMaterial = new T("default"), this.dependencies = [L], this._v1 = new F(), this._v2 = new F(), this._s2 = new F(), this._q1 = new C(), this._q2 = new C(), this._m1 = new Ya(), this._m2 = new Ya(), this.frameFadeToggled = !1, this._preFrame = (b) => {
|
|
2021
2021
|
const s = this._viewer;
|
|
2022
2022
|
if (!s || this.isDisabled()) return;
|
|
2023
|
-
const i = s.getPlugin(
|
|
2023
|
+
const i = s.getPlugin(Se);
|
|
2024
2024
|
if (!this.running)
|
|
2025
2025
|
if (this.nextSteps > 0) this.running = !0;
|
|
2026
2026
|
else {
|
|
@@ -2088,7 +2088,7 @@ let z = class extends Se {
|
|
|
2088
2088
|
a && this._onRemove.push(a), Object.values(this.componentTypes).forEach((e) => {
|
|
2089
2089
|
var b;
|
|
2090
2090
|
(b = t.getPlugin(L)) == null || b.addComponentType(e);
|
|
2091
|
-
}), t.object3dManager.getObjects().forEach((e) => this._objectAdd({ object: e })), t.object3dManager.addEventListener("objectAdd", this._objectAdd), t.object3dManager.addEventListener("objectRemove", this._objectRemove), t.forPlugin(
|
|
2091
|
+
}), t.object3dManager.getObjects().forEach((e) => this._objectAdd({ object: e })), t.object3dManager.addEventListener("objectAdd", this._objectAdd), t.object3dManager.addEventListener("objectRemove", this._objectRemove), t.forPlugin(ce, (e) => {
|
|
2092
2092
|
e.helpers.push(ya);
|
|
2093
2093
|
}, (e) => {
|
|
2094
2094
|
const b = e.helpers.indexOf(ya);
|
|
@@ -2112,27 +2112,27 @@ z.PluginType = "CannonPhysicsPlugin";
|
|
|
2112
2112
|
z.CannonTypes = {
|
|
2113
2113
|
Body: N,
|
|
2114
2114
|
Shape: q,
|
|
2115
|
-
World:
|
|
2116
|
-
Material:
|
|
2117
|
-
ContactMaterial:
|
|
2115
|
+
World: fe,
|
|
2116
|
+
Material: La,
|
|
2117
|
+
ContactMaterial: pe
|
|
2118
2118
|
};
|
|
2119
2119
|
W([
|
|
2120
|
-
|
|
2121
|
-
|
|
2120
|
+
oe(),
|
|
2121
|
+
de()
|
|
2122
2122
|
], z.prototype, "enabled", 2);
|
|
2123
2123
|
W([
|
|
2124
|
-
|
|
2124
|
+
de("Running", (t) => ({ onChange: () => {
|
|
2125
2125
|
} }))
|
|
2126
2126
|
], z.prototype, "running", 2);
|
|
2127
2127
|
W([
|
|
2128
|
-
|
|
2128
|
+
re()
|
|
2129
2129
|
], z.prototype, "stepPhysics", 2);
|
|
2130
2130
|
W([
|
|
2131
|
-
|
|
2132
|
-
|
|
2131
|
+
re(),
|
|
2132
|
+
oe()
|
|
2133
2133
|
], z.prototype, "defaultMaterial", 2);
|
|
2134
2134
|
z = W([
|
|
2135
|
-
|
|
2135
|
+
Sa("Physics")
|
|
2136
2136
|
], z);
|
|
2137
2137
|
const Vt = ["visible", "name", "position", "quaternion", "scale"], Yt = ["name"], Xt = [
|
|
2138
2138
|
"position",
|
|
@@ -2227,7 +2227,7 @@ class Zt {
|
|
|
2227
2227
|
for (const p of [...e.children])
|
|
2228
2228
|
e._sChildren.includes(p) || p.removeFromParent();
|
|
2229
2229
|
for (const p of a.children) {
|
|
2230
|
-
const j =
|
|
2230
|
+
const j = ke(p);
|
|
2231
2231
|
j.userData.excludeFromExport = !0, e.add(j);
|
|
2232
2232
|
}
|
|
2233
2233
|
const b = e.userData.sProperties, s = e.name, i = e.visible;
|
|
@@ -2237,11 +2237,11 @@ class Zt {
|
|
|
2237
2237
|
j && P && j.isVector3 || j && P && j.isQuaternion ? P.copy(j) : j !== void 0 && Object.assign(e, { [p]: j });
|
|
2238
2238
|
}
|
|
2239
2239
|
const n = e.userData;
|
|
2240
|
-
e.userData = {},
|
|
2240
|
+
e.userData = {}, Re(e.userData, a.userData, ["uuid", "sProperties"]), Object.assign(e.userData, n), e.name = s, e.visible = i, e.userData.uuid = e.uuid, e.userData.sProperties = b, (l = e.setDirty) == null || l.call(e, { source: "RuntimeNestedAssetLoader" });
|
|
2241
2241
|
}
|
|
2242
2242
|
updateMaterial(a, e) {
|
|
2243
|
-
const b = e.userData.sProperties, s =
|
|
2244
|
-
e.setValues(a), e.name = i,
|
|
2243
|
+
const b = e.userData.sProperties, s = Ue(e, b), i = e.name;
|
|
2244
|
+
e.setValues(a), e.name = i, Ge(s, e), e.userData.uuid = e.uuid, e.userData.sProperties = b;
|
|
2245
2245
|
}
|
|
2246
2246
|
track(a) {
|
|
2247
2247
|
this.pending.add(a);
|
|
@@ -2249,38 +2249,38 @@ class Zt {
|
|
|
2249
2249
|
a.then(e, e);
|
|
2250
2250
|
}
|
|
2251
2251
|
}
|
|
2252
|
-
function
|
|
2252
|
+
function ke(t) {
|
|
2253
2253
|
const a = t.clone(!1), e = t, b = a;
|
|
2254
2254
|
b._tpRootPath = e._tpRootPath, b._tpRootUid = e._tpRootUid || t.uuid, delete a.userData.cloneParent;
|
|
2255
|
-
for (const s of t.children) a.add(
|
|
2255
|
+
for (const s of t.children) a.add(ke(s));
|
|
2256
2256
|
return a;
|
|
2257
2257
|
}
|
|
2258
|
-
function
|
|
2259
|
-
return
|
|
2258
|
+
function hb(t) {
|
|
2259
|
+
return we(t, !0);
|
|
2260
2260
|
}
|
|
2261
|
-
function
|
|
2262
|
-
return
|
|
2261
|
+
function lb(t) {
|
|
2262
|
+
return we(t, !1);
|
|
2263
2263
|
}
|
|
2264
|
-
async function
|
|
2264
|
+
async function we({
|
|
2265
2265
|
base: t,
|
|
2266
2266
|
canvas: a,
|
|
2267
2267
|
onError: e,
|
|
2268
2268
|
fileRevisions: b = {},
|
|
2269
2269
|
moduleRevision: s
|
|
2270
2270
|
}, i) {
|
|
2271
|
-
const n =
|
|
2271
|
+
const n = sb(e);
|
|
2272
2272
|
let l, p, j, P;
|
|
2273
2273
|
try {
|
|
2274
|
-
const k =
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
]), o =
|
|
2274
|
+
const k = bb(t), [M, m] = await Promise.all([
|
|
2275
|
+
be(new URL("package.json", k)),
|
|
2276
|
+
be(new URL("assets.json", k))
|
|
2277
|
+
]), o = tt(M), c = await bt(o), d = it(m), r = {
|
|
2278
2278
|
packageJson: o,
|
|
2279
2279
|
config: c,
|
|
2280
2280
|
assetsManifest: d,
|
|
2281
2281
|
mainScene: o.mainScene
|
|
2282
2282
|
}, h = new L(!1), f = new z(!0, !1);
|
|
2283
|
-
L.AddObjectUiConfig = !1, window.MeshoptDecoder = ct, l = new
|
|
2283
|
+
L.AddObjectUiConfig = !1, window.MeshoptDecoder = ct, l = new _e({
|
|
2284
2284
|
canvas: a,
|
|
2285
2285
|
...c.viewer,
|
|
2286
2286
|
assetManager: {
|
|
@@ -2289,27 +2289,27 @@ async function ve({
|
|
|
2289
2289
|
},
|
|
2290
2290
|
plugins: [
|
|
2291
2291
|
h,
|
|
2292
|
-
new
|
|
2292
|
+
new Te(),
|
|
2293
2293
|
f,
|
|
2294
|
+
new Oe(),
|
|
2294
2295
|
new Qe(),
|
|
2295
|
-
new We(),
|
|
2296
|
-
new qe(
|
|
2296
|
+
new We(!1),
|
|
2297
|
+
new qe(),
|
|
2297
2298
|
new Ke(),
|
|
2298
2299
|
new He(),
|
|
2299
2300
|
new Je(),
|
|
2300
2301
|
new Ve(),
|
|
2301
|
-
new Ye()
|
|
2302
|
-
new Xe()
|
|
2302
|
+
new Ye()
|
|
2303
2303
|
]
|
|
2304
|
-
}), l.timeline.endTime = 0, P =
|
|
2305
|
-
const g =
|
|
2304
|
+
}), l.timeline.endTime = 0, P = at(), h.addComponentType(Ea), h.addComponentType(sa), sa.configureViewer(l, { base: k, onError: n });
|
|
2305
|
+
const g = st(k, d);
|
|
2306
2306
|
l.assetManager.importer.addURLModifier(g), j = () => l == null ? void 0 : l.assetManager.importer.removeURLModifier(g), p = new Zt(l, n), await ab(l, r, k, b, s), await $t(l, r, k, b, s);
|
|
2307
2307
|
const u = new URL(r.mainScene, k).href, w = await l.load(u, { importAsModelRoot: !0 });
|
|
2308
2308
|
if (!(w != null && w.isObject3D))
|
|
2309
2309
|
throw new Error(`The main scene did not load as an Object3D: ${u}`);
|
|
2310
2310
|
if (await p.loadObjectDependencies(w), await p.waitForPending(), await sa.waitForViewer(l), i) {
|
|
2311
2311
|
l.timeline.reset(), l.timeline.start(), h.start(), f.running = !0;
|
|
2312
|
-
const D =
|
|
2312
|
+
const D = za("main.js", k, b, s), I = await Ra(D.href);
|
|
2313
2313
|
if (I.main !== void 0) {
|
|
2314
2314
|
if (typeof I.main != "function")
|
|
2315
2315
|
throw new Error('main.js export "main" must be a function');
|
|
@@ -2325,7 +2325,7 @@ async function ve({
|
|
|
2325
2325
|
publishGameTelemetry: P.publishGameTelemetry,
|
|
2326
2326
|
runGameValidation: P.runGameValidation,
|
|
2327
2327
|
dispose() {
|
|
2328
|
-
return A || (A = !0, h.stop(), f.running = !1, v.timeline.stop(), x =
|
|
2328
|
+
return A || (A = !0, h.stop(), f.running = !1, v.timeline.stop(), x = et(v), p == null || p.dispose(), j == null || j(), P == null || P.dispose(), v.dispose()), x;
|
|
2329
2329
|
}
|
|
2330
2330
|
};
|
|
2331
2331
|
} catch (k) {
|
|
@@ -2336,7 +2336,7 @@ async function $t(t, a, e, b, s) {
|
|
|
2336
2336
|
const { config: i, packageJson: n } = a;
|
|
2337
2337
|
for (const l of i.plugins) {
|
|
2338
2338
|
if (l.active === !1) continue;
|
|
2339
|
-
const p =
|
|
2339
|
+
const p = eb(l, n, e, b, s), j = await Ra(p), P = tb(j, l);
|
|
2340
2340
|
t.getPlugin(P) || await t.addPlugin(P, ...l.params || []);
|
|
2341
2341
|
}
|
|
2342
2342
|
}
|
|
@@ -2344,69 +2344,58 @@ async function ab(t, a, e, b, s) {
|
|
|
2344
2344
|
const { config: i, packageJson: n } = a, l = [];
|
|
2345
2345
|
for (const p of i.scripts) {
|
|
2346
2346
|
if (p.active === !1) continue;
|
|
2347
|
-
const j =
|
|
2348
|
-
l.push(await
|
|
2347
|
+
const j = ge(p.import, n) ? p.import : za(p.import, e, b, s).href;
|
|
2348
|
+
l.push(await Ra(j));
|
|
2349
2349
|
}
|
|
2350
2350
|
await ot(t, l);
|
|
2351
2351
|
}
|
|
2352
|
-
function eb(t, a) {
|
|
2353
|
-
|
|
2354
|
-
return (b) => {
|
|
2355
|
-
if (b.startsWith(e)) {
|
|
2356
|
-
const s = b.slice(e.length).split("/", 1)[0], i = a.files[s];
|
|
2357
|
-
if (!(i != null && i.path)) throw new Error(`Unknown asset id in URL: ${s}`);
|
|
2358
|
-
return new URL(i.path, t).href;
|
|
2359
|
-
}
|
|
2360
|
-
return b.startsWith(Ma) ? new URL(b.slice(Ma.length), t).href : b;
|
|
2361
|
-
};
|
|
2362
|
-
}
|
|
2363
|
-
function tb(t, a, e, b, s) {
|
|
2364
|
-
return me(t.import, a) ? t.import : Ra(t.import, e, b, s).href;
|
|
2352
|
+
function eb(t, a, e, b, s) {
|
|
2353
|
+
return ge(t.import, a) ? t.import : za(t.import, e, b, s).href;
|
|
2365
2354
|
}
|
|
2366
|
-
function
|
|
2367
|
-
const s =
|
|
2355
|
+
function za(t, a, e, b) {
|
|
2356
|
+
const s = ib(new URL(t, a), a), i = t.replace(/^\.\//, ""), n = e[i];
|
|
2368
2357
|
return n && s.searchParams.set("v", n), b && s.searchParams.set("r", b), s;
|
|
2369
2358
|
}
|
|
2370
|
-
function
|
|
2359
|
+
function tb(t, a) {
|
|
2371
2360
|
const e = a.className || "default", b = t[e];
|
|
2372
|
-
if (
|
|
2361
|
+
if (te(b)) return b;
|
|
2373
2362
|
if (!a.className) {
|
|
2374
|
-
const s = Object.values(t).filter(
|
|
2363
|
+
const s = Object.values(t).filter(te);
|
|
2375
2364
|
if (s.length === 1) return s[0];
|
|
2376
2365
|
}
|
|
2377
2366
|
throw new Error(`Cannot find plugin export "${e}" in ${a.import}`);
|
|
2378
2367
|
}
|
|
2379
|
-
function
|
|
2368
|
+
function te(t) {
|
|
2380
2369
|
return typeof t == "function" && typeof t.PluginType == "string";
|
|
2381
2370
|
}
|
|
2382
|
-
async function
|
|
2371
|
+
async function Ra(t) {
|
|
2383
2372
|
return import(
|
|
2384
2373
|
/* @vite-ignore */
|
|
2385
2374
|
t
|
|
2386
2375
|
);
|
|
2387
2376
|
}
|
|
2388
|
-
async function
|
|
2377
|
+
async function be(t) {
|
|
2389
2378
|
const a = await fetch(t);
|
|
2390
2379
|
if (!a.ok) throw new Error(`Failed to fetch ${t.href}: ${a.status} ${a.statusText}`);
|
|
2391
2380
|
return a.text();
|
|
2392
2381
|
}
|
|
2393
|
-
function
|
|
2382
|
+
function bb(t) {
|
|
2394
2383
|
if (!t.endsWith("/")) throw new Error('createGame base must end in "/"');
|
|
2395
2384
|
const a = new URL(t);
|
|
2396
2385
|
if (!a.protocol.startsWith("http")) throw new Error("createGame base must be an absolute HTTP(S) URL");
|
|
2397
2386
|
return a;
|
|
2398
2387
|
}
|
|
2399
|
-
function
|
|
2388
|
+
function ib(t, a) {
|
|
2400
2389
|
if (t.origin !== a.origin)
|
|
2401
2390
|
throw new Error(`Project modules must be same-origin: ${t.href}`);
|
|
2402
2391
|
return t;
|
|
2403
2392
|
}
|
|
2404
|
-
function
|
|
2393
|
+
function sb(t) {
|
|
2405
2394
|
return (a) => {
|
|
2406
2395
|
console.error("[kite3d] Runtime error", a), t == null || t(a);
|
|
2407
2396
|
};
|
|
2408
2397
|
}
|
|
2409
|
-
const
|
|
2398
|
+
const fb = {
|
|
2410
2399
|
plugins: [
|
|
2411
2400
|
{
|
|
2412
2401
|
import: "threepipe",
|
|
@@ -2692,61 +2681,62 @@ export {
|
|
|
2692
2681
|
na as CannonRagdollComponent,
|
|
2693
2682
|
bi as DEPLOYS_PATH,
|
|
2694
2683
|
sa as GeneratorComponent,
|
|
2695
|
-
|
|
2684
|
+
Ea as HtmlUiComponent,
|
|
2696
2685
|
ii as JOURNAL_PATH,
|
|
2697
|
-
|
|
2686
|
+
ub as KITE3D_AUTHORING_METADATA_KEY,
|
|
2698
2687
|
si as KITE3D_DIRECTORY,
|
|
2699
|
-
|
|
2688
|
+
jb as KITE3D_RUNTIME_METADATA_KEY,
|
|
2700
2689
|
ci as KITE3D_SERVER_CLIENT_ID,
|
|
2701
2690
|
Ub as PROJECT_MIGRATIONS,
|
|
2702
2691
|
ni as RUNNING_DIRECTORY,
|
|
2703
2692
|
qb as RUNTIME_SPECIFIERS,
|
|
2704
2693
|
zb as RUNTIME_VERSION,
|
|
2705
2694
|
Zt as RuntimeNestedAssetLoader,
|
|
2706
|
-
|
|
2695
|
+
yb as RuntimeObjectOwner,
|
|
2707
2696
|
oi as STATE_PATH,
|
|
2708
2697
|
di as THUMBS_DIRECTORY,
|
|
2709
|
-
|
|
2710
|
-
|
|
2698
|
+
Eb as assetUrlPrefix,
|
|
2699
|
+
Pb as authoringQualityReport,
|
|
2711
2700
|
Wt as cannonShapeTypeParams,
|
|
2712
2701
|
Qt as cannonShapeTypes,
|
|
2713
|
-
|
|
2714
|
-
|
|
2702
|
+
hb as createGame,
|
|
2703
|
+
st as createProjectAssetURLModifier,
|
|
2704
|
+
lb as createStoppedGame,
|
|
2715
2705
|
Kb as dependencyImportMap,
|
|
2716
|
-
|
|
2706
|
+
fb as emptyProjectSettings,
|
|
2717
2707
|
Yb as extensionMimeTypes,
|
|
2718
2708
|
ma as getAuthoringMetadata,
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2709
|
+
kb as getRuntimeObjectMetadata,
|
|
2710
|
+
wb as getTrackedRuntimeObjects,
|
|
2711
|
+
at as installGameHooks,
|
|
2722
2712
|
rt as isComponentType,
|
|
2723
|
-
|
|
2713
|
+
ge as isDependencyModuleSpecifier,
|
|
2724
2714
|
dt as isPluginType,
|
|
2725
|
-
|
|
2726
|
-
|
|
2715
|
+
vb as isRuntimeObject,
|
|
2716
|
+
Xa as markGenerated,
|
|
2727
2717
|
Xb as mimeToExt,
|
|
2728
2718
|
Zb as mimeTypeForPath,
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2719
|
+
it as parseAssetsJSONManifest,
|
|
2720
|
+
tt as parsePackageJSON,
|
|
2721
|
+
bt as parsePackageJsonSettingsConfig,
|
|
2722
|
+
Ab as persistenceReport,
|
|
2733
2723
|
_t as physicsBodyType,
|
|
2734
2724
|
Hb as projectDependencies,
|
|
2735
2725
|
Jb as projectPluginNames,
|
|
2736
|
-
|
|
2726
|
+
Db as publishGameTelemetry,
|
|
2737
2727
|
Nb as readProjectGeneratorStates,
|
|
2738
|
-
|
|
2728
|
+
Mb as registerGameValidation,
|
|
2739
2729
|
ot as registerScripts,
|
|
2740
|
-
|
|
2730
|
+
me as removeGeneratedChildren,
|
|
2741
2731
|
ut as resolveGeneratorModule,
|
|
2742
2732
|
ft as runGenerator,
|
|
2743
|
-
|
|
2744
|
-
|
|
2733
|
+
et as runtimeCleanupReport,
|
|
2734
|
+
Ib as semanticSceneSnapshot,
|
|
2745
2735
|
_b as serializeSceneGltf,
|
|
2746
2736
|
Tb as serializeSceneGltfDocument,
|
|
2747
|
-
|
|
2737
|
+
he as setAuthoringMetadata,
|
|
2748
2738
|
Cb as settingsKey,
|
|
2749
|
-
|
|
2739
|
+
Na as typeToCannon,
|
|
2750
2740
|
$b as typesExts,
|
|
2751
2741
|
ht as uiPositionMode,
|
|
2752
2742
|
Sb as updateProjectGeneratorState,
|