|
@@ -9512,6 +9512,27 @@ var BABYLON;
|
|
}
|
|
}
|
|
return newPromise;
|
|
return newPromise;
|
|
};
|
|
};
|
|
|
|
+ InternalPromise.race = function (promises) {
|
|
|
|
+ var newPromise = new InternalPromise();
|
|
|
|
+ if (promises.length) {
|
|
|
|
+ for (var _i = 0, promises_1 = promises; _i < promises_1.length; _i++) {
|
|
|
|
+ var promise = promises_1[_i];
|
|
|
|
+ promise.then(function (value) {
|
|
|
|
+ if (newPromise) {
|
|
|
|
+ newPromise._resolve(value);
|
|
|
|
+ newPromise = null;
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }, function (reason) {
|
|
|
|
+ if (newPromise) {
|
|
|
|
+ newPromise._reject(reason);
|
|
|
|
+ newPromise = null;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return newPromise;
|
|
|
|
+ };
|
|
return InternalPromise;
|
|
return InternalPromise;
|
|
}());
|
|
}());
|
|
/**
|
|
/**
|
|
@@ -90593,6 +90614,10 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
this.onMaterialLoadedObservable = new BABYLON.Observable();
|
|
this.onMaterialLoadedObservable = new BABYLON.Observable();
|
|
/**
|
|
/**
|
|
|
|
+ * Raised when the loader creates an animation group after parsing the glTF properties of the material.
|
|
|
|
+ */
|
|
|
|
+ this.onAnimationGroupLoadedObservable = new BABYLON.Observable();
|
|
|
|
+ /**
|
|
* Raised when the asset is completely loaded, immediately before the loader is disposed.
|
|
* Raised when the asset is completely loaded, immediately before the loader is disposed.
|
|
* For assets with LODs, raised when all of the LODs are complete.
|
|
* For assets with LODs, raised when all of the LODs are complete.
|
|
* For assets without LODs, raised when the model is complete, immediately after onSuccess.
|
|
* For assets without LODs, raised when the model is complete, immediately after onSuccess.
|
|
@@ -90655,6 +90680,16 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ Object.defineProperty(GLTFFileLoader.prototype, "onAnimationGroupLoaded", {
|
|
|
|
+ set: function (callback) {
|
|
|
|
+ if (this._onAnimationGroupLoadedObserver) {
|
|
|
|
+ this.onAnimationGroupLoadedObservable.remove(this._onAnimationGroupLoadedObserver);
|
|
|
|
+ }
|
|
|
|
+ this._onAnimationGroupLoadedObserver = this.onAnimationGroupLoadedObservable.add(callback);
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
Object.defineProperty(GLTFFileLoader.prototype, "onComplete", {
|
|
Object.defineProperty(GLTFFileLoader.prototype, "onComplete", {
|
|
set: function (callback) {
|
|
set: function (callback) {
|
|
if (this._onCompleteObserver) {
|
|
if (this._onCompleteObserver) {
|
|
@@ -90685,6 +90720,18 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ /**
|
|
|
|
+ * Gets a promise that resolves when the asset to be completely loaded.
|
|
|
|
+ * @returns A promise that resolves when the asset is completely loaded.
|
|
|
|
+ */
|
|
|
|
+ GLTFFileLoader.prototype.whenCompleteAsync = function () {
|
|
|
|
+ var _this = this;
|
|
|
|
+ return new Promise(function (resolve) {
|
|
|
|
+ _this.onCompleteObservable.add(function () {
|
|
|
|
+ resolve();
|
|
|
|
+ }, undefined, undefined, undefined, true);
|
|
|
|
+ });
|
|
|
|
+ };
|
|
Object.defineProperty(GLTFFileLoader.prototype, "loaderState", {
|
|
Object.defineProperty(GLTFFileLoader.prototype, "loaderState", {
|
|
/**
|
|
/**
|
|
* The loader state or null if not active.
|
|
* The loader state or null if not active.
|
|
@@ -92353,6 +92400,7 @@ var BABYLON;
|
|
this.onMeshLoadedObservable = new BABYLON.Observable();
|
|
this.onMeshLoadedObservable = new BABYLON.Observable();
|
|
this.onTextureLoadedObservable = new BABYLON.Observable();
|
|
this.onTextureLoadedObservable = new BABYLON.Observable();
|
|
this.onMaterialLoadedObservable = new BABYLON.Observable();
|
|
this.onMaterialLoadedObservable = new BABYLON.Observable();
|
|
|
|
+ this.onAnimationGroupLoadedObservable = new BABYLON.Observable();
|
|
this.onCompleteObservable = new BABYLON.Observable();
|
|
this.onCompleteObservable = new BABYLON.Observable();
|
|
this.onExtensionLoadedObservable = new BABYLON.Observable();
|
|
this.onExtensionLoadedObservable = new BABYLON.Observable();
|
|
this.state = null;
|
|
this.state = null;
|
|
@@ -93173,6 +93221,7 @@ var BABYLON;
|
|
this.onMeshLoadedObservable = new BABYLON.Observable();
|
|
this.onMeshLoadedObservable = new BABYLON.Observable();
|
|
this.onTextureLoadedObservable = new BABYLON.Observable();
|
|
this.onTextureLoadedObservable = new BABYLON.Observable();
|
|
this.onMaterialLoadedObservable = new BABYLON.Observable();
|
|
this.onMaterialLoadedObservable = new BABYLON.Observable();
|
|
|
|
+ this.onAnimationGroupLoadedObservable = new BABYLON.Observable();
|
|
this.onExtensionLoadedObservable = new BABYLON.Observable();
|
|
this.onExtensionLoadedObservable = new BABYLON.Observable();
|
|
this.onCompleteObservable = new BABYLON.Observable();
|
|
this.onCompleteObservable = new BABYLON.Observable();
|
|
}
|
|
}
|
|
@@ -93260,9 +93309,12 @@ var BABYLON;
|
|
if (_this.compileShadowGenerators) {
|
|
if (_this.compileShadowGenerators) {
|
|
promises.push(_this._compileShadowGeneratorsAsync());
|
|
promises.push(_this._compileShadowGeneratorsAsync());
|
|
}
|
|
}
|
|
- return Promise.all(promises).then(function () {
|
|
|
|
|
|
+ var resultPromise = Promise.all(promises).then(function () {
|
|
_this._state = BABYLON.GLTFLoaderState.Ready;
|
|
_this._state = BABYLON.GLTFLoaderState.Ready;
|
|
_this._startAnimations();
|
|
_this._startAnimations();
|
|
|
|
+ });
|
|
|
|
+ resultPromise.then(function () {
|
|
|
|
+ _this._rootBabylonMesh.setEnabled(true);
|
|
BABYLON.Tools.SetImmediate(function () {
|
|
BABYLON.Tools.SetImmediate(function () {
|
|
if (!_this._disposed) {
|
|
if (!_this._disposed) {
|
|
Promise.all(_this._completePromises).then(function () {
|
|
Promise.all(_this._completePromises).then(function () {
|
|
@@ -93277,6 +93329,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+ return resultPromise;
|
|
}).catch(function (error) {
|
|
}).catch(function (error) {
|
|
BABYLON.Tools.Error("glTF Loader: " + error.message);
|
|
BABYLON.Tools.Error("glTF Loader: " + error.message);
|
|
_this._clear();
|
|
_this._clear();
|
|
@@ -93355,6 +93408,7 @@ var BABYLON;
|
|
};
|
|
};
|
|
GLTFLoader.prototype._createRootNode = function () {
|
|
GLTFLoader.prototype._createRootNode = function () {
|
|
this._rootBabylonMesh = new BABYLON.Mesh("__root__", this._babylonScene);
|
|
this._rootBabylonMesh = new BABYLON.Mesh("__root__", this._babylonScene);
|
|
|
|
+ this._rootBabylonMesh.setEnabled(false);
|
|
var rootNode = { _babylonMesh: this._rootBabylonMesh };
|
|
var rootNode = { _babylonMesh: this._rootBabylonMesh };
|
|
switch (this.coordinateSystemMode) {
|
|
switch (this.coordinateSystemMode) {
|
|
case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
|
|
case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
|
|
@@ -93518,7 +93572,6 @@ var BABYLON;
|
|
var _this = this;
|
|
var _this = this;
|
|
var promises = new Array();
|
|
var promises = new Array();
|
|
var babylonMesh = new BABYLON.Mesh((mesh.name || node._babylonMesh.name) + "_" + primitive._index, this._babylonScene, node._babylonMesh);
|
|
var babylonMesh = new BABYLON.Mesh((mesh.name || node._babylonMesh.name) + "_" + primitive._index, this._babylonScene, node._babylonMesh);
|
|
- babylonMesh.setEnabled(false);
|
|
|
|
node._primitiveBabylonMeshes = node._primitiveBabylonMeshes || [];
|
|
node._primitiveBabylonMeshes = node._primitiveBabylonMeshes || [];
|
|
node._primitiveBabylonMeshes[primitive._index] = babylonMesh;
|
|
node._primitiveBabylonMeshes[primitive._index] = babylonMesh;
|
|
this._createMorphTargets(context, node, mesh, primitive, babylonMesh);
|
|
this._createMorphTargets(context, node, mesh, primitive, babylonMesh);
|
|
@@ -93531,12 +93584,12 @@ var BABYLON;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
var material = GLTFLoader._GetProperty(context + "/material", this._gltf.materials, primitive.material);
|
|
var material = GLTFLoader._GetProperty(context + "/material", this._gltf.materials, primitive.material);
|
|
- promises.push(this._loadMaterialAsync("#/materials/" + material._index, material, babylonMesh));
|
|
|
|
|
|
+ promises.push(this._loadMaterialAsync("#/materials/" + material._index, material, babylonMesh, function (babylonMaterial) {
|
|
|
|
+ babylonMesh.material = babylonMaterial;
|
|
|
|
+ }));
|
|
}
|
|
}
|
|
this.onMeshLoadedObservable.notifyObservers(babylonMesh);
|
|
this.onMeshLoadedObservable.notifyObservers(babylonMesh);
|
|
- return Promise.all(promises).then(function () {
|
|
|
|
- babylonMesh.setEnabled(true);
|
|
|
|
- });
|
|
|
|
|
|
+ return Promise.all(promises).then(function () { });
|
|
};
|
|
};
|
|
GLTFLoader.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {
|
|
GLTFLoader.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {
|
|
var _this = this;
|
|
var _this = this;
|
|
@@ -93831,13 +93884,14 @@ var BABYLON;
|
|
var channel = _a[_i];
|
|
var channel = _a[_i];
|
|
promises.push(this._loadAnimationChannelAsync(context + "/channels/" + channel._index, context, animation, channel, babylonAnimationGroup));
|
|
promises.push(this._loadAnimationChannelAsync(context + "/channels/" + channel._index, context, animation, channel, babylonAnimationGroup));
|
|
}
|
|
}
|
|
|
|
+ this.onAnimationGroupLoadedObservable.notifyObservers(babylonAnimationGroup);
|
|
return Promise.all(promises).then(function () {
|
|
return Promise.all(promises).then(function () {
|
|
babylonAnimationGroup.normalize();
|
|
babylonAnimationGroup.normalize();
|
|
});
|
|
});
|
|
};
|
|
};
|
|
GLTFLoader.prototype._loadAnimationChannelAsync = function (context, animationContext, animation, channel, babylonAnimationGroup) {
|
|
GLTFLoader.prototype._loadAnimationChannelAsync = function (context, animationContext, animation, channel, babylonAnimationGroup) {
|
|
var targetNode = GLTFLoader._GetProperty(context + "/target/node", this._gltf.nodes, channel.target.node);
|
|
var targetNode = GLTFLoader._GetProperty(context + "/target/node", this._gltf.nodes, channel.target.node);
|
|
- if (!targetNode._babylonMesh) {
|
|
|
|
|
|
+ if (!targetNode._babylonMesh || targetNode.skin != undefined) {
|
|
return Promise.resolve();
|
|
return Promise.resolve();
|
|
}
|
|
}
|
|
var sampler = GLTFLoader._GetProperty(context + "/sampler", animation.samplers, channel.sampler);
|
|
var sampler = GLTFLoader._GetProperty(context + "/sampler", animation.samplers, channel.sampler);
|
|
@@ -94155,25 +94209,24 @@ var BABYLON;
|
|
this._loadMaterialAlphaProperties(context, material);
|
|
this._loadMaterialAlphaProperties(context, material);
|
|
return Promise.all(promises).then(function () { });
|
|
return Promise.all(promises).then(function () { });
|
|
};
|
|
};
|
|
- GLTFLoader.prototype._loadMaterialAsync = function (context, material, babylonMesh) {
|
|
|
|
- var promise = GLTF2.GLTFLoaderExtension._LoadMaterialAsync(this, context, material, babylonMesh);
|
|
|
|
|
|
+ GLTFLoader.prototype._loadMaterialAsync = function (context, material, babylonMesh, assign) {
|
|
|
|
+ var promise = GLTF2.GLTFLoaderExtension._LoadMaterialAsync(this, context, material, babylonMesh, assign);
|
|
if (promise) {
|
|
if (promise) {
|
|
return promise;
|
|
return promise;
|
|
}
|
|
}
|
|
material._babylonMeshes = material._babylonMeshes || [];
|
|
material._babylonMeshes = material._babylonMeshes || [];
|
|
material._babylonMeshes.push(babylonMesh);
|
|
material._babylonMeshes.push(babylonMesh);
|
|
- if (material._loaded) {
|
|
|
|
- babylonMesh.material = material._babylonMaterial;
|
|
|
|
- return material._loaded;
|
|
|
|
|
|
+ if (!material._loaded) {
|
|
|
|
+ var promises = new Array();
|
|
|
|
+ var babylonMaterial = this._createMaterial(material);
|
|
|
|
+ material._babylonMaterial = babylonMaterial;
|
|
|
|
+ promises.push(this._loadMaterialBasePropertiesAsync(context, material));
|
|
|
|
+ promises.push(this._loadMaterialMetallicRoughnessPropertiesAsync(context, material));
|
|
|
|
+ this.onMaterialLoadedObservable.notifyObservers(babylonMaterial);
|
|
|
|
+ material._loaded = Promise.all(promises).then(function () { });
|
|
}
|
|
}
|
|
- var promises = new Array();
|
|
|
|
- var babylonMaterial = this._createMaterial(material);
|
|
|
|
- material._babylonMaterial = babylonMaterial;
|
|
|
|
- promises.push(this._loadMaterialBasePropertiesAsync(context, material));
|
|
|
|
- promises.push(this._loadMaterialMetallicRoughnessPropertiesAsync(context, material));
|
|
|
|
- this.onMaterialLoadedObservable.notifyObservers(babylonMaterial);
|
|
|
|
- babylonMesh.material = babylonMaterial;
|
|
|
|
- return (material._loaded = Promise.all(promises).then(function () { }));
|
|
|
|
|
|
+ assign(material._babylonMaterial);
|
|
|
|
+ return material._loaded;
|
|
};
|
|
};
|
|
GLTFLoader.prototype._createMaterial = function (material) {
|
|
GLTFLoader.prototype._createMaterial = function (material) {
|
|
var babylonMaterial = new BABYLON.PBRMaterial(material.name || "material" + material._index, this._babylonScene);
|
|
var babylonMaterial = new BABYLON.PBRMaterial(material.name || "material" + material._index, this._babylonScene);
|
|
@@ -94542,7 +94595,7 @@ var BABYLON;
|
|
/** Override this method to modify the default behavior for loading mesh primitive vertex data. */
|
|
/** Override this method to modify the default behavior for loading mesh primitive vertex data. */
|
|
GLTFLoaderExtension.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) { return null; };
|
|
GLTFLoaderExtension.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) { return null; };
|
|
/** Override this method to modify the default behavior for loading materials. */
|
|
/** Override this method to modify the default behavior for loading materials. */
|
|
- GLTFLoaderExtension.prototype._loadMaterialAsync = function (context, material, babylonMesh) { return null; };
|
|
|
|
|
|
+ GLTFLoaderExtension.prototype._loadMaterialAsync = function (context, material, babylonMesh, assign) { return null; };
|
|
/** Override this method to modify the default behavior for loading uris. */
|
|
/** Override this method to modify the default behavior for loading uris. */
|
|
GLTFLoaderExtension.prototype._loadUriAsync = function (context, uri) { return null; };
|
|
GLTFLoaderExtension.prototype._loadUriAsync = function (context, uri) { return null; };
|
|
// #endregion
|
|
// #endregion
|
|
@@ -94579,8 +94632,8 @@ var BABYLON;
|
|
return loader._applyExtensions(function (extension) { return extension._loadVertexDataAsync(context, primitive, babylonMesh); });
|
|
return loader._applyExtensions(function (extension) { return extension._loadVertexDataAsync(context, primitive, babylonMesh); });
|
|
};
|
|
};
|
|
/** Helper method called by the loader to allow extensions to override loading materials. */
|
|
/** Helper method called by the loader to allow extensions to override loading materials. */
|
|
- GLTFLoaderExtension._LoadMaterialAsync = function (loader, context, material, babylonMesh) {
|
|
|
|
- return loader._applyExtensions(function (extension) { return extension._loadMaterialAsync(context, material, babylonMesh); });
|
|
|
|
|
|
+ GLTFLoaderExtension._LoadMaterialAsync = function (loader, context, material, babylonMesh, assign) {
|
|
|
|
+ return loader._applyExtensions(function (extension) { return extension._loadMaterialAsync(context, material, babylonMesh, assign); });
|
|
};
|
|
};
|
|
/** Helper method called by the loader to allow extensions to override loading uris. */
|
|
/** Helper method called by the loader to allow extensions to override loading uris. */
|
|
GLTFLoaderExtension._LoadUriAsync = function (loader, context, uri) {
|
|
GLTFLoaderExtension._LoadUriAsync = function (loader, context, uri) {
|
|
@@ -94659,7 +94712,7 @@ var BABYLON;
|
|
return firstPromise;
|
|
return firstPromise;
|
|
});
|
|
});
|
|
};
|
|
};
|
|
- MSFT_lod.prototype._loadMaterialAsync = function (context, material, babylonMesh) {
|
|
|
|
|
|
+ MSFT_lod.prototype._loadMaterialAsync = function (context, material, babylonMesh, assign) {
|
|
var _this = this;
|
|
var _this = this;
|
|
// Don't load material LODs if already loading a node LOD.
|
|
// Don't load material LODs if already loading a node LOD.
|
|
if (this._loadingNodeLOD) {
|
|
if (this._loadingNodeLOD) {
|
|
@@ -94676,7 +94729,10 @@ var BABYLON;
|
|
_this._loadMaterialSignals[materialLOD._index] = new BABYLON.Deferred();
|
|
_this._loadMaterialSignals[materialLOD._index] = new BABYLON.Deferred();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- var promise = _this._loader._loadMaterialAsync("#/materials/" + materialLOD._index, materialLOD, babylonMesh).then(function () {
|
|
|
|
|
|
+ var promise = _this._loader._loadMaterialAsync("#/materials/" + materialLOD._index, materialLOD, babylonMesh, indexLOD === 0 ? assign : function () { }).then(function () {
|
|
|
|
+ if (indexLOD !== 0) {
|
|
|
|
+ assign(materialLOD._babylonMaterial);
|
|
|
|
+ }
|
|
if (indexLOD !== materialLODs.length - 1) {
|
|
if (indexLOD !== materialLODs.length - 1) {
|
|
var materialIndex = materialLODs[indexLOD + 1]._index;
|
|
var materialIndex = materialLODs[indexLOD + 1]._index;
|
|
if (_this._loadMaterialSignals[materialIndex]) {
|
|
if (_this._loadMaterialSignals[materialIndex]) {
|
|
@@ -94845,26 +94901,25 @@ var BABYLON;
|
|
_this.name = NAME;
|
|
_this.name = NAME;
|
|
return _this;
|
|
return _this;
|
|
}
|
|
}
|
|
- KHR_materials_pbrSpecularGlossiness.prototype._loadMaterialAsync = function (context, material, babylonMesh) {
|
|
|
|
|
|
+ KHR_materials_pbrSpecularGlossiness.prototype._loadMaterialAsync = function (context, material, babylonMesh, assign) {
|
|
var _this = this;
|
|
var _this = this;
|
|
return this._loadExtensionAsync(context, material, function (context, extension) {
|
|
return this._loadExtensionAsync(context, material, function (context, extension) {
|
|
material._babylonMeshes = material._babylonMeshes || [];
|
|
material._babylonMeshes = material._babylonMeshes || [];
|
|
material._babylonMeshes.push(babylonMesh);
|
|
material._babylonMeshes.push(babylonMesh);
|
|
- if (material._loaded) {
|
|
|
|
- babylonMesh.material = material._babylonMaterial;
|
|
|
|
- return material._loaded;
|
|
|
|
- }
|
|
|
|
- var promises = new Array();
|
|
|
|
- var babylonMaterial = _this._loader._createMaterial(material);
|
|
|
|
- material._babylonMaterial = babylonMaterial;
|
|
|
|
- promises.push(_this._loader._loadMaterialBasePropertiesAsync(context, material));
|
|
|
|
- promises.push(_this._loadSpecularGlossinessPropertiesAsync(_this._loader, context, material, extension));
|
|
|
|
- _this._loader.onMaterialLoadedObservable.notifyObservers(babylonMaterial);
|
|
|
|
- babylonMesh.material = babylonMaterial;
|
|
|
|
- return (material._loaded = Promise.all(promises).then(function () { }));
|
|
|
|
|
|
+ if (!material._loaded) {
|
|
|
|
+ var promises = new Array();
|
|
|
|
+ var babylonMaterial = _this._loader._createMaterial(material);
|
|
|
|
+ material._babylonMaterial = babylonMaterial;
|
|
|
|
+ promises.push(_this._loader._loadMaterialBasePropertiesAsync(context, material));
|
|
|
|
+ promises.push(_this._loadSpecularGlossinessPropertiesAsync(context, material, extension));
|
|
|
|
+ _this._loader.onMaterialLoadedObservable.notifyObservers(babylonMaterial);
|
|
|
|
+ material._loaded = Promise.all(promises).then(function () { });
|
|
|
|
+ }
|
|
|
|
+ assign(material._babylonMaterial);
|
|
|
|
+ return material._loaded;
|
|
});
|
|
});
|
|
};
|
|
};
|
|
- KHR_materials_pbrSpecularGlossiness.prototype._loadSpecularGlossinessPropertiesAsync = function (loader, context, material, properties) {
|
|
|
|
|
|
+ KHR_materials_pbrSpecularGlossiness.prototype._loadSpecularGlossinessPropertiesAsync = function (context, material, properties) {
|
|
var promises = new Array();
|
|
var promises = new Array();
|
|
var babylonMaterial = material._babylonMaterial;
|
|
var babylonMaterial = material._babylonMaterial;
|
|
if (properties.diffuseFactor) {
|
|
if (properties.diffuseFactor) {
|
|
@@ -94877,18 +94932,18 @@ var BABYLON;
|
|
babylonMaterial.reflectivityColor = properties.specularFactor ? BABYLON.Color3.FromArray(properties.specularFactor) : BABYLON.Color3.White();
|
|
babylonMaterial.reflectivityColor = properties.specularFactor ? BABYLON.Color3.FromArray(properties.specularFactor) : BABYLON.Color3.White();
|
|
babylonMaterial.microSurface = properties.glossinessFactor == undefined ? 1 : properties.glossinessFactor;
|
|
babylonMaterial.microSurface = properties.glossinessFactor == undefined ? 1 : properties.glossinessFactor;
|
|
if (properties.diffuseTexture) {
|
|
if (properties.diffuseTexture) {
|
|
- promises.push(loader._loadTextureAsync(context + "/diffuseTexture", properties.diffuseTexture, function (texture) {
|
|
|
|
|
|
+ promises.push(this._loader._loadTextureAsync(context + "/diffuseTexture", properties.diffuseTexture, function (texture) {
|
|
babylonMaterial.albedoTexture = texture;
|
|
babylonMaterial.albedoTexture = texture;
|
|
}));
|
|
}));
|
|
}
|
|
}
|
|
if (properties.specularGlossinessTexture) {
|
|
if (properties.specularGlossinessTexture) {
|
|
- promises.push(loader._loadTextureAsync(context + "/specularGlossinessTexture", properties.specularGlossinessTexture, function (texture) {
|
|
|
|
|
|
+ promises.push(this._loader._loadTextureAsync(context + "/specularGlossinessTexture", properties.specularGlossinessTexture, function (texture) {
|
|
babylonMaterial.reflectivityTexture = texture;
|
|
babylonMaterial.reflectivityTexture = texture;
|
|
}));
|
|
}));
|
|
babylonMaterial.reflectivityTexture.hasAlpha = true;
|
|
babylonMaterial.reflectivityTexture.hasAlpha = true;
|
|
babylonMaterial.useMicroSurfaceFromReflectivityMapAlpha = true;
|
|
babylonMaterial.useMicroSurfaceFromReflectivityMapAlpha = true;
|
|
}
|
|
}
|
|
- loader._loadMaterialAlphaProperties(context, material);
|
|
|
|
|
|
+ this._loader._loadMaterialAlphaProperties(context, material);
|
|
return Promise.all(promises).then(function () { });
|
|
return Promise.all(promises).then(function () { });
|
|
};
|
|
};
|
|
return KHR_materials_pbrSpecularGlossiness;
|
|
return KHR_materials_pbrSpecularGlossiness;
|