Modello 3D family: audio-reactive GLB model renderer

New model3d.js: minimal GLB loader (JSON+BIN chunks, accessors with
byteStride, node hierarchy baked into vertices, embedded PNG/JPEG base
colour textures) and a WebGL2 renderer on the shared canvas — palette
fill light, beat-pulsing fresnel rim, treble speculars, bass breathing
via normal displacement, orbiting camera auto-fitted to the bounding
box, gradient backdrop with a bass glow. A generated torus knot shows
before any GLB is loaded. 'Carica un modello .glb' button in the SVG
section; the path persists and is re-sent when the output restarts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
lucianoandClaude Fable 5 committed 2026-07-30 18:12:28 +02:00
1 parent b90066de6a
commit 65fb6ae895
7 files changed
+498 -2

No files matched your search

+11
View File
@@ -320,6 +320,17 @@ djv.onControl(async (m) => {
djv.report({ type: 'autoVj', on: autoVj });
break;
case 'svg': loadCustomTexture(m.dataUrl); break;
case 'glb':
try {
const bytes = await djv.readFile(m.path);
if (!bytes) throw new Error('file non leggibile');
const buf = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
const ok = viz.setModelData(buf);
if (ok === false) throw new Error((viz.model3d && viz.model3d.loadError) || 'GLB non valido');
djv.report({ type: 'glbLoaded', name: m.path.split('/').pop() });
hideHint();
} catch (e) { djv.report({ type: 'error', message: 'GLB: ' + e.message }); }
break;
case 'ledArea': {
// Confine the whole show to a W×H rectangle at X,Y (LED pixel mapping).
const st = $('#stage').style;