|
@@ -51834,8 +51834,8 @@ var BABYLON;
|
|
|
this.removePendingData(this);
|
|
|
};
|
|
|
GLTFLoader.prototype._onError = function (message) {
|
|
|
- this.dispose();
|
|
|
this._errorCallback(message);
|
|
|
+ this.dispose();
|
|
|
};
|
|
|
GLTFLoader.prototype._onProgress = function (event) {
|
|
|
this._progressCallback(event);
|
|
@@ -52049,14 +52049,17 @@ var BABYLON;
|
|
|
babylonMultiMaterial.subMaterials[i] = _this._getDefaultMaterial();
|
|
|
}
|
|
|
else {
|
|
|
- _this.loadMaterial(primitive.material, function (babylonSubMaterial) {
|
|
|
+ _this.loadMaterial(primitive.material, function (babylonMaterial, isNew) {
|
|
|
+ if (isNew && _this._parent.onMaterialLoaded) {
|
|
|
+ _this._parent.onMaterialLoaded(babylonMaterial);
|
|
|
+ }
|
|
|
if (_this._renderReady) {
|
|
|
- babylonSubMaterial.forceCompilation(babylonMesh, function (babylonSubMaterial) {
|
|
|
- _this._assignMaterial(babylonMultiMaterial, i, babylonSubMaterial);
|
|
|
+ babylonMaterial.forceCompilation(babylonMesh, function (babylonSubMaterial) {
|
|
|
+ babylonMultiMaterial.subMaterials[i] = babylonSubMaterial;
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
- _this._assignMaterial(babylonMultiMaterial, i, babylonSubMaterial);
|
|
|
+ babylonMultiMaterial.subMaterials[i] = babylonMaterial;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -52074,12 +52077,6 @@ var BABYLON;
|
|
|
_loop_1(i);
|
|
|
}
|
|
|
};
|
|
|
- GLTFLoader.prototype._assignMaterial = function (multiMaterial, index, subMaterial) {
|
|
|
- multiMaterial.subMaterials[index] = subMaterial;
|
|
|
- if (this._parent.onMaterialLoaded) {
|
|
|
- this._parent.onMaterialLoaded(subMaterial);
|
|
|
- }
|
|
|
- };
|
|
|
GLTFLoader.prototype._loadVertexDataAsync = function (primitive, onSuccess) {
|
|
|
var _this = this;
|
|
|
var attributes = primitive.attributes;
|
|
@@ -52536,7 +52533,7 @@ var BABYLON;
|
|
|
var material = this._gltf.materials[index];
|
|
|
material.index = index;
|
|
|
if (material.babylonMaterial) {
|
|
|
- assign(material.babylonMaterial);
|
|
|
+ assign(material.babylonMaterial, false);
|
|
|
return;
|
|
|
}
|
|
|
if (GLTF2.GLTFLoaderExtension.LoadMaterial(this, material, assign)) {
|
|
@@ -52545,7 +52542,7 @@ var BABYLON;
|
|
|
this.createPbrMaterial(material);
|
|
|
this.loadMaterialBaseProperties(material);
|
|
|
this._loadMaterialMetallicRoughnessProperties(material);
|
|
|
- assign(material.babylonMaterial);
|
|
|
+ assign(material.babylonMaterial, true);
|
|
|
};
|
|
|
GLTFLoader.prototype.createPbrMaterial = function (material) {
|
|
|
var babylonMaterial = new BABYLON.PBRMaterial(material.name || "mat" + material.index, this._babylonScene);
|
|
@@ -52860,8 +52857,8 @@ var BABYLON;
|
|
|
};
|
|
|
MSFTLOD.prototype.loadMaterialLOD = function (loader, material, materialLODs, lod, assign) {
|
|
|
var _this = this;
|
|
|
- loader.loadMaterial(materialLODs[lod], function (babylonMaterial) {
|
|
|
- assign(babylonMaterial);
|
|
|
+ loader.loadMaterial(materialLODs[lod], function (babylonMaterial, isNew) {
|
|
|
+ assign(babylonMaterial, isNew);
|
|
|
// Loading is complete if this is the highest quality LOD.
|
|
|
if (lod === 0) {
|
|
|
loader.removeLoaderPendingData(material);
|
|
@@ -52917,7 +52914,7 @@ var BABYLON;
|
|
|
loader.createPbrMaterial(material);
|
|
|
loader.loadMaterialBaseProperties(material);
|
|
|
this._loadSpecularGlossinessProperties(loader, material, properties);
|
|
|
- assign(material.babylonMaterial);
|
|
|
+ assign(material.babylonMaterial, true);
|
|
|
return true;
|
|
|
};
|
|
|
KHRMaterialsPbrSpecularGlossiness.prototype._loadSpecularGlossinessProperties = function (loader, material, properties) {
|
|
@@ -52931,6 +52928,7 @@ var BABYLON;
|
|
|
}
|
|
|
if (properties.specularGlossinessTexture) {
|
|
|
babylonMaterial.reflectivityTexture = loader.loadTexture(properties.specularGlossinessTexture);
|
|
|
+ babylonMaterial.reflectivityTexture.hasAlpha = true;
|
|
|
babylonMaterial.useMicroSurfaceFromReflectivityMapAlpha = true;
|
|
|
}
|
|
|
loader.loadMaterialAlphaProperties(material, properties.diffuseFactor);
|