mage-engine 3.23.23 → 3.23.25
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 +459 -39
- package/package.json +1 -1
package/dist/mage.js
CHANGED
|
@@ -34,6 +34,42 @@ function _typeof(obj) {
|
|
|
34
34
|
}, _typeof(obj);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
38
|
+
try {
|
|
39
|
+
var info = gen[key](arg);
|
|
40
|
+
var value = info.value;
|
|
41
|
+
} catch (error) {
|
|
42
|
+
reject(error);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (info.done) {
|
|
47
|
+
resolve(value);
|
|
48
|
+
} else {
|
|
49
|
+
Promise.resolve(value).then(_next, _throw);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function _asyncToGenerator(fn) {
|
|
54
|
+
return function () {
|
|
55
|
+
var self = this,
|
|
56
|
+
args = arguments;
|
|
57
|
+
return new Promise(function (resolve, reject) {
|
|
58
|
+
var gen = fn.apply(self, args);
|
|
59
|
+
|
|
60
|
+
function _next(value) {
|
|
61
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function _throw(err) {
|
|
65
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_next(undefined);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
37
73
|
function _classCallCheck(instance, Constructor) {
|
|
38
74
|
if (!(instance instanceof Constructor)) {
|
|
39
75
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -54036,7 +54072,8 @@ var AUDIO_CONTEXT_NOT_AVAILABLE = "".concat(PREFIX, " No Audio Context available
|
|
|
54036
54072
|
var AUDIO_UNABLE_TO_LOAD_SOUND = "".concat(PREFIX, " Unable to load sound, sorry.");
|
|
54037
54073
|
var AUDIO_SOURCE_NOT_DEFINED = "".concat(PREFIX, " No audio source defined. Set a source for this sound.");
|
|
54038
54074
|
var LIGHT_NOT_FOUND = "".concat(PREFIX, " This light was not created properly.");
|
|
54039
|
-
var LIGHT_HOLDER_MODEL_NOT_FOUND
|
|
54075
|
+
var LIGHT_HOLDER_MODEL_NOT_FOUND = "".concat(PREFIX, " This light holder model can't be found.");
|
|
54076
|
+
var SOUND_HOLDER_MODEL_NOT_FOUND = "".concat(PREFIX, " This sound holder model can't be found.");
|
|
54040
54077
|
var LABEL_DOMELEMENT_MISSING = "".concat(PREFIX, " Could not create Label, domElement is missing. Did you forget to set the this.element ref on your component?");
|
|
54041
54078
|
var NO_VALID_LEVEL_DATA_PROVIDED = "".concat(PREFIX, " No valid level data (json or url) provided");/*
|
|
54042
54079
|
A dynamic script that can be attached to an entity.
|
|
@@ -55039,7 +55076,7 @@ var createElementFromSelector = function createElementFromSelector(selector) {
|
|
|
55039
55076
|
}
|
|
55040
55077
|
|
|
55041
55078
|
return element;
|
|
55042
|
-
};var getWindow = function getWindow() {
|
|
55079
|
+
};var getWindow$1 = function getWindow() {
|
|
55043
55080
|
try {
|
|
55044
55081
|
var win = window || global.window;
|
|
55045
55082
|
return win;
|
|
@@ -55159,7 +55196,7 @@ var Config = /*#__PURE__*/function () {
|
|
|
55159
55196
|
}, {
|
|
55160
55197
|
key: "getWindowSize",
|
|
55161
55198
|
value: function getWindowSize() {
|
|
55162
|
-
var win = getWindow();
|
|
55199
|
+
var win = getWindow$1();
|
|
55163
55200
|
if (!win) return false;
|
|
55164
55201
|
var height = win.innerHeight;
|
|
55165
55202
|
var width = win.innerWidth;
|
|
@@ -56949,7 +56986,7 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
|
|
|
56949
56986
|
}, {
|
|
56950
56987
|
key: "listenToResizeEvent",
|
|
56951
56988
|
value: function listenToResizeEvent() {
|
|
56952
|
-
var win = getWindow();
|
|
56989
|
+
var win = getWindow$1();
|
|
56953
56990
|
|
|
56954
56991
|
if (win) {
|
|
56955
56992
|
win.addEventListener("resize", this.onResize);
|
|
@@ -56958,7 +56995,7 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
|
|
|
56958
56995
|
}, {
|
|
56959
56996
|
key: "stopResizeListener",
|
|
56960
56997
|
value: function stopResizeListener() {
|
|
56961
|
-
var win = getWindow();
|
|
56998
|
+
var win = getWindow$1();
|
|
56962
56999
|
|
|
56963
57000
|
if (win) {
|
|
56964
57001
|
win.removeEventListener("resize", this.onResize);
|
|
@@ -58257,8 +58294,8 @@ function applyMiddleware() {
|
|
|
58257
58294
|
}
|
|
58258
58295
|
|
|
58259
58296
|
var thunk = createThunkMiddleware();
|
|
58260
|
-
thunk.withExtraArgument = createThunkMiddleware;var name
|
|
58261
|
-
var version$1 = "3.23.
|
|
58297
|
+
thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
|
|
58298
|
+
var version$1 = "3.23.25";
|
|
58262
58299
|
var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
|
|
58263
58300
|
var main = "dist/mage.js";
|
|
58264
58301
|
var author$1 = {
|
|
@@ -58341,7 +58378,7 @@ var devDependencies = {
|
|
|
58341
58378
|
"rollup-plugin-web-worker-loader": "1.6.1"
|
|
58342
58379
|
};
|
|
58343
58380
|
var packageJSON = {
|
|
58344
|
-
name: name
|
|
58381
|
+
name: name,
|
|
58345
58382
|
version: version$1,
|
|
58346
58383
|
description: description,
|
|
58347
58384
|
main: main,
|
|
@@ -62715,10 +62752,12 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62715
62752
|
}
|
|
62716
62753
|
}, {
|
|
62717
62754
|
key: "recordTexture",
|
|
62718
|
-
value: function recordTexture(id, type, options) {
|
|
62755
|
+
value: function recordTexture(id, type, options, assetPath) {
|
|
62756
|
+
// assetPath is the relative path like "textures/mytexture.png"
|
|
62719
62757
|
this.textures.set(type, {
|
|
62720
62758
|
id: id,
|
|
62721
|
-
options: options
|
|
62759
|
+
options: options,
|
|
62760
|
+
assetPath: assetPath
|
|
62722
62761
|
});
|
|
62723
62762
|
}
|
|
62724
62763
|
}, {
|
|
@@ -62739,15 +62778,22 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
62739
62778
|
y: 1
|
|
62740
62779
|
} : _options$repeat,
|
|
62741
62780
|
_options$wrap = options.wrap,
|
|
62742
|
-
wrap = _options$wrap === void 0 ? RepeatWrapping$1 : _options$wrap
|
|
62781
|
+
wrap = _options$wrap === void 0 ? RepeatWrapping$1 : _options$wrap,
|
|
62782
|
+
assetPath = options.assetPath;
|
|
62743
62783
|
var textureOptions = {
|
|
62744
62784
|
repeat: repeat,
|
|
62745
62785
|
wrap: wrap
|
|
62746
62786
|
};
|
|
62747
|
-
this.recordTexture(textureId, textureType, textureOptions);
|
|
62787
|
+
this.recordTexture(textureId, textureType, textureOptions, assetPath);
|
|
62748
62788
|
|
|
62749
62789
|
var applyTextureTo = function applyTextureTo(material) {
|
|
62750
62790
|
var texture = Images$1.get(textureId);
|
|
62791
|
+
|
|
62792
|
+
if (!texture) {
|
|
62793
|
+
console.warn("[Mage] Texture not found: ".concat(textureId));
|
|
62794
|
+
return;
|
|
62795
|
+
}
|
|
62796
|
+
|
|
62751
62797
|
texture.wrapS = textureOptions.wrap;
|
|
62752
62798
|
texture.wrapT = textureOptions.wrap;
|
|
62753
62799
|
texture.repeat.set(textureOptions.repeat.x, textureOptions.repeat.y);
|
|
@@ -70166,6 +70212,75 @@ var createConnect = function (ref) {
|
|
|
70166
70212
|
};
|
|
70167
70213
|
var connect = createConnect();var BaseUI = function BaseUI() {
|
|
70168
70214
|
return null;
|
|
70215
|
+
};/**
|
|
70216
|
+
* Environment configuration module for mage-engine.
|
|
70217
|
+
* Centralizes all environment variables and their default values.
|
|
70218
|
+
*
|
|
70219
|
+
* Usage:
|
|
70220
|
+
* import env from './env';
|
|
70221
|
+
* const baseUrl = env.MAGE_ASSETS_BASE_URL;
|
|
70222
|
+
*/
|
|
70223
|
+
|
|
70224
|
+
/**
|
|
70225
|
+
* Safe window access - returns undefined in non-browser environments
|
|
70226
|
+
*/
|
|
70227
|
+
var getWindow = function getWindow() {
|
|
70228
|
+
return typeof window !== "undefined" ? window : undefined;
|
|
70229
|
+
};
|
|
70230
|
+
/**
|
|
70231
|
+
* Gets an environment variable from the window object with a fallback default.
|
|
70232
|
+
* @param {string} key - The environment variable name
|
|
70233
|
+
* @param {any} defaultValue - Default value if not set
|
|
70234
|
+
* @returns {any} - The environment variable value or default
|
|
70235
|
+
*/
|
|
70236
|
+
|
|
70237
|
+
|
|
70238
|
+
var getEnv = function getEnv(key) {
|
|
70239
|
+
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
70240
|
+
var win = getWindow();
|
|
70241
|
+
return win && win[key] !== undefined ? win[key] : defaultValue;
|
|
70242
|
+
};
|
|
70243
|
+
/**
|
|
70244
|
+
* Environment variables with their default values.
|
|
70245
|
+
* These are accessed as getters so they're evaluated at access time,
|
|
70246
|
+
* not at module load time (important for variables set after page load).
|
|
70247
|
+
*/
|
|
70248
|
+
|
|
70249
|
+
|
|
70250
|
+
var env = {
|
|
70251
|
+
/**
|
|
70252
|
+
* Base URL for loading assets (textures, models, audio).
|
|
70253
|
+
* Set by mage-studio editor or deployed builds.
|
|
70254
|
+
* Default: empty string (paths used as-is for backwards compatibility)
|
|
70255
|
+
*/
|
|
70256
|
+
get MAGE_ASSETS_BASE_URL() {
|
|
70257
|
+
return getEnv("MAGE_ASSETS_BASE_URL", "");
|
|
70258
|
+
},
|
|
70259
|
+
|
|
70260
|
+
/**
|
|
70261
|
+
* Enable debug mode for verbose logging.
|
|
70262
|
+
* Default: false
|
|
70263
|
+
*/
|
|
70264
|
+
get MAGE_DEBUG() {
|
|
70265
|
+
return getEnv("MAGE_DEBUG", false);
|
|
70266
|
+
},
|
|
70267
|
+
|
|
70268
|
+
/**
|
|
70269
|
+
* Current project ID (set by mage-studio).
|
|
70270
|
+
* Default: empty string
|
|
70271
|
+
*/
|
|
70272
|
+
get MAGE_PROJECT_ID() {
|
|
70273
|
+
return getEnv("MAGE_PROJECT_ID", "");
|
|
70274
|
+
},
|
|
70275
|
+
|
|
70276
|
+
/**
|
|
70277
|
+
* Current build ID (set by deployed builds).
|
|
70278
|
+
* Default: empty string
|
|
70279
|
+
*/
|
|
70280
|
+
get MAGE_BUILD_ID() {
|
|
70281
|
+
return getEnv("MAGE_BUILD_ID", "");
|
|
70282
|
+
}
|
|
70283
|
+
|
|
70169
70284
|
};var TIME_FOR_UPDATE = 5;
|
|
70170
70285
|
var VOLUME = 2;
|
|
70171
70286
|
var DEFAULT_AUDIO_NODE_VOLUME = 5;
|
|
@@ -70175,6 +70290,48 @@ var AUDIO_RAMPS = {
|
|
|
70175
70290
|
LINEAR: "LINEAR",
|
|
70176
70291
|
EXPONENTIAL: "EXPONENTIAL"
|
|
70177
70292
|
};
|
|
70293
|
+
/**
|
|
70294
|
+
* Checks if a path is an absolute URL.
|
|
70295
|
+
* @param {string} path - The path to check
|
|
70296
|
+
* @returns {boolean} - True if path is an absolute URL
|
|
70297
|
+
*/
|
|
70298
|
+
|
|
70299
|
+
var isURL$1 = function isURL(path) {
|
|
70300
|
+
try {
|
|
70301
|
+
new URL(path);
|
|
70302
|
+
return true;
|
|
70303
|
+
} catch (_) {
|
|
70304
|
+
return false;
|
|
70305
|
+
}
|
|
70306
|
+
};
|
|
70307
|
+
/**
|
|
70308
|
+
* Resolves an asset path to a full URL.
|
|
70309
|
+
* If path is already an absolute URL, returns it as-is.
|
|
70310
|
+
* If path is relative and MAGE_ASSETS_BASE_URL is set, prepends the base URL.
|
|
70311
|
+
* @param {string} path - The asset path (relative or absolute)
|
|
70312
|
+
* @returns {string} - The resolved full URL
|
|
70313
|
+
*/
|
|
70314
|
+
|
|
70315
|
+
|
|
70316
|
+
var resolveAssetPath$1 = function resolveAssetPath(path) {
|
|
70317
|
+
// If it's already an absolute URL, use it as-is
|
|
70318
|
+
if (isURL$1(path)) {
|
|
70319
|
+
return path;
|
|
70320
|
+
} // If MAGE_ASSETS_BASE_URL is set, prepend it to the relative path
|
|
70321
|
+
|
|
70322
|
+
|
|
70323
|
+
var baseUrl = env.MAGE_ASSETS_BASE_URL;
|
|
70324
|
+
|
|
70325
|
+
if (baseUrl) {
|
|
70326
|
+
// Remove leading slash from path if present to avoid double slashes
|
|
70327
|
+
var cleanPath = path.startsWith("/") ? path.slice(1) : path;
|
|
70328
|
+
return "".concat(baseUrl, "/").concat(cleanPath);
|
|
70329
|
+
} // Fallback: return the path as-is (for backwards compatibility)
|
|
70330
|
+
|
|
70331
|
+
|
|
70332
|
+
return path;
|
|
70333
|
+
};
|
|
70334
|
+
|
|
70178
70335
|
var Audio = /*#__PURE__*/function () {
|
|
70179
70336
|
function Audio() {
|
|
70180
70337
|
var _this = this;
|
|
@@ -70212,9 +70369,11 @@ var Audio = /*#__PURE__*/function () {
|
|
|
70212
70369
|
});
|
|
70213
70370
|
|
|
70214
70371
|
_defineProperty$1(this, "loadAssetByPath", function (path, id) {
|
|
70372
|
+
// Resolve the path using MAGE_ASSETS_BASE_URL if available
|
|
70373
|
+
var resolvedPath = resolveAssetPath$1(path);
|
|
70215
70374
|
var request = new XMLHttpRequest();
|
|
70216
70375
|
return new Promise(function (resolve) {
|
|
70217
|
-
request.open("GET",
|
|
70376
|
+
request.open("GET", resolvedPath, true);
|
|
70218
70377
|
request.responseType = "arraybuffer";
|
|
70219
70378
|
|
|
70220
70379
|
request.onreadystatechange = function (e) {
|
|
@@ -80709,6 +80868,33 @@ var isURL = function isURL(path) {
|
|
|
80709
80868
|
return false;
|
|
80710
80869
|
}
|
|
80711
80870
|
};
|
|
80871
|
+
/**
|
|
80872
|
+
* Resolves an asset path to a full URL.
|
|
80873
|
+
* If path is already an absolute URL, returns it as-is.
|
|
80874
|
+
* If path is relative and MAGE_ASSETS_BASE_URL is set, prepends the base URL.
|
|
80875
|
+
* @param {string} path - The asset path (relative or absolute)
|
|
80876
|
+
* @returns {string} - The resolved full URL
|
|
80877
|
+
*/
|
|
80878
|
+
|
|
80879
|
+
|
|
80880
|
+
var resolveAssetPath = function resolveAssetPath(path) {
|
|
80881
|
+
// If it's already an absolute URL, use it as-is
|
|
80882
|
+
if (isURL(path)) {
|
|
80883
|
+
return path;
|
|
80884
|
+
} // If MAGE_ASSETS_BASE_URL is set, prepend it to the relative path
|
|
80885
|
+
|
|
80886
|
+
|
|
80887
|
+
var baseUrl = env.MAGE_ASSETS_BASE_URL;
|
|
80888
|
+
|
|
80889
|
+
if (baseUrl) {
|
|
80890
|
+
// Remove leading slash from path if present to avoid double slashes
|
|
80891
|
+
var cleanPath = path.startsWith("/") ? path.slice(1) : path;
|
|
80892
|
+
return "".concat(baseUrl, "/").concat(cleanPath);
|
|
80893
|
+
} // Fallback: return the path as-is (for backwards compatibility)
|
|
80894
|
+
|
|
80895
|
+
|
|
80896
|
+
return path;
|
|
80897
|
+
};
|
|
80712
80898
|
|
|
80713
80899
|
var extractExtension = function extractExtension(path) {
|
|
80714
80900
|
var url = isURL(path);
|
|
@@ -80915,7 +81101,9 @@ var Models = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
80915
81101
|
_defineProperty$1(_assertThisInitialized(_this), "loadAssetByPath", function (path, name) {
|
|
80916
81102
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
80917
81103
|
var level = options.level;
|
|
80918
|
-
var id = buildAssetId(name, level);
|
|
81104
|
+
var id = buildAssetId(name, level); // Resolve the path using MAGE_ASSETS_BASE_URL if available
|
|
81105
|
+
|
|
81106
|
+
var resolvedPath = resolveAssetPath(path);
|
|
80919
81107
|
var extension = extractExtension(path);
|
|
80920
81108
|
|
|
80921
81109
|
var _getLoaderFromExtensi = getLoaderFromExtension(extension, options),
|
|
@@ -80932,7 +81120,7 @@ var Models = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
80932
81120
|
});
|
|
80933
81121
|
});
|
|
80934
81122
|
return new Promise(function (resolve) {
|
|
80935
|
-
loader.load(
|
|
81123
|
+
loader.load(resolvedPath, function (model) {
|
|
80936
81124
|
var parsedModel = parser(model);
|
|
80937
81125
|
|
|
80938
81126
|
if (parsedModel) {
|
|
@@ -91199,7 +91387,7 @@ var storage = new Storage();var Light$1 = /*#__PURE__*/function (_Entity) {
|
|
|
91199
91387
|
_this.holder = holderSprite;
|
|
91200
91388
|
return true;
|
|
91201
91389
|
} else {
|
|
91202
|
-
console.warn(LIGHT_HOLDER_MODEL_NOT_FOUND
|
|
91390
|
+
console.warn(LIGHT_HOLDER_MODEL_NOT_FOUND);
|
|
91203
91391
|
return false;
|
|
91204
91392
|
}
|
|
91205
91393
|
});
|
|
@@ -91650,7 +91838,32 @@ var PointLight$1 = /*#__PURE__*/function (_Light) {
|
|
|
91650
91838
|
key: "create",
|
|
91651
91839
|
value: function create() {
|
|
91652
91840
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
91653
|
-
|
|
91841
|
+
var color = data.color,
|
|
91842
|
+
intensity = data.intensity,
|
|
91843
|
+
name = data.name,
|
|
91844
|
+
position = data.position,
|
|
91845
|
+
distance = data.distance,
|
|
91846
|
+
decay = data.decay,
|
|
91847
|
+
bias = data.bias,
|
|
91848
|
+
mapSize = data.mapSize,
|
|
91849
|
+
shadowCamera = data.shadowCamera;
|
|
91850
|
+
|
|
91851
|
+
var _ref3 = shadowCamera || {},
|
|
91852
|
+
near = _ref3.near,
|
|
91853
|
+
far = _ref3.far;
|
|
91854
|
+
|
|
91855
|
+
return new PointLight({
|
|
91856
|
+
color: color,
|
|
91857
|
+
intensity: intensity,
|
|
91858
|
+
name: name,
|
|
91859
|
+
position: position,
|
|
91860
|
+
distance: distance,
|
|
91861
|
+
decay: decay,
|
|
91862
|
+
near: near,
|
|
91863
|
+
far: far,
|
|
91864
|
+
mapSize: mapSize,
|
|
91865
|
+
bias: bias
|
|
91866
|
+
});
|
|
91654
91867
|
}
|
|
91655
91868
|
}]);
|
|
91656
91869
|
|
|
@@ -91760,7 +91973,16 @@ var AmbientLight$1 = /*#__PURE__*/function (_Light) {
|
|
|
91760
91973
|
key: "create",
|
|
91761
91974
|
value: function create() {
|
|
91762
91975
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
91763
|
-
|
|
91976
|
+
var color = data.color,
|
|
91977
|
+
intensity = data.intensity,
|
|
91978
|
+
name = data.name,
|
|
91979
|
+
position = data.position;
|
|
91980
|
+
return new AmbientLight({
|
|
91981
|
+
color: color,
|
|
91982
|
+
intensity: intensity,
|
|
91983
|
+
name: name,
|
|
91984
|
+
position: position
|
|
91985
|
+
});
|
|
91764
91986
|
}
|
|
91765
91987
|
}]);
|
|
91766
91988
|
|
|
@@ -92070,7 +92292,36 @@ var SpotLight$1 = /*#__PURE__*/function (_Light) {
|
|
|
92070
92292
|
key: "create",
|
|
92071
92293
|
value: function create() {
|
|
92072
92294
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
92073
|
-
|
|
92295
|
+
var color = data.color,
|
|
92296
|
+
intensity = data.intensity,
|
|
92297
|
+
name = data.name,
|
|
92298
|
+
position = data.position,
|
|
92299
|
+
distance = data.distance,
|
|
92300
|
+
angle = data.angle,
|
|
92301
|
+
penumbra = data.penumbra,
|
|
92302
|
+
decay = data.decay,
|
|
92303
|
+
bias = data.bias,
|
|
92304
|
+
mapSize = data.mapSize,
|
|
92305
|
+
shadowCamera = data.shadowCamera;
|
|
92306
|
+
|
|
92307
|
+
var _ref3 = shadowCamera || {},
|
|
92308
|
+
near = _ref3.near,
|
|
92309
|
+
far = _ref3.far;
|
|
92310
|
+
|
|
92311
|
+
return new SpotLight({
|
|
92312
|
+
color: color,
|
|
92313
|
+
intensity: intensity,
|
|
92314
|
+
name: name,
|
|
92315
|
+
position: position,
|
|
92316
|
+
distance: distance,
|
|
92317
|
+
angle: angle,
|
|
92318
|
+
penumbra: penumbra,
|
|
92319
|
+
decay: decay,
|
|
92320
|
+
near: near,
|
|
92321
|
+
far: far,
|
|
92322
|
+
mapSize: mapSize,
|
|
92323
|
+
bias: bias
|
|
92324
|
+
});
|
|
92074
92325
|
}
|
|
92075
92326
|
}]);
|
|
92076
92327
|
|
|
@@ -92111,7 +92362,7 @@ var SpotLight$1 = /*#__PURE__*/function (_Light) {
|
|
|
92111
92362
|
_this.holder = holderSprite;
|
|
92112
92363
|
return true;
|
|
92113
92364
|
} else {
|
|
92114
|
-
console.warn(LIGHT_HOLDER_MODEL_NOT_FOUND
|
|
92365
|
+
console.warn(LIGHT_HOLDER_MODEL_NOT_FOUND);
|
|
92115
92366
|
return false;
|
|
92116
92367
|
}
|
|
92117
92368
|
});
|
|
@@ -92476,7 +92727,16 @@ var HemisphereLight$1 = /*#__PURE__*/function (_Light) {
|
|
|
92476
92727
|
key: "create",
|
|
92477
92728
|
value: function create() {
|
|
92478
92729
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
92479
|
-
|
|
92730
|
+
var color = data.color,
|
|
92731
|
+
intensity = data.intensity,
|
|
92732
|
+
name = data.name,
|
|
92733
|
+
position = data.position;
|
|
92734
|
+
return new HemisphereLight({
|
|
92735
|
+
color: color,
|
|
92736
|
+
intensity: intensity,
|
|
92737
|
+
name: name,
|
|
92738
|
+
position: position
|
|
92739
|
+
});
|
|
92480
92740
|
}
|
|
92481
92741
|
}]);
|
|
92482
92742
|
|
|
@@ -92724,7 +92984,30 @@ var SunLight$1 = /*#__PURE__*/function (_Light) {
|
|
|
92724
92984
|
key: "create",
|
|
92725
92985
|
value: function create() {
|
|
92726
92986
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
92727
|
-
|
|
92987
|
+
var color = data.color,
|
|
92988
|
+
intensity = data.intensity,
|
|
92989
|
+
name = data.name,
|
|
92990
|
+
position = data.position,
|
|
92991
|
+
bias = data.bias,
|
|
92992
|
+
mapSize = data.mapSize,
|
|
92993
|
+
shadowCamera = data.shadowCamera;
|
|
92994
|
+
|
|
92995
|
+
var _ref3 = shadowCamera || {},
|
|
92996
|
+
near = _ref3.near,
|
|
92997
|
+
far = _ref3.far,
|
|
92998
|
+
fov = _ref3.fov;
|
|
92999
|
+
|
|
93000
|
+
return new SunLight({
|
|
93001
|
+
color: color,
|
|
93002
|
+
intensity: intensity,
|
|
93003
|
+
name: name,
|
|
93004
|
+
position: position,
|
|
93005
|
+
near: near,
|
|
93006
|
+
far: far,
|
|
93007
|
+
mapSize: mapSize,
|
|
93008
|
+
bias: bias,
|
|
93009
|
+
fov: fov
|
|
93010
|
+
});
|
|
92728
93011
|
}
|
|
92729
93012
|
}]);
|
|
92730
93013
|
|
|
@@ -92836,12 +93119,12 @@ var Sound$1 = /*#__PURE__*/function (_Entity) {
|
|
|
92836
93119
|
holderSprite.setDepthWrite(false);
|
|
92837
93120
|
holderSprite.setSerializable(false);
|
|
92838
93121
|
holderSprite.setPosition(this.getPosition());
|
|
92839
|
-
holderSprite.addTags([TAGS.HELPER, TAGS.SOUNDS.HELPER, TAGS.SOUNDS.HOLDER,
|
|
93122
|
+
holderSprite.addTags([TAGS.HELPER, TAGS.SOUNDS.HELPER, TAGS.SOUNDS.HOLDER, holderName]);
|
|
92840
93123
|
holderSprite.setHelperTarget(this);
|
|
92841
93124
|
this.holder = holderSprite;
|
|
92842
93125
|
return true;
|
|
92843
93126
|
} else {
|
|
92844
|
-
console.warn(
|
|
93127
|
+
console.warn(SOUND_HOLDER_MODEL_NOT_FOUND);
|
|
92845
93128
|
return false;
|
|
92846
93129
|
}
|
|
92847
93130
|
}
|
|
@@ -93590,7 +93873,7 @@ var Importer = /*#__PURE__*/function () {
|
|
|
93590
93873
|
_ref$options = _ref.options,
|
|
93591
93874
|
options = _ref$options === void 0 ? {} : _ref$options;
|
|
93592
93875
|
|
|
93593
|
-
if (getWindow() && url) {
|
|
93876
|
+
if (getWindow$1() && url) {
|
|
93594
93877
|
return fetch$1(url).then(function (res) {
|
|
93595
93878
|
return res.json();
|
|
93596
93879
|
}).then(function (data) {
|
|
@@ -93686,12 +93969,54 @@ var Importer = /*#__PURE__*/function () {
|
|
|
93686
93969
|
if (elementData.textures) {
|
|
93687
93970
|
var parsedTextures = JSON.parse(elementData.textures);
|
|
93688
93971
|
element.setNormalScale();
|
|
93689
|
-
Object.keys(parsedTextures).forEach(function (
|
|
93690
|
-
var
|
|
93691
|
-
|
|
93692
|
-
|
|
93693
|
-
|
|
93694
|
-
|
|
93972
|
+
Object.keys(parsedTextures).forEach( /*#__PURE__*/function () {
|
|
93973
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(textureType) {
|
|
93974
|
+
var _parsedTextures$textu, id, options, assetPath, baseUrl, fullUrl;
|
|
93975
|
+
|
|
93976
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
93977
|
+
while (1) {
|
|
93978
|
+
switch (_context.prev = _context.next) {
|
|
93979
|
+
case 0:
|
|
93980
|
+
_parsedTextures$textu = parsedTextures[textureType], id = _parsedTextures$textu.id, options = _parsedTextures$textu.options, assetPath = _parsedTextures$textu.assetPath; // If texture not already loaded and we have an assetPath, load it first
|
|
93981
|
+
// assetPath is relative like "textures/mytexture.png"
|
|
93982
|
+
// The actual URL is resolved based on the assets base URL
|
|
93983
|
+
|
|
93984
|
+
if (!(!Images$1.get(id) && assetPath)) {
|
|
93985
|
+
_context.next = 12;
|
|
93986
|
+
break;
|
|
93987
|
+
}
|
|
93988
|
+
|
|
93989
|
+
_context.prev = 2;
|
|
93990
|
+
// Use the assets base URL from env to build full URL
|
|
93991
|
+
baseUrl = env.MAGE_ASSETS_BASE_URL;
|
|
93992
|
+
fullUrl = baseUrl ? "".concat(baseUrl, "/").concat(assetPath) : assetPath;
|
|
93993
|
+
_context.next = 7;
|
|
93994
|
+
return Images$1.loadAssetByPath(fullUrl, id, Images$1.currentLevel);
|
|
93995
|
+
|
|
93996
|
+
case 7:
|
|
93997
|
+
_context.next = 12;
|
|
93998
|
+
break;
|
|
93999
|
+
|
|
94000
|
+
case 9:
|
|
94001
|
+
_context.prev = 9;
|
|
94002
|
+
_context.t0 = _context["catch"](2);
|
|
94003
|
+
console.warn("[Mage] Failed to load texture: ".concat(id, " from ").concat(assetPath));
|
|
94004
|
+
|
|
94005
|
+
case 12:
|
|
94006
|
+
element.setTexture(id, textureType, options);
|
|
94007
|
+
|
|
94008
|
+
case 13:
|
|
94009
|
+
case "end":
|
|
94010
|
+
return _context.stop();
|
|
94011
|
+
}
|
|
94012
|
+
}
|
|
94013
|
+
}, _callee, null, [[2, 9]]);
|
|
94014
|
+
}));
|
|
94015
|
+
|
|
94016
|
+
return function (_x) {
|
|
94017
|
+
return _ref2.apply(this, arguments);
|
|
94018
|
+
};
|
|
94019
|
+
}());
|
|
93695
94020
|
} // setting shadow properties
|
|
93696
94021
|
|
|
93697
94022
|
|
|
@@ -94970,12 +95295,12 @@ var Sound = /*#__PURE__*/function (_Entity) {
|
|
|
94970
95295
|
holderSprite.setDepthWrite(false);
|
|
94971
95296
|
holderSprite.setSerializable(false);
|
|
94972
95297
|
holderSprite.setPosition(this.getPosition());
|
|
94973
|
-
holderSprite.addTags([TAGS.HELPER, TAGS.SOUNDS.HELPER, TAGS.SOUNDS.HOLDER,
|
|
95298
|
+
holderSprite.addTags([TAGS.HELPER, TAGS.SOUNDS.HELPER, TAGS.SOUNDS.HOLDER, holderName]);
|
|
94974
95299
|
holderSprite.setHelperTarget(this);
|
|
94975
95300
|
this.holder = holderSprite;
|
|
94976
95301
|
return true;
|
|
94977
95302
|
} else {
|
|
94978
|
-
console.warn(
|
|
95303
|
+
console.warn(SOUND_HOLDER_MODEL_NOT_FOUND);
|
|
94979
95304
|
return false;
|
|
94980
95305
|
}
|
|
94981
95306
|
}
|
|
@@ -95353,7 +95678,7 @@ var createPromiseWorker = function createPromiseWorker(task, message) {
|
|
|
95353
95678
|
value: function _export() {
|
|
95354
95679
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
95355
95680
|
|
|
95356
|
-
if (getWindow()) {
|
|
95681
|
+
if (getWindow$1()) {
|
|
95357
95682
|
// only exporting the current level, each level needs to be instantiated to export it
|
|
95358
95683
|
var level = GameRunner$1.getCurrentLevel();
|
|
95359
95684
|
var content = JSON.stringify(level.toJSON());
|
|
@@ -95554,7 +95879,16 @@ var AmbientLight = /*#__PURE__*/function (_Light) {
|
|
|
95554
95879
|
key: "create",
|
|
95555
95880
|
value: function create() {
|
|
95556
95881
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
95557
|
-
|
|
95882
|
+
var color = data.color,
|
|
95883
|
+
intensity = data.intensity,
|
|
95884
|
+
name = data.name,
|
|
95885
|
+
position = data.position;
|
|
95886
|
+
return new AmbientLight({
|
|
95887
|
+
color: color,
|
|
95888
|
+
intensity: intensity,
|
|
95889
|
+
name: name,
|
|
95890
|
+
position: position
|
|
95891
|
+
});
|
|
95558
95892
|
}
|
|
95559
95893
|
}]);
|
|
95560
95894
|
|
|
@@ -95802,7 +96136,30 @@ var SunLight = /*#__PURE__*/function (_Light) {
|
|
|
95802
96136
|
key: "create",
|
|
95803
96137
|
value: function create() {
|
|
95804
96138
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
95805
|
-
|
|
96139
|
+
var color = data.color,
|
|
96140
|
+
intensity = data.intensity,
|
|
96141
|
+
name = data.name,
|
|
96142
|
+
position = data.position,
|
|
96143
|
+
bias = data.bias,
|
|
96144
|
+
mapSize = data.mapSize,
|
|
96145
|
+
shadowCamera = data.shadowCamera;
|
|
96146
|
+
|
|
96147
|
+
var _ref3 = shadowCamera || {},
|
|
96148
|
+
near = _ref3.near,
|
|
96149
|
+
far = _ref3.far,
|
|
96150
|
+
fov = _ref3.fov;
|
|
96151
|
+
|
|
96152
|
+
return new SunLight({
|
|
96153
|
+
color: color,
|
|
96154
|
+
intensity: intensity,
|
|
96155
|
+
name: name,
|
|
96156
|
+
position: position,
|
|
96157
|
+
near: near,
|
|
96158
|
+
far: far,
|
|
96159
|
+
mapSize: mapSize,
|
|
96160
|
+
bias: bias,
|
|
96161
|
+
fov: fov
|
|
96162
|
+
});
|
|
95806
96163
|
}
|
|
95807
96164
|
}]);
|
|
95808
96165
|
|
|
@@ -96041,7 +96398,32 @@ var PointLight = /*#__PURE__*/function (_Light) {
|
|
|
96041
96398
|
key: "create",
|
|
96042
96399
|
value: function create() {
|
|
96043
96400
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
96044
|
-
|
|
96401
|
+
var color = data.color,
|
|
96402
|
+
intensity = data.intensity,
|
|
96403
|
+
name = data.name,
|
|
96404
|
+
position = data.position,
|
|
96405
|
+
distance = data.distance,
|
|
96406
|
+
decay = data.decay,
|
|
96407
|
+
bias = data.bias,
|
|
96408
|
+
mapSize = data.mapSize,
|
|
96409
|
+
shadowCamera = data.shadowCamera;
|
|
96410
|
+
|
|
96411
|
+
var _ref3 = shadowCamera || {},
|
|
96412
|
+
near = _ref3.near,
|
|
96413
|
+
far = _ref3.far;
|
|
96414
|
+
|
|
96415
|
+
return new PointLight({
|
|
96416
|
+
color: color,
|
|
96417
|
+
intensity: intensity,
|
|
96418
|
+
name: name,
|
|
96419
|
+
position: position,
|
|
96420
|
+
distance: distance,
|
|
96421
|
+
decay: decay,
|
|
96422
|
+
near: near,
|
|
96423
|
+
far: far,
|
|
96424
|
+
mapSize: mapSize,
|
|
96425
|
+
bias: bias
|
|
96426
|
+
});
|
|
96045
96427
|
}
|
|
96046
96428
|
}]);
|
|
96047
96429
|
|
|
@@ -96351,7 +96733,36 @@ var SpotLight = /*#__PURE__*/function (_Light) {
|
|
|
96351
96733
|
key: "create",
|
|
96352
96734
|
value: function create() {
|
|
96353
96735
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
96354
|
-
|
|
96736
|
+
var color = data.color,
|
|
96737
|
+
intensity = data.intensity,
|
|
96738
|
+
name = data.name,
|
|
96739
|
+
position = data.position,
|
|
96740
|
+
distance = data.distance,
|
|
96741
|
+
angle = data.angle,
|
|
96742
|
+
penumbra = data.penumbra,
|
|
96743
|
+
decay = data.decay,
|
|
96744
|
+
bias = data.bias,
|
|
96745
|
+
mapSize = data.mapSize,
|
|
96746
|
+
shadowCamera = data.shadowCamera;
|
|
96747
|
+
|
|
96748
|
+
var _ref3 = shadowCamera || {},
|
|
96749
|
+
near = _ref3.near,
|
|
96750
|
+
far = _ref3.far;
|
|
96751
|
+
|
|
96752
|
+
return new SpotLight({
|
|
96753
|
+
color: color,
|
|
96754
|
+
intensity: intensity,
|
|
96755
|
+
name: name,
|
|
96756
|
+
position: position,
|
|
96757
|
+
distance: distance,
|
|
96758
|
+
angle: angle,
|
|
96759
|
+
penumbra: penumbra,
|
|
96760
|
+
decay: decay,
|
|
96761
|
+
near: near,
|
|
96762
|
+
far: far,
|
|
96763
|
+
mapSize: mapSize,
|
|
96764
|
+
bias: bias
|
|
96765
|
+
});
|
|
96355
96766
|
}
|
|
96356
96767
|
}]);
|
|
96357
96768
|
|
|
@@ -96504,7 +96915,16 @@ var HemisphereLight = /*#__PURE__*/function (_Light) {
|
|
|
96504
96915
|
key: "create",
|
|
96505
96916
|
value: function create() {
|
|
96506
96917
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
96507
|
-
|
|
96918
|
+
var color = data.color,
|
|
96919
|
+
intensity = data.intensity,
|
|
96920
|
+
name = data.name,
|
|
96921
|
+
position = data.position;
|
|
96922
|
+
return new HemisphereLight({
|
|
96923
|
+
color: color,
|
|
96924
|
+
intensity: intensity,
|
|
96925
|
+
name: name,
|
|
96926
|
+
position: position
|
|
96927
|
+
});
|
|
96508
96928
|
}
|
|
96509
96929
|
}]);
|
|
96510
96930
|
|