|
@@ -5808,6 +5808,22 @@ var BABYLON;
|
|
return LoadFileError;
|
|
return LoadFileError;
|
|
}(Error));
|
|
}(Error));
|
|
BABYLON.LoadFileError = LoadFileError;
|
|
BABYLON.LoadFileError = LoadFileError;
|
|
|
|
+ var RetryStrategy = /** @class */ (function () {
|
|
|
|
+ function RetryStrategy() {
|
|
|
|
+ }
|
|
|
|
+ RetryStrategy.ExponentialBackoff = function (maxRetries, baseInterval) {
|
|
|
|
+ if (maxRetries === void 0) { maxRetries = 3; }
|
|
|
|
+ if (baseInterval === void 0) { baseInterval = 500; }
|
|
|
|
+ return function (url, request, retryIndex) {
|
|
|
|
+ if (request.status !== 0 || retryIndex >= maxRetries || url.indexOf("file:") !== -1) {
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ return Math.pow(2, retryIndex) * baseInterval;
|
|
|
|
+ };
|
|
|
|
+ };
|
|
|
|
+ return RetryStrategy;
|
|
|
|
+ }());
|
|
|
|
+ BABYLON.RetryStrategy = RetryStrategy;
|
|
// Screenshots
|
|
// Screenshots
|
|
var screenshotCanvas;
|
|
var screenshotCanvas;
|
|
var cloneValue = function (source, destinationObject) {
|
|
var cloneValue = function (source, destinationObject) {
|
|
@@ -6198,11 +6214,13 @@ var BABYLON;
|
|
}
|
|
}
|
|
return img;
|
|
return img;
|
|
};
|
|
};
|
|
- Tools.LoadFile = function (url, callback, progressCallBack, database, useArrayBuffer, onError) {
|
|
|
|
|
|
+ Tools.LoadFile = function (url, callback, progressCallBack, database, useArrayBuffer, onError, onRetry, retryStrategy) {
|
|
|
|
+ if (retryStrategy === void 0) { retryStrategy = null; }
|
|
url = Tools.CleanUrl(url);
|
|
url = Tools.CleanUrl(url);
|
|
url = Tools.PreprocessUrl(url);
|
|
url = Tools.PreprocessUrl(url);
|
|
var request = null;
|
|
var request = null;
|
|
- var noIndexedDB = function () {
|
|
|
|
|
|
+ var noIndexedDB = function (retryIndex) {
|
|
|
|
+ var oldRequest = request;
|
|
request = new XMLHttpRequest();
|
|
request = new XMLHttpRequest();
|
|
var loadUrl = Tools.BaseUrl + url;
|
|
var loadUrl = Tools.BaseUrl + url;
|
|
request.open('GET', loadUrl, true);
|
|
request.open('GET', loadUrl, true);
|
|
@@ -6219,19 +6237,29 @@ var BABYLON;
|
|
req.onreadystatechange = function () { }; //some browsers have issues where onreadystatechange can be called multiple times with the same value
|
|
req.onreadystatechange = function () { }; //some browsers have issues where onreadystatechange can be called multiple times with the same value
|
|
if (req.status >= 200 && req.status < 300 || (!Tools.IsWindowObjectExist() && (req.status === 0))) {
|
|
if (req.status >= 200 && req.status < 300 || (!Tools.IsWindowObjectExist() && (req.status === 0))) {
|
|
callback(!useArrayBuffer ? req.responseText : req.response, req.responseURL);
|
|
callback(!useArrayBuffer ? req.responseText : req.response, req.responseURL);
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- else {
|
|
|
|
- var e = new LoadFileError("Error status: " + req.status + " - Unable to load " + loadUrl, req);
|
|
|
|
- if (onError) {
|
|
|
|
- onError(req, e);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- throw e;
|
|
|
|
|
|
+ retryStrategy = retryStrategy || Tools.DefaultRetryStrategy;
|
|
|
|
+ if (retryStrategy) {
|
|
|
|
+ var waitTime = retryStrategy(loadUrl, req, retryIndex || 0);
|
|
|
|
+ if (waitTime !== -1) {
|
|
|
|
+ setTimeout(function () { return noIndexedDB((retryIndex || 0) + 1); }, waitTime);
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ var e = new Error("Error status: " + req.status + " - Unable to load " + loadUrl);
|
|
|
|
+ if (onError) {
|
|
|
|
+ onError(req, e);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ throw e;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- request.send(null);
|
|
|
|
|
|
+ request.send();
|
|
|
|
+ if (oldRequest && onRetry) {
|
|
|
|
+ onRetry(oldRequest, request);
|
|
|
|
+ }
|
|
};
|
|
};
|
|
var loadFromIndexedDB = function () {
|
|
var loadFromIndexedDB = function () {
|
|
if (database) {
|
|
if (database) {
|
|
@@ -6962,6 +6990,7 @@ var BABYLON;
|
|
return hash;
|
|
return hash;
|
|
};
|
|
};
|
|
Tools.BaseUrl = "";
|
|
Tools.BaseUrl = "";
|
|
|
|
+ Tools.DefaultRetryStrategy = RetryStrategy.ExponentialBackoff();
|
|
/**
|
|
/**
|
|
* Default behaviour for cors in the application.
|
|
* Default behaviour for cors in the application.
|
|
* It can be a string if the expected behavior is identical in the entire app.
|
|
* It can be a string if the expected behavior is identical in the entire app.
|
|
@@ -45846,6 +45875,13 @@ var BABYLON;
|
|
serializationObject.blendMode = this.blendMode;
|
|
serializationObject.blendMode = this.blendMode;
|
|
serializationObject.customShader = this.customShader;
|
|
serializationObject.customShader = this.customShader;
|
|
serializationObject.preventAutoStart = this.preventAutoStart;
|
|
serializationObject.preventAutoStart = this.preventAutoStart;
|
|
|
|
+ serializationObject.startSpriteCellID = this.startSpriteCellID;
|
|
|
|
+ serializationObject.endSpriteCellID = this.endSpriteCellID;
|
|
|
|
+ serializationObject.spriteCellLoop = this.spriteCellLoop;
|
|
|
|
+ serializationObject.spriteCellChangeSpeed = this.spriteCellChangeSpeed;
|
|
|
|
+ serializationObject.spriteCellWidth = this.spriteCellWidth;
|
|
|
|
+ serializationObject.spriteCellHeight = this.spriteCellHeight;
|
|
|
|
+ serializationObject.isAnimationSheetEnabled = this._isAnimationSheetEnabled;
|
|
return serializationObject;
|
|
return serializationObject;
|
|
};
|
|
};
|
|
ParticleSystem.Parse = function (parsedParticleSystem, scene, rootUrl) {
|
|
ParticleSystem.Parse = function (parsedParticleSystem, scene, rootUrl) {
|
|
@@ -45857,7 +45893,7 @@ var BABYLON;
|
|
var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
|
|
var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
|
|
custom = scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
|
|
custom = scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
|
|
}
|
|
}
|
|
- var particleSystem = new ParticleSystem(name, parsedParticleSystem.capacity, scene, custom);
|
|
|
|
|
|
+ var particleSystem = new ParticleSystem(name, parsedParticleSystem.capacity, scene, custom, parsedParticleSystem.isAnimationSheetEnabled);
|
|
particleSystem.customShader = program;
|
|
particleSystem.customShader = program;
|
|
if (parsedParticleSystem.id) {
|
|
if (parsedParticleSystem.id) {
|
|
particleSystem.id = parsedParticleSystem.id;
|
|
particleSystem.id = parsedParticleSystem.id;
|
|
@@ -45910,6 +45946,12 @@ var BABYLON;
|
|
particleSystem.targetStopDuration = parsedParticleSystem.targetStopDuration;
|
|
particleSystem.targetStopDuration = parsedParticleSystem.targetStopDuration;
|
|
particleSystem.textureMask = BABYLON.Color4.FromArray(parsedParticleSystem.textureMask);
|
|
particleSystem.textureMask = BABYLON.Color4.FromArray(parsedParticleSystem.textureMask);
|
|
particleSystem.blendMode = parsedParticleSystem.blendMode;
|
|
particleSystem.blendMode = parsedParticleSystem.blendMode;
|
|
|
|
+ particleSystem.startSpriteCellID = parsedParticleSystem.startSpriteCellID;
|
|
|
|
+ particleSystem.endSpriteCellID = parsedParticleSystem.endSpriteCellID;
|
|
|
|
+ particleSystem.spriteCellLoop = parsedParticleSystem.spriteCellLoop;
|
|
|
|
+ particleSystem.spriteCellChangeSpeed = parsedParticleSystem.spriteCellChangeSpeed;
|
|
|
|
+ particleSystem.spriteCellWidth = parsedParticleSystem.spriteCellWidth;
|
|
|
|
+ particleSystem.spriteCellHeight = parsedParticleSystem.spriteCellHeight;
|
|
if (!particleSystem.preventAutoStart) {
|
|
if (!particleSystem.preventAutoStart) {
|
|
particleSystem.start();
|
|
particleSystem.start();
|
|
}
|
|
}
|
|
@@ -53582,6 +53624,9 @@ var BABYLON;
|
|
SceneLoader.GetPluginForExtension = function (extension) {
|
|
SceneLoader.GetPluginForExtension = function (extension) {
|
|
return SceneLoader._getPluginForExtension(extension).plugin;
|
|
return SceneLoader._getPluginForExtension(extension).plugin;
|
|
};
|
|
};
|
|
|
|
+ SceneLoader.IsPluginForExtensionAvailable = function (extension) {
|
|
|
|
+ return !!SceneLoader._registeredPlugins[extension];
|
|
|
|
+ };
|
|
SceneLoader.RegisterPlugin = function (plugin) {
|
|
SceneLoader.RegisterPlugin = function (plugin) {
|
|
if (typeof plugin.extensions === "string") {
|
|
if (typeof plugin.extensions === "string") {
|
|
var extension = plugin.extensions;
|
|
var extension = plugin.extensions;
|
|
@@ -57828,7 +57873,7 @@ var BABYLON;
|
|
var path;
|
|
var path;
|
|
var filename;
|
|
var filename;
|
|
// Checking if GLB loader is present
|
|
// Checking if GLB loader is present
|
|
- if (BABYLON.SceneLoader.GetPluginForExtension("glb")) {
|
|
|
|
|
|
+ if (BABYLON.SceneLoader.IsPluginForExtensionAvailable("glb")) {
|
|
// Determine the device specific folder based on the ID suffix
|
|
// Determine the device specific folder based on the ID suffix
|
|
var device = 'default';
|
|
var device = 'default';
|
|
if (this.id && !forceDefault) {
|
|
if (this.id && !forceDefault) {
|
|
@@ -60381,6 +60426,9 @@ var BABYLON;
|
|
], StandardRenderingPipeline.prototype, "motionStrength", void 0);
|
|
], StandardRenderingPipeline.prototype, "motionStrength", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serialize()
|
|
BABYLON.serialize()
|
|
|
|
+ ], StandardRenderingPipeline.prototype, "_ratio", void 0);
|
|
|
|
+ __decorate([
|
|
|
|
+ BABYLON.serialize()
|
|
], StandardRenderingPipeline.prototype, "BloomEnabled", null);
|
|
], StandardRenderingPipeline.prototype, "BloomEnabled", null);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serialize()
|
|
BABYLON.serialize()
|
|
@@ -60885,7 +60933,7 @@ var BABYLON;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// Culling
|
|
// Culling
|
|
- engine.setState(material.backFaceCulling);
|
|
|
|
|
|
+ engine.setState(material.backFaceCulling, 0, false, scene.useRightHandedSystem);
|
|
// Managing instances
|
|
// Managing instances
|
|
var batch = mesh._getInstancesRenderList(subMesh._id);
|
|
var batch = mesh._getInstancesRenderList(subMesh._id);
|
|
if (batch.mustReturn) {
|
|
if (batch.mustReturn) {
|
|
@@ -79675,9 +79723,11 @@ var BABYLON;
|
|
this._groundMaterial.dispose();
|
|
this._groundMaterial.dispose();
|
|
this._groundMaterial = null;
|
|
this._groundMaterial = null;
|
|
}
|
|
}
|
|
- if (this._options.groundTexture && !newOptions.groundTexture && this._groundTexture) {
|
|
|
|
- this._groundTexture.dispose();
|
|
|
|
- this._groundTexture = null;
|
|
|
|
|
|
+ if (this._groundTexture) {
|
|
|
|
+ if (this._options.groundTexture != newOptions.groundTexture) {
|
|
|
|
+ this._groundTexture.dispose();
|
|
|
|
+ this._groundTexture = null;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (this._skybox && !newOptions.createSkybox) {
|
|
if (this._skybox && !newOptions.createSkybox) {
|
|
this._skybox.dispose();
|
|
this._skybox.dispose();
|
|
@@ -79687,16 +79737,20 @@ var BABYLON;
|
|
this._skyboxMaterial.dispose();
|
|
this._skyboxMaterial.dispose();
|
|
this._skyboxMaterial = null;
|
|
this._skyboxMaterial = null;
|
|
}
|
|
}
|
|
- if (this._options.skyboxTexture && !newOptions.skyboxTexture && this._skyboxTexture) {
|
|
|
|
- this._skyboxTexture.dispose();
|
|
|
|
- this._skyboxTexture = null;
|
|
|
|
|
|
+ if (this._skyboxTexture) {
|
|
|
|
+ if (this._options.skyboxTexture != newOptions.skyboxTexture) {
|
|
|
|
+ this._skyboxTexture.dispose();
|
|
|
|
+ this._skyboxTexture = null;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (this._groundMirror && !newOptions.enableGroundMirror) {
|
|
if (this._groundMirror && !newOptions.enableGroundMirror) {
|
|
this._groundMirror.dispose();
|
|
this._groundMirror.dispose();
|
|
this._groundMirror = null;
|
|
this._groundMirror = null;
|
|
}
|
|
}
|
|
- if (this._options.environmentTexture && !newOptions.environmentTexture && this._scene.environmentTexture) {
|
|
|
|
- this._scene.environmentTexture.dispose();
|
|
|
|
|
|
+ if (this._scene.environmentTexture) {
|
|
|
|
+ if (this._options.environmentTexture != newOptions.environmentTexture) {
|
|
|
|
+ this._scene.environmentTexture.dispose();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
this._options = newOptions;
|
|
this._options = newOptions;
|
|
this._setupBackground();
|
|
this._setupBackground();
|
|
@@ -82703,14 +82757,6 @@ var BABYLON;
|
|
this._loaderPendingCount = 0;
|
|
this._loaderPendingCount = 0;
|
|
this._loaderTrackers = new Array();
|
|
this._loaderTrackers = new Array();
|
|
this._parent = parent;
|
|
this._parent = parent;
|
|
- if (!GLTFLoader._progressEventFactory) {
|
|
|
|
- if (typeof window["ProgressEvent"] === "function") {
|
|
|
|
- GLTFLoader._progressEventFactory = GLTFLoader._createProgressEventByConstructor;
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- GLTFLoader._progressEventFactory = GLTFLoader._createProgressEventByDocument;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
GLTFLoader.RegisterExtension = function (extension) {
|
|
GLTFLoader.RegisterExtension = function (extension) {
|
|
if (GLTFLoader.Extensions[extension.name]) {
|
|
if (GLTFLoader.Extensions[extension.name]) {
|
|
@@ -82721,14 +82767,6 @@ var BABYLON;
|
|
// Keep the order of registration so that extensions registered first are called first.
|
|
// Keep the order of registration so that extensions registered first are called first.
|
|
GLTF2.GLTFLoaderExtension._Extensions.push(extension);
|
|
GLTF2.GLTFLoaderExtension._Extensions.push(extension);
|
|
};
|
|
};
|
|
- GLTFLoader._createProgressEventByConstructor = function (name, data) {
|
|
|
|
- return new ProgressEvent(name, data);
|
|
|
|
- };
|
|
|
|
- GLTFLoader._createProgressEventByDocument = function (name, data) {
|
|
|
|
- var event = document.createEvent("ProgressEvent");
|
|
|
|
- event.initProgressEvent(name, false, false, data.lengthComputable, data.loaded, data.total);
|
|
|
|
- return event;
|
|
|
|
- };
|
|
|
|
GLTFLoader.prototype.dispose = function () {
|
|
GLTFLoader.prototype.dispose = function () {
|
|
if (this._disposed) {
|
|
if (this._disposed) {
|
|
return;
|
|
return;
|
|
@@ -82781,21 +82819,19 @@ var BABYLON;
|
|
if (!this._progressCallback) {
|
|
if (!this._progressCallback) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ var lengthComputable = true;
|
|
var loaded = 0;
|
|
var loaded = 0;
|
|
var total = 0;
|
|
var total = 0;
|
|
for (var _i = 0, _a = this._requests; _i < _a.length; _i++) {
|
|
for (var _i = 0, _a = this._requests; _i < _a.length; _i++) {
|
|
var request = _a[_i];
|
|
var request = _a[_i];
|
|
- if (!request._loaded || !request._total) {
|
|
|
|
|
|
+ if (request._lengthComputable === undefined || request._loaded === undefined || request._total === undefined) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ lengthComputable = lengthComputable && request._lengthComputable;
|
|
loaded += request._loaded;
|
|
loaded += request._loaded;
|
|
total += request._total;
|
|
total += request._total;
|
|
}
|
|
}
|
|
- this._progressCallback(GLTFLoader._progressEventFactory("GLTFLoaderProgress", {
|
|
|
|
- lengthComputable: true,
|
|
|
|
- loaded: loaded,
|
|
|
|
- total: total
|
|
|
|
- }));
|
|
|
|
|
|
+ this._progressCallback(GLTFLoader._createProgressEvent(lengthComputable, loaded, lengthComputable ? total : 0));
|
|
};
|
|
};
|
|
GLTFLoader.prototype._executeWhenRenderReady = function (func) {
|
|
GLTFLoader.prototype._executeWhenRenderReady = function (func) {
|
|
if (this._renderReady) {
|
|
if (this._renderReady) {
|
|
@@ -84083,6 +84119,7 @@ var BABYLON;
|
|
}, function (event) {
|
|
}, function (event) {
|
|
_this._tryCatchOnError(function () {
|
|
_this._tryCatchOnError(function () {
|
|
if (request && !_this._renderReady) {
|
|
if (request && !_this._renderReady) {
|
|
|
|
+ request._lengthComputable = event.lengthComputable;
|
|
request._loaded = event.loaded;
|
|
request._loaded = event.loaded;
|
|
request._total = event.total;
|
|
request._total = event.total;
|
|
_this._onProgress();
|
|
_this._onProgress();
|
|
@@ -84092,10 +84129,10 @@ var BABYLON;
|
|
_this._tryCatchOnError(function () {
|
|
_this._tryCatchOnError(function () {
|
|
throw new BABYLON.LoadFileError(context + ": Failed to load '" + uri + "'" + (request ? ": " + request.status + " " + request.statusText : ""), request);
|
|
throw new BABYLON.LoadFileError(context + ": Failed to load '" + uri + "'" + (request ? ": " + request.status + " " + request.statusText : ""), request);
|
|
});
|
|
});
|
|
|
|
+ }, function (oldRequest, newRequest) {
|
|
|
|
+ _this._requests.splice(_this._requests.indexOf(oldRequest), 1, newRequest);
|
|
});
|
|
});
|
|
if (request) {
|
|
if (request) {
|
|
- request._loaded = null;
|
|
|
|
- request._total = null;
|
|
|
|
this._requests.push(request);
|
|
this._requests.push(request);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -84280,6 +84317,20 @@ var BABYLON;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
GLTFLoader.Extensions = {};
|
|
GLTFLoader.Extensions = {};
|
|
|
|
+ // IE 11 Compatibility.
|
|
|
|
+ GLTFLoader._createProgressEvent = (typeof window["ProgressEvent"] === "function")
|
|
|
|
+ ? function (lengthComputable, loaded, total) {
|
|
|
|
+ return new ProgressEvent("GLTFLoaderProgress", {
|
|
|
|
+ lengthComputable: lengthComputable,
|
|
|
|
+ loaded: loaded,
|
|
|
|
+ total: total
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ : function (lengthComputable, loaded, total) {
|
|
|
|
+ var event = document.createEvent("ProgressEvent");
|
|
|
|
+ event.initProgressEvent("GLTFLoaderProgress", false, false, lengthComputable, loaded, total);
|
|
|
|
+ return event;
|
|
|
|
+ };
|
|
return GLTFLoader;
|
|
return GLTFLoader;
|
|
}());
|
|
}());
|
|
GLTF2.GLTFLoader = GLTFLoader;
|
|
GLTF2.GLTFLoader = GLTFLoader;
|