UNPKG

@itwin/core-frontend

Version:
55 lines 2.32 kB
/** @packageDocumentation * @module WebGL */ import { RenderMaterial, RenderMaterialParams } from "@itwin/core-common"; import { SurfaceMaterial, SurfaceMaterialAtlas } from "../../../common/internal/render/SurfaceParams"; /** Parameters describing a single material. The parameters used are: * - diffuse color rgb (vec3). * - alpha (float in [0..1]) * - is rgb overridden (bool) * - is alpha overridden (bool) * - specular exponent (float). * - specular color (vec3). * - specular weight (float in [0..1]) * - diffuse weight (float in [0..1]) * - texture weight (float in [0..1]) * * The rgb and alpha are applied in the vertex shader. Either can be negative, indicating the material does not override it. * * The rest are passed as a varying vec4 to be applied in the fragment shader. * All but the specular exponent are compressed such that floats in [0..1] become integers in [0..255] and concatenated bitwise in pairs into 16-bit integer values. * * The result is: * x: diffuse and specular weights * y: texture weight and specular red * z: specular green and blue * w: specular exponent * * This packing is motivated by the limited max number of varying vectors guaranteed by WebGL. * A varying is used because: * 1. Material atlases require looking up the material associated with a particular vertex; and * 2. The vertex material may be replaced with a default material based on other criteria such as view flags and feature symbology overrides. * @internal */ export declare class Material extends RenderMaterial { static readonly default: Material; readonly isAtlas: false; readonly fragUniforms: Float32Array; readonly rgba: Float32Array; get overridesRgb(): boolean; get overridesAlpha(): boolean; get hasTranslucency(): boolean; /** Strictly for testing. */ static preserveParams: boolean; /** Strictly for testing. */ params?: RenderMaterialParams; constructor(params: RenderMaterialParams); private setInteger; } /** Describes the material associated with a surface. * @internal */ export type MaterialInfo = Material | SurfaceMaterialAtlas; /** @internal */ export declare function createMaterialInfo(source: SurfaceMaterial | undefined): MaterialInfo | undefined; //# sourceMappingURL=Material.d.ts.map