/** * Describes a typed material property whose value is stored in the material uniform buffer: the * public property name, the uniform it feeds, the uniform type and the conversion from the public * value to the uniform data. Descriptors are static, one per property of a material class, and * are shared by all instances of that class. * * @ignore */ export class MaterialProperty { /** * @param {string} name - The public property name. * @param {string} uniformName - The name of the uniform in the material uniform buffer. * @param {number} type - The type of the uniform, one of UNIFORMTYPE_***. * @param {(value: any, storage: Float32Array, offset: number, material: Material) => void} convert - Converts * the public value into the uniform data, reading any other property it depends on from the * material. * @param {number} [count] - The array size of the uniform. Defaults to 0 (not an array). */ constructor(name: string, uniformName: string, type: number, convert: (value: any, storage: Float32Array, offset: number, material: Material) => void, count?: number); /** * The public property name, for example 'diffuse'. * * @type {string} */ name: string; /** * The name of the field storing the public value on the material, for example '_diffuse'. * * @type {string} */ backingName: string; /** * The name of the uniform in the material uniform buffer, for example 'material_diffuse'. * * @type {string} */ uniformName: string; /** * The type of the uniform, one of UNIFORMTYPE_***. * * @type {number} */ type: number; /** * The array size of the uniform, 0 for a non-array uniform. * * @type {number} */ count: number; /** * Writes the uniform data for a public value into the float storage of a uniform buffer at * the given element offset. A uniform derived from several properties reads the others from * the material. * * @type {(value: any, storage: Float32Array, offset: number, material: Material) => void} */ convert: (value: any, storage: Float32Array, offset: number, material: Material) => void; /** * A string describing the uniform of the property, used to build and order the layout key. * * @type {string} */ key: string; } /** * Converts an sRGB color to a linear RGB uniform value. * * @param {Color} color - The color in sRGB space. * @param {Float32Array} storage - The uniform buffer storage. * @param {number} offset - The element offset of the uniform in the storage. * @ignore */ export function convertColorToLinear(color: Color, storage: Float32Array, offset: number): void; /** * Writes a number to a float uniform value. * * @param {number} value - The number. * @param {Float32Array} storage - The uniform buffer storage. * @param {number} offset - The element offset of the uniform in the storage. * @ignore */ export function convertFloat(value: number, storage: Float32Array, offset: number): void; import type { Material } from './material.js'; import { Color } from '../../core/math/color.js';