@relu-interactives/spatial-ecs 0.2.4 → 0.2.5
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-BTyYvKVH.d.cts → System-CIiWteft.d.cts} +2 -2
- package/dist/{System-BTyYvKVH.d.ts → System-CIiWteft.d.ts} +2 -2
- package/dist/{Video-D2H5H-K3.d.cts → Video-ChVFs9Tl.d.cts} +139 -75
- package/dist/{Video-BWhbvVPg.d.ts → Video-DCMCLInA.d.ts} +139 -75
- package/dist/{chunk-XWIEEJ7Z.js → chunk-4A66FSFT.js} +128 -82
- package/dist/chunk-4A66FSFT.js.map +1 -0
- package/dist/{chunk-AYEF3X2P.js → chunk-CRP3W2GK.js} +3 -3
- package/dist/chunk-CRP3W2GK.js.map +1 -0
- package/dist/{chunk-MAWBTMCG.js → chunk-KRZLEPRI.js} +156 -88
- package/dist/chunk-KRZLEPRI.js.map +1 -0
- package/dist/{chunk-NFDTIYR4.js → chunk-NB6I5JJN.js} +17 -2
- package/dist/chunk-NB6I5JJN.js.map +1 -0
- package/dist/{chunk-P2YDX5DB.js → chunk-RXCUHGRB.js} +124 -5
- package/dist/chunk-RXCUHGRB.js.map +1 -0
- package/dist/components/index.cjs +161 -93
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +1 -1
- package/dist/factories/index.cjs +217 -105
- 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-KdEzEZox.d.cts → index-D1I5L7bA.d.cts} +8 -3
- package/dist/{index-Dm6zF1MY.d.ts → index-DGZDgt3p.d.ts} +8 -3
- package/dist/index.cjs +468 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +51 -12
- package/dist/index.js.map +1 -1
- package/dist/systems/index.cjs +248 -63
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +15 -3
- package/dist/systems/index.d.ts +15 -3
- package/dist/systems/index.js +3 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/worldSnapshotUtils.cjs +15 -0
- package/dist/worldSnapshotUtils.cjs.map +1 -1
- package/dist/worldSnapshotUtils.d.cts +1 -1
- package/dist/worldSnapshotUtils.d.ts +1 -1
- package/dist/worldSnapshotUtils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AYEF3X2P.js.map +0 -1
- package/dist/chunk-MAWBTMCG.js.map +0 -1
- package/dist/chunk-NFDTIYR4.js.map +0 -1
- package/dist/chunk-P2YDX5DB.js.map +0 -1
- package/dist/chunk-XWIEEJ7Z.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var THREE5 = require('three');
|
|
4
4
|
|
|
5
5
|
function _interopNamespace(e) {
|
|
6
6
|
if (e && e.__esModule) return e;
|
|
@@ -20,7 +20,7 @@ function _interopNamespace(e) {
|
|
|
20
20
|
return Object.freeze(n);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var THREE5__namespace = /*#__PURE__*/_interopNamespace(THREE5);
|
|
24
24
|
|
|
25
25
|
var __defProp = Object.defineProperty;
|
|
26
26
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -293,14 +293,14 @@ var _AnimationComponent = class _AnimationComponent extends Component {
|
|
|
293
293
|
return;
|
|
294
294
|
}
|
|
295
295
|
this.importedClips = clips.map((entry) => {
|
|
296
|
-
if (entry instanceof
|
|
296
|
+
if (entry instanceof THREE5__namespace.AnimationClip) {
|
|
297
297
|
return { clip: entry, sourceUrl: null };
|
|
298
298
|
}
|
|
299
299
|
if (!entry || typeof entry !== "object") {
|
|
300
300
|
return null;
|
|
301
301
|
}
|
|
302
302
|
const candidate = entry;
|
|
303
|
-
if (!(candidate.clip instanceof
|
|
303
|
+
if (!(candidate.clip instanceof THREE5__namespace.AnimationClip)) {
|
|
304
304
|
return null;
|
|
305
305
|
}
|
|
306
306
|
return {
|
|
@@ -434,7 +434,7 @@ var DEFAULT_ORTHO_TOP = 5;
|
|
|
434
434
|
var DEFAULT_ORTHO_BOTTOM = -5;
|
|
435
435
|
var DEFAULT_ZOOM = 1;
|
|
436
436
|
function inferProjection(camera) {
|
|
437
|
-
if (camera instanceof
|
|
437
|
+
if (camera instanceof THREE5__namespace.OrthographicCamera) {
|
|
438
438
|
return "orthographic";
|
|
439
439
|
}
|
|
440
440
|
return "perspective";
|
|
@@ -455,7 +455,7 @@ function readCameraFar(camera) {
|
|
|
455
455
|
}
|
|
456
456
|
__name(readCameraFar, "readCameraFar");
|
|
457
457
|
function inferFov(camera) {
|
|
458
|
-
if (camera instanceof
|
|
458
|
+
if (camera instanceof THREE5__namespace.PerspectiveCamera && Number.isFinite(camera.fov)) {
|
|
459
459
|
return camera.fov;
|
|
460
460
|
}
|
|
461
461
|
return DEFAULT_FOV;
|
|
@@ -478,28 +478,28 @@ function inferFar(camera) {
|
|
|
478
478
|
}
|
|
479
479
|
__name(inferFar, "inferFar");
|
|
480
480
|
function inferOrthoLeft(camera) {
|
|
481
|
-
if (camera instanceof
|
|
481
|
+
if (camera instanceof THREE5__namespace.OrthographicCamera && Number.isFinite(camera.left)) {
|
|
482
482
|
return camera.left;
|
|
483
483
|
}
|
|
484
484
|
return DEFAULT_ORTHO_LEFT;
|
|
485
485
|
}
|
|
486
486
|
__name(inferOrthoLeft, "inferOrthoLeft");
|
|
487
487
|
function inferOrthoRight(camera) {
|
|
488
|
-
if (camera instanceof
|
|
488
|
+
if (camera instanceof THREE5__namespace.OrthographicCamera && Number.isFinite(camera.right)) {
|
|
489
489
|
return camera.right;
|
|
490
490
|
}
|
|
491
491
|
return DEFAULT_ORTHO_RIGHT;
|
|
492
492
|
}
|
|
493
493
|
__name(inferOrthoRight, "inferOrthoRight");
|
|
494
494
|
function inferOrthoTop(camera) {
|
|
495
|
-
if (camera instanceof
|
|
495
|
+
if (camera instanceof THREE5__namespace.OrthographicCamera && Number.isFinite(camera.top)) {
|
|
496
496
|
return camera.top;
|
|
497
497
|
}
|
|
498
498
|
return DEFAULT_ORTHO_TOP;
|
|
499
499
|
}
|
|
500
500
|
__name(inferOrthoTop, "inferOrthoTop");
|
|
501
501
|
function inferOrthoBottom(camera) {
|
|
502
|
-
if (camera instanceof
|
|
502
|
+
if (camera instanceof THREE5__namespace.OrthographicCamera && Number.isFinite(camera.bottom)) {
|
|
503
503
|
return camera.bottom;
|
|
504
504
|
}
|
|
505
505
|
return DEFAULT_ORTHO_BOTTOM;
|
|
@@ -515,7 +515,7 @@ __name(inferZoom, "inferZoom");
|
|
|
515
515
|
var _CameraComponent = class _CameraComponent extends Component {
|
|
516
516
|
constructor(payload = {}) {
|
|
517
517
|
super();
|
|
518
|
-
this.camera = payload.camera ?? new
|
|
518
|
+
this.camera = payload.camera ?? new THREE5__namespace.PerspectiveCamera();
|
|
519
519
|
this.type = payload.type ?? "3d";
|
|
520
520
|
this.isDefault = typeof payload.isDefault === "boolean" ? payload.isDefault : false;
|
|
521
521
|
this.projection = payload.projection ?? inferProjection(payload.camera);
|
|
@@ -950,6 +950,135 @@ var _Postprocessing = class _Postprocessing extends Component {
|
|
|
950
950
|
};
|
|
951
951
|
__name(_Postprocessing, "Postprocessing");
|
|
952
952
|
var Postprocessing = _Postprocessing;
|
|
953
|
+
var DEFAULT_MESH_GEOMETRY_PARAMETERS = {
|
|
954
|
+
capsule: { radius: 0.5, height: 1 },
|
|
955
|
+
cube: { width: 1, height: 1, depth: 1 },
|
|
956
|
+
cylinder: { radius: 0.5, height: 1 },
|
|
957
|
+
model: {},
|
|
958
|
+
plane: { width: 100, height: 100 },
|
|
959
|
+
sphere: { radius: 0.5 }
|
|
960
|
+
};
|
|
961
|
+
var GEOMETRY_TYPE_BY_KIND = {
|
|
962
|
+
capsule: "CapsuleGeometry",
|
|
963
|
+
cube: "BoxGeometry",
|
|
964
|
+
cylinder: "CylinderGeometry",
|
|
965
|
+
model: "Model",
|
|
966
|
+
plane: "PlaneGeometry",
|
|
967
|
+
sphere: "SphereGeometry"
|
|
968
|
+
};
|
|
969
|
+
var _MeshGeometryComponent = class _MeshGeometryComponent extends Component {
|
|
970
|
+
constructor(kind, object, parameters, options) {
|
|
971
|
+
super();
|
|
972
|
+
this.kind = kind;
|
|
973
|
+
this.geometryType = GEOMETRY_TYPE_BY_KIND[kind];
|
|
974
|
+
this.object = object;
|
|
975
|
+
this.modelName = options?.modelName ?? "";
|
|
976
|
+
this.castShadow = options?.castShadow ?? false;
|
|
977
|
+
this.receiveShadow = options?.receiveShadow ?? false;
|
|
978
|
+
switch (kind) {
|
|
979
|
+
case "cube":
|
|
980
|
+
this.parameters = {
|
|
981
|
+
...DEFAULT_MESH_GEOMETRY_PARAMETERS.cube,
|
|
982
|
+
...parameters
|
|
983
|
+
};
|
|
984
|
+
break;
|
|
985
|
+
case "plane":
|
|
986
|
+
this.parameters = {
|
|
987
|
+
...DEFAULT_MESH_GEOMETRY_PARAMETERS.plane,
|
|
988
|
+
...parameters
|
|
989
|
+
};
|
|
990
|
+
break;
|
|
991
|
+
case "sphere":
|
|
992
|
+
this.parameters = {
|
|
993
|
+
...DEFAULT_MESH_GEOMETRY_PARAMETERS.sphere,
|
|
994
|
+
...parameters
|
|
995
|
+
};
|
|
996
|
+
break;
|
|
997
|
+
case "cylinder":
|
|
998
|
+
this.parameters = {
|
|
999
|
+
...DEFAULT_MESH_GEOMETRY_PARAMETERS.cylinder,
|
|
1000
|
+
...parameters
|
|
1001
|
+
};
|
|
1002
|
+
break;
|
|
1003
|
+
case "capsule":
|
|
1004
|
+
this.parameters = {
|
|
1005
|
+
...DEFAULT_MESH_GEOMETRY_PARAMETERS.capsule,
|
|
1006
|
+
...parameters
|
|
1007
|
+
};
|
|
1008
|
+
break;
|
|
1009
|
+
case "model":
|
|
1010
|
+
this.parameters = {};
|
|
1011
|
+
break;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
1015
|
+
__name(_MeshGeometryComponent, "MeshGeometryComponent");
|
|
1016
|
+
var MeshGeometryComponent = _MeshGeometryComponent;
|
|
1017
|
+
|
|
1018
|
+
// core/components/InstancedMesh.ts
|
|
1019
|
+
var DEFAULT_INSTANCE_TRANSFORM = {
|
|
1020
|
+
position: { x: 0, y: 0, z: 0 },
|
|
1021
|
+
rotation: { x: 0, y: 0, z: 0 },
|
|
1022
|
+
scale: { x: 1, y: 1, z: 1 }
|
|
1023
|
+
};
|
|
1024
|
+
var DEFAULT_INSTANCED_MESH_PARAMETERS = {
|
|
1025
|
+
capsule: DEFAULT_MESH_GEOMETRY_PARAMETERS.capsule,
|
|
1026
|
+
cube: DEFAULT_MESH_GEOMETRY_PARAMETERS.cube,
|
|
1027
|
+
cylinder: DEFAULT_MESH_GEOMETRY_PARAMETERS.cylinder,
|
|
1028
|
+
plane: DEFAULT_MESH_GEOMETRY_PARAMETERS.plane,
|
|
1029
|
+
sphere: DEFAULT_MESH_GEOMETRY_PARAMETERS.sphere
|
|
1030
|
+
};
|
|
1031
|
+
var _InstancedMeshComponent = class _InstancedMeshComponent extends Component {
|
|
1032
|
+
constructor(meshKind = "cube", meshParameters, options) {
|
|
1033
|
+
super();
|
|
1034
|
+
this.meshKind = meshKind;
|
|
1035
|
+
this.meshParameters = {
|
|
1036
|
+
...DEFAULT_INSTANCED_MESH_PARAMETERS[meshKind],
|
|
1037
|
+
...meshParameters ?? {}
|
|
1038
|
+
};
|
|
1039
|
+
this.castShadow = options?.castShadow ?? false;
|
|
1040
|
+
this.receiveShadow = options?.receiveShadow ?? false;
|
|
1041
|
+
this.instances = options?.instances && options.instances.length > 0 ? options.instances : [{ ...DEFAULT_INSTANCE_TRANSFORM }];
|
|
1042
|
+
this.instancedMesh = null;
|
|
1043
|
+
}
|
|
1044
|
+
/** Sanitize and return a copy of the current mesh parameters with valid values. */
|
|
1045
|
+
getSanitizedParameters() {
|
|
1046
|
+
const MIN_DIM = 0.01;
|
|
1047
|
+
const MIN_RAD = 1e-3;
|
|
1048
|
+
const sanitize = /* @__PURE__ */ __name((v, min) => Number.isFinite(v) ? Math.max(min, v) : min, "sanitize");
|
|
1049
|
+
switch (this.meshKind) {
|
|
1050
|
+
case "cube": {
|
|
1051
|
+
const p = this.meshParameters;
|
|
1052
|
+
return {
|
|
1053
|
+
width: sanitize(p.width, MIN_DIM),
|
|
1054
|
+
height: sanitize(p.height, MIN_DIM),
|
|
1055
|
+
depth: sanitize(p.depth, MIN_DIM)
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
case "plane": {
|
|
1059
|
+
const p = this.meshParameters;
|
|
1060
|
+
return {
|
|
1061
|
+
width: sanitize(p.width, MIN_DIM),
|
|
1062
|
+
height: sanitize(p.height, MIN_DIM)
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
case "sphere": {
|
|
1066
|
+
const p = this.meshParameters;
|
|
1067
|
+
return { radius: sanitize(p.radius, MIN_RAD) };
|
|
1068
|
+
}
|
|
1069
|
+
case "cylinder":
|
|
1070
|
+
case "capsule": {
|
|
1071
|
+
const p = this.meshParameters;
|
|
1072
|
+
return {
|
|
1073
|
+
radius: sanitize(p.radius, MIN_RAD),
|
|
1074
|
+
height: sanitize(p.height, MIN_DIM)
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
__name(_InstancedMeshComponent, "InstancedMeshComponent");
|
|
1081
|
+
var InstancedMeshComponent = _InstancedMeshComponent;
|
|
953
1082
|
|
|
954
1083
|
// core/components/Physics.ts
|
|
955
1084
|
var DEFAULT_RIGIDBODY_STATE = {
|
|
@@ -1209,15 +1338,15 @@ function createValueState(light) {
|
|
|
1209
1338
|
castShadow: light.castShadow ?? false,
|
|
1210
1339
|
frustumCulling: light.frustumCulled
|
|
1211
1340
|
};
|
|
1212
|
-
if (light instanceof
|
|
1341
|
+
if (light instanceof THREE5__namespace.PointLight) {
|
|
1213
1342
|
base.distance = light.distance;
|
|
1214
1343
|
base.decay = light.decay;
|
|
1215
|
-
} else if (light instanceof
|
|
1344
|
+
} else if (light instanceof THREE5__namespace.SpotLight) {
|
|
1216
1345
|
base.distance = light.distance;
|
|
1217
1346
|
base.decay = light.decay;
|
|
1218
1347
|
base.angle = light.angle;
|
|
1219
1348
|
base.penumbra = light.penumbra;
|
|
1220
|
-
} else if (light instanceof
|
|
1349
|
+
} else if (light instanceof THREE5__namespace.RectAreaLight) {
|
|
1221
1350
|
base.width = light.width;
|
|
1222
1351
|
base.height = light.height;
|
|
1223
1352
|
}
|
|
@@ -1252,13 +1381,13 @@ function toHexColor2(value, fallback) {
|
|
|
1252
1381
|
}
|
|
1253
1382
|
__name(toHexColor2, "toHexColor");
|
|
1254
1383
|
function getMaterialType(material) {
|
|
1255
|
-
if (material instanceof
|
|
1384
|
+
if (material instanceof THREE5__namespace.MeshPhysicalMaterial) {
|
|
1256
1385
|
return "physical";
|
|
1257
1386
|
}
|
|
1258
|
-
if (material instanceof
|
|
1387
|
+
if (material instanceof THREE5__namespace.MeshPhongMaterial) {
|
|
1259
1388
|
return "phong";
|
|
1260
1389
|
}
|
|
1261
|
-
if (material instanceof
|
|
1390
|
+
if (material instanceof THREE5__namespace.MeshBasicMaterial) {
|
|
1262
1391
|
return "basic";
|
|
1263
1392
|
}
|
|
1264
1393
|
return "standard";
|
|
@@ -1277,8 +1406,8 @@ function createMaterialValue(material) {
|
|
|
1277
1406
|
opacity: typeof materialRecord.opacity === "number" ? materialRecord.opacity : 1,
|
|
1278
1407
|
emissive: toHexColor2(materialRecord.emissive, "#000000"),
|
|
1279
1408
|
emissiveIntensity: typeof materialRecord.emissiveIntensity === "number" ? materialRecord.emissiveIntensity : 0,
|
|
1280
|
-
side: typeof materialRecord.side === "number" ? materialRecord.side :
|
|
1281
|
-
blending: typeof materialRecord.blending === "number" ? materialRecord.blending :
|
|
1409
|
+
side: typeof materialRecord.side === "number" ? materialRecord.side : THREE5__namespace.FrontSide,
|
|
1410
|
+
blending: typeof materialRecord.blending === "number" ? materialRecord.blending : THREE5__namespace.NormalBlending,
|
|
1282
1411
|
depthTest: materialRecord.depthTest !== false,
|
|
1283
1412
|
depthWrite: materialRecord.depthWrite !== false,
|
|
1284
1413
|
wireframe: Boolean(materialRecord.wireframe),
|
|
@@ -1294,7 +1423,7 @@ function createMaterialValue(material) {
|
|
|
1294
1423
|
displacementMap: materialRecord.displacementMap?.image?.src,
|
|
1295
1424
|
lightMap: materialRecord.lightMap?.image?.src,
|
|
1296
1425
|
envMap: materialRecord.envMap?.image?.src,
|
|
1297
|
-
textureFiltering: map?.magFilter ===
|
|
1426
|
+
textureFiltering: map?.magFilter === THREE5__namespace.NearestFilter ? "sharp" : "smooth",
|
|
1298
1427
|
useMipmaps: map?.generateMipmaps !== false
|
|
1299
1428
|
};
|
|
1300
1429
|
}
|
|
@@ -1309,8 +1438,8 @@ function defaultMaterialValue() {
|
|
|
1309
1438
|
opacity: 1,
|
|
1310
1439
|
emissive: "#000000",
|
|
1311
1440
|
emissiveIntensity: 0,
|
|
1312
|
-
side:
|
|
1313
|
-
blending:
|
|
1441
|
+
side: THREE5__namespace.FrontSide,
|
|
1442
|
+
blending: THREE5__namespace.NormalBlending,
|
|
1314
1443
|
depthTest: true,
|
|
1315
1444
|
depthWrite: true,
|
|
1316
1445
|
wireframe: false,
|
|
@@ -1380,70 +1509,6 @@ var _MeshComponent = class _MeshComponent extends Component {
|
|
|
1380
1509
|
};
|
|
1381
1510
|
__name(_MeshComponent, "MeshComponent");
|
|
1382
1511
|
var MeshComponent = _MeshComponent;
|
|
1383
|
-
var DEFAULT_MESH_GEOMETRY_PARAMETERS = {
|
|
1384
|
-
capsule: { radius: 0.5, height: 1 },
|
|
1385
|
-
cube: { width: 1, height: 1, depth: 1 },
|
|
1386
|
-
cylinder: { radius: 0.5, height: 1 },
|
|
1387
|
-
model: {},
|
|
1388
|
-
plane: { width: 100, height: 100 },
|
|
1389
|
-
sphere: { radius: 0.5 }
|
|
1390
|
-
};
|
|
1391
|
-
var GEOMETRY_TYPE_BY_KIND = {
|
|
1392
|
-
capsule: "CapsuleGeometry",
|
|
1393
|
-
cube: "BoxGeometry",
|
|
1394
|
-
cylinder: "CylinderGeometry",
|
|
1395
|
-
model: "Model",
|
|
1396
|
-
plane: "PlaneGeometry",
|
|
1397
|
-
sphere: "SphereGeometry"
|
|
1398
|
-
};
|
|
1399
|
-
var _MeshGeometryComponent = class _MeshGeometryComponent extends Component {
|
|
1400
|
-
constructor(kind, object, parameters, options) {
|
|
1401
|
-
super();
|
|
1402
|
-
this.kind = kind;
|
|
1403
|
-
this.geometryType = GEOMETRY_TYPE_BY_KIND[kind];
|
|
1404
|
-
this.object = object;
|
|
1405
|
-
this.modelName = options?.modelName ?? "";
|
|
1406
|
-
this.castShadow = options?.castShadow ?? false;
|
|
1407
|
-
this.receiveShadow = options?.receiveShadow ?? false;
|
|
1408
|
-
switch (kind) {
|
|
1409
|
-
case "cube":
|
|
1410
|
-
this.parameters = {
|
|
1411
|
-
...DEFAULT_MESH_GEOMETRY_PARAMETERS.cube,
|
|
1412
|
-
...parameters
|
|
1413
|
-
};
|
|
1414
|
-
break;
|
|
1415
|
-
case "plane":
|
|
1416
|
-
this.parameters = {
|
|
1417
|
-
...DEFAULT_MESH_GEOMETRY_PARAMETERS.plane,
|
|
1418
|
-
...parameters
|
|
1419
|
-
};
|
|
1420
|
-
break;
|
|
1421
|
-
case "sphere":
|
|
1422
|
-
this.parameters = {
|
|
1423
|
-
...DEFAULT_MESH_GEOMETRY_PARAMETERS.sphere,
|
|
1424
|
-
...parameters
|
|
1425
|
-
};
|
|
1426
|
-
break;
|
|
1427
|
-
case "cylinder":
|
|
1428
|
-
this.parameters = {
|
|
1429
|
-
...DEFAULT_MESH_GEOMETRY_PARAMETERS.cylinder,
|
|
1430
|
-
...parameters
|
|
1431
|
-
};
|
|
1432
|
-
break;
|
|
1433
|
-
case "capsule":
|
|
1434
|
-
this.parameters = {
|
|
1435
|
-
...DEFAULT_MESH_GEOMETRY_PARAMETERS.capsule,
|
|
1436
|
-
...parameters
|
|
1437
|
-
};
|
|
1438
|
-
break;
|
|
1439
|
-
case "model":
|
|
1440
|
-
this.parameters = {};
|
|
1441
|
-
break;
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
};
|
|
1445
|
-
__name(_MeshGeometryComponent, "MeshGeometryComponent");
|
|
1446
|
-
var MeshGeometryComponent = _MeshGeometryComponent;
|
|
1447
1512
|
|
|
1448
1513
|
// core/components/Model.ts
|
|
1449
1514
|
var _ModelComponent = class _ModelComponent extends Component {
|
|
@@ -1583,14 +1648,14 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
1583
1648
|
z: scale.z ?? 1
|
|
1584
1649
|
};
|
|
1585
1650
|
}
|
|
1586
|
-
toPositionVector3(target = new
|
|
1651
|
+
toPositionVector3(target = new THREE5.Vector3()) {
|
|
1587
1652
|
return target.set(this.position.x, this.position.y, this.position.z);
|
|
1588
1653
|
}
|
|
1589
|
-
toRotationEuler(target = new
|
|
1654
|
+
toRotationEuler(target = new THREE5.Euler(), order = "XYZ") {
|
|
1590
1655
|
return target.set(this.rotation.x, this.rotation.y, this.rotation.z, order);
|
|
1591
1656
|
}
|
|
1592
|
-
toRotationQuaternion(target = new
|
|
1593
|
-
const euler = new
|
|
1657
|
+
toRotationQuaternion(target = new THREE5.Quaternion(), order = "XYZ") {
|
|
1658
|
+
const euler = new THREE5.Euler(
|
|
1594
1659
|
this.rotation.x,
|
|
1595
1660
|
this.rotation.y,
|
|
1596
1661
|
this.rotation.z,
|
|
@@ -1598,7 +1663,7 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
1598
1663
|
);
|
|
1599
1664
|
return target.setFromEuler(euler);
|
|
1600
1665
|
}
|
|
1601
|
-
toScaleVector3(target = new
|
|
1666
|
+
toScaleVector3(target = new THREE5.Vector3()) {
|
|
1602
1667
|
return target.set(this.scale.x, this.scale.y, this.scale.z);
|
|
1603
1668
|
}
|
|
1604
1669
|
setPosition(input) {
|
|
@@ -1616,8 +1681,8 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
1616
1681
|
return this;
|
|
1617
1682
|
}
|
|
1618
1683
|
setRotation(input, order = "XYZ") {
|
|
1619
|
-
if (input instanceof
|
|
1620
|
-
const euler = new
|
|
1684
|
+
if (input instanceof THREE5.Quaternion) {
|
|
1685
|
+
const euler = new THREE5.Euler().setFromQuaternion(input, order);
|
|
1621
1686
|
this.rotation.x = euler.x;
|
|
1622
1687
|
this.rotation.y = euler.y;
|
|
1623
1688
|
this.rotation.z = euler.z;
|
|
@@ -1715,6 +1780,8 @@ exports.AudioComponent = AudioComponent;
|
|
|
1715
1780
|
exports.CameraComponent = CameraComponent;
|
|
1716
1781
|
exports.DEFAULT_COLLIDER_STATE = DEFAULT_COLLIDER_STATE;
|
|
1717
1782
|
exports.DEFAULT_ENVIRONMENT_STATE = DEFAULT_ENVIRONMENT_STATE;
|
|
1783
|
+
exports.DEFAULT_INSTANCED_MESH_PARAMETERS = DEFAULT_INSTANCED_MESH_PARAMETERS;
|
|
1784
|
+
exports.DEFAULT_INSTANCE_TRANSFORM = DEFAULT_INSTANCE_TRANSFORM;
|
|
1718
1785
|
exports.DEFAULT_MESH_GEOMETRY_PARAMETERS = DEFAULT_MESH_GEOMETRY_PARAMETERS;
|
|
1719
1786
|
exports.DEFAULT_PHYSICS_STATE = DEFAULT_PHYSICS_STATE;
|
|
1720
1787
|
exports.DEFAULT_POSTPROCESSING_STATE = DEFAULT_POSTPROCESSING_STATE;
|
|
@@ -1724,6 +1791,7 @@ exports.Environment = Environment;
|
|
|
1724
1791
|
exports.ImageComponent = ImageComponent;
|
|
1725
1792
|
exports.ImageTarget = ImageTarget;
|
|
1726
1793
|
exports.ImageTargetAnchor = ImageTargetAnchor;
|
|
1794
|
+
exports.InstancedMeshComponent = InstancedMeshComponent;
|
|
1727
1795
|
exports.LightComponent = LightComponent;
|
|
1728
1796
|
exports.MaterialComponent = MaterialComponent;
|
|
1729
1797
|
exports.MeshComponent = MeshComponent;
|