@galacean/engine 1.3.19 → 1.3.21
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/browser.js +377 -217
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -288,6 +288,16 @@
|
|
|
288
288
|
return this;
|
|
289
289
|
};
|
|
290
290
|
/**
|
|
291
|
+
* Copy to vector3 like object.
|
|
292
|
+
* @param target - Vector3 like object
|
|
293
|
+
* @returns This Vector3 like object
|
|
294
|
+
*/ _proto.copyTo = function copyTo(target) {
|
|
295
|
+
target.x = this._x;
|
|
296
|
+
target.y = this._y;
|
|
297
|
+
target.z = this._z;
|
|
298
|
+
return target;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
291
301
|
* Copy the value of this vector from an array.
|
|
292
302
|
* @param array - The array
|
|
293
303
|
* @param offset - The start offset of the array
|
|
@@ -2206,6 +2216,17 @@
|
|
|
2206
2216
|
return this;
|
|
2207
2217
|
};
|
|
2208
2218
|
/**
|
|
2219
|
+
* Copy this quaternion to the specified quaternion.
|
|
2220
|
+
* @param target - The specified quaternion
|
|
2221
|
+
* @returns This specified quaternion
|
|
2222
|
+
*/ _proto.copyTo = function copyTo(target) {
|
|
2223
|
+
target.x = this._x;
|
|
2224
|
+
target.y = this._y;
|
|
2225
|
+
target.z = this._z;
|
|
2226
|
+
target.w = this._w;
|
|
2227
|
+
return target;
|
|
2228
|
+
};
|
|
2229
|
+
/**
|
|
2209
2230
|
* Copy the value of this quaternion from an array.
|
|
2210
2231
|
* @param array - The array
|
|
2211
2232
|
* @param offset - The start offset of the array
|
|
@@ -3771,6 +3792,15 @@
|
|
|
3771
3792
|
return this;
|
|
3772
3793
|
};
|
|
3773
3794
|
/**
|
|
3795
|
+
* Copy to vector2 like object.
|
|
3796
|
+
* @param target - Vector2 like object
|
|
3797
|
+
* @returns This Vector2 like object
|
|
3798
|
+
*/ _proto.copyTo = function copyTo(target) {
|
|
3799
|
+
target.x = this._x;
|
|
3800
|
+
target.y = this._y;
|
|
3801
|
+
return target;
|
|
3802
|
+
};
|
|
3803
|
+
/**
|
|
3774
3804
|
* Copy the value of this vector from an array.
|
|
3775
3805
|
* @param array - The array
|
|
3776
3806
|
* @param offset - The start offset of the array
|
|
@@ -4117,6 +4147,17 @@
|
|
|
4117
4147
|
return this;
|
|
4118
4148
|
};
|
|
4119
4149
|
/**
|
|
4150
|
+
* Copy to vector4 like object.
|
|
4151
|
+
* @param target - Vector4 like object
|
|
4152
|
+
* @returns This Vector4 like object
|
|
4153
|
+
*/ _proto.copyTo = function copyTo(target) {
|
|
4154
|
+
target.x = this._x;
|
|
4155
|
+
target.y = this._y;
|
|
4156
|
+
target.z = this._z;
|
|
4157
|
+
target.w = this._w;
|
|
4158
|
+
return target;
|
|
4159
|
+
};
|
|
4160
|
+
/**
|
|
4120
4161
|
* Copy the value of this vector by an array.
|
|
4121
4162
|
* @param array - The array
|
|
4122
4163
|
* @param offset - The start offset of the array
|
|
@@ -4486,6 +4527,17 @@
|
|
|
4486
4527
|
return this;
|
|
4487
4528
|
};
|
|
4488
4529
|
/**
|
|
4530
|
+
* Copy to color like object.
|
|
4531
|
+
* @param target - Color like object.
|
|
4532
|
+
* @returns This Color like object
|
|
4533
|
+
*/ _proto.copyTo = function copyTo(target) {
|
|
4534
|
+
target.r = this._r;
|
|
4535
|
+
target.g = this._g;
|
|
4536
|
+
target.b = this._b;
|
|
4537
|
+
target.a = this._a;
|
|
4538
|
+
return target;
|
|
4539
|
+
};
|
|
4540
|
+
/**
|
|
4489
4541
|
* Copy from array like object.
|
|
4490
4542
|
* @param source - Array like object
|
|
4491
4543
|
* @param offset - The start offset
|
|
@@ -23417,8 +23469,20 @@
|
|
|
23417
23469
|
mesh.setVertexElements([
|
|
23418
23470
|
new VertexElement("POSITION_UV", 0, exports.VertexElementFormat.Vector4, 0)
|
|
23419
23471
|
]);
|
|
23420
|
-
|
|
23472
|
+
var buffer = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, vertices, exports.BufferUsage.Static, true);
|
|
23473
|
+
mesh.setVertexBufferBinding(buffer, 16);
|
|
23421
23474
|
mesh.addSubMesh(0, 3, exports.MeshTopology.Triangles);
|
|
23475
|
+
engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
23476
|
+
var _class = function _class() {
|
|
23477
|
+
return ContentRestorer.call(this, mesh);
|
|
23478
|
+
};
|
|
23479
|
+
_inherits$2(_class, ContentRestorer);
|
|
23480
|
+
var _proto = _class.prototype;
|
|
23481
|
+
_proto.restoreContent = function restoreContent() {
|
|
23482
|
+
buffer.setData(buffer.data);
|
|
23483
|
+
};
|
|
23484
|
+
return _class;
|
|
23485
|
+
}(ContentRestorer))());
|
|
23422
23486
|
return mesh;
|
|
23423
23487
|
};
|
|
23424
23488
|
_proto._create1x1Texture = function _create1x1Texture(engine, type, format, pixel) {
|
|
@@ -24197,6 +24261,150 @@
|
|
|
24197
24261
|
PromiseState["Rejected"] = "rejected";
|
|
24198
24262
|
PromiseState["Canceled"] = "canceled";
|
|
24199
24263
|
})(PromiseState || (PromiseState = {}));
|
|
24264
|
+
var mimeType = {
|
|
24265
|
+
json: "json",
|
|
24266
|
+
gltf: "json",
|
|
24267
|
+
mtl: "json",
|
|
24268
|
+
prefab: "json",
|
|
24269
|
+
txt: "text",
|
|
24270
|
+
bin: "arraybuffer",
|
|
24271
|
+
png: "image",
|
|
24272
|
+
webp: "image",
|
|
24273
|
+
jpg: "image"
|
|
24274
|
+
};
|
|
24275
|
+
var defaultRetryCount = 1;
|
|
24276
|
+
var defaultTimeout = Infinity;
|
|
24277
|
+
var defaultInterval = 500;
|
|
24278
|
+
/**
|
|
24279
|
+
* Web request.
|
|
24280
|
+
* @param url - The link
|
|
24281
|
+
* @param config - Load configuration
|
|
24282
|
+
*/ function request(url, config) {
|
|
24283
|
+
if (config === void 0) config = {};
|
|
24284
|
+
return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
24285
|
+
var _config_retryCount;
|
|
24286
|
+
var retryCount = (_config_retryCount = config.retryCount) != null ? _config_retryCount : defaultRetryCount;
|
|
24287
|
+
var _config_retryInterval;
|
|
24288
|
+
var retryInterval = (_config_retryInterval = config.retryInterval) != null ? _config_retryInterval : defaultInterval;
|
|
24289
|
+
var _config_timeout;
|
|
24290
|
+
config.timeout = (_config_timeout = config.timeout) != null ? _config_timeout : defaultTimeout;
|
|
24291
|
+
var _config_type;
|
|
24292
|
+
config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
|
|
24293
|
+
var executor = new MultiExecutor(function() {
|
|
24294
|
+
return requestRes(url, config).onProgress(setTaskCompleteProgress, setTaskDetailProgress);
|
|
24295
|
+
}, retryCount, retryInterval);
|
|
24296
|
+
executor.start().onError(reject).onComplete(resolve);
|
|
24297
|
+
});
|
|
24298
|
+
}
|
|
24299
|
+
function requestRes(url, config) {
|
|
24300
|
+
return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
24301
|
+
var xhr = new XMLHttpRequest();
|
|
24302
|
+
var isImg = config.type === "image";
|
|
24303
|
+
xhr.timeout = config.timeout;
|
|
24304
|
+
var _config_method;
|
|
24305
|
+
config.method = (_config_method = config.method) != null ? _config_method : "get";
|
|
24306
|
+
xhr.onload = function() {
|
|
24307
|
+
if (xhr.status < 200 || xhr.status >= 300) {
|
|
24308
|
+
reject(new Error("request failed from: " + url));
|
|
24309
|
+
return;
|
|
24310
|
+
}
|
|
24311
|
+
var _xhr_response;
|
|
24312
|
+
var result = (_xhr_response = xhr.response) != null ? _xhr_response : xhr.responseText;
|
|
24313
|
+
if (isImg) {
|
|
24314
|
+
var img = new Image();
|
|
24315
|
+
img.onload = function() {
|
|
24316
|
+
// Call requestAnimationFrame to avoid iOS's bug.
|
|
24317
|
+
requestAnimationFrame(function() {
|
|
24318
|
+
setTaskCompleteProgress(1, 1);
|
|
24319
|
+
//@ts-ignore
|
|
24320
|
+
resolve(img);
|
|
24321
|
+
img.onload = null;
|
|
24322
|
+
img.onerror = null;
|
|
24323
|
+
img.onabort = null;
|
|
24324
|
+
URL.revokeObjectURL(img.src);
|
|
24325
|
+
});
|
|
24326
|
+
};
|
|
24327
|
+
img.onerror = img.onabort = function() {
|
|
24328
|
+
reject(new Error("request " + img.src + " fail"));
|
|
24329
|
+
URL.revokeObjectURL(img.src);
|
|
24330
|
+
};
|
|
24331
|
+
img.crossOrigin = "anonymous";
|
|
24332
|
+
img.src = URL.createObjectURL(result);
|
|
24333
|
+
} else {
|
|
24334
|
+
setTaskCompleteProgress(1, 1);
|
|
24335
|
+
resolve(result);
|
|
24336
|
+
}
|
|
24337
|
+
};
|
|
24338
|
+
xhr.onerror = function() {
|
|
24339
|
+
reject(new Error("request failed from: " + url));
|
|
24340
|
+
};
|
|
24341
|
+
xhr.ontimeout = function() {
|
|
24342
|
+
reject(new Error("request timeout from: " + url));
|
|
24343
|
+
};
|
|
24344
|
+
xhr.onprogress = function(e) {
|
|
24345
|
+
if (e.lengthComputable) {
|
|
24346
|
+
setTaskDetailProgress(url, e.loaded, e.total);
|
|
24347
|
+
}
|
|
24348
|
+
};
|
|
24349
|
+
xhr.open(config.method, url, true);
|
|
24350
|
+
xhr.withCredentials = config.credentials === "include";
|
|
24351
|
+
// @ts-ignore
|
|
24352
|
+
xhr.responseType = isImg ? "blob" : config.type;
|
|
24353
|
+
var headers = config.headers;
|
|
24354
|
+
if (headers) {
|
|
24355
|
+
Object.keys(headers).forEach(function(name1) {
|
|
24356
|
+
xhr.setRequestHeader(name1, headers[name1]);
|
|
24357
|
+
});
|
|
24358
|
+
}
|
|
24359
|
+
// @ts-ignore
|
|
24360
|
+
xhr.send(config.body);
|
|
24361
|
+
});
|
|
24362
|
+
}
|
|
24363
|
+
function getMimeTypeFromUrl(url) {
|
|
24364
|
+
var extname = url.substring(url.lastIndexOf(".") + 1);
|
|
24365
|
+
return mimeType[extname];
|
|
24366
|
+
}
|
|
24367
|
+
var MultiExecutor = /*#__PURE__*/ function() {
|
|
24368
|
+
var MultiExecutor = function MultiExecutor(execFunc, totalCount, interval) {
|
|
24369
|
+
this.execFunc = execFunc;
|
|
24370
|
+
this.totalCount = totalCount;
|
|
24371
|
+
this.interval = interval;
|
|
24372
|
+
this._timeoutId = -100;
|
|
24373
|
+
this._currentCount = 0;
|
|
24374
|
+
this.exec = this.exec.bind(this);
|
|
24375
|
+
};
|
|
24376
|
+
var _proto = MultiExecutor.prototype;
|
|
24377
|
+
_proto.start = function start() {
|
|
24378
|
+
this.exec();
|
|
24379
|
+
return this;
|
|
24380
|
+
};
|
|
24381
|
+
_proto.onComplete = function onComplete(func) {
|
|
24382
|
+
this._onComplete = func;
|
|
24383
|
+
return this;
|
|
24384
|
+
};
|
|
24385
|
+
_proto.onError = function onError(func) {
|
|
24386
|
+
this._onError = func;
|
|
24387
|
+
return this;
|
|
24388
|
+
};
|
|
24389
|
+
_proto.cancel = function cancel() {
|
|
24390
|
+
window.clearTimeout(this._timeoutId);
|
|
24391
|
+
};
|
|
24392
|
+
_proto.exec = function exec() {
|
|
24393
|
+
var _this = this;
|
|
24394
|
+
if (this._currentCount >= this.totalCount) {
|
|
24395
|
+
this._onError && this._onError(this._error);
|
|
24396
|
+
return;
|
|
24397
|
+
}
|
|
24398
|
+
this._currentCount++;
|
|
24399
|
+
this.execFunc(this._currentCount).then(function(result) {
|
|
24400
|
+
return _this._onComplete && _this._onComplete(result);
|
|
24401
|
+
}).catch(function(e) {
|
|
24402
|
+
_this._error = e;
|
|
24403
|
+
_this._timeoutId = window.setTimeout(_this.exec, _this.interval);
|
|
24404
|
+
});
|
|
24405
|
+
};
|
|
24406
|
+
return MultiExecutor;
|
|
24407
|
+
}();
|
|
24200
24408
|
/**
|
|
24201
24409
|
* ResourceManager
|
|
24202
24410
|
*/ var ResourceManager = /*#__PURE__*/ function() {
|
|
@@ -24291,6 +24499,23 @@
|
|
|
24291
24499
|
};
|
|
24292
24500
|
/**
|
|
24293
24501
|
* @internal
|
|
24502
|
+
*/ _proto._getRemoteUrl = function _getRemoteUrl(url) {
|
|
24503
|
+
var _this__virtualPathMap_url;
|
|
24504
|
+
return (_this__virtualPathMap_url = this._virtualPathMap[url]) != null ? _this__virtualPathMap_url : url;
|
|
24505
|
+
};
|
|
24506
|
+
/**
|
|
24507
|
+
* @internal
|
|
24508
|
+
*/ _proto._requestByRemoteUrl = function _requestByRemoteUrl(url, config) {
|
|
24509
|
+
return request(url, config);
|
|
24510
|
+
};
|
|
24511
|
+
/**
|
|
24512
|
+
* @internal
|
|
24513
|
+
*/ _proto._request = function _request(url, config) {
|
|
24514
|
+
var remoteUrl = this._getRemoteUrl(url);
|
|
24515
|
+
return this._requestByRemoteUrl(remoteUrl, config);
|
|
24516
|
+
};
|
|
24517
|
+
/**
|
|
24518
|
+
* @internal
|
|
24294
24519
|
*/ _proto._onSubAssetSuccess = function _onSubAssetSuccess(assetBaseURL, assetSubPath, value) {
|
|
24295
24520
|
var _this__subAssetPromiseCallbacks_remoteAssetBaseURL;
|
|
24296
24521
|
var _this__virtualPathMap_assetBaseURL;
|
|
@@ -28744,7 +28969,21 @@
|
|
|
28744
28969
|
mesh.uploadData(false);
|
|
28745
28970
|
};
|
|
28746
28971
|
_proto._initMesh = function _initMesh(engine) {
|
|
28747
|
-
this._mesh = this._createPlane(engine);
|
|
28972
|
+
var mesh = this._mesh = this._createPlane(engine);
|
|
28973
|
+
engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
28974
|
+
var _class = function _class() {
|
|
28975
|
+
return ContentRestorer.call(this, mesh);
|
|
28976
|
+
};
|
|
28977
|
+
_inherits$2(_class, ContentRestorer);
|
|
28978
|
+
var _proto = _class.prototype;
|
|
28979
|
+
_proto.restoreContent = function restoreContent() {
|
|
28980
|
+
mesh.setPositions(mesh.getPositions());
|
|
28981
|
+
mesh.setUVs(mesh.getUVs());
|
|
28982
|
+
mesh.setIndices(mesh.getIndices());
|
|
28983
|
+
mesh.uploadData(false);
|
|
28984
|
+
};
|
|
28985
|
+
return _class;
|
|
28986
|
+
}(ContentRestorer))());
|
|
28748
28987
|
this._mesh._addReferCount(1);
|
|
28749
28988
|
};
|
|
28750
28989
|
_proto._initMaterial = function _initMaterial(engine) {
|
|
@@ -30962,162 +31201,12 @@
|
|
|
30962
31201
|
__decorate$1([
|
|
30963
31202
|
ignoreClone
|
|
30964
31203
|
], Script.prototype, "_entityScriptsIndex", void 0);
|
|
30965
|
-
var mimeType = {
|
|
30966
|
-
json: "json",
|
|
30967
|
-
gltf: "json",
|
|
30968
|
-
mtl: "json",
|
|
30969
|
-
prefab: "json",
|
|
30970
|
-
txt: "text",
|
|
30971
|
-
bin: "arraybuffer",
|
|
30972
|
-
png: "image",
|
|
30973
|
-
webp: "image",
|
|
30974
|
-
jpg: "image"
|
|
30975
|
-
};
|
|
30976
|
-
var defaultRetryCount = 1;
|
|
30977
|
-
var defaultTimeout = Infinity;
|
|
30978
|
-
var defaultInterval = 500;
|
|
30979
|
-
/**
|
|
30980
|
-
* Web request.
|
|
30981
|
-
* @param url - The link
|
|
30982
|
-
* @param config - Load configuration
|
|
30983
|
-
*/ function request(url, config) {
|
|
30984
|
-
if (config === void 0) config = {};
|
|
30985
|
-
return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
30986
|
-
var _config_retryCount;
|
|
30987
|
-
var retryCount = (_config_retryCount = config.retryCount) != null ? _config_retryCount : defaultRetryCount;
|
|
30988
|
-
var _config_retryInterval;
|
|
30989
|
-
var retryInterval = (_config_retryInterval = config.retryInterval) != null ? _config_retryInterval : defaultInterval;
|
|
30990
|
-
var _config_timeout;
|
|
30991
|
-
config.timeout = (_config_timeout = config.timeout) != null ? _config_timeout : defaultTimeout;
|
|
30992
|
-
var _config_type;
|
|
30993
|
-
config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
|
|
30994
|
-
var executor = new MultiExecutor(function() {
|
|
30995
|
-
return requestRes(url, config).onProgress(setTaskCompleteProgress, setTaskDetailProgress);
|
|
30996
|
-
}, retryCount, retryInterval);
|
|
30997
|
-
executor.start().onError(reject).onComplete(resolve);
|
|
30998
|
-
});
|
|
30999
|
-
}
|
|
31000
|
-
function requestRes(url, config) {
|
|
31001
|
-
return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
31002
|
-
var xhr = new XMLHttpRequest();
|
|
31003
|
-
var isImg = config.type === "image";
|
|
31004
|
-
xhr.timeout = config.timeout;
|
|
31005
|
-
var _config_method;
|
|
31006
|
-
config.method = (_config_method = config.method) != null ? _config_method : "get";
|
|
31007
|
-
xhr.onload = function() {
|
|
31008
|
-
if (xhr.status < 200 || xhr.status >= 300) {
|
|
31009
|
-
reject(new Error("request failed from: " + url));
|
|
31010
|
-
return;
|
|
31011
|
-
}
|
|
31012
|
-
var _xhr_response;
|
|
31013
|
-
var result = (_xhr_response = xhr.response) != null ? _xhr_response : xhr.responseText;
|
|
31014
|
-
if (isImg) {
|
|
31015
|
-
var img = new Image();
|
|
31016
|
-
img.onload = function() {
|
|
31017
|
-
// Call requestAnimationFrame to avoid iOS's bug.
|
|
31018
|
-
requestAnimationFrame(function() {
|
|
31019
|
-
setTaskCompleteProgress(1, 1);
|
|
31020
|
-
//@ts-ignore
|
|
31021
|
-
resolve(img);
|
|
31022
|
-
img.onload = null;
|
|
31023
|
-
img.onerror = null;
|
|
31024
|
-
img.onabort = null;
|
|
31025
|
-
URL.revokeObjectURL(img.src);
|
|
31026
|
-
});
|
|
31027
|
-
};
|
|
31028
|
-
img.onerror = img.onabort = function() {
|
|
31029
|
-
reject(new Error("request " + img.src + " fail"));
|
|
31030
|
-
URL.revokeObjectURL(img.src);
|
|
31031
|
-
};
|
|
31032
|
-
img.crossOrigin = "anonymous";
|
|
31033
|
-
img.src = URL.createObjectURL(result);
|
|
31034
|
-
} else {
|
|
31035
|
-
setTaskCompleteProgress(1, 1);
|
|
31036
|
-
resolve(result);
|
|
31037
|
-
}
|
|
31038
|
-
};
|
|
31039
|
-
xhr.onerror = function() {
|
|
31040
|
-
reject(new Error("request failed from: " + url));
|
|
31041
|
-
};
|
|
31042
|
-
xhr.ontimeout = function() {
|
|
31043
|
-
reject(new Error("request timeout from: " + url));
|
|
31044
|
-
};
|
|
31045
|
-
xhr.onprogress = function(e) {
|
|
31046
|
-
if (e.lengthComputable) {
|
|
31047
|
-
setTaskDetailProgress(url, e.loaded, e.total);
|
|
31048
|
-
}
|
|
31049
|
-
};
|
|
31050
|
-
xhr.open(config.method, url, true);
|
|
31051
|
-
xhr.withCredentials = config.credentials === "include";
|
|
31052
|
-
// @ts-ignore
|
|
31053
|
-
xhr.responseType = isImg ? "blob" : config.type;
|
|
31054
|
-
var headers = config.headers;
|
|
31055
|
-
if (headers) {
|
|
31056
|
-
Object.keys(headers).forEach(function(name1) {
|
|
31057
|
-
xhr.setRequestHeader(name1, headers[name1]);
|
|
31058
|
-
});
|
|
31059
|
-
}
|
|
31060
|
-
// @ts-ignore
|
|
31061
|
-
xhr.send(config.body);
|
|
31062
|
-
});
|
|
31063
|
-
}
|
|
31064
|
-
function getMimeTypeFromUrl(url) {
|
|
31065
|
-
var extname = url.substring(url.lastIndexOf(".") + 1);
|
|
31066
|
-
return mimeType[extname];
|
|
31067
|
-
}
|
|
31068
|
-
var MultiExecutor = /*#__PURE__*/ function() {
|
|
31069
|
-
var MultiExecutor = function MultiExecutor(execFunc, totalCount, interval) {
|
|
31070
|
-
this.execFunc = execFunc;
|
|
31071
|
-
this.totalCount = totalCount;
|
|
31072
|
-
this.interval = interval;
|
|
31073
|
-
this._timeoutId = -100;
|
|
31074
|
-
this._currentCount = 0;
|
|
31075
|
-
this.exec = this.exec.bind(this);
|
|
31076
|
-
};
|
|
31077
|
-
var _proto = MultiExecutor.prototype;
|
|
31078
|
-
_proto.start = function start() {
|
|
31079
|
-
this.exec();
|
|
31080
|
-
return this;
|
|
31081
|
-
};
|
|
31082
|
-
_proto.onComplete = function onComplete(func) {
|
|
31083
|
-
this._onComplete = func;
|
|
31084
|
-
return this;
|
|
31085
|
-
};
|
|
31086
|
-
_proto.onError = function onError(func) {
|
|
31087
|
-
this._onError = func;
|
|
31088
|
-
return this;
|
|
31089
|
-
};
|
|
31090
|
-
_proto.cancel = function cancel() {
|
|
31091
|
-
window.clearTimeout(this._timeoutId);
|
|
31092
|
-
};
|
|
31093
|
-
_proto.exec = function exec() {
|
|
31094
|
-
var _this = this;
|
|
31095
|
-
if (this._currentCount >= this.totalCount) {
|
|
31096
|
-
this._onError && this._onError(this._error);
|
|
31097
|
-
return;
|
|
31098
|
-
}
|
|
31099
|
-
this._currentCount++;
|
|
31100
|
-
this.execFunc(this._currentCount).then(function(result) {
|
|
31101
|
-
return _this._onComplete && _this._onComplete(result);
|
|
31102
|
-
}).catch(function(e) {
|
|
31103
|
-
_this._error = e;
|
|
31104
|
-
_this._timeoutId = window.setTimeout(_this.exec, _this.interval);
|
|
31105
|
-
});
|
|
31106
|
-
};
|
|
31107
|
-
return MultiExecutor;
|
|
31108
|
-
}();
|
|
31109
31204
|
/**
|
|
31110
31205
|
* Loader abstract class.
|
|
31111
31206
|
*/ var Loader = /*#__PURE__*/ function() {
|
|
31112
31207
|
var Loader = function Loader(useCache) {
|
|
31113
31208
|
this.useCache = useCache;
|
|
31114
31209
|
};
|
|
31115
|
-
var _proto = Loader.prototype;
|
|
31116
|
-
_proto.request = function request1(url, resourceManager, config) {
|
|
31117
|
-
var _resourceManager__virtualPathMap_url;
|
|
31118
|
-
var remoteUrl = (_resourceManager__virtualPathMap_url = resourceManager._virtualPathMap[url]) != null ? _resourceManager__virtualPathMap_url : url;
|
|
31119
|
-
return request(remoteUrl, config);
|
|
31120
|
-
};
|
|
31121
31210
|
/**
|
|
31122
31211
|
* Register a class with a string name for serialization and deserialization.
|
|
31123
31212
|
* @param key - class name
|
|
@@ -34885,6 +34974,10 @@
|
|
|
34885
34974
|
if (!this._supportInstancedArrays) {
|
|
34886
34975
|
return;
|
|
34887
34976
|
}
|
|
34977
|
+
// Don't need to render when no particles
|
|
34978
|
+
if (!this.generator._getAliveParticleCount()) {
|
|
34979
|
+
return;
|
|
34980
|
+
}
|
|
34888
34981
|
Renderer1.prototype._prepareRender.call(this, context);
|
|
34889
34982
|
};
|
|
34890
34983
|
/**
|
|
@@ -36033,6 +36126,7 @@
|
|
|
36033
36126
|
/** Control how the Particle Generator applies its Transform component to the particles it emits. */ this.scalingMode = exports.ParticleScaleMode.Local;
|
|
36034
36127
|
/** If set to true, the Particle Generator automatically begins to play on startup. */ this.playOnEnabled = true;
|
|
36035
36128
|
/** @internal */ this._maxParticleBuffer = 1000;
|
|
36129
|
+
/** @internal */ this._startDelayRand = new Rand(0, ParticleRandomSubSeeds.StartDelay);
|
|
36036
36130
|
/** @internal */ this._startSpeedRand = new Rand(0, ParticleRandomSubSeeds.StartSpeed);
|
|
36037
36131
|
/** @internal */ this._startLifeTimeRand = new Rand(0, ParticleRandomSubSeeds.StartLifetime);
|
|
36038
36132
|
/** @internal */ this._startColorRand = new Rand(0, ParticleRandomSubSeeds.StartColor);
|
|
@@ -36317,6 +36411,9 @@
|
|
|
36317
36411
|
__decorate$1([
|
|
36318
36412
|
ignoreClone
|
|
36319
36413
|
], MainModule.prototype, "_maxParticleBuffer", void 0);
|
|
36414
|
+
__decorate$1([
|
|
36415
|
+
ignoreClone
|
|
36416
|
+
], MainModule.prototype, "_startDelayRand", void 0);
|
|
36320
36417
|
__decorate$1([
|
|
36321
36418
|
ignoreClone
|
|
36322
36419
|
], MainModule.prototype, "_startSpeedRand", void 0);
|
|
@@ -37155,6 +37252,7 @@
|
|
|
37155
37252
|
this._transformedBoundsCount = 0;
|
|
37156
37253
|
this._firstActiveTransformedBoundingBox = 0;
|
|
37157
37254
|
this._firstFreeTransformedBoundingBox = 0;
|
|
37255
|
+
this._playStartDelay = 0;
|
|
37158
37256
|
this._renderer = renderer;
|
|
37159
37257
|
var subPrimitive = new SubPrimitive();
|
|
37160
37258
|
subPrimitive.start = 0;
|
|
@@ -37183,6 +37281,7 @@
|
|
|
37183
37281
|
if (this.useAutoRandomSeed) {
|
|
37184
37282
|
this._resetGlobalRandSeed(Math.floor(Math.random() * 0xffffffff)); // 2^32 - 1
|
|
37185
37283
|
}
|
|
37284
|
+
this._playStartDelay = this.main.startDelay.evaluate(undefined, this.main._startDelayRand.random());
|
|
37186
37285
|
}
|
|
37187
37286
|
};
|
|
37188
37287
|
/**
|
|
@@ -37223,7 +37322,8 @@
|
|
|
37223
37322
|
*/ _proto._emit = function _emit(time, count) {
|
|
37224
37323
|
if (this.emission.enabled) {
|
|
37225
37324
|
// Wait the existing particles to be retired
|
|
37226
|
-
|
|
37325
|
+
var notRetireParticleCount = this._getNotRetiredParticleCount();
|
|
37326
|
+
if (notRetireParticleCount >= this.main.maxParticles) {
|
|
37227
37327
|
return;
|
|
37228
37328
|
}
|
|
37229
37329
|
var position = ParticleGenerator._tempVector30;
|
|
@@ -37252,7 +37352,18 @@
|
|
|
37252
37352
|
var _this = this, main = _this.main, emission = _this.emission;
|
|
37253
37353
|
var duration = main.duration;
|
|
37254
37354
|
var lastPlayTime = this._playTime;
|
|
37255
|
-
|
|
37355
|
+
var deltaTime = elapsedTime * main.simulationSpeed;
|
|
37356
|
+
// Process start delay time
|
|
37357
|
+
if (this._playStartDelay > 0) {
|
|
37358
|
+
var remainingDelay = this._playStartDelay -= deltaTime;
|
|
37359
|
+
if (remainingDelay < 0) {
|
|
37360
|
+
this._playTime -= remainingDelay;
|
|
37361
|
+
this._playStartDelay = 0;
|
|
37362
|
+
} else {
|
|
37363
|
+
return;
|
|
37364
|
+
}
|
|
37365
|
+
}
|
|
37366
|
+
this._playTime += deltaTime;
|
|
37256
37367
|
this._retireActiveParticles();
|
|
37257
37368
|
this._freeRetiredParticles();
|
|
37258
37369
|
if (main.simulationSpace === exports.ParticleSimulationSpace.World) {
|
|
@@ -38029,6 +38140,9 @@
|
|
|
38029
38140
|
__decorate$1([
|
|
38030
38141
|
ignoreClone
|
|
38031
38142
|
], ParticleGenerator.prototype, "_firstFreeTransformedBoundingBox", void 0);
|
|
38143
|
+
__decorate$1([
|
|
38144
|
+
ignoreClone
|
|
38145
|
+
], ParticleGenerator.prototype, "_playStartDelay", void 0);
|
|
38032
38146
|
/**
|
|
38033
38147
|
* Particle Material.
|
|
38034
38148
|
*/ var ParticleMaterial = /*#__PURE__*/ function(BaseMaterial1) {
|
|
@@ -42678,9 +42792,9 @@
|
|
|
42678
42792
|
_inherits(EditorTextureLoader, Loader1);
|
|
42679
42793
|
var _proto = EditorTextureLoader.prototype;
|
|
42680
42794
|
_proto.load = function load(item, resourceManager) {
|
|
42681
|
-
var _this = this;
|
|
42682
42795
|
return new AssetPromise(function(resolve, reject) {
|
|
42683
|
-
|
|
42796
|
+
resourceManager // @ts-ignore
|
|
42797
|
+
._request(item.url, _extends({}, item, {
|
|
42684
42798
|
type: "arraybuffer"
|
|
42685
42799
|
})).then(function(data) {
|
|
42686
42800
|
decode(data, resourceManager.engine).then(function(texture) {
|
|
@@ -42718,7 +42832,8 @@
|
|
|
42718
42832
|
_proto.load = function load(item, resourceManager) {
|
|
42719
42833
|
var _this = this;
|
|
42720
42834
|
return new AssetPromise(function(resolve, reject) {
|
|
42721
|
-
|
|
42835
|
+
resourceManager // @ts-ignore
|
|
42836
|
+
._request(item.url, _extends({}, item, {
|
|
42722
42837
|
type: "arraybuffer"
|
|
42723
42838
|
})).then(function(data) {
|
|
42724
42839
|
return decode(data, resourceManager.engine).then(function(clip) {
|
|
@@ -42769,7 +42884,8 @@
|
|
|
42769
42884
|
_proto.load = function load(item, resourceManager) {
|
|
42770
42885
|
var _this = this;
|
|
42771
42886
|
return new AssetPromise(function(resolve, reject) {
|
|
42772
|
-
|
|
42887
|
+
resourceManager // @ts-ignore
|
|
42888
|
+
._request(item.url, _extends({}, item, {
|
|
42773
42889
|
type: "json"
|
|
42774
42890
|
})).then(function(data) {
|
|
42775
42891
|
var animatorController = new AnimatorController(resourceManager.engine);
|
|
@@ -42884,7 +43000,8 @@
|
|
|
42884
43000
|
resolve(result.buffer);
|
|
42885
43001
|
});
|
|
42886
43002
|
}
|
|
42887
|
-
|
|
43003
|
+
// @ts-ignore
|
|
43004
|
+
return resourceManager._request(url, _extends({}, item, {
|
|
42888
43005
|
type: "arraybuffer"
|
|
42889
43006
|
}));
|
|
42890
43007
|
};
|
|
@@ -42903,9 +43020,9 @@
|
|
|
42903
43020
|
_inherits(EnvLoader, Loader1);
|
|
42904
43021
|
var _proto = EnvLoader.prototype;
|
|
42905
43022
|
_proto.load = function load(item, resourceManager) {
|
|
42906
|
-
var _this = this;
|
|
42907
43023
|
return new AssetPromise(function(resolve, reject) {
|
|
42908
|
-
|
|
43024
|
+
resourceManager // @ts-ignore
|
|
43025
|
+
._request(item.url, _extends({}, item, {
|
|
42909
43026
|
type: "arraybuffer"
|
|
42910
43027
|
})).then(function(arraybuffer) {
|
|
42911
43028
|
var _this;
|
|
@@ -42981,7 +43098,8 @@
|
|
|
42981
43098
|
_proto.load = function load(item, resourceManager) {
|
|
42982
43099
|
var _this = this;
|
|
42983
43100
|
return new AssetPromise(function(resolve, reject) {
|
|
42984
|
-
|
|
43101
|
+
resourceManager // @ts-ignore
|
|
43102
|
+
._request(item.url, _extends({}, item, {
|
|
42985
43103
|
type: "json"
|
|
42986
43104
|
})).then(function(data) {
|
|
42987
43105
|
var fontName = data.fontName, fontUrl = data.fontUrl;
|
|
@@ -43721,28 +43839,29 @@
|
|
|
43721
43839
|
BIN: 0x004e4942
|
|
43722
43840
|
};
|
|
43723
43841
|
var dataView = new DataView(originBuffer);
|
|
43724
|
-
//
|
|
43842
|
+
// Read header
|
|
43725
43843
|
var header = {
|
|
43726
43844
|
magic: dataView.getUint32(0, true),
|
|
43727
43845
|
version: dataView.getUint32(UINT32_LENGTH, true),
|
|
43728
43846
|
length: dataView.getUint32(2 * UINT32_LENGTH, true)
|
|
43729
43847
|
};
|
|
43848
|
+
// Return the original buffer if it is not a glb
|
|
43730
43849
|
if (header.magic !== GLB_HEADER_MAGIC) {
|
|
43731
43850
|
return {
|
|
43732
43851
|
originBuffer: originBuffer
|
|
43733
43852
|
};
|
|
43734
43853
|
}
|
|
43735
|
-
//
|
|
43854
|
+
// Read main data
|
|
43736
43855
|
var chunkLength = dataView.getUint32(GLB_HEADER_LENGTH, true);
|
|
43737
43856
|
var chunkType = dataView.getUint32(GLB_HEADER_LENGTH + UINT32_LENGTH, true);
|
|
43738
|
-
//
|
|
43857
|
+
// Read glTF json
|
|
43739
43858
|
if (chunkType !== GLB_CHUNK_TYPES.JSON) {
|
|
43740
43859
|
console.error("Invalid glb chunk type. Expected 0x4E4F534A, found 0x" + chunkType.toString(16));
|
|
43741
43860
|
return null;
|
|
43742
43861
|
}
|
|
43743
43862
|
var glTFData = new Uint8Array(originBuffer, GLB_HEADER_LENGTH + 2 * UINT32_LENGTH, chunkLength);
|
|
43744
43863
|
var glTF = JSON.parse(Utils.decodeText(glTFData));
|
|
43745
|
-
//
|
|
43864
|
+
// Read all buffers
|
|
43746
43865
|
var buffers = [];
|
|
43747
43866
|
var byteOffset = GLB_HEADER_LENGTH + 2 * UINT32_LENGTH + chunkLength;
|
|
43748
43867
|
var restoreGLBBufferSlice = context.contentRestorer.glbBufferSlices;
|
|
@@ -44623,9 +44742,9 @@
|
|
|
44623
44742
|
/**
|
|
44624
44743
|
* @internal
|
|
44625
44744
|
*/ _proto.load = function load(item, resourceManager) {
|
|
44626
|
-
var _this = this;
|
|
44627
44745
|
return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
44628
|
-
|
|
44746
|
+
resourceManager // @ts-ignore
|
|
44747
|
+
._request(item.url, {
|
|
44629
44748
|
type: "arraybuffer"
|
|
44630
44749
|
}).onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(buffer) {
|
|
44631
44750
|
return exports.KTX2Loader._parseBuffer(new Uint8Array(buffer), resourceManager.engine, item.params).then(function(param) {
|
|
@@ -45154,18 +45273,23 @@
|
|
|
45154
45273
|
_inherits(GLTFSchemaParser, GLTFParser1);
|
|
45155
45274
|
var _proto = GLTFSchemaParser.prototype;
|
|
45156
45275
|
_proto.parse = function parse(context) {
|
|
45157
|
-
var glTFResource = context.glTFResource, contentRestorer = context.contentRestorer;
|
|
45276
|
+
var glTFResource = context.glTFResource, contentRestorer = context.contentRestorer, resourceManager = context.resourceManager;
|
|
45158
45277
|
var url = glTFResource.url;
|
|
45159
45278
|
var restoreBufferRequests = contentRestorer.bufferRequests;
|
|
45160
45279
|
var requestConfig = {
|
|
45161
45280
|
type: "arraybuffer"
|
|
45162
45281
|
};
|
|
45163
|
-
var _context_resourceManager__virtualPathMap_url;
|
|
45164
45282
|
// @ts-ignore
|
|
45165
|
-
var remoteUrl =
|
|
45166
|
-
return
|
|
45167
|
-
|
|
45168
|
-
|
|
45283
|
+
var remoteUrl = resourceManager._getRemoteUrl(url);
|
|
45284
|
+
return resourceManager // @ts-ignore
|
|
45285
|
+
._requestByRemoteUrl(remoteUrl, requestConfig).onProgress(undefined, context._onTaskDetail).then(function(buffer) {
|
|
45286
|
+
var _parseResult;
|
|
45287
|
+
var parseResult = GLTFUtils.parseGLB(context, buffer);
|
|
45288
|
+
// If the buffer is a GLB file, we need to restore the buffer data
|
|
45289
|
+
if ((_parseResult = parseResult) == null ? void 0 : _parseResult.glTF) {
|
|
45290
|
+
restoreBufferRequests.push(new BufferRequestInfo(remoteUrl, requestConfig));
|
|
45291
|
+
}
|
|
45292
|
+
return parseResult;
|
|
45169
45293
|
}).then(function(result) {
|
|
45170
45294
|
var _result;
|
|
45171
45295
|
if ((_result = result) == null ? void 0 : _result.glTF) {
|
|
@@ -45388,18 +45512,18 @@
|
|
|
45388
45512
|
return context.buffers ? Promise.resolve(context.buffers[index]) : this._parseSingleBuffer(context, buffers[index]);
|
|
45389
45513
|
};
|
|
45390
45514
|
_proto._parseSingleBuffer = function _parseSingleBuffer(context, bufferInfo) {
|
|
45391
|
-
var glTFResource = context.glTFResource, contentRestorer = context.contentRestorer;
|
|
45515
|
+
var glTFResource = context.glTFResource, contentRestorer = context.contentRestorer, resourceManager = context.resourceManager;
|
|
45392
45516
|
var url = glTFResource.url;
|
|
45393
|
-
var _context_resourceManager__virtualPathMap_url;
|
|
45394
45517
|
// @ts-ignore
|
|
45395
|
-
var remoteUrl =
|
|
45518
|
+
var remoteUrl = resourceManager._getRemoteUrl(url);
|
|
45396
45519
|
var restoreBufferRequests = contentRestorer.bufferRequests;
|
|
45397
45520
|
var requestConfig = {
|
|
45398
45521
|
type: "arraybuffer"
|
|
45399
45522
|
};
|
|
45400
45523
|
var absoluteUrl = Utils.resolveAbsoluteUrl(remoteUrl, bufferInfo.uri);
|
|
45401
45524
|
restoreBufferRequests.push(new BufferRequestInfo(absoluteUrl, requestConfig));
|
|
45402
|
-
var promise =
|
|
45525
|
+
var promise = resourceManager // @ts-ignore
|
|
45526
|
+
._requestByRemoteUrl(absoluteUrl, requestConfig).onProgress(undefined, context._onTaskDetail);
|
|
45403
45527
|
context._addTaskCompletePromise(promise);
|
|
45404
45528
|
return promise;
|
|
45405
45529
|
};
|
|
@@ -46493,10 +46617,10 @@
|
|
|
46493
46617
|
_inherits(PrefabLoader, Loader1);
|
|
46494
46618
|
var _proto = PrefabLoader.prototype;
|
|
46495
46619
|
_proto.load = function load(item, resourceManager) {
|
|
46496
|
-
var _this = this;
|
|
46497
46620
|
var engine = resourceManager.engine;
|
|
46498
46621
|
return new AssetPromise(function(resolve, reject) {
|
|
46499
|
-
|
|
46622
|
+
resourceManager // @ts-ignore
|
|
46623
|
+
._request(item.url, _extends({}, item, {
|
|
46500
46624
|
type: "json"
|
|
46501
46625
|
})).then(function(data) {
|
|
46502
46626
|
PrefabParser.parse(engine, item.url, data).then(resolve).catch(reject);
|
|
@@ -46519,26 +46643,34 @@
|
|
|
46519
46643
|
_inherits(HDRLoader1, Loader1);
|
|
46520
46644
|
var _proto = HDRLoader1.prototype;
|
|
46521
46645
|
_proto.load = function load(item, resourceManager) {
|
|
46522
|
-
var _this = this;
|
|
46523
46646
|
return new AssetPromise(function(resolve, reject) {
|
|
46524
46647
|
var engine = resourceManager.engine;
|
|
46525
|
-
|
|
46648
|
+
var requestConfig = _extends({}, item, {
|
|
46526
46649
|
type: "arraybuffer"
|
|
46527
|
-
})
|
|
46528
|
-
|
|
46529
|
-
|
|
46530
|
-
var
|
|
46531
|
-
|
|
46532
|
-
var cubeMapData = HDRLoader._convertToCubemap(pixels, width, height, cubeSize);
|
|
46533
|
-
var texture = new TextureCube(engine, cubeSize);
|
|
46534
|
-
for(var faceIndex = 0; faceIndex < 6; faceIndex++){
|
|
46535
|
-
texture.setPixelBuffer(exports.TextureCubeFace.PositiveX + faceIndex, cubeMapData[faceIndex], 0);
|
|
46536
|
-
}
|
|
46537
|
-
texture.generateMipmaps();
|
|
46650
|
+
});
|
|
46651
|
+
resourceManager // @ts-ignore
|
|
46652
|
+
._request(item.url, requestConfig).then(function(buffer) {
|
|
46653
|
+
var texture = HDRLoader._setTextureByBuffer(engine, buffer);
|
|
46654
|
+
engine.resourceManager.addContentRestorer(new HDRContentRestorer(texture, item.url, requestConfig));
|
|
46538
46655
|
resolve(texture);
|
|
46539
46656
|
}).catch(reject);
|
|
46540
46657
|
});
|
|
46541
46658
|
};
|
|
46659
|
+
/**
|
|
46660
|
+
* @internal
|
|
46661
|
+
*/ HDRLoader1._setTextureByBuffer = function _setTextureByBuffer(engine, buffer, texture) {
|
|
46662
|
+
var bufferArray = new Uint8Array(buffer);
|
|
46663
|
+
var _HDRLoader__parseHeader = HDRLoader._parseHeader(bufferArray), width = _HDRLoader__parseHeader.width, height = _HDRLoader__parseHeader.height, dataPosition = _HDRLoader__parseHeader.dataPosition;
|
|
46664
|
+
var cubeSize = height >> 1;
|
|
46665
|
+
texture || (texture = new TextureCube(engine, cubeSize));
|
|
46666
|
+
var pixels = HDRLoader._readPixels(bufferArray.subarray(dataPosition), width, height);
|
|
46667
|
+
var cubeMapData = HDRLoader._convertToCubemap(pixels, width, height, cubeSize);
|
|
46668
|
+
for(var faceIndex = 0; faceIndex < 6; faceIndex++){
|
|
46669
|
+
texture.setPixelBuffer(exports.TextureCubeFace.PositiveX + faceIndex, cubeMapData[faceIndex], 0);
|
|
46670
|
+
}
|
|
46671
|
+
texture.generateMipmaps();
|
|
46672
|
+
return texture;
|
|
46673
|
+
};
|
|
46542
46674
|
HDRLoader1._convertToCubemap = function _convertToCubemap(pixels, inputWidth, inputHeight, size) {
|
|
46543
46675
|
if (!pixels) {
|
|
46544
46676
|
throw "ConvertPanoramaToCubemap: input cannot be null";
|
|
@@ -46830,6 +46962,29 @@
|
|
|
46830
46962
|
"hdr"
|
|
46831
46963
|
])
|
|
46832
46964
|
], HDRLoader);
|
|
46965
|
+
/**
|
|
46966
|
+
* @internal
|
|
46967
|
+
*/ var HDRContentRestorer = /*#__PURE__*/ function(ContentRestorer1) {
|
|
46968
|
+
var HDRContentRestorer = function HDRContentRestorer(resource, url, requestConfig) {
|
|
46969
|
+
var _this;
|
|
46970
|
+
_this = ContentRestorer1.call(this, resource) || this;
|
|
46971
|
+
_this.url = url;
|
|
46972
|
+
_this.requestConfig = requestConfig;
|
|
46973
|
+
return _this;
|
|
46974
|
+
};
|
|
46975
|
+
_inherits(HDRContentRestorer, ContentRestorer1);
|
|
46976
|
+
var _proto = HDRContentRestorer.prototype;
|
|
46977
|
+
_proto.restoreContent = function restoreContent() {
|
|
46978
|
+
var _this = this;
|
|
46979
|
+
return new AssetPromise(function(resolve, reject) {
|
|
46980
|
+
request(_this.url, _this.requestConfig).then(function(buffer) {
|
|
46981
|
+
HDRLoader._setTextureByBuffer(_this.resource.engine, buffer, _this.resource);
|
|
46982
|
+
resolve(_this.resource);
|
|
46983
|
+
}).catch(reject);
|
|
46984
|
+
});
|
|
46985
|
+
};
|
|
46986
|
+
return HDRContentRestorer;
|
|
46987
|
+
}(ContentRestorer);
|
|
46833
46988
|
var JSONLoader = /*#__PURE__*/ function(Loader1) {
|
|
46834
46989
|
var JSONLoader = function JSONLoader() {
|
|
46835
46990
|
return Loader1.apply(this, arguments);
|
|
@@ -46837,7 +46992,8 @@
|
|
|
46837
46992
|
_inherits(JSONLoader, Loader1);
|
|
46838
46993
|
var _proto = JSONLoader.prototype;
|
|
46839
46994
|
_proto.load = function load(item, resourceManager) {
|
|
46840
|
-
|
|
46995
|
+
// @ts-ignore
|
|
46996
|
+
return resourceManager._request(item.url, _extends({}, item, {
|
|
46841
46997
|
type: "json"
|
|
46842
46998
|
}));
|
|
46843
46999
|
};
|
|
@@ -47038,10 +47194,9 @@
|
|
|
47038
47194
|
_inherits(KTXCubeLoader, Loader1);
|
|
47039
47195
|
var _proto = KTXCubeLoader.prototype;
|
|
47040
47196
|
_proto.load = function load(item, resourceManager) {
|
|
47041
|
-
var _this = this;
|
|
47042
47197
|
return new AssetPromise(function(resolve, reject) {
|
|
47043
47198
|
Promise.all(item.urls.map(function(url) {
|
|
47044
|
-
return
|
|
47199
|
+
return resourceManager._request(url, _extends({}, item, {
|
|
47045
47200
|
type: "arraybuffer"
|
|
47046
47201
|
}));
|
|
47047
47202
|
})).then(function(data) {
|
|
@@ -47074,9 +47229,9 @@
|
|
|
47074
47229
|
_inherits(KTXLoader, Loader1);
|
|
47075
47230
|
var _proto = KTXLoader.prototype;
|
|
47076
47231
|
_proto.load = function load(item, resourceManager) {
|
|
47077
|
-
var _this = this;
|
|
47078
47232
|
return new AssetPromise(function(resolve, reject) {
|
|
47079
|
-
|
|
47233
|
+
resourceManager // @ts-ignore
|
|
47234
|
+
._request(item.url, _extends({}, item, {
|
|
47080
47235
|
type: "arraybuffer"
|
|
47081
47236
|
})).then(function(bin) {
|
|
47082
47237
|
var parsedData = parseSingleKTX(bin);
|
|
@@ -47118,7 +47273,8 @@
|
|
|
47118
47273
|
_proto.load = function load(item, resourceManager) {
|
|
47119
47274
|
var _this = this;
|
|
47120
47275
|
return new AssetPromise(function(resolve, reject) {
|
|
47121
|
-
|
|
47276
|
+
resourceManager // @ts-ignore
|
|
47277
|
+
._request(item.url, _extends({}, item, {
|
|
47122
47278
|
type: "json"
|
|
47123
47279
|
})).then(function(materialSchema) {
|
|
47124
47280
|
var engine = resourceManager.engine;
|
|
@@ -47200,9 +47356,9 @@
|
|
|
47200
47356
|
_inherits(MeshLoader, Loader1);
|
|
47201
47357
|
var _proto = MeshLoader.prototype;
|
|
47202
47358
|
_proto.load = function load(item, resourceManager) {
|
|
47203
|
-
var _this = this;
|
|
47204
47359
|
return new AssetPromise(function(resolve, reject) {
|
|
47205
|
-
|
|
47360
|
+
resourceManager // @ts-ignore
|
|
47361
|
+
._request(item.url, _extends({}, item, {
|
|
47206
47362
|
type: "arraybuffer"
|
|
47207
47363
|
})).then(function(data) {
|
|
47208
47364
|
return decode(data, resourceManager.engine);
|
|
@@ -47226,7 +47382,8 @@
|
|
|
47226
47382
|
var _proto = PrimitiveMeshLoader.prototype;
|
|
47227
47383
|
_proto.load = function load(item, resourceManager) {
|
|
47228
47384
|
var engine = resourceManager.engine;
|
|
47229
|
-
return
|
|
47385
|
+
return resourceManager // @ts-ignore
|
|
47386
|
+
._request(item.url, _extends({}, item, {
|
|
47230
47387
|
type: "json"
|
|
47231
47388
|
})).then(function(data) {
|
|
47232
47389
|
switch(data.type){
|
|
@@ -47271,10 +47428,10 @@
|
|
|
47271
47428
|
_inherits(ProjectLoader, Loader1);
|
|
47272
47429
|
var _proto = ProjectLoader.prototype;
|
|
47273
47430
|
_proto.load = function load(item, resourceManager) {
|
|
47274
|
-
var _this = this;
|
|
47275
47431
|
var engine = resourceManager.engine;
|
|
47276
47432
|
return new AssetPromise(function(resolve, reject) {
|
|
47277
|
-
|
|
47433
|
+
resourceManager // @ts-ignore
|
|
47434
|
+
._request(item.url, _extends({}, item, {
|
|
47278
47435
|
type: "json"
|
|
47279
47436
|
})).then(function(data) {
|
|
47280
47437
|
// @ts-ignore
|
|
@@ -47305,9 +47462,8 @@
|
|
|
47305
47462
|
_proto.load = function load(item, resourceManager) {
|
|
47306
47463
|
var _this = this;
|
|
47307
47464
|
return new AssetPromise(function(resolve, reject) {
|
|
47308
|
-
var _resourceManager__virtualPathMap_item_url;
|
|
47309
47465
|
// @ts-ignore
|
|
47310
|
-
var url =
|
|
47466
|
+
var url = resourceManager._getRemoteUrl(item.url);
|
|
47311
47467
|
_this._registerFont(url, url).then(function() {
|
|
47312
47468
|
var font = new Font(resourceManager.engine, url);
|
|
47313
47469
|
resolve(font);
|
|
@@ -47366,7 +47522,8 @@
|
|
|
47366
47522
|
chainPromises[i].cancel();
|
|
47367
47523
|
}
|
|
47368
47524
|
});
|
|
47369
|
-
|
|
47525
|
+
// @ts-ignore
|
|
47526
|
+
var configPromise = resourceManager._request(item.url, _extends({}, item, {
|
|
47370
47527
|
type: "json"
|
|
47371
47528
|
}));
|
|
47372
47529
|
chainPromises.push(configPromise);
|
|
@@ -47448,7 +47605,8 @@
|
|
|
47448
47605
|
var _proto = SpriteLoader.prototype;
|
|
47449
47606
|
_proto.load = function load(item, resourceManager) {
|
|
47450
47607
|
var _this = this;
|
|
47451
|
-
return
|
|
47608
|
+
return resourceManager // @ts-ignore
|
|
47609
|
+
._request(item.url, _extends({}, item, {
|
|
47452
47610
|
type: "json"
|
|
47453
47611
|
})).then(function(data) {
|
|
47454
47612
|
return data.belongToAtlas ? _this._loadFromAtlas(resourceManager, data) : _this._loadFromTexture(resourceManager, data);
|
|
@@ -47518,13 +47676,13 @@
|
|
|
47518
47676
|
_inherits(Texture2DLoader, Loader1);
|
|
47519
47677
|
var _proto = Texture2DLoader.prototype;
|
|
47520
47678
|
_proto.load = function load(item, resourceManager) {
|
|
47521
|
-
var _this = this;
|
|
47522
47679
|
return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
47523
47680
|
var url = item.url;
|
|
47524
47681
|
var requestConfig = _extends({}, item, {
|
|
47525
47682
|
type: "image"
|
|
47526
47683
|
});
|
|
47527
|
-
|
|
47684
|
+
resourceManager // @ts-ignore
|
|
47685
|
+
._request(url, requestConfig).onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(image) {
|
|
47528
47686
|
var _item_params;
|
|
47529
47687
|
var _ref = (_item_params = item.params) != null ? _item_params : {}, format = _ref.format, mipmap = _ref.mipmap, anisoLevel = _ref.anisoLevel, wrapModeU = _ref.wrapModeU, wrapModeV = _ref.wrapModeV, filterMode = _ref.filterMode;
|
|
47530
47688
|
var texture = new Texture2D(resourceManager.engine, image.width, image.height, format, mipmap);
|
|
@@ -47593,14 +47751,14 @@
|
|
|
47593
47751
|
_inherits(TextureCubeLoader, Loader1);
|
|
47594
47752
|
var _proto = TextureCubeLoader.prototype;
|
|
47595
47753
|
_proto.load = function load(item, resourceManager) {
|
|
47596
|
-
var _this = this;
|
|
47597
47754
|
return new AssetPromise(function(resolve, reject) {
|
|
47598
47755
|
var urls = item.urls;
|
|
47599
47756
|
var requestConfig = _extends({}, item, {
|
|
47600
47757
|
type: "image"
|
|
47601
47758
|
});
|
|
47759
|
+
// @ts-ignore
|
|
47602
47760
|
Promise.all(urls.map(function(url) {
|
|
47603
|
-
return
|
|
47761
|
+
return resourceManager._request(url, requestConfig);
|
|
47604
47762
|
})).then(function(images) {
|
|
47605
47763
|
var _images_ = images[0], width = _images_.width, height = _images_.height;
|
|
47606
47764
|
if (width !== height) {
|
|
@@ -47635,7 +47793,8 @@
|
|
|
47635
47793
|
var _proto = ShaderChunkLoader1.prototype;
|
|
47636
47794
|
_proto.load = function load(item, resourceManager) {
|
|
47637
47795
|
var url = item.url;
|
|
47638
|
-
|
|
47796
|
+
// @ts-ignore
|
|
47797
|
+
return resourceManager._request(url, _extends({}, item, {
|
|
47639
47798
|
type: "text"
|
|
47640
47799
|
})).then(function(code) {
|
|
47641
47800
|
ShaderFactory.registerInclude(url.substring(1), code);
|
|
@@ -47680,7 +47839,8 @@
|
|
|
47680
47839
|
_proto.load = function load(item, resourceManager) {
|
|
47681
47840
|
var _this = this;
|
|
47682
47841
|
var url = item.url;
|
|
47683
|
-
|
|
47842
|
+
// @ts-ignore
|
|
47843
|
+
return resourceManager._request(url, _extends({}, item, {
|
|
47684
47844
|
type: "text"
|
|
47685
47845
|
})).then(function(code) {
|
|
47686
47846
|
var builtinShader = _this._getBuiltinShader(code);
|
|
@@ -47716,10 +47876,10 @@
|
|
|
47716
47876
|
_inherits(SceneLoader, Loader1);
|
|
47717
47877
|
var _proto = SceneLoader.prototype;
|
|
47718
47878
|
_proto.load = function load(item, resourceManager) {
|
|
47719
|
-
var _this = this;
|
|
47720
47879
|
var engine = resourceManager.engine;
|
|
47721
47880
|
return new AssetPromise(function(resolve, reject) {
|
|
47722
|
-
|
|
47881
|
+
resourceManager // @ts-ignore
|
|
47882
|
+
._request(item.url, _extends({}, item, {
|
|
47723
47883
|
type: "json"
|
|
47724
47884
|
})).then(function(data) {
|
|
47725
47885
|
return SceneParser.parse(engine, data).then(function(scene) {
|
|
@@ -48268,7 +48428,7 @@
|
|
|
48268
48428
|
], EXT_texture_webp);
|
|
48269
48429
|
|
|
48270
48430
|
//@ts-ignore
|
|
48271
|
-
var version = "1.3.
|
|
48431
|
+
var version = "1.3.21";
|
|
48272
48432
|
console.log("Galacean engine version: " + version);
|
|
48273
48433
|
for(var key in CoreObjects){
|
|
48274
48434
|
Loader.registerClass(key, CoreObjects[key]);
|