/** * Tracks the texture transforms of a StandardMaterial: which maps are assigned, the transform * computed from the tiling, offset and rotation of each, and the groups of maps sharing a * transform on a uv set, which the shader uses to transform each uv set once per unique transform. * The transforms are stored in the material uniform buffer: the tracker adds their uniforms to the * layout of the material while a map is assigned and marks them modified when the transform * changes, so that {@link Material#update} writes them. * * @ignore */ export class StandardMaterialMapTransforms { /** * True when a map, tiling, offset, rotation or uv set was assigned since the last update. * * @type {boolean} * @private */ private _dirty; /** * True when a tiling or offset was exposed by a getter since the last update, and may have * been changed in place. * * @type {boolean} * @private */ private _mutable; /** * The transform group id of each map, 0 for a map without a transform. * * @type {Map} * @private */ private _ids; /** * The state of each map as of the last update: assigned, uv set, tiling, offset and rotation. * * @type {Map} * @private */ private _states; /** * The computed transform of each assigned map, the two vec3 uniforms in a row. * * @type {Map} * @private */ private _values; /** * The property descriptors of the material, the typed properties followed by the transforms of * the assigned maps, rebuilt when the set of assigned maps changes. * * @type {MaterialProperty[]|null} * @private */ private _descriptors; reset(): void; markDirty(): void; markMutable(): void; /** * Returns the property descriptors of the material: the given typed properties, followed by * the transforms of the maps assigned as of the last update. * * @param {MaterialProperty[]} properties - The typed properties of the material. * @returns {MaterialProperty[]} The descriptors. */ getDescriptors(properties: MaterialProperty[]): MaterialProperty[]; /** * Returns the descriptor of a transform uniform stored in the material uniform buffer, or null * when the name is not a transform uniform or its map is not assigned. * * @param {string} uniformName - The name of the uniform. * @returns {MaterialProperty|null} The descriptor. */ getUniformProperty(uniformName: string): MaterialProperty | null; /** * Writes one half of the transform of a map, three floats, into the storage of the material * uniform buffer. * * @param {string} name - The name of the map. * @param {number} half - 0 for the first uniform of the transform, 1 for the second. * @param {Float32Array} storage - The storage. * @param {number} offset - The element offset of the uniform. */ write(name: string, half: number, storage: Float32Array, offset: number): void; /** * Applies the changes made since the last update: recomputes the transforms of the changed maps * and marks their uniforms modified, marks the layout of the material changed when a map was * assigned or removed, and regroups the transforms. * * @param {StandardMaterial} material - The material. * @returns {boolean} True when the transform groups changed, which selects different shader code. */ update(material: StandardMaterial): boolean; /** * Collects the names of the map properties changed since the last update, for the debug * warning about changes made without a subsequent update. * * @param {StandardMaterial} material - The material. * @param {string[]} names - The names to add to. */ collectUnapplied(material: StandardMaterial, names: string[]): void; /** * @param {string} p - The name of the map. * @param {import('../../core/math/vec2.js').Vec2} tiling - The tiling. * @param {import('../../core/math/vec2.js').Vec2} offset - The offset. * @param {number} rotation - The rotation in degrees. * @private */ private _compute; /** * Groups the assigned maps with a transform by uv set and equal transform, so that the shader * transforms each uv set once per unique transform. A map without a transform has the id 0. * * @returns {boolean} True when the group of any map changed. * @private */ private _updateIds; getId(name: any): number; } import { MaterialProperty } from './material-property.js'; import type { StandardMaterial } from './standard-material.js';