|
@@ -1710,10 +1710,11 @@ export class GLTFLoader implements IGLTFLoader {
|
|
|
}
|
|
|
|
|
|
if (properties.metallicRoughnessTexture) {
|
|
|
+ properties.metallicRoughnessTexture.isNotColorData = true;
|
|
|
promises.push(this.loadTextureInfoAsync(`${context}/metallicRoughnessTexture`, properties.metallicRoughnessTexture, (texture) => {
|
|
|
texture.name = `${babylonMaterial.name} (Metallic Roughness)`;
|
|
|
babylonMaterial.metallicTexture = texture;
|
|
|
- }, false));
|
|
|
+ }));
|
|
|
|
|
|
babylonMaterial.useMetallnessFromMetallicTextureBlue = true;
|
|
|
babylonMaterial.useRoughnessFromMetallicTextureGreen = true;
|
|
@@ -1851,10 +1852,11 @@ export class GLTFLoader implements IGLTFLoader {
|
|
|
}
|
|
|
|
|
|
if (material.normalTexture) {
|
|
|
+ material.normalTexture.isNotColorData = true;
|
|
|
promises.push(this.loadTextureInfoAsync(`${context}/normalTexture`, material.normalTexture, (texture) => {
|
|
|
texture.name = `${babylonMaterial.name} (Normal)`;
|
|
|
babylonMaterial.bumpTexture = texture;
|
|
|
- }, false));
|
|
|
+ }));
|
|
|
|
|
|
babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;
|
|
|
babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;
|
|
@@ -1866,10 +1868,11 @@ export class GLTFLoader implements IGLTFLoader {
|
|
|
}
|
|
|
|
|
|
if (material.occlusionTexture) {
|
|
|
+ material.occlusionTexture.isNotColorData = true;
|
|
|
promises.push(this.loadTextureInfoAsync(`${context}/occlusionTexture`, material.occlusionTexture, (texture) => {
|
|
|
texture.name = `${babylonMaterial.name} (Occlusion)`;
|
|
|
babylonMaterial.ambientTexture = texture;
|
|
|
- }, false));
|
|
|
+ }));
|
|
|
|
|
|
babylonMaterial.useAmbientInGrayScale = true;
|
|
|
if (material.occlusionTexture.strength != undefined) {
|
|
@@ -1932,11 +1935,10 @@ export class GLTFLoader implements IGLTFLoader {
|
|
|
* @param context The context when loading the asset
|
|
|
* @param textureInfo The glTF texture info property
|
|
|
* @param assign A function called synchronously after parsing the glTF properties
|
|
|
- * @param isColorData true if the texture held color data, else false
|
|
|
* @returns A promise that resolves with the loaded Babylon texture when the load is complete
|
|
|
*/
|
|
|
- public loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void = () => { }, isColorData = true): Promise<BaseTexture> {
|
|
|
- const extensionPromise = this._extensionsLoadTextureInfoAsync(context, textureInfo, assign, isColorData);
|
|
|
+ public loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void = () => { }): Promise<BaseTexture> {
|
|
|
+ const extensionPromise = this._extensionsLoadTextureInfoAsync(context, textureInfo, assign);
|
|
|
if (extensionPromise) {
|
|
|
return extensionPromise;
|
|
|
}
|
|
@@ -1953,7 +1955,7 @@ export class GLTFLoader implements IGLTFLoader {
|
|
|
GLTFLoader.AddPointerMetadata(babylonTexture, context);
|
|
|
this._parent.onTextureLoadedObservable.notifyObservers(babylonTexture);
|
|
|
assign(babylonTexture);
|
|
|
- }, isColorData);
|
|
|
+ });
|
|
|
|
|
|
this.logClose();
|
|
|
|
|
@@ -1961,8 +1963,8 @@ export class GLTFLoader implements IGLTFLoader {
|
|
|
}
|
|
|
|
|
|
/** @hidden */
|
|
|
- public _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void = () => { }, isColorData = true): Promise<BaseTexture> {
|
|
|
- const extensionPromise = this._extensionsLoadTextureAsync(context, texture, assign, isColorData);
|
|
|
+ public _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void = () => { }): Promise<BaseTexture> {
|
|
|
+ const extensionPromise = this._extensionsLoadTextureAsync(context, texture, assign);
|
|
|
if (extensionPromise) {
|
|
|
return extensionPromise;
|
|
|
}
|
|
@@ -2339,12 +2341,12 @@ export class GLTFLoader implements IGLTFLoader {
|
|
|
return this._applyExtensions(material, "loadMaterialProperties", (extension) => extension.loadMaterialPropertiesAsync && extension.loadMaterialPropertiesAsync(context, material, babylonMaterial));
|
|
|
}
|
|
|
|
|
|
- private _extensionsLoadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void, isColorData: boolean): Nullable<Promise<BaseTexture>> {
|
|
|
- return this._applyExtensions(textureInfo, "loadTextureInfo", (extension) => extension.loadTextureInfoAsync && extension.loadTextureInfoAsync(context, textureInfo, assign, isColorData));
|
|
|
+ private _extensionsLoadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {
|
|
|
+ return this._applyExtensions(textureInfo, "loadTextureInfo", (extension) => extension.loadTextureInfoAsync && extension.loadTextureInfoAsync(context, textureInfo, assign));
|
|
|
}
|
|
|
|
|
|
- private _extensionsLoadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void, isColorData: boolean): Nullable<Promise<BaseTexture>> {
|
|
|
- return this._applyExtensions(texture, "loadTexture", (extension) => extension._loadTextureAsync && extension._loadTextureAsync(context, texture, assign, isColorData));
|
|
|
+ private _extensionsLoadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {
|
|
|
+ return this._applyExtensions(texture, "loadTexture", (extension) => extension._loadTextureAsync && extension._loadTextureAsync(context, texture, assign));
|
|
|
}
|
|
|
|
|
|
private _extensionsLoadAnimationAsync(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>> {
|