|
@@ -76847,6 +76847,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
this._scene = scene || BABYLON.Engine.LastCreatedScene;
|
|
this._scene = scene || BABYLON.Engine.LastCreatedScene;
|
|
this._sceneDisposeObserver = this._scene.onDisposeObservable.add(function () {
|
|
this._sceneDisposeObserver = this._scene.onDisposeObservable.add(function () {
|
|
|
|
+ _this._sceneDisposeObserver = null;
|
|
_this.dispose();
|
|
_this.dispose();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -78117,14 +78118,36 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
|
|
+ /**
|
|
|
|
+ * Defines the list of states available for a task inside a {BABYLON.AssetsManager}
|
|
|
|
+ */
|
|
var AssetTaskState;
|
|
var AssetTaskState;
|
|
(function (AssetTaskState) {
|
|
(function (AssetTaskState) {
|
|
|
|
+ /**
|
|
|
|
+ * Initialization
|
|
|
|
+ */
|
|
AssetTaskState[AssetTaskState["INIT"] = 0] = "INIT";
|
|
AssetTaskState[AssetTaskState["INIT"] = 0] = "INIT";
|
|
|
|
+ /**
|
|
|
|
+ * Running
|
|
|
|
+ */
|
|
AssetTaskState[AssetTaskState["RUNNING"] = 1] = "RUNNING";
|
|
AssetTaskState[AssetTaskState["RUNNING"] = 1] = "RUNNING";
|
|
|
|
+ /**
|
|
|
|
+ * Done
|
|
|
|
+ */
|
|
AssetTaskState[AssetTaskState["DONE"] = 2] = "DONE";
|
|
AssetTaskState[AssetTaskState["DONE"] = 2] = "DONE";
|
|
|
|
+ /**
|
|
|
|
+ * Error
|
|
|
|
+ */
|
|
AssetTaskState[AssetTaskState["ERROR"] = 3] = "ERROR";
|
|
AssetTaskState[AssetTaskState["ERROR"] = 3] = "ERROR";
|
|
})(AssetTaskState = BABYLON.AssetTaskState || (BABYLON.AssetTaskState = {}));
|
|
})(AssetTaskState = BABYLON.AssetTaskState || (BABYLON.AssetTaskState = {}));
|
|
|
|
+ /**
|
|
|
|
+ * Define an abstract asset task used with a {BABYLON.AssetsManager} class to load assets into a scene
|
|
|
|
+ */
|
|
var AbstractAssetTask = /** @class */ (function () {
|
|
var AbstractAssetTask = /** @class */ (function () {
|
|
|
|
+ /**
|
|
|
|
+ * Creates a new {BABYLON.AssetsManager}
|
|
|
|
+ * @param name define the name of the task
|
|
|
|
+ */
|
|
function AbstractAssetTask(name) {
|
|
function AbstractAssetTask(name) {
|
|
this.name = name;
|
|
this.name = name;
|
|
this.isCompleted = false;
|
|
this.isCompleted = false;
|
|
@@ -78139,6 +78162,12 @@ var BABYLON;
|
|
_this.onErrorCallback(onError, msg, exception);
|
|
_this.onErrorCallback(onError, msg, 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.runTask = function (scene, onSuccess, onError) {
|
|
AbstractAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
|
|
throw new Error("runTask is not implemented");
|
|
throw new Error("runTask is not implemented");
|
|
};
|
|
};
|
|
@@ -78169,7 +78198,16 @@ var BABYLON;
|
|
return AbstractAssetTask;
|
|
return AbstractAssetTask;
|
|
}());
|
|
}());
|
|
BABYLON.AbstractAssetTask = AbstractAssetTask;
|
|
BABYLON.AbstractAssetTask = AbstractAssetTask;
|
|
|
|
+ /**
|
|
|
|
+ * Class used to share progress information about assets loading
|
|
|
|
+ */
|
|
var AssetsProgressEvent = /** @class */ (function () {
|
|
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) {
|
|
function AssetsProgressEvent(remainingCount, totalCount, task) {
|
|
this.remainingCount = remainingCount;
|
|
this.remainingCount = remainingCount;
|
|
this.totalCount = totalCount;
|
|
this.totalCount = totalCount;
|
|
@@ -78178,6 +78216,9 @@ var BABYLON;
|
|
return AssetsProgressEvent;
|
|
return AssetsProgressEvent;
|
|
}());
|
|
}());
|
|
BABYLON.AssetsProgressEvent = AssetsProgressEvent;
|
|
BABYLON.AssetsProgressEvent = AssetsProgressEvent;
|
|
|
|
+ /**
|
|
|
|
+ * Define a task used by {BABYLON.AssetsManager} to load meshes
|
|
|
|
+ */
|
|
var MeshAssetTask = /** @class */ (function (_super) {
|
|
var MeshAssetTask = /** @class */ (function (_super) {
|
|
__extends(MeshAssetTask, _super);
|
|
__extends(MeshAssetTask, _super);
|
|
function MeshAssetTask(name, meshesNames, rootUrl, sceneFilename) {
|
|
function MeshAssetTask(name, meshesNames, rootUrl, sceneFilename) {
|
|
@@ -78202,6 +78243,9 @@ var BABYLON;
|
|
return MeshAssetTask;
|
|
return MeshAssetTask;
|
|
}(AbstractAssetTask));
|
|
}(AbstractAssetTask));
|
|
BABYLON.MeshAssetTask = MeshAssetTask;
|
|
BABYLON.MeshAssetTask = MeshAssetTask;
|
|
|
|
+ /**
|
|
|
|
+ * Define a task used by {BABYLON.AssetsManager} to load text content
|
|
|
|
+ */
|
|
var TextFileAssetTask = /** @class */ (function (_super) {
|
|
var TextFileAssetTask = /** @class */ (function (_super) {
|
|
__extends(TextFileAssetTask, _super);
|
|
__extends(TextFileAssetTask, _super);
|
|
function TextFileAssetTask(name, url) {
|
|
function TextFileAssetTask(name, url) {
|
|
@@ -78224,6 +78268,9 @@ var BABYLON;
|
|
return TextFileAssetTask;
|
|
return TextFileAssetTask;
|
|
}(AbstractAssetTask));
|
|
}(AbstractAssetTask));
|
|
BABYLON.TextFileAssetTask = TextFileAssetTask;
|
|
BABYLON.TextFileAssetTask = TextFileAssetTask;
|
|
|
|
+ /**
|
|
|
|
+ * Define a task used by {BABYLON.AssetsManager} to load binary data
|
|
|
|
+ */
|
|
var BinaryFileAssetTask = /** @class */ (function (_super) {
|
|
var BinaryFileAssetTask = /** @class */ (function (_super) {
|
|
__extends(BinaryFileAssetTask, _super);
|
|
__extends(BinaryFileAssetTask, _super);
|
|
function BinaryFileAssetTask(name, url) {
|
|
function BinaryFileAssetTask(name, url) {
|
|
@@ -78246,6 +78293,9 @@ var BABYLON;
|
|
return BinaryFileAssetTask;
|
|
return BinaryFileAssetTask;
|
|
}(AbstractAssetTask));
|
|
}(AbstractAssetTask));
|
|
BABYLON.BinaryFileAssetTask = BinaryFileAssetTask;
|
|
BABYLON.BinaryFileAssetTask = BinaryFileAssetTask;
|
|
|
|
+ /**
|
|
|
|
+ * Define a task used by {BABYLON.AssetsManager} to load images
|
|
|
|
+ */
|
|
var ImageAssetTask = /** @class */ (function (_super) {
|
|
var ImageAssetTask = /** @class */ (function (_super) {
|
|
__extends(ImageAssetTask, _super);
|
|
__extends(ImageAssetTask, _super);
|
|
function ImageAssetTask(name, url) {
|
|
function ImageAssetTask(name, url) {
|
|
@@ -78270,6 +78320,9 @@ var BABYLON;
|
|
return ImageAssetTask;
|
|
return ImageAssetTask;
|
|
}(AbstractAssetTask));
|
|
}(AbstractAssetTask));
|
|
BABYLON.ImageAssetTask = ImageAssetTask;
|
|
BABYLON.ImageAssetTask = ImageAssetTask;
|
|
|
|
+ /**
|
|
|
|
+ * Define a task used by {BABYLON.AssetsManager} to load 2D textures
|
|
|
|
+ */
|
|
var TextureAssetTask = /** @class */ (function (_super) {
|
|
var TextureAssetTask = /** @class */ (function (_super) {
|
|
__extends(TextureAssetTask, _super);
|
|
__extends(TextureAssetTask, _super);
|
|
function TextureAssetTask(name, url, noMipmap, invertY, samplingMode) {
|
|
function TextureAssetTask(name, url, noMipmap, invertY, samplingMode) {
|
|
@@ -78294,6 +78347,9 @@ var BABYLON;
|
|
return TextureAssetTask;
|
|
return TextureAssetTask;
|
|
}(AbstractAssetTask));
|
|
}(AbstractAssetTask));
|
|
BABYLON.TextureAssetTask = TextureAssetTask;
|
|
BABYLON.TextureAssetTask = TextureAssetTask;
|
|
|
|
+ /**
|
|
|
|
+ * Define a task used by {BABYLON.AssetsManager} to load cube textures
|
|
|
|
+ */
|
|
var CubeTextureAssetTask = /** @class */ (function (_super) {
|
|
var CubeTextureAssetTask = /** @class */ (function (_super) {
|
|
__extends(CubeTextureAssetTask, _super);
|
|
__extends(CubeTextureAssetTask, _super);
|
|
function CubeTextureAssetTask(name, url, extensions, noMipmap, files) {
|
|
function CubeTextureAssetTask(name, url, extensions, noMipmap, files) {
|
|
@@ -78317,6 +78373,9 @@ var BABYLON;
|
|
return CubeTextureAssetTask;
|
|
return CubeTextureAssetTask;
|
|
}(AbstractAssetTask));
|
|
}(AbstractAssetTask));
|
|
BABYLON.CubeTextureAssetTask = CubeTextureAssetTask;
|
|
BABYLON.CubeTextureAssetTask = CubeTextureAssetTask;
|
|
|
|
+ /**
|
|
|
|
+ * Define a task used by {BABYLON.AssetsManager} to load HDR cube textures
|
|
|
|
+ */
|
|
var HDRCubeTextureAssetTask = /** @class */ (function (_super) {
|
|
var HDRCubeTextureAssetTask = /** @class */ (function (_super) {
|
|
__extends(HDRCubeTextureAssetTask, _super);
|
|
__extends(HDRCubeTextureAssetTask, _super);
|
|
function HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
|
|
function HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
|
|
@@ -78346,66 +78405,146 @@ var BABYLON;
|
|
return HDRCubeTextureAssetTask;
|
|
return HDRCubeTextureAssetTask;
|
|
}(AbstractAssetTask));
|
|
}(AbstractAssetTask));
|
|
BABYLON.HDRCubeTextureAssetTask = HDRCubeTextureAssetTask;
|
|
BABYLON.HDRCubeTextureAssetTask = HDRCubeTextureAssetTask;
|
|
|
|
+ /**
|
|
|
|
+ * This class can be used to easily import assets into a scene
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/how_to_use_assetsmanager
|
|
|
|
+ */
|
|
var AssetsManager = /** @class */ (function () {
|
|
var AssetsManager = /** @class */ (function () {
|
|
function AssetsManager(scene) {
|
|
function AssetsManager(scene) {
|
|
this._isLoading = false;
|
|
this._isLoading = false;
|
|
this.tasks = new Array();
|
|
this.tasks = new Array();
|
|
this.waitingTasksCount = 0;
|
|
this.waitingTasksCount = 0;
|
|
|
|
+ this.totalTasksCount = 0;
|
|
//Observables
|
|
//Observables
|
|
|
|
+ /**
|
|
|
|
+ * Observable called when all tasks are processed
|
|
|
|
+ */
|
|
this.onTaskSuccessObservable = new BABYLON.Observable();
|
|
this.onTaskSuccessObservable = new BABYLON.Observable();
|
|
|
|
+ /**
|
|
|
|
+ * Observable called when a task had an error
|
|
|
|
+ */
|
|
this.onTaskErrorObservable = new BABYLON.Observable();
|
|
this.onTaskErrorObservable = new BABYLON.Observable();
|
|
|
|
+ /**
|
|
|
|
+ * Observable called when a task is successful
|
|
|
|
+ */
|
|
this.onTasksDoneObservable = new BABYLON.Observable();
|
|
this.onTasksDoneObservable = new BABYLON.Observable();
|
|
|
|
+ /**
|
|
|
|
+ * Observable called when a task is done (whatever the result is)
|
|
|
|
+ */
|
|
this.onProgressObservable = new BABYLON.Observable();
|
|
this.onProgressObservable = new BABYLON.Observable();
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets a boolean defining if the {BABYLON.AssetsManager} should use the default loading screen
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen
|
|
|
|
+ */
|
|
this.useDefaultLoadingScreen = true;
|
|
this.useDefaultLoadingScreen = true;
|
|
this._scene = scene;
|
|
this._scene = scene;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Add a {BABYLON.MeshAssetTask} to the list of active tasks
|
|
|
|
+ * @param taskName defines the name of the new task
|
|
|
|
+ * @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
|
|
|
|
+ */
|
|
AssetsManager.prototype.addMeshTask = function (taskName, meshesNames, rootUrl, sceneFilename) {
|
|
AssetsManager.prototype.addMeshTask = function (taskName, meshesNames, rootUrl, sceneFilename) {
|
|
var task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);
|
|
var task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);
|
|
this.tasks.push(task);
|
|
this.tasks.push(task);
|
|
return 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
|
|
|
|
+ */
|
|
AssetsManager.prototype.addTextFileTask = function (taskName, url) {
|
|
AssetsManager.prototype.addTextFileTask = function (taskName, url) {
|
|
var task = new TextFileAssetTask(taskName, url);
|
|
var task = new TextFileAssetTask(taskName, url);
|
|
this.tasks.push(task);
|
|
this.tasks.push(task);
|
|
return 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
|
|
|
|
+ */
|
|
AssetsManager.prototype.addBinaryFileTask = function (taskName, url) {
|
|
AssetsManager.prototype.addBinaryFileTask = function (taskName, url) {
|
|
var task = new BinaryFileAssetTask(taskName, url);
|
|
var task = new BinaryFileAssetTask(taskName, url);
|
|
this.tasks.push(task);
|
|
this.tasks.push(task);
|
|
return 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
|
|
|
|
+ */
|
|
AssetsManager.prototype.addImageTask = function (taskName, url) {
|
|
AssetsManager.prototype.addImageTask = function (taskName, url) {
|
|
var task = new ImageAssetTask(taskName, url);
|
|
var task = new ImageAssetTask(taskName, url);
|
|
this.tasks.push(task);
|
|
this.tasks.push(task);
|
|
return task;
|
|
return task;
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Add a {BABYLON.TextureAssetTask} 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
|
|
|
|
+ * @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)
|
|
|
|
+ */
|
|
AssetsManager.prototype.addTextureTask = function (taskName, url, noMipmap, invertY, samplingMode) {
|
|
AssetsManager.prototype.addTextureTask = function (taskName, url, noMipmap, invertY, samplingMode) {
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
var task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);
|
|
var task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);
|
|
this.tasks.push(task);
|
|
this.tasks.push(task);
|
|
return task;
|
|
return task;
|
|
};
|
|
};
|
|
- AssetsManager.prototype.addCubeTextureTask = function (name, url, extensions, noMipmap, files) {
|
|
|
|
- var task = new CubeTextureAssetTask(name, url, extensions, noMipmap, files);
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Add a {BABYLON.CubeTextureAssetTask} 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
|
|
|
|
+ * @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)
|
|
|
|
+ */
|
|
|
|
+ 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;
|
|
return task;
|
|
};
|
|
};
|
|
- AssetsManager.prototype.addHDRCubeTextureTask = function (name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ * Add a {BABYLON.HDRCubeTextureAssetTask} 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
|
|
|
|
+ * @param size defines the size you want for the cubemap (can be null)
|
|
|
|
+ * @param noMipmap defines if the texture must not receive mipmaps (false by default)
|
|
|
|
+ * @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
|
|
|
|
+ */
|
|
|
|
+ AssetsManager.prototype.addHDRCubeTextureTask = function (taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
|
|
if (noMipmap === void 0) { noMipmap = false; }
|
|
if (noMipmap === void 0) { noMipmap = false; }
|
|
if (generateHarmonics === void 0) { generateHarmonics = true; }
|
|
if (generateHarmonics === void 0) { generateHarmonics = true; }
|
|
if (useInGammaSpace === void 0) { useInGammaSpace = false; }
|
|
if (useInGammaSpace === void 0) { useInGammaSpace = false; }
|
|
if (usePMREMGenerator === void 0) { usePMREMGenerator = false; }
|
|
if (usePMREMGenerator === void 0) { usePMREMGenerator = false; }
|
|
- var task = new HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
|
|
|
|
|
|
+ var task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
|
|
this.tasks.push(task);
|
|
this.tasks.push(task);
|
|
return task;
|
|
return task;
|
|
};
|
|
};
|
|
AssetsManager.prototype._decreaseWaitingTasksCount = function (task) {
|
|
AssetsManager.prototype._decreaseWaitingTasksCount = function (task) {
|
|
|
|
+ var _this = this;
|
|
this.waitingTasksCount--;
|
|
this.waitingTasksCount--;
|
|
try {
|
|
try {
|
|
|
|
+ if (task.taskState === AssetTaskState.DONE) {
|
|
|
|
+ // Let's remove successfull tasks
|
|
|
|
+ BABYLON.Tools.SetImmediate(function () {
|
|
|
|
+ var index = _this.tasks.indexOf(task);
|
|
|
|
+ if (index > -1) {
|
|
|
|
+ _this.tasks.splice(index, 1);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
if (this.onProgress) {
|
|
if (this.onProgress) {
|
|
- this.onProgress(this.waitingTasksCount, this.tasks.length, task);
|
|
|
|
|
|
+ this.onProgress(this.waitingTasksCount, this.totalTasksCount, task);
|
|
}
|
|
}
|
|
- this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this.waitingTasksCount, this.tasks.length, task));
|
|
|
|
|
|
+ this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this.waitingTasksCount, this.totalTasksCount, task));
|
|
}
|
|
}
|
|
catch (e) {
|
|
catch (e) {
|
|
BABYLON.Tools.Error("Error running progress callbacks.");
|
|
BABYLON.Tools.Error("Error running progress callbacks.");
|
|
@@ -78453,23 +78592,31 @@ var BABYLON;
|
|
};
|
|
};
|
|
task.run(this._scene, done, error);
|
|
task.run(this._scene, done, error);
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Reset the {BABYLON.AssetsManager} and remove all tasks
|
|
|
|
+ * @return the current instance of the {BABYLON.AssetsManager}
|
|
|
|
+ */
|
|
AssetsManager.prototype.reset = function () {
|
|
AssetsManager.prototype.reset = function () {
|
|
this._isLoading = false;
|
|
this._isLoading = false;
|
|
this.tasks = new Array();
|
|
this.tasks = new Array();
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Start the loading process
|
|
|
|
+ * @return the current instance of the {BABYLON.AssetsManager}
|
|
|
|
+ */
|
|
AssetsManager.prototype.load = function () {
|
|
AssetsManager.prototype.load = function () {
|
|
if (this._isLoading) {
|
|
if (this._isLoading) {
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
this._isLoading = true;
|
|
this._isLoading = true;
|
|
this.waitingTasksCount = this.tasks.length;
|
|
this.waitingTasksCount = this.tasks.length;
|
|
|
|
+ this.totalTasksCount = this.tasks.length;
|
|
if (this.waitingTasksCount === 0) {
|
|
if (this.waitingTasksCount === 0) {
|
|
if (this.onFinish) {
|
|
if (this.onFinish) {
|
|
this.onFinish(this.tasks);
|
|
this.onFinish(this.tasks);
|
|
}
|
|
}
|
|
this.onTasksDoneObservable.notifyObservers(this.tasks);
|
|
this.onTasksDoneObservable.notifyObservers(this.tasks);
|
|
- this._isLoading = false;
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
if (this.useDefaultLoadingScreen) {
|
|
if (this.useDefaultLoadingScreen) {
|