UNPKG

nanogl-gltf

Version:
70 lines (69 loc) 2.22 kB
import { vec4, vec3 } from 'gl-matrix'; import { StandardPass } from 'nanogl-pbr/StandardPass'; import TextureInfo from '../../elements/TextureInfo'; import GltfLoader from '../../io/GltfLoader'; import Gltf2 from '../../types/Gltf2'; /** * Data interface for PbrSpecularGlossiness */ export interface IMaterialPbrSpecularGlossiness { /** * The reflected diffuse factor of the material. */ diffuseFactor?: number[]; /** * The diffuse texture. */ diffuseTexture?: Gltf2.ITextureInfo; /** * The specular RGB color of the material. */ specularFactor?: number[]; /** * The glossiness or smoothness of the material. */ glossinessFactor?: number; /** * The specular-glossiness texture. */ specularGlossinessTexture?: Gltf2.ITextureInfo; } /** * The PbrSpecularGlossiness element contains the base properties for a PBR material, using the specular-glossiness workflow. */ export default class PbrSpecularGlossiness { /** * The reflected diffuse factor of the material. Default to [1, 1, 1, 1] */ diffuseFactor: vec4; /** * The specular RGB color of the material. Default to [1, 1, 1] */ specularFactor: vec3; /** * The glossiness or smoothness of the material. Default to 1 */ glossinessFactor: number; /** * The diffuse TextureInfo. */ diffuseTexture?: TextureInfo; /** * The specular-glossiness TextureInfo. */ specularGlossinessTexture?: TextureInfo; /** * Parse the PbrSpecularGlossiness data, filling the class properties. * * Is async as it may need to wait for diffuseTexture and specularGlossinessTexture to be loaded. * @param gltfLoader GLTFLoader to use * @param data Data to parse */ parse(gltfLoader: GltfLoader, data: IMaterialPbrSpecularGlossiness): Promise<any>; /** * Setup the PbrSpecularGlossiness data on a nanogl-pbr StandardPass by attaching diffuse (on surface.baseColor) * and specularGlossiness textures with samplers and their strength factors. It uses a nanogl-pbr SpecularSurface. * @param pass Pass to setup */ setupPass(pass: StandardPass): void; }