gamedev 0.0.3-alpha.0 → 0.0.4-alpha.2
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/app-server/WorldManifest.js +1 -1
- package/app-server/cli.js +1 -1
- package/app-server/commands.js +7 -7
- package/app-server/direct.js +3 -3
- package/app-server/scaffold.js +91 -6
- package/app-server/targets.js +1 -1
- package/app-server/templates/claude/skills/hyperfy-app-scripting/SKILL.md +2 -2
- package/bin/gamedev.mjs +19 -125
- package/build/public/admin.html +2 -2
- package/build/public/index.html +2 -2
- package/build/world-node-client.js +1339 -214
- package/build/world-node-client.js.map +4 -4
- package/package.json +1 -1
|
@@ -381,10 +381,10 @@ var Vector3Enhanced = class _Vector3Enhanced {
|
|
|
381
381
|
this._onChangeCallback();
|
|
382
382
|
return this;
|
|
383
383
|
}
|
|
384
|
-
lerpVectors(
|
|
385
|
-
this._x =
|
|
386
|
-
this._y =
|
|
387
|
-
this._z =
|
|
384
|
+
lerpVectors(v112, v28, alpha) {
|
|
385
|
+
this._x = v112.x + (v28.x - v112.x) * alpha;
|
|
386
|
+
this._y = v112.y + (v28.y - v112.y) * alpha;
|
|
387
|
+
this._z = v112.z + (v28.z - v112.z) * alpha;
|
|
388
388
|
this._onChangeCallback();
|
|
389
389
|
return this;
|
|
390
390
|
}
|
|
@@ -1460,10 +1460,6 @@ var Apps = class extends System {
|
|
|
1460
1460
|
}
|
|
1461
1461
|
const newUrl = window.location.pathname + "?" + urlParams.toString();
|
|
1462
1462
|
window.history.replaceState({}, "", newUrl);
|
|
1463
|
-
},
|
|
1464
|
-
evm() {
|
|
1465
|
-
const { world: _, ...evm } = world2.evm;
|
|
1466
|
-
return evm;
|
|
1467
1463
|
}
|
|
1468
1464
|
};
|
|
1469
1465
|
}
|
|
@@ -1483,10 +1479,10 @@ var Apps = class extends System {
|
|
|
1483
1479
|
return entity.data.state;
|
|
1484
1480
|
},
|
|
1485
1481
|
props(entity) {
|
|
1486
|
-
return entity.
|
|
1482
|
+
return entity.getEffectiveProps();
|
|
1487
1483
|
},
|
|
1488
1484
|
config(entity) {
|
|
1489
|
-
return entity.
|
|
1485
|
+
return entity.getEffectiveProps();
|
|
1490
1486
|
},
|
|
1491
1487
|
resetOnMove(entity) {
|
|
1492
1488
|
return entity.resetOnMove;
|
|
@@ -1557,7 +1553,11 @@ var Apps = class extends System {
|
|
|
1557
1553
|
if (!isArray(entity.fields)) {
|
|
1558
1554
|
entity.fields = [];
|
|
1559
1555
|
}
|
|
1560
|
-
|
|
1556
|
+
let props = entity.blueprint.props;
|
|
1557
|
+
if (!props || typeof props !== "object" || isArray(props)) {
|
|
1558
|
+
props = {};
|
|
1559
|
+
entity.blueprint.props = props;
|
|
1560
|
+
}
|
|
1561
1561
|
for (const field of entity.fields) {
|
|
1562
1562
|
fileRemaps[field.type]?.(field);
|
|
1563
1563
|
if (field.initial !== void 0 && props[field.key] === void 0) {
|
|
@@ -1572,8 +1572,8 @@ var Apps = class extends System {
|
|
|
1572
1572
|
if (world2) {
|
|
1573
1573
|
for (const key in world2) {
|
|
1574
1574
|
const value = world2[key];
|
|
1575
|
-
const
|
|
1576
|
-
if (
|
|
1575
|
+
const isFunction9 = typeof value === "function";
|
|
1576
|
+
if (isFunction9) {
|
|
1577
1577
|
this.worldMethods[key] = value;
|
|
1578
1578
|
continue;
|
|
1579
1579
|
}
|
|
@@ -1588,8 +1588,8 @@ var Apps = class extends System {
|
|
|
1588
1588
|
if (app) {
|
|
1589
1589
|
for (const key in app) {
|
|
1590
1590
|
const value = app[key];
|
|
1591
|
-
const
|
|
1592
|
-
if (
|
|
1591
|
+
const isFunction9 = typeof value === "function";
|
|
1592
|
+
if (isFunction9) {
|
|
1593
1593
|
this.appMethods[key] = value;
|
|
1594
1594
|
continue;
|
|
1595
1595
|
}
|
|
@@ -1983,7 +1983,7 @@ var Blueprints = class extends System {
|
|
|
1983
1983
|
};
|
|
1984
1984
|
|
|
1985
1985
|
// src/core/entities/App.js
|
|
1986
|
-
import { isArray as isArray8, isFunction as
|
|
1986
|
+
import { isArray as isArray8, isFunction as isFunction8, isNumber as isNumber21, isString as isString18, merge as merge3 } from "lodash-es";
|
|
1987
1987
|
import moment3 from "moment";
|
|
1988
1988
|
|
|
1989
1989
|
// src/core/entities/Entity.js
|
|
@@ -2029,9 +2029,11 @@ __export(nodes_exports, {
|
|
|
2029
2029
|
snap: () => Snap,
|
|
2030
2030
|
ui: () => UI,
|
|
2031
2031
|
uiimage: () => UIImage,
|
|
2032
|
+
uiinput: () => UIInput,
|
|
2032
2033
|
uitext: () => UIText,
|
|
2033
2034
|
uiview: () => UIView,
|
|
2034
|
-
video: () => Video
|
|
2035
|
+
video: () => Video,
|
|
2036
|
+
webview: () => WebView
|
|
2035
2037
|
});
|
|
2036
2038
|
|
|
2037
2039
|
// src/core/nodes/Group.js
|
|
@@ -5654,16 +5656,6 @@ var Prim = class extends Node {
|
|
|
5654
5656
|
this.handle.setEmissive(this._emissive);
|
|
5655
5657
|
this.handle.setEmissiveIntensity(this._emissiveIntensity);
|
|
5656
5658
|
count++;
|
|
5657
|
-
} else {
|
|
5658
|
-
this.sItem = {
|
|
5659
|
-
matrix: this.matrixWorldOffset,
|
|
5660
|
-
geometry,
|
|
5661
|
-
material: material2,
|
|
5662
|
-
getEntity: () => this.ctx.entity,
|
|
5663
|
-
node: this
|
|
5664
|
-
};
|
|
5665
|
-
this.ctx.world.stage.octree.insert(this.sItem);
|
|
5666
|
-
count++;
|
|
5667
5659
|
}
|
|
5668
5660
|
if (this._physics && !this.ctx.moving) {
|
|
5669
5661
|
this.mountPhysics(size);
|
|
@@ -10708,8 +10700,983 @@ function isEdge4(value) {
|
|
|
10708
10700
|
return false;
|
|
10709
10701
|
}
|
|
10710
10702
|
|
|
10703
|
+
// src/core/nodes/WebView.js
|
|
10704
|
+
import { isBoolean as isBoolean16, isNumber as isNumber15, isString as isString14 } from "lodash-es";
|
|
10705
|
+
import { CSS3DObject } from "three/examples/jsm/renderers/CSS3DRenderer.js";
|
|
10706
|
+
var defaults18 = {
|
|
10707
|
+
src: null,
|
|
10708
|
+
html: null,
|
|
10709
|
+
width: 1,
|
|
10710
|
+
height: 1,
|
|
10711
|
+
factor: 100,
|
|
10712
|
+
doubleside: false,
|
|
10713
|
+
space: "world",
|
|
10714
|
+
pointerEvents: true
|
|
10715
|
+
};
|
|
10716
|
+
var v16 = new Vector3Enhanced();
|
|
10717
|
+
var WebView = class extends Node {
|
|
10718
|
+
constructor(data = {}) {
|
|
10719
|
+
super(data);
|
|
10720
|
+
this.name = "webview";
|
|
10721
|
+
this.src = data.src;
|
|
10722
|
+
this.html = data.html ?? data.srcdoc;
|
|
10723
|
+
this.width = data.width;
|
|
10724
|
+
this.height = data.height;
|
|
10725
|
+
this.factor = data.factor;
|
|
10726
|
+
this.doubleside = data.doubleside;
|
|
10727
|
+
this.space = data.space;
|
|
10728
|
+
this.pointerEvents = data.pointerEvents;
|
|
10729
|
+
this.n = 0;
|
|
10730
|
+
}
|
|
10731
|
+
copy(source, recursive) {
|
|
10732
|
+
super.copy(source, recursive);
|
|
10733
|
+
this._src = source._src;
|
|
10734
|
+
this._html = source._html;
|
|
10735
|
+
this._width = source._width;
|
|
10736
|
+
this._height = source._height;
|
|
10737
|
+
this._factor = source._factor;
|
|
10738
|
+
this._doubleside = source._doubleside;
|
|
10739
|
+
this._space = source._space;
|
|
10740
|
+
this._pointerEvents = source._pointerEvents;
|
|
10741
|
+
return this;
|
|
10742
|
+
}
|
|
10743
|
+
mount() {
|
|
10744
|
+
this.build();
|
|
10745
|
+
}
|
|
10746
|
+
commit(didMove) {
|
|
10747
|
+
if (this.needsRebuild) {
|
|
10748
|
+
this.build();
|
|
10749
|
+
return;
|
|
10750
|
+
}
|
|
10751
|
+
if (this._space === "screen") {
|
|
10752
|
+
if (didMove && this.container) {
|
|
10753
|
+
this.updateScreenTransform();
|
|
10754
|
+
}
|
|
10755
|
+
return;
|
|
10756
|
+
}
|
|
10757
|
+
if (didMove) {
|
|
10758
|
+
if (this.mesh) {
|
|
10759
|
+
this.mesh.matrixWorld.copy(this.matrixWorld);
|
|
10760
|
+
}
|
|
10761
|
+
if (this.sItem) {
|
|
10762
|
+
this.ctx.world.stage.octree.move(this.sItem);
|
|
10763
|
+
}
|
|
10764
|
+
}
|
|
10765
|
+
}
|
|
10766
|
+
unmount() {
|
|
10767
|
+
this.unbuild();
|
|
10768
|
+
}
|
|
10769
|
+
build() {
|
|
10770
|
+
this.needsRebuild = false;
|
|
10771
|
+
if (this.ctx.world.network.isServer) return;
|
|
10772
|
+
this.unbuild();
|
|
10773
|
+
if (this._space === "screen") {
|
|
10774
|
+
this.buildScreen();
|
|
10775
|
+
} else {
|
|
10776
|
+
this.buildWorld();
|
|
10777
|
+
}
|
|
10778
|
+
}
|
|
10779
|
+
buildWorld() {
|
|
10780
|
+
const n2 = ++this.n;
|
|
10781
|
+
const hasContent = this._src || this._html;
|
|
10782
|
+
const geometry = new three_exports.PlaneGeometry(this._width, this._height);
|
|
10783
|
+
const material2 = new three_exports.MeshBasicMaterial({
|
|
10784
|
+
opacity: 0,
|
|
10785
|
+
color: new three_exports.Color("black"),
|
|
10786
|
+
blending: hasContent ? three_exports.NoBlending : three_exports.NormalBlending,
|
|
10787
|
+
side: this._doubleside ? three_exports.DoubleSide : three_exports.FrontSide
|
|
10788
|
+
});
|
|
10789
|
+
this.mesh = new three_exports.Mesh(geometry, material2);
|
|
10790
|
+
this.mesh.matrixWorld.copy(this.matrixWorld);
|
|
10791
|
+
this.mesh.matrixAutoUpdate = false;
|
|
10792
|
+
this.mesh.matrixWorldAutoUpdate = false;
|
|
10793
|
+
this.mesh.renderOrder = -1;
|
|
10794
|
+
this.ctx.world.stage.scene.add(this.mesh);
|
|
10795
|
+
if (this._pointerEvents) {
|
|
10796
|
+
this.sItem = {
|
|
10797
|
+
matrix: this.matrixWorld,
|
|
10798
|
+
geometry,
|
|
10799
|
+
material: material2,
|
|
10800
|
+
getEntity: () => this.ctx.entity,
|
|
10801
|
+
node: this
|
|
10802
|
+
};
|
|
10803
|
+
this.ctx.world.stage.octree.insert(this.sItem);
|
|
10804
|
+
}
|
|
10805
|
+
if (!hasContent) return;
|
|
10806
|
+
const widthPx = `${this._width * this._factor}px`;
|
|
10807
|
+
const heightPx = `${this._height * this._factor}px`;
|
|
10808
|
+
const container = document.createElement("div");
|
|
10809
|
+
container.style.width = widthPx;
|
|
10810
|
+
container.style.height = heightPx;
|
|
10811
|
+
const inner = document.createElement("div");
|
|
10812
|
+
inner.style.width = widthPx;
|
|
10813
|
+
inner.style.height = heightPx;
|
|
10814
|
+
inner.style.backgroundColor = "#000";
|
|
10815
|
+
const iframe = document.createElement("iframe");
|
|
10816
|
+
iframe.frameBorder = "0";
|
|
10817
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share";
|
|
10818
|
+
iframe.allowFullscreen = true;
|
|
10819
|
+
iframe.style.width = widthPx;
|
|
10820
|
+
iframe.style.height = heightPx;
|
|
10821
|
+
iframe.style.border = "0px";
|
|
10822
|
+
iframe.style.pointerEvents = "none";
|
|
10823
|
+
if (this._html) {
|
|
10824
|
+
iframe.srcdoc = this._html;
|
|
10825
|
+
} else {
|
|
10826
|
+
iframe.src = this._src;
|
|
10827
|
+
}
|
|
10828
|
+
container.appendChild(inner);
|
|
10829
|
+
inner.appendChild(iframe);
|
|
10830
|
+
this.objectCSS = new CSS3DObject(container);
|
|
10831
|
+
this.objectCSS.target = this.mesh;
|
|
10832
|
+
this.mesh.updateMatrixWorld();
|
|
10833
|
+
this.mesh.matrixWorld.decompose(this.objectCSS.position, this.objectCSS.quaternion, v16);
|
|
10834
|
+
this.objectCSS.scale.setScalar(1 / this._factor);
|
|
10835
|
+
this.iframe = iframe;
|
|
10836
|
+
this.inner = inner;
|
|
10837
|
+
this.container = container;
|
|
10838
|
+
const isDesktop = !this.ctx.world.network.isServer && this.ctx.world.controls && !/iPhone|iPad|iPod|Android/i.test(globalThis.navigator?.userAgent || "");
|
|
10839
|
+
if (!isDesktop && this._pointerEvents) {
|
|
10840
|
+
iframe.style.pointerEvents = "auto";
|
|
10841
|
+
}
|
|
10842
|
+
inner.addEventListener("mouseenter", () => {
|
|
10843
|
+
if (isDesktop && this._pointerEvents) {
|
|
10844
|
+
this.objectCSS.interacting = true;
|
|
10845
|
+
iframe.style.pointerEvents = "auto";
|
|
10846
|
+
}
|
|
10847
|
+
});
|
|
10848
|
+
inner.addEventListener("mouseleave", () => {
|
|
10849
|
+
if (isDesktop && this._pointerEvents) {
|
|
10850
|
+
this.objectCSS.interacting = false;
|
|
10851
|
+
iframe.style.pointerEvents = "none";
|
|
10852
|
+
}
|
|
10853
|
+
});
|
|
10854
|
+
if (this.n !== n2) return;
|
|
10855
|
+
this.ctx.world.css?.add(this.objectCSS);
|
|
10856
|
+
}
|
|
10857
|
+
buildScreen() {
|
|
10858
|
+
const hasContent = this._src || this._html;
|
|
10859
|
+
if (!hasContent) return;
|
|
10860
|
+
if (!this.ctx.world.pointer?.ui) return;
|
|
10861
|
+
const widthPx = this._width;
|
|
10862
|
+
const heightPx = this._height;
|
|
10863
|
+
const container = document.createElement("div");
|
|
10864
|
+
container.style.position = "absolute";
|
|
10865
|
+
container.style.width = `${widthPx}px`;
|
|
10866
|
+
container.style.height = `${heightPx}px`;
|
|
10867
|
+
container.style.pointerEvents = this._pointerEvents ? "auto" : "none";
|
|
10868
|
+
const iframe = document.createElement("iframe");
|
|
10869
|
+
iframe.frameBorder = "0";
|
|
10870
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share";
|
|
10871
|
+
iframe.allowFullscreen = true;
|
|
10872
|
+
iframe.style.width = "100%";
|
|
10873
|
+
iframe.style.height = "100%";
|
|
10874
|
+
iframe.style.border = "0px";
|
|
10875
|
+
if (this._html) {
|
|
10876
|
+
iframe.srcdoc = this._html;
|
|
10877
|
+
} else {
|
|
10878
|
+
iframe.src = this._src;
|
|
10879
|
+
}
|
|
10880
|
+
container.appendChild(iframe);
|
|
10881
|
+
this.container = container;
|
|
10882
|
+
this.iframe = iframe;
|
|
10883
|
+
this.updateScreenTransform();
|
|
10884
|
+
this.ctx.world.pointer.ui.prepend(container);
|
|
10885
|
+
}
|
|
10886
|
+
unbuild() {
|
|
10887
|
+
this.n++;
|
|
10888
|
+
if (this.mesh) {
|
|
10889
|
+
this.ctx.world.stage.scene.remove(this.mesh);
|
|
10890
|
+
this.mesh.geometry.dispose();
|
|
10891
|
+
this.mesh.material.dispose();
|
|
10892
|
+
this.mesh = null;
|
|
10893
|
+
}
|
|
10894
|
+
if (this.sItem) {
|
|
10895
|
+
this.ctx.world.stage.octree.remove(this.sItem);
|
|
10896
|
+
this.sItem = null;
|
|
10897
|
+
}
|
|
10898
|
+
if (this.objectCSS) {
|
|
10899
|
+
this.ctx.world.css?.remove(this.objectCSS);
|
|
10900
|
+
this.objectCSS = null;
|
|
10901
|
+
}
|
|
10902
|
+
if (this.container) {
|
|
10903
|
+
this.container.remove();
|
|
10904
|
+
this.container = null;
|
|
10905
|
+
}
|
|
10906
|
+
this.iframe = null;
|
|
10907
|
+
this.inner = null;
|
|
10908
|
+
}
|
|
10909
|
+
updateScreenTransform() {
|
|
10910
|
+
const xPercent = this.position.x * 100;
|
|
10911
|
+
const yPercent = this.position.y * 100;
|
|
10912
|
+
const rotation = this.rotation.z || 0;
|
|
10913
|
+
const scaleX = this.scale.x;
|
|
10914
|
+
const scaleY = this.scale.y;
|
|
10915
|
+
this.container.style.left = `${xPercent}%`;
|
|
10916
|
+
this.container.style.top = `${yPercent}%`;
|
|
10917
|
+
this.container.style.transform = `translate(-${xPercent}%, -${yPercent}%) rotate(${rotation}rad) scale(${scaleX}, ${scaleY})`;
|
|
10918
|
+
this.container.style.zIndex = String(Math.floor(this.position.z || 0));
|
|
10919
|
+
}
|
|
10920
|
+
onPointerDown(e2) {
|
|
10921
|
+
if (this._onPointerDown) {
|
|
10922
|
+
this._onPointerDown(e2);
|
|
10923
|
+
if (e2.defaultPrevented) return;
|
|
10924
|
+
}
|
|
10925
|
+
if (this.ctx.world.builder?.enabled) return;
|
|
10926
|
+
if (this.ctx.world.controls?.pointer?.locked) {
|
|
10927
|
+
this.ctx.world.controls.unlockPointer();
|
|
10928
|
+
}
|
|
10929
|
+
}
|
|
10930
|
+
get src() {
|
|
10931
|
+
return this._src;
|
|
10932
|
+
}
|
|
10933
|
+
set src(value = defaults18.src) {
|
|
10934
|
+
if (value !== null && !isString14(value)) {
|
|
10935
|
+
throw new Error("[webview] src not null or string");
|
|
10936
|
+
}
|
|
10937
|
+
if (this._src === value) return;
|
|
10938
|
+
this._src = value;
|
|
10939
|
+
this.needsRebuild = true;
|
|
10940
|
+
this.setDirty();
|
|
10941
|
+
}
|
|
10942
|
+
get html() {
|
|
10943
|
+
return this._html;
|
|
10944
|
+
}
|
|
10945
|
+
set html(value = defaults18.html) {
|
|
10946
|
+
if (value !== null && !isString14(value)) {
|
|
10947
|
+
throw new Error("[webview] html not null or string");
|
|
10948
|
+
}
|
|
10949
|
+
if (this._html === value) return;
|
|
10950
|
+
this._html = value;
|
|
10951
|
+
this.needsRebuild = true;
|
|
10952
|
+
this.setDirty();
|
|
10953
|
+
}
|
|
10954
|
+
get srcdoc() {
|
|
10955
|
+
return this._html;
|
|
10956
|
+
}
|
|
10957
|
+
set srcdoc(value = defaults18.html) {
|
|
10958
|
+
this.html = value;
|
|
10959
|
+
}
|
|
10960
|
+
get width() {
|
|
10961
|
+
return this._width;
|
|
10962
|
+
}
|
|
10963
|
+
set width(value = defaults18.width) {
|
|
10964
|
+
if (!isNumber15(value)) {
|
|
10965
|
+
throw new Error("[webview] width not a number");
|
|
10966
|
+
}
|
|
10967
|
+
if (this._width === value) return;
|
|
10968
|
+
this._width = value;
|
|
10969
|
+
this.needsRebuild = true;
|
|
10970
|
+
this.setDirty();
|
|
10971
|
+
}
|
|
10972
|
+
get height() {
|
|
10973
|
+
return this._height;
|
|
10974
|
+
}
|
|
10975
|
+
set height(value = defaults18.height) {
|
|
10976
|
+
if (!isNumber15(value)) {
|
|
10977
|
+
throw new Error("[webview] height not a number");
|
|
10978
|
+
}
|
|
10979
|
+
if (this._height === value) return;
|
|
10980
|
+
this._height = value;
|
|
10981
|
+
this.needsRebuild = true;
|
|
10982
|
+
this.setDirty();
|
|
10983
|
+
}
|
|
10984
|
+
get factor() {
|
|
10985
|
+
return this._factor;
|
|
10986
|
+
}
|
|
10987
|
+
set factor(value = defaults18.factor) {
|
|
10988
|
+
if (!isNumber15(value)) {
|
|
10989
|
+
throw new Error("[webview] factor not a number");
|
|
10990
|
+
}
|
|
10991
|
+
if (this._factor === value) return;
|
|
10992
|
+
this._factor = value;
|
|
10993
|
+
this.needsRebuild = true;
|
|
10994
|
+
this.setDirty();
|
|
10995
|
+
}
|
|
10996
|
+
get doubleside() {
|
|
10997
|
+
return this._doubleside;
|
|
10998
|
+
}
|
|
10999
|
+
set doubleside(value = defaults18.doubleside) {
|
|
11000
|
+
if (!isBoolean16(value)) {
|
|
11001
|
+
throw new Error("[webview] doubleside not a boolean");
|
|
11002
|
+
}
|
|
11003
|
+
if (this._doubleside === value) return;
|
|
11004
|
+
this._doubleside = value;
|
|
11005
|
+
this.needsRebuild = true;
|
|
11006
|
+
this.setDirty();
|
|
11007
|
+
}
|
|
11008
|
+
get space() {
|
|
11009
|
+
return this._space;
|
|
11010
|
+
}
|
|
11011
|
+
set space(value = defaults18.space) {
|
|
11012
|
+
if (value !== "world" && value !== "screen") {
|
|
11013
|
+
throw new Error('[webview] space must be "world" or "screen"');
|
|
11014
|
+
}
|
|
11015
|
+
if (this._space === value) return;
|
|
11016
|
+
this._space = value;
|
|
11017
|
+
this.needsRebuild = true;
|
|
11018
|
+
this.setDirty();
|
|
11019
|
+
}
|
|
11020
|
+
get pointerEvents() {
|
|
11021
|
+
return this._pointerEvents;
|
|
11022
|
+
}
|
|
11023
|
+
set pointerEvents(value = defaults18.pointerEvents) {
|
|
11024
|
+
if (!isBoolean16(value)) {
|
|
11025
|
+
throw new Error("[webview] pointerEvents not a boolean");
|
|
11026
|
+
}
|
|
11027
|
+
if (this._pointerEvents === value) return;
|
|
11028
|
+
this._pointerEvents = value;
|
|
11029
|
+
this.needsRebuild = true;
|
|
11030
|
+
this.setDirty();
|
|
11031
|
+
}
|
|
11032
|
+
getProxy() {
|
|
11033
|
+
if (!this.proxy) {
|
|
11034
|
+
const self2 = this;
|
|
11035
|
+
let proxy = {
|
|
11036
|
+
get src() {
|
|
11037
|
+
return self2.src;
|
|
11038
|
+
},
|
|
11039
|
+
set src(value) {
|
|
11040
|
+
self2.src = value;
|
|
11041
|
+
},
|
|
11042
|
+
get html() {
|
|
11043
|
+
return self2.html;
|
|
11044
|
+
},
|
|
11045
|
+
set html(value) {
|
|
11046
|
+
self2.html = value;
|
|
11047
|
+
},
|
|
11048
|
+
get srcdoc() {
|
|
11049
|
+
return self2.srcdoc;
|
|
11050
|
+
},
|
|
11051
|
+
set srcdoc(value) {
|
|
11052
|
+
self2.srcdoc = value;
|
|
11053
|
+
},
|
|
11054
|
+
get width() {
|
|
11055
|
+
return self2.width;
|
|
11056
|
+
},
|
|
11057
|
+
set width(value) {
|
|
11058
|
+
self2.width = value;
|
|
11059
|
+
},
|
|
11060
|
+
get height() {
|
|
11061
|
+
return self2.height;
|
|
11062
|
+
},
|
|
11063
|
+
set height(value) {
|
|
11064
|
+
self2.height = value;
|
|
11065
|
+
},
|
|
11066
|
+
get factor() {
|
|
11067
|
+
return self2.factor;
|
|
11068
|
+
},
|
|
11069
|
+
set factor(value) {
|
|
11070
|
+
self2.factor = value;
|
|
11071
|
+
},
|
|
11072
|
+
get doubleside() {
|
|
11073
|
+
return self2.doubleside;
|
|
11074
|
+
},
|
|
11075
|
+
set doubleside(value) {
|
|
11076
|
+
self2.doubleside = value;
|
|
11077
|
+
},
|
|
11078
|
+
get space() {
|
|
11079
|
+
return self2.space;
|
|
11080
|
+
},
|
|
11081
|
+
set space(value) {
|
|
11082
|
+
self2.space = value;
|
|
11083
|
+
},
|
|
11084
|
+
get pointerEvents() {
|
|
11085
|
+
return self2.pointerEvents;
|
|
11086
|
+
},
|
|
11087
|
+
set pointerEvents(value) {
|
|
11088
|
+
self2.pointerEvents = value;
|
|
11089
|
+
}
|
|
11090
|
+
};
|
|
11091
|
+
proxy = Object.defineProperties(proxy, Object.getOwnPropertyDescriptors(super.getProxy()));
|
|
11092
|
+
this.proxy = proxy;
|
|
11093
|
+
}
|
|
11094
|
+
return this.proxy;
|
|
11095
|
+
}
|
|
11096
|
+
};
|
|
11097
|
+
|
|
11098
|
+
// src/core/nodes/UIInput.js
|
|
11099
|
+
import { isBoolean as isBoolean17, isFunction as isFunction5, isNumber as isNumber16, isString as isString15 } from "lodash-es";
|
|
11100
|
+
import { CSS3DObject as CSS3DObject2 } from "three/examples/jsm/renderers/CSS3DRenderer.js";
|
|
11101
|
+
var defaults19 = {
|
|
11102
|
+
value: "",
|
|
11103
|
+
placeholder: "",
|
|
11104
|
+
width: 200,
|
|
11105
|
+
height: 32,
|
|
11106
|
+
factor: 100,
|
|
11107
|
+
fontSize: 14,
|
|
11108
|
+
color: "#000000",
|
|
11109
|
+
backgroundColor: "#ffffff",
|
|
11110
|
+
borderWidth: 1,
|
|
11111
|
+
borderColor: "#cccccc",
|
|
11112
|
+
borderRadius: 4,
|
|
11113
|
+
padding: 8,
|
|
11114
|
+
disabled: false,
|
|
11115
|
+
type: "text"
|
|
11116
|
+
};
|
|
11117
|
+
var v17 = new Vector3Enhanced();
|
|
11118
|
+
var UIInput = class extends Node {
|
|
11119
|
+
constructor(data = {}) {
|
|
11120
|
+
super(data);
|
|
11121
|
+
this.name = "uiinput";
|
|
11122
|
+
this.value = data.value;
|
|
11123
|
+
this.placeholder = data.placeholder;
|
|
11124
|
+
this.width = data.width;
|
|
11125
|
+
this.height = data.height;
|
|
11126
|
+
this.factor = data.factor;
|
|
11127
|
+
this.fontSize = data.fontSize;
|
|
11128
|
+
this.color = data.color;
|
|
11129
|
+
this.backgroundColor = data.backgroundColor;
|
|
11130
|
+
this.borderWidth = data.borderWidth;
|
|
11131
|
+
this.borderColor = data.borderColor;
|
|
11132
|
+
this.borderRadius = data.borderRadius;
|
|
11133
|
+
this.padding = data.padding;
|
|
11134
|
+
this.disabled = data.disabled;
|
|
11135
|
+
this.type = data.type;
|
|
11136
|
+
this._onFocus = data.onFocus;
|
|
11137
|
+
this._onBlur = data.onBlur;
|
|
11138
|
+
this._onChange = data.onChange;
|
|
11139
|
+
this._onSubmit = data.onSubmit;
|
|
11140
|
+
this.n = 0;
|
|
11141
|
+
}
|
|
11142
|
+
copy(source, recursive) {
|
|
11143
|
+
super.copy(source, recursive);
|
|
11144
|
+
this._value = source._value;
|
|
11145
|
+
this._placeholder = source._placeholder;
|
|
11146
|
+
this._width = source._width;
|
|
11147
|
+
this._height = source._height;
|
|
11148
|
+
this._factor = source._factor;
|
|
11149
|
+
this._fontSize = source._fontSize;
|
|
11150
|
+
this._color = source._color;
|
|
11151
|
+
this._backgroundColor = source._backgroundColor;
|
|
11152
|
+
this._borderWidth = source._borderWidth;
|
|
11153
|
+
this._borderColor = source._borderColor;
|
|
11154
|
+
this._borderRadius = source._borderRadius;
|
|
11155
|
+
this._padding = source._padding;
|
|
11156
|
+
this._disabled = source._disabled;
|
|
11157
|
+
this._type = source._type;
|
|
11158
|
+
this._onFocus = source._onFocus;
|
|
11159
|
+
this._onBlur = source._onBlur;
|
|
11160
|
+
this._onChange = source._onChange;
|
|
11161
|
+
this._onSubmit = source._onSubmit;
|
|
11162
|
+
return this;
|
|
11163
|
+
}
|
|
11164
|
+
mount() {
|
|
11165
|
+
this.build();
|
|
11166
|
+
}
|
|
11167
|
+
commit(didMove) {
|
|
11168
|
+
if (this.needsRebuild) {
|
|
11169
|
+
this.build();
|
|
11170
|
+
return;
|
|
11171
|
+
}
|
|
11172
|
+
if (didMove) {
|
|
11173
|
+
if (this.mesh) {
|
|
11174
|
+
this.mesh.matrixWorld.copy(this.matrixWorld);
|
|
11175
|
+
}
|
|
11176
|
+
if (this.sItem) {
|
|
11177
|
+
this.ctx.world.stage.octree.move(this.sItem);
|
|
11178
|
+
}
|
|
11179
|
+
}
|
|
11180
|
+
}
|
|
11181
|
+
unmount() {
|
|
11182
|
+
this.unbuild();
|
|
11183
|
+
}
|
|
11184
|
+
build() {
|
|
11185
|
+
this.needsRebuild = false;
|
|
11186
|
+
if (this.ctx.world.network.isServer) return;
|
|
11187
|
+
this.unbuild();
|
|
11188
|
+
const n2 = ++this.n;
|
|
11189
|
+
const widthM = this._width / this._factor;
|
|
11190
|
+
const heightM = this._height / this._factor;
|
|
11191
|
+
const geometry = new three_exports.PlaneGeometry(widthM, heightM);
|
|
11192
|
+
const material2 = new three_exports.MeshBasicMaterial({
|
|
11193
|
+
opacity: 0,
|
|
11194
|
+
color: new three_exports.Color("black"),
|
|
11195
|
+
blending: three_exports.NoBlending,
|
|
11196
|
+
side: three_exports.FrontSide
|
|
11197
|
+
});
|
|
11198
|
+
this.mesh = new three_exports.Mesh(geometry, material2);
|
|
11199
|
+
this.mesh.matrixWorld.copy(this.matrixWorld);
|
|
11200
|
+
this.mesh.matrixAutoUpdate = false;
|
|
11201
|
+
this.mesh.matrixWorldAutoUpdate = false;
|
|
11202
|
+
this.mesh.renderOrder = -1;
|
|
11203
|
+
this.ctx.world.stage.scene.add(this.mesh);
|
|
11204
|
+
this.sItem = {
|
|
11205
|
+
matrix: this.matrixWorld,
|
|
11206
|
+
geometry,
|
|
11207
|
+
material: material2,
|
|
11208
|
+
getEntity: () => this.ctx.entity,
|
|
11209
|
+
node: this
|
|
11210
|
+
};
|
|
11211
|
+
this.ctx.world.stage.octree.insert(this.sItem);
|
|
11212
|
+
const widthPx = `${this._width}px`;
|
|
11213
|
+
const heightPx = `${this._height}px`;
|
|
11214
|
+
const container = document.createElement("div");
|
|
11215
|
+
container.style.width = widthPx;
|
|
11216
|
+
container.style.height = heightPx;
|
|
11217
|
+
const inner = document.createElement("div");
|
|
11218
|
+
inner.style.width = widthPx;
|
|
11219
|
+
inner.style.height = heightPx;
|
|
11220
|
+
inner.style.backgroundColor = this._backgroundColor;
|
|
11221
|
+
const input = document.createElement("input");
|
|
11222
|
+
input.type = this._type;
|
|
11223
|
+
input.value = this._value;
|
|
11224
|
+
input.placeholder = this._placeholder;
|
|
11225
|
+
input.disabled = this._disabled;
|
|
11226
|
+
input.style.width = "100%";
|
|
11227
|
+
input.style.height = "100%";
|
|
11228
|
+
input.style.boxSizing = "border-box";
|
|
11229
|
+
input.style.border = `${this._borderWidth}px solid ${this._borderColor}`;
|
|
11230
|
+
input.style.borderRadius = `${this._borderRadius}px`;
|
|
11231
|
+
input.style.padding = `${this._padding}px`;
|
|
11232
|
+
input.style.fontSize = `${this._fontSize}px`;
|
|
11233
|
+
input.style.color = this._color;
|
|
11234
|
+
input.style.backgroundColor = this._backgroundColor;
|
|
11235
|
+
input.style.outline = "none";
|
|
11236
|
+
input.style.fontFamily = "Rubik, sans-serif";
|
|
11237
|
+
input.style.pointerEvents = "none";
|
|
11238
|
+
container.appendChild(inner);
|
|
11239
|
+
inner.appendChild(input);
|
|
11240
|
+
this.objectCSS = new CSS3DObject2(container);
|
|
11241
|
+
this.objectCSS.target = this.mesh;
|
|
11242
|
+
this.mesh.updateMatrixWorld();
|
|
11243
|
+
this.mesh.matrixWorld.decompose(this.objectCSS.position, this.objectCSS.quaternion, v17);
|
|
11244
|
+
this.objectCSS.scale.setScalar(1 / this._factor);
|
|
11245
|
+
this.input = input;
|
|
11246
|
+
this.inner = inner;
|
|
11247
|
+
this.container = container;
|
|
11248
|
+
const isDesktop = !this.ctx.world.network.isServer && this.ctx.world.controls && !/iPhone|iPad|iPod|Android/i.test(globalThis.navigator?.userAgent || "");
|
|
11249
|
+
if (!isDesktop) {
|
|
11250
|
+
input.style.pointerEvents = "auto";
|
|
11251
|
+
}
|
|
11252
|
+
container.addEventListener("pointerdown", (e2) => {
|
|
11253
|
+
e2.stopPropagation();
|
|
11254
|
+
});
|
|
11255
|
+
inner.addEventListener("mouseenter", () => {
|
|
11256
|
+
if (isDesktop) {
|
|
11257
|
+
this.objectCSS.interacting = true;
|
|
11258
|
+
input.style.pointerEvents = "auto";
|
|
11259
|
+
}
|
|
11260
|
+
});
|
|
11261
|
+
inner.addEventListener("mouseleave", () => {
|
|
11262
|
+
if (isDesktop && document.activeElement !== input) {
|
|
11263
|
+
this.objectCSS.interacting = false;
|
|
11264
|
+
input.style.pointerEvents = "none";
|
|
11265
|
+
}
|
|
11266
|
+
});
|
|
11267
|
+
input.addEventListener("focus", () => {
|
|
11268
|
+
this.objectCSS.interacting = true;
|
|
11269
|
+
this._onFocus?.(this._value);
|
|
11270
|
+
});
|
|
11271
|
+
input.addEventListener("blur", () => {
|
|
11272
|
+
if (isDesktop) {
|
|
11273
|
+
this.objectCSS.interacting = false;
|
|
11274
|
+
input.style.pointerEvents = "none";
|
|
11275
|
+
}
|
|
11276
|
+
this._onBlur?.(this._value);
|
|
11277
|
+
});
|
|
11278
|
+
input.addEventListener("input", () => {
|
|
11279
|
+
this._value = input.value;
|
|
11280
|
+
this._onChange?.(this._value);
|
|
11281
|
+
});
|
|
11282
|
+
input.addEventListener("keydown", (e2) => {
|
|
11283
|
+
if (e2.key === "Enter") {
|
|
11284
|
+
e2.preventDefault();
|
|
11285
|
+
this._onSubmit?.(this._value);
|
|
11286
|
+
} else if (e2.key === "Escape") {
|
|
11287
|
+
e2.preventDefault();
|
|
11288
|
+
input.blur();
|
|
11289
|
+
}
|
|
11290
|
+
});
|
|
11291
|
+
if (this.n !== n2) return;
|
|
11292
|
+
this.ctx.world.css?.add(this.objectCSS);
|
|
11293
|
+
}
|
|
11294
|
+
unbuild() {
|
|
11295
|
+
this.n++;
|
|
11296
|
+
if (this.mesh) {
|
|
11297
|
+
this.ctx.world.stage.scene.remove(this.mesh);
|
|
11298
|
+
this.mesh.geometry.dispose();
|
|
11299
|
+
this.mesh.material.dispose();
|
|
11300
|
+
this.mesh = null;
|
|
11301
|
+
}
|
|
11302
|
+
if (this.sItem) {
|
|
11303
|
+
this.ctx.world.stage.octree.remove(this.sItem);
|
|
11304
|
+
this.sItem = null;
|
|
11305
|
+
}
|
|
11306
|
+
if (this.objectCSS) {
|
|
11307
|
+
this.ctx.world.css?.remove(this.objectCSS);
|
|
11308
|
+
this.objectCSS = null;
|
|
11309
|
+
}
|
|
11310
|
+
this.input = null;
|
|
11311
|
+
this.inner = null;
|
|
11312
|
+
this.container = null;
|
|
11313
|
+
}
|
|
11314
|
+
onPointerDown(e2) {
|
|
11315
|
+
if (this._onPointerDown) {
|
|
11316
|
+
this._onPointerDown(e2);
|
|
11317
|
+
if (e2.defaultPrevented) return;
|
|
11318
|
+
}
|
|
11319
|
+
if (this.ctx.world.builder?.enabled) return;
|
|
11320
|
+
if (this._disabled) return;
|
|
11321
|
+
if (this.ctx.world.controls?.pointer?.locked) {
|
|
11322
|
+
this.ctx.world.controls.unlockPointer();
|
|
11323
|
+
}
|
|
11324
|
+
}
|
|
11325
|
+
focus() {
|
|
11326
|
+
this.input?.focus();
|
|
11327
|
+
}
|
|
11328
|
+
blur() {
|
|
11329
|
+
this.input?.blur();
|
|
11330
|
+
}
|
|
11331
|
+
get value() {
|
|
11332
|
+
return this._value;
|
|
11333
|
+
}
|
|
11334
|
+
set value(val = defaults19.value) {
|
|
11335
|
+
if (isNumber16(val)) {
|
|
11336
|
+
val = val + "";
|
|
11337
|
+
}
|
|
11338
|
+
if (!isString15(val)) {
|
|
11339
|
+
throw new Error("[uiinput] value not a string");
|
|
11340
|
+
}
|
|
11341
|
+
if (this._value === val) return;
|
|
11342
|
+
this._value = val;
|
|
11343
|
+
if (this.input) {
|
|
11344
|
+
this.input.value = val;
|
|
11345
|
+
}
|
|
11346
|
+
}
|
|
11347
|
+
get placeholder() {
|
|
11348
|
+
return this._placeholder;
|
|
11349
|
+
}
|
|
11350
|
+
set placeholder(value = defaults19.placeholder) {
|
|
11351
|
+
if (!isString15(value)) {
|
|
11352
|
+
throw new Error("[uiinput] placeholder not a string");
|
|
11353
|
+
}
|
|
11354
|
+
if (this._placeholder === value) return;
|
|
11355
|
+
this._placeholder = value;
|
|
11356
|
+
if (this.input) {
|
|
11357
|
+
this.input.placeholder = value;
|
|
11358
|
+
}
|
|
11359
|
+
}
|
|
11360
|
+
get width() {
|
|
11361
|
+
return this._width;
|
|
11362
|
+
}
|
|
11363
|
+
set width(value = defaults19.width) {
|
|
11364
|
+
if (!isNumber16(value)) {
|
|
11365
|
+
throw new Error("[uiinput] width not a number");
|
|
11366
|
+
}
|
|
11367
|
+
if (this._width === value) return;
|
|
11368
|
+
this._width = value;
|
|
11369
|
+
this.needsRebuild = true;
|
|
11370
|
+
this.setDirty();
|
|
11371
|
+
}
|
|
11372
|
+
get height() {
|
|
11373
|
+
return this._height;
|
|
11374
|
+
}
|
|
11375
|
+
set height(value = defaults19.height) {
|
|
11376
|
+
if (!isNumber16(value)) {
|
|
11377
|
+
throw new Error("[uiinput] height not a number");
|
|
11378
|
+
}
|
|
11379
|
+
if (this._height === value) return;
|
|
11380
|
+
this._height = value;
|
|
11381
|
+
this.needsRebuild = true;
|
|
11382
|
+
this.setDirty();
|
|
11383
|
+
}
|
|
11384
|
+
get factor() {
|
|
11385
|
+
return this._factor;
|
|
11386
|
+
}
|
|
11387
|
+
set factor(value = defaults19.factor) {
|
|
11388
|
+
if (!isNumber16(value)) {
|
|
11389
|
+
throw new Error("[uiinput] factor not a number");
|
|
11390
|
+
}
|
|
11391
|
+
if (this._factor === value) return;
|
|
11392
|
+
this._factor = value;
|
|
11393
|
+
this.needsRebuild = true;
|
|
11394
|
+
this.setDirty();
|
|
11395
|
+
}
|
|
11396
|
+
get fontSize() {
|
|
11397
|
+
return this._fontSize;
|
|
11398
|
+
}
|
|
11399
|
+
set fontSize(value = defaults19.fontSize) {
|
|
11400
|
+
if (!isNumber16(value)) {
|
|
11401
|
+
throw new Error("[uiinput] fontSize not a number");
|
|
11402
|
+
}
|
|
11403
|
+
if (this._fontSize === value) return;
|
|
11404
|
+
this._fontSize = value;
|
|
11405
|
+
if (this.input) {
|
|
11406
|
+
this.input.style.fontSize = `${value}px`;
|
|
11407
|
+
}
|
|
11408
|
+
}
|
|
11409
|
+
get color() {
|
|
11410
|
+
return this._color;
|
|
11411
|
+
}
|
|
11412
|
+
set color(value = defaults19.color) {
|
|
11413
|
+
if (!isString15(value)) {
|
|
11414
|
+
throw new Error("[uiinput] color not a string");
|
|
11415
|
+
}
|
|
11416
|
+
if (this._color === value) return;
|
|
11417
|
+
this._color = value;
|
|
11418
|
+
if (this.input) {
|
|
11419
|
+
this.input.style.color = value;
|
|
11420
|
+
}
|
|
11421
|
+
}
|
|
11422
|
+
get backgroundColor() {
|
|
11423
|
+
return this._backgroundColor;
|
|
11424
|
+
}
|
|
11425
|
+
set backgroundColor(value = defaults19.backgroundColor) {
|
|
11426
|
+
if (!isString15(value)) {
|
|
11427
|
+
throw new Error("[uiinput] backgroundColor not a string");
|
|
11428
|
+
}
|
|
11429
|
+
if (this._backgroundColor === value) return;
|
|
11430
|
+
this._backgroundColor = value;
|
|
11431
|
+
if (this.input) {
|
|
11432
|
+
this.input.style.backgroundColor = value;
|
|
11433
|
+
}
|
|
11434
|
+
if (this.inner) {
|
|
11435
|
+
this.inner.style.backgroundColor = value;
|
|
11436
|
+
}
|
|
11437
|
+
}
|
|
11438
|
+
get borderWidth() {
|
|
11439
|
+
return this._borderWidth;
|
|
11440
|
+
}
|
|
11441
|
+
set borderWidth(value = defaults19.borderWidth) {
|
|
11442
|
+
if (!isNumber16(value)) {
|
|
11443
|
+
throw new Error("[uiinput] borderWidth not a number");
|
|
11444
|
+
}
|
|
11445
|
+
if (this._borderWidth === value) return;
|
|
11446
|
+
this._borderWidth = value;
|
|
11447
|
+
if (this.input) {
|
|
11448
|
+
this.input.style.border = `${value}px solid ${this._borderColor}`;
|
|
11449
|
+
}
|
|
11450
|
+
}
|
|
11451
|
+
get borderColor() {
|
|
11452
|
+
return this._borderColor;
|
|
11453
|
+
}
|
|
11454
|
+
set borderColor(value = defaults19.borderColor) {
|
|
11455
|
+
if (!isString15(value)) {
|
|
11456
|
+
throw new Error("[uiinput] borderColor not a string");
|
|
11457
|
+
}
|
|
11458
|
+
if (this._borderColor === value) return;
|
|
11459
|
+
this._borderColor = value;
|
|
11460
|
+
if (this.input) {
|
|
11461
|
+
this.input.style.border = `${this._borderWidth}px solid ${value}`;
|
|
11462
|
+
}
|
|
11463
|
+
}
|
|
11464
|
+
get borderRadius() {
|
|
11465
|
+
return this._borderRadius;
|
|
11466
|
+
}
|
|
11467
|
+
set borderRadius(value = defaults19.borderRadius) {
|
|
11468
|
+
if (!isNumber16(value)) {
|
|
11469
|
+
throw new Error("[uiinput] borderRadius not a number");
|
|
11470
|
+
}
|
|
11471
|
+
if (this._borderRadius === value) return;
|
|
11472
|
+
this._borderRadius = value;
|
|
11473
|
+
if (this.input) {
|
|
11474
|
+
this.input.style.borderRadius = `${value}px`;
|
|
11475
|
+
}
|
|
11476
|
+
}
|
|
11477
|
+
get padding() {
|
|
11478
|
+
return this._padding;
|
|
11479
|
+
}
|
|
11480
|
+
set padding(value = defaults19.padding) {
|
|
11481
|
+
if (!isNumber16(value)) {
|
|
11482
|
+
throw new Error("[uiinput] padding not a number");
|
|
11483
|
+
}
|
|
11484
|
+
if (this._padding === value) return;
|
|
11485
|
+
this._padding = value;
|
|
11486
|
+
if (this.input) {
|
|
11487
|
+
this.input.style.padding = `${value}px`;
|
|
11488
|
+
}
|
|
11489
|
+
}
|
|
11490
|
+
get disabled() {
|
|
11491
|
+
return this._disabled;
|
|
11492
|
+
}
|
|
11493
|
+
set disabled(value = defaults19.disabled) {
|
|
11494
|
+
if (!isBoolean17(value)) {
|
|
11495
|
+
throw new Error("[uiinput] disabled not a boolean");
|
|
11496
|
+
}
|
|
11497
|
+
if (this._disabled === value) return;
|
|
11498
|
+
this._disabled = value;
|
|
11499
|
+
if (this.input) {
|
|
11500
|
+
this.input.disabled = value;
|
|
11501
|
+
}
|
|
11502
|
+
}
|
|
11503
|
+
get type() {
|
|
11504
|
+
return this._type;
|
|
11505
|
+
}
|
|
11506
|
+
set type(value = defaults19.type) {
|
|
11507
|
+
if (!isString15(value)) {
|
|
11508
|
+
throw new Error("[uiinput] type not a string");
|
|
11509
|
+
}
|
|
11510
|
+
if (this._type === value) return;
|
|
11511
|
+
this._type = value;
|
|
11512
|
+
if (this.input) {
|
|
11513
|
+
this.input.type = value;
|
|
11514
|
+
}
|
|
11515
|
+
}
|
|
11516
|
+
get onFocus() {
|
|
11517
|
+
return this._onFocus;
|
|
11518
|
+
}
|
|
11519
|
+
set onFocus(value) {
|
|
11520
|
+
if (value !== null && value !== void 0 && !isFunction5(value)) {
|
|
11521
|
+
throw new Error("[uiinput] onFocus not a function");
|
|
11522
|
+
}
|
|
11523
|
+
this._onFocus = value;
|
|
11524
|
+
}
|
|
11525
|
+
get onBlur() {
|
|
11526
|
+
return this._onBlur;
|
|
11527
|
+
}
|
|
11528
|
+
set onBlur(value) {
|
|
11529
|
+
if (value !== null && value !== void 0 && !isFunction5(value)) {
|
|
11530
|
+
throw new Error("[uiinput] onBlur not a function");
|
|
11531
|
+
}
|
|
11532
|
+
this._onBlur = value;
|
|
11533
|
+
}
|
|
11534
|
+
get onChange() {
|
|
11535
|
+
return this._onChange;
|
|
11536
|
+
}
|
|
11537
|
+
set onChange(value) {
|
|
11538
|
+
if (value !== null && value !== void 0 && !isFunction5(value)) {
|
|
11539
|
+
throw new Error("[uiinput] onChange not a function");
|
|
11540
|
+
}
|
|
11541
|
+
this._onChange = value;
|
|
11542
|
+
}
|
|
11543
|
+
get onSubmit() {
|
|
11544
|
+
return this._onSubmit;
|
|
11545
|
+
}
|
|
11546
|
+
set onSubmit(value) {
|
|
11547
|
+
if (value !== null && value !== void 0 && !isFunction5(value)) {
|
|
11548
|
+
throw new Error("[uiinput] onSubmit not a function");
|
|
11549
|
+
}
|
|
11550
|
+
this._onSubmit = value;
|
|
11551
|
+
}
|
|
11552
|
+
getProxy() {
|
|
11553
|
+
if (!this.proxy) {
|
|
11554
|
+
const self2 = this;
|
|
11555
|
+
let proxy = {
|
|
11556
|
+
get value() {
|
|
11557
|
+
return self2.value;
|
|
11558
|
+
},
|
|
11559
|
+
set value(v) {
|
|
11560
|
+
self2.value = v;
|
|
11561
|
+
},
|
|
11562
|
+
get placeholder() {
|
|
11563
|
+
return self2.placeholder;
|
|
11564
|
+
},
|
|
11565
|
+
set placeholder(v) {
|
|
11566
|
+
self2.placeholder = v;
|
|
11567
|
+
},
|
|
11568
|
+
get width() {
|
|
11569
|
+
return self2.width;
|
|
11570
|
+
},
|
|
11571
|
+
set width(v) {
|
|
11572
|
+
self2.width = v;
|
|
11573
|
+
},
|
|
11574
|
+
get height() {
|
|
11575
|
+
return self2.height;
|
|
11576
|
+
},
|
|
11577
|
+
set height(v) {
|
|
11578
|
+
self2.height = v;
|
|
11579
|
+
},
|
|
11580
|
+
get factor() {
|
|
11581
|
+
return self2.factor;
|
|
11582
|
+
},
|
|
11583
|
+
set factor(v) {
|
|
11584
|
+
self2.factor = v;
|
|
11585
|
+
},
|
|
11586
|
+
get fontSize() {
|
|
11587
|
+
return self2.fontSize;
|
|
11588
|
+
},
|
|
11589
|
+
set fontSize(v) {
|
|
11590
|
+
self2.fontSize = v;
|
|
11591
|
+
},
|
|
11592
|
+
get color() {
|
|
11593
|
+
return self2.color;
|
|
11594
|
+
},
|
|
11595
|
+
set color(v) {
|
|
11596
|
+
self2.color = v;
|
|
11597
|
+
},
|
|
11598
|
+
get backgroundColor() {
|
|
11599
|
+
return self2.backgroundColor;
|
|
11600
|
+
},
|
|
11601
|
+
set backgroundColor(v) {
|
|
11602
|
+
self2.backgroundColor = v;
|
|
11603
|
+
},
|
|
11604
|
+
get borderWidth() {
|
|
11605
|
+
return self2.borderWidth;
|
|
11606
|
+
},
|
|
11607
|
+
set borderWidth(v) {
|
|
11608
|
+
self2.borderWidth = v;
|
|
11609
|
+
},
|
|
11610
|
+
get borderColor() {
|
|
11611
|
+
return self2.borderColor;
|
|
11612
|
+
},
|
|
11613
|
+
set borderColor(v) {
|
|
11614
|
+
self2.borderColor = v;
|
|
11615
|
+
},
|
|
11616
|
+
get borderRadius() {
|
|
11617
|
+
return self2.borderRadius;
|
|
11618
|
+
},
|
|
11619
|
+
set borderRadius(v) {
|
|
11620
|
+
self2.borderRadius = v;
|
|
11621
|
+
},
|
|
11622
|
+
get padding() {
|
|
11623
|
+
return self2.padding;
|
|
11624
|
+
},
|
|
11625
|
+
set padding(v) {
|
|
11626
|
+
self2.padding = v;
|
|
11627
|
+
},
|
|
11628
|
+
get disabled() {
|
|
11629
|
+
return self2.disabled;
|
|
11630
|
+
},
|
|
11631
|
+
set disabled(v) {
|
|
11632
|
+
self2.disabled = v;
|
|
11633
|
+
},
|
|
11634
|
+
get type() {
|
|
11635
|
+
return self2.type;
|
|
11636
|
+
},
|
|
11637
|
+
set type(v) {
|
|
11638
|
+
self2.type = v;
|
|
11639
|
+
},
|
|
11640
|
+
get onFocus() {
|
|
11641
|
+
return self2.onFocus;
|
|
11642
|
+
},
|
|
11643
|
+
set onFocus(v) {
|
|
11644
|
+
self2.onFocus = v;
|
|
11645
|
+
},
|
|
11646
|
+
get onBlur() {
|
|
11647
|
+
return self2.onBlur;
|
|
11648
|
+
},
|
|
11649
|
+
set onBlur(v) {
|
|
11650
|
+
self2.onBlur = v;
|
|
11651
|
+
},
|
|
11652
|
+
get onChange() {
|
|
11653
|
+
return self2.onChange;
|
|
11654
|
+
},
|
|
11655
|
+
set onChange(v) {
|
|
11656
|
+
self2.onChange = v;
|
|
11657
|
+
},
|
|
11658
|
+
get onSubmit() {
|
|
11659
|
+
return self2.onSubmit;
|
|
11660
|
+
},
|
|
11661
|
+
set onSubmit(v) {
|
|
11662
|
+
self2.onSubmit = v;
|
|
11663
|
+
},
|
|
11664
|
+
focus() {
|
|
11665
|
+
self2.focus();
|
|
11666
|
+
},
|
|
11667
|
+
blur() {
|
|
11668
|
+
self2.blur();
|
|
11669
|
+
}
|
|
11670
|
+
};
|
|
11671
|
+
proxy = Object.defineProperties(proxy, Object.getOwnPropertyDescriptors(super.getProxy()));
|
|
11672
|
+
this.proxy = proxy;
|
|
11673
|
+
}
|
|
11674
|
+
return this.proxy;
|
|
11675
|
+
}
|
|
11676
|
+
};
|
|
11677
|
+
|
|
10711
11678
|
// src/core/nodes/Controller.js
|
|
10712
|
-
import { isNumber as
|
|
11679
|
+
import { isNumber as isNumber17, isBoolean as isBoolean18, isString as isString16, isFunction as isFunction6 } from "lodash-es";
|
|
10713
11680
|
|
|
10714
11681
|
// src/core/extras/general.js
|
|
10715
11682
|
var DEG2RAD = three_exports.MathUtils.DEG2RAD;
|
|
@@ -10717,7 +11684,7 @@ var RAD2DEG = three_exports.MathUtils.RAD2DEG;
|
|
|
10717
11684
|
|
|
10718
11685
|
// src/core/nodes/Controller.js
|
|
10719
11686
|
var layers = ["environment", "prop", "player", "tool"];
|
|
10720
|
-
var
|
|
11687
|
+
var defaults20 = {
|
|
10721
11688
|
radius: 0.4,
|
|
10722
11689
|
height: 1,
|
|
10723
11690
|
visible: false,
|
|
@@ -10834,8 +11801,8 @@ var Controller = class extends Node {
|
|
|
10834
11801
|
get radius() {
|
|
10835
11802
|
return this._radius;
|
|
10836
11803
|
}
|
|
10837
|
-
set radius(value =
|
|
10838
|
-
if (!
|
|
11804
|
+
set radius(value = defaults20.radius) {
|
|
11805
|
+
if (!isNumber17(value)) {
|
|
10839
11806
|
throw new Error("[controller] radius not a number");
|
|
10840
11807
|
}
|
|
10841
11808
|
this._radius = value;
|
|
@@ -10845,8 +11812,8 @@ var Controller = class extends Node {
|
|
|
10845
11812
|
get height() {
|
|
10846
11813
|
return this._height;
|
|
10847
11814
|
}
|
|
10848
|
-
set height(value =
|
|
10849
|
-
if (!
|
|
11815
|
+
set height(value = defaults20.height) {
|
|
11816
|
+
if (!isNumber17(value)) {
|
|
10850
11817
|
throw new Error("[controller] height not a number");
|
|
10851
11818
|
}
|
|
10852
11819
|
this._height = value;
|
|
@@ -10856,8 +11823,8 @@ var Controller = class extends Node {
|
|
|
10856
11823
|
get visible() {
|
|
10857
11824
|
return this._visible;
|
|
10858
11825
|
}
|
|
10859
|
-
set visible(value =
|
|
10860
|
-
if (!
|
|
11826
|
+
set visible(value = defaults20.visible) {
|
|
11827
|
+
if (!isBoolean18(value)) {
|
|
10861
11828
|
throw new Error("[controller] visible not a boolean");
|
|
10862
11829
|
}
|
|
10863
11830
|
this._visible = value;
|
|
@@ -10867,7 +11834,7 @@ var Controller = class extends Node {
|
|
|
10867
11834
|
get layer() {
|
|
10868
11835
|
return this._layer;
|
|
10869
11836
|
}
|
|
10870
|
-
set layer(value =
|
|
11837
|
+
set layer(value = defaults20.layer) {
|
|
10871
11838
|
if (!isLayer(value)) {
|
|
10872
11839
|
throw new Error(`[controller] invalid layer: ${value}`);
|
|
10873
11840
|
}
|
|
@@ -10880,11 +11847,11 @@ var Controller = class extends Node {
|
|
|
10880
11847
|
get tag() {
|
|
10881
11848
|
return this._tag;
|
|
10882
11849
|
}
|
|
10883
|
-
set tag(value =
|
|
10884
|
-
if (
|
|
11850
|
+
set tag(value = defaults20.tag) {
|
|
11851
|
+
if (isNumber17(value)) {
|
|
10885
11852
|
value = value + "";
|
|
10886
11853
|
}
|
|
10887
|
-
if (value !== null && !
|
|
11854
|
+
if (value !== null && !isString16(value)) {
|
|
10888
11855
|
throw new Error("[controller] tag not a string");
|
|
10889
11856
|
}
|
|
10890
11857
|
this._tag = value;
|
|
@@ -10892,8 +11859,8 @@ var Controller = class extends Node {
|
|
|
10892
11859
|
get onContactStart() {
|
|
10893
11860
|
return this._onContactStart;
|
|
10894
11861
|
}
|
|
10895
|
-
set onContactStart(value =
|
|
10896
|
-
if (value !== null && !
|
|
11862
|
+
set onContactStart(value = defaults20.onContactStart) {
|
|
11863
|
+
if (value !== null && !isFunction6(value)) {
|
|
10897
11864
|
throw new Error("[controller] onContactStart not a function");
|
|
10898
11865
|
}
|
|
10899
11866
|
this._onContactStart = value;
|
|
@@ -10901,8 +11868,8 @@ var Controller = class extends Node {
|
|
|
10901
11868
|
get onContactEnd() {
|
|
10902
11869
|
return this._onContactEnd;
|
|
10903
11870
|
}
|
|
10904
|
-
set onContactEnd(value =
|
|
10905
|
-
if (value !== null && !
|
|
11871
|
+
set onContactEnd(value = defaults20.onContactEnd) {
|
|
11872
|
+
if (value !== null && !isFunction6(value)) {
|
|
10906
11873
|
throw new Error("[controller] onContactEnd not a function");
|
|
10907
11874
|
}
|
|
10908
11875
|
this._onContactEnd = value;
|
|
@@ -11003,7 +11970,7 @@ function isLayer(value) {
|
|
|
11003
11970
|
}
|
|
11004
11971
|
|
|
11005
11972
|
// src/core/nodes/RigidBody.js
|
|
11006
|
-
import { isFunction as
|
|
11973
|
+
import { isFunction as isFunction7, isNumber as isNumber18, isString as isString17 } from "lodash-es";
|
|
11007
11974
|
var _v14 = new Vector3Enhanced();
|
|
11008
11975
|
var _v24 = new Vector3Enhanced();
|
|
11009
11976
|
var _q13 = new three_exports.Quaternion();
|
|
@@ -11012,7 +11979,7 @@ var _m23 = new three_exports.Matrix4();
|
|
|
11012
11979
|
var _m33 = new three_exports.Matrix4();
|
|
11013
11980
|
var _defaultScale2 = new Vector3Enhanced(1, 1, 1);
|
|
11014
11981
|
var types3 = ["static", "kinematic", "dynamic"];
|
|
11015
|
-
var
|
|
11982
|
+
var defaults21 = {
|
|
11016
11983
|
type: "static",
|
|
11017
11984
|
mass: 1,
|
|
11018
11985
|
linearDamping: 0,
|
|
@@ -11164,7 +12131,7 @@ var RigidBody = class extends Node {
|
|
|
11164
12131
|
get type() {
|
|
11165
12132
|
return this._type;
|
|
11166
12133
|
}
|
|
11167
|
-
set type(value =
|
|
12134
|
+
set type(value = defaults21.type) {
|
|
11168
12135
|
if (!isType2(value)) {
|
|
11169
12136
|
throw new Error(`[rigidbody] type invalid: ${value}`);
|
|
11170
12137
|
}
|
|
@@ -11176,8 +12143,8 @@ var RigidBody = class extends Node {
|
|
|
11176
12143
|
get mass() {
|
|
11177
12144
|
return this._mass;
|
|
11178
12145
|
}
|
|
11179
|
-
set mass(value =
|
|
11180
|
-
if (!
|
|
12146
|
+
set mass(value = defaults21.mass) {
|
|
12147
|
+
if (!isNumber18(value)) {
|
|
11181
12148
|
throw new Error("[rigidbody] mass not a number");
|
|
11182
12149
|
}
|
|
11183
12150
|
if (value < 0) {
|
|
@@ -11190,8 +12157,8 @@ var RigidBody = class extends Node {
|
|
|
11190
12157
|
get linearDamping() {
|
|
11191
12158
|
return this._linearDamping;
|
|
11192
12159
|
}
|
|
11193
|
-
set linearDamping(value =
|
|
11194
|
-
if (!
|
|
12160
|
+
set linearDamping(value = defaults21.linearDamping) {
|
|
12161
|
+
if (!isNumber18(value)) {
|
|
11195
12162
|
throw new Error("[rigidbody] linearDamping not a number");
|
|
11196
12163
|
}
|
|
11197
12164
|
if (value < 0) {
|
|
@@ -11204,8 +12171,8 @@ var RigidBody = class extends Node {
|
|
|
11204
12171
|
get angularDamping() {
|
|
11205
12172
|
return this._angularDamping;
|
|
11206
12173
|
}
|
|
11207
|
-
set angularDamping(value =
|
|
11208
|
-
if (!
|
|
12174
|
+
set angularDamping(value = defaults21.angularDamping) {
|
|
12175
|
+
if (!isNumber18(value)) {
|
|
11209
12176
|
throw new Error("[rigidbody] angularDamping not a number");
|
|
11210
12177
|
}
|
|
11211
12178
|
if (value < 0) {
|
|
@@ -11218,11 +12185,11 @@ var RigidBody = class extends Node {
|
|
|
11218
12185
|
get tag() {
|
|
11219
12186
|
return this._tag;
|
|
11220
12187
|
}
|
|
11221
|
-
set tag(value =
|
|
11222
|
-
if (
|
|
12188
|
+
set tag(value = defaults21.tag) {
|
|
12189
|
+
if (isNumber18(value)) {
|
|
11223
12190
|
value = value + "";
|
|
11224
12191
|
}
|
|
11225
|
-
if (value !== null && !
|
|
12192
|
+
if (value !== null && !isString17(value)) {
|
|
11226
12193
|
throw new Error("[rigidbody] tag not a string");
|
|
11227
12194
|
}
|
|
11228
12195
|
this._tag = value;
|
|
@@ -11230,8 +12197,8 @@ var RigidBody = class extends Node {
|
|
|
11230
12197
|
get onContactStart() {
|
|
11231
12198
|
return this._onContactStart;
|
|
11232
12199
|
}
|
|
11233
|
-
set onContactStart(value =
|
|
11234
|
-
if (value !== null && !
|
|
12200
|
+
set onContactStart(value = defaults21.onContactStart) {
|
|
12201
|
+
if (value !== null && !isFunction7(value)) {
|
|
11235
12202
|
throw new Error("[rigidbody] onContactStart not a function");
|
|
11236
12203
|
}
|
|
11237
12204
|
this._onContactStart = value;
|
|
@@ -11239,8 +12206,8 @@ var RigidBody = class extends Node {
|
|
|
11239
12206
|
get onContactEnd() {
|
|
11240
12207
|
return this._onContactEnd;
|
|
11241
12208
|
}
|
|
11242
|
-
set onContactEnd(value =
|
|
11243
|
-
if (value !== null && !
|
|
12209
|
+
set onContactEnd(value = defaults21.onContactEnd) {
|
|
12210
|
+
if (value !== null && !isFunction7(value)) {
|
|
11244
12211
|
throw new Error("[rigidbody] onContactEnd not a function");
|
|
11245
12212
|
}
|
|
11246
12213
|
this._onContactEnd = value;
|
|
@@ -11248,8 +12215,8 @@ var RigidBody = class extends Node {
|
|
|
11248
12215
|
get onTriggerEnter() {
|
|
11249
12216
|
return this._onTriggerEnter;
|
|
11250
12217
|
}
|
|
11251
|
-
set onTriggerEnter(value =
|
|
11252
|
-
if (value !== null && !
|
|
12218
|
+
set onTriggerEnter(value = defaults21.onTriggerEnter) {
|
|
12219
|
+
if (value !== null && !isFunction7(value)) {
|
|
11253
12220
|
throw new Error("[rigidbody] onTriggerEnter not a function");
|
|
11254
12221
|
}
|
|
11255
12222
|
this._onTriggerEnter = value;
|
|
@@ -11257,8 +12224,8 @@ var RigidBody = class extends Node {
|
|
|
11257
12224
|
get onTriggerLeave() {
|
|
11258
12225
|
return this._onTriggerLeave;
|
|
11259
12226
|
}
|
|
11260
|
-
set onTriggerLeave(value =
|
|
11261
|
-
if (value !== null && !
|
|
12227
|
+
set onTriggerLeave(value = defaults21.onTriggerLeave) {
|
|
12228
|
+
if (value !== null && !isFunction7(value)) {
|
|
11262
12229
|
throw new Error("[rigidbody] onTriggerLeave not a function");
|
|
11263
12230
|
}
|
|
11264
12231
|
this._onTriggerLeave = value;
|
|
@@ -11496,8 +12463,8 @@ function isType2(value) {
|
|
|
11496
12463
|
}
|
|
11497
12464
|
|
|
11498
12465
|
// src/core/nodes/Collider.js
|
|
11499
|
-
import { isBoolean as
|
|
11500
|
-
var
|
|
12466
|
+
import { isBoolean as isBoolean19, isNumber as isNumber19 } from "lodash-es";
|
|
12467
|
+
var defaults22 = {
|
|
11501
12468
|
type: "box",
|
|
11502
12469
|
width: 1,
|
|
11503
12470
|
height: 1,
|
|
@@ -11627,7 +12594,7 @@ var Collider = class extends Node {
|
|
|
11627
12594
|
get type() {
|
|
11628
12595
|
return this._type;
|
|
11629
12596
|
}
|
|
11630
|
-
set type(value =
|
|
12597
|
+
set type(value = defaults22.type) {
|
|
11631
12598
|
if (!isType3(value)) {
|
|
11632
12599
|
throw new Error(`[collider] invalid type:`, value);
|
|
11633
12600
|
}
|
|
@@ -11638,8 +12605,8 @@ var Collider = class extends Node {
|
|
|
11638
12605
|
get width() {
|
|
11639
12606
|
return this._width;
|
|
11640
12607
|
}
|
|
11641
|
-
set width(value =
|
|
11642
|
-
if (!
|
|
12608
|
+
set width(value = defaults22.width) {
|
|
12609
|
+
if (!isNumber19(value)) {
|
|
11643
12610
|
throw new Error("[collider] width not a number");
|
|
11644
12611
|
}
|
|
11645
12612
|
this._width = value;
|
|
@@ -11651,8 +12618,8 @@ var Collider = class extends Node {
|
|
|
11651
12618
|
get height() {
|
|
11652
12619
|
return this._height;
|
|
11653
12620
|
}
|
|
11654
|
-
set height(value =
|
|
11655
|
-
if (!
|
|
12621
|
+
set height(value = defaults22.height) {
|
|
12622
|
+
if (!isNumber19(value)) {
|
|
11656
12623
|
throw new Error("[collider] height not a number");
|
|
11657
12624
|
}
|
|
11658
12625
|
this._height = value;
|
|
@@ -11664,8 +12631,8 @@ var Collider = class extends Node {
|
|
|
11664
12631
|
get depth() {
|
|
11665
12632
|
return this._depth;
|
|
11666
12633
|
}
|
|
11667
|
-
set depth(value =
|
|
11668
|
-
if (!
|
|
12634
|
+
set depth(value = defaults22.depth) {
|
|
12635
|
+
if (!isNumber19(value)) {
|
|
11669
12636
|
throw new Error("[collider] depth not a number");
|
|
11670
12637
|
}
|
|
11671
12638
|
this._depth = value;
|
|
@@ -11682,8 +12649,8 @@ var Collider = class extends Node {
|
|
|
11682
12649
|
get radius() {
|
|
11683
12650
|
return this._radius;
|
|
11684
12651
|
}
|
|
11685
|
-
set radius(value =
|
|
11686
|
-
if (!
|
|
12652
|
+
set radius(value = defaults22.radius) {
|
|
12653
|
+
if (!isNumber19(value)) {
|
|
11687
12654
|
throw new Error("[collider] radius not a number");
|
|
11688
12655
|
}
|
|
11689
12656
|
this._radius = value;
|
|
@@ -11695,7 +12662,7 @@ var Collider = class extends Node {
|
|
|
11695
12662
|
get geometry() {
|
|
11696
12663
|
return secureRef({}, () => this._geometry);
|
|
11697
12664
|
}
|
|
11698
|
-
set geometry(value =
|
|
12665
|
+
set geometry(value = defaults22.geometry) {
|
|
11699
12666
|
this._geometry = getRef(value);
|
|
11700
12667
|
this.needsRebuild = true;
|
|
11701
12668
|
this.setDirty();
|
|
@@ -11703,8 +12670,8 @@ var Collider = class extends Node {
|
|
|
11703
12670
|
get convex() {
|
|
11704
12671
|
return this._convex;
|
|
11705
12672
|
}
|
|
11706
|
-
set convex(value =
|
|
11707
|
-
if (!
|
|
12673
|
+
set convex(value = defaults22.convex) {
|
|
12674
|
+
if (!isBoolean19(value)) {
|
|
11708
12675
|
throw new Error("[collider] convex not a boolean");
|
|
11709
12676
|
}
|
|
11710
12677
|
this._convex = value;
|
|
@@ -11716,8 +12683,8 @@ var Collider = class extends Node {
|
|
|
11716
12683
|
get trigger() {
|
|
11717
12684
|
return this._trigger;
|
|
11718
12685
|
}
|
|
11719
|
-
set trigger(value =
|
|
11720
|
-
if (!
|
|
12686
|
+
set trigger(value = defaults22.trigger) {
|
|
12687
|
+
if (!isBoolean19(value)) {
|
|
11721
12688
|
throw new Error("[collider] trigger not a boolean");
|
|
11722
12689
|
}
|
|
11723
12690
|
this._trigger = value;
|
|
@@ -11729,7 +12696,7 @@ var Collider = class extends Node {
|
|
|
11729
12696
|
get layer() {
|
|
11730
12697
|
return this._layer;
|
|
11731
12698
|
}
|
|
11732
|
-
set layer(value =
|
|
12699
|
+
set layer(value = defaults22.layer) {
|
|
11733
12700
|
if (!isLayer2(value)) {
|
|
11734
12701
|
throw new Error(`[collider] invalid layer: ${value}`);
|
|
11735
12702
|
}
|
|
@@ -11742,8 +12709,8 @@ var Collider = class extends Node {
|
|
|
11742
12709
|
get staticFriction() {
|
|
11743
12710
|
return this._staticFriction;
|
|
11744
12711
|
}
|
|
11745
|
-
set staticFriction(value =
|
|
11746
|
-
if (!
|
|
12712
|
+
set staticFriction(value = defaults22.staticFriction) {
|
|
12713
|
+
if (!isNumber19(value)) {
|
|
11747
12714
|
throw new Error("[collider] staticFriction not a number");
|
|
11748
12715
|
}
|
|
11749
12716
|
this._staticFriction = value;
|
|
@@ -11755,8 +12722,8 @@ var Collider = class extends Node {
|
|
|
11755
12722
|
get dynamicFriction() {
|
|
11756
12723
|
return this._dynamicFriction;
|
|
11757
12724
|
}
|
|
11758
|
-
set dynamicFriction(value =
|
|
11759
|
-
if (!
|
|
12725
|
+
set dynamicFriction(value = defaults22.dynamicFriction) {
|
|
12726
|
+
if (!isNumber19(value)) {
|
|
11760
12727
|
throw new Error("[collider] dynamicFriction not a number");
|
|
11761
12728
|
}
|
|
11762
12729
|
this._dynamicFriction = value;
|
|
@@ -11768,8 +12735,8 @@ var Collider = class extends Node {
|
|
|
11768
12735
|
get restitution() {
|
|
11769
12736
|
return this._restitution;
|
|
11770
12737
|
}
|
|
11771
|
-
set restitution(value =
|
|
11772
|
-
if (!
|
|
12738
|
+
set restitution(value = defaults22.restitution) {
|
|
12739
|
+
if (!isNumber19(value)) {
|
|
11773
12740
|
throw new Error("[collider] restitution not a number");
|
|
11774
12741
|
}
|
|
11775
12742
|
this._restitution = value;
|
|
@@ -11890,7 +12857,7 @@ function isLayer2(value) {
|
|
|
11890
12857
|
}
|
|
11891
12858
|
|
|
11892
12859
|
// src/core/nodes/Joint.js
|
|
11893
|
-
import { isBoolean as
|
|
12860
|
+
import { isBoolean as isBoolean20, isNumber as isNumber20 } from "lodash-es";
|
|
11894
12861
|
|
|
11895
12862
|
// src/core/extras/bindRotations.js
|
|
11896
12863
|
function bindRotations(quaternion, euler) {
|
|
@@ -11905,7 +12872,7 @@ function bindRotations(quaternion, euler) {
|
|
|
11905
12872
|
// src/core/nodes/Joint.js
|
|
11906
12873
|
var _q15 = new three_exports.Quaternion();
|
|
11907
12874
|
var _q2 = new three_exports.Quaternion();
|
|
11908
|
-
var
|
|
12875
|
+
var defaults23 = {
|
|
11909
12876
|
type: "fixed",
|
|
11910
12877
|
body0: null,
|
|
11911
12878
|
body1: null,
|
|
@@ -11924,7 +12891,7 @@ var Joint = class extends Node {
|
|
|
11924
12891
|
constructor(data = {}) {
|
|
11925
12892
|
super(data);
|
|
11926
12893
|
this.name = "joint";
|
|
11927
|
-
this.type = data.type ||
|
|
12894
|
+
this.type = data.type || defaults23.type;
|
|
11928
12895
|
this.body0 = null;
|
|
11929
12896
|
this.offset0 = new Vector3Enhanced(0, 0, 0);
|
|
11930
12897
|
this.quaternion0 = new three_exports.Quaternion(0, 0, 0, 1);
|
|
@@ -11935,16 +12902,16 @@ var Joint = class extends Node {
|
|
|
11935
12902
|
this.quaternion1 = new three_exports.Quaternion(0, 0, 0, 1);
|
|
11936
12903
|
this.rotation1 = new three_exports.Euler(0, 0, 0, "YXZ");
|
|
11937
12904
|
bindRotations(this.quaternion1, this.rotation1);
|
|
11938
|
-
this.breakForce =
|
|
11939
|
-
this.breakTorque =
|
|
12905
|
+
this.breakForce = isNumber20(data.breakForce) ? data.breakForce : defaults23.breakForce;
|
|
12906
|
+
this.breakTorque = isNumber20(data.breakTorque) ? data.breakTorque : defaults23.breakTorque;
|
|
11940
12907
|
this.axis = new Vector3Enhanced(0, 1, 0);
|
|
11941
|
-
this.limitY =
|
|
11942
|
-
this.limitZ =
|
|
11943
|
-
this.limitMin =
|
|
11944
|
-
this.limitMax =
|
|
11945
|
-
this.limitStiffness =
|
|
11946
|
-
this.limitDamping =
|
|
11947
|
-
this.collide =
|
|
12908
|
+
this.limitY = isNumber20(data.limitY) ? data.limitY : defaults23.limitY;
|
|
12909
|
+
this.limitZ = isNumber20(data.limitZ) ? data.limitZ : defaults23.limitZ;
|
|
12910
|
+
this.limitMin = isNumber20(data.limitMin) ? data.limitMin : defaults23.limitMin;
|
|
12911
|
+
this.limitMax = isNumber20(data.limitMax) ? data.limitMax : defaults23.limitMax;
|
|
12912
|
+
this.limitStiffness = isNumber20(data.limitStiffness) ? data.limitStiffness : defaults23.limitStiffness;
|
|
12913
|
+
this.limitDamping = isNumber20(data.limitDamping) ? data.limitDamping : defaults23.limitDamping;
|
|
12914
|
+
this.collide = isBoolean20(data.collide) ? data.collide : defaults23.collide;
|
|
11948
12915
|
this.frame0 = new PHYSX.PxTransform(PHYSX.PxIDENTITYEnum.PxIdentity);
|
|
11949
12916
|
this.frame1 = new PHYSX.PxTransform(PHYSX.PxIDENTITYEnum.PxIdentity);
|
|
11950
12917
|
}
|
|
@@ -11968,9 +12935,9 @@ var Joint = class extends Node {
|
|
|
11968
12935
|
_q15.copy(this.quaternion0).multiply(alignRotation).toPxTransform(frame0);
|
|
11969
12936
|
_q2.copy(this.quaternion1).multiply(alignRotation).toPxTransform(frame1);
|
|
11970
12937
|
this.joint = new PHYSX.SphericalJointCreate(this.ctx.world.physics.physics, actor0, frame0, actor1, frame1);
|
|
11971
|
-
if (
|
|
12938
|
+
if (isNumber20(this.limitY) && isNumber20(this.limitZ)) {
|
|
11972
12939
|
let spring;
|
|
11973
|
-
if (
|
|
12940
|
+
if (isNumber20(this.limitStiffness) && isNumber20(this.limitDamping)) {
|
|
11974
12941
|
spring = new PHYSX.PxSpring(this.limitStiffness, this.limitDamping);
|
|
11975
12942
|
}
|
|
11976
12943
|
const cone = new PHYSX.PxJointLimitCone(this.limitY * DEG2RAD, this.limitZ * DEG2RAD, spring);
|
|
@@ -11987,9 +12954,9 @@ var Joint = class extends Node {
|
|
|
11987
12954
|
_q15.copy(this.quaternion0).multiply(alignRotation).toPxTransform(frame0);
|
|
11988
12955
|
_q2.copy(this.quaternion1).multiply(alignRotation).toPxTransform(frame1);
|
|
11989
12956
|
this.joint = new PHYSX.RevoluteJointCreate(this.ctx.world.physics.physics, actor0, frame0, actor1, frame1);
|
|
11990
|
-
if (
|
|
12957
|
+
if (isNumber20(this.limitMin) && isNumber20(this.limitMax)) {
|
|
11991
12958
|
let spring;
|
|
11992
|
-
if (
|
|
12959
|
+
if (isNumber20(this.limitStiffness) && isNumber20(this.limitDamping)) {
|
|
11993
12960
|
spring = new PHYSX.PxSpring(this.limitStiffness, this.limitDamping);
|
|
11994
12961
|
}
|
|
11995
12962
|
const limit = new PHYSX.PxJointAngularLimitPair(this.limitMin * DEG2RAD, this.limitMax * DEG2RAD, spring);
|
|
@@ -12007,7 +12974,7 @@ var Joint = class extends Node {
|
|
|
12007
12974
|
this.joint.setMaxDistance(this.limitMax);
|
|
12008
12975
|
this.joint.setDistanceJointFlag(PHYSX.PxDistanceJointFlagEnum.eMIN_DISTANCE_ENABLED, true);
|
|
12009
12976
|
this.joint.setDistanceJointFlag(PHYSX.PxDistanceJointFlagEnum.eMAX_DISTANCE_ENABLED, true);
|
|
12010
|
-
if (
|
|
12977
|
+
if (isNumber20(this.limitStiffness) && isNumber20(this.limitDamping)) {
|
|
12011
12978
|
this.joint.setStiffness(this.limitStiffness);
|
|
12012
12979
|
this.joint.setDamping(this.limitDamping);
|
|
12013
12980
|
this.joint.setDistanceJointFlag(PHYSX.PxDistanceJointFlagEnum.eSPRING_ENABLED, true);
|
|
@@ -12117,7 +13084,7 @@ var Joint = class extends Node {
|
|
|
12117
13084
|
return self2.breakForce;
|
|
12118
13085
|
},
|
|
12119
13086
|
set breakForce(value) {
|
|
12120
|
-
self2.breakForce =
|
|
13087
|
+
self2.breakForce = isNumber20(value) ? value : defaults23.breakForce;
|
|
12121
13088
|
self2.needsRebuild = true;
|
|
12122
13089
|
self2.setDirty();
|
|
12123
13090
|
},
|
|
@@ -12125,7 +13092,7 @@ var Joint = class extends Node {
|
|
|
12125
13092
|
return self2.breakTorque;
|
|
12126
13093
|
},
|
|
12127
13094
|
set breakTorque(value) {
|
|
12128
|
-
self2.breakTorque =
|
|
13095
|
+
self2.breakTorque = isNumber20(value) ? value : defaults23.breakTorque;
|
|
12129
13096
|
self2.needsRebuild = true;
|
|
12130
13097
|
self2.setDirty();
|
|
12131
13098
|
},
|
|
@@ -12367,9 +13334,6 @@ function createPlayerProxy(entity, player) {
|
|
|
12367
13334
|
get destroyed() {
|
|
12368
13335
|
return !!player.destroyed;
|
|
12369
13336
|
},
|
|
12370
|
-
get evm() {
|
|
12371
|
-
return player.data.evm;
|
|
12372
|
-
},
|
|
12373
13337
|
teleport(position2, rotationY) {
|
|
12374
13338
|
if (player.data.owner === world2.network.id) {
|
|
12375
13339
|
world2.network.enqueue("onPlayerTeleport", { position: position2.toArray(), rotationY });
|
|
@@ -12494,12 +13458,6 @@ function createPlayerProxy(entity, player) {
|
|
|
12494
13458
|
if (voiceMod) {
|
|
12495
13459
|
voiceMod = world2.livekit.removeModifier(voiceMod);
|
|
12496
13460
|
}
|
|
12497
|
-
},
|
|
12498
|
-
connect() {
|
|
12499
|
-
return world2.evm.connect(player);
|
|
12500
|
-
},
|
|
12501
|
-
disconnect() {
|
|
12502
|
-
return world2.evm.disconnect(player);
|
|
12503
13461
|
}
|
|
12504
13462
|
};
|
|
12505
13463
|
}
|
|
@@ -12535,6 +13493,9 @@ var App = class extends Entity {
|
|
|
12535
13493
|
constructor(world2, data, local) {
|
|
12536
13494
|
super(world2, data, local);
|
|
12537
13495
|
this.isApp = true;
|
|
13496
|
+
if (!this.data.props || typeof this.data.props !== "object" || isArray8(this.data.props)) {
|
|
13497
|
+
this.data.props = {};
|
|
13498
|
+
}
|
|
12538
13499
|
this.n = 0;
|
|
12539
13500
|
this.worldNodes = /* @__PURE__ */ new Set();
|
|
12540
13501
|
this.hotEvents = 0;
|
|
@@ -12544,6 +13505,7 @@ var App = class extends Entity {
|
|
|
12544
13505
|
this.snaps = [];
|
|
12545
13506
|
this.root = createNode("group");
|
|
12546
13507
|
this.fields = [];
|
|
13508
|
+
this.effectiveProps = void 0;
|
|
12547
13509
|
this.target = null;
|
|
12548
13510
|
this.projectLimit = Infinity;
|
|
12549
13511
|
this.resetOnMove = false;
|
|
@@ -12559,6 +13521,21 @@ var App = class extends Entity {
|
|
|
12559
13521
|
const node = createNode(name, data);
|
|
12560
13522
|
return node;
|
|
12561
13523
|
}
|
|
13524
|
+
computeEffectiveProps() {
|
|
13525
|
+
const blueprintProps = this.blueprint?.props ?? null;
|
|
13526
|
+
const entityProps = this.data.props;
|
|
13527
|
+
const hasOverrides = entityProps && typeof entityProps === "object" && !isArray8(entityProps) && Object.keys(entityProps).length > 0;
|
|
13528
|
+
if (hasOverrides) {
|
|
13529
|
+
return merge3({}, blueprintProps || {}, entityProps);
|
|
13530
|
+
}
|
|
13531
|
+
return blueprintProps;
|
|
13532
|
+
}
|
|
13533
|
+
getEffectiveProps() {
|
|
13534
|
+
if (this.effectiveProps === void 0) {
|
|
13535
|
+
this.effectiveProps = this.computeEffectiveProps();
|
|
13536
|
+
}
|
|
13537
|
+
return this.effectiveProps;
|
|
13538
|
+
}
|
|
12562
13539
|
async build(crashed) {
|
|
12563
13540
|
this.building = true;
|
|
12564
13541
|
const n2 = ++this.n;
|
|
@@ -12608,6 +13585,7 @@ var App = class extends Entity {
|
|
|
12608
13585
|
if (this.data.mover) this.mode = Modes.MOVING;
|
|
12609
13586
|
if (this.data.uploader && this.data.uploader !== this.world.network.id) this.mode = Modes.LOADING;
|
|
12610
13587
|
this.blueprint = blueprint;
|
|
13588
|
+
this.effectiveProps = this.computeEffectiveProps();
|
|
12611
13589
|
this.root = root;
|
|
12612
13590
|
if (!blueprint.scene) {
|
|
12613
13591
|
this.root.position.fromArray(this.data.position);
|
|
@@ -12621,7 +13599,7 @@ var App = class extends Entity {
|
|
|
12621
13599
|
if (runScript) {
|
|
12622
13600
|
this.abortController = new AbortController();
|
|
12623
13601
|
try {
|
|
12624
|
-
this.script.exec(this.getWorldProxy(), this.getAppProxy(), this.fetch,
|
|
13602
|
+
this.script.exec(this.getWorldProxy(), this.getAppProxy(), this.fetch, this.effectiveProps, this.setTimeout);
|
|
12625
13603
|
this.scriptError = null;
|
|
12626
13604
|
} catch (err) {
|
|
12627
13605
|
this.scriptError = serializeError(err);
|
|
@@ -12773,6 +13751,14 @@ var App = class extends Entity {
|
|
|
12773
13751
|
this.data.state = data.state;
|
|
12774
13752
|
rebuild = true;
|
|
12775
13753
|
}
|
|
13754
|
+
if (data.hasOwnProperty("props")) {
|
|
13755
|
+
if (data.props && typeof data.props === "object" && !isArray8(data.props)) {
|
|
13756
|
+
this.data.props = data.props;
|
|
13757
|
+
} else {
|
|
13758
|
+
this.data.props = {};
|
|
13759
|
+
}
|
|
13760
|
+
rebuild = true;
|
|
13761
|
+
}
|
|
12776
13762
|
if (rebuild) {
|
|
12777
13763
|
this.build();
|
|
12778
13764
|
}
|
|
@@ -12968,7 +13954,7 @@ import { XRControllerModelFactory } from "three/addons";
|
|
|
12968
13954
|
|
|
12969
13955
|
// src/core/extras/simpleCamLerp.js
|
|
12970
13956
|
var BACKWARD = new Vector3Enhanced(0, 0, 1);
|
|
12971
|
-
var
|
|
13957
|
+
var v18 = new Vector3Enhanced();
|
|
12972
13958
|
var sweepGeometry;
|
|
12973
13959
|
var smoothing = 20;
|
|
12974
13960
|
function simpleCamLerp(world2, camera, target, delta) {
|
|
@@ -12977,7 +13963,7 @@ function simpleCamLerp(world2, camera, target, delta) {
|
|
|
12977
13963
|
camera.position.copy(target.position);
|
|
12978
13964
|
if (!sweepGeometry) sweepGeometry = new PHYSX.PxSphereGeometry(0.2);
|
|
12979
13965
|
const origin = camera.position;
|
|
12980
|
-
const direction =
|
|
13966
|
+
const direction = v18.copy(BACKWARD).applyQuaternion(camera.quaternion);
|
|
12981
13967
|
const layerMask = Layers.camera.mask;
|
|
12982
13968
|
const hit = world2.physics.sweep(sweepGeometry, origin, direction, 200, layerMask);
|
|
12983
13969
|
let distance = target.zoom;
|
|
@@ -13024,7 +14010,7 @@ var emoteUrls = [
|
|
|
13024
14010
|
];
|
|
13025
14011
|
|
|
13026
14012
|
// src/core/entities/PlayerLocal.js
|
|
13027
|
-
import { isBoolean as
|
|
14013
|
+
import { isBoolean as isBoolean21, isNumber as isNumber22 } from "lodash-es";
|
|
13028
14014
|
var UP = new Vector3Enhanced(0, 1, 0);
|
|
13029
14015
|
var DOWN = new Vector3Enhanced(0, -1, 0);
|
|
13030
14016
|
var FORWARD2 = new Vector3Enhanced(0, 0, -1);
|
|
@@ -13038,7 +14024,7 @@ var MAX_ZOOM = 8;
|
|
|
13038
14024
|
var STICK_OUTER_RADIUS = 50;
|
|
13039
14025
|
var STICK_INNER_RADIUS = 25;
|
|
13040
14026
|
var DEFAULT_CAM_HEIGHT = 1.2;
|
|
13041
|
-
var
|
|
14027
|
+
var v19 = new Vector3Enhanced();
|
|
13042
14028
|
var v25 = new Vector3Enhanced();
|
|
13043
14029
|
var v32 = new Vector3Enhanced();
|
|
13044
14030
|
var v42 = new Vector3Enhanced();
|
|
@@ -13203,8 +14189,8 @@ var PlayerLocal = class extends Entity {
|
|
|
13203
14189
|
const localPose = new PHYSX.PxTransform(PHYSX.PxIDENTITYEnum.PxIdentity);
|
|
13204
14190
|
q14.set(0, 0, 0).setFromAxisAngle(BACKWARD2, Math.PI / 2);
|
|
13205
14191
|
q14.toPxTransform(localPose);
|
|
13206
|
-
|
|
13207
|
-
|
|
14192
|
+
v19.set(0, halfHeight + radius, 0);
|
|
14193
|
+
v19.toPxTransform(localPose);
|
|
13208
14194
|
shape.setLocalPose(localPose);
|
|
13209
14195
|
const filterData = new PHYSX.PxFilterData(
|
|
13210
14196
|
Layers.player.group,
|
|
@@ -13216,7 +14202,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13216
14202
|
shape.setQueryFilterData(filterData);
|
|
13217
14203
|
shape.setSimulationFilterData(filterData);
|
|
13218
14204
|
const transform = new PHYSX.PxTransform(PHYSX.PxIDENTITYEnum.PxIdentity);
|
|
13219
|
-
|
|
14205
|
+
v19.copy(this.base.position).toPxTransform(transform);
|
|
13220
14206
|
q14.set(0, 0, 0, 1).toPxTransform(transform);
|
|
13221
14207
|
this.capsule = this.world.physics.physics.createRigidDynamic(transform);
|
|
13222
14208
|
this.capsule.setMass(this.mass);
|
|
@@ -13296,7 +14282,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13296
14282
|
const child = this.world.camera;
|
|
13297
14283
|
const feetWorldPos = child.getWorldPosition(v25);
|
|
13298
14284
|
feetWorldPos.y -= child.position.y;
|
|
13299
|
-
const offset =
|
|
14285
|
+
const offset = v19.subVectors(position, feetWorldPos);
|
|
13300
14286
|
parent.position.add(offset);
|
|
13301
14287
|
}
|
|
13302
14288
|
turnXRRigAtPlayer(degrees) {
|
|
@@ -13310,7 +14296,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13310
14296
|
parent.position.copy(pivotWorld).sub(offset);
|
|
13311
14297
|
}
|
|
13312
14298
|
toggleFlying(value) {
|
|
13313
|
-
value =
|
|
14299
|
+
value = isBoolean21(value) ? value : !this.flying;
|
|
13314
14300
|
if (this.flying === value) return;
|
|
13315
14301
|
this.flying = value;
|
|
13316
14302
|
if (this.flying) {
|
|
@@ -13360,7 +14346,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13360
14346
|
} else if (!this.flying) {
|
|
13361
14347
|
if (this.grounded) {
|
|
13362
14348
|
const pose = this.capsule.getGlobalPose();
|
|
13363
|
-
const origin =
|
|
14349
|
+
const origin = v19.copy(pose.p);
|
|
13364
14350
|
origin.y += 0.2;
|
|
13365
14351
|
const hitMask = Layers.environment.group | Layers.prop.group;
|
|
13366
14352
|
const hit = this.world.physics.raycast(origin, DOWN, 2, hitMask);
|
|
@@ -13369,17 +14355,17 @@ var PlayerLocal = class extends Entity {
|
|
|
13369
14355
|
this.platform.actor = actor;
|
|
13370
14356
|
if (actor) {
|
|
13371
14357
|
const platformPose = this.platform.actor.getGlobalPose();
|
|
13372
|
-
|
|
14358
|
+
v19.copy(platformPose.p);
|
|
13373
14359
|
q14.copy(platformPose.q);
|
|
13374
|
-
this.platform.prevTransform.compose(
|
|
14360
|
+
this.platform.prevTransform.compose(v19, q14, SCALE_IDENTITY);
|
|
13375
14361
|
}
|
|
13376
14362
|
}
|
|
13377
14363
|
if (this.platform.actor) {
|
|
13378
14364
|
const currTransform = m13;
|
|
13379
14365
|
const platformPose = this.platform.actor.getGlobalPose();
|
|
13380
|
-
|
|
14366
|
+
v19.copy(platformPose.p);
|
|
13381
14367
|
q14.copy(platformPose.q);
|
|
13382
|
-
currTransform.compose(
|
|
14368
|
+
currTransform.compose(v19, q14, SCALE_IDENTITY);
|
|
13383
14369
|
const deltaTransform = m2.multiplyMatrices(currTransform, this.platform.prevTransform.clone().invert());
|
|
13384
14370
|
const deltaPosition = v25;
|
|
13385
14371
|
const deltaQuaternion = q22;
|
|
@@ -13412,7 +14398,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13412
14398
|
{
|
|
13413
14399
|
const geometry = this.groundSweepGeometry;
|
|
13414
14400
|
const pose = this.capsule.getGlobalPose();
|
|
13415
|
-
const origin =
|
|
14401
|
+
const origin = v19.copy(
|
|
13416
14402
|
pose.p
|
|
13417
14403
|
/*this.ghost.position*/
|
|
13418
14404
|
);
|
|
@@ -13489,7 +14475,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13489
14475
|
const isKinematic = this.platform.actor.getRigidBodyFlags?.().isSet(PHYSX.PxRigidBodyFlagEnum.eKINEMATIC);
|
|
13490
14476
|
if (!isKinematic && !isStatic) {
|
|
13491
14477
|
const amount = -9.81 * 0.2;
|
|
13492
|
-
const force =
|
|
14478
|
+
const force = v19.set(0, amount, 0);
|
|
13493
14479
|
PHYSX.PxRigidBodyExt.prototype.addForceAtPos(
|
|
13494
14480
|
this.platform.actor,
|
|
13495
14481
|
force.toPxVec3(),
|
|
@@ -13500,10 +14486,10 @@ var PlayerLocal = class extends Entity {
|
|
|
13500
14486
|
}
|
|
13501
14487
|
}
|
|
13502
14488
|
} else {
|
|
13503
|
-
const force =
|
|
14489
|
+
const force = v19.set(0, -this.effectiveGravity, 0);
|
|
13504
14490
|
this.capsule.addForce(force.toPxVec3(), PHYSX.PxForceModeEnum.eFORCE, true);
|
|
13505
14491
|
}
|
|
13506
|
-
const velocity =
|
|
14492
|
+
const velocity = v19.copy(this.capsule.getLinearVelocity());
|
|
13507
14493
|
const dragCoeff = 10 * delta;
|
|
13508
14494
|
let perpComponent = v25.copy(this.groundNormal).multiplyScalar(velocity.dot(this.groundNormal));
|
|
13509
14495
|
let parallelComponent = v32.copy(velocity).sub(perpComponent);
|
|
@@ -13548,7 +14534,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13548
14534
|
let moveSpeed = (this.running ? 6 : 3) * this.mass;
|
|
13549
14535
|
moveSpeed *= 1 - snare;
|
|
13550
14536
|
const slopeRotation = q14.setFromUnitVectors(UP, this.groundNormal);
|
|
13551
|
-
const moveForce =
|
|
14537
|
+
const moveForce = v19.copy(this.moveDir).multiplyScalar(moveSpeed * 10).applyQuaternion(slopeRotation);
|
|
13552
14538
|
this.capsule.addForce(moveForce.toPxVec3(), PHYSX.PxForceModeEnum.eFORCE, true);
|
|
13553
14539
|
}
|
|
13554
14540
|
const shouldJump = this.grounded && !this.jumping && this.jumpDown && !this.data.effect?.snare && !this.data.effect?.freeze;
|
|
@@ -13573,7 +14559,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13573
14559
|
} else {
|
|
13574
14560
|
if (this.moving || this.jumpDown || this.control.keyC.down) {
|
|
13575
14561
|
const flySpeed = this.flyForce * (this.running ? 2 : 1);
|
|
13576
|
-
const force =
|
|
14562
|
+
const force = v19.copy(this.flyDir).multiplyScalar(flySpeed);
|
|
13577
14563
|
if (this.jumpDown) {
|
|
13578
14564
|
force.y = flySpeed;
|
|
13579
14565
|
} else if (this.control.keyC.down) {
|
|
@@ -13604,11 +14590,11 @@ var PlayerLocal = class extends Entity {
|
|
|
13604
14590
|
const anchor = this.getAnchorMatrix();
|
|
13605
14591
|
if (xr) {
|
|
13606
14592
|
this.setXRPlayerPosition(this.base.position);
|
|
13607
|
-
this.world.camera.getWorldPosition(
|
|
13608
|
-
|
|
14593
|
+
this.world.camera.getWorldPosition(v19);
|
|
14594
|
+
v19.y = 0;
|
|
13609
14595
|
v25.copy(this.xrRig.position);
|
|
13610
14596
|
v25.y = 0;
|
|
13611
|
-
v32.copy(
|
|
14597
|
+
v32.copy(v19).sub(v25);
|
|
13612
14598
|
this.hmdDelta.copy(v32).sub(this.hmdLast);
|
|
13613
14599
|
this.hmdLast.copy(v32);
|
|
13614
14600
|
const pose = this.capsule.getGlobalPose();
|
|
@@ -13627,11 +14613,11 @@ var PlayerLocal = class extends Entity {
|
|
|
13627
14613
|
this.didSnapTurn = true;
|
|
13628
14614
|
}
|
|
13629
14615
|
if (this.didSnapTurn) {
|
|
13630
|
-
this.world.camera.getWorldPosition(
|
|
13631
|
-
|
|
14616
|
+
this.world.camera.getWorldPosition(v19);
|
|
14617
|
+
v19.y = 0;
|
|
13632
14618
|
v25.copy(this.xrRig.position);
|
|
13633
14619
|
v25.y = 0;
|
|
13634
|
-
v32.copy(
|
|
14620
|
+
v32.copy(v19).sub(v25);
|
|
13635
14621
|
this.hmdLast.copy(v32);
|
|
13636
14622
|
}
|
|
13637
14623
|
} else if (this.control.pointer.locked) {
|
|
@@ -13780,8 +14766,8 @@ var PlayerLocal = class extends Entity {
|
|
|
13780
14766
|
} else {
|
|
13781
14767
|
this.gaze.copy(FORWARD2).applyQuaternion(this.cam.quaternion);
|
|
13782
14768
|
if (!this.firstPerson) {
|
|
13783
|
-
|
|
13784
|
-
this.gaze.applyAxisAngle(
|
|
14769
|
+
v19.copy(gazeTiltAxis).applyQuaternion(this.cam.quaternion);
|
|
14770
|
+
this.gaze.applyAxisAngle(v19, gazeTiltAngle);
|
|
13785
14771
|
}
|
|
13786
14772
|
}
|
|
13787
14773
|
if (xr) {
|
|
@@ -13862,7 +14848,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13862
14848
|
} else {
|
|
13863
14849
|
this.cam.position.y += this.camHeight;
|
|
13864
14850
|
if (!this.firstPerson) {
|
|
13865
|
-
const forward =
|
|
14851
|
+
const forward = v19.copy(FORWARD2).applyQuaternion(this.cam.quaternion);
|
|
13866
14852
|
const right = v25.crossVectors(forward, UP).normalize();
|
|
13867
14853
|
this.cam.position.add(right.multiplyScalar(0.3));
|
|
13868
14854
|
}
|
|
@@ -13878,7 +14864,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13878
14864
|
}
|
|
13879
14865
|
teleport({ position, rotationY }) {
|
|
13880
14866
|
position = position.isVector3 ? position : new Vector3Enhanced().fromArray(position);
|
|
13881
|
-
const hasRotation =
|
|
14867
|
+
const hasRotation = isNumber22(rotationY);
|
|
13882
14868
|
const pose = this.capsule.getGlobalPose();
|
|
13883
14869
|
position.toPxTransform(pose);
|
|
13884
14870
|
this.capsuleHandle.snap(pose);
|
|
@@ -13916,7 +14902,7 @@ var PlayerLocal = class extends Entity {
|
|
|
13916
14902
|
this.speaking = speaking;
|
|
13917
14903
|
}
|
|
13918
14904
|
push(force) {
|
|
13919
|
-
force =
|
|
14905
|
+
force = v19.fromArray(force);
|
|
13920
14906
|
if (this.pushForce) {
|
|
13921
14907
|
this.pushForce.add(force);
|
|
13922
14908
|
} else {
|
|
@@ -13985,11 +14971,6 @@ var PlayerLocal = class extends Entity {
|
|
|
13985
14971
|
if (avatarChanged) {
|
|
13986
14972
|
this.applyAvatar();
|
|
13987
14973
|
}
|
|
13988
|
-
if (data.hasOwnProperty("evm")) {
|
|
13989
|
-
this.data.evm = data.evm;
|
|
13990
|
-
this.world.network.send("entityModified", { id: this.data.id, ...data });
|
|
13991
|
-
this.world.events.emit("evm", { playerId: this.data.id, evm: data.evm });
|
|
13992
|
-
}
|
|
13993
14974
|
if (changed) {
|
|
13994
14975
|
this.world.emit("player", this);
|
|
13995
14976
|
}
|
|
@@ -14360,13 +15341,6 @@ var PlayerRemote = class extends Entity {
|
|
|
14360
15341
|
this.data.rank = data.rank;
|
|
14361
15342
|
this.world.emit("rank", { playerId: this.data.id, rank: this.data.rank });
|
|
14362
15343
|
}
|
|
14363
|
-
if (data.hasOwnProperty("evm")) {
|
|
14364
|
-
this.data.evm = data.evm;
|
|
14365
|
-
this.world.events.emit("evm", { playerId: this.data.id, evm: data.evm });
|
|
14366
|
-
}
|
|
14367
|
-
if (data.hasOwnProperty("roles")) {
|
|
14368
|
-
this.data.roles = data.roles;
|
|
14369
|
-
}
|
|
14370
15344
|
if (avatarChanged) {
|
|
14371
15345
|
this.applyAvatar();
|
|
14372
15346
|
}
|
|
@@ -14398,6 +15372,161 @@ var PlayerRemote = class extends Entity {
|
|
|
14398
15372
|
}
|
|
14399
15373
|
};
|
|
14400
15374
|
|
|
15375
|
+
// src/core/entities/AdminPlayerRemote.js
|
|
15376
|
+
var AdminPlayerRemote = class extends Entity {
|
|
15377
|
+
constructor(world2, data, local) {
|
|
15378
|
+
super(world2, data, local);
|
|
15379
|
+
this.isPlayer = true;
|
|
15380
|
+
this.isRemote = true;
|
|
15381
|
+
this.init();
|
|
15382
|
+
}
|
|
15383
|
+
async init() {
|
|
15384
|
+
this.base = createNode("group");
|
|
15385
|
+
this.base.position.fromArray(this.data.position || [0, 0, 0]);
|
|
15386
|
+
this.base.quaternion.fromArray(this.data.quaternion || [0, 0, 0, 1]);
|
|
15387
|
+
this.enteredAt = this.data.enteredAt;
|
|
15388
|
+
this.aura = createNode("group");
|
|
15389
|
+
this.nametag = createNode("nametag", { label: this.data.name || "", health: this.data.health, active: false });
|
|
15390
|
+
this.aura.add(this.nametag);
|
|
15391
|
+
this.bubble = createNode("ui", {
|
|
15392
|
+
width: 300,
|
|
15393
|
+
height: 512,
|
|
15394
|
+
pivot: "bottom-center",
|
|
15395
|
+
billboard: "full",
|
|
15396
|
+
scaler: [3, 30],
|
|
15397
|
+
justifyContent: "flex-end",
|
|
15398
|
+
alignItems: "center",
|
|
15399
|
+
active: false
|
|
15400
|
+
});
|
|
15401
|
+
this.bubbleBox = createNode("uiview", {
|
|
15402
|
+
backgroundColor: "rgba(0, 0, 0, 0.8)",
|
|
15403
|
+
borderRadius: 10,
|
|
15404
|
+
padding: 10
|
|
15405
|
+
});
|
|
15406
|
+
this.bubbleText = createNode("uitext", {
|
|
15407
|
+
color: "white",
|
|
15408
|
+
fontWeight: 100,
|
|
15409
|
+
lineHeight: 1.4,
|
|
15410
|
+
fontSize: 16
|
|
15411
|
+
});
|
|
15412
|
+
this.bubble.add(this.bubbleBox);
|
|
15413
|
+
this.bubbleBox.add(this.bubbleText);
|
|
15414
|
+
this.aura.add(this.bubble);
|
|
15415
|
+
this.aura.activate({ world: this.world, entity: this });
|
|
15416
|
+
this.base.activate({ world: this.world, entity: this });
|
|
15417
|
+
this.applyAvatar();
|
|
15418
|
+
this.position = new BufferedLerpVector3(this.base.position, this.world.networkRate * 1.5);
|
|
15419
|
+
this.quaternion = new BufferedLerpQuaternion(this.base.quaternion, this.world.networkRate * 1.5);
|
|
15420
|
+
this.teleport = 0;
|
|
15421
|
+
this.world.setHot(this, true);
|
|
15422
|
+
}
|
|
15423
|
+
applyAvatar() {
|
|
15424
|
+
const avatarUrl = this.data.sessionAvatar || this.data.avatar || "asset://avatar.vrm";
|
|
15425
|
+
if (this.avatarUrl === avatarUrl) return;
|
|
15426
|
+
this.world.loader.load("avatar", avatarUrl).then((src) => {
|
|
15427
|
+
if (this.avatar) this.avatar.deactivate();
|
|
15428
|
+
this.avatar = src.toNodes().get("avatar");
|
|
15429
|
+
this.base.add(this.avatar);
|
|
15430
|
+
this.nametag.position.y = this.avatar.getHeadToHeight() + 0.2;
|
|
15431
|
+
this.bubble.position.y = this.avatar.getHeadToHeight() + 0.2;
|
|
15432
|
+
if (!this.bubble.active) {
|
|
15433
|
+
this.nametag.active = true;
|
|
15434
|
+
}
|
|
15435
|
+
this.avatarUrl = avatarUrl;
|
|
15436
|
+
});
|
|
15437
|
+
}
|
|
15438
|
+
outranks(otherPlayer) {
|
|
15439
|
+
if (!otherPlayer?.data) return false;
|
|
15440
|
+
const rank = Math.max(this.data.rank, this.world.settings.effectiveRank);
|
|
15441
|
+
const otherRank = Math.max(otherPlayer.data.rank, this.world.settings.effectiveRank);
|
|
15442
|
+
return rank > otherRank;
|
|
15443
|
+
}
|
|
15444
|
+
isAdmin() {
|
|
15445
|
+
const rank = Math.max(this.data.rank, this.world.settings.effectiveRank);
|
|
15446
|
+
return hasRank(rank, Ranks.ADMIN);
|
|
15447
|
+
}
|
|
15448
|
+
isBuilder() {
|
|
15449
|
+
const rank = Math.max(this.data.rank, this.world.settings.effectiveRank);
|
|
15450
|
+
return hasRank(rank, Ranks.BUILDER);
|
|
15451
|
+
}
|
|
15452
|
+
isMuted() {
|
|
15453
|
+
return this.world.livekit?.isMuted?.(this.data.id) || false;
|
|
15454
|
+
}
|
|
15455
|
+
update(delta) {
|
|
15456
|
+
this.position.update(delta);
|
|
15457
|
+
this.quaternion.update(delta);
|
|
15458
|
+
}
|
|
15459
|
+
lateUpdate() {
|
|
15460
|
+
if (this.avatar) {
|
|
15461
|
+
const matrix = this.avatar.getBoneTransform("head");
|
|
15462
|
+
if (matrix) {
|
|
15463
|
+
this.aura.position.setFromMatrixPosition(matrix);
|
|
15464
|
+
}
|
|
15465
|
+
}
|
|
15466
|
+
}
|
|
15467
|
+
modify(data) {
|
|
15468
|
+
let avatarChanged;
|
|
15469
|
+
if (data.hasOwnProperty("t")) {
|
|
15470
|
+
this.teleport++;
|
|
15471
|
+
}
|
|
15472
|
+
const position = data.position || data.p;
|
|
15473
|
+
if (position) {
|
|
15474
|
+
this.data.position = position;
|
|
15475
|
+
this.position.push(position, this.teleport);
|
|
15476
|
+
}
|
|
15477
|
+
const quaternion = data.quaternion || data.q;
|
|
15478
|
+
if (quaternion) {
|
|
15479
|
+
this.data.quaternion = quaternion;
|
|
15480
|
+
this.quaternion.push(quaternion, this.teleport);
|
|
15481
|
+
}
|
|
15482
|
+
if (data.hasOwnProperty("name")) {
|
|
15483
|
+
this.data.name = data.name;
|
|
15484
|
+
this.nametag.label = data.name;
|
|
15485
|
+
this.world.emit("name", { playerId: this.data.id, name: this.data.name });
|
|
15486
|
+
}
|
|
15487
|
+
if (data.hasOwnProperty("avatar")) {
|
|
15488
|
+
this.data.avatar = data.avatar;
|
|
15489
|
+
avatarChanged = true;
|
|
15490
|
+
}
|
|
15491
|
+
if (data.hasOwnProperty("sessionAvatar")) {
|
|
15492
|
+
this.data.sessionAvatar = data.sessionAvatar;
|
|
15493
|
+
avatarChanged = true;
|
|
15494
|
+
}
|
|
15495
|
+
if (data.hasOwnProperty("rank")) {
|
|
15496
|
+
this.data.rank = data.rank;
|
|
15497
|
+
this.world.emit("rank", { playerId: this.data.id, rank: this.data.rank });
|
|
15498
|
+
}
|
|
15499
|
+
if (data.hasOwnProperty("enteredAt")) {
|
|
15500
|
+
this.data.enteredAt = data.enteredAt;
|
|
15501
|
+
this.enteredAt = data.enteredAt;
|
|
15502
|
+
}
|
|
15503
|
+
if (avatarChanged) {
|
|
15504
|
+
this.applyAvatar();
|
|
15505
|
+
}
|
|
15506
|
+
}
|
|
15507
|
+
chat(msg) {
|
|
15508
|
+
this.nametag.active = false;
|
|
15509
|
+
this.bubbleText.value = msg;
|
|
15510
|
+
this.bubble.active = true;
|
|
15511
|
+
clearTimeout(this.chatTimer);
|
|
15512
|
+
this.chatTimer = setTimeout(() => {
|
|
15513
|
+
this.bubble.active = false;
|
|
15514
|
+
this.nametag.active = true;
|
|
15515
|
+
}, 5e3);
|
|
15516
|
+
}
|
|
15517
|
+
destroy() {
|
|
15518
|
+
if (this.destroyed) return;
|
|
15519
|
+
this.destroyed = true;
|
|
15520
|
+
clearTimeout(this.chatTimer);
|
|
15521
|
+
this.base?.deactivate();
|
|
15522
|
+
this.avatar = null;
|
|
15523
|
+
this.world.setHot(this, false);
|
|
15524
|
+
this.world.events.emit("leave", { playerId: this.data.id });
|
|
15525
|
+
this.aura?.deactivate();
|
|
15526
|
+
this.aura = null;
|
|
15527
|
+
}
|
|
15528
|
+
};
|
|
15529
|
+
|
|
14401
15530
|
// src/core/systems/Entities.js
|
|
14402
15531
|
var Types = {
|
|
14403
15532
|
app: App,
|
|
@@ -14417,12 +15546,19 @@ var Entities = class extends System {
|
|
|
14417
15546
|
return this.items.get(id);
|
|
14418
15547
|
}
|
|
14419
15548
|
getPlayer(entityId) {
|
|
15549
|
+
if (this.world.isAdminClient && this.player?.data?.id === entityId) {
|
|
15550
|
+
return this.player;
|
|
15551
|
+
}
|
|
14420
15552
|
return this.players.get(entityId);
|
|
14421
15553
|
}
|
|
14422
15554
|
add(data, local) {
|
|
14423
15555
|
let Entity2;
|
|
14424
15556
|
if (data.type === "player") {
|
|
14425
|
-
|
|
15557
|
+
if (this.world.isAdminClient) {
|
|
15558
|
+
Entity2 = AdminPlayerRemote;
|
|
15559
|
+
} else {
|
|
15560
|
+
Entity2 = Types[data.owner === this.world.network.id ? "playerLocal" : "playerRemote"];
|
|
15561
|
+
}
|
|
14426
15562
|
} else {
|
|
14427
15563
|
Entity2 = Types[data.type];
|
|
14428
15564
|
}
|
|
@@ -44293,10 +45429,10 @@ function getOrCreateOverlapHit(idx) {
|
|
|
44293
45429
|
}
|
|
44294
45430
|
|
|
44295
45431
|
// src/core/systems/Stage.js
|
|
44296
|
-
import { isNumber as
|
|
45432
|
+
import { isNumber as isNumber23 } from "lodash-es";
|
|
44297
45433
|
|
|
44298
45434
|
// src/core/extras/LooseOctree.js
|
|
44299
|
-
import { isBoolean as
|
|
45435
|
+
import { isBoolean as isBoolean22 } from "lodash-es";
|
|
44300
45436
|
var _v16 = new Vector3Enhanced();
|
|
44301
45437
|
var _v26 = new Vector3Enhanced();
|
|
44302
45438
|
var _q16 = new three_exports.Quaternion();
|
|
@@ -44397,7 +45533,7 @@ var LooseOctree = class {
|
|
|
44397
45533
|
// console.log('pruned:', this.pruneCount)
|
|
44398
45534
|
// }
|
|
44399
45535
|
toggleHelper(enabled) {
|
|
44400
|
-
enabled =
|
|
45536
|
+
enabled = isBoolean22(enabled) ? enabled : !this.helper;
|
|
44401
45537
|
if (enabled && !this.helper) {
|
|
44402
45538
|
this.helper = createHelper(this);
|
|
44403
45539
|
this.helper.init();
|
|
@@ -44823,8 +45959,8 @@ var Stage = class extends System {
|
|
|
44823
45959
|
} else {
|
|
44824
45960
|
raw = new three_exports.MeshStandardMaterial({
|
|
44825
45961
|
color: options.color || "white",
|
|
44826
|
-
metalness:
|
|
44827
|
-
roughness:
|
|
45962
|
+
metalness: isNumber23(options.metalness) ? options.metalness : 0,
|
|
45963
|
+
roughness: isNumber23(options.roughness) ? options.roughness : 1
|
|
44828
45964
|
});
|
|
44829
45965
|
}
|
|
44830
45966
|
raw.shadowSide = three_exports.BackSide;
|
|
@@ -44890,7 +46026,7 @@ var Stage = class extends System {
|
|
|
44890
46026
|
return raw.emissiveIntensity;
|
|
44891
46027
|
},
|
|
44892
46028
|
set emissiveIntensity(value) {
|
|
44893
|
-
if (!
|
|
46029
|
+
if (!isNumber23(value)) {
|
|
44894
46030
|
throw new Error("[material] emissiveIntensity not a number");
|
|
44895
46031
|
}
|
|
44896
46032
|
raw.emissiveIntensity = value;
|
|
@@ -45603,9 +46739,7 @@ var Scripts = class extends System {
|
|
|
45603
46739
|
Date: {
|
|
45604
46740
|
now: () => Date.now()
|
|
45605
46741
|
},
|
|
45606
|
-
URL
|
|
45607
|
-
createObjectURL: (blob) => URL.createObjectURL(blob)
|
|
45608
|
-
},
|
|
46742
|
+
URL,
|
|
45609
46743
|
Math,
|
|
45610
46744
|
eval: void 0,
|
|
45611
46745
|
harden: void 0,
|
|
@@ -46033,7 +47167,7 @@ var HandednessRight = "right";
|
|
|
46033
47167
|
var XR_TREMOR_SMOOTHING_FACTOR = 0.6;
|
|
46034
47168
|
var m14 = new three_exports.Matrix4();
|
|
46035
47169
|
var m22 = new three_exports.Matrix4();
|
|
46036
|
-
var
|
|
47170
|
+
var v110 = new Vector3Enhanced();
|
|
46037
47171
|
var v26 = new Vector3Enhanced();
|
|
46038
47172
|
var q15 = new three_exports.Quaternion();
|
|
46039
47173
|
var q23 = new three_exports.Quaternion();
|
|
@@ -46101,7 +47235,7 @@ var ClientControls = class extends System {
|
|
|
46101
47235
|
for (const control of this.controls) {
|
|
46102
47236
|
if (control.entries.xrLeftRayPose) {
|
|
46103
47237
|
const pose = control.entries.xrLeftRayPose;
|
|
46104
|
-
const scale =
|
|
47238
|
+
const scale = v110.set(1, 1, 1);
|
|
46105
47239
|
m14.compose(pose.lPosition, pose.lQuaternion, scale);
|
|
46106
47240
|
m22.compose(xrRig.position, xrRig.quaternion, scale);
|
|
46107
47241
|
m14.premultiply(m22);
|
|
@@ -46109,7 +47243,7 @@ var ClientControls = class extends System {
|
|
|
46109
47243
|
}
|
|
46110
47244
|
if (control.entries.xrRightRayPose) {
|
|
46111
47245
|
const pose = control.entries.xrRightRayPose;
|
|
46112
|
-
const scale =
|
|
47246
|
+
const scale = v110.set(1, 1, 1);
|
|
46113
47247
|
m14.compose(pose.lPosition, pose.lQuaternion, scale);
|
|
46114
47248
|
m22.compose(xrRig.position, xrRig.quaternion, scale);
|
|
46115
47249
|
m14.premultiply(m22);
|
|
@@ -46141,7 +47275,7 @@ var ClientControls = class extends System {
|
|
|
46141
47275
|
pose.lPosition = new Vector3Enhanced().copy(ray.transform.position);
|
|
46142
47276
|
pose.lQuaternion = new three_exports.Quaternion().copy(ray.transform.orientation);
|
|
46143
47277
|
}
|
|
46144
|
-
pose.lPosition.lerp(
|
|
47278
|
+
pose.lPosition.lerp(v110.copy(ray.transform.position), 1 - XR_TREMOR_SMOOTHING_FACTOR);
|
|
46145
47279
|
pose.lQuaternion.slerp(q15.copy(ray.transform.orientation), 1 - XR_TREMOR_SMOOTHING_FACTOR);
|
|
46146
47280
|
}
|
|
46147
47281
|
}
|
|
@@ -46236,7 +47370,7 @@ var ClientControls = class extends System {
|
|
|
46236
47370
|
pose.lPosition = new Vector3Enhanced().copy(ray.transform.position);
|
|
46237
47371
|
pose.lQuaternion = new three_exports.Quaternion().copy(ray.transform.orientation);
|
|
46238
47372
|
}
|
|
46239
|
-
pose.lPosition.lerp(
|
|
47373
|
+
pose.lPosition.lerp(v110.copy(ray.transform.position), 1 - XR_TREMOR_SMOOTHING_FACTOR);
|
|
46240
47374
|
pose.lQuaternion.slerp(q15.copy(ray.transform.orientation), 1 - XR_TREMOR_SMOOTHING_FACTOR);
|
|
46241
47375
|
}
|
|
46242
47376
|
}
|
|
@@ -46870,17 +48004,19 @@ var names = [
|
|
|
46870
48004
|
"spawnModified",
|
|
46871
48005
|
"modifyRank",
|
|
46872
48006
|
"kick",
|
|
46873
|
-
"ai",
|
|
46874
48007
|
"ping",
|
|
46875
48008
|
"pong",
|
|
46876
48009
|
"blueprintRemoved",
|
|
46877
|
-
|
|
46878
|
-
"
|
|
46879
|
-
"
|
|
46880
|
-
"
|
|
46881
|
-
"
|
|
46882
|
-
"
|
|
46883
|
-
|
|
48010
|
+
// admin protocol
|
|
48011
|
+
"adminAuth",
|
|
48012
|
+
"adminAuthOk",
|
|
48013
|
+
"adminAuthError",
|
|
48014
|
+
"adminCommand",
|
|
48015
|
+
"adminResult",
|
|
48016
|
+
// admin player streaming
|
|
48017
|
+
"playerJoined",
|
|
48018
|
+
"playerUpdated",
|
|
48019
|
+
"playerLeft"
|
|
46884
48020
|
];
|
|
46885
48021
|
var byName = {};
|
|
46886
48022
|
var byId = {};
|
|
@@ -47106,13 +48242,11 @@ var ClientNetwork = class extends System {
|
|
|
47106
48242
|
this.world.settings.deserialize(data.settings);
|
|
47107
48243
|
this.world.settings.setHasAdminCode(data.hasAdminCode);
|
|
47108
48244
|
this.world.chat.deserialize(data.chat);
|
|
47109
|
-
this.world.ai.deserialize(data.ai);
|
|
47110
48245
|
this.world.blueprints.deserialize(data.blueprints);
|
|
47111
48246
|
this.world.entities.deserialize(data.entities);
|
|
47112
48247
|
this.world.livekit?.deserialize(data.livekit);
|
|
47113
48248
|
storage.set("authToken", data.authToken);
|
|
47114
48249
|
this.world.admin?.onSnapshot?.(data);
|
|
47115
|
-
this.world.evm?.onSnapshot?.(data);
|
|
47116
48250
|
}
|
|
47117
48251
|
onSettingsModified = (data) => {
|
|
47118
48252
|
this.world.settings.set(data.key, data.value);
|
|
@@ -47171,15 +48305,6 @@ var ClientNetwork = class extends System {
|
|
|
47171
48305
|
onKick = (code) => {
|
|
47172
48306
|
this.world.emit("kick", code);
|
|
47173
48307
|
};
|
|
47174
|
-
onHlConfig = (data) => {
|
|
47175
|
-
this.world.evm?.onHlConfig?.(data);
|
|
47176
|
-
};
|
|
47177
|
-
onDepositRequest = (data) => {
|
|
47178
|
-
this.world.evm?.onDepositRequest?.(data);
|
|
47179
|
-
};
|
|
47180
|
-
onDepositResult = (data) => {
|
|
47181
|
-
this.world.evm?.onDepositResult?.(data);
|
|
47182
|
-
};
|
|
47183
48308
|
onClose = (code) => {
|
|
47184
48309
|
this.world.chat.add({
|
|
47185
48310
|
id: uuid(),
|
|
@@ -47215,12 +48340,12 @@ import {
|
|
|
47215
48340
|
BufferAttribute as BufferAttribute2,
|
|
47216
48341
|
BufferGeometry as BufferGeometry2,
|
|
47217
48342
|
ClampToEdgeWrapping,
|
|
47218
|
-
Color as
|
|
48343
|
+
Color as Color6,
|
|
47219
48344
|
ColorManagement,
|
|
47220
48345
|
DirectionalLight,
|
|
47221
|
-
DoubleSide as
|
|
48346
|
+
DoubleSide as DoubleSide6,
|
|
47222
48347
|
FileLoader,
|
|
47223
|
-
FrontSide as
|
|
48348
|
+
FrontSide as FrontSide7,
|
|
47224
48349
|
Group as Group2,
|
|
47225
48350
|
ImageBitmapLoader,
|
|
47226
48351
|
InstancedMesh as InstancedMesh3,
|
|
@@ -47242,8 +48367,8 @@ import {
|
|
|
47242
48367
|
Material as Material2,
|
|
47243
48368
|
MathUtils as MathUtils4,
|
|
47244
48369
|
Matrix4 as Matrix412,
|
|
47245
|
-
Mesh as
|
|
47246
|
-
MeshBasicMaterial as
|
|
48370
|
+
Mesh as Mesh11,
|
|
48371
|
+
MeshBasicMaterial as MeshBasicMaterial7,
|
|
47247
48372
|
MeshPhysicalMaterial,
|
|
47248
48373
|
MeshStandardMaterial as MeshStandardMaterial7,
|
|
47249
48374
|
MirroredRepeatWrapping,
|
|
@@ -47540,7 +48665,7 @@ var GLTFLightsExtension = class {
|
|
|
47540
48665
|
const lightDefs = extensions.lights || [];
|
|
47541
48666
|
const lightDef = lightDefs[lightIndex];
|
|
47542
48667
|
let lightNode;
|
|
47543
|
-
const color = new
|
|
48668
|
+
const color = new Color6(16777215);
|
|
47544
48669
|
if (lightDef.color !== void 0) color.setRGB(lightDef.color[0], lightDef.color[1], lightDef.color[2], LinearSRGBColorSpace);
|
|
47545
48670
|
const range = lightDef.range !== void 0 ? lightDef.range : 0;
|
|
47546
48671
|
switch (lightDef.type) {
|
|
@@ -47597,11 +48722,11 @@ var GLTFMaterialsUnlitExtension = class {
|
|
|
47597
48722
|
this.name = EXTENSIONS.KHR_MATERIALS_UNLIT;
|
|
47598
48723
|
}
|
|
47599
48724
|
getMaterialType() {
|
|
47600
|
-
return
|
|
48725
|
+
return MeshBasicMaterial7;
|
|
47601
48726
|
}
|
|
47602
48727
|
extendParams(materialParams, materialDef, parser) {
|
|
47603
48728
|
const pending = [];
|
|
47604
|
-
materialParams.color = new
|
|
48729
|
+
materialParams.color = new Color6(1, 1, 1);
|
|
47605
48730
|
materialParams.opacity = 1;
|
|
47606
48731
|
const metallicRoughness = materialDef.pbrMetallicRoughness;
|
|
47607
48732
|
if (metallicRoughness) {
|
|
@@ -47759,7 +48884,7 @@ var GLTFMaterialsSheenExtension = class {
|
|
|
47759
48884
|
return Promise.resolve();
|
|
47760
48885
|
}
|
|
47761
48886
|
const pending = [];
|
|
47762
|
-
materialParams.sheenColor = new
|
|
48887
|
+
materialParams.sheenColor = new Color6(0, 0, 0);
|
|
47763
48888
|
materialParams.sheenRoughness = 0;
|
|
47764
48889
|
materialParams.sheen = 1;
|
|
47765
48890
|
const extension = materialDef.extensions[this.name];
|
|
@@ -47832,7 +48957,7 @@ var GLTFMaterialsVolumeExtension = class {
|
|
|
47832
48957
|
}
|
|
47833
48958
|
materialParams.attenuationDistance = extension.attenuationDistance || Infinity;
|
|
47834
48959
|
const colorArray = extension.attenuationColor || [1, 1, 1];
|
|
47835
|
-
materialParams.attenuationColor = new
|
|
48960
|
+
materialParams.attenuationColor = new Color6().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace);
|
|
47836
48961
|
return Promise.all(pending);
|
|
47837
48962
|
}
|
|
47838
48963
|
};
|
|
@@ -47882,7 +49007,7 @@ var GLTFMaterialsSpecularExtension = class {
|
|
|
47882
49007
|
pending.push(parser.assignTexture(materialParams, "specularIntensityMap", extension.specularTexture));
|
|
47883
49008
|
}
|
|
47884
49009
|
const colorArray = extension.specularColorFactor || [1, 1, 1];
|
|
47885
|
-
materialParams.specularColor = new
|
|
49010
|
+
materialParams.specularColor = new Color6().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace);
|
|
47886
49011
|
if (extension.specularColorTexture !== void 0) {
|
|
47887
49012
|
pending.push(parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture, SRGBColorSpace3));
|
|
47888
49013
|
}
|
|
@@ -48426,7 +49551,7 @@ function createDefaultMaterial(cache2) {
|
|
|
48426
49551
|
roughness: 1,
|
|
48427
49552
|
transparent: false,
|
|
48428
49553
|
depthTest: true,
|
|
48429
|
-
side:
|
|
49554
|
+
side: FrontSide7
|
|
48430
49555
|
});
|
|
48431
49556
|
}
|
|
48432
49557
|
return cache2["DefaultMaterial"];
|
|
@@ -49137,7 +50262,7 @@ var GLTFParser = class {
|
|
|
49137
50262
|
pending.push(kmuExtension.extendParams(materialParams, materialDef, parser));
|
|
49138
50263
|
} else {
|
|
49139
50264
|
const metallicRoughness = materialDef.pbrMetallicRoughness || {};
|
|
49140
|
-
materialParams.color = new
|
|
50265
|
+
materialParams.color = new Color6(1, 1, 1);
|
|
49141
50266
|
materialParams.opacity = 1;
|
|
49142
50267
|
if (Array.isArray(metallicRoughness.baseColorFactor)) {
|
|
49143
50268
|
const array = metallicRoughness.baseColorFactor;
|
|
@@ -49161,7 +50286,7 @@ var GLTFParser = class {
|
|
|
49161
50286
|
})));
|
|
49162
50287
|
}
|
|
49163
50288
|
if (materialDef.doubleSided === true) {
|
|
49164
|
-
materialParams.side =
|
|
50289
|
+
materialParams.side = DoubleSide6;
|
|
49165
50290
|
}
|
|
49166
50291
|
const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;
|
|
49167
50292
|
if (alphaMode === ALPHA_MODES.BLEND) {
|
|
@@ -49173,7 +50298,7 @@ var GLTFParser = class {
|
|
|
49173
50298
|
materialParams.alphaTest = materialDef.alphaCutoff !== void 0 ? materialDef.alphaCutoff : 0.5;
|
|
49174
50299
|
}
|
|
49175
50300
|
}
|
|
49176
|
-
if (materialDef.normalTexture !== void 0 && materialType !==
|
|
50301
|
+
if (materialDef.normalTexture !== void 0 && materialType !== MeshBasicMaterial7) {
|
|
49177
50302
|
pending.push(parser.assignTexture(materialParams, "normalMap", materialDef.normalTexture));
|
|
49178
50303
|
materialParams.normalScale = new Vector24(1, 1);
|
|
49179
50304
|
if (materialDef.normalTexture.scale !== void 0) {
|
|
@@ -49181,17 +50306,17 @@ var GLTFParser = class {
|
|
|
49181
50306
|
materialParams.normalScale.set(scale, scale);
|
|
49182
50307
|
}
|
|
49183
50308
|
}
|
|
49184
|
-
if (materialDef.occlusionTexture !== void 0 && materialType !==
|
|
50309
|
+
if (materialDef.occlusionTexture !== void 0 && materialType !== MeshBasicMaterial7) {
|
|
49185
50310
|
pending.push(parser.assignTexture(materialParams, "aoMap", materialDef.occlusionTexture));
|
|
49186
50311
|
if (materialDef.occlusionTexture.strength !== void 0) {
|
|
49187
50312
|
materialParams.aoMapIntensity = materialDef.occlusionTexture.strength;
|
|
49188
50313
|
}
|
|
49189
50314
|
}
|
|
49190
|
-
if (materialDef.emissiveFactor !== void 0 && materialType !==
|
|
50315
|
+
if (materialDef.emissiveFactor !== void 0 && materialType !== MeshBasicMaterial7) {
|
|
49191
50316
|
const emissiveFactor = materialDef.emissiveFactor;
|
|
49192
|
-
materialParams.emissive = new
|
|
50317
|
+
materialParams.emissive = new Color6().setRGB(emissiveFactor[0], emissiveFactor[1], emissiveFactor[2], LinearSRGBColorSpace);
|
|
49193
50318
|
}
|
|
49194
|
-
if (materialDef.emissiveTexture !== void 0 && materialType !==
|
|
50319
|
+
if (materialDef.emissiveTexture !== void 0 && materialType !== MeshBasicMaterial7) {
|
|
49195
50320
|
pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture, SRGBColorSpace3));
|
|
49196
50321
|
}
|
|
49197
50322
|
return Promise.all(pending).then(function() {
|
|
@@ -49282,7 +50407,7 @@ var GLTFParser = class {
|
|
|
49282
50407
|
let mesh;
|
|
49283
50408
|
const material2 = materials[i];
|
|
49284
50409
|
if (primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === void 0) {
|
|
49285
|
-
mesh = meshDef.isSkinnedMesh === true ? new SkinnedMesh2(geometry, material2) : new
|
|
50410
|
+
mesh = meshDef.isSkinnedMesh === true ? new SkinnedMesh2(geometry, material2) : new Mesh11(geometry, material2);
|
|
49286
50411
|
if (mesh.isSkinnedMesh === true) {
|
|
49287
50412
|
mesh.normalizeSkinWeights();
|
|
49288
50413
|
}
|
|
@@ -49780,7 +50905,7 @@ function addPrimitiveAttributes(geometry, primitiveDef, parser) {
|
|
|
49780
50905
|
|
|
49781
50906
|
// src/core/extras/createVRMFactory.js
|
|
49782
50907
|
import * as SkeletonUtils2 from "three/examples/jsm/utils/SkeletonUtils.js";
|
|
49783
|
-
var
|
|
50908
|
+
var v111 = new Vector3Enhanced();
|
|
49784
50909
|
var v27 = new Vector3Enhanced();
|
|
49785
50910
|
var q16 = new three_exports.Quaternion();
|
|
49786
50911
|
var m15 = new three_exports.Matrix4();
|
|
@@ -50567,7 +51692,7 @@ var ServerLoader = class extends System {
|
|
|
50567
51692
|
};
|
|
50568
51693
|
|
|
50569
51694
|
// src/core/systems/NodeEnvironment.js
|
|
50570
|
-
import { isNumber as
|
|
51695
|
+
import { isNumber as isNumber24, isString as isString19 } from "lodash-es";
|
|
50571
51696
|
var NodeEnvironment = class extends System {
|
|
50572
51697
|
constructor(world2) {
|
|
50573
51698
|
super(world2);
|