/** * MaterialLibrary.ts * * PBR material system: material definitions, texture slots, * instancing, and preset materials. * * @module rendering */ export type BlendMode = 'opaque' | 'transparent' | 'additive' | 'multiply'; export type CullMode = 'none' | 'front' | 'back'; /** * Material type classification for UI and editor workflows. * Maps to high-level rendering strategies. */ export type MaterialType = 'standard' | 'physical' | 'basic' | 'emissive' | 'toon' | 'glass' | 'metal'; export interface TextureSlot { textureId: string; uvChannel: number; tiling: { x: number; y: number; }; offset: { x: number; y: number; }; } /** * Unified PBR material definition. * * This is the single canonical material type used across all HoloScript * subsystems: the rendering MaterialLibrary, the MaterialEditor tool, * shader graphs, and export compilers. * * Color values use linear RGBA objects (not hex strings) for precision * and compatibility with GPU pipelines. */ export interface MaterialDef { id: string; name: string; /** High-level material classification for editor UI (default: 'standard') */ materialType?: MaterialType; albedo: { r: number; g: number; b: number; a: number; }; metallic: number; roughness: number; emission: { r: number; g: number; b: number; }; emissionStrength: number; normalScale: number; aoStrength: number; albedoMap?: TextureSlot; normalMap?: TextureSlot; metallicRoughnessMap?: TextureSlot; emissionMap?: TextureSlot; aoMap?: TextureSlot; blendMode: BlendMode; cullMode: CullMode; depthWrite: boolean; depthTest: boolean; doubleSided: boolean; shaderGraphId?: string; customUniforms?: Record; /** Arbitrary extension properties for editor/plugin use */ properties?: Record; } /** * Convert a hex color string (#RRGGBB or #RRGGBBAA) to an RGBA object * with linear color values (0-1). */ export declare function hexToRGBA(hex: string): { r: number; g: number; b: number; a: number; }; /** * Convert an RGBA object (0-1 values) to a hex color string (#RRGGBB). */ export declare function rgbaToHex(color: { r: number; g: number; b: number; a?: number; }): string; /** * Create a default MaterialDef with sensible PBR defaults. * Useful for editors and tools that need a starting point. */ export declare function createDefaultMaterialDef(id: string, name?: string, materialType?: MaterialType): MaterialDef; export interface MaterialInstance { id: string; baseMaterialId: string; overrides: Partial; } export declare const MATERIAL_PRESETS: Record>; export declare class MaterialLibrary { private materials; private instances; constructor(); register(material: MaterialDef): void; registerPreset(presetName: string, id?: string): MaterialDef | null; unregister(id: string): void; getMaterial(id: string): MaterialDef | undefined; getMaterialCount(): number; getAllMaterials(): MaterialDef[]; createInstance(baseMaterialId: string, overrides?: Partial): MaterialInstance | null; /** * Resolve an instance to its full material definition. */ resolveInstance(instanceId: string): MaterialDef | null; getInstance(id: string): MaterialInstance | undefined; getInstanceCount(): number; setTexture(materialId: string, slot: keyof Pick, textureId: string): boolean; } //# sourceMappingURL=MaterialLibrary.d.ts.map