@relu-interactives/spatial-ecs 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{System-CYWZ_Zx5.d.cts → System-vrU46Vuw.d.cts} +16 -2
- package/dist/{System-CYWZ_Zx5.d.ts → System-vrU46Vuw.d.ts} +16 -2
- package/dist/{Video-AIQYTAAr.d.cts → XRRig-CAmf04NX.d.ts} +131 -4
- package/dist/{Video-DlZ4G9ig.d.ts → XRRig-Cu-EyliG.d.cts} +131 -4
- package/dist/{chunk-PZ4CAALA.js → chunk-67WGASUJ.js} +3 -3
- package/dist/{chunk-PZ4CAALA.js.map → chunk-67WGASUJ.js.map} +1 -1
- package/dist/{chunk-AT5SPSPM.js → chunk-PCOZLCXS.js} +160 -83
- package/dist/chunk-PCOZLCXS.js.map +1 -0
- package/dist/{chunk-7BPHZWQ6.js → chunk-U3MDYKPV.js} +47 -3
- package/dist/chunk-U3MDYKPV.js.map +1 -0
- package/dist/{chunk-7JFSEV7A.js → chunk-VXUVNC7S.js} +633 -6
- package/dist/chunk-VXUVNC7S.js.map +1 -0
- package/dist/components/index.cjs +44 -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 +228 -107
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +9 -3
- package/dist/factories/index.d.ts +9 -3
- package/dist/factories/index.js +3 -3
- package/dist/{index-Gr8aCPRM.d.cts → index-CUFd71ri.d.cts} +12 -3
- package/dist/index-D84o_UA6.d.ts +488 -0
- package/dist/index-YYypJaVw.d.cts +488 -0
- package/dist/{index-BwiRJNIT.d.ts → index-w1oqWl_M.d.ts} +12 -3
- package/dist/index.cjs +971 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -8
- package/dist/index.d.ts +42 -8
- package/dist/index.js +24 -8
- package/dist/index.js.map +1 -1
- package/dist/systems/index.cjs +673 -1
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +3 -278
- package/dist/systems/index.d.ts +3 -278
- 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-7BPHZWQ6.js.map +0 -1
- package/dist/chunk-7JFSEV7A.js.map +0 -1
- package/dist/chunk-AT5SPSPM.js.map +0 -1
package/dist/factories/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var THREE31 = 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 THREE31__namespace = /*#__PURE__*/_interopNamespace(THREE31);
|
|
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 THREE31__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 THREE31__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 THREE31__namespace.PositionalAudio(listener) : new THREE31__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 THREE31__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 THREE31__namespace.EdgesGeometry(
|
|
531
|
+
new THREE31__namespace.OctahedronGeometry(0.22, 0)
|
|
532
532
|
);
|
|
533
|
-
const material2 = new
|
|
533
|
+
const material2 = new THREE31__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 THREE31__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 THREE31__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 THREE31__namespace.CanvasTexture(canvas);
|
|
583
583
|
texture.needsUpdate = true;
|
|
584
|
-
const material = new
|
|
584
|
+
const material = new THREE31__namespace.SpriteMaterial({
|
|
585
585
|
map: texture,
|
|
586
586
|
transparent: true,
|
|
587
587
|
depthTest: false
|
|
588
588
|
});
|
|
589
|
-
const helper = new
|
|
589
|
+
const helper = new THREE31__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 THREE31__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 THREE31__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 THREE31__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 THREE31__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 THREE31__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 THREE31__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 THREE31__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 THREE31__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 THREE31__namespace.PointLight) {
|
|
1294
1294
|
base.distance = light.distance;
|
|
1295
1295
|
base.decay = light.decay;
|
|
1296
|
-
} else if (light instanceof
|
|
1296
|
+
} else if (light instanceof THREE31__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 THREE31__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 THREE31__namespace.MeshPhysicalMaterial) {
|
|
1345
1345
|
return "physical";
|
|
1346
1346
|
}
|
|
1347
|
-
if (material instanceof
|
|
1347
|
+
if (material instanceof THREE31__namespace.MeshPhongMaterial) {
|
|
1348
1348
|
return "phong";
|
|
1349
1349
|
}
|
|
1350
|
-
if (material instanceof
|
|
1350
|
+
if (material instanceof THREE31__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 : THREE31__namespace.FrontSide,
|
|
1386
|
+
blending: typeof materialRecord.blending === "number" ? materialRecord.blending : THREE31__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 === THREE31__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: THREE31__namespace.FrontSide,
|
|
1434
|
+
blending: THREE31__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 THREE31.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 THREE31.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 THREE31.Quaternion(), order = "XYZ") {
|
|
2012
|
+
const euler = new THREE31.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 THREE31.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 THREE31.Quaternion) {
|
|
2039
|
+
const euler = new THREE31.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;
|
|
@@ -2241,6 +2241,71 @@ function createVideoComponent(world, entityId, ...args) {
|
|
|
2241
2241
|
}
|
|
2242
2242
|
__name(createVideoComponent, "createVideoComponent");
|
|
2243
2243
|
|
|
2244
|
+
// core/components/XRRig.ts
|
|
2245
|
+
var _XRRigComponent = class _XRRigComponent extends Component {
|
|
2246
|
+
constructor(options) {
|
|
2247
|
+
super();
|
|
2248
|
+
this.locomotion = options?.locomotion ?? "teleport";
|
|
2249
|
+
this.moveSpeed = options?.moveSpeed ?? 2;
|
|
2250
|
+
this.snapTurn = options?.snapTurn ?? true;
|
|
2251
|
+
this.snapTurnDegrees = options?.snapTurnDegrees ?? 30;
|
|
2252
|
+
this.fallbackEyeHeight = options?.fallbackEyeHeight ?? 1.6;
|
|
2253
|
+
}
|
|
2254
|
+
};
|
|
2255
|
+
__name(_XRRigComponent, "XRRigComponent");
|
|
2256
|
+
var XRRigComponent = _XRRigComponent;
|
|
2257
|
+
|
|
2258
|
+
// core/factories/components/XRRigFactory.ts
|
|
2259
|
+
function createXRRigComponent(world, entityId, ...args) {
|
|
2260
|
+
const component = new XRRigComponent(...args);
|
|
2261
|
+
world.addComponent(entityId, component);
|
|
2262
|
+
return component;
|
|
2263
|
+
}
|
|
2264
|
+
__name(createXRRigComponent, "createXRRigComponent");
|
|
2265
|
+
|
|
2266
|
+
// core/components/VRTeleportArea.ts
|
|
2267
|
+
var _VRTeleportAreaComponent = class _VRTeleportAreaComponent extends Component {
|
|
2268
|
+
constructor(options) {
|
|
2269
|
+
super();
|
|
2270
|
+
this.enabled = options?.enabled ?? true;
|
|
2271
|
+
this.shape = options?.shape ?? "plane";
|
|
2272
|
+
this.width = options?.width ?? 10;
|
|
2273
|
+
this.depth = options?.depth ?? 10;
|
|
2274
|
+
}
|
|
2275
|
+
};
|
|
2276
|
+
__name(_VRTeleportAreaComponent, "VRTeleportAreaComponent");
|
|
2277
|
+
var VRTeleportAreaComponent = _VRTeleportAreaComponent;
|
|
2278
|
+
|
|
2279
|
+
// core/factories/components/VRTeleportAreaFactory.ts
|
|
2280
|
+
function createVRTeleportAreaComponent(world, entityId, ...args) {
|
|
2281
|
+
const component = new VRTeleportAreaComponent(...args);
|
|
2282
|
+
world.addComponent(entityId, component);
|
|
2283
|
+
return component;
|
|
2284
|
+
}
|
|
2285
|
+
__name(createVRTeleportAreaComponent, "createVRTeleportAreaComponent");
|
|
2286
|
+
|
|
2287
|
+
// core/components/XRInteractable.ts
|
|
2288
|
+
var _XRInteractableComponent = class _XRInteractableComponent extends Component {
|
|
2289
|
+
constructor(options) {
|
|
2290
|
+
super();
|
|
2291
|
+
this.enabled = options?.enabled ?? true;
|
|
2292
|
+
this.grabbable = options?.grabbable ?? true;
|
|
2293
|
+
this.pointable = options?.pointable ?? true;
|
|
2294
|
+
this.grabMode = options?.grabMode ?? "kinematic";
|
|
2295
|
+
this.highlightOnHover = options?.highlightOnHover ?? true;
|
|
2296
|
+
}
|
|
2297
|
+
};
|
|
2298
|
+
__name(_XRInteractableComponent, "XRInteractableComponent");
|
|
2299
|
+
var XRInteractableComponent = _XRInteractableComponent;
|
|
2300
|
+
|
|
2301
|
+
// core/factories/components/XRInteractableFactory.ts
|
|
2302
|
+
function createXRInteractableComponent(world, entityId, ...args) {
|
|
2303
|
+
const component = new XRInteractableComponent(...args);
|
|
2304
|
+
world.addComponent(entityId, component);
|
|
2305
|
+
return component;
|
|
2306
|
+
}
|
|
2307
|
+
__name(createXRInteractableComponent, "createXRInteractableComponent");
|
|
2308
|
+
|
|
2244
2309
|
// core/factories/registerDefaultComponentFactories.ts
|
|
2245
2310
|
function registerDefaultComponentFactories(objectManagementSystem) {
|
|
2246
2311
|
objectManagementSystem.registerComponentFactory("animation", createAnimationComponent);
|
|
@@ -2250,6 +2315,9 @@ function registerDefaultComponentFactories(objectManagementSystem) {
|
|
|
2250
2315
|
objectManagementSystem.registerComponentFactory("environment", createEnvironmentComponent);
|
|
2251
2316
|
objectManagementSystem.registerComponentFactory("entityType", createEntityTypeComponent);
|
|
2252
2317
|
objectManagementSystem.registerComponentFactory("image", createImageComponent);
|
|
2318
|
+
objectManagementSystem.registerComponentFactory("xrRig", createXRRigComponent);
|
|
2319
|
+
objectManagementSystem.registerComponentFactory("vrTeleportArea", createVRTeleportAreaComponent);
|
|
2320
|
+
objectManagementSystem.registerComponentFactory("xrInteractable", createXRInteractableComponent);
|
|
2253
2321
|
objectManagementSystem.registerComponentFactory(
|
|
2254
2322
|
"imageTargetAnchor",
|
|
2255
2323
|
createImageTargetAnchorComponent
|
|
@@ -2293,7 +2361,7 @@ var SHARED_MODEL_RESOURCE_FLAG = "spatialEcsSharedModelResource";
|
|
|
2293
2361
|
var modelCache = /* @__PURE__ */ new Map();
|
|
2294
2362
|
function markSharedResources(root) {
|
|
2295
2363
|
root.traverse((child) => {
|
|
2296
|
-
if (!(child instanceof
|
|
2364
|
+
if (!(child instanceof THREE31__namespace.Mesh)) {
|
|
2297
2365
|
return;
|
|
2298
2366
|
}
|
|
2299
2367
|
if (child.geometry) {
|
|
@@ -2367,10 +2435,10 @@ __name(createBaseEntity, "createBaseEntity");
|
|
|
2367
2435
|
// core/factories/objects/AudioFactory.ts
|
|
2368
2436
|
function getOrCreateListener(camera) {
|
|
2369
2437
|
const existing = camera.userData.ecsAudioListener;
|
|
2370
|
-
if (existing instanceof
|
|
2438
|
+
if (existing instanceof THREE31__namespace.AudioListener) {
|
|
2371
2439
|
return existing;
|
|
2372
2440
|
}
|
|
2373
|
-
const listener = new
|
|
2441
|
+
const listener = new THREE31__namespace.AudioListener();
|
|
2374
2442
|
camera.add(listener);
|
|
2375
2443
|
camera.userData.ecsAudioListener = listener;
|
|
2376
2444
|
return listener;
|
|
@@ -2383,7 +2451,7 @@ function createAudio({
|
|
|
2383
2451
|
payload,
|
|
2384
2452
|
isEditor
|
|
2385
2453
|
}) {
|
|
2386
|
-
const anchor = new
|
|
2454
|
+
const anchor = new THREE31__namespace.Object3D();
|
|
2387
2455
|
const entityId = createBaseEntity(world, anchor, {
|
|
2388
2456
|
label: payload.name ?? "Audio",
|
|
2389
2457
|
entityType: "audio",
|
|
@@ -2405,7 +2473,7 @@ function createAudio({
|
|
|
2405
2473
|
return entityId;
|
|
2406
2474
|
}
|
|
2407
2475
|
if (!isEditor) {
|
|
2408
|
-
const loader = new
|
|
2476
|
+
const loader = new THREE31__namespace.AudioLoader();
|
|
2409
2477
|
loader.load(
|
|
2410
2478
|
audio.path,
|
|
2411
2479
|
(buffer) => {
|
|
@@ -2480,7 +2548,7 @@ function applyCameraSettings(camera, options) {
|
|
|
2480
2548
|
const near = typeof options.near === "number" ? options.near : DEFAULT_NEAR2;
|
|
2481
2549
|
const far = typeof options.far === "number" ? options.far : DEFAULT_FAR2;
|
|
2482
2550
|
const projection = options.projection;
|
|
2483
|
-
if (camera instanceof
|
|
2551
|
+
if (camera instanceof THREE31__namespace.PerspectiveCamera) {
|
|
2484
2552
|
if (!projection || projection === "perspective") {
|
|
2485
2553
|
camera.fov = typeof options.fov === "number" ? options.fov : DEFAULT_FOV2;
|
|
2486
2554
|
}
|
|
@@ -2490,7 +2558,7 @@ function applyCameraSettings(camera, options) {
|
|
|
2490
2558
|
camera.updateProjectionMatrix();
|
|
2491
2559
|
return;
|
|
2492
2560
|
}
|
|
2493
|
-
if (camera instanceof
|
|
2561
|
+
if (camera instanceof THREE31__namespace.OrthographicCamera) {
|
|
2494
2562
|
camera.left = typeof options.left === "number" ? options.left : -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2495
2563
|
camera.right = typeof options.right === "number" ? options.right : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2496
2564
|
camera.top = typeof options.top === "number" ? options.top : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
@@ -2511,7 +2579,7 @@ function createCameraObject(options) {
|
|
|
2511
2579
|
const bottom = options.bottom ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2512
2580
|
const left = options.left ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2513
2581
|
const right = options.right ?? DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2514
|
-
const camera = new
|
|
2582
|
+
const camera = new THREE31__namespace.OrthographicCamera(
|
|
2515
2583
|
left,
|
|
2516
2584
|
right,
|
|
2517
2585
|
top,
|
|
@@ -2523,7 +2591,7 @@ function createCameraObject(options) {
|
|
|
2523
2591
|
camera.updateProjectionMatrix();
|
|
2524
2592
|
return camera;
|
|
2525
2593
|
}
|
|
2526
|
-
return new
|
|
2594
|
+
return new THREE31__namespace.PerspectiveCamera(
|
|
2527
2595
|
options.fov ?? DEFAULT_FOV2,
|
|
2528
2596
|
readViewportAspect(),
|
|
2529
2597
|
near,
|
|
@@ -2541,7 +2609,7 @@ function createCamera({ world, scene, camera, payload, isEditor }) {
|
|
|
2541
2609
|
transformInput: payload.transform
|
|
2542
2610
|
});
|
|
2543
2611
|
const objectRef = world.getComponent(entityId, Object3DRef);
|
|
2544
|
-
if (objectRef?.object instanceof
|
|
2612
|
+
if (objectRef?.object instanceof THREE31__namespace.Camera) {
|
|
2545
2613
|
objectRef.object.userData.entityId = entityId;
|
|
2546
2614
|
}
|
|
2547
2615
|
const componentOptions = {
|
|
@@ -2573,9 +2641,9 @@ function createCapsule({
|
|
|
2573
2641
|
scene,
|
|
2574
2642
|
payload
|
|
2575
2643
|
}) {
|
|
2576
|
-
const geometry = new
|
|
2577
|
-
const material = new
|
|
2578
|
-
const mesh = new
|
|
2644
|
+
const geometry = new THREE31__namespace.CapsuleGeometry(0.5, 1, 4, 8);
|
|
2645
|
+
const material = new THREE31__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
2646
|
+
const mesh = new THREE31__namespace.Mesh(geometry, material);
|
|
2579
2647
|
const entityId = createBaseEntity(world, mesh, {
|
|
2580
2648
|
label: payload.name ?? "Capsule",
|
|
2581
2649
|
entityType: "capsule",
|
|
@@ -2595,9 +2663,9 @@ function createCapsule({
|
|
|
2595
2663
|
}
|
|
2596
2664
|
__name(createCapsule, "createCapsule");
|
|
2597
2665
|
function createCube({ world, scene, payload }) {
|
|
2598
|
-
const geometry = new
|
|
2599
|
-
const material = new
|
|
2600
|
-
const mesh = new
|
|
2666
|
+
const geometry = new THREE31__namespace.BoxGeometry(1, 1, 1);
|
|
2667
|
+
const material = new THREE31__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
2668
|
+
const mesh = new THREE31__namespace.Mesh(geometry, material);
|
|
2601
2669
|
const entityId = createBaseEntity(world, mesh, {
|
|
2602
2670
|
label: payload.name ?? "Cube",
|
|
2603
2671
|
entityType: "cube",
|
|
@@ -2622,9 +2690,9 @@ function createCylinder({
|
|
|
2622
2690
|
scene,
|
|
2623
2691
|
payload
|
|
2624
2692
|
}) {
|
|
2625
|
-
const geometry = new
|
|
2626
|
-
const material = new
|
|
2627
|
-
const mesh = new
|
|
2693
|
+
const geometry = new THREE31__namespace.CylinderGeometry(0.5, 0.5, 1, 20);
|
|
2694
|
+
const material = new THREE31__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
2695
|
+
const mesh = new THREE31__namespace.Mesh(geometry, material);
|
|
2628
2696
|
const entityId = createBaseEntity(world, mesh, {
|
|
2629
2697
|
label: payload.name ?? "Cylinder",
|
|
2630
2698
|
entityType: "cylinder",
|
|
@@ -2644,7 +2712,7 @@ function createCylinder({
|
|
|
2644
2712
|
}
|
|
2645
2713
|
__name(createCylinder, "createCylinder");
|
|
2646
2714
|
function createEmpty({ world, scene, payload, isEditor }) {
|
|
2647
|
-
const object = new
|
|
2715
|
+
const object = new THREE31__namespace.Group();
|
|
2648
2716
|
const entityId = createBaseEntity(world, object, {
|
|
2649
2717
|
label: payload.name ?? "Empty",
|
|
2650
2718
|
entityType: "empty",
|
|
@@ -2655,7 +2723,7 @@ function createEmpty({ world, scene, payload, isEditor }) {
|
|
|
2655
2723
|
}
|
|
2656
2724
|
__name(createEmpty, "createEmpty");
|
|
2657
2725
|
function createImage({ world, scene, payload }) {
|
|
2658
|
-
const anchor = new
|
|
2726
|
+
const anchor = new THREE31__namespace.Object3D();
|
|
2659
2727
|
const imagePath = payload.path ?? "";
|
|
2660
2728
|
const entityId = createBaseEntity(world, anchor, {
|
|
2661
2729
|
label: payload.name ?? "Image",
|
|
@@ -2668,7 +2736,7 @@ function createImage({ world, scene, payload }) {
|
|
|
2668
2736
|
if (!imagePath) {
|
|
2669
2737
|
return entityId;
|
|
2670
2738
|
}
|
|
2671
|
-
const loader = new
|
|
2739
|
+
const loader = new THREE31__namespace.TextureLoader();
|
|
2672
2740
|
loader.load(
|
|
2673
2741
|
imagePath,
|
|
2674
2742
|
(texture) => {
|
|
@@ -2676,13 +2744,13 @@ function createImage({ world, scene, payload }) {
|
|
|
2676
2744
|
texture.dispose();
|
|
2677
2745
|
return;
|
|
2678
2746
|
}
|
|
2679
|
-
const material = new
|
|
2747
|
+
const material = new THREE31__namespace.MeshBasicMaterial({
|
|
2680
2748
|
map: texture,
|
|
2681
2749
|
transparent: true,
|
|
2682
|
-
side:
|
|
2750
|
+
side: THREE31__namespace.DoubleSide
|
|
2683
2751
|
});
|
|
2684
|
-
const geometry = new
|
|
2685
|
-
const plane = new
|
|
2752
|
+
const geometry = new THREE31__namespace.PlaneGeometry(1, 1);
|
|
2753
|
+
const plane = new THREE31__namespace.Mesh(geometry, material);
|
|
2686
2754
|
plane.userData.entityId = entityId;
|
|
2687
2755
|
const textureImage = texture.image;
|
|
2688
2756
|
const width = textureImage?.width ?? 1;
|
|
@@ -2728,7 +2796,7 @@ function createImageTarget({
|
|
|
2728
2796
|
payload,
|
|
2729
2797
|
isEditor
|
|
2730
2798
|
}) {
|
|
2731
|
-
const anchor = new
|
|
2799
|
+
const anchor = new THREE31__namespace.Object3D();
|
|
2732
2800
|
const imagePath = payload.path ?? "";
|
|
2733
2801
|
const entityId = createBaseEntity(world, anchor, {
|
|
2734
2802
|
label: payload.name ?? "Image Target",
|
|
@@ -2745,7 +2813,7 @@ function createImageTarget({
|
|
|
2745
2813
|
if (!isEditor || !imagePath) {
|
|
2746
2814
|
return entityId;
|
|
2747
2815
|
}
|
|
2748
|
-
const loader = new
|
|
2816
|
+
const loader = new THREE31__namespace.TextureLoader();
|
|
2749
2817
|
loader.load(
|
|
2750
2818
|
imagePath,
|
|
2751
2819
|
(texture) => {
|
|
@@ -2753,13 +2821,13 @@ function createImageTarget({
|
|
|
2753
2821
|
texture.dispose();
|
|
2754
2822
|
return;
|
|
2755
2823
|
}
|
|
2756
|
-
const material = new
|
|
2824
|
+
const material = new THREE31__namespace.MeshBasicMaterial({
|
|
2757
2825
|
map: texture,
|
|
2758
2826
|
transparent: true,
|
|
2759
|
-
side:
|
|
2827
|
+
side: THREE31__namespace.DoubleSide
|
|
2760
2828
|
});
|
|
2761
|
-
const geometry = new
|
|
2762
|
-
const plane = new
|
|
2829
|
+
const geometry = new THREE31__namespace.PlaneGeometry(1, 1);
|
|
2830
|
+
const plane = new THREE31__namespace.Mesh(geometry, material);
|
|
2763
2831
|
plane.userData.entityId = entityId;
|
|
2764
2832
|
const textureImage = texture.image;
|
|
2765
2833
|
const width = textureImage?.width ?? 1;
|
|
@@ -2810,7 +2878,7 @@ function createInstancedMesh({
|
|
|
2810
2878
|
scene,
|
|
2811
2879
|
payload
|
|
2812
2880
|
}) {
|
|
2813
|
-
const anchor = new
|
|
2881
|
+
const anchor = new THREE31__namespace.Object3D();
|
|
2814
2882
|
const opts = payload.options ?? {};
|
|
2815
2883
|
const meshKind = isInstancedMeshKind(opts.meshKind) ? opts.meshKind : "cube";
|
|
2816
2884
|
const meshParameters = opts.meshParameters && typeof opts.meshParameters === "object" ? opts.meshParameters : void 0;
|
|
@@ -2881,7 +2949,7 @@ function createAmbientLight({
|
|
|
2881
2949
|
scene,
|
|
2882
2950
|
payload
|
|
2883
2951
|
}) {
|
|
2884
|
-
const light = new
|
|
2952
|
+
const light = new THREE31__namespace.AmbientLight("#ffffff", 0.6);
|
|
2885
2953
|
const entityId = createBaseEntity(world, light, {
|
|
2886
2954
|
label: payload.name ?? "Ambient Light",
|
|
2887
2955
|
entityType: "ambientLight",
|
|
@@ -2898,7 +2966,7 @@ function createAreaLight({
|
|
|
2898
2966
|
payload,
|
|
2899
2967
|
isEditor
|
|
2900
2968
|
}) {
|
|
2901
|
-
const light = new
|
|
2969
|
+
const light = new THREE31__namespace.RectAreaLight("#ffffff", 5, 4, 4);
|
|
2902
2970
|
light.lookAt(0, 0, 0);
|
|
2903
2971
|
const entityId = createBaseEntity(world, light, {
|
|
2904
2972
|
label: payload.name ?? "Area Light",
|
|
@@ -2927,7 +2995,7 @@ function createDirectionalLight({
|
|
|
2927
2995
|
payload,
|
|
2928
2996
|
isEditor
|
|
2929
2997
|
}) {
|
|
2930
|
-
const light = new
|
|
2998
|
+
const light = new THREE31__namespace.DirectionalLight("#ffffff", 1.5);
|
|
2931
2999
|
light.castShadow = true;
|
|
2932
3000
|
const entityId = createBaseEntity(world, light, {
|
|
2933
3001
|
label: payload.name ?? "Directional Light",
|
|
@@ -2938,7 +3006,7 @@ function createDirectionalLight({
|
|
|
2938
3006
|
});
|
|
2939
3007
|
createLightComponent(world, entityId, light);
|
|
2940
3008
|
if (isEditor) {
|
|
2941
|
-
const helper = new
|
|
3009
|
+
const helper = new THREE31__namespace.DirectionalLightHelper(light, 1.8, "#38bdf8");
|
|
2942
3010
|
helper.onBeforeRender = () => {
|
|
2943
3011
|
helper.update();
|
|
2944
3012
|
};
|
|
@@ -2956,7 +3024,7 @@ function createPointLight({
|
|
|
2956
3024
|
payload,
|
|
2957
3025
|
isEditor
|
|
2958
3026
|
}) {
|
|
2959
|
-
const light = new
|
|
3027
|
+
const light = new THREE31__namespace.PointLight("#ffffff", 1, 10);
|
|
2960
3028
|
const entityId = createBaseEntity(world, light, {
|
|
2961
3029
|
label: payload.name ?? "Point Light",
|
|
2962
3030
|
entityType: "pointLight",
|
|
@@ -2966,7 +3034,7 @@ function createPointLight({
|
|
|
2966
3034
|
});
|
|
2967
3035
|
createLightComponent(world, entityId, light);
|
|
2968
3036
|
if (isEditor) {
|
|
2969
|
-
const helper = new
|
|
3037
|
+
const helper = new THREE31__namespace.PointLightHelper(light, 0.35, "#fbbf24");
|
|
2970
3038
|
helper.onBeforeRender = () => {
|
|
2971
3039
|
helper.update();
|
|
2972
3040
|
};
|
|
@@ -2984,7 +3052,7 @@ function createSpotLight({
|
|
|
2984
3052
|
payload,
|
|
2985
3053
|
isEditor
|
|
2986
3054
|
}) {
|
|
2987
|
-
const light = new
|
|
3055
|
+
const light = new THREE31__namespace.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
|
|
2988
3056
|
const entityId = createBaseEntity(world, light, {
|
|
2989
3057
|
label: payload.name ?? "Spot Light",
|
|
2990
3058
|
entityType: "spotLight",
|
|
@@ -2994,7 +3062,7 @@ function createSpotLight({
|
|
|
2994
3062
|
});
|
|
2995
3063
|
createLightComponent(world, entityId, light);
|
|
2996
3064
|
if (isEditor) {
|
|
2997
|
-
const helper = new
|
|
3065
|
+
const helper = new THREE31__namespace.SpotLightHelper(light, "#f59e0b");
|
|
2998
3066
|
helper.onBeforeRender = () => {
|
|
2999
3067
|
helper.update();
|
|
3000
3068
|
};
|
|
@@ -3054,7 +3122,7 @@ function createModel({
|
|
|
3054
3122
|
payload,
|
|
3055
3123
|
isEditor
|
|
3056
3124
|
}) {
|
|
3057
|
-
const anchor = new
|
|
3125
|
+
const anchor = new THREE31__namespace.Object3D();
|
|
3058
3126
|
const modelPath = payload.path ?? "";
|
|
3059
3127
|
const entityId = createBaseEntity(world, anchor, {
|
|
3060
3128
|
label: payload.name ?? "Model",
|
|
@@ -3120,12 +3188,12 @@ function createModel({
|
|
|
3120
3188
|
}
|
|
3121
3189
|
__name(createModel, "createModel");
|
|
3122
3190
|
function createPlane({ world, scene, payload }) {
|
|
3123
|
-
const geometry = new
|
|
3124
|
-
const material = new
|
|
3191
|
+
const geometry = new THREE31__namespace.PlaneGeometry(100, 100);
|
|
3192
|
+
const material = new THREE31__namespace.MeshStandardMaterial({
|
|
3125
3193
|
color: "#ffffff",
|
|
3126
|
-
side:
|
|
3194
|
+
side: THREE31__namespace.DoubleSide
|
|
3127
3195
|
});
|
|
3128
|
-
const mesh = new
|
|
3196
|
+
const mesh = new THREE31__namespace.Mesh(geometry, material);
|
|
3129
3197
|
const entityId = createBaseEntity(
|
|
3130
3198
|
world,
|
|
3131
3199
|
mesh,
|
|
@@ -3161,7 +3229,7 @@ function createScriptObject({
|
|
|
3161
3229
|
scene,
|
|
3162
3230
|
payload
|
|
3163
3231
|
}) {
|
|
3164
|
-
const object = new
|
|
3232
|
+
const object = new THREE31__namespace.Group();
|
|
3165
3233
|
const entityId = createBaseEntity(world, object, {
|
|
3166
3234
|
label: payload.name ?? "Script Object",
|
|
3167
3235
|
entityType: "scriptObject",
|
|
@@ -3178,8 +3246,56 @@ function createScriptObject({
|
|
|
3178
3246
|
return entityId;
|
|
3179
3247
|
}
|
|
3180
3248
|
__name(createScriptObject, "createScriptObject");
|
|
3249
|
+
function createTeleportArea({
|
|
3250
|
+
world,
|
|
3251
|
+
scene,
|
|
3252
|
+
payload
|
|
3253
|
+
}) {
|
|
3254
|
+
const options = payload.options ?? {};
|
|
3255
|
+
const width = typeof options.width === "number" ? options.width : 10;
|
|
3256
|
+
const depth = typeof options.depth === "number" ? options.depth : 10;
|
|
3257
|
+
const geometry = new THREE31__namespace.PlaneGeometry(width, depth);
|
|
3258
|
+
const material = new THREE31__namespace.MeshBasicMaterial({
|
|
3259
|
+
color: "#4da3ff",
|
|
3260
|
+
transparent: true,
|
|
3261
|
+
opacity: 0.18,
|
|
3262
|
+
side: THREE31__namespace.DoubleSide,
|
|
3263
|
+
depthWrite: false
|
|
3264
|
+
});
|
|
3265
|
+
const object = new THREE31__namespace.Mesh(geometry, material);
|
|
3266
|
+
object.rotation.x = -Math.PI / 2;
|
|
3267
|
+
const entityId = createBaseEntity(world, object, {
|
|
3268
|
+
label: payload.name ?? "Teleport Area",
|
|
3269
|
+
entityType: "teleportArea",
|
|
3270
|
+
transformInput: payload.transform
|
|
3271
|
+
});
|
|
3272
|
+
world.addComponent(
|
|
3273
|
+
entityId,
|
|
3274
|
+
new VRTeleportAreaComponent({ width, depth, ...options })
|
|
3275
|
+
);
|
|
3276
|
+
scene.add(object);
|
|
3277
|
+
return entityId;
|
|
3278
|
+
}
|
|
3279
|
+
__name(createTeleportArea, "createTeleportArea");
|
|
3280
|
+
function createXRRig({
|
|
3281
|
+
world,
|
|
3282
|
+
scene,
|
|
3283
|
+
payload
|
|
3284
|
+
}) {
|
|
3285
|
+
const object = new THREE31__namespace.Group();
|
|
3286
|
+
const entityId = createBaseEntity(world, object, {
|
|
3287
|
+
label: payload.name ?? "XR Rig",
|
|
3288
|
+
entityType: "xrRig",
|
|
3289
|
+
transformInput: payload.transform
|
|
3290
|
+
});
|
|
3291
|
+
const options = payload.options ?? {};
|
|
3292
|
+
world.addComponent(entityId, new XRRigComponent(options));
|
|
3293
|
+
scene.add(object);
|
|
3294
|
+
return entityId;
|
|
3295
|
+
}
|
|
3296
|
+
__name(createXRRig, "createXRRig");
|
|
3181
3297
|
function createSprite({ world, scene, payload }) {
|
|
3182
|
-
const anchor = new
|
|
3298
|
+
const anchor = new THREE31__namespace.Object3D();
|
|
3183
3299
|
const imagePath = payload.path ?? "";
|
|
3184
3300
|
const entityId = createBaseEntity(world, anchor, {
|
|
3185
3301
|
label: payload.name ?? "Sprite",
|
|
@@ -3191,7 +3307,7 @@ function createSprite({ world, scene, payload }) {
|
|
|
3191
3307
|
if (!imagePath) {
|
|
3192
3308
|
return entityId;
|
|
3193
3309
|
}
|
|
3194
|
-
const loader = new
|
|
3310
|
+
const loader = new THREE31__namespace.TextureLoader();
|
|
3195
3311
|
loader.load(
|
|
3196
3312
|
imagePath,
|
|
3197
3313
|
(texture) => {
|
|
@@ -3199,11 +3315,11 @@ function createSprite({ world, scene, payload }) {
|
|
|
3199
3315
|
texture.dispose();
|
|
3200
3316
|
return;
|
|
3201
3317
|
}
|
|
3202
|
-
const material = new
|
|
3318
|
+
const material = new THREE31__namespace.SpriteMaterial({
|
|
3203
3319
|
map: texture,
|
|
3204
3320
|
transparent: true
|
|
3205
3321
|
});
|
|
3206
|
-
const sprite = new
|
|
3322
|
+
const sprite = new THREE31__namespace.Sprite(material);
|
|
3207
3323
|
sprite.userData.entityId = entityId;
|
|
3208
3324
|
const textureImage = texture.image;
|
|
3209
3325
|
spriteComponent.width = textureImage?.width ?? 1;
|
|
@@ -3221,9 +3337,9 @@ function createSprite({ world, scene, payload }) {
|
|
|
3221
3337
|
}
|
|
3222
3338
|
__name(createSprite, "createSprite");
|
|
3223
3339
|
function createSphere({ world, scene, payload }) {
|
|
3224
|
-
const geometry = new
|
|
3225
|
-
const material = new
|
|
3226
|
-
const mesh = new
|
|
3340
|
+
const geometry = new THREE31__namespace.SphereGeometry(0.5, 24, 24);
|
|
3341
|
+
const material = new THREE31__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
3342
|
+
const mesh = new THREE31__namespace.Mesh(geometry, material);
|
|
3227
3343
|
const entityId = createBaseEntity(world, mesh, {
|
|
3228
3344
|
label: payload.name ?? "Sphere",
|
|
3229
3345
|
entityType: "sphere",
|
|
@@ -3243,10 +3359,10 @@ function createSphere({ world, scene, payload }) {
|
|
|
3243
3359
|
__name(createSphere, "createSphere");
|
|
3244
3360
|
function getOrCreateListener2(camera) {
|
|
3245
3361
|
const existing = camera.userData.ecsAudioListener;
|
|
3246
|
-
if (existing instanceof
|
|
3362
|
+
if (existing instanceof THREE31__namespace.AudioListener) {
|
|
3247
3363
|
return existing;
|
|
3248
3364
|
}
|
|
3249
|
-
const listener = new
|
|
3365
|
+
const listener = new THREE31__namespace.AudioListener();
|
|
3250
3366
|
camera.add(listener);
|
|
3251
3367
|
camera.userData.ecsAudioListener = listener;
|
|
3252
3368
|
return listener;
|
|
@@ -3296,10 +3412,10 @@ function normalizeOptions(input) {
|
|
|
3296
3412
|
}
|
|
3297
3413
|
__name(normalizeOptions, "normalizeOptions");
|
|
3298
3414
|
function createChromaMaterial(texture, options) {
|
|
3299
|
-
return new
|
|
3415
|
+
return new THREE31__namespace.ShaderMaterial({
|
|
3300
3416
|
uniforms: {
|
|
3301
3417
|
tex: { value: texture },
|
|
3302
|
-
keyColor: { value: new
|
|
3418
|
+
keyColor: { value: new THREE31__namespace.Color(options.backgroundColor) },
|
|
3303
3419
|
similarity: { value: options.similarity },
|
|
3304
3420
|
smoothness: { value: options.smoothness },
|
|
3305
3421
|
spill: { value: options.spill }
|
|
@@ -3331,22 +3447,22 @@ function createChromaMaterial(texture, options) {
|
|
|
3331
3447
|
}
|
|
3332
3448
|
`,
|
|
3333
3449
|
transparent: true,
|
|
3334
|
-
side:
|
|
3450
|
+
side: THREE31__namespace.DoubleSide
|
|
3335
3451
|
});
|
|
3336
3452
|
}
|
|
3337
3453
|
__name(createChromaMaterial, "createChromaMaterial");
|
|
3338
3454
|
function createStandardMaterial(texture) {
|
|
3339
|
-
return new
|
|
3455
|
+
return new THREE31__namespace.MeshBasicMaterial({
|
|
3340
3456
|
map: texture,
|
|
3341
3457
|
transparent: true,
|
|
3342
|
-
side:
|
|
3458
|
+
side: THREE31__namespace.DoubleSide
|
|
3343
3459
|
});
|
|
3344
3460
|
}
|
|
3345
3461
|
__name(createStandardMaterial, "createStandardMaterial");
|
|
3346
3462
|
function createVideoMesh(entityId, texture, options) {
|
|
3347
|
-
const geometry = new
|
|
3463
|
+
const geometry = new THREE31__namespace.PlaneGeometry(1, 1);
|
|
3348
3464
|
const material = options.isGreenScreen ? createChromaMaterial(texture, options) : createStandardMaterial(texture);
|
|
3349
|
-
const mesh = new
|
|
3465
|
+
const mesh = new THREE31__namespace.Mesh(geometry, material);
|
|
3350
3466
|
mesh.userData.entityId = entityId;
|
|
3351
3467
|
mesh.scale.set(options.width, options.height, 1);
|
|
3352
3468
|
return { mesh, material };
|
|
@@ -3381,7 +3497,7 @@ function createVideo({
|
|
|
3381
3497
|
payload,
|
|
3382
3498
|
isEditor
|
|
3383
3499
|
}) {
|
|
3384
|
-
const anchor = new
|
|
3500
|
+
const anchor = new THREE31__namespace.Object3D();
|
|
3385
3501
|
const path = payload.path ?? "";
|
|
3386
3502
|
const options = normalizeOptions(payload.options);
|
|
3387
3503
|
const entityId = createBaseEntity(world, anchor, {
|
|
@@ -3396,8 +3512,8 @@ function createVideo({
|
|
|
3396
3512
|
return entityId;
|
|
3397
3513
|
}
|
|
3398
3514
|
const video = createVideoElement(path, options);
|
|
3399
|
-
const texture = new
|
|
3400
|
-
texture.colorSpace =
|
|
3515
|
+
const texture = new THREE31__namespace.VideoTexture(video);
|
|
3516
|
+
texture.colorSpace = THREE31__namespace.SRGBColorSpace;
|
|
3401
3517
|
texture.needsUpdate = true;
|
|
3402
3518
|
const { mesh, material } = createVideoMesh(entityId, texture, options);
|
|
3403
3519
|
anchor.add(mesh);
|
|
@@ -3413,7 +3529,7 @@ function createVideo({
|
|
|
3413
3529
|
});
|
|
3414
3530
|
if (!isEditor && options.positional) {
|
|
3415
3531
|
const listener = getOrCreateListener2(camera);
|
|
3416
|
-
const audioNode = new
|
|
3532
|
+
const audioNode = new THREE31__namespace.PositionalAudio(listener);
|
|
3417
3533
|
audioNode.setVolume(options.volume);
|
|
3418
3534
|
audioNode.setRefDistance(options.refDistance);
|
|
3419
3535
|
audioNode.setDistanceModel(normalizeDistanceModel2(options.distanceModel));
|
|
@@ -3453,6 +3569,8 @@ function registerDefaultFactories(objectManagementSystem) {
|
|
|
3453
3569
|
objectManagementSystem.register("spotLight", createSpotLight);
|
|
3454
3570
|
objectManagementSystem.register("areaLight", createAreaLight);
|
|
3455
3571
|
objectManagementSystem.register("scriptObject", createScriptObject);
|
|
3572
|
+
objectManagementSystem.register("xrRig", createXRRig);
|
|
3573
|
+
objectManagementSystem.register("teleportArea", createTeleportArea);
|
|
3456
3574
|
registerDefaultComponentFactories(objectManagementSystem);
|
|
3457
3575
|
}
|
|
3458
3576
|
__name(registerDefaultFactories, "registerDefaultFactories");
|
|
@@ -3483,7 +3601,10 @@ exports.createSelectableComponent = createSelectableComponent;
|
|
|
3483
3601
|
exports.createSelectionTransformStateComponent = createSelectionTransformStateComponent;
|
|
3484
3602
|
exports.createSpriteComponent = createSpriteComponent;
|
|
3485
3603
|
exports.createTransformComponent = createTransformComponent;
|
|
3604
|
+
exports.createVRTeleportAreaComponent = createVRTeleportAreaComponent;
|
|
3486
3605
|
exports.createVideoComponent = createVideoComponent;
|
|
3606
|
+
exports.createXRInteractableComponent = createXRInteractableComponent;
|
|
3607
|
+
exports.createXRRigComponent = createXRRigComponent;
|
|
3487
3608
|
exports.registerDefaultComponentFactories = registerDefaultComponentFactories;
|
|
3488
3609
|
exports.registerDefaultFactories = registerDefaultFactories;
|
|
3489
3610
|
//# sourceMappingURL=index.cjs.map
|