@relu-interactives/spatial-ecs 0.2.4 → 0.2.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-BTyYvKVH.d.cts → System-CIiWteft.d.cts} +2 -2
- package/dist/{System-BTyYvKVH.d.ts → System-CIiWteft.d.ts} +2 -2
- package/dist/{Video-BWhbvVPg.d.ts → Video-B-qMljTn.d.ts} +147 -75
- package/dist/{Video-D2H5H-K3.d.cts → Video-Dj4KBqQ1.d.cts} +147 -75
- package/dist/{chunk-XWIEEJ7Z.js → chunk-EIC5B3A7.js} +128 -82
- package/dist/chunk-EIC5B3A7.js.map +1 -0
- package/dist/{chunk-AYEF3X2P.js → chunk-FDWNCXU3.js} +3 -3
- package/dist/chunk-FDWNCXU3.js.map +1 -0
- package/dist/{chunk-NFDTIYR4.js → chunk-G2DUXNTQ.js} +18 -2
- package/dist/chunk-G2DUXNTQ.js.map +1 -0
- package/dist/{chunk-P2YDX5DB.js → chunk-NRSUYDBA.js} +275 -5
- package/dist/chunk-NRSUYDBA.js.map +1 -0
- package/dist/{chunk-MAWBTMCG.js → chunk-R5D5PWXV.js} +160 -88
- package/dist/chunk-R5D5PWXV.js.map +1 -0
- package/dist/components/index.cjs +165 -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 +221 -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-B12sx9yF.d.cts} +8 -3
- package/dist/{index-Dm6zF1MY.d.ts → index-Cf-PaKyN.d.ts} +8 -3
- package/dist/index.cjs +627 -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 +54 -12
- package/dist/index.js.map +1 -1
- package/dist/systems/index.cjs +403 -63
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +27 -3
- package/dist/systems/index.d.ts +27 -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 +16 -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,139 @@ 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
|
+
model: DEFAULT_MESH_GEOMETRY_PARAMETERS.cube,
|
|
1029
|
+
plane: DEFAULT_MESH_GEOMETRY_PARAMETERS.plane,
|
|
1030
|
+
sphere: DEFAULT_MESH_GEOMETRY_PARAMETERS.sphere
|
|
1031
|
+
};
|
|
1032
|
+
var _InstancedMeshComponent = class _InstancedMeshComponent extends Component {
|
|
1033
|
+
constructor(meshKind = "cube", meshParameters, options) {
|
|
1034
|
+
super();
|
|
1035
|
+
this.meshKind = meshKind;
|
|
1036
|
+
this.modelPath = options?.modelPath ?? "";
|
|
1037
|
+
this.meshParameters = {
|
|
1038
|
+
...DEFAULT_INSTANCED_MESH_PARAMETERS[meshKind],
|
|
1039
|
+
...meshParameters ?? {}
|
|
1040
|
+
};
|
|
1041
|
+
this.castShadow = options?.castShadow ?? false;
|
|
1042
|
+
this.receiveShadow = options?.receiveShadow ?? false;
|
|
1043
|
+
this.instances = options?.instances && options.instances.length > 0 ? options.instances : [{ ...DEFAULT_INSTANCE_TRANSFORM }];
|
|
1044
|
+
this.instancedMesh = null;
|
|
1045
|
+
}
|
|
1046
|
+
/** Sanitize and return a copy of the current mesh parameters with valid values. */
|
|
1047
|
+
getSanitizedParameters() {
|
|
1048
|
+
const MIN_DIM = 0.01;
|
|
1049
|
+
const MIN_RAD = 1e-3;
|
|
1050
|
+
const sanitize = /* @__PURE__ */ __name((v, min) => Number.isFinite(v) ? Math.max(min, v) : min, "sanitize");
|
|
1051
|
+
switch (this.meshKind) {
|
|
1052
|
+
case "cube": {
|
|
1053
|
+
const p = this.meshParameters;
|
|
1054
|
+
return {
|
|
1055
|
+
width: sanitize(p.width, MIN_DIM),
|
|
1056
|
+
height: sanitize(p.height, MIN_DIM),
|
|
1057
|
+
depth: sanitize(p.depth, MIN_DIM)
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
case "plane": {
|
|
1061
|
+
const p = this.meshParameters;
|
|
1062
|
+
return {
|
|
1063
|
+
width: sanitize(p.width, MIN_DIM),
|
|
1064
|
+
height: sanitize(p.height, MIN_DIM)
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
case "sphere": {
|
|
1068
|
+
const p = this.meshParameters;
|
|
1069
|
+
return { radius: sanitize(p.radius, MIN_RAD) };
|
|
1070
|
+
}
|
|
1071
|
+
case "cylinder":
|
|
1072
|
+
case "capsule": {
|
|
1073
|
+
const p = this.meshParameters;
|
|
1074
|
+
return {
|
|
1075
|
+
radius: sanitize(p.radius, MIN_RAD),
|
|
1076
|
+
height: sanitize(p.height, MIN_DIM)
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
case "model":
|
|
1080
|
+
return DEFAULT_MESH_GEOMETRY_PARAMETERS.cube;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
__name(_InstancedMeshComponent, "InstancedMeshComponent");
|
|
1085
|
+
var InstancedMeshComponent = _InstancedMeshComponent;
|
|
953
1086
|
|
|
954
1087
|
// core/components/Physics.ts
|
|
955
1088
|
var DEFAULT_RIGIDBODY_STATE = {
|
|
@@ -1209,15 +1342,15 @@ function createValueState(light) {
|
|
|
1209
1342
|
castShadow: light.castShadow ?? false,
|
|
1210
1343
|
frustumCulling: light.frustumCulled
|
|
1211
1344
|
};
|
|
1212
|
-
if (light instanceof
|
|
1345
|
+
if (light instanceof THREE5__namespace.PointLight) {
|
|
1213
1346
|
base.distance = light.distance;
|
|
1214
1347
|
base.decay = light.decay;
|
|
1215
|
-
} else if (light instanceof
|
|
1348
|
+
} else if (light instanceof THREE5__namespace.SpotLight) {
|
|
1216
1349
|
base.distance = light.distance;
|
|
1217
1350
|
base.decay = light.decay;
|
|
1218
1351
|
base.angle = light.angle;
|
|
1219
1352
|
base.penumbra = light.penumbra;
|
|
1220
|
-
} else if (light instanceof
|
|
1353
|
+
} else if (light instanceof THREE5__namespace.RectAreaLight) {
|
|
1221
1354
|
base.width = light.width;
|
|
1222
1355
|
base.height = light.height;
|
|
1223
1356
|
}
|
|
@@ -1252,13 +1385,13 @@ function toHexColor2(value, fallback) {
|
|
|
1252
1385
|
}
|
|
1253
1386
|
__name(toHexColor2, "toHexColor");
|
|
1254
1387
|
function getMaterialType(material) {
|
|
1255
|
-
if (material instanceof
|
|
1388
|
+
if (material instanceof THREE5__namespace.MeshPhysicalMaterial) {
|
|
1256
1389
|
return "physical";
|
|
1257
1390
|
}
|
|
1258
|
-
if (material instanceof
|
|
1391
|
+
if (material instanceof THREE5__namespace.MeshPhongMaterial) {
|
|
1259
1392
|
return "phong";
|
|
1260
1393
|
}
|
|
1261
|
-
if (material instanceof
|
|
1394
|
+
if (material instanceof THREE5__namespace.MeshBasicMaterial) {
|
|
1262
1395
|
return "basic";
|
|
1263
1396
|
}
|
|
1264
1397
|
return "standard";
|
|
@@ -1277,8 +1410,8 @@ function createMaterialValue(material) {
|
|
|
1277
1410
|
opacity: typeof materialRecord.opacity === "number" ? materialRecord.opacity : 1,
|
|
1278
1411
|
emissive: toHexColor2(materialRecord.emissive, "#000000"),
|
|
1279
1412
|
emissiveIntensity: typeof materialRecord.emissiveIntensity === "number" ? materialRecord.emissiveIntensity : 0,
|
|
1280
|
-
side: typeof materialRecord.side === "number" ? materialRecord.side :
|
|
1281
|
-
blending: typeof materialRecord.blending === "number" ? materialRecord.blending :
|
|
1413
|
+
side: typeof materialRecord.side === "number" ? materialRecord.side : THREE5__namespace.FrontSide,
|
|
1414
|
+
blending: typeof materialRecord.blending === "number" ? materialRecord.blending : THREE5__namespace.NormalBlending,
|
|
1282
1415
|
depthTest: materialRecord.depthTest !== false,
|
|
1283
1416
|
depthWrite: materialRecord.depthWrite !== false,
|
|
1284
1417
|
wireframe: Boolean(materialRecord.wireframe),
|
|
@@ -1294,7 +1427,7 @@ function createMaterialValue(material) {
|
|
|
1294
1427
|
displacementMap: materialRecord.displacementMap?.image?.src,
|
|
1295
1428
|
lightMap: materialRecord.lightMap?.image?.src,
|
|
1296
1429
|
envMap: materialRecord.envMap?.image?.src,
|
|
1297
|
-
textureFiltering: map?.magFilter ===
|
|
1430
|
+
textureFiltering: map?.magFilter === THREE5__namespace.NearestFilter ? "sharp" : "smooth",
|
|
1298
1431
|
useMipmaps: map?.generateMipmaps !== false
|
|
1299
1432
|
};
|
|
1300
1433
|
}
|
|
@@ -1309,8 +1442,8 @@ function defaultMaterialValue() {
|
|
|
1309
1442
|
opacity: 1,
|
|
1310
1443
|
emissive: "#000000",
|
|
1311
1444
|
emissiveIntensity: 0,
|
|
1312
|
-
side:
|
|
1313
|
-
blending:
|
|
1445
|
+
side: THREE5__namespace.FrontSide,
|
|
1446
|
+
blending: THREE5__namespace.NormalBlending,
|
|
1314
1447
|
depthTest: true,
|
|
1315
1448
|
depthWrite: true,
|
|
1316
1449
|
wireframe: false,
|
|
@@ -1380,70 +1513,6 @@ var _MeshComponent = class _MeshComponent extends Component {
|
|
|
1380
1513
|
};
|
|
1381
1514
|
__name(_MeshComponent, "MeshComponent");
|
|
1382
1515
|
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
1516
|
|
|
1448
1517
|
// core/components/Model.ts
|
|
1449
1518
|
var _ModelComponent = class _ModelComponent extends Component {
|
|
@@ -1583,14 +1652,14 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
1583
1652
|
z: scale.z ?? 1
|
|
1584
1653
|
};
|
|
1585
1654
|
}
|
|
1586
|
-
toPositionVector3(target = new
|
|
1655
|
+
toPositionVector3(target = new THREE5.Vector3()) {
|
|
1587
1656
|
return target.set(this.position.x, this.position.y, this.position.z);
|
|
1588
1657
|
}
|
|
1589
|
-
toRotationEuler(target = new
|
|
1658
|
+
toRotationEuler(target = new THREE5.Euler(), order = "XYZ") {
|
|
1590
1659
|
return target.set(this.rotation.x, this.rotation.y, this.rotation.z, order);
|
|
1591
1660
|
}
|
|
1592
|
-
toRotationQuaternion(target = new
|
|
1593
|
-
const euler = new
|
|
1661
|
+
toRotationQuaternion(target = new THREE5.Quaternion(), order = "XYZ") {
|
|
1662
|
+
const euler = new THREE5.Euler(
|
|
1594
1663
|
this.rotation.x,
|
|
1595
1664
|
this.rotation.y,
|
|
1596
1665
|
this.rotation.z,
|
|
@@ -1598,7 +1667,7 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
1598
1667
|
);
|
|
1599
1668
|
return target.setFromEuler(euler);
|
|
1600
1669
|
}
|
|
1601
|
-
toScaleVector3(target = new
|
|
1670
|
+
toScaleVector3(target = new THREE5.Vector3()) {
|
|
1602
1671
|
return target.set(this.scale.x, this.scale.y, this.scale.z);
|
|
1603
1672
|
}
|
|
1604
1673
|
setPosition(input) {
|
|
@@ -1616,8 +1685,8 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
1616
1685
|
return this;
|
|
1617
1686
|
}
|
|
1618
1687
|
setRotation(input, order = "XYZ") {
|
|
1619
|
-
if (input instanceof
|
|
1620
|
-
const euler = new
|
|
1688
|
+
if (input instanceof THREE5.Quaternion) {
|
|
1689
|
+
const euler = new THREE5.Euler().setFromQuaternion(input, order);
|
|
1621
1690
|
this.rotation.x = euler.x;
|
|
1622
1691
|
this.rotation.y = euler.y;
|
|
1623
1692
|
this.rotation.z = euler.z;
|
|
@@ -1715,6 +1784,8 @@ exports.AudioComponent = AudioComponent;
|
|
|
1715
1784
|
exports.CameraComponent = CameraComponent;
|
|
1716
1785
|
exports.DEFAULT_COLLIDER_STATE = DEFAULT_COLLIDER_STATE;
|
|
1717
1786
|
exports.DEFAULT_ENVIRONMENT_STATE = DEFAULT_ENVIRONMENT_STATE;
|
|
1787
|
+
exports.DEFAULT_INSTANCED_MESH_PARAMETERS = DEFAULT_INSTANCED_MESH_PARAMETERS;
|
|
1788
|
+
exports.DEFAULT_INSTANCE_TRANSFORM = DEFAULT_INSTANCE_TRANSFORM;
|
|
1718
1789
|
exports.DEFAULT_MESH_GEOMETRY_PARAMETERS = DEFAULT_MESH_GEOMETRY_PARAMETERS;
|
|
1719
1790
|
exports.DEFAULT_PHYSICS_STATE = DEFAULT_PHYSICS_STATE;
|
|
1720
1791
|
exports.DEFAULT_POSTPROCESSING_STATE = DEFAULT_POSTPROCESSING_STATE;
|
|
@@ -1724,6 +1795,7 @@ exports.Environment = Environment;
|
|
|
1724
1795
|
exports.ImageComponent = ImageComponent;
|
|
1725
1796
|
exports.ImageTarget = ImageTarget;
|
|
1726
1797
|
exports.ImageTargetAnchor = ImageTargetAnchor;
|
|
1798
|
+
exports.InstancedMeshComponent = InstancedMeshComponent;
|
|
1727
1799
|
exports.LightComponent = LightComponent;
|
|
1728
1800
|
exports.MaterialComponent = MaterialComponent;
|
|
1729
1801
|
exports.MeshComponent = MeshComponent;
|