|
@@ -72859,6 +72859,15 @@ var BABYLON;
|
|
return AbstractAssetTask;
|
|
return AbstractAssetTask;
|
|
}());
|
|
}());
|
|
BABYLON.AbstractAssetTask = AbstractAssetTask;
|
|
BABYLON.AbstractAssetTask = AbstractAssetTask;
|
|
|
|
+ var AssetsProgressEvent = /** @class */ (function () {
|
|
|
|
+ function AssetsProgressEvent(remainingCount, totalCount, task) {
|
|
|
|
+ this.remainingCount = remainingCount;
|
|
|
|
+ this.totalCount = totalCount;
|
|
|
|
+ this.task = task;
|
|
|
|
+ }
|
|
|
|
+ return AssetsProgressEvent;
|
|
|
|
+ }());
|
|
|
|
+ BABYLON.AssetsProgressEvent = AssetsProgressEvent;
|
|
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) {
|
|
@@ -73035,6 +73044,7 @@ var BABYLON;
|
|
this.onTaskSuccessObservable = new BABYLON.Observable();
|
|
this.onTaskSuccessObservable = new BABYLON.Observable();
|
|
this.onTaskErrorObservable = new BABYLON.Observable();
|
|
this.onTaskErrorObservable = new BABYLON.Observable();
|
|
this.onTasksDoneObservable = new BABYLON.Observable();
|
|
this.onTasksDoneObservable = new BABYLON.Observable();
|
|
|
|
+ this.onProgressObservable = new BABYLON.Observable();
|
|
this.useDefaultLoadingScreen = true;
|
|
this.useDefaultLoadingScreen = true;
|
|
this._scene = scene;
|
|
this._scene = scene;
|
|
}
|
|
}
|
|
@@ -73078,8 +73088,18 @@ var BABYLON;
|
|
this.tasks.push(task);
|
|
this.tasks.push(task);
|
|
return task;
|
|
return task;
|
|
};
|
|
};
|
|
- AssetsManager.prototype._decreaseWaitingTasksCount = function () {
|
|
|
|
|
|
+ AssetsManager.prototype._decreaseWaitingTasksCount = function (task) {
|
|
this.waitingTasksCount--;
|
|
this.waitingTasksCount--;
|
|
|
|
+ try {
|
|
|
|
+ if (this.onProgress) {
|
|
|
|
+ this.onProgress(this.waitingTasksCount, this.tasks.length, task);
|
|
|
|
+ }
|
|
|
|
+ this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this.waitingTasksCount, this.tasks.length, task));
|
|
|
|
+ }
|
|
|
|
+ catch (e) {
|
|
|
|
+ BABYLON.Tools.Error("Error running progress callbacks.");
|
|
|
|
+ console.log(e);
|
|
|
|
+ }
|
|
if (this.waitingTasksCount === 0) {
|
|
if (this.waitingTasksCount === 0) {
|
|
try {
|
|
try {
|
|
if (this.onFinish) {
|
|
if (this.onFinish) {
|
|
@@ -73102,7 +73122,7 @@ var BABYLON;
|
|
_this.onTaskSuccess(task);
|
|
_this.onTaskSuccess(task);
|
|
}
|
|
}
|
|
_this.onTaskSuccessObservable.notifyObservers(task);
|
|
_this.onTaskSuccessObservable.notifyObservers(task);
|
|
- _this._decreaseWaitingTasksCount();
|
|
|
|
|
|
+ _this._decreaseWaitingTasksCount(task);
|
|
}
|
|
}
|
|
catch (e) {
|
|
catch (e) {
|
|
error("Error executing task success callbacks", e);
|
|
error("Error executing task success callbacks", e);
|
|
@@ -73117,7 +73137,7 @@ var BABYLON;
|
|
_this.onTaskError(task);
|
|
_this.onTaskError(task);
|
|
}
|
|
}
|
|
_this.onTaskErrorObservable.notifyObservers(task);
|
|
_this.onTaskErrorObservable.notifyObservers(task);
|
|
- _this._decreaseWaitingTasksCount();
|
|
|
|
|
|
+ _this._decreaseWaitingTasksCount(task);
|
|
};
|
|
};
|
|
task.run(this._scene, done, error);
|
|
task.run(this._scene, done, error);
|
|
};
|
|
};
|
|
@@ -78173,7 +78193,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
GLTFLoader.prototype._getMeshes = function () {
|
|
GLTFLoader.prototype._getMeshes = function () {
|
|
- var meshes = [this._rootNode.babylonMesh || null];
|
|
|
|
|
|
+ var meshes = [this._rootNode.babylonMesh];
|
|
var nodes = this._gltf.nodes;
|
|
var nodes = this._gltf.nodes;
|
|
if (nodes) {
|
|
if (nodes) {
|
|
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
|
|
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
|
|
@@ -79078,14 +79098,14 @@ var BABYLON;
|
|
babylonMaterial.albedoColor = properties.baseColorFactor ? BABYLON.Color3.FromArray(properties.baseColorFactor) : new BABYLON.Color3(1, 1, 1);
|
|
babylonMaterial.albedoColor = properties.baseColorFactor ? BABYLON.Color3.FromArray(properties.baseColorFactor) : new BABYLON.Color3(1, 1, 1);
|
|
babylonMaterial.metallic = properties.metallicFactor == null ? 1 : properties.metallicFactor;
|
|
babylonMaterial.metallic = properties.metallicFactor == null ? 1 : properties.metallicFactor;
|
|
babylonMaterial.roughness = properties.roughnessFactor == null ? 1 : properties.roughnessFactor;
|
|
babylonMaterial.roughness = properties.roughnessFactor == null ? 1 : properties.roughnessFactor;
|
|
- if (properties.baseColorTexture && properties.baseColorTexture.texCoord) {
|
|
|
|
|
|
+ if (properties.baseColorTexture) {
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, properties.baseColorTexture.index);
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, properties.baseColorTexture.index);
|
|
if (!texture) {
|
|
if (!texture) {
|
|
throw new Error(context + ": Failed to find base color texture " + properties.baseColorTexture.index);
|
|
throw new Error(context + ": Failed to find base color texture " + properties.baseColorTexture.index);
|
|
}
|
|
}
|
|
babylonMaterial.albedoTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.baseColorTexture.texCoord);
|
|
babylonMaterial.albedoTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.baseColorTexture.texCoord);
|
|
}
|
|
}
|
|
- if (properties.metallicRoughnessTexture && properties.metallicRoughnessTexture.texCoord) {
|
|
|
|
|
|
+ if (properties.metallicRoughnessTexture) {
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, properties.metallicRoughnessTexture.index);
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, properties.metallicRoughnessTexture.index);
|
|
if (!texture) {
|
|
if (!texture) {
|
|
throw new Error(context + ": Failed to find metallic roughness texture " + properties.metallicRoughnessTexture.index);
|
|
throw new Error(context + ": Failed to find metallic roughness texture " + properties.metallicRoughnessTexture.index);
|
|
@@ -79124,7 +79144,7 @@ var BABYLON;
|
|
babylonMaterial.backFaceCulling = false;
|
|
babylonMaterial.backFaceCulling = false;
|
|
babylonMaterial.twoSidedLighting = true;
|
|
babylonMaterial.twoSidedLighting = true;
|
|
}
|
|
}
|
|
- if (material.normalTexture && material.normalTexture.texCoord) {
|
|
|
|
|
|
+ if (material.normalTexture) {
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, material.normalTexture.index);
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, material.normalTexture.index);
|
|
if (!texture) {
|
|
if (!texture) {
|
|
throw new Error(context + ": Failed to find normal texture " + material.normalTexture.index);
|
|
throw new Error(context + ": Failed to find normal texture " + material.normalTexture.index);
|
|
@@ -79136,7 +79156,7 @@ var BABYLON;
|
|
babylonMaterial.bumpTexture.level = material.normalTexture.scale;
|
|
babylonMaterial.bumpTexture.level = material.normalTexture.scale;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (material.occlusionTexture && material.occlusionTexture.texCoord) {
|
|
|
|
|
|
+ if (material.occlusionTexture) {
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, material.occlusionTexture.index);
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, material.occlusionTexture.index);
|
|
if (!texture) {
|
|
if (!texture) {
|
|
throw new Error(context + ": Failed to find occlusion texture " + material.occlusionTexture.index);
|
|
throw new Error(context + ": Failed to find occlusion texture " + material.occlusionTexture.index);
|
|
@@ -79147,7 +79167,7 @@ var BABYLON;
|
|
babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;
|
|
babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (material.emissiveTexture && material.emissiveTexture.texCoord) {
|
|
|
|
|
|
+ if (material.emissiveTexture) {
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, material.emissiveTexture.index);
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, material.emissiveTexture.index);
|
|
if (!texture) {
|
|
if (!texture) {
|
|
throw new Error(context + ": Failed to find emissive texture " + material.emissiveTexture.index);
|
|
throw new Error(context + ": Failed to find emissive texture " + material.emissiveTexture.index);
|
|
@@ -79191,6 +79211,7 @@ var BABYLON;
|
|
};
|
|
};
|
|
GLTFLoader.prototype._loadTexture = function (context, texture, coordinatesIndex) {
|
|
GLTFLoader.prototype._loadTexture = function (context, texture, coordinatesIndex) {
|
|
var _this = this;
|
|
var _this = this;
|
|
|
|
+ if (coordinatesIndex === void 0) { coordinatesIndex = 0; }
|
|
var sampler = (texture.sampler == null ? {} : GLTF2.GLTFUtils.GetArrayItem(this._gltf.samplers, texture.sampler));
|
|
var sampler = (texture.sampler == null ? {} : GLTF2.GLTFUtils.GetArrayItem(this._gltf.samplers, texture.sampler));
|
|
if (!sampler) {
|
|
if (!sampler) {
|
|
throw new Error(context + ": Failed to find sampler " + texture.sampler);
|
|
throw new Error(context + ": Failed to find sampler " + texture.sampler);
|