mage-engine 3.23.37 → 3.23.39
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/mage.js +195 -51
- package/package.json +1 -1
package/dist/mage.js
CHANGED
|
@@ -54641,7 +54641,8 @@ let Keyboard = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
54641
54641
|
TYPE: "CAMERA",
|
|
54642
54642
|
SUBTYPES: {
|
|
54643
54643
|
DEFAULT: "CAMERA.SUBTYPE.DEFAULT",
|
|
54644
|
-
MAIN: "CAMERA.SUBTYPE.MAIN"
|
|
54644
|
+
MAIN: "CAMERA.SUBTYPE.MAIN",
|
|
54645
|
+
GAME: "CAMERA.SUBTYPE.GAME"
|
|
54645
54646
|
}
|
|
54646
54647
|
},
|
|
54647
54648
|
MESH: {
|
|
@@ -54736,7 +54737,7 @@ let Keyboard = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
54736
54737
|
UNKNOWN: "UNKNOWN"
|
|
54737
54738
|
};
|
|
54738
54739
|
const FLAT_ENTITY_TYPES = [ENTITY_TYPES.SCENE.TYPE, ENTITY_TYPES.CAMERA.TYPE, ENTITY_TYPES.MESH.TYPE, ENTITY_TYPES.LABEL.TYPE, ENTITY_TYPES.LIGHT.TYPE, ENTITY_TYPES.AUDIO.TYPE, ENTITY_TYPES.MODEL.TYPE, ENTITY_TYPES.SPRITE.TYPE, ENTITY_TYPES.PARTICLE.TYPE, ENTITY_TYPES.SCENERY.TYPE, ENTITY_TYPES.HELPER.TYPE, ENTITY_TYPES.UNKNOWN];
|
|
54739
|
-
const FLAT_ENTITY_SUBTYPES = [ENTITY_TYPES.SCENE.SUBTYPES.DEFAULT, ENTITY_TYPES.CAMERA.SUBTYPES.DEFAULT, ENTITY_TYPES.CAMERA.SUBTYPES.MAIN, ENTITY_TYPES.MESH.SUBTYPES.DEFAULT, ENTITY_TYPES.MESH.SUBTYPES.BOX, ENTITY_TYPES.MESH.SUBTYPES.SPHERE, ENTITY_TYPES.MESH.SUBTYPES.PLANE, ENTITY_TYPES.MESH.SUBTYPES.CYLINDER, ENTITY_TYPES.MESH.SUBTYPES.CONE, ENTITY_TYPES.MESH.SUBTYPES.CUBE, ENTITY_TYPES.MESH.SUBTYPES.LINE, ENTITY_TYPES.MESH.SUBTYPES.CURVE_LINE, ENTITY_TYPES.MESH.SUBTYPES.AXES, ENTITY_TYPES.MESH.SUBTYPES.GRID, ENTITY_TYPES.MESH.SUBTYPES.TARGET, ENTITY_TYPES.LABEL.SUBTYPES.DEFAULT, ENTITY_TYPES.LIGHT.SUBTYPES.DEFAULT, ENTITY_TYPES.LIGHT.SUBTYPES.AMBIENT, ENTITY_TYPES.LIGHT.SUBTYPES.SUN, ENTITY_TYPES.LIGHT.SUBTYPES.HEMISPHERE, ENTITY_TYPES.LIGHT.SUBTYPES.POINT, ENTITY_TYPES.LIGHT.SUBTYPES.SPOT, ENTITY_TYPES.AUDIO.SUBTYPES.DEFAULT, ENTITY_TYPES.AUDIO.SUBTYPES.DIRECTIONAL, ENTITY_TYPES.AUDIO.SUBTYPES.AMBIENT, ENTITY_TYPES.MODEL.SUBTYPES.DEFAULT, ENTITY_TYPES.SPRITE.SUBTYPES.DEFAULT, ENTITY_TYPES.SPRITE.SUBTYPES.ANIMATED_SPRITE, ENTITY_TYPES.PARTICLE.SUBTYPES.DEFAULT, ENTITY_TYPES.PARTICLE.SUBTYPES.EMITTER, ENTITY_TYPES.PARTICLE.SUBTYPES.SYSTEM, ENTITY_TYPES.PARTICLE.SUBTYPES.EMITTER_GROUP, ENTITY_TYPES.PARTICLE.SUBTYPES.PROTON_EMITTER, ENTITY_TYPES.SCENERY.SUBTYPES.DEFAULT, ENTITY_TYPES.SCENERY.SUBTYPES.SKY, ENTITY_TYPES.SCENERY.SUBTYPES.SKYBOX, ENTITY_TYPES.HELPER.SUBTYPES.GRID, ENTITY_TYPES.HELPER.SUBTYPES.AXES, ENTITY_TYPES.HELPER.SUBTYPES.HELPER_SPRITE];
|
|
54740
|
+
const FLAT_ENTITY_SUBTYPES = [ENTITY_TYPES.SCENE.SUBTYPES.DEFAULT, ENTITY_TYPES.CAMERA.SUBTYPES.DEFAULT, ENTITY_TYPES.CAMERA.SUBTYPES.MAIN, ENTITY_TYPES.CAMERA.SUBTYPES.GAME, ENTITY_TYPES.MESH.SUBTYPES.DEFAULT, ENTITY_TYPES.MESH.SUBTYPES.BOX, ENTITY_TYPES.MESH.SUBTYPES.SPHERE, ENTITY_TYPES.MESH.SUBTYPES.PLANE, ENTITY_TYPES.MESH.SUBTYPES.CYLINDER, ENTITY_TYPES.MESH.SUBTYPES.CONE, ENTITY_TYPES.MESH.SUBTYPES.CUBE, ENTITY_TYPES.MESH.SUBTYPES.LINE, ENTITY_TYPES.MESH.SUBTYPES.CURVE_LINE, ENTITY_TYPES.MESH.SUBTYPES.AXES, ENTITY_TYPES.MESH.SUBTYPES.GRID, ENTITY_TYPES.MESH.SUBTYPES.TARGET, ENTITY_TYPES.LABEL.SUBTYPES.DEFAULT, ENTITY_TYPES.LIGHT.SUBTYPES.DEFAULT, ENTITY_TYPES.LIGHT.SUBTYPES.AMBIENT, ENTITY_TYPES.LIGHT.SUBTYPES.SUN, ENTITY_TYPES.LIGHT.SUBTYPES.HEMISPHERE, ENTITY_TYPES.LIGHT.SUBTYPES.POINT, ENTITY_TYPES.LIGHT.SUBTYPES.SPOT, ENTITY_TYPES.AUDIO.SUBTYPES.DEFAULT, ENTITY_TYPES.AUDIO.SUBTYPES.DIRECTIONAL, ENTITY_TYPES.AUDIO.SUBTYPES.AMBIENT, ENTITY_TYPES.MODEL.SUBTYPES.DEFAULT, ENTITY_TYPES.SPRITE.SUBTYPES.DEFAULT, ENTITY_TYPES.SPRITE.SUBTYPES.ANIMATED_SPRITE, ENTITY_TYPES.PARTICLE.SUBTYPES.DEFAULT, ENTITY_TYPES.PARTICLE.SUBTYPES.EMITTER, ENTITY_TYPES.PARTICLE.SUBTYPES.SYSTEM, ENTITY_TYPES.PARTICLE.SUBTYPES.EMITTER_GROUP, ENTITY_TYPES.PARTICLE.SUBTYPES.PROTON_EMITTER, ENTITY_TYPES.SCENERY.SUBTYPES.DEFAULT, ENTITY_TYPES.SCENERY.SUBTYPES.SKY, ENTITY_TYPES.SCENERY.SUBTYPES.SKYBOX, ENTITY_TYPES.HELPER.SUBTYPES.GRID, ENTITY_TYPES.HELPER.SUBTYPES.AXES, ENTITY_TYPES.HELPER.SUBTYPES.HELPER_SPRITE];
|
|
54740
54741
|
const ENTITY_EVENTS = {
|
|
54741
54742
|
DISPOSE: "DISPOSE",
|
|
54742
54743
|
STATE_MACHINE: {
|
|
@@ -56793,9 +56794,12 @@ var Physics$1 = new Physics();let Scene = /*#__PURE__*/function () {
|
|
|
56793
56794
|
key: "getHierarchy",
|
|
56794
56795
|
value: function getHierarchy() {
|
|
56795
56796
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
56797
|
+
const camera = this.getCamera(); // Only include camera in hierarchy if it's serializable (scene camera is not)
|
|
56798
|
+
|
|
56799
|
+
const cameraChildren = camera && camera.isSerializable() ? [camera.getHierarchy(options)] : [];
|
|
56796
56800
|
return [{
|
|
56797
56801
|
element: this.toJSON(options.parseJSON),
|
|
56798
|
-
children: [
|
|
56802
|
+
children: [...cameraChildren, ...this.elements.filter(e => !e.hasParent() && !e.isHelper() && e.isSerializable()).map(e => e.getHierarchy(options))]
|
|
56799
56803
|
}];
|
|
56800
56804
|
}
|
|
56801
56805
|
}, {
|
|
@@ -58135,7 +58139,7 @@ function applyMiddleware() {
|
|
|
58135
58139
|
|
|
58136
58140
|
var thunk = createThunkMiddleware();
|
|
58137
58141
|
thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
|
|
58138
|
-
var version$1 = "3.23.
|
|
58142
|
+
var version$1 = "3.23.39";
|
|
58139
58143
|
var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
|
|
58140
58144
|
var main = "dist/mage.js";
|
|
58141
58145
|
var author$1 = {
|
|
@@ -60776,8 +60780,13 @@ const tweenTo = function (origin, target) {
|
|
|
60776
60780
|
z,
|
|
60777
60781
|
w
|
|
60778
60782
|
} = _ref;
|
|
60783
|
+
// Ensure values are numbers (not strings) to prevent rendering issues
|
|
60784
|
+
const qx = Number(x) || 0;
|
|
60785
|
+
const qy = Number(y) || 0;
|
|
60786
|
+
const qz = Number(z) || 0;
|
|
60787
|
+
const qw = Number(w) || 1;
|
|
60779
60788
|
|
|
60780
|
-
_this.getBody().quaternion.set(
|
|
60789
|
+
_this.getBody().quaternion.set(qx, qy, qz, qw);
|
|
60781
60790
|
});
|
|
60782
60791
|
|
|
60783
60792
|
_defineProperty$1(_assertThisInitialized(_this), "setUuid", uuid => {
|
|
@@ -61318,8 +61327,12 @@ const tweenTo = function (origin, target) {
|
|
|
61318
61327
|
if (this.hasBody()) {
|
|
61319
61328
|
const scale = { ...this.getScale(),
|
|
61320
61329
|
...howbig
|
|
61321
|
-
};
|
|
61322
|
-
|
|
61330
|
+
}; // Ensure values are numbers (not strings) to prevent rendering issues
|
|
61331
|
+
|
|
61332
|
+
const sx = Number(scale.x) || 1;
|
|
61333
|
+
const sy = Number(scale.y) || 1;
|
|
61334
|
+
const sz = Number(scale.z) || 1;
|
|
61335
|
+
this.body.scale.set(sx, sy, sz);
|
|
61323
61336
|
}
|
|
61324
61337
|
}
|
|
61325
61338
|
}, {
|
|
@@ -61348,8 +61361,12 @@ const tweenTo = function (origin, target) {
|
|
|
61348
61361
|
y,
|
|
61349
61362
|
z,
|
|
61350
61363
|
...where
|
|
61351
|
-
};
|
|
61352
|
-
|
|
61364
|
+
}; // Ensure values are numbers (not strings) to prevent rendering issues
|
|
61365
|
+
|
|
61366
|
+
const px = Number(position.x) || 0;
|
|
61367
|
+
const py = Number(position.y) || 0;
|
|
61368
|
+
const pz = Number(position.z) || 0;
|
|
61369
|
+
this.getBody().position.set(px, py, pz);
|
|
61353
61370
|
}
|
|
61354
61371
|
}
|
|
61355
61372
|
}, {
|
|
@@ -61371,8 +61388,12 @@ const tweenTo = function (origin, target) {
|
|
|
61371
61388
|
y,
|
|
61372
61389
|
z,
|
|
61373
61390
|
...how
|
|
61374
|
-
};
|
|
61375
|
-
|
|
61391
|
+
}; // Ensure values are numbers (not strings) to prevent rendering issues
|
|
61392
|
+
|
|
61393
|
+
const rx = Number(rotation.x) || 0;
|
|
61394
|
+
const ry = Number(rotation.y) || 0;
|
|
61395
|
+
const rz = Number(rotation.z) || 0;
|
|
61396
|
+
this.getBody().rotation.set(rx, ry, rz);
|
|
61376
61397
|
}
|
|
61377
61398
|
}
|
|
61378
61399
|
}, {
|
|
@@ -62283,8 +62304,13 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62283
62304
|
}, {
|
|
62284
62305
|
key: "setAngularVelocity",
|
|
62285
62306
|
value: function setAngularVelocity(velocity) {
|
|
62286
|
-
|
|
62287
|
-
|
|
62307
|
+
const numericVelocity = {
|
|
62308
|
+
x: Number(velocity === null || velocity === void 0 ? void 0 : velocity.x) || 0,
|
|
62309
|
+
y: Number(velocity === null || velocity === void 0 ? void 0 : velocity.y) || 0,
|
|
62310
|
+
z: Number(velocity === null || velocity === void 0 ? void 0 : velocity.z) || 0
|
|
62311
|
+
};
|
|
62312
|
+
this.angularVelocity = numericVelocity;
|
|
62313
|
+
Physics$1.updateAngularVelocity(this.uuid(), numericVelocity);
|
|
62288
62314
|
}
|
|
62289
62315
|
}, {
|
|
62290
62316
|
key: "getLinearVelocity",
|
|
@@ -62294,8 +62320,13 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62294
62320
|
}, {
|
|
62295
62321
|
key: "setLinearVelocity",
|
|
62296
62322
|
value: function setLinearVelocity(velocity) {
|
|
62297
|
-
|
|
62298
|
-
|
|
62323
|
+
const numericVelocity = {
|
|
62324
|
+
x: Number(velocity === null || velocity === void 0 ? void 0 : velocity.x) || 0,
|
|
62325
|
+
y: Number(velocity === null || velocity === void 0 ? void 0 : velocity.y) || 0,
|
|
62326
|
+
z: Number(velocity === null || velocity === void 0 ? void 0 : velocity.z) || 0
|
|
62327
|
+
};
|
|
62328
|
+
this.linearVelocity = numericVelocity;
|
|
62329
|
+
Physics$1.updateLinearVelocity(this.uuid(), numericVelocity);
|
|
62299
62330
|
}
|
|
62300
62331
|
}, {
|
|
62301
62332
|
key: "isCollidingOnDirection",
|
|
@@ -62316,11 +62347,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62316
62347
|
key: "setGeometryRotation",
|
|
62317
62348
|
value: function setGeometryRotation() {
|
|
62318
62349
|
let rotation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
62319
|
-
const
|
|
62320
|
-
|
|
62321
|
-
|
|
62322
|
-
z = 0
|
|
62323
|
-
} = rotation;
|
|
62350
|
+
const x = Number(rotation === null || rotation === void 0 ? void 0 : rotation.x) || 0;
|
|
62351
|
+
const y = Number(rotation === null || rotation === void 0 ? void 0 : rotation.y) || 0;
|
|
62352
|
+
const z = Number(rotation === null || rotation === void 0 ? void 0 : rotation.z) || 0;
|
|
62324
62353
|
|
|
62325
62354
|
if (x !== 0) {
|
|
62326
62355
|
this.getBody().geometry.rotateX(x);
|
|
@@ -62376,8 +62405,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62376
62405
|
key: "setReflectivity",
|
|
62377
62406
|
value: function setReflectivity() {
|
|
62378
62407
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.REFLECTIVITY];
|
|
62408
|
+
const numericValue = Number(value) || 0;
|
|
62379
62409
|
|
|
62380
|
-
const _setReflectivity = material => material[PROPERTIES.REFLECTIVITY] =
|
|
62410
|
+
const _setReflectivity = material => material[PROPERTIES.REFLECTIVITY] = numericValue;
|
|
62381
62411
|
|
|
62382
62412
|
if (value != undefined) {
|
|
62383
62413
|
applyMaterialChange(this.getBody(), _setReflectivity);
|
|
@@ -62394,8 +62424,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62394
62424
|
key: "setRefractionRatio",
|
|
62395
62425
|
value: function setRefractionRatio() {
|
|
62396
62426
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.REFRACTION_RATIO];
|
|
62427
|
+
const numericValue = Number(value) || 0;
|
|
62397
62428
|
|
|
62398
|
-
const _setRefractionRatio = material => material[PROPERTIES.REFRACTION_RATIO] =
|
|
62429
|
+
const _setRefractionRatio = material => material[PROPERTIES.REFRACTION_RATIO] = numericValue;
|
|
62399
62430
|
|
|
62400
62431
|
if (value != undefined) {
|
|
62401
62432
|
applyMaterialChange(this.getBody(), _setRefractionRatio);
|
|
@@ -62468,8 +62499,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62468
62499
|
key: "setShininess",
|
|
62469
62500
|
value: function setShininess() {
|
|
62470
62501
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.SHININESS];
|
|
62502
|
+
const numericValue = Number(value) || 0;
|
|
62471
62503
|
|
|
62472
|
-
const _setShininess = material => material[PROPERTIES.SHININESS] =
|
|
62504
|
+
const _setShininess = material => material[PROPERTIES.SHININESS] = numericValue;
|
|
62473
62505
|
|
|
62474
62506
|
applyMaterialChange(this.getBody(), _setShininess);
|
|
62475
62507
|
}
|
|
@@ -62520,8 +62552,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62520
62552
|
key: "setMetalness",
|
|
62521
62553
|
value: function setMetalness() {
|
|
62522
62554
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.METALNESS];
|
|
62555
|
+
const numericValue = Number(value) || 0;
|
|
62523
62556
|
|
|
62524
|
-
const _setMetalness = material => material[PROPERTIES.METALNESS] =
|
|
62557
|
+
const _setMetalness = material => material[PROPERTIES.METALNESS] = numericValue;
|
|
62525
62558
|
|
|
62526
62559
|
applyMaterialChange(this.getBody(), _setMetalness);
|
|
62527
62560
|
}
|
|
@@ -62534,8 +62567,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62534
62567
|
key: "setRoughness",
|
|
62535
62568
|
value: function setRoughness() {
|
|
62536
62569
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.ROUGHNESS];
|
|
62570
|
+
const numericValue = Number(value) || 0;
|
|
62537
62571
|
|
|
62538
|
-
const _setRoughness = material => material[PROPERTIES.ROUGHNESS] =
|
|
62572
|
+
const _setRoughness = material => material[PROPERTIES.ROUGHNESS] = numericValue;
|
|
62539
62573
|
|
|
62540
62574
|
applyMaterialChange(this.getBody(), _setRoughness);
|
|
62541
62575
|
}
|
|
@@ -62572,8 +62606,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62572
62606
|
key: "setEmissiveIntensity",
|
|
62573
62607
|
value: function setEmissiveIntensity() {
|
|
62574
62608
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.EMISSIVE_INTENSITY];
|
|
62609
|
+
const numericValue = Number(value) || 0;
|
|
62575
62610
|
|
|
62576
|
-
const _setEmissiveIntensity = material => material[PROPERTIES.EMISSIVE_INTENSITY] =
|
|
62611
|
+
const _setEmissiveIntensity = material => material[PROPERTIES.EMISSIVE_INTENSITY] = numericValue;
|
|
62577
62612
|
|
|
62578
62613
|
applyMaterialChange(this.getBody(), _setEmissiveIntensity);
|
|
62579
62614
|
}
|
|
@@ -62586,8 +62621,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62586
62621
|
key: "setLightMapIntensity",
|
|
62587
62622
|
value: function setLightMapIntensity() {
|
|
62588
62623
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.LIGHT_MAP_INTENSITY];
|
|
62624
|
+
const numericValue = Number(value) || 0;
|
|
62589
62625
|
|
|
62590
|
-
const _setLightMapIntensity = material => material[PROPERTIES.LIGHT_MAP_INTENSITY] =
|
|
62626
|
+
const _setLightMapIntensity = material => material[PROPERTIES.LIGHT_MAP_INTENSITY] = numericValue;
|
|
62591
62627
|
|
|
62592
62628
|
applyMaterialChange(this.getBody(), _setLightMapIntensity);
|
|
62593
62629
|
}
|
|
@@ -62600,8 +62636,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62600
62636
|
key: "setAOMapIntensity",
|
|
62601
62637
|
value: function setAOMapIntensity() {
|
|
62602
62638
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.AO_MAP_INTENSITY];
|
|
62639
|
+
const numericValue = Number(value) || 0;
|
|
62603
62640
|
|
|
62604
|
-
const _setAOMapIntensity = material => material[PROPERTIES.AO_MAP_INTENSITY] =
|
|
62641
|
+
const _setAOMapIntensity = material => material[PROPERTIES.AO_MAP_INTENSITY] = numericValue;
|
|
62605
62642
|
|
|
62606
62643
|
applyMaterialChange(this.getBody(), _setAOMapIntensity);
|
|
62607
62644
|
}
|
|
@@ -62614,8 +62651,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62614
62651
|
key: "setAoMapIntensity",
|
|
62615
62652
|
value: function setAoMapIntensity() {
|
|
62616
62653
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.AO_MAP_INTENSITY];
|
|
62654
|
+
const numericValue = Number(value) || 0;
|
|
62617
62655
|
|
|
62618
|
-
const _setAoMapIntensity = material => material[PROPERTIES.AO_MAP_INTENSITY] =
|
|
62656
|
+
const _setAoMapIntensity = material => material[PROPERTIES.AO_MAP_INTENSITY] = numericValue;
|
|
62619
62657
|
|
|
62620
62658
|
applyMaterialChange(this.getBody(), _setAoMapIntensity);
|
|
62621
62659
|
}
|
|
@@ -62623,8 +62661,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62623
62661
|
key: "setEnvMapIntensity",
|
|
62624
62662
|
value: function setEnvMapIntensity() {
|
|
62625
62663
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.ENV_MAP_INTENSITY];
|
|
62664
|
+
const numericValue = Number(value) || 0;
|
|
62626
62665
|
|
|
62627
|
-
const _setEnvMapIntensity = material => material[PROPERTIES.ENV_MAP_INTENSITY] =
|
|
62666
|
+
const _setEnvMapIntensity = material => material[PROPERTIES.ENV_MAP_INTENSITY] = numericValue;
|
|
62628
62667
|
|
|
62629
62668
|
applyMaterialChange(this.getBody(), _setEnvMapIntensity);
|
|
62630
62669
|
}
|
|
@@ -62637,8 +62676,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62637
62676
|
key: "setDisplacementScale",
|
|
62638
62677
|
value: function setDisplacementScale() {
|
|
62639
62678
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.DISPLACEMENT_SCALE];
|
|
62679
|
+
const numericValue = Number(value) || 0;
|
|
62640
62680
|
|
|
62641
|
-
const _setDisplacementScale = material => material[PROPERTIES.DISPLACEMENT_SCALE] =
|
|
62681
|
+
const _setDisplacementScale = material => material[PROPERTIES.DISPLACEMENT_SCALE] = numericValue;
|
|
62642
62682
|
|
|
62643
62683
|
applyMaterialChange(this.getBody(), _setDisplacementScale);
|
|
62644
62684
|
}
|
|
@@ -62651,8 +62691,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62651
62691
|
key: "setDisplacementBias",
|
|
62652
62692
|
value: function setDisplacementBias() {
|
|
62653
62693
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.DISPLACEMENT_BIAS];
|
|
62694
|
+
const numericValue = Number(value) || 0;
|
|
62654
62695
|
|
|
62655
|
-
const _setDisplacementBias = material => material[PROPERTIES.DISPLACEMENT_BIAS] =
|
|
62696
|
+
const _setDisplacementBias = material => material[PROPERTIES.DISPLACEMENT_BIAS] = numericValue;
|
|
62656
62697
|
|
|
62657
62698
|
applyMaterialChange(this.getBody(), _setDisplacementBias);
|
|
62658
62699
|
}
|
|
@@ -62665,8 +62706,9 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62665
62706
|
key: "setBumpScale",
|
|
62666
62707
|
value: function setBumpScale() {
|
|
62667
62708
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIAL_PROPERTIES_DEFAULT_VALUES[PROPERTIES.BUMP_SCALE];
|
|
62709
|
+
const numericValue = Number(value) || 0;
|
|
62668
62710
|
|
|
62669
|
-
const _setBumpScale = material => material[PROPERTIES.BUMP_SCALE] =
|
|
62711
|
+
const _setBumpScale = material => material[PROPERTIES.BUMP_SCALE] = numericValue;
|
|
62670
62712
|
|
|
62671
62713
|
applyMaterialChange(this.getBody(), _setBumpScale);
|
|
62672
62714
|
}
|
|
@@ -62873,9 +62915,10 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62873
62915
|
key: "setWireframeLineWidth",
|
|
62874
62916
|
value: function setWireframeLineWidth() {
|
|
62875
62917
|
let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
62918
|
+
const numericWidth = Number(width) || 1;
|
|
62876
62919
|
|
|
62877
62920
|
const _setWireframeLineWidth = material => {
|
|
62878
|
-
material.wireframeLinewidth =
|
|
62921
|
+
material.wireframeLinewidth = numericWidth;
|
|
62879
62922
|
};
|
|
62880
62923
|
|
|
62881
62924
|
applyMaterialChange(this.getBody(), _setWireframeLineWidth);
|
|
@@ -62967,12 +63010,16 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62967
63010
|
fov = Config$1.camera().fov,
|
|
62968
63011
|
ratio = Config$1.screen().ratio,
|
|
62969
63012
|
near = Config$1.camera().near,
|
|
62970
|
-
far = Config$1.camera().far
|
|
63013
|
+
far = Config$1.camera().far,
|
|
63014
|
+
serializable = true
|
|
62971
63015
|
} = options;
|
|
62972
63016
|
_this = _super.call(this, {
|
|
62973
|
-
name
|
|
63017
|
+
name,
|
|
63018
|
+
serializable
|
|
62974
63019
|
});
|
|
62975
|
-
|
|
63020
|
+
|
|
63021
|
+
_this.extendOptions(options);
|
|
63022
|
+
|
|
62976
63023
|
const body = new PerspectiveCamera(fov, ratio, near, far);
|
|
62977
63024
|
|
|
62978
63025
|
_this.setBody({
|
|
@@ -63019,6 +63066,58 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
63019
63066
|
} = position;
|
|
63020
63067
|
this.body.lookAt(x, y, z);
|
|
63021
63068
|
}
|
|
63069
|
+
}, {
|
|
63070
|
+
key: "getFov",
|
|
63071
|
+
value: function getFov() {
|
|
63072
|
+
return this.getBody().fov;
|
|
63073
|
+
}
|
|
63074
|
+
}, {
|
|
63075
|
+
key: "setFov",
|
|
63076
|
+
value: function setFov(fov) {
|
|
63077
|
+
const num = Number(fov);
|
|
63078
|
+
const numericFov = Number.isFinite(num) ? num : 75;
|
|
63079
|
+
this.getBody().fov = numericFov;
|
|
63080
|
+
this.getBody().updateProjectionMatrix();
|
|
63081
|
+
}
|
|
63082
|
+
}, {
|
|
63083
|
+
key: "getNear",
|
|
63084
|
+
value: function getNear() {
|
|
63085
|
+
return this.getBody().near;
|
|
63086
|
+
}
|
|
63087
|
+
}, {
|
|
63088
|
+
key: "setNear",
|
|
63089
|
+
value: function setNear(near) {
|
|
63090
|
+
const num = Number(near);
|
|
63091
|
+
const numericNear = Number.isFinite(num) ? num : 0.1;
|
|
63092
|
+
this.getBody().near = numericNear;
|
|
63093
|
+
this.getBody().updateProjectionMatrix();
|
|
63094
|
+
}
|
|
63095
|
+
}, {
|
|
63096
|
+
key: "getFar",
|
|
63097
|
+
value: function getFar() {
|
|
63098
|
+
return this.getBody().far;
|
|
63099
|
+
}
|
|
63100
|
+
}, {
|
|
63101
|
+
key: "setFar",
|
|
63102
|
+
value: function setFar(far) {
|
|
63103
|
+
const num = Number(far);
|
|
63104
|
+
const numericFar = Number.isFinite(num) ? num : 3000000;
|
|
63105
|
+
this.getBody().far = numericFar;
|
|
63106
|
+
this.getBody().updateProjectionMatrix();
|
|
63107
|
+
}
|
|
63108
|
+
}, {
|
|
63109
|
+
key: "toJSON",
|
|
63110
|
+
value: function toJSON() {
|
|
63111
|
+
let parseJSON = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
63112
|
+
|
|
63113
|
+
if (this.isSerializable()) {
|
|
63114
|
+
return { ..._get(_getPrototypeOf(Camera.prototype), "toJSON", this).call(this, parseJSON),
|
|
63115
|
+
fov: this.getFov(),
|
|
63116
|
+
near: this.getNear(),
|
|
63117
|
+
far: this.getFar()
|
|
63118
|
+
};
|
|
63119
|
+
}
|
|
63120
|
+
}
|
|
63022
63121
|
}]);
|
|
63023
63122
|
|
|
63024
63123
|
return Camera;
|
|
@@ -63505,7 +63604,8 @@ let Line = /*#__PURE__*/function (_Element) {
|
|
|
63505
63604
|
key: "setThickness",
|
|
63506
63605
|
value: function setThickness() {
|
|
63507
63606
|
let thickness = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_LINE_THICKNESS;
|
|
63508
|
-
|
|
63607
|
+
const numericThickness = Number(thickness) || DEFAULT_LINE_THICKNESS;
|
|
63608
|
+
this.body.material.linewidth = numericThickness;
|
|
63509
63609
|
}
|
|
63510
63610
|
}, {
|
|
63511
63611
|
key: "toJSON",
|
|
@@ -63816,29 +63916,33 @@ let Sprite = /*#__PURE__*/function (_Element) {
|
|
|
63816
63916
|
key: "setRotation",
|
|
63817
63917
|
value: function setRotation() {
|
|
63818
63918
|
let rotation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getRotation();
|
|
63819
|
-
|
|
63820
|
-
this.
|
|
63919
|
+
const numericRotation = Number(rotation) || 0;
|
|
63920
|
+
this.setData("rotation", numericRotation);
|
|
63921
|
+
this.getBody().material.rotation = numericRotation;
|
|
63821
63922
|
}
|
|
63822
63923
|
}, {
|
|
63823
63924
|
key: "setWidth",
|
|
63824
63925
|
value: function setWidth() {
|
|
63825
63926
|
let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.width;
|
|
63826
|
-
|
|
63827
|
-
this.
|
|
63927
|
+
const numericWidth = Number(width) || 1;
|
|
63928
|
+
this.setData("width", numericWidth);
|
|
63929
|
+
this.getBody().scale.x = numericWidth;
|
|
63828
63930
|
}
|
|
63829
63931
|
}, {
|
|
63830
63932
|
key: "setHeight",
|
|
63831
63933
|
value: function setHeight() {
|
|
63832
63934
|
let height = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.height;
|
|
63833
|
-
|
|
63834
|
-
this.
|
|
63935
|
+
const numericHeight = Number(height) || 1;
|
|
63936
|
+
this.setData("height", numericHeight);
|
|
63937
|
+
this.getBody().scale.y = numericHeight;
|
|
63835
63938
|
}
|
|
63836
63939
|
}, {
|
|
63837
63940
|
key: "setAnisotropy",
|
|
63838
63941
|
value: function setAnisotropy() {
|
|
63839
63942
|
let anisotropy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
63840
|
-
|
|
63841
|
-
this.
|
|
63943
|
+
const numericAnisotropy = Number(anisotropy) || 1;
|
|
63944
|
+
this.setData("anisotropy", numericAnisotropy);
|
|
63945
|
+
this.getTexture(TEXTURES.MAP).anisotropy = validateAnisotropy(numericAnisotropy);
|
|
63842
63946
|
}
|
|
63843
63947
|
}, {
|
|
63844
63948
|
key: "setSizeAttenuation",
|
|
@@ -76148,7 +76252,11 @@ const buildFBXLoader = () => {
|
|
|
76148
76252
|
const textureLoader = new TextureLoader(this.manager).setCrossOrigin(this.crossOrigin);
|
|
76149
76253
|
|
|
76150
76254
|
if (!isAbsoluteURL$1(texture)) {
|
|
76151
|
-
|
|
76255
|
+
// Use MAGE_ASSETS_BASE_URL + textures/ as fallback when no texture path is specified
|
|
76256
|
+
// This allows FBX models to find textures in the textures directory of deployed builds
|
|
76257
|
+
const baseUrl = env.MAGE_ASSETS_BASE_URL;
|
|
76258
|
+
const defaultTexturePath = baseUrl ? `${baseUrl}/textures/` : null;
|
|
76259
|
+
textureLoader.setPath(this.resourcePath || texturePath || defaultTexturePath || path);
|
|
76152
76260
|
}
|
|
76153
76261
|
|
|
76154
76262
|
return new FBXTreeParser(textureLoader, this.manager, this.options).parse(fbxTree);
|
|
@@ -91097,8 +91205,11 @@ let Level = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
91097
91205
|
_defineProperty$1(_assertThisInitialized(_this), "cancelNextAnimationFrame", () => cancelAnimationFrame(_this.requestAnimationFrameId));
|
|
91098
91206
|
|
|
91099
91207
|
_defineProperty$1(_assertThisInitialized(_this), "init", () => {
|
|
91100
|
-
Scene$1.create(_this.getName());
|
|
91101
|
-
|
|
91208
|
+
Scene$1.create(_this.getName()); // Scene camera is for editor navigation, not serializable
|
|
91209
|
+
|
|
91210
|
+
Scene$1.createCamera(new Camera({
|
|
91211
|
+
serializable: false
|
|
91212
|
+
}));
|
|
91102
91213
|
Physics$1.init().then(() => {
|
|
91103
91214
|
Particles$1.init();
|
|
91104
91215
|
PostProcessing$1.init();
|
|
@@ -94083,10 +94194,43 @@ let Sky = /*#__PURE__*/function (_Element) {
|
|
|
94083
94194
|
elements = [],
|
|
94084
94195
|
lights = [],
|
|
94085
94196
|
audio = [],
|
|
94086
|
-
sounds = []
|
|
94197
|
+
sounds = [],
|
|
94198
|
+
cameras = []
|
|
94087
94199
|
} = data; // Support both 'audio' and 'sounds' keys for backwards compatibility
|
|
94088
94200
|
|
|
94089
|
-
const allSounds = [...audio, ...sounds]; //
|
|
94201
|
+
const allSounds = [...audio, ...sounds]; // Process cameras - create game camera entity and apply settings to scene camera
|
|
94202
|
+
|
|
94203
|
+
for (const cameraData of cameras) {
|
|
94204
|
+
if (cameraData.entitySubType === ENTITY_TYPES.CAMERA.SUBTYPES.GAME) {
|
|
94205
|
+
// Create a Camera entity that will appear in the hierarchy (for editor)
|
|
94206
|
+
const gameCamera = new Camera({
|
|
94207
|
+
name: cameraData.name || "Game Camera",
|
|
94208
|
+
fov: cameraData.fov || 75,
|
|
94209
|
+
near: cameraData.near || 0.1,
|
|
94210
|
+
far: cameraData.far || 3000000,
|
|
94211
|
+
serializable: true
|
|
94212
|
+
});
|
|
94213
|
+
gameCamera.setEntitySubtype(ENTITY_TYPES.CAMERA.SUBTYPES.GAME); // Set position and rotation
|
|
94214
|
+
|
|
94215
|
+
if (cameraData.position) gameCamera.setPosition(cameraData.position);
|
|
94216
|
+
if (cameraData.rotation) gameCamera.setRotation(cameraData.rotation); // Set uuid and name for persistence
|
|
94217
|
+
|
|
94218
|
+
if (cameraData.uuid) gameCamera.setUuid(cameraData.uuid);
|
|
94219
|
+
if (cameraData.name) gameCamera.setName(cameraData.name); // Add tags for selectability in editor
|
|
94220
|
+
|
|
94221
|
+
if (cameraData.tags) gameCamera.addTags(cameraData.tags); // Add to Scene.elements so it appears in hierarchy
|
|
94222
|
+
|
|
94223
|
+
Scene$1.add(gameCamera.getBody(), gameCamera); // Also apply to the scene's rendering camera (for deployed games)
|
|
94224
|
+
|
|
94225
|
+
const sceneCamera = Scene$1.getCamera();
|
|
94226
|
+
if (cameraData.position) sceneCamera.setPosition(cameraData.position);
|
|
94227
|
+
if (cameraData.rotation) sceneCamera.setRotation(cameraData.rotation);
|
|
94228
|
+
if (cameraData.fov) sceneCamera.setFov(cameraData.fov);
|
|
94229
|
+
if (cameraData.near) sceneCamera.setNear(cameraData.near);
|
|
94230
|
+
if (cameraData.far) sceneCamera.setFar(cameraData.far);
|
|
94231
|
+
}
|
|
94232
|
+
} // Use for...of to properly await async completeElementCreation calls
|
|
94233
|
+
|
|
94090
94234
|
|
|
94091
94235
|
for (const elementData of elements) {
|
|
94092
94236
|
try {
|