import { type ITextureInfo, type IMaterialPbrMetallicRoughness } from "babylonjs-gltf2interface"; import { type Nullable } from "@babylonjs/core/types.js"; import { type BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js"; import { type GLTFExporter } from "./glTFExporter.js"; import { type StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js"; import { PBRBaseMaterial } from "@babylonjs/core/Materials/PBR/pbrBaseMaterial.js"; import { OpenPBRMaterial } from "@babylonjs/core/Materials/PBR/openpbrMaterial.js"; /** * Computes the metallic factor from specular glossiness values. * @param diffuse diffused value * @param specular specular value * @param oneMinusSpecularStrength one minus the specular strength * @returns metallic value * @internal */ export declare function _SolveMetallic(diffuse: number, specular: number, oneMinusSpecularStrength: number): number; /** * Computes the metallic/roughness factors from a Standard Material. * @internal */ export declare function _ConvertToGLTFPBRMetallicRoughness(babylonStandardMaterial: StandardMaterial): IMaterialPbrMetallicRoughness; /** * Utility methods for working with glTF material conversion properties. * @internal */ export declare class GLTFMaterialExporter { private readonly _exporter; private _textureMap; private _internalTextureToImage; constructor(_exporter: GLTFExporter); getTextureInfo(babylonTexture: Nullable): Nullable; exportStandardMaterialAsync(babylonStandardMaterial: StandardMaterial, hasUVs: boolean): Promise; private _finishMaterialAsync; /** * Resizes the two source textures to the same dimensions. If a texture is null, a default white texture is generated. If both textures are null, returns null * @param texture1 first texture to resize * @param texture2 second texture to resize * @param scene babylonjs scene * @returns resized textures or null */ private _resizeTexturesToSameDimensions; /** * Convert Specular Glossiness Textures to Metallic Roughness * See link below for info on the material conversions from PBR Metallic/Roughness and Specular/Glossiness * @see https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness/examples/convert-between-workflows-.js/babylon.pbrUtilities.js * @param diffuseTexture texture used to store diffuse information * @param specularGlossinessTexture texture used to store specular and glossiness information * @param factors specular glossiness material factors * @returns pbr metallic roughness interface or null */ private _convertSpecularGlossinessTexturesToMetallicRoughnessAsync; /** * Converts specular glossiness material properties to metallic roughness * @param specularGlossiness interface with specular glossiness material properties * @returns interface with metallic roughness material properties */ private _convertSpecularGlossinessToMetallicRoughness; /** * Calculates the surface reflectance, independent of lighting conditions * @param color Color source to calculate brightness from * @returns number representing the perceived brightness, or zero if color is undefined */ private _getPerceivedBrightness; /** * Returns the maximum color component value * @param color * @returns maximum color component value, or zero if color is null or undefined */ private _getMaxComponent; /** * Convert a PBRMaterial (Metallic/Roughness) to Metallic Roughness factors * @param baseColor Base color of the material * @param metallic Metallic factor of the material * @param roughness Roughness factor of the material * @param albedoTexture Albedo texture of the material * @param metallicTexture Metallic texture of the material * @param roughnessTexture Roughness texture of the material * @param babylonPBRMaterial BJS PBR Metallic Roughness Material * @param glTFPbrMetallicRoughness glTF PBR Metallic Roughness interface * @param hasUVs specifies if texture coordinates are present on the submesh to determine if textures should be applied * @returns glTF PBR Metallic Roughness factors */ private _convertMetalRoughFactorsToMetallicRoughnessAsync; private _getTextureSampler; private _getGLTFTextureWrapMode; /** * Convert a PBRMaterial (Specular/Glossiness) to Metallic Roughness factors * @param babylonPBRMaterial BJS PBR Metallic Roughness Material * @param pbrMetallicRoughness glTF PBR Metallic Roughness interface * @param hasUVs specifies if texture coordinates are present on the submesh to determine if textures should be applied * @returns glTF PBR Metallic Roughness factors */ private _convertSpecGlossFactorsToMetallicRoughnessAsync; exportPBRMaterialAsync(babylonPBRMaterial: PBRBaseMaterial, hasUVs: boolean): Promise; private _setMetallicRoughnessPbrMaterialAsync; exportOpenPBRMaterialAsync(babylonOpenPBRMaterial: OpenPBRMaterial, hasUVs: boolean): Promise; exportTextureAsync(babylonTexture: BaseTexture, overrideId?: Nullable): Promise>; private _exportTextureImageAsync; private _exportImageAsync; private _exportTextureInfo; private _exportTextureSampler; }