kikocis/VibeCodeViewer public
Changesets · Branches · Tags · Compare
| Changeset | 25fac166e770bc3ded7c7e329791b09d7707334faad0402abac908e6598f86ef |
|---|---|
| Author | Sendery <sendery@gmail.com> · 2026-06-22 20:24 +02:00 |
| Committer | Sendery <sendery@gmail.com> · 2026-06-22 20:24 +02:00 |
| Parents | 26f65a4fb4c5, 4116077e169b |
10 files changed
modified README.md +97 −7
| @@ -2,8 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | Ciudad procedural de **edificios de cristal** (Three.js) que visualiza un |
| 4 | 4 | repositorio de código como una metrópolis estilo *hacker noventero*: wireframes |
| 5 | -cian nítidos, suelo de placa de circuito impreso y bloom selectivo solo en lo | |
| 6 | -que se resalta — nada de neblina permanente. | |
| 5 | +cian nítidos, suelo de placa de circuito impreso y controles visuales para | |
| 6 | +subir el dramatismo sin depender del postprocesado HDR. | |
| 7 | 7 | |
| 8 | 8 | ## Mapeo repo → ciudad |
| 9 | 9 | |
| @@ -38,11 +38,14 @@ | ||
| 38 | 38 | |
| 39 | 39 | ## Receta anti-difuminado |
| 40 | 40 | |
| 41 | -1. Aristas finas con **colores HDR** en un único `LineSegments` (rangos de | |
| 42 | - color por nodo): el bloom (umbral 0.85) solo se dispara en lo resaltado. | |
| 41 | +1. Aristas finas en un único `LineSegments` (rangos de color por nodo), con | |
| 42 | + color y opacidad ajustables desde **Settings**. | |
| 43 | 43 | 2. Cristal **fresnel** de opacidad mínima (α ≈ 0.02 en el centro de la cara). |
| 44 | 44 | 3. Cero volúmenes aditivos permanentes: los rellenos solo existen mientras un |
| 45 | 45 | nivel está encendido (pool de 10 cajas reutilizables). |
| 46 | +4. Render directo por defecto: el antiguo composer HDR/bloom queda como modo | |
| 47 | + experimental (`?bloom=1`) porque algunos drivers producen rectángulos | |
| 48 | + negros screen-space al orbitar. | |
| 46 | 49 | |
| 47 | 50 | ## Extras |
| 48 | 51 | |
| @@ -64,6 +67,11 @@ | ||
| 64 | 67 | late suavemente. |
| 65 | 68 | - **Sugerencias de búsqueda**: mientras escribes, todos los ficheros que |
| 66 | 69 | casan parpadean en la ciudad y se resaltan en las fachadas de sus edificios. |
| 70 | +- **Settings**: panel modal bajo `Reset Vista` con presets visuales y sliders | |
| 71 | + persistentes para exposición, brillo, contraste, saturación, aristas, | |
| 72 | + celdas, cristal, fachadas, rótulos, suelo y niebla. Incluye un toggle | |
| 73 | + explícito para probar **Bloom HDR**; al cambiarlo recarga con/sin | |
| 74 | + `?bloom=1`. | |
| 67 | 75 | |
| 68 | 76 | ## Modos de coloreado |
| 69 | 77 | |
| @@ -134,6 +142,48 @@ | ||
| 134 | 142 | los sótanos; opaco escribe profundidad y los **oculta de verdad** (desde |
| 135 | 143 | debajo, en modo vuelo, se siguen viendo). |
| 136 | 144 | |
| 145 | +## Ajustes visuales y bloom | |
| 146 | + | |
| 147 | +El botón **Settings** abre un panel con cuatro presets: | |
| 148 | + | |
| 149 | +- **Seguro**: valores base, render directo. | |
| 150 | +- **Neón**: más saturación y brillo, recomendado para recuperar impacto sin | |
| 151 | + pasar por bloom. | |
| 152 | +- **Cine**: más contraste, niebla algo más densa y suelo menos dominante. | |
| 153 | +- **Intenso**: mayor exposición y potencia de aristas/celdas; es el preset más | |
| 154 | + agresivo probado sin artefactos negros. | |
| 155 | + | |
| 156 | +Los sliders se aplican en caliente y se guardan en `localStorage` bajo | |
| 157 | +`vcc.visualSettings.v1`. El HUD indica si estás en `render directo` o en | |
| 158 | +`bloom ×N`. | |
| 159 | + | |
| 160 | +`?bloom=1` activa el pipeline `EffectComposer` + `UnrealBloomPass`. Se conserva | |
| 161 | +para experimentación, pero no es el modo por defecto: en algunas GPUs/drivers | |
| 162 | +ese render target HDR genera cuadros negros alineados a pantalla durante la | |
| 163 | +órbita. Para volver al modo estable, quita `bloom` de la URL o desmarca | |
| 164 | +**Bloom HDR** en Settings. | |
| 165 | + | |
| 166 | +## Diagnóstico GPU | |
| 167 | + | |
| 168 | +La detección se basa en el renderer WebGL real que entrega el navegador | |
| 169 | +(`WEBGL_debug_renderer_info` cuando está disponible). En Windows/WSLg o capas | |
| 170 | +virtualizadas puede aparecer como `D3D12 virtual`, `Mesa` o `Microsoft` aunque | |
| 171 | +el host tenga una NVIDIA; en ese caso la app lo trata como hardware acelerado, | |
| 172 | +pero no puede inventar la marca si WebGL la oculta. | |
| 173 | + | |
| 174 | +El arranque escribe en consola algo como: | |
| 175 | + | |
| 176 | +```text | |
| 177 | +[gpu] NVIDIA · nivel alta · renderer "ANGLE (...)" · vendor "..." | |
| 178 | +``` | |
| 179 | + | |
| 180 | +Overrides útiles para depurar: | |
| 181 | + | |
| 182 | +- `?gpu=nvidia` fuerza etiqueta/perfil NVIDIA cuando el host sí tiene NVIDIA | |
| 183 | + pero el navegador solo reporta una capa virtual. | |
| 184 | +- `?msaa=N` y `?pr=N` fuerzan multisampling de render target y pixel ratio. | |
| 185 | +- `?bloom=1` activa el composer HDR experimental. | |
| 186 | + | |
| 137 | 187 | ## Teclado en el árbol |
| 138 | 188 | |
| 139 | 189 | Con el árbol enfocado (clic sobre él): `↑`/`↓` mueven el cursor, `→` |
| @@ -201,6 +251,41 @@ | ||
| 201 | 251 | node scan.mjs /otra/ruta # o cualquier otro árbol |
| 202 | 252 | ``` |
| 203 | 253 | |
| 254 | +## Verificación visual automatizada | |
| 255 | + | |
| 256 | +Hay tres herramientas para grabar órbitas y detectar regresiones de cuadros | |
| 257 | +negros: | |
| 258 | + | |
| 259 | +```bash | |
| 260 | +# 1. Levanta la app y un Chromium con DevTools remoto. | |
| 261 | +./serve.sh 8137 | |
| 262 | +chromium-browser --headless --disable-gpu-sandbox --no-sandbox \ | |
| 263 | + --remote-debugging-port=9223 --window-size=2048,1152 about:blank | |
| 264 | + | |
| 265 | +# 2. Captura una órbita con un tema/preset. | |
| 266 | +node tools/capture-orbit.mjs \ | |
| 267 | + --url=http://localhost:8137/ \ | |
| 268 | + --out=/tmp/vcc-orbit \ | |
| 269 | + --frames=120 --width=2048 --height=1152 --port=9223 --theme=matrix \ | |
| 270 | + --visuals='{"exposure":1.24,"brightness":1.08,"contrast":1.28,"saturate":1.65,"lines":1.22,"files":1.35,"glass":1.16,"facades":1.12,"labels":1.45,"ground":1.08,"fog":0.92}' | |
| 271 | + | |
| 272 | +# 3. Genera un vídeo opcional. | |
| 273 | +ffmpeg -y -framerate 30 -i /tmp/vcc-orbit/frame-%04d.png \ | |
| 274 | + -pix_fmt yuv420p /tmp/vcc-orbit.mp4 | |
| 275 | + | |
| 276 | +# 4. Detecta cuadros negros en una órbita. | |
| 277 | +python3 tools/detect-black-rects.py /tmp/vcc-orbit | |
| 278 | + | |
| 279 | +# 5. Detecta el caso de una captura suelta, más sensible a ventanas negras. | |
| 280 | +python3 tools/detect-black-rects.py --scan-windows captura.png | |
| 281 | + | |
| 282 | +# 6. Compara un candidato contra un baseline estable. | |
| 283 | +python3 tools/compare-black-regressions.py /tmp/candidato /tmp/baseline | |
| 284 | +``` | |
| 285 | + | |
| 286 | +`tools/detect-black-rects.py` usa Pillow/NumPy en lugar de OpenCV para no | |
| 287 | +añadir dependencias nuevas. Devuelve código 1 cuando encuentra frames malos. | |
| 288 | + | |
| 204 | 289 | ## Modo test: `./serve.sh --test N M [K]` |
| 205 | 290 | |
| 206 | 291 | Genera un `src/data.js` sintético y determinista (`tools/gentest.mjs`) para |
| @@ -261,8 +346,9 @@ | ||
| 261 | 346 | | `W A S D` / ratón | mover · mirar (en vuelo) | |
| 262 | 347 | | `Space`/`E` · `C`/`Q` | subir · bajar · `Shift` turbo | |
| 263 | 348 | | `1` `2` `3` | Reset Vista · Vista Aérea · Vista Altura Edificios | |
| 349 | +| `L` · `G` | leyenda · suelo opaco | | |
| 264 | 350 | | `X` · `/` | limpiar selección · enfocar el buscador | |
| 265 | -| `Esc` | salir del vuelo / cerrar buscador | | |
| 351 | +| `Esc` | salir del vuelo / cerrar buscador / cerrar Settings | | |
| 266 | 352 | |
| 267 | 353 | ## Estructura |
| 268 | 354 | |
| @@ -274,7 +360,11 @@ | ||
| 274 | 360 | model.js jerarquía + layout (cajas anidadas, empaquetado urbano) |
| 275 | 361 | builder.js escena: aristas HDR, cristal fresnel, fachadas, suelo PCB |
| 276 | 362 | controls.js órbita + vuelo libre + vuelos de cámara |
| 277 | - ui.js árbol lateral, buscador, ruta, stats | |
| 278 | - main.js selección jerárquica, raycast, bucle de render | |
| 363 | + ui.js árbol lateral, buscador, ruta, stats, Settings | |
| 364 | + main.js selección jerárquica, raycast, render y ajustes visuales | |
| 365 | +tools/ | |
| 366 | + capture-orbit.mjs captura órbitas vía Chrome DevTools Protocol | |
| 367 | + detect-black-rects.py detector de cuadros negros en frames/capturas | |
| 368 | + compare-black-regressions.py compara órbitas contra baseline visual | |
| 279 | 369 | vendor/ Three.js r160 + addons (offline) |
| 280 | 370 | ``` |
modified index.html +30 −0
| @@ -31,6 +31,7 @@ | ||
| 31 | 31 | <button id="btn-aerial">Vista Aérea</button> |
| 32 | 32 | <button id="btn-skyline">Vista Altura Edificios</button> |
| 33 | 33 | <button id="btn-reset">Reset Vista</button> |
| 34 | + <button id="btn-settings" onclick="window.VCCOpenSettings?.()">Settings</button> | |
| 34 | 35 | <button id="btn-legend">Leyenda</button> |
| 35 | 36 | <button id="btn-ground">Suelo Opaco</button> |
| 36 | 37 | <select id="theme-select" title="Tema de color"></select> |
| @@ -71,6 +72,35 @@ | ||
| 71 | 72 | |
| 72 | 73 | <div id="crosshair">+</div> |
| 73 | 74 | |
| 75 | + <div id="settings-modal" aria-hidden="true"> | |
| 76 | + <div id="settings-panel" role="dialog" aria-modal="true" aria-labelledby="settings-title"> | |
| 77 | + <div class="settings-head"> | |
| 78 | + <div id="settings-title" class="title">Settings</div> | |
| 79 | + <button id="settings-close" title="Cerrar" onclick="window.VCCCloseSettings?.()">×</button> | |
| 80 | + </div> | |
| 81 | + <div id="settings-presets"></div> | |
| 82 | + <div id="settings-controls"></div> | |
| 83 | + <div class="settings-foot"> | |
| 84 | + <label class="check-row"><input id="setting-bloom" type="checkbox"> Bloom HDR</label> | |
| 85 | + <button id="settings-reset">Reset Settings</button> | |
| 86 | + </div> | |
| 87 | + </div> | |
| 88 | + </div> | |
| 89 | + | |
| 74 | 90 | <script type="module" src="src/main.js"></script> |
| 91 | + <script> | |
| 92 | + window.VCCOpenSettings = () => { | |
| 93 | + const modal = document.getElementById('settings-modal'); | |
| 94 | + if (!modal) return; | |
| 95 | + modal.classList.add('show'); | |
| 96 | + modal.setAttribute('aria-hidden', 'false'); | |
| 97 | + }; | |
| 98 | + window.VCCCloseSettings = () => { | |
| 99 | + const modal = document.getElementById('settings-modal'); | |
| 100 | + if (!modal) return; | |
| 101 | + modal.classList.remove('show'); | |
| 102 | + modal.setAttribute('aria-hidden', 'true'); | |
| 103 | + }; | |
| 104 | + </script> | |
| 75 | 105 | </body> |
| 76 | 106 | </html> |
modified src/builder.js +64 −13
| @@ -7,6 +7,16 @@ | ||
| 7 | 7 | import * as THREE from 'three'; |
| 8 | 8 | |
| 9 | 9 | function lerp3(a, b, t) { return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t]; } |
| 10 | +function configureCanvasTexture(tx) { | |
| 11 | + tx.colorSpace = THREE.SRGBColorSpace; | |
| 12 | + tx.anisotropy = 8; | |
| 13 | + // Las texturas son texto fino sobre fondo transparente. Sin mipmaps, los | |
| 14 | + // píxeles transparentes no se mezclan con negro al orbitar y solaparse. | |
| 15 | + tx.generateMipmaps = false; | |
| 16 | + tx.minFilter = THREE.LinearFilter; | |
| 17 | + tx.magFilter = THREE.LinearFilter; | |
| 18 | + return tx; | |
| 19 | +} | |
| 10 | 20 | |
| 11 | 21 | // 12 aristas de una caja → 24 vértices |
| 12 | 22 | const EDGE_PAIRS = [ |
| @@ -165,14 +175,14 @@ | ||
| 165 | 175 | const cv = document.createElement('canvas'); |
| 166 | 176 | cv.width = W; cv.height = H; |
| 167 | 177 | building.facadeCanvas = cv; |
| 168 | - const tx = new THREE.CanvasTexture(cv); | |
| 169 | - tx.colorSpace = THREE.SRGBColorSpace; | |
| 170 | - tx.anisotropy = 8; | |
| 178 | + const tx = configureCanvasTexture(new THREE.CanvasTexture(cv)); | |
| 171 | 179 | building.facadeTexture = tx; |
| 172 | 180 | drawFacade(building, null, theme); |
| 173 | 181 | const mat = new THREE.MeshBasicMaterial({ |
| 174 | - map: tx, transparent: true, depthWrite: false, side: THREE.FrontSide, | |
| 182 | + map: tx, transparent: true, alphaTest: 0.025, depthWrite: false, side: THREE.FrontSide, | |
| 183 | + blending: theme.light ? THREE.NormalBlending : THREE.AdditiveBlending, | |
| 175 | 184 | }); |
| 185 | + mat.userData.vccKind = 'facade'; | |
| 176 | 186 | const E = 0.14; |
| 177 | 187 | const faces = [ |
| 178 | 188 | { w: b.sx, pos: [b.cx, b.cy, b.cz + b.sz / 2 + E], rot: 0 }, |
| @@ -211,9 +221,7 @@ | ||
| 211 | 221 | g.globalAlpha = 0.92; |
| 212 | 222 | g.shadowColor = color; g.shadowBlur = 16; |
| 213 | 223 | g.fillText(text, pad + 80, y); |
| 214 | - const tx = new THREE.CanvasTexture(cv); | |
| 215 | - tx.colorSpace = THREE.SRGBColorSpace; | |
| 216 | - tx.anisotropy = 8; | |
| 224 | + const tx = configureCanvasTexture(new THREE.CanvasTexture(cv)); | |
| 217 | 225 | return { tx, aspect: cv.width / cv.height }; |
| 218 | 226 | } |
| 219 | 227 | |
| @@ -227,10 +235,11 @@ | ||
| 227 | 235 | const mesh = new THREE.Mesh( |
| 228 | 236 | new THREE.PlaneGeometry(w, w / aspect), |
| 229 | 237 | new THREE.MeshBasicMaterial({ |
| 230 | - map: tx, transparent: true, depthWrite: false, | |
| 238 | + map: tx, transparent: true, alphaTest: 0.025, depthWrite: false, | |
| 231 | 239 | blending: theme.light ? THREE.NormalBlending : THREE.AdditiveBlending, |
| 232 | 240 | }), |
| 233 | 241 | ); |
| 242 | + mesh.material.userData.vccKind = 'label'; | |
| 234 | 243 | if (flat) mesh.rotation.x = -Math.PI / 2; |
| 235 | 244 | mesh.position.set(...pos); |
| 236 | 245 | mesh.renderOrder = 4; |
| @@ -341,8 +350,10 @@ | ||
| 341 | 350 | const lineGeo = new THREE.BufferGeometry(); |
| 342 | 351 | lineGeo.setAttribute('position', new THREE.BufferAttribute(positions, 3)); |
| 343 | 352 | lineGeo.setAttribute('color', new THREE.BufferAttribute(colors, 3)); |
| 353 | + lineGeo.computeBoundingSphere(); | |
| 344 | 354 | // opacidad adaptativa: cuantas más cajas, más tenue cada arista |
| 345 | 355 | const lineOpacity = Math.min(0.95, Math.max(0.4, Math.sqrt(4000 / Math.max(boxNodes.length, 1)))); |
| 356 | + const lineBaseOpacity = lineOpacity; | |
| 346 | 357 | const lines = new THREE.LineSegments(lineGeo, new THREE.LineBasicMaterial({ |
| 347 | 358 | vertexColors: true, transparent: true, opacity: lineOpacity, |
| 348 | 359 | blending: BLEND, depthWrite: false, |
| @@ -359,6 +370,7 @@ | ||
| 359 | 370 | const shells = []; |
| 360 | 371 | for (const b of model.buildings) { |
| 361 | 372 | const mat = glassMaterial(theme, cityDim, b.onlyBasement ? 1 : 0); |
| 373 | + mat.userData.baseDim = cityDim; | |
| 362 | 374 | const mesh = new THREE.Mesh(new THREE.BoxGeometry(b.box.sx, b.box.sy, b.box.sz), mat); |
| 363 | 375 | mesh.position.set(b.box.cx, b.box.cy, b.box.cz); |
| 364 | 376 | mesh.renderOrder = 1; |
| @@ -391,6 +403,7 @@ | ||
| 391 | 403 | m.setPosition(n.box.cx, n.box.cy - n.box.sy / 2, n.box.cz); |
| 392 | 404 | slabs.setMatrixAt(i, m); |
| 393 | 405 | }); |
| 406 | + slabs.computeBoundingSphere(); | |
| 394 | 407 | slabs.renderOrder = 1; |
| 395 | 408 | group.add(slabs); |
| 396 | 409 | } |
| @@ -400,6 +413,7 @@ | ||
| 400 | 413 | const fileMat = new THREE.MeshBasicMaterial({ |
| 401 | 414 | transparent: true, opacity: 0.9, depthWrite: false, blending: BLEND, |
| 402 | 415 | }); |
| 416 | + const fileBaseOpacity = fileMat.opacity; | |
| 403 | 417 | const filesMesh = new THREE.InstancedMesh(fileGeo, fileMat, model.files.length); |
| 404 | 418 | { |
| 405 | 419 | const m = new THREE.Matrix4(); |
| @@ -411,6 +425,7 @@ | ||
| 411 | 425 | filesMesh.setColorAt(f.id, c.setRGB(...FILE_BASE)); |
| 412 | 426 | } |
| 413 | 427 | filesMesh.instanceColor.needsUpdate = true; |
| 428 | + filesMesh.computeBoundingSphere(); | |
| 414 | 429 | } |
| 415 | 430 | filesMesh.renderOrder = 2; |
| 416 | 431 | group.add(filesMesh); |
| @@ -588,26 +603,62 @@ | ||
| 588 | 603 | const legend = buildLegend(model, byArea, theme); |
| 589 | 604 | group.add(legend); |
| 590 | 605 | |
| 606 | + let groundOpaque = false; | |
| 607 | + const groundBaseOpacity = 0.8; | |
| 608 | + let visualSettings = {}; | |
| 609 | + function setVisuals(v = {}) { | |
| 610 | + visualSettings = { ...visualSettings, ...v }; | |
| 611 | + const linesMul = visualSettings.lines ?? 1; | |
| 612 | + const filesMul = visualSettings.files ?? 1; | |
| 613 | + const glassMul = visualSettings.glass ?? 1; | |
| 614 | + const facadeMul = visualSettings.facades ?? 1; | |
| 615 | + const labelMul = visualSettings.labels ?? 1; | |
| 616 | + const groundMul = visualSettings.ground ?? 1; | |
| 617 | + | |
| 618 | + lines.material.opacity = Math.min(1, lineBaseOpacity * linesMul); | |
| 619 | + fileMat.opacity = Math.min(1, fileBaseOpacity * filesMul); | |
| 620 | + if (!groundOpaque) ground.material.opacity = Math.min(1, groundBaseOpacity * groundMul); | |
| 621 | + | |
| 622 | + for (const shell of shells) { | |
| 623 | + const mat = shell.material; | |
| 624 | + mat.uniforms.uDim.value = (mat.userData.baseDim ?? cityDim) * glassMul; | |
| 625 | + } | |
| 626 | + group.traverse((o) => { | |
| 627 | + const mats = Array.isArray(o.material) ? o.material : [o.material]; | |
| 628 | + for (const mat of mats) { | |
| 629 | + if (mat?.userData?.vccKind === 'facade') mat.opacity = Math.min(1, facadeMul); | |
| 630 | + if (mat?.userData?.vccKind === 'label') mat.opacity = Math.min(1, labelMul); | |
| 631 | + } | |
| 632 | + }); | |
| 633 | + } | |
| 634 | + | |
| 591 | 635 | function dispose() { |
| 592 | 636 | scene.remove(group); |
| 637 | + const geometries = new Set(); | |
| 638 | + const materials = new Set(); | |
| 593 | 639 | group.traverse((o) => { |
| 594 | - o.geometry?.dispose?.(); | |
| 640 | + if (o.geometry) geometries.add(o.geometry); | |
| 595 | 641 | for (const m of Array.isArray(o.material) ? o.material : [o.material]) { |
| 596 | - m?.map?.dispose?.(); | |
| 597 | - m?.dispose?.(); | |
| 642 | + if (m) materials.add(m); | |
| 598 | 643 | } |
| 599 | 644 | }); |
| 645 | + for (const g of geometries) g.dispose(); | |
| 646 | + for (const m of materials) { | |
| 647 | + m.map?.dispose?.(); | |
| 648 | + m.dispose(); | |
| 649 | + } | |
| 600 | 650 | } |
| 601 | 651 | |
| 602 | 652 | return { |
| 603 | 653 | group, lines, shells, filesMesh, ground, legend, |
| 604 | - paintNode, paintFile, clearGlows, fillBoxes, dispose, setModeColors, setBlastBeams, tickBeams, | |
| 654 | + paintNode, paintFile, clearGlows, fillBoxes, dispose, setModeColors, setBlastBeams, tickBeams, setVisuals, | |
| 605 | 655 | setLegend: (v) => { legend.visible = v; }, |
| 606 | 656 | // suelo opaco/translúcido. Opaco = escribe profundidad y se dibuja en la |
| 607 | 657 | // pasada de opacos: oculta de verdad los sótanos (ficheros ignorados) |
| 608 | 658 | setGroundOpaque: (v) => { |
| 659 | + groundOpaque = v; | |
| 609 | 660 | const m = ground.material; |
| 610 | - m.opacity = v ? 1 : 0.8; | |
| 661 | + m.opacity = v ? 1 : Math.min(1, groundBaseOpacity * (visualSettings.ground ?? 1)); | |
| 611 | 662 | m.transparent = !v; |
| 612 | 663 | m.depthWrite = v; |
| 613 | 664 | m.needsUpdate = true; |
modified src/gpu.js +50 −17
| @@ -1,9 +1,14 @@ | ||
| 1 | 1 | // Detección de la aceleración gráfica real del navegador. |
| 2 | 2 | // Lee el renderer sin máscara de WebGL (WEBGL_debug_renderer_info) y |
| 3 | 3 | // clasifica el hardware en niveles para adaptar la calidad del render: |
| 4 | -// - alta: GPU discreta NVIDIA/AMD/Intel Arc o Apple Silicon (Metal) | |
| 5 | -// - media: integradas u origen desconocido (valores actuales del proyecto) | |
| 4 | +// - alta: GPU discreta NVIDIA/AMD/Intel Arc, Apple Silicon, D3D12/Mesa HW | |
| 5 | +// - media: integradas u origen desconocido | |
| 6 | 6 | // - software: SwiftShader/llvmpipe → sin MSAA y resolución nativa 1:1 |
| 7 | +// | |
| 8 | +// El composer usa render targets HDR. En varios drivers produce artefactos | |
| 9 | +// rectangulares negros screen-space al orbitar, incluso sin MSAA. Por eso el | |
| 10 | +// render directo es el camino por defecto y bloom queda como opt-in con | |
| 11 | +// ?bloom=1 para depuración visual. | |
| 7 | 12 | |
| 8 | 13 | export function detectGPU(gl) { |
| 9 | 14 | let renderer = '', vendor = ''; |
| @@ -14,36 +19,63 @@ | ||
| 14 | 19 | } catch { /* contexto perdido o cabeceras bloqueadas */ } |
| 15 | 20 | const low = `${renderer} ${vendor}`.toLowerCase(); |
| 16 | 21 | |
| 17 | - const isSoftware = /swiftshader|llvmpipe|softpipe|software|basic render/.test(low); | |
| 18 | - const isNvidia = /nvidia|geforce|quadro|\brtx\b|\bgtx\b/.test(low); | |
| 22 | + const isSoftware = /swiftshader|llvmpipe|softpipe|software|basic render|warp/.test(low); | |
| 23 | + let isNvidia = /nvidia|geforce|quadro|\brtx\b|\bgtx\b/.test(low); | |
| 19 | 24 | // macOS: ANGLE sobre Metal reporta "Apple M1/M2/…" o el genérico "Apple GPU" |
| 20 | - const isApple = /apple m\d|apple gpu|angle.*metal/.test(low) | |
| 25 | + let isApple = /apple m\d|apple gpu|angle.*metal/.test(low) | |
| 21 | 26 | || (/apple/.test(low) && /mac/i.test(navigator.platform ?? '')); |
| 22 | - const isAmd = /\bamd\b|radeon/.test(low); | |
| 23 | - const isIntelArc = /intel.*arc/.test(low); | |
| 27 | + let isAmd = /\bamd\b|radeon/.test(low); | |
| 28 | + let isIntelArc = /intel.*arc/.test(low); | |
| 29 | + const isD3D12 = /d3d12|direct3d\s*12|dx12/.test(low); | |
| 30 | + const isD3D11 = /d3d11|direct3d\s*11|dx11/.test(low); | |
| 31 | + const isMesa = /mesa|zink|vulkan/.test(low); | |
| 32 | + const isVirtual = /microsoft|wsl|virtual|parallels|vmware|virgl/.test(low); | |
| 33 | + const isHardwareBridge = !isSoftware && (isD3D12 || isD3D11 || isMesa); | |
| 24 | 34 | |
| 25 | 35 | let tier = 'media'; |
| 26 | 36 | if (isSoftware) tier = 'software'; |
| 27 | - else if (isNvidia || isApple || isAmd || isIntelArc) tier = 'alta'; | |
| 37 | + else if (isNvidia || isApple || isAmd || isIntelArc || isHardwareBridge) tier = 'alta'; | |
| 38 | + | |
| 39 | + let brand = 'desconocida'; | |
| 40 | + if (isNvidia) brand = 'NVIDIA'; | |
| 41 | + else if (isAmd) brand = 'AMD'; | |
| 42 | + else if (isIntelArc) brand = 'Intel Arc'; | |
| 43 | + else if (isApple) brand = 'Apple'; | |
| 44 | + else if (isD3D12) brand = isVirtual ? 'D3D12 virtual' : 'D3D12'; | |
| 45 | + else if (isD3D11) brand = isVirtual ? 'D3D11 virtual' : 'D3D11'; | |
| 46 | + else if (isMesa) brand = isVirtual ? 'Mesa virtual' : 'Mesa'; | |
| 47 | + else if (tier === 'alta') brand = 'discreta'; | |
| 28 | 48 | |
| 29 | 49 | let maxSamples = 4; |
| 30 | 50 | try { maxSamples = gl.getParameter(gl.MAX_SAMPLES) ?? 4; } catch { /* WebGL1 */ } |
| 31 | 51 | |
| 32 | - // MSAA ×8 + HalfFloat + pixelRatio 3 corrompía el render en algunas GPUs | |
| 33 | - // discretas (regiones negras y geometría estirada según el ángulo de | |
| 34 | - // cámara: el driver no aguanta render targets multisample tan grandes). | |
| 35 | - // Techo conservador conocido-bueno: ×4 y ratio ≤2; el render software | |
| 36 | - // baja a 1:1 sin multisampling. Overrides para depurar: ?msaa=N&pr=N | |
| 52 | + // Overrides para depurar: ?gpu=nvidia|amd|apple|arc|discreta|software&msaa=N&pr=N&bloom=1 | |
| 37 | 53 | const params = new URLSearchParams(window.location?.search ?? ''); |
| 38 | - const ovMsaa = params.get('msaa'), ovPr = params.get('pr'); | |
| 54 | + const ovGpu = (params.get('gpu') || '').toLowerCase(); | |
| 55 | + const ovMsaa = params.get('msaa'), ovPr = params.get('pr'), ovBloom = params.get('bloom'); | |
| 56 | + if (ovGpu) { | |
| 57 | + isNvidia = /nvidia|geforce|rtx|gtx/.test(ovGpu); | |
| 58 | + isAmd = /amd|radeon/.test(ovGpu); | |
| 59 | + isApple = /apple|metal/.test(ovGpu); | |
| 60 | + isIntelArc = /arc/.test(ovGpu); | |
| 61 | + if (isNvidia) brand = 'NVIDIA'; | |
| 62 | + else if (isAmd) brand = 'AMD'; | |
| 63 | + else if (isIntelArc) brand = 'Intel Arc'; | |
| 64 | + else if (isApple) brand = 'Apple'; | |
| 65 | + else if (/software|swiftshader|llvmpipe/.test(ovGpu)) brand = 'software'; | |
| 66 | + else brand = 'discreta'; | |
| 67 | + tier = /software|swiftshader|llvmpipe/.test(ovGpu) ? 'software' : /media|integrada/.test(ovGpu) ? 'media' : 'alta'; | |
| 68 | + } | |
| 39 | 69 | |
| 40 | 70 | const profile = { |
| 41 | 71 | name: renderer || 'GPU desconocida', |
| 42 | - tier, isNvidia, isApple, | |
| 72 | + vendor: vendor || 'Proveedor desconocido', | |
| 73 | + tier, brand, isNvidia, isApple, isAmd, isIntelArc, isD3D12, isD3D11, isMesa, isVirtual, | |
| 74 | + override: ovGpu || '', | |
| 43 | 75 | webgpu: 'gpu' in navigator, |
| 44 | 76 | pixelRatioCap: tier === 'software' ? 1 : 2, |
| 45 | - msaaSamples: tier === 'software' ? 0 : Math.min(4, maxSamples), | |
| 46 | - bloom: tier !== 'software', | |
| 77 | + msaaSamples: 0, | |
| 78 | + bloom: false, | |
| 47 | 79 | }; |
| 48 | 80 | if (ovMsaa !== null && ovMsaa !== '') { |
| 49 | 81 | profile.msaaSamples = Math.max(0, Math.min(+ovMsaa || 0, maxSamples)); |
| @@ -51,5 +83,6 @@ | ||
| 51 | 83 | if (ovPr !== null && ovPr !== '') { |
| 52 | 84 | profile.pixelRatioCap = Math.max(0.5, Math.min(+ovPr || 1, 4)); |
| 53 | 85 | } |
| 86 | + if (ovBloom !== null) profile.bloom = ovBloom !== '0'; | |
| 54 | 87 | return profile; |
| 55 | 88 | } |
modified src/main.js +110 −23
| @@ -14,40 +14,81 @@ | ||
| 14 | 14 | import { detectGPU } from './gpu.js'; |
| 15 | 15 | import { THEMES } from './themes.js'; |
| 16 | 16 | |
| 17 | +const VISUAL_STORAGE_KEY = 'vcc.visualSettings.v1'; | |
| 18 | +const DEFAULT_VISUAL_SETTINGS = { | |
| 19 | + exposure: 1.05, | |
| 20 | + brightness: 1, | |
| 21 | + contrast: 1, | |
| 22 | + saturate: 1, | |
| 23 | + lines: 1, | |
| 24 | + files: 1, | |
| 25 | + glass: 1, | |
| 26 | + facades: 1, | |
| 27 | + labels: 1, | |
| 28 | + ground: 1, | |
| 29 | + fog: 1, | |
| 30 | +}; | |
| 31 | + | |
| 32 | +function loadVisualSettings() { | |
| 33 | + try { | |
| 34 | + return { ...DEFAULT_VISUAL_SETTINGS, ...JSON.parse(localStorage.getItem(VISUAL_STORAGE_KEY) || '{}') }; | |
| 35 | + } catch { | |
| 36 | + return { ...DEFAULT_VISUAL_SETTINGS }; | |
| 37 | + } | |
| 38 | +} | |
| 39 | + | |
| 40 | +let visualSettings = loadVisualSettings(); | |
| 41 | + | |
| 17 | 42 | // ── base persistente (renderer, cámara, composer) ───────────────────────── |
| 18 | 43 | // powerPreference fuerza la GPU discreta en portátiles con doble gráfica |
| 19 | 44 | const canvas = document.getElementById('view'); |
| 20 | 45 | const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, powerPreference: 'high-performance' }); |
| 21 | 46 | const gpu = detectGPU(renderer.getContext()); |
| 22 | -console.info(`[gpu] ${gpu.name} · nivel ${gpu.tier} · MSAA ×${gpu.msaaSamples} · pixelRatio ≤${gpu.pixelRatioCap}${gpu.webgpu ? ' · WebGPU disponible' : ''}`); | |
| 47 | +console.info(`[gpu] ${gpu.brand} · nivel ${gpu.tier} · renderer "${gpu.name}" · vendor "${gpu.vendor}" · bloom ${gpu.bloom ? 'on' : 'off'} · MSAA RT ×${gpu.msaaSamples} · pixelRatio ≤${gpu.pixelRatioCap}${gpu.override ? ` · override ${gpu.override}` : ''}${gpu.webgpu ? ' · WebGPU disponible' : ''}`); | |
| 23 | 48 | renderer.setPixelRatio(Math.min(window.devicePixelRatio, gpu.pixelRatioCap)); |
| 24 | 49 | renderer.toneMapping = THREE.ACESFilmicToneMapping; |
| 25 | -renderer.toneMappingExposure = 1.05; | |
| 50 | +renderer.toneMappingExposure = visualSettings.exposure; | |
| 51 | +renderer.setClearColor(0x020309, 1); | |
| 26 | 52 | |
| 27 | 53 | const scene = new THREE.Scene(); |
| 28 | 54 | scene.background = new THREE.Color(0x020309); |
| 29 | 55 | const camera = new THREE.PerspectiveCamera(55, 1, 0.1, 1000); |
| 30 | 56 | |
| 31 | -// el antialias del canvas no aplica al renderizar vía composer: sin MSAA | |
| 32 | -// en el render target, las aristas de 1px parpadean con el bloom al mover | |
| 33 | -// la cámara (aliasing temporal). HalfFloat para conservar los colores HDR. | |
| 34 | -// Las muestras se adaptan a la GPU detectada (×8 en discretas/Apple Silicon, | |
| 35 | -// 0 en render software). | |
| 36 | -const composer = new EffectComposer(renderer, new THREE.WebGLRenderTarget(1, 1, { | |
| 37 | - type: THREE.HalfFloatType, | |
| 38 | - samples: gpu.msaaSamples, | |
| 39 | -})); | |
| 40 | -composer.addPass(new RenderPass(scene, camera)); | |
| 41 | -const bloom = new UnrealBloomPass(new THREE.Vector2(1, 1), 0.65, 0.25, 0.85); | |
| 42 | -bloom.enabled = gpu.bloom; | |
| 43 | -composer.addPass(bloom); | |
| 44 | -composer.addPass(new OutputPass()); | |
| 57 | +function createRenderPipeline() { | |
| 58 | + if (!gpu.bloom) { | |
| 59 | + return { | |
| 60 | + bloom: { strength: 0, threshold: 1, resolution: new THREE.Vector2(1, 1) }, | |
| 61 | + resize: () => {}, | |
| 62 | + render: () => renderer.render(scene, camera), | |
| 63 | + }; | |
| 64 | + } | |
| 65 | + | |
| 66 | + const target = new THREE.WebGLRenderTarget(1, 1, { | |
| 67 | + type: THREE.HalfFloatType, | |
| 68 | + samples: gpu.msaaSamples, | |
| 69 | + }); | |
| 70 | + target.texture.name = 'VCC.composer'; | |
| 71 | + const composer = new EffectComposer(renderer, target); | |
| 72 | + composer.addPass(new RenderPass(scene, camera)); | |
| 73 | + const bloom = new UnrealBloomPass(new THREE.Vector2(1, 1), 0.65, 0.25, 0.85); | |
| 74 | + composer.addPass(bloom); | |
| 75 | + composer.addPass(new OutputPass()); | |
| 76 | + return { | |
| 77 | + bloom, | |
| 78 | + resize: (w, h) => { | |
| 79 | + composer.setSize(w, h); | |
| 80 | + bloom.resolution.set(w, h); | |
| 81 | + }, | |
| 82 | + render: () => composer.render(), | |
| 83 | + }; | |
| 84 | +} | |
| 85 | +const pipeline = createRenderPipeline(); | |
| 86 | +const bloom = pipeline.bloom; | |
| 45 | 87 | |
| 46 | 88 | function resize() { |
| 47 | 89 | const w = window.innerWidth, h = window.innerHeight; |
| 48 | 90 | renderer.setSize(w, h, false); |
| 49 | - composer.setSize(w, h); | |
| 50 | - bloom.resolution.set(w, h); | |
| 91 | + pipeline.resize(w, h); | |
| 51 | 92 | camera.aspect = w / h; |
| 52 | 93 | camera.updateProjectionMatrix(); |
| 53 | 94 | } |
| @@ -59,6 +100,33 @@ | ||
| 59 | 100 | let groundSolid = false; |
| 60 | 101 | let colorMode = 'basic'; |
| 61 | 102 | let themeName = 'hacker'; |
| 103 | +let fogBaseDensity = 0; | |
| 104 | + | |
| 105 | +function applyVisualSettings(next, { persist = true } = {}) { | |
| 106 | + visualSettings = next === null | |
| 107 | + ? { ...DEFAULT_VISUAL_SETTINGS } | |
| 108 | + : { ...visualSettings, ...next }; | |
| 109 | + for (const k of Object.keys(DEFAULT_VISUAL_SETTINGS)) { | |
| 110 | + visualSettings[k] = Number.isFinite(+visualSettings[k]) ? +visualSettings[k] : DEFAULT_VISUAL_SETTINGS[k]; | |
| 111 | + } | |
| 112 | + renderer.toneMappingExposure = visualSettings.exposure; | |
| 113 | + canvas.style.filter = [ | |
| 114 | + `brightness(${visualSettings.brightness})`, | |
| 115 | + `contrast(${visualSettings.contrast})`, | |
| 116 | + `saturate(${visualSettings.saturate})`, | |
| 117 | + ].join(' '); | |
| 118 | + if (scene.fog && fogBaseDensity) scene.fog.density = fogBaseDensity * visualSettings.fog; | |
| 119 | + city?.setVisuals?.(visualSettings); | |
| 120 | + if (persist) localStorage.setItem(VISUAL_STORAGE_KEY, JSON.stringify(visualSettings)); | |
| 121 | + return { ...visualSettings }; | |
| 122 | +} | |
| 123 | + | |
| 124 | +function setBloomMode(enabled) { | |
| 125 | + const url = new URL(location.href); | |
| 126 | + if (enabled) url.searchParams.set('bloom', '1'); | |
| 127 | + else url.searchParams.delete('bloom'); | |
| 128 | + location.assign(url); | |
| 129 | +} | |
| 62 | 130 | |
| 63 | 131 | // aplica la parte "barata" del tema: escena, bloom y variables CSS de la UI |
| 64 | 132 | function setSceneTheme(t) { |
| @@ -79,6 +147,7 @@ | ||
| 79 | 147 | city = buildCity(scene, model, t); |
| 80 | 148 | city.setLegend(legendOn); |
| 81 | 149 | city.setGroundOpaque(groundSolid); |
| 150 | + city.setVisuals(visualSettings); | |
| 82 | 151 | } |
| 83 | 152 | |
| 84 | 153 | function boot(packedTree, meta) { |
| @@ -94,7 +163,8 @@ | ||
| 94 | 163 | |
| 95 | 164 | model = buildModel(packedTree, meta); |
| 96 | 165 | const extent = Math.max(model.city.box.sx, model.city.box.sz); |
| 97 | - scene.fog = new THREE.FogExp2(THEMES[themeName].fog, 0.62 / extent); | |
| 166 | + fogBaseDensity = 0.62 / extent; | |
| 167 | + scene.fog = new THREE.FogExp2(THEMES[themeName].fog, fogBaseDensity * visualSettings.fog); | |
| 98 | 168 | camera.far = extent * 14; |
| 99 | 169 | camera.updateProjectionMatrix(); |
| 100 | 170 | |
| @@ -107,7 +177,7 @@ | ||
| 107 | 177 | ui.setModeAvailable('blast', |
| 108 | 178 | Object.keys(model.linksOut).length > 0 || Object.keys(model.symOut).length > 0); |
| 109 | 179 | applyColorMode('basic'); |
| 110 | - window.VCC = { model, city, nav, camera, selectFile, selectNode, clearSelection, applyColorMode, applyTheme }; | |
| 180 | + window.VCC = { model, city, nav, camera, selectFile, selectNode, clearSelection, applyColorMode, applyTheme, applyVisualSettings }; | |
| 111 | 181 | } |
| 112 | 182 | |
| 113 | 183 | // cambia de tema reconstruyendo solo la ciudad (modelo y cámara intactos) |
| @@ -315,6 +385,7 @@ | ||
| 315 | 385 | |
| 316 | 386 | canvas.addEventListener('pointermove', (e) => { |
| 317 | 387 | pointer.set((e.clientX / window.innerWidth) * 2 - 1, -(e.clientY / window.innerHeight) * 2 + 1); |
| 388 | + hoverDirty = true; | |
| 318 | 389 | }); |
| 319 | 390 | |
| 320 | 391 | function pick() { |
| @@ -325,8 +396,13 @@ | ||
| 325 | 396 | return { fileHit, shellHit }; |
| 326 | 397 | } |
| 327 | 398 | |
| 328 | -function updateHover() { | |
| 399 | +let hoverDirty = true; | |
| 400 | +let lastHoverAt = 0; | |
| 401 | +function updateHover(now) { | |
| 329 | 402 | if (selectedFile) return; |
| 403 | + if (!nav.fly.active && !hoverDirty && now - lastHoverAt < 50) return; | |
| 404 | + hoverDirty = false; | |
| 405 | + lastHoverAt = now; | |
| 330 | 406 | // solo carcasas: raycast contra cientos de miles de celdas por frame no escala |
| 331 | 407 | if (nav.fly.active) raycaster.setFromCamera(new THREE.Vector2(0, 0), camera); |
| 332 | 408 | else raycaster.setFromCamera(pointer, camera); |
| @@ -413,6 +489,11 @@ | ||
| 413 | 489 | onToggleLegend: (on) => { legendOn = on; city.setLegend(on); }, |
| 414 | 490 | onToggleGround: (solid) => { groundSolid = solid; city.setGroundOpaque(solid); }, |
| 415 | 491 | onTheme: (name) => applyTheme(name), |
| 492 | + getVisualSettings: () => ({ ...visualSettings }), | |
| 493 | + onVisualSettings: (settings) => applyVisualSettings(settings), | |
| 494 | + onVisualPreset: (settings) => applyVisualSettings(settings), | |
| 495 | + onBloomMode: (enabled) => setBloomMode(enabled), | |
| 496 | + isBloomEnabled: () => gpu.bloom, | |
| 416 | 497 | onMode: (mode) => applyColorMode(mode), |
| 417 | 498 | onPickFolder: () => loadScan(pickAndScanFolder), |
| 418 | 499 | onReopenFolder: () => loadScan(reopenLastFolder), |
| @@ -425,14 +506,20 @@ | ||
| 425 | 506 | // ── arranque + bucle ────────────────────────────────────────────────────── |
| 426 | 507 | boot(REPO_TREE, REPO_META); |
| 427 | 508 | resize(); |
| 509 | +applyVisualSettings(visualSettings, { persist: false }); | |
| 428 | 510 | |
| 429 | 511 | let last = performance.now(); |
| 430 | 512 | let fpsAcc = 0, fpsN = 0; |
| 431 | 513 | function frame(now) { |
| 514 | + if (document.hidden) { | |
| 515 | + last = now; | |
| 516 | + requestAnimationFrame(frame); | |
| 517 | + return; | |
| 518 | + } | |
| 432 | 519 | const dt = Math.min(0.05, (now - last) / 1000); |
| 433 | 520 | last = now; |
| 434 | 521 | nav.update(dt); |
| 435 | - updateHover(); | |
| 522 | + updateHover(now); | |
| 436 | 523 | |
| 437 | 524 | // pulse de los barrios encendidos |
| 438 | 525 | for (const p of pulsers) { |
| @@ -446,7 +533,7 @@ | ||
| 446 | 533 | // pulsos de datos por los haces del modo Blast |
| 447 | 534 | city.tickBeams(now); |
| 448 | 535 | |
| 449 | - composer.render(); | |
| 536 | + pipeline.render(); | |
| 450 | 537 | fpsAcc += dt; fpsN++; |
| 451 | 538 | if (fpsAcc >= 0.5) { |
| 452 | 539 | ui.setStats(Math.round(fpsN / fpsAcc)); |
modified src/styles.css +112 −11
| @@ -15,14 +15,18 @@ | ||
| 15 | 15 | font-family: "JetBrains Mono", "Cascadia Code", "Fira Code", monospace; |
| 16 | 16 | color: var(--text); |
| 17 | 17 | font-size: 13px; |
| 18 | + text-rendering: geometricPrecision; | |
| 18 | 19 | } |
| 19 | 20 | |
| 20 | -#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; } | |
| 21 | +#view { | |
| 22 | + position: fixed; inset: 0; width: 100%; height: 100%; display: block; | |
| 23 | + background: #020309; | |
| 24 | +} | |
| 21 | 25 | |
| 22 | 26 | .title { |
| 23 | 27 | color: var(--cyan); |
| 24 | 28 | font-size: 11px; |
| 25 | - letter-spacing: 0.18em; | |
| 29 | + letter-spacing: 0; | |
| 26 | 30 | text-transform: uppercase; |
| 27 | 31 | margin-bottom: 8px; |
| 28 | 32 | } |
| @@ -50,7 +54,7 @@ | ||
| 50 | 54 | padding: 8px 18px; |
| 51 | 55 | cursor: pointer; |
| 52 | 56 | text-align: left; |
| 53 | - backdrop-filter: blur(4px); | |
| 57 | + backdrop-filter: blur(10px) saturate(1.25); | |
| 54 | 58 | transition: border-color 0.15s, color 0.15s, box-shadow 0.15s; |
| 55 | 59 | } |
| 56 | 60 | #view-buttons button:hover { |
| @@ -60,6 +64,7 @@ | ||
| 60 | 64 | } |
| 61 | 65 | #view-buttons button.off { color: rgba(140, 195, 210, 0.4); border-style: dashed; } |
| 62 | 66 | #view-buttons button:disabled { color: rgba(140, 195, 210, 0.5); cursor: progress; } |
| 67 | +#view-buttons #btn-settings { border-color: rgba(46, 230, 255, 0.35); } | |
| 63 | 68 | #view-buttons select { |
| 64 | 69 | font: inherit; |
| 65 | 70 | color: var(--text); |
| @@ -68,7 +73,7 @@ | ||
| 68 | 73 | border-radius: 4px; |
| 69 | 74 | padding: 8px 12px; |
| 70 | 75 | cursor: pointer; |
| 71 | - backdrop-filter: blur(4px); | |
| 76 | + backdrop-filter: blur(10px) saturate(1.25); | |
| 72 | 77 | } |
| 73 | 78 | #view-buttons select:hover { border-color: var(--cyan); } |
| 74 | 79 | #view-buttons select option { background: #04121a; color: var(--text); } |
| @@ -83,7 +88,8 @@ | ||
| 83 | 88 | border: 1px solid var(--panel-border); |
| 84 | 89 | border-radius: 6px; |
| 85 | 90 | overflow: hidden; |
| 86 | - backdrop-filter: blur(4px); | |
| 91 | + backdrop-filter: blur(10px) saturate(1.25); | |
| 92 | + box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18); | |
| 87 | 93 | } |
| 88 | 94 | #mode-switch button { |
| 89 | 95 | font: inherit; |
| @@ -93,7 +99,7 @@ | ||
| 93 | 99 | border-right: 1px solid var(--panel-border); |
| 94 | 100 | padding: 8px 20px; |
| 95 | 101 | cursor: pointer; |
| 96 | - letter-spacing: 0.06em; | |
| 102 | + letter-spacing: 0; | |
| 97 | 103 | } |
| 98 | 104 | #mode-switch button:last-child { border-right: none; } |
| 99 | 105 | #mode-switch button:focus { outline: none; } |
| @@ -122,7 +128,7 @@ | ||
| 122 | 128 | border: 1px solid var(--panel-border); |
| 123 | 129 | border-radius: 6px; |
| 124 | 130 | padding: 10px 14px; |
| 125 | - backdrop-filter: blur(4px); | |
| 131 | + backdrop-filter: blur(10px) saturate(1.25); | |
| 126 | 132 | font-size: 11.5px; |
| 127 | 133 | max-height: 38vh; overflow-y: auto; |
| 128 | 134 | } |
| @@ -157,7 +163,8 @@ | ||
| 157 | 163 | border: 1px solid var(--panel-border); |
| 158 | 164 | border-radius: 6px; |
| 159 | 165 | padding: 12px; |
| 160 | - backdrop-filter: blur(4px); | |
| 166 | + backdrop-filter: blur(10px) saturate(1.25); | |
| 167 | + box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18); | |
| 161 | 168 | } |
| 162 | 169 | #search-input { |
| 163 | 170 | width: 100%; |
| @@ -193,7 +200,8 @@ | ||
| 193 | 200 | border: 1px solid var(--panel-border); |
| 194 | 201 | border-radius: 6px; |
| 195 | 202 | padding: 12px 0 6px; |
| 196 | - backdrop-filter: blur(4px); | |
| 203 | + backdrop-filter: blur(10px) saturate(1.25); | |
| 204 | + box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18); | |
| 197 | 205 | } |
| 198 | 206 | #tree-panel .title { padding: 0 12px; } |
| 199 | 207 | #tree { overflow-y: auto; flex: 1; } |
| @@ -234,7 +242,7 @@ | ||
| 234 | 242 | border: 1px solid var(--panel-border); |
| 235 | 243 | border-radius: 6px; |
| 236 | 244 | padding: 9px 14px; |
| 237 | - backdrop-filter: blur(4px); | |
| 245 | + backdrop-filter: blur(10px) saturate(1.25); | |
| 238 | 246 | overflow: hidden; white-space: nowrap; text-overflow: ellipsis; |
| 239 | 247 | } |
| 240 | 248 | #pathbar .sep { color: rgba(46, 230, 255, 0.4); margin: 0 4px; } |
| @@ -255,12 +263,105 @@ | ||
| 255 | 263 | border: 1px solid var(--panel-border); |
| 256 | 264 | border-radius: 6px; |
| 257 | 265 | padding: 12px 14px; |
| 258 | - backdrop-filter: blur(4px); | |
| 266 | + backdrop-filter: blur(10px) saturate(1.25); | |
| 259 | 267 | font-size: 11.5px; |
| 260 | 268 | } |
| 261 | 269 | #help td { padding: 1.5px 0; color: rgba(170, 220, 235, 0.75); } |
| 262 | 270 | #help td:first-child { color: var(--cyan); padding-right: 14px; } |
| 263 | 271 | |
| 272 | +/* ── settings ─────────────────────────────────────────── */ | |
| 273 | +#settings-modal { | |
| 274 | + position: fixed; inset: 0; | |
| 275 | + display: none; | |
| 276 | + align-items: center; justify-content: center; | |
| 277 | + background: rgba(0, 0, 0, 0.28); | |
| 278 | + z-index: 20; | |
| 279 | +} | |
| 280 | +#settings-modal.show { display: flex; } | |
| 281 | +#settings-panel { | |
| 282 | + width: min(560px, calc(100vw - 32px)); | |
| 283 | + max-height: min(760px, calc(100vh - 32px)); | |
| 284 | + overflow: auto; | |
| 285 | + background: var(--panel-bg); | |
| 286 | + border: 1px solid var(--panel-border); | |
| 287 | + border-radius: 6px; | |
| 288 | + padding: 16px; | |
| 289 | + backdrop-filter: blur(14px) saturate(1.35); | |
| 290 | + box-shadow: 0 20px 80px rgba(0, 0, 0, 0.42); | |
| 291 | +} | |
| 292 | +.settings-head { | |
| 293 | + display: flex; align-items: center; justify-content: space-between; | |
| 294 | + margin-bottom: 10px; | |
| 295 | +} | |
| 296 | +#settings-close { | |
| 297 | + width: 28px; height: 28px; | |
| 298 | + border: 1px solid var(--panel-border); | |
| 299 | + border-radius: 4px; | |
| 300 | + color: var(--text); | |
| 301 | + background: transparent; | |
| 302 | + font: inherit; | |
| 303 | + cursor: pointer; | |
| 304 | +} | |
| 305 | +#settings-presets { | |
| 306 | + display: grid; | |
| 307 | + grid-template-columns: repeat(4, minmax(0, 1fr)); | |
| 308 | + gap: 8px; | |
| 309 | + margin-bottom: 12px; | |
| 310 | +} | |
| 311 | +#settings-presets button, | |
| 312 | +#settings-reset { | |
| 313 | + font: inherit; | |
| 314 | + color: var(--text); | |
| 315 | + background: rgba(8, 22, 32, 0.62); | |
| 316 | + border: 1px solid var(--panel-border); | |
| 317 | + border-radius: 4px; | |
| 318 | + padding: 8px 10px; | |
| 319 | + cursor: pointer; | |
| 320 | +} | |
| 321 | +#settings-controls { | |
| 322 | + display: grid; | |
| 323 | + grid-template-columns: 1fr 1fr; | |
| 324 | + gap: 10px 16px; | |
| 325 | +} | |
| 326 | +.setting-row { | |
| 327 | + display: grid; | |
| 328 | + grid-template-columns: 92px 1fr 42px; | |
| 329 | + align-items: center; | |
| 330 | + gap: 8px; | |
| 331 | + color: var(--text); | |
| 332 | +} | |
| 333 | +.setting-row input[type="range"] { | |
| 334 | + width: 100%; | |
| 335 | + accent-color: var(--cyan); | |
| 336 | +} | |
| 337 | +.setting-row output { | |
| 338 | + color: rgba(170, 220, 235, 0.72); | |
| 339 | + text-align: right; | |
| 340 | + font-size: 11px; | |
| 341 | +} | |
| 342 | +.settings-foot { | |
| 343 | + display: flex; align-items: center; justify-content: space-between; | |
| 344 | + gap: 12px; | |
| 345 | + margin-top: 14px; | |
| 346 | + padding-top: 12px; | |
| 347 | + border-top: 1px solid var(--panel-border); | |
| 348 | +} | |
| 349 | +.check-row { | |
| 350 | + display: inline-flex; align-items: center; gap: 8px; | |
| 351 | + color: var(--text); | |
| 352 | +} | |
| 353 | +.check-row input { accent-color: var(--cyan); } | |
| 354 | +body.light #settings-presets button, | |
| 355 | +body.light #settings-reset { | |
| 356 | + background: rgba(255, 255, 255, 0.72); | |
| 357 | + color: #143a40; | |
| 358 | +} | |
| 359 | + | |
| 360 | +@media (max-width: 720px) { | |
| 361 | + #settings-controls { grid-template-columns: 1fr; } | |
| 362 | + #settings-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); } | |
| 363 | +} | |
| 364 | + | |
| 264 | 365 | /* ── modo vuelo ────────────────────────────────────────── */ |
| 265 | 366 | #crosshair { |
| 266 | 367 | position: fixed; left: 50%; top: 50%; |
modified src/ui.js +91 −5
| @@ -217,11 +217,12 @@ | ||
| 217 | 217 | if (!t.includes('*') && !t.includes('?')) { |
| 218 | 218 | return (f) => f.path.toLowerCase().includes(t); |
| 219 | 219 | } |
| 220 | + const globstar = '__DOUBLE_STAR__'; | |
| 220 | 221 | const body = t |
| 221 | 222 | .replace(/[.+^${}()|[\]\\]/g, '\\$&') |
| 222 | - .replace(/\*\*/g, ' |