@relu-interactives/spatial-ecs 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{System-vrU46Vuw.d.cts → System-TmC2EijF.d.cts} +2 -2
- package/dist/{System-vrU46Vuw.d.ts → System-TmC2EijF.d.ts} +2 -2
- package/dist/{XRRig-2686IqLQ.d.cts → XRInteractor-CCUzSqg9.d.ts} +96 -2
- package/dist/{XRRig-D2QURXl1.d.ts → XRInteractor-I2q6TKtF.d.cts} +96 -2
- package/dist/{chunk-4BZYK3JP.js → chunk-FQTOC7HK.js} +135 -88
- package/dist/chunk-FQTOC7HK.js.map +1 -0
- package/dist/{chunk-2LVFGVWI.js → chunk-JRJ3CL5H.js} +3 -3
- package/dist/{chunk-2LVFGVWI.js.map → chunk-JRJ3CL5H.js.map} +1 -1
- package/dist/{chunk-6QC2PJLD.js → chunk-N4GKZ7IV.js} +29 -3
- package/dist/chunk-N4GKZ7IV.js.map +1 -0
- package/dist/{chunk-G53MZVKQ.js → chunk-WRJ2K3LZ.js} +285 -39
- package/dist/chunk-WRJ2K3LZ.js.map +1 -0
- package/dist/components/index.cjs +26 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +1 -1
- package/dist/factories/index.cjs +185 -112
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +7 -3
- package/dist/factories/index.d.ts +7 -3
- package/dist/factories/index.js +3 -3
- package/dist/{index-BtKOaHfY.d.ts → index-BltjPEhg.d.cts} +10 -3
- package/dist/{index-B-CViRMx.d.ts → index-BpbmZuOz.d.ts} +43 -14
- package/dist/{index-BvCmmuJ0.d.cts → index-C5FrDt3z.d.cts} +43 -14
- package/dist/{index-Xu238jLn.d.cts → index-W8pUajCW.d.ts} +10 -3
- package/dist/index.cjs +602 -279
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -9
- package/dist/index.d.ts +35 -9
- package/dist/index.js +8 -8
- package/dist/systems/index.cjs +304 -34
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +2 -2
- package/dist/systems/index.d.ts +2 -2
- package/dist/systems/index.js +3 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/worldSnapshotUtils.d.cts +1 -1
- package/dist/worldSnapshotUtils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-4BZYK3JP.js.map +0 -1
- package/dist/chunk-6QC2PJLD.js.map +0 -1
- package/dist/chunk-G53MZVKQ.js.map +0 -1
package/dist/factories/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var THREE32 = require('three');
|
|
4
4
|
var SkeletonUtils_js = require('three/examples/jsm/utils/SkeletonUtils.js');
|
|
5
5
|
var RectAreaLightHelper_js = require('three/examples/jsm/helpers/RectAreaLightHelper.js');
|
|
6
6
|
var DRACOLoader_js = require('three/examples/jsm/loaders/DRACOLoader.js');
|
|
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
|
|
|
25
25
|
return Object.freeze(n);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var THREE32__namespace = /*#__PURE__*/_interopNamespace(THREE32);
|
|
29
29
|
|
|
30
30
|
var __defProp = Object.defineProperty;
|
|
31
31
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -298,14 +298,14 @@ var _AnimationComponent = class _AnimationComponent extends Component {
|
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
this.importedClips = clips.map((entry) => {
|
|
301
|
-
if (entry instanceof
|
|
301
|
+
if (entry instanceof THREE32__namespace.AnimationClip) {
|
|
302
302
|
return { clip: entry, sourceUrl: null };
|
|
303
303
|
}
|
|
304
304
|
if (!entry || typeof entry !== "object") {
|
|
305
305
|
return null;
|
|
306
306
|
}
|
|
307
307
|
const candidate = entry;
|
|
308
|
-
if (!(candidate.clip instanceof
|
|
308
|
+
if (!(candidate.clip instanceof THREE32__namespace.AnimationClip)) {
|
|
309
309
|
return null;
|
|
310
310
|
}
|
|
311
311
|
return {
|
|
@@ -513,11 +513,11 @@ function normalizeDistanceModel(distanceModel) {
|
|
|
513
513
|
}
|
|
514
514
|
__name(normalizeDistanceModel, "normalizeDistanceModel");
|
|
515
515
|
function createConfiguredAudio(listener, options) {
|
|
516
|
-
const sound = options.positional ? new
|
|
516
|
+
const sound = options.positional ? new THREE32__namespace.PositionalAudio(listener) : new THREE32__namespace.Audio(listener);
|
|
517
517
|
sound.setLoop(options.loop);
|
|
518
518
|
sound.setVolume(options.volume);
|
|
519
519
|
sound.setPlaybackRate(options.pitch);
|
|
520
|
-
if (sound instanceof
|
|
520
|
+
if (sound instanceof THREE32__namespace.PositionalAudio) {
|
|
521
521
|
sound.setRefDistance(options.refDistance);
|
|
522
522
|
sound.setDistanceModel(normalizeDistanceModel(options.distanceModel));
|
|
523
523
|
sound.setRolloffFactor(options.rolloffFactor);
|
|
@@ -527,16 +527,16 @@ function createConfiguredAudio(listener, options) {
|
|
|
527
527
|
__name(createConfiguredAudio, "createConfiguredAudio");
|
|
528
528
|
function createAudioEditorHelper() {
|
|
529
529
|
if (typeof document === "undefined") {
|
|
530
|
-
const geometry = new
|
|
531
|
-
new
|
|
530
|
+
const geometry = new THREE32__namespace.EdgesGeometry(
|
|
531
|
+
new THREE32__namespace.OctahedronGeometry(0.22, 0)
|
|
532
532
|
);
|
|
533
|
-
const material2 = new
|
|
533
|
+
const material2 = new THREE32__namespace.LineBasicMaterial({
|
|
534
534
|
color: "#8bc8ff",
|
|
535
535
|
transparent: true,
|
|
536
536
|
opacity: 0.95,
|
|
537
537
|
depthTest: false
|
|
538
538
|
});
|
|
539
|
-
const fallback = new
|
|
539
|
+
const fallback = new THREE32__namespace.LineSegments(geometry, material2);
|
|
540
540
|
fallback.renderOrder = 10;
|
|
541
541
|
fallback.userData.ecsHelper = true;
|
|
542
542
|
fallback.visible = false;
|
|
@@ -548,7 +548,7 @@ function createAudioEditorHelper() {
|
|
|
548
548
|
canvas.height = size;
|
|
549
549
|
const ctx = canvas.getContext("2d");
|
|
550
550
|
if (!ctx) {
|
|
551
|
-
return new
|
|
551
|
+
return new THREE32__namespace.Object3D();
|
|
552
552
|
}
|
|
553
553
|
ctx.clearRect(0, 0, size, size);
|
|
554
554
|
ctx.fillStyle = "rgba(27, 35, 52, 0.9)";
|
|
@@ -579,14 +579,14 @@ function createAudioEditorHelper() {
|
|
|
579
579
|
ctx.beginPath();
|
|
580
580
|
ctx.arc(56, 48, 16, -0.8, 0.8);
|
|
581
581
|
ctx.stroke();
|
|
582
|
-
const texture = new
|
|
582
|
+
const texture = new THREE32__namespace.CanvasTexture(canvas);
|
|
583
583
|
texture.needsUpdate = true;
|
|
584
|
-
const material = new
|
|
584
|
+
const material = new THREE32__namespace.SpriteMaterial({
|
|
585
585
|
map: texture,
|
|
586
586
|
transparent: true,
|
|
587
587
|
depthTest: false
|
|
588
588
|
});
|
|
589
|
-
const helper = new
|
|
589
|
+
const helper = new THREE32__namespace.Sprite(material);
|
|
590
590
|
helper.scale.set(0.68, 0.68, 0.68);
|
|
591
591
|
helper.renderOrder = 10;
|
|
592
592
|
helper.userData.ecsHelper = true;
|
|
@@ -620,7 +620,7 @@ var DEFAULT_ORTHO_TOP = 5;
|
|
|
620
620
|
var DEFAULT_ORTHO_BOTTOM = -5;
|
|
621
621
|
var DEFAULT_ZOOM = 1;
|
|
622
622
|
function inferProjection(camera) {
|
|
623
|
-
if (camera instanceof
|
|
623
|
+
if (camera instanceof THREE32__namespace.OrthographicCamera) {
|
|
624
624
|
return "orthographic";
|
|
625
625
|
}
|
|
626
626
|
return "perspective";
|
|
@@ -641,7 +641,7 @@ function readCameraFar(camera) {
|
|
|
641
641
|
}
|
|
642
642
|
__name(readCameraFar, "readCameraFar");
|
|
643
643
|
function inferFov(camera) {
|
|
644
|
-
if (camera instanceof
|
|
644
|
+
if (camera instanceof THREE32__namespace.PerspectiveCamera && Number.isFinite(camera.fov)) {
|
|
645
645
|
return camera.fov;
|
|
646
646
|
}
|
|
647
647
|
return DEFAULT_FOV;
|
|
@@ -664,28 +664,28 @@ function inferFar(camera) {
|
|
|
664
664
|
}
|
|
665
665
|
__name(inferFar, "inferFar");
|
|
666
666
|
function inferOrthoLeft(camera) {
|
|
667
|
-
if (camera instanceof
|
|
667
|
+
if (camera instanceof THREE32__namespace.OrthographicCamera && Number.isFinite(camera.left)) {
|
|
668
668
|
return camera.left;
|
|
669
669
|
}
|
|
670
670
|
return DEFAULT_ORTHO_LEFT;
|
|
671
671
|
}
|
|
672
672
|
__name(inferOrthoLeft, "inferOrthoLeft");
|
|
673
673
|
function inferOrthoRight(camera) {
|
|
674
|
-
if (camera instanceof
|
|
674
|
+
if (camera instanceof THREE32__namespace.OrthographicCamera && Number.isFinite(camera.right)) {
|
|
675
675
|
return camera.right;
|
|
676
676
|
}
|
|
677
677
|
return DEFAULT_ORTHO_RIGHT;
|
|
678
678
|
}
|
|
679
679
|
__name(inferOrthoRight, "inferOrthoRight");
|
|
680
680
|
function inferOrthoTop(camera) {
|
|
681
|
-
if (camera instanceof
|
|
681
|
+
if (camera instanceof THREE32__namespace.OrthographicCamera && Number.isFinite(camera.top)) {
|
|
682
682
|
return camera.top;
|
|
683
683
|
}
|
|
684
684
|
return DEFAULT_ORTHO_TOP;
|
|
685
685
|
}
|
|
686
686
|
__name(inferOrthoTop, "inferOrthoTop");
|
|
687
687
|
function inferOrthoBottom(camera) {
|
|
688
|
-
if (camera instanceof
|
|
688
|
+
if (camera instanceof THREE32__namespace.OrthographicCamera && Number.isFinite(camera.bottom)) {
|
|
689
689
|
return camera.bottom;
|
|
690
690
|
}
|
|
691
691
|
return DEFAULT_ORTHO_BOTTOM;
|
|
@@ -701,7 +701,7 @@ __name(inferZoom, "inferZoom");
|
|
|
701
701
|
var _CameraComponent = class _CameraComponent extends Component {
|
|
702
702
|
constructor(payload = {}) {
|
|
703
703
|
super();
|
|
704
|
-
this.camera = payload.camera ?? new
|
|
704
|
+
this.camera = payload.camera ?? new THREE32__namespace.PerspectiveCamera();
|
|
705
705
|
this.type = payload.type ?? "3d";
|
|
706
706
|
this.isDefault = typeof payload.isDefault === "boolean" ? payload.isDefault : false;
|
|
707
707
|
this.projection = payload.projection ?? inferProjection(payload.camera);
|
|
@@ -732,7 +732,7 @@ var Object3DRef = _Object3DRef;
|
|
|
732
732
|
// core/factories/components/CameraFactory.ts
|
|
733
733
|
function createCameraComponent(world, entityId, payload = {}) {
|
|
734
734
|
const object = world.getComponent(entityId, Object3DRef)?.object;
|
|
735
|
-
const objectCamera = object instanceof
|
|
735
|
+
const objectCamera = object instanceof THREE32__namespace.Camera ? object : void 0;
|
|
736
736
|
const component = new CameraComponent({
|
|
737
737
|
...payload,
|
|
738
738
|
camera: payload.camera ?? objectCamera
|
|
@@ -1290,15 +1290,15 @@ function createValueState(light) {
|
|
|
1290
1290
|
castShadow: light.castShadow ?? false,
|
|
1291
1291
|
frustumCulling: light.frustumCulled
|
|
1292
1292
|
};
|
|
1293
|
-
if (light instanceof
|
|
1293
|
+
if (light instanceof THREE32__namespace.PointLight) {
|
|
1294
1294
|
base.distance = light.distance;
|
|
1295
1295
|
base.decay = light.decay;
|
|
1296
|
-
} else if (light instanceof
|
|
1296
|
+
} else if (light instanceof THREE32__namespace.SpotLight) {
|
|
1297
1297
|
base.distance = light.distance;
|
|
1298
1298
|
base.decay = light.decay;
|
|
1299
1299
|
base.angle = light.angle;
|
|
1300
1300
|
base.penumbra = light.penumbra;
|
|
1301
|
-
} else if (light instanceof
|
|
1301
|
+
} else if (light instanceof THREE32__namespace.RectAreaLight) {
|
|
1302
1302
|
base.width = light.width;
|
|
1303
1303
|
base.height = light.height;
|
|
1304
1304
|
}
|
|
@@ -1341,13 +1341,13 @@ function toHexColor2(value, fallback) {
|
|
|
1341
1341
|
}
|
|
1342
1342
|
__name(toHexColor2, "toHexColor");
|
|
1343
1343
|
function getMaterialType(material) {
|
|
1344
|
-
if (material instanceof
|
|
1344
|
+
if (material instanceof THREE32__namespace.MeshPhysicalMaterial) {
|
|
1345
1345
|
return "physical";
|
|
1346
1346
|
}
|
|
1347
|
-
if (material instanceof
|
|
1347
|
+
if (material instanceof THREE32__namespace.MeshPhongMaterial) {
|
|
1348
1348
|
return "phong";
|
|
1349
1349
|
}
|
|
1350
|
-
if (material instanceof
|
|
1350
|
+
if (material instanceof THREE32__namespace.MeshBasicMaterial) {
|
|
1351
1351
|
return "basic";
|
|
1352
1352
|
}
|
|
1353
1353
|
return "standard";
|
|
@@ -1382,8 +1382,8 @@ function createMaterialValue(material) {
|
|
|
1382
1382
|
opacity: typeof materialRecord.opacity === "number" ? materialRecord.opacity : 1,
|
|
1383
1383
|
emissive: toHexColor2(materialRecord.emissive, "#000000"),
|
|
1384
1384
|
emissiveIntensity: typeof materialRecord.emissiveIntensity === "number" ? materialRecord.emissiveIntensity : 0,
|
|
1385
|
-
side: typeof materialRecord.side === "number" ? materialRecord.side :
|
|
1386
|
-
blending: typeof materialRecord.blending === "number" ? materialRecord.blending :
|
|
1385
|
+
side: typeof materialRecord.side === "number" ? materialRecord.side : THREE32__namespace.FrontSide,
|
|
1386
|
+
blending: typeof materialRecord.blending === "number" ? materialRecord.blending : THREE32__namespace.NormalBlending,
|
|
1387
1387
|
depthTest: materialRecord.depthTest !== false,
|
|
1388
1388
|
depthWrite: materialRecord.depthWrite !== false,
|
|
1389
1389
|
wireframe: Boolean(materialRecord.wireframe),
|
|
@@ -1415,7 +1415,7 @@ function createMaterialValue(material) {
|
|
|
1415
1415
|
materialRecord.lightMap
|
|
1416
1416
|
),
|
|
1417
1417
|
envMap: textureImageSrc(materialRecord.envMap),
|
|
1418
|
-
textureFiltering: map?.magFilter ===
|
|
1418
|
+
textureFiltering: map?.magFilter === THREE32__namespace.NearestFilter ? "sharp" : "smooth",
|
|
1419
1419
|
useMipmaps: map?.generateMipmaps !== false
|
|
1420
1420
|
};
|
|
1421
1421
|
}
|
|
@@ -1430,8 +1430,8 @@ function defaultMaterialValue() {
|
|
|
1430
1430
|
opacity: 1,
|
|
1431
1431
|
emissive: "#000000",
|
|
1432
1432
|
emissiveIntensity: 0,
|
|
1433
|
-
side:
|
|
1434
|
-
blending:
|
|
1433
|
+
side: THREE32__namespace.FrontSide,
|
|
1434
|
+
blending: THREE32__namespace.NormalBlending,
|
|
1435
1435
|
depthTest: true,
|
|
1436
1436
|
depthWrite: true,
|
|
1437
1437
|
wireframe: false,
|
|
@@ -2002,14 +2002,14 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
2002
2002
|
z: scale.z ?? 1
|
|
2003
2003
|
};
|
|
2004
2004
|
}
|
|
2005
|
-
toPositionVector3(target = new
|
|
2005
|
+
toPositionVector3(target = new THREE32.Vector3()) {
|
|
2006
2006
|
return target.set(this.position.x, this.position.y, this.position.z);
|
|
2007
2007
|
}
|
|
2008
|
-
toRotationEuler(target = new
|
|
2008
|
+
toRotationEuler(target = new THREE32.Euler(), order = "XYZ") {
|
|
2009
2009
|
return target.set(this.rotation.x, this.rotation.y, this.rotation.z, order);
|
|
2010
2010
|
}
|
|
2011
|
-
toRotationQuaternion(target = new
|
|
2012
|
-
const euler = new
|
|
2011
|
+
toRotationQuaternion(target = new THREE32.Quaternion(), order = "XYZ") {
|
|
2012
|
+
const euler = new THREE32.Euler(
|
|
2013
2013
|
this.rotation.x,
|
|
2014
2014
|
this.rotation.y,
|
|
2015
2015
|
this.rotation.z,
|
|
@@ -2017,7 +2017,7 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
2017
2017
|
);
|
|
2018
2018
|
return target.setFromEuler(euler);
|
|
2019
2019
|
}
|
|
2020
|
-
toScaleVector3(target = new
|
|
2020
|
+
toScaleVector3(target = new THREE32.Vector3()) {
|
|
2021
2021
|
return target.set(this.scale.x, this.scale.y, this.scale.z);
|
|
2022
2022
|
}
|
|
2023
2023
|
setPosition(input) {
|
|
@@ -2035,8 +2035,8 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
2035
2035
|
return this;
|
|
2036
2036
|
}
|
|
2037
2037
|
setRotation(input, order = "XYZ") {
|
|
2038
|
-
if (input instanceof
|
|
2039
|
-
const euler = new
|
|
2038
|
+
if (input instanceof THREE32.Quaternion) {
|
|
2039
|
+
const euler = new THREE32.Euler().setFromQuaternion(input, order);
|
|
2040
2040
|
this.rotation.x = euler.x;
|
|
2041
2041
|
this.rotation.y = euler.y;
|
|
2042
2042
|
this.rotation.z = euler.z;
|
|
@@ -2245,6 +2245,7 @@ __name(createVideoComponent, "createVideoComponent");
|
|
|
2245
2245
|
var _XRRigComponent = class _XRRigComponent extends Component {
|
|
2246
2246
|
constructor(options) {
|
|
2247
2247
|
super();
|
|
2248
|
+
this.trackingOrigin = options?.trackingOrigin ?? "floor";
|
|
2248
2249
|
this.locomotion = options?.locomotion ?? "teleport";
|
|
2249
2250
|
this.moveSpeed = options?.moveSpeed ?? 2;
|
|
2250
2251
|
this.snapTurn = options?.snapTurn ?? true;
|
|
@@ -2307,6 +2308,45 @@ function createXRInteractableComponent(world, entityId, ...args) {
|
|
|
2307
2308
|
}
|
|
2308
2309
|
__name(createXRInteractableComponent, "createXRInteractableComponent");
|
|
2309
2310
|
|
|
2311
|
+
// core/components/XRInteractor.ts
|
|
2312
|
+
var _XRInteractorComponent = class _XRInteractorComponent extends Component {
|
|
2313
|
+
constructor(options) {
|
|
2314
|
+
super();
|
|
2315
|
+
this.interactorType = options?.interactorType ?? "both";
|
|
2316
|
+
this.handPreset = options?.handPreset ?? "default";
|
|
2317
|
+
this.handColor = options?.handColor ?? "#e8b48a";
|
|
2318
|
+
this.handOpacity = options?.handOpacity ?? 1;
|
|
2319
|
+
this.handEmissiveIntensity = options?.handEmissiveIntensity ?? 0;
|
|
2320
|
+
this.showRay = options?.showRay ?? true;
|
|
2321
|
+
}
|
|
2322
|
+
};
|
|
2323
|
+
__name(_XRInteractorComponent, "XRInteractorComponent");
|
|
2324
|
+
var XRInteractorComponent = _XRInteractorComponent;
|
|
2325
|
+
var _XRInteractorSideComponent = class _XRInteractorSideComponent extends Component {
|
|
2326
|
+
constructor(options) {
|
|
2327
|
+
super();
|
|
2328
|
+
this.side = options?.side ?? "left";
|
|
2329
|
+
}
|
|
2330
|
+
};
|
|
2331
|
+
__name(_XRInteractorSideComponent, "XRInteractorSideComponent");
|
|
2332
|
+
var XRInteractorSideComponent = _XRInteractorSideComponent;
|
|
2333
|
+
|
|
2334
|
+
// core/factories/components/XRInteractorFactory.ts
|
|
2335
|
+
function createXRInteractorComponent(world, entityId, ...args) {
|
|
2336
|
+
const component = new XRInteractorComponent(...args);
|
|
2337
|
+
world.addComponent(entityId, component);
|
|
2338
|
+
return component;
|
|
2339
|
+
}
|
|
2340
|
+
__name(createXRInteractorComponent, "createXRInteractorComponent");
|
|
2341
|
+
|
|
2342
|
+
// core/factories/components/XRInteractorSideFactory.ts
|
|
2343
|
+
function createXRInteractorSideComponent(world, entityId, ...args) {
|
|
2344
|
+
const component = new XRInteractorSideComponent(...args);
|
|
2345
|
+
world.addComponent(entityId, component);
|
|
2346
|
+
return component;
|
|
2347
|
+
}
|
|
2348
|
+
__name(createXRInteractorSideComponent, "createXRInteractorSideComponent");
|
|
2349
|
+
|
|
2310
2350
|
// core/factories/registerDefaultComponentFactories.ts
|
|
2311
2351
|
function registerDefaultComponentFactories(objectManagementSystem) {
|
|
2312
2352
|
objectManagementSystem.registerComponentFactory("animation", createAnimationComponent);
|
|
@@ -2319,6 +2359,8 @@ function registerDefaultComponentFactories(objectManagementSystem) {
|
|
|
2319
2359
|
objectManagementSystem.registerComponentFactory("xrRig", createXRRigComponent);
|
|
2320
2360
|
objectManagementSystem.registerComponentFactory("vrTeleportArea", createVRTeleportAreaComponent);
|
|
2321
2361
|
objectManagementSystem.registerComponentFactory("xrInteractable", createXRInteractableComponent);
|
|
2362
|
+
objectManagementSystem.registerComponentFactory("xrInteractor", createXRInteractorComponent);
|
|
2363
|
+
objectManagementSystem.registerComponentFactory("xrInteractorSide", createXRInteractorSideComponent);
|
|
2322
2364
|
objectManagementSystem.registerComponentFactory(
|
|
2323
2365
|
"imageTargetAnchor",
|
|
2324
2366
|
createImageTargetAnchorComponent
|
|
@@ -2362,7 +2404,7 @@ var SHARED_MODEL_RESOURCE_FLAG = "spatialEcsSharedModelResource";
|
|
|
2362
2404
|
var modelCache = /* @__PURE__ */ new Map();
|
|
2363
2405
|
function markSharedResources(root) {
|
|
2364
2406
|
root.traverse((child) => {
|
|
2365
|
-
if (!(child instanceof
|
|
2407
|
+
if (!(child instanceof THREE32__namespace.Mesh)) {
|
|
2366
2408
|
return;
|
|
2367
2409
|
}
|
|
2368
2410
|
if (child.geometry) {
|
|
@@ -2436,10 +2478,10 @@ __name(createBaseEntity, "createBaseEntity");
|
|
|
2436
2478
|
// core/factories/objects/AudioFactory.ts
|
|
2437
2479
|
function getOrCreateListener(camera) {
|
|
2438
2480
|
const existing = camera.userData.ecsAudioListener;
|
|
2439
|
-
if (existing instanceof
|
|
2481
|
+
if (existing instanceof THREE32__namespace.AudioListener) {
|
|
2440
2482
|
return existing;
|
|
2441
2483
|
}
|
|
2442
|
-
const listener = new
|
|
2484
|
+
const listener = new THREE32__namespace.AudioListener();
|
|
2443
2485
|
camera.add(listener);
|
|
2444
2486
|
camera.userData.ecsAudioListener = listener;
|
|
2445
2487
|
return listener;
|
|
@@ -2452,7 +2494,7 @@ function createAudio({
|
|
|
2452
2494
|
payload,
|
|
2453
2495
|
isEditor
|
|
2454
2496
|
}) {
|
|
2455
|
-
const anchor = new
|
|
2497
|
+
const anchor = new THREE32__namespace.Object3D();
|
|
2456
2498
|
const entityId = createBaseEntity(world, anchor, {
|
|
2457
2499
|
label: payload.name ?? "Audio",
|
|
2458
2500
|
entityType: "audio",
|
|
@@ -2474,7 +2516,7 @@ function createAudio({
|
|
|
2474
2516
|
return entityId;
|
|
2475
2517
|
}
|
|
2476
2518
|
if (!isEditor) {
|
|
2477
|
-
const loader = new
|
|
2519
|
+
const loader = new THREE32__namespace.AudioLoader();
|
|
2478
2520
|
loader.load(
|
|
2479
2521
|
audio.path,
|
|
2480
2522
|
(buffer) => {
|
|
@@ -2549,7 +2591,7 @@ function applyCameraSettings(camera, options) {
|
|
|
2549
2591
|
const near = typeof options.near === "number" ? options.near : DEFAULT_NEAR2;
|
|
2550
2592
|
const far = typeof options.far === "number" ? options.far : DEFAULT_FAR2;
|
|
2551
2593
|
const projection = options.projection;
|
|
2552
|
-
if (camera instanceof
|
|
2594
|
+
if (camera instanceof THREE32__namespace.PerspectiveCamera) {
|
|
2553
2595
|
if (!projection || projection === "perspective") {
|
|
2554
2596
|
camera.fov = typeof options.fov === "number" ? options.fov : DEFAULT_FOV2;
|
|
2555
2597
|
}
|
|
@@ -2559,7 +2601,7 @@ function applyCameraSettings(camera, options) {
|
|
|
2559
2601
|
camera.updateProjectionMatrix();
|
|
2560
2602
|
return;
|
|
2561
2603
|
}
|
|
2562
|
-
if (camera instanceof
|
|
2604
|
+
if (camera instanceof THREE32__namespace.OrthographicCamera) {
|
|
2563
2605
|
camera.left = typeof options.left === "number" ? options.left : -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2564
2606
|
camera.right = typeof options.right === "number" ? options.right : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2565
2607
|
camera.top = typeof options.top === "number" ? options.top : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
@@ -2580,7 +2622,7 @@ function createCameraObject(options) {
|
|
|
2580
2622
|
const bottom = options.bottom ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2581
2623
|
const left = options.left ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2582
2624
|
const right = options.right ?? DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2583
|
-
const camera = new
|
|
2625
|
+
const camera = new THREE32__namespace.OrthographicCamera(
|
|
2584
2626
|
left,
|
|
2585
2627
|
right,
|
|
2586
2628
|
top,
|
|
@@ -2592,7 +2634,7 @@ function createCameraObject(options) {
|
|
|
2592
2634
|
camera.updateProjectionMatrix();
|
|
2593
2635
|
return camera;
|
|
2594
2636
|
}
|
|
2595
|
-
return new
|
|
2637
|
+
return new THREE32__namespace.PerspectiveCamera(
|
|
2596
2638
|
options.fov ?? DEFAULT_FOV2,
|
|
2597
2639
|
readViewportAspect(),
|
|
2598
2640
|
near,
|
|
@@ -2610,7 +2652,7 @@ function createCamera({ world, scene, camera, payload, isEditor }) {
|
|
|
2610
2652
|
transformInput: payload.transform
|
|
2611
2653
|
});
|
|
2612
2654
|
const objectRef = world.getComponent(entityId, Object3DRef);
|
|
2613
|
-
if (objectRef?.object instanceof
|
|
2655
|
+
if (objectRef?.object instanceof THREE32__namespace.Camera) {
|
|
2614
2656
|
objectRef.object.userData.entityId = entityId;
|
|
2615
2657
|
}
|
|
2616
2658
|
const componentOptions = {
|
|
@@ -2642,9 +2684,9 @@ function createCapsule({
|
|
|
2642
2684
|
scene,
|
|
2643
2685
|
payload
|
|
2644
2686
|
}) {
|
|
2645
|
-
const geometry = new
|
|
2646
|
-
const material = new
|
|
2647
|
-
const mesh = new
|
|
2687
|
+
const geometry = new THREE32__namespace.CapsuleGeometry(0.5, 1, 4, 8);
|
|
2688
|
+
const material = new THREE32__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
2689
|
+
const mesh = new THREE32__namespace.Mesh(geometry, material);
|
|
2648
2690
|
const entityId = createBaseEntity(world, mesh, {
|
|
2649
2691
|
label: payload.name ?? "Capsule",
|
|
2650
2692
|
entityType: "capsule",
|
|
@@ -2664,9 +2706,9 @@ function createCapsule({
|
|
|
2664
2706
|
}
|
|
2665
2707
|
__name(createCapsule, "createCapsule");
|
|
2666
2708
|
function createCube({ world, scene, payload }) {
|
|
2667
|
-
const geometry = new
|
|
2668
|
-
const material = new
|
|
2669
|
-
const mesh = new
|
|
2709
|
+
const geometry = new THREE32__namespace.BoxGeometry(1, 1, 1);
|
|
2710
|
+
const material = new THREE32__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
2711
|
+
const mesh = new THREE32__namespace.Mesh(geometry, material);
|
|
2670
2712
|
const entityId = createBaseEntity(world, mesh, {
|
|
2671
2713
|
label: payload.name ?? "Cube",
|
|
2672
2714
|
entityType: "cube",
|
|
@@ -2691,9 +2733,9 @@ function createCylinder({
|
|
|
2691
2733
|
scene,
|
|
2692
2734
|
payload
|
|
2693
2735
|
}) {
|
|
2694
|
-
const geometry = new
|
|
2695
|
-
const material = new
|
|
2696
|
-
const mesh = new
|
|
2736
|
+
const geometry = new THREE32__namespace.CylinderGeometry(0.5, 0.5, 1, 20);
|
|
2737
|
+
const material = new THREE32__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
2738
|
+
const mesh = new THREE32__namespace.Mesh(geometry, material);
|
|
2697
2739
|
const entityId = createBaseEntity(world, mesh, {
|
|
2698
2740
|
label: payload.name ?? "Cylinder",
|
|
2699
2741
|
entityType: "cylinder",
|
|
@@ -2713,7 +2755,7 @@ function createCylinder({
|
|
|
2713
2755
|
}
|
|
2714
2756
|
__name(createCylinder, "createCylinder");
|
|
2715
2757
|
function createEmpty({ world, scene, payload, isEditor }) {
|
|
2716
|
-
const object = new
|
|
2758
|
+
const object = new THREE32__namespace.Group();
|
|
2717
2759
|
const entityId = createBaseEntity(world, object, {
|
|
2718
2760
|
label: payload.name ?? "Empty",
|
|
2719
2761
|
entityType: "empty",
|
|
@@ -2724,7 +2766,7 @@ function createEmpty({ world, scene, payload, isEditor }) {
|
|
|
2724
2766
|
}
|
|
2725
2767
|
__name(createEmpty, "createEmpty");
|
|
2726
2768
|
function createImage({ world, scene, payload }) {
|
|
2727
|
-
const anchor = new
|
|
2769
|
+
const anchor = new THREE32__namespace.Object3D();
|
|
2728
2770
|
const imagePath = payload.path ?? "";
|
|
2729
2771
|
const entityId = createBaseEntity(world, anchor, {
|
|
2730
2772
|
label: payload.name ?? "Image",
|
|
@@ -2737,7 +2779,7 @@ function createImage({ world, scene, payload }) {
|
|
|
2737
2779
|
if (!imagePath) {
|
|
2738
2780
|
return entityId;
|
|
2739
2781
|
}
|
|
2740
|
-
const loader = new
|
|
2782
|
+
const loader = new THREE32__namespace.TextureLoader();
|
|
2741
2783
|
loader.load(
|
|
2742
2784
|
imagePath,
|
|
2743
2785
|
(texture) => {
|
|
@@ -2745,13 +2787,13 @@ function createImage({ world, scene, payload }) {
|
|
|
2745
2787
|
texture.dispose();
|
|
2746
2788
|
return;
|
|
2747
2789
|
}
|
|
2748
|
-
const material = new
|
|
2790
|
+
const material = new THREE32__namespace.MeshBasicMaterial({
|
|
2749
2791
|
map: texture,
|
|
2750
2792
|
transparent: true,
|
|
2751
|
-
side:
|
|
2793
|
+
side: THREE32__namespace.DoubleSide
|
|
2752
2794
|
});
|
|
2753
|
-
const geometry = new
|
|
2754
|
-
const plane = new
|
|
2795
|
+
const geometry = new THREE32__namespace.PlaneGeometry(1, 1);
|
|
2796
|
+
const plane = new THREE32__namespace.Mesh(geometry, material);
|
|
2755
2797
|
plane.userData.entityId = entityId;
|
|
2756
2798
|
const textureImage = texture.image;
|
|
2757
2799
|
const width = textureImage?.width ?? 1;
|
|
@@ -2797,7 +2839,7 @@ function createImageTarget({
|
|
|
2797
2839
|
payload,
|
|
2798
2840
|
isEditor
|
|
2799
2841
|
}) {
|
|
2800
|
-
const anchor = new
|
|
2842
|
+
const anchor = new THREE32__namespace.Object3D();
|
|
2801
2843
|
const imagePath = payload.path ?? "";
|
|
2802
2844
|
const entityId = createBaseEntity(world, anchor, {
|
|
2803
2845
|
label: payload.name ?? "Image Target",
|
|
@@ -2814,7 +2856,7 @@ function createImageTarget({
|
|
|
2814
2856
|
if (!isEditor || !imagePath) {
|
|
2815
2857
|
return entityId;
|
|
2816
2858
|
}
|
|
2817
|
-
const loader = new
|
|
2859
|
+
const loader = new THREE32__namespace.TextureLoader();
|
|
2818
2860
|
loader.load(
|
|
2819
2861
|
imagePath,
|
|
2820
2862
|
(texture) => {
|
|
@@ -2822,13 +2864,13 @@ function createImageTarget({
|
|
|
2822
2864
|
texture.dispose();
|
|
2823
2865
|
return;
|
|
2824
2866
|
}
|
|
2825
|
-
const material = new
|
|
2867
|
+
const material = new THREE32__namespace.MeshBasicMaterial({
|
|
2826
2868
|
map: texture,
|
|
2827
2869
|
transparent: true,
|
|
2828
|
-
side:
|
|
2870
|
+
side: THREE32__namespace.DoubleSide
|
|
2829
2871
|
});
|
|
2830
|
-
const geometry = new
|
|
2831
|
-
const plane = new
|
|
2872
|
+
const geometry = new THREE32__namespace.PlaneGeometry(1, 1);
|
|
2873
|
+
const plane = new THREE32__namespace.Mesh(geometry, material);
|
|
2832
2874
|
plane.userData.entityId = entityId;
|
|
2833
2875
|
const textureImage = texture.image;
|
|
2834
2876
|
const width = textureImage?.width ?? 1;
|
|
@@ -2879,7 +2921,7 @@ function createInstancedMesh({
|
|
|
2879
2921
|
scene,
|
|
2880
2922
|
payload
|
|
2881
2923
|
}) {
|
|
2882
|
-
const anchor = new
|
|
2924
|
+
const anchor = new THREE32__namespace.Object3D();
|
|
2883
2925
|
const opts = payload.options ?? {};
|
|
2884
2926
|
const meshKind = isInstancedMeshKind(opts.meshKind) ? opts.meshKind : "cube";
|
|
2885
2927
|
const meshParameters = opts.meshParameters && typeof opts.meshParameters === "object" ? opts.meshParameters : void 0;
|
|
@@ -2950,7 +2992,7 @@ function createAmbientLight({
|
|
|
2950
2992
|
scene,
|
|
2951
2993
|
payload
|
|
2952
2994
|
}) {
|
|
2953
|
-
const light = new
|
|
2995
|
+
const light = new THREE32__namespace.AmbientLight("#ffffff", 0.6);
|
|
2954
2996
|
const entityId = createBaseEntity(world, light, {
|
|
2955
2997
|
label: payload.name ?? "Ambient Light",
|
|
2956
2998
|
entityType: "ambientLight",
|
|
@@ -2967,7 +3009,7 @@ function createAreaLight({
|
|
|
2967
3009
|
payload,
|
|
2968
3010
|
isEditor
|
|
2969
3011
|
}) {
|
|
2970
|
-
const light = new
|
|
3012
|
+
const light = new THREE32__namespace.RectAreaLight("#ffffff", 5, 4, 4);
|
|
2971
3013
|
light.lookAt(0, 0, 0);
|
|
2972
3014
|
const entityId = createBaseEntity(world, light, {
|
|
2973
3015
|
label: payload.name ?? "Area Light",
|
|
@@ -2996,7 +3038,7 @@ function createDirectionalLight({
|
|
|
2996
3038
|
payload,
|
|
2997
3039
|
isEditor
|
|
2998
3040
|
}) {
|
|
2999
|
-
const light = new
|
|
3041
|
+
const light = new THREE32__namespace.DirectionalLight("#ffffff", 1.5);
|
|
3000
3042
|
light.castShadow = true;
|
|
3001
3043
|
const entityId = createBaseEntity(world, light, {
|
|
3002
3044
|
label: payload.name ?? "Directional Light",
|
|
@@ -3007,7 +3049,7 @@ function createDirectionalLight({
|
|
|
3007
3049
|
});
|
|
3008
3050
|
createLightComponent(world, entityId, light);
|
|
3009
3051
|
if (isEditor) {
|
|
3010
|
-
const helper = new
|
|
3052
|
+
const helper = new THREE32__namespace.DirectionalLightHelper(light, 1.8, "#38bdf8");
|
|
3011
3053
|
helper.onBeforeRender = () => {
|
|
3012
3054
|
helper.update();
|
|
3013
3055
|
};
|
|
@@ -3025,7 +3067,7 @@ function createPointLight({
|
|
|
3025
3067
|
payload,
|
|
3026
3068
|
isEditor
|
|
3027
3069
|
}) {
|
|
3028
|
-
const light = new
|
|
3070
|
+
const light = new THREE32__namespace.PointLight("#ffffff", 1, 10);
|
|
3029
3071
|
const entityId = createBaseEntity(world, light, {
|
|
3030
3072
|
label: payload.name ?? "Point Light",
|
|
3031
3073
|
entityType: "pointLight",
|
|
@@ -3035,7 +3077,7 @@ function createPointLight({
|
|
|
3035
3077
|
});
|
|
3036
3078
|
createLightComponent(world, entityId, light);
|
|
3037
3079
|
if (isEditor) {
|
|
3038
|
-
const helper = new
|
|
3080
|
+
const helper = new THREE32__namespace.PointLightHelper(light, 0.35, "#fbbf24");
|
|
3039
3081
|
helper.onBeforeRender = () => {
|
|
3040
3082
|
helper.update();
|
|
3041
3083
|
};
|
|
@@ -3053,7 +3095,7 @@ function createSpotLight({
|
|
|
3053
3095
|
payload,
|
|
3054
3096
|
isEditor
|
|
3055
3097
|
}) {
|
|
3056
|
-
const light = new
|
|
3098
|
+
const light = new THREE32__namespace.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
|
|
3057
3099
|
const entityId = createBaseEntity(world, light, {
|
|
3058
3100
|
label: payload.name ?? "Spot Light",
|
|
3059
3101
|
entityType: "spotLight",
|
|
@@ -3063,7 +3105,7 @@ function createSpotLight({
|
|
|
3063
3105
|
});
|
|
3064
3106
|
createLightComponent(world, entityId, light);
|
|
3065
3107
|
if (isEditor) {
|
|
3066
|
-
const helper = new
|
|
3108
|
+
const helper = new THREE32__namespace.SpotLightHelper(light, "#f59e0b");
|
|
3067
3109
|
helper.onBeforeRender = () => {
|
|
3068
3110
|
helper.update();
|
|
3069
3111
|
};
|
|
@@ -3123,7 +3165,7 @@ function createModel({
|
|
|
3123
3165
|
payload,
|
|
3124
3166
|
isEditor
|
|
3125
3167
|
}) {
|
|
3126
|
-
const anchor = new
|
|
3168
|
+
const anchor = new THREE32__namespace.Object3D();
|
|
3127
3169
|
const modelPath = payload.path ?? "";
|
|
3128
3170
|
const entityId = createBaseEntity(world, anchor, {
|
|
3129
3171
|
label: payload.name ?? "Model",
|
|
@@ -3189,12 +3231,12 @@ function createModel({
|
|
|
3189
3231
|
}
|
|
3190
3232
|
__name(createModel, "createModel");
|
|
3191
3233
|
function createPlane({ world, scene, payload }) {
|
|
3192
|
-
const geometry = new
|
|
3193
|
-
const material = new
|
|
3234
|
+
const geometry = new THREE32__namespace.PlaneGeometry(100, 100);
|
|
3235
|
+
const material = new THREE32__namespace.MeshStandardMaterial({
|
|
3194
3236
|
color: "#ffffff",
|
|
3195
|
-
side:
|
|
3237
|
+
side: THREE32__namespace.DoubleSide
|
|
3196
3238
|
});
|
|
3197
|
-
const mesh = new
|
|
3239
|
+
const mesh = new THREE32__namespace.Mesh(geometry, material);
|
|
3198
3240
|
const entityId = createBaseEntity(
|
|
3199
3241
|
world,
|
|
3200
3242
|
mesh,
|
|
@@ -3230,7 +3272,7 @@ function createScriptObject({
|
|
|
3230
3272
|
scene,
|
|
3231
3273
|
payload
|
|
3232
3274
|
}) {
|
|
3233
|
-
const object = new
|
|
3275
|
+
const object = new THREE32__namespace.Group();
|
|
3234
3276
|
const entityId = createBaseEntity(world, object, {
|
|
3235
3277
|
label: payload.name ?? "Script Object",
|
|
3236
3278
|
entityType: "scriptObject",
|
|
@@ -3255,15 +3297,15 @@ function createTeleportArea({
|
|
|
3255
3297
|
const options = payload.options ?? {};
|
|
3256
3298
|
const width = typeof options.width === "number" ? options.width : 10;
|
|
3257
3299
|
const depth = typeof options.depth === "number" ? options.depth : 10;
|
|
3258
|
-
const geometry = new
|
|
3259
|
-
const material = new
|
|
3300
|
+
const geometry = new THREE32__namespace.PlaneGeometry(width, depth);
|
|
3301
|
+
const material = new THREE32__namespace.MeshBasicMaterial({
|
|
3260
3302
|
color: "#4da3ff",
|
|
3261
3303
|
transparent: true,
|
|
3262
3304
|
opacity: 0.18,
|
|
3263
|
-
side:
|
|
3305
|
+
side: THREE32__namespace.DoubleSide,
|
|
3264
3306
|
depthWrite: false
|
|
3265
3307
|
});
|
|
3266
|
-
const object = new
|
|
3308
|
+
const object = new THREE32__namespace.Mesh(geometry, material);
|
|
3267
3309
|
const entityId = createBaseEntity(world, object, {
|
|
3268
3310
|
label: payload.name ?? "Teleport Area",
|
|
3269
3311
|
entityType: "teleportArea",
|
|
@@ -3286,12 +3328,40 @@ function createTeleportArea({
|
|
|
3286
3328
|
return entityId;
|
|
3287
3329
|
}
|
|
3288
3330
|
__name(createTeleportArea, "createTeleportArea");
|
|
3331
|
+
function createXRInteractor({
|
|
3332
|
+
world,
|
|
3333
|
+
scene,
|
|
3334
|
+
payload
|
|
3335
|
+
}) {
|
|
3336
|
+
const root = new THREE32__namespace.Group();
|
|
3337
|
+
const options = payload.options ?? {};
|
|
3338
|
+
const entityId = createBaseEntity(world, root, {
|
|
3339
|
+
label: payload.name ?? "XR Interactor",
|
|
3340
|
+
entityType: "xrInteractor",
|
|
3341
|
+
transformInput: payload.transform
|
|
3342
|
+
});
|
|
3343
|
+
world.addComponent(entityId, new XRInteractorComponent(options));
|
|
3344
|
+
scene.add(root);
|
|
3345
|
+
for (const side of ["left", "right"]) {
|
|
3346
|
+
const slot = new THREE32__namespace.Group();
|
|
3347
|
+
const label = side === "left" ? "Left Interactor" : "Right Interactor";
|
|
3348
|
+
const slotEntityId = createBaseEntity(world, slot, {
|
|
3349
|
+
label,
|
|
3350
|
+
entityType: "empty",
|
|
3351
|
+
parentId: entityId
|
|
3352
|
+
});
|
|
3353
|
+
world.addComponent(slotEntityId, new XRInteractorSideComponent({ side }));
|
|
3354
|
+
scene.add(slot);
|
|
3355
|
+
}
|
|
3356
|
+
return entityId;
|
|
3357
|
+
}
|
|
3358
|
+
__name(createXRInteractor, "createXRInteractor");
|
|
3289
3359
|
function createXRRig({
|
|
3290
3360
|
world,
|
|
3291
3361
|
scene,
|
|
3292
3362
|
payload
|
|
3293
3363
|
}) {
|
|
3294
|
-
const object = new
|
|
3364
|
+
const object = new THREE32__namespace.Group();
|
|
3295
3365
|
const entityId = createBaseEntity(world, object, {
|
|
3296
3366
|
label: payload.name ?? "XR Rig",
|
|
3297
3367
|
entityType: "xrRig",
|
|
@@ -3304,7 +3374,7 @@ function createXRRig({
|
|
|
3304
3374
|
}
|
|
3305
3375
|
__name(createXRRig, "createXRRig");
|
|
3306
3376
|
function createSprite({ world, scene, payload }) {
|
|
3307
|
-
const anchor = new
|
|
3377
|
+
const anchor = new THREE32__namespace.Object3D();
|
|
3308
3378
|
const imagePath = payload.path ?? "";
|
|
3309
3379
|
const entityId = createBaseEntity(world, anchor, {
|
|
3310
3380
|
label: payload.name ?? "Sprite",
|
|
@@ -3316,7 +3386,7 @@ function createSprite({ world, scene, payload }) {
|
|
|
3316
3386
|
if (!imagePath) {
|
|
3317
3387
|
return entityId;
|
|
3318
3388
|
}
|
|
3319
|
-
const loader = new
|
|
3389
|
+
const loader = new THREE32__namespace.TextureLoader();
|
|
3320
3390
|
loader.load(
|
|
3321
3391
|
imagePath,
|
|
3322
3392
|
(texture) => {
|
|
@@ -3324,11 +3394,11 @@ function createSprite({ world, scene, payload }) {
|
|
|
3324
3394
|
texture.dispose();
|
|
3325
3395
|
return;
|
|
3326
3396
|
}
|
|
3327
|
-
const material = new
|
|
3397
|
+
const material = new THREE32__namespace.SpriteMaterial({
|
|
3328
3398
|
map: texture,
|
|
3329
3399
|
transparent: true
|
|
3330
3400
|
});
|
|
3331
|
-
const sprite = new
|
|
3401
|
+
const sprite = new THREE32__namespace.Sprite(material);
|
|
3332
3402
|
sprite.userData.entityId = entityId;
|
|
3333
3403
|
const textureImage = texture.image;
|
|
3334
3404
|
spriteComponent.width = textureImage?.width ?? 1;
|
|
@@ -3346,9 +3416,9 @@ function createSprite({ world, scene, payload }) {
|
|
|
3346
3416
|
}
|
|
3347
3417
|
__name(createSprite, "createSprite");
|
|
3348
3418
|
function createSphere({ world, scene, payload }) {
|
|
3349
|
-
const geometry = new
|
|
3350
|
-
const material = new
|
|
3351
|
-
const mesh = new
|
|
3419
|
+
const geometry = new THREE32__namespace.SphereGeometry(0.5, 24, 24);
|
|
3420
|
+
const material = new THREE32__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
3421
|
+
const mesh = new THREE32__namespace.Mesh(geometry, material);
|
|
3352
3422
|
const entityId = createBaseEntity(world, mesh, {
|
|
3353
3423
|
label: payload.name ?? "Sphere",
|
|
3354
3424
|
entityType: "sphere",
|
|
@@ -3368,10 +3438,10 @@ function createSphere({ world, scene, payload }) {
|
|
|
3368
3438
|
__name(createSphere, "createSphere");
|
|
3369
3439
|
function getOrCreateListener2(camera) {
|
|
3370
3440
|
const existing = camera.userData.ecsAudioListener;
|
|
3371
|
-
if (existing instanceof
|
|
3441
|
+
if (existing instanceof THREE32__namespace.AudioListener) {
|
|
3372
3442
|
return existing;
|
|
3373
3443
|
}
|
|
3374
|
-
const listener = new
|
|
3444
|
+
const listener = new THREE32__namespace.AudioListener();
|
|
3375
3445
|
camera.add(listener);
|
|
3376
3446
|
camera.userData.ecsAudioListener = listener;
|
|
3377
3447
|
return listener;
|
|
@@ -3421,10 +3491,10 @@ function normalizeOptions(input) {
|
|
|
3421
3491
|
}
|
|
3422
3492
|
__name(normalizeOptions, "normalizeOptions");
|
|
3423
3493
|
function createChromaMaterial(texture, options) {
|
|
3424
|
-
return new
|
|
3494
|
+
return new THREE32__namespace.ShaderMaterial({
|
|
3425
3495
|
uniforms: {
|
|
3426
3496
|
tex: { value: texture },
|
|
3427
|
-
keyColor: { value: new
|
|
3497
|
+
keyColor: { value: new THREE32__namespace.Color(options.backgroundColor) },
|
|
3428
3498
|
similarity: { value: options.similarity },
|
|
3429
3499
|
smoothness: { value: options.smoothness },
|
|
3430
3500
|
spill: { value: options.spill }
|
|
@@ -3456,22 +3526,22 @@ function createChromaMaterial(texture, options) {
|
|
|
3456
3526
|
}
|
|
3457
3527
|
`,
|
|
3458
3528
|
transparent: true,
|
|
3459
|
-
side:
|
|
3529
|
+
side: THREE32__namespace.DoubleSide
|
|
3460
3530
|
});
|
|
3461
3531
|
}
|
|
3462
3532
|
__name(createChromaMaterial, "createChromaMaterial");
|
|
3463
3533
|
function createStandardMaterial(texture) {
|
|
3464
|
-
return new
|
|
3534
|
+
return new THREE32__namespace.MeshBasicMaterial({
|
|
3465
3535
|
map: texture,
|
|
3466
3536
|
transparent: true,
|
|
3467
|
-
side:
|
|
3537
|
+
side: THREE32__namespace.DoubleSide
|
|
3468
3538
|
});
|
|
3469
3539
|
}
|
|
3470
3540
|
__name(createStandardMaterial, "createStandardMaterial");
|
|
3471
3541
|
function createVideoMesh(entityId, texture, options) {
|
|
3472
|
-
const geometry = new
|
|
3542
|
+
const geometry = new THREE32__namespace.PlaneGeometry(1, 1);
|
|
3473
3543
|
const material = options.isGreenScreen ? createChromaMaterial(texture, options) : createStandardMaterial(texture);
|
|
3474
|
-
const mesh = new
|
|
3544
|
+
const mesh = new THREE32__namespace.Mesh(geometry, material);
|
|
3475
3545
|
mesh.userData.entityId = entityId;
|
|
3476
3546
|
mesh.scale.set(options.width, options.height, 1);
|
|
3477
3547
|
return { mesh, material };
|
|
@@ -3506,7 +3576,7 @@ function createVideo({
|
|
|
3506
3576
|
payload,
|
|
3507
3577
|
isEditor
|
|
3508
3578
|
}) {
|
|
3509
|
-
const anchor = new
|
|
3579
|
+
const anchor = new THREE32__namespace.Object3D();
|
|
3510
3580
|
const path = payload.path ?? "";
|
|
3511
3581
|
const options = normalizeOptions(payload.options);
|
|
3512
3582
|
const entityId = createBaseEntity(world, anchor, {
|
|
@@ -3521,8 +3591,8 @@ function createVideo({
|
|
|
3521
3591
|
return entityId;
|
|
3522
3592
|
}
|
|
3523
3593
|
const video = createVideoElement(path, options);
|
|
3524
|
-
const texture = new
|
|
3525
|
-
texture.colorSpace =
|
|
3594
|
+
const texture = new THREE32__namespace.VideoTexture(video);
|
|
3595
|
+
texture.colorSpace = THREE32__namespace.SRGBColorSpace;
|
|
3526
3596
|
texture.needsUpdate = true;
|
|
3527
3597
|
const { mesh, material } = createVideoMesh(entityId, texture, options);
|
|
3528
3598
|
anchor.add(mesh);
|
|
@@ -3538,7 +3608,7 @@ function createVideo({
|
|
|
3538
3608
|
});
|
|
3539
3609
|
if (!isEditor && options.positional) {
|
|
3540
3610
|
const listener = getOrCreateListener2(camera);
|
|
3541
|
-
const audioNode = new
|
|
3611
|
+
const audioNode = new THREE32__namespace.PositionalAudio(listener);
|
|
3542
3612
|
audioNode.setVolume(options.volume);
|
|
3543
3613
|
audioNode.setRefDistance(options.refDistance);
|
|
3544
3614
|
audioNode.setDistanceModel(normalizeDistanceModel2(options.distanceModel));
|
|
@@ -3579,6 +3649,7 @@ function registerDefaultFactories(objectManagementSystem) {
|
|
|
3579
3649
|
objectManagementSystem.register("areaLight", createAreaLight);
|
|
3580
3650
|
objectManagementSystem.register("scriptObject", createScriptObject);
|
|
3581
3651
|
objectManagementSystem.register("xrRig", createXRRig);
|
|
3652
|
+
objectManagementSystem.register("xrInteractor", createXRInteractor);
|
|
3582
3653
|
objectManagementSystem.register("teleportArea", createTeleportArea);
|
|
3583
3654
|
registerDefaultComponentFactories(objectManagementSystem);
|
|
3584
3655
|
}
|
|
@@ -3613,6 +3684,8 @@ exports.createTransformComponent = createTransformComponent;
|
|
|
3613
3684
|
exports.createVRTeleportAreaComponent = createVRTeleportAreaComponent;
|
|
3614
3685
|
exports.createVideoComponent = createVideoComponent;
|
|
3615
3686
|
exports.createXRInteractableComponent = createXRInteractableComponent;
|
|
3687
|
+
exports.createXRInteractorComponent = createXRInteractorComponent;
|
|
3688
|
+
exports.createXRInteractorSideComponent = createXRInteractorSideComponent;
|
|
3616
3689
|
exports.createXRRigComponent = createXRRigComponent;
|
|
3617
3690
|
exports.registerDefaultComponentFactories = registerDefaultComponentFactories;
|
|
3618
3691
|
exports.registerDefaultFactories = registerDefaultFactories;
|