"use strict"; const FrameMaterialDebug = (function(){ const FrameMaterialDebug = function(){ const face_cache = {}, edge_cache = {}; /** * Retorna el material de caras sólidas para la distancia al piso actual. * @param {number} dist - Distancia en pisos |model.y - current_floor| */ this.get_face_material = dist => { const key = String(dist); if(!face_cache[key]){ // Piso activo: 0.55 de opacidad; pisos lejanos: decae progresivamente const opacity = dist === 0 ? 0.55 : Math.max(0.08, 0.35 / (dist * 1.5)); face_cache[key] = new THREE.MeshBasicMaterial({ color : dist === 0 ? 0xf1f5f9 : 0x94a3b8, // Blanco roto en foco, gris azulado fuera transparent : true, opacity : opacity, depthWrite : false }); } return face_cache[key]; }; /** * Retorna el material de aristas para la distancia al piso actual. * @param {number} dist - Distancia en pisos |model.y - current_floor| */ this.get_edge_material = dist => { const key = String(dist); if(!edge_cache[key]){ const opacity = dist === 0 ? 1.0 : Math.max(0.15, 0.6 / (dist * 1.4)); edge_cache[key] = new THREE.LineBasicMaterial({ color : dist === 0 ? 0xffffff : 0xcbd5e1, // Blanco brillante en foco transparent : true, opacity : opacity, depthWrite : false }); } return edge_cache[key]; }; this.reset = () => { for(const key in face_cache){ if(face_cache[key]){ face_cache[key].dispose(); delete face_cache[key]; } } for(const key in edge_cache){ if(edge_cache[key]){ edge_cache[key].dispose(); delete edge_cache[key]; } } }; }; return FrameMaterialDebug; })();