|
@@ -66360,9 +66360,9 @@ var BABYLON;
|
|
|
* @param scene The scene the texture will be used in
|
|
|
* @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
|
|
|
* @param noMipmap Forces to not generate the mipmap if true
|
|
|
- * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
|
|
|
+ * @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process
|
|
|
* @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
|
|
|
- * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
|
|
|
+ * @param usePMREMGenerator Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
|
|
|
*/
|
|
|
function HDRCubeTexture(url, scene, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator, onLoad, onError) {
|
|
|
if (noMipmap === void 0) { noMipmap = false; }
|
|
@@ -78300,16 +78300,68 @@ var BABYLON;
|
|
|
var AbstractAssetTask = /** @class */ (function () {
|
|
|
/**
|
|
|
* Creates a new {BABYLON.AssetsManager}
|
|
|
- * @param name define the name of the task
|
|
|
+ * @param name defines the name of the task
|
|
|
*/
|
|
|
- function AbstractAssetTask(name) {
|
|
|
+ function AbstractAssetTask(
|
|
|
+ /**
|
|
|
+ * Task name
|
|
|
+ */ name) {
|
|
|
this.name = name;
|
|
|
- this.isCompleted = false;
|
|
|
- this.taskState = AssetTaskState.INIT;
|
|
|
+ this._isCompleted = false;
|
|
|
+ this._taskState = AssetTaskState.INIT;
|
|
|
}
|
|
|
+ Object.defineProperty(AbstractAssetTask.prototype, "isCompleted", {
|
|
|
+ /**
|
|
|
+ * Get if the task is completed
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._isCompleted;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ Object.defineProperty(AbstractAssetTask.prototype, "taskState", {
|
|
|
+ /**
|
|
|
+ * Gets the current state of the task
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._taskState;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ Object.defineProperty(AbstractAssetTask.prototype, "errorObject", {
|
|
|
+ /**
|
|
|
+ * Gets the current error object (if task is in error)
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._errorObject;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ AbstractAssetTask.prototype._setErrorObject = function (message, exception) {
|
|
|
+ if (this._errorObject) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this._errorObject = {
|
|
|
+ message: message,
|
|
|
+ exception: exception
|
|
|
+ };
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Execute the current task
|
|
|
+ * @param scene defines the scene where you want your assets to be loaded
|
|
|
+ * @param onSuccess is a callback called when the task is successfully executed
|
|
|
+ * @param onError is a callback called if an error occurs
|
|
|
+ */
|
|
|
AbstractAssetTask.prototype.run = function (scene, onSuccess, onError) {
|
|
|
var _this = this;
|
|
|
- this.taskState = AssetTaskState.RUNNING;
|
|
|
+ this._taskState = AssetTaskState.RUNNING;
|
|
|
this.runTask(scene, function () {
|
|
|
_this.onDoneCallback(onSuccess, onError);
|
|
|
}, function (msg, exception) {
|
|
@@ -78326,8 +78378,8 @@ var BABYLON;
|
|
|
throw new Error("runTask is not implemented");
|
|
|
};
|
|
|
AbstractAssetTask.prototype.onErrorCallback = function (onError, message, exception) {
|
|
|
- this.taskState = AssetTaskState.ERROR;
|
|
|
- this.errorObject = {
|
|
|
+ this._taskState = AssetTaskState.ERROR;
|
|
|
+ this._errorObject = {
|
|
|
message: message,
|
|
|
exception: exception
|
|
|
};
|
|
@@ -78338,8 +78390,8 @@ var BABYLON;
|
|
|
};
|
|
|
AbstractAssetTask.prototype.onDoneCallback = function (onSuccess, onError) {
|
|
|
try {
|
|
|
- this.taskState = AssetTaskState.DONE;
|
|
|
- this.isCompleted = true;
|
|
|
+ this._taskState = AssetTaskState.DONE;
|
|
|
+ this._isCompleted = true;
|
|
|
if (this.onSuccess) {
|
|
|
this.onSuccess(this);
|
|
|
}
|
|
@@ -78356,6 +78408,12 @@ var BABYLON;
|
|
|
* Class used to share progress information about assets loading
|
|
|
*/
|
|
|
var AssetsProgressEvent = /** @class */ (function () {
|
|
|
+ /**
|
|
|
+ * Creates a {BABYLON.AssetsProgressEvent}
|
|
|
+ * @param remainingCount defines the number of remaining tasks to process
|
|
|
+ * @param totalCount defines the total number of tasks
|
|
|
+ * @param task defines the task that was just processed
|
|
|
+ */
|
|
|
function AssetsProgressEvent(remainingCount, totalCount, task) {
|
|
|
this.remainingCount = remainingCount;
|
|
|
this.totalCount = totalCount;
|
|
@@ -78369,7 +78427,30 @@ var BABYLON;
|
|
|
*/
|
|
|
var MeshAssetTask = /** @class */ (function (_super) {
|
|
|
__extends(MeshAssetTask, _super);
|
|
|
- function MeshAssetTask(name, meshesNames, rootUrl, sceneFilename) {
|
|
|
+ /**
|
|
|
+ * Creates a new {BABYLON.MeshAssetTask}
|
|
|
+ * @param name defines the name of the task
|
|
|
+ * @param meshesNames defines the list of mesh's names you want to load
|
|
|
+ * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
|
|
|
+ * @param sceneFilename defines the filename of the scene to load from
|
|
|
+ */
|
|
|
+ function MeshAssetTask(
|
|
|
+ /**
|
|
|
+ * Defines the name of the task
|
|
|
+ */
|
|
|
+ name,
|
|
|
+ /**
|
|
|
+ * Defines the list of mesh's names you want to load
|
|
|
+ */
|
|
|
+ meshesNames,
|
|
|
+ /**
|
|
|
+ * Defines the root url to use as a base to load your meshes and associated resources
|
|
|
+ */
|
|
|
+ rootUrl,
|
|
|
+ /**
|
|
|
+ * Defines the filename of the scene to load from
|
|
|
+ */
|
|
|
+ sceneFilename) {
|
|
|
var _this = _super.call(this, name) || this;
|
|
|
_this.name = name;
|
|
|
_this.meshesNames = meshesNames;
|
|
@@ -78377,6 +78458,12 @@ var BABYLON;
|
|
|
_this.sceneFilename = sceneFilename;
|
|
|
return _this;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Execute the current task
|
|
|
+ * @param scene defines the scene where you want your assets to be loaded
|
|
|
+ * @param onSuccess is a callback called when the task is successfully executed
|
|
|
+ * @param onError is a callback called if an error occurs
|
|
|
+ */
|
|
|
MeshAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
|
|
|
var _this = this;
|
|
|
BABYLON.SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene, function (meshes, particleSystems, skeletons) {
|
|
@@ -78396,12 +78483,31 @@ var BABYLON;
|
|
|
*/
|
|
|
var TextFileAssetTask = /** @class */ (function (_super) {
|
|
|
__extends(TextFileAssetTask, _super);
|
|
|
- function TextFileAssetTask(name, url) {
|
|
|
+ /**
|
|
|
+ * Creates a new TextFileAssetTask object
|
|
|
+ * @param name defines the name of the task
|
|
|
+ * @param url defines the location of the file to load
|
|
|
+ */
|
|
|
+ function TextFileAssetTask(
|
|
|
+ /**
|
|
|
+ * Defines the name of the task
|
|
|
+ */
|
|
|
+ name,
|
|
|
+ /**
|
|
|
+ * Defines the location of the file to load
|
|
|
+ */
|
|
|
+ url) {
|
|
|
var _this = _super.call(this, name) || this;
|
|
|
_this.name = name;
|
|
|
_this.url = url;
|
|
|
return _this;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Execute the current task
|
|
|
+ * @param scene defines the scene where you want your assets to be loaded
|
|
|
+ * @param onSuccess is a callback called when the task is successfully executed
|
|
|
+ * @param onError is a callback called if an error occurs
|
|
|
+ */
|
|
|
TextFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
|
|
|
var _this = this;
|
|
|
scene._loadFile(this.url, function (data) {
|
|
@@ -78421,12 +78527,31 @@ var BABYLON;
|
|
|
*/
|
|
|
var BinaryFileAssetTask = /** @class */ (function (_super) {
|
|
|
__extends(BinaryFileAssetTask, _super);
|
|
|
- function BinaryFileAssetTask(name, url) {
|
|
|
+ /**
|
|
|
+ * Creates a new BinaryFileAssetTask object
|
|
|
+ * @param name defines the name of the new task
|
|
|
+ * @param url defines the location of the file to load
|
|
|
+ */
|
|
|
+ function BinaryFileAssetTask(
|
|
|
+ /**
|
|
|
+ * Defines the name of the task
|
|
|
+ */
|
|
|
+ name,
|
|
|
+ /**
|
|
|
+ * Defines the location of the file to load
|
|
|
+ */
|
|
|
+ url) {
|
|
|
var _this = _super.call(this, name) || this;
|
|
|
_this.name = name;
|
|
|
_this.url = url;
|
|
|
return _this;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Execute the current task
|
|
|
+ * @param scene defines the scene where you want your assets to be loaded
|
|
|
+ * @param onSuccess is a callback called when the task is successfully executed
|
|
|
+ * @param onError is a callback called if an error occurs
|
|
|
+ */
|
|
|
BinaryFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
|
|
|
var _this = this;
|
|
|
scene._loadFile(this.url, function (data) {
|
|
@@ -78446,12 +78571,31 @@ var BABYLON;
|
|
|
*/
|
|
|
var ImageAssetTask = /** @class */ (function (_super) {
|
|
|
__extends(ImageAssetTask, _super);
|
|
|
- function ImageAssetTask(name, url) {
|
|
|
+ /**
|
|
|
+ * Creates a new ImageAssetTask
|
|
|
+ * @param name defines the name of the task
|
|
|
+ * @param url defines the location of the image to load
|
|
|
+ */
|
|
|
+ function ImageAssetTask(
|
|
|
+ /**
|
|
|
+ * Defines the name of the task
|
|
|
+ */
|
|
|
+ name,
|
|
|
+ /**
|
|
|
+ * Defines the location of the image to load
|
|
|
+ */
|
|
|
+ url) {
|
|
|
var _this = _super.call(this, name) || this;
|
|
|
_this.name = name;
|
|
|
_this.url = url;
|
|
|
return _this;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Execute the current task
|
|
|
+ * @param scene defines the scene where you want your assets to be loaded
|
|
|
+ * @param onSuccess is a callback called when the task is successfully executed
|
|
|
+ * @param onError is a callback called if an error occurs
|
|
|
+ */
|
|
|
ImageAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
|
|
|
var _this = this;
|
|
|
var img = new Image();
|
|
@@ -78473,7 +78617,35 @@ var BABYLON;
|
|
|
*/
|
|
|
var TextureAssetTask = /** @class */ (function (_super) {
|
|
|
__extends(TextureAssetTask, _super);
|
|
|
- function TextureAssetTask(name, url, noMipmap, invertY, samplingMode) {
|
|
|
+ /**
|
|
|
+ * Creates a new TextureAssetTask object
|
|
|
+ * @param name defines the name of the task
|
|
|
+ * @param url defines the location of the file to load
|
|
|
+ * @param noMipmap defines if mipmap should not be generated (default is false)
|
|
|
+ * @param invertY defines if texture must be inverted on Y axis (default is false)
|
|
|
+ * @param samplingMode defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
|
|
|
+ */
|
|
|
+ function TextureAssetTask(
|
|
|
+ /**
|
|
|
+ * Defines the name of the task
|
|
|
+ */
|
|
|
+ name,
|
|
|
+ /**
|
|
|
+ * Defines the location of the file to load
|
|
|
+ */
|
|
|
+ url,
|
|
|
+ /**
|
|
|
+ * Defines if mipmap should not be generated (default is false)
|
|
|
+ */
|
|
|
+ noMipmap,
|
|
|
+ /**
|
|
|
+ * Defines if texture must be inverted on Y axis (default is false)
|
|
|
+ */
|
|
|
+ invertY,
|
|
|
+ /**
|
|
|
+ * Defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
|
|
|
+ */
|
|
|
+ samplingMode) {
|
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
|
var _this = _super.call(this, name) || this;
|
|
|
_this.name = name;
|
|
@@ -78483,6 +78655,12 @@ var BABYLON;
|
|
|
_this.samplingMode = samplingMode;
|
|
|
return _this;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Execute the current task
|
|
|
+ * @param scene defines the scene where you want your assets to be loaded
|
|
|
+ * @param onSuccess is a callback called when the task is successfully executed
|
|
|
+ * @param onError is a callback called if an error occurs
|
|
|
+ */
|
|
|
TextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
|
|
|
var onload = function () {
|
|
|
onSuccess();
|
|
@@ -78500,7 +78678,35 @@ var BABYLON;
|
|
|
*/
|
|
|
var CubeTextureAssetTask = /** @class */ (function (_super) {
|
|
|
__extends(CubeTextureAssetTask, _super);
|
|
|
- function CubeTextureAssetTask(name, url, extensions, noMipmap, files) {
|
|
|
+ /**
|
|
|
+ * Creates a new CubeTextureAssetTask
|
|
|
+ * @param name defines the name of the task
|
|
|
+ * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
|
|
|
+ * @param extensions defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
|
|
|
+ * @param noMipmap defines if mipmaps should not be generated (default is false)
|
|
|
+ * @param files defines the explicit list of files (undefined by default)
|
|
|
+ */
|
|
|
+ function CubeTextureAssetTask(
|
|
|
+ /**
|
|
|
+ * Defines the name of the task
|
|
|
+ */
|
|
|
+ name,
|
|
|
+ /**
|
|
|
+ * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
|
|
|
+ */
|
|
|
+ url,
|
|
|
+ /**
|
|
|
+ * Defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
|
|
|
+ */
|
|
|
+ extensions,
|
|
|
+ /**
|
|
|
+ * Defines if mipmaps should not be generated (default is false)
|
|
|
+ */
|
|
|
+ noMipmap,
|
|
|
+ /**
|
|
|
+ * Defines the explicit list of files (undefined by default)
|
|
|
+ */
|
|
|
+ files) {
|
|
|
var _this = _super.call(this, name) || this;
|
|
|
_this.name = name;
|
|
|
_this.url = url;
|
|
@@ -78509,6 +78715,12 @@ var BABYLON;
|
|
|
_this.files = files;
|
|
|
return _this;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Execute the current task
|
|
|
+ * @param scene defines the scene where you want your assets to be loaded
|
|
|
+ * @param onSuccess is a callback called when the task is successfully executed
|
|
|
+ * @param onError is a callback called if an error occurs
|
|
|
+ */
|
|
|
CubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
|
|
|
var onload = function () {
|
|
|
onSuccess();
|
|
@@ -78526,7 +78738,45 @@ var BABYLON;
|
|
|
*/
|
|
|
var HDRCubeTextureAssetTask = /** @class */ (function (_super) {
|
|
|
__extends(HDRCubeTextureAssetTask, _super);
|
|
|
- function HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
|
|
|
+ /**
|
|
|
+ * Creates a new HDRCubeTextureAssetTask object
|
|
|
+ * @param name defines the name of the task
|
|
|
+ * @param url defines the location of the file to load
|
|
|
+ * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
|
|
|
+ * @param noMipmap defines if mipmaps should not be generated (default is false)
|
|
|
+ * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
|
|
|
+ * @param useInGammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
|
|
|
+ * @param usePMREMGenerator specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
|
|
|
+ */
|
|
|
+ function HDRCubeTextureAssetTask(
|
|
|
+ /**
|
|
|
+ * Defines the name of the task
|
|
|
+ */
|
|
|
+ name,
|
|
|
+ /**
|
|
|
+ * Defines the location of the file to load
|
|
|
+ */
|
|
|
+ url,
|
|
|
+ /**
|
|
|
+ * Defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
|
|
|
+ */
|
|
|
+ size,
|
|
|
+ /**
|
|
|
+ * Defines if mipmaps should not be generated (default is false)
|
|
|
+ */
|
|
|
+ noMipmap,
|
|
|
+ /**
|
|
|
+ * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
|
|
|
+ */
|
|
|
+ generateHarmonics,
|
|
|
+ /**
|
|
|
+ * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
|
|
|
+ */
|
|
|
+ useInGammaSpace,
|
|
|
+ /**
|
|
|
+ * Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
|
|
|
+ */
|
|
|
+ usePMREMGenerator) {
|
|
|
if (noMipmap === void 0) { noMipmap = false; }
|
|
|
if (generateHarmonics === void 0) { generateHarmonics = true; }
|
|
|
if (useInGammaSpace === void 0) { useInGammaSpace = false; }
|
|
@@ -78541,6 +78791,12 @@ var BABYLON;
|
|
|
_this.usePMREMGenerator = usePMREMGenerator;
|
|
|
return _this;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Execute the current task
|
|
|
+ * @param scene defines the scene where you want your assets to be loaded
|
|
|
+ * @param onSuccess is a callback called when the task is successfully executed
|
|
|
+ * @param onError is a callback called if an error occurs
|
|
|
+ */
|
|
|
HDRCubeTextureAssetTask.prototype.run = function (scene, onSuccess, onError) {
|
|
|
var onload = function () {
|
|
|
onSuccess();
|
|
@@ -78558,12 +78814,15 @@ var BABYLON;
|
|
|
* @see http://doc.babylonjs.com/how_to/how_to_use_assetsmanager
|
|
|
*/
|
|
|
var AssetsManager = /** @class */ (function () {
|
|
|
+ /**
|
|
|
+ * Creates a new AssetsManager
|
|
|
+ * @param scene defines the scene to work on
|
|
|
+ */
|
|
|
function AssetsManager(scene) {
|
|
|
this._isLoading = false;
|
|
|
- this.tasks = new Array();
|
|
|
- this.waitingTasksCount = 0;
|
|
|
- this.totalTasksCount = 0;
|
|
|
- //Observables
|
|
|
+ this._tasks = new Array();
|
|
|
+ this._waitingTasksCount = 0;
|
|
|
+ this._totalTasksCount = 0;
|
|
|
/**
|
|
|
* Observable called when all tasks are processed
|
|
|
*/
|
|
@@ -78593,40 +78852,44 @@ var BABYLON;
|
|
|
* @param meshesNames defines the name of meshes to load
|
|
|
* @param rootUrl defines the root url to use to locate files
|
|
|
* @param sceneFilename defines the filename of the scene file
|
|
|
+ * @returns a new {BABYLON.MeshAssetTask} object
|
|
|
*/
|
|
|
AssetsManager.prototype.addMeshTask = function (taskName, meshesNames, rootUrl, sceneFilename) {
|
|
|
var task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);
|
|
|
- this.tasks.push(task);
|
|
|
+ this._tasks.push(task);
|
|
|
return task;
|
|
|
};
|
|
|
/**
|
|
|
* Add a {BABYLON.TextFileAssetTask} to the list of active tasks
|
|
|
* @param taskName defines the name of the new task
|
|
|
* @param url defines the url of the file to load
|
|
|
+ * @returns a new {BABYLON.TextFileAssetTask} object
|
|
|
*/
|
|
|
AssetsManager.prototype.addTextFileTask = function (taskName, url) {
|
|
|
var task = new TextFileAssetTask(taskName, url);
|
|
|
- this.tasks.push(task);
|
|
|
+ this._tasks.push(task);
|
|
|
return task;
|
|
|
};
|
|
|
/**
|
|
|
* Add a {BABYLON.BinaryFileAssetTask} to the list of active tasks
|
|
|
* @param taskName defines the name of the new task
|
|
|
* @param url defines the url of the file to load
|
|
|
+ * @returns a new {BABYLON.BinaryFileAssetTask} object
|
|
|
*/
|
|
|
AssetsManager.prototype.addBinaryFileTask = function (taskName, url) {
|
|
|
var task = new BinaryFileAssetTask(taskName, url);
|
|
|
- this.tasks.push(task);
|
|
|
+ this._tasks.push(task);
|
|
|
return task;
|
|
|
};
|
|
|
/**
|
|
|
* Add a {BABYLON.ImageAssetTask} to the list of active tasks
|
|
|
* @param taskName defines the name of the new task
|
|
|
* @param url defines the url of the file to load
|
|
|
+ * @returns a new {BABYLON.ImageAssetTask} object
|
|
|
*/
|
|
|
AssetsManager.prototype.addImageTask = function (taskName, url) {
|
|
|
var task = new ImageAssetTask(taskName, url);
|
|
|
- this.tasks.push(task);
|
|
|
+ this._tasks.push(task);
|
|
|
return task;
|
|
|
};
|
|
|
/**
|
|
@@ -78636,11 +78899,12 @@ var BABYLON;
|
|
|
* @param noMipmap defines if the texture must not receive mipmaps (false by default)
|
|
|
* @param invertY defines if you want to invert Y axis of the loaded texture (false by default)
|
|
|
* @param samplingMode defines the sampling mode to use (BABYLON.Texture.TRILINEAR_SAMPLINGMODE by default)
|
|
|
+ * @returns a new {BABYLON.TextureAssetTask} object
|
|
|
*/
|
|
|
AssetsManager.prototype.addTextureTask = function (taskName, url, noMipmap, invertY, samplingMode) {
|
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
|
var task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);
|
|
|
- this.tasks.push(task);
|
|
|
+ this._tasks.push(task);
|
|
|
return task;
|
|
|
};
|
|
|
/**
|
|
@@ -78650,10 +78914,11 @@ var BABYLON;
|
|
|
* @param extensions defines the extension to use to load the cube map (can be null)
|
|
|
* @param noMipmap defines if the texture must not receive mipmaps (false by default)
|
|
|
* @param files defines the list of files to load (can be null)
|
|
|
+ * @returns a new {BABYLON.CubeTextureAssetTask} object
|
|
|
*/
|
|
|
AssetsManager.prototype.addCubeTextureTask = function (taskName, url, extensions, noMipmap, files) {
|
|
|
var task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files);
|
|
|
- this.tasks.push(task);
|
|
|
+ this._tasks.push(task);
|
|
|
return task;
|
|
|
};
|
|
|
/**
|
|
@@ -78666,6 +78931,7 @@ var BABYLON;
|
|
|
* @param generateHarmonics defines if you want to automatically generate (true by default)
|
|
|
* @param useInGammaSpace defines if the texture must be considered in gamma space (false by default)
|
|
|
* @param usePMREMGenerator is a reserved parameter and must be set to false or ignored
|
|
|
+ * @returns a new {BABYLON.HDRCubeTextureAssetTask} object
|
|
|
*/
|
|
|
AssetsManager.prototype.addHDRCubeTextureTask = function (taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
|
|
|
if (noMipmap === void 0) { noMipmap = false; }
|
|
@@ -78673,37 +78939,37 @@ var BABYLON;
|
|
|
if (useInGammaSpace === void 0) { useInGammaSpace = false; }
|
|
|
if (usePMREMGenerator === void 0) { usePMREMGenerator = false; }
|
|
|
var task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
|
|
|
- this.tasks.push(task);
|
|
|
+ this._tasks.push(task);
|
|
|
return task;
|
|
|
};
|
|
|
AssetsManager.prototype._decreaseWaitingTasksCount = function (task) {
|
|
|
var _this = this;
|
|
|
- this.waitingTasksCount--;
|
|
|
+ this._waitingTasksCount--;
|
|
|
try {
|
|
|
if (task.taskState === AssetTaskState.DONE) {
|
|
|
// Let's remove successfull tasks
|
|
|
BABYLON.Tools.SetImmediate(function () {
|
|
|
- var index = _this.tasks.indexOf(task);
|
|
|
+ var index = _this._tasks.indexOf(task);
|
|
|
if (index > -1) {
|
|
|
- _this.tasks.splice(index, 1);
|
|
|
+ _this._tasks.splice(index, 1);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
if (this.onProgress) {
|
|
|
- this.onProgress(this.waitingTasksCount, this.totalTasksCount, task);
|
|
|
+ this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);
|
|
|
}
|
|
|
- this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this.waitingTasksCount, this.totalTasksCount, task));
|
|
|
+ this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));
|
|
|
}
|
|
|
catch (e) {
|
|
|
BABYLON.Tools.Error("Error running progress callbacks.");
|
|
|
console.log(e);
|
|
|
}
|
|
|
- if (this.waitingTasksCount === 0) {
|
|
|
+ if (this._waitingTasksCount === 0) {
|
|
|
try {
|
|
|
if (this.onFinish) {
|
|
|
- this.onFinish(this.tasks);
|
|
|
+ this.onFinish(this._tasks);
|
|
|
}
|
|
|
- this.onTasksDoneObservable.notifyObservers(this.tasks);
|
|
|
+ this.onTasksDoneObservable.notifyObservers(this._tasks);
|
|
|
}
|
|
|
catch (e) {
|
|
|
BABYLON.Tools.Error("Error running tasks-done callbacks.");
|
|
@@ -78728,10 +78994,7 @@ var BABYLON;
|
|
|
}
|
|
|
};
|
|
|
var error = function (message, exception) {
|
|
|
- task.errorObject = task.errorObject || {
|
|
|
- message: message,
|
|
|
- exception: exception
|
|
|
- };
|
|
|
+ task._setErrorObject(message, exception);
|
|
|
if (_this.onTaskError) {
|
|
|
_this.onTaskError(task);
|
|
|
}
|
|
@@ -78746,7 +79009,7 @@ var BABYLON;
|
|
|
*/
|
|
|
AssetsManager.prototype.reset = function () {
|
|
|
this._isLoading = false;
|
|
|
- this.tasks = new Array();
|
|
|
+ this._tasks = new Array();
|
|
|
return this;
|
|
|
};
|
|
|
/**
|
|
@@ -78758,20 +79021,20 @@ var BABYLON;
|
|
|
return this;
|
|
|
}
|
|
|
this._isLoading = true;
|
|
|
- this.waitingTasksCount = this.tasks.length;
|
|
|
- this.totalTasksCount = this.tasks.length;
|
|
|
- if (this.waitingTasksCount === 0) {
|
|
|
+ this._waitingTasksCount = this._tasks.length;
|
|
|
+ this._totalTasksCount = this._tasks.length;
|
|
|
+ if (this._waitingTasksCount === 0) {
|
|
|
if (this.onFinish) {
|
|
|
- this.onFinish(this.tasks);
|
|
|
+ this.onFinish(this._tasks);
|
|
|
}
|
|
|
- this.onTasksDoneObservable.notifyObservers(this.tasks);
|
|
|
+ this.onTasksDoneObservable.notifyObservers(this._tasks);
|
|
|
return this;
|
|
|
}
|
|
|
if (this.useDefaultLoadingScreen) {
|
|
|
this._scene.getEngine().displayLoadingUI();
|
|
|
}
|
|
|
- for (var index = 0; index < this.tasks.length; index++) {
|
|
|
- var task = this.tasks[index];
|
|
|
+ for (var index = 0; index < this._tasks.length; index++) {
|
|
|
+ var task = this._tasks[index];
|
|
|
this._runTask(task);
|
|
|
}
|
|
|
return this;
|