/** * MaterialEditor.ts * * Material Editor with Live Preview * Unity/Substance-style material editing with real-time preview sphere. * Supports PBR materials, procedural textures, and visual presets. * * Uses the unified MaterialDef type from the rendering MaterialLibrary, * eliminating duplicate PBR schemas across the codebase. */ import type { MaterialDef } from '@holoscript/engine/rendering/MaterialLibrary'; export type { MaterialDef, MaterialType } from '@holoscript/engine/rendering/MaterialLibrary'; export { hexToRGBA, rgbaToHex, createDefaultMaterialDef, } from '@holoscript/engine/rendering/MaterialLibrary'; /** * @deprecated Use MaterialDef from rendering/MaterialLibrary instead. * This alias is kept for backward compatibility. */ export type Material = MaterialDef; /** * Material preset for the editor UI */ export interface MaterialEditorPreset { /** Preset name */ name: string; /** Preset category */ category: string; /** Material configuration overrides */ material: Partial; /** Preview color (hex string for CSS rendering) */ previewColor: string; } /** * @deprecated Use MaterialEditorPreset instead. */ export type MaterialPreset = MaterialEditorPreset; /** * Material editor configuration */ export interface MaterialEditorConfig { /** Container element */ container?: HTMLElement; /** Enable live preview */ livePreview?: boolean; /** Preview resolution */ previewResolution?: number; /** Auto-save */ autoSave?: boolean; /** Debug mode */ debug?: boolean; /** Theme */ theme?: 'light' | 'dark'; } /** * Material Editor * * Professional material editing with live preview sphere. * All materials use the unified MaterialDef type from the rendering subsystem. */ export declare class MaterialEditor { private readonly config; private materials; private currentMaterialId; private container; private previewCanvas; private previewRenderer; private previewScene; private previewCamera; private previewSphere; private static readonly PRESETS; constructor(config?: MaterialEditorConfig); /** * Initialize editor UI */ private initializeUI; /** * Generate editor HTML */ private generateEditorHTML; /** * Initialize 3D preview */ private initializePreview; /** * Animate preview sphere */ private animatePreview; /** * Attach event listeners */ private attachEventListeners; /** * Update material type */ private updateMaterialType; /** * Update preview material (THREE.js sphere). * Accepts hex color strings for THREE.js Color.set() compatibility. */ private updatePreviewMaterial; /** * Save current material. * Returns a fully-formed MaterialDef (the unified PBR type). */ saveMaterial(): MaterialDef; /** * Get current material configuration from the editor UI. * Reads hex color values from DOM inputs and converts to RGBA objects * for the unified MaterialDef type. */ getCurrentMaterial(): MaterialDef; /** * Load a MaterialDef into the editor UI. * Converts RGBA objects back to hex strings for DOM color inputs. */ loadMaterial(material: MaterialDef): void; /** * Load a preset by name. * Merges preset overrides with default MaterialDef values. */ loadPreset(presetName: string): void; /** * Update presets list */ private updatePresetsList; /** * Get all materials (returns unified MaterialDef objects) */ getMaterials(): MaterialDef[]; /** * Get presets */ static getPresets(): MaterialEditorPreset[]; /** * Dispose editor */ dispose(): void; } //# sourceMappingURL=MaterialEditor.d.ts.map