← Commit history

Lighting floaty: live sliders for spot (intensity/angle/XYZ), env, hemi, shadow darkness, copper metallic/roughness; light helper gizmo (sphere+aim line); snapshot button dumps settings for the AI to bake

John Lauer ·e56dcf123a ·3mo ago ·parent 4845bf5
3 files changed +72−4
package.json+1−1
@@ -2,7 +2,7 @@   "slug": "bq25792-charger",   "title": "BQ25792 Charger",   "type": "component",-  "version": "0.1.76",+  "version": "0.1.77",   "description": "BQ25792 Charger - buck-boost 1S-4S battery charger board by Adonis, with real 3D copper traces and measured stackup.",   "tags": [     "hardware"
page.json+10−3
@@ -4,9 +4,16 @@   "slug": "bq25792-charger",   "title": "BQ25792 Charger",   "brief": "Buck-boost 1S-4S battery charger board (TI BQ25792) with 14 Adom machine pins, by Adonis",-  "version": "0.1.76",+  "version": "0.1.77",   "tags": [-    "hardware"+    "adom",+    "adom-modular",+    "component",+    "charger",+    "battery",+    "bq25792",+    "power",+    "usb-c"   ],   "license": "proprietary",   "component": {@@ -49,7 +56,7 @@     "email": "[email protected]"   },   "visibility": "public",-  "description": "BQ25792 Charger - buck-boost 1S-4S battery charger board by Adonis, with real 3D copper traces and measured stackup.",+  "description": "BQ25792 Charger - a buck-boost 1S-4S battery charger board (Texas Instruments BQ25792) designed by Adonis in Fusion 360, with 14 Adom machine pins for the modular stack. Interactive colored 3D model, schematic and layout views.",   "dependencies": {},   "files": [     "README.md",
readme.html+61
@@ -73,6 +73,13 @@     background:transparent; color:#6e7681; font-size:11px; line-height:1; cursor:pointer; flex:none; }   .lp-iso:hover { color:#5ff5e8; border-color:#00b8b1; }   .lp-iso.on { background:#0b3d33; border-color:#00b8b1; color:#5ff5e8; }+  #light-panel { position:absolute; top:70px; left:14px; z-index:30; width:250px;+    background:rgba(13,17,23,0.62); backdrop-filter:blur(8px); border:1px solid rgba(48,54,61,0.8);+    border-radius:10px; padding:8px 10px; font-size:11px; }+  .lt-row { display:flex; align-items:center; gap:6px; padding:1px 2px; color:#c9d1d9; }+  .lt-row label { width:86px; flex:none; white-space:nowrap; overflow:hidden; color:#8b949e; }+  .lt-row input[type=range] { flex:1; accent-color:#00b8b1; height:14px; }+  .lt-row .lt-v { width:44px; text-align:right; font-variant-numeric:tabular-nums; color:#c9d1d9; }   .grip { cursor:grab; color:#6e7681; font-weight:700; letter-spacing:1px; padding:0 6px 0 2px; user-select:none; }   .grip:active { cursor:grabbing; } </style>@@ -91,6 +98,7 @@     <button class="fbtn" id="btn-exploded" type="button">Exploded</button>     <button class="fbtn" id="btn-fs" type="button" title="Fullscreen">Fullscreen</button>   </div>+  <div id="light-panel"><div class="lp-title"><span class="grip" title="drag">::</span> Lighting <button id="lt-helpers" class="lp-iso" style="width:auto;padding:0 6px" data-tip="Show light helper gizmo (where the spot sits and points)">helper</button> <button id="lt-snap" class="lp-iso" style="width:auto;padding:0 6px" data-tip="Snapshot current settings so the AI can bake them">snapshot</button></div><div id="lt-rows"></div></div>   <div id="layers-panel"><div class="lp-title"><span class="grip" title="drag">::</span> Layers</div><div id="lp-rows"></div><div id="lp-order">order: -</div></div>   <div id="scrub-wrap"><button id="btn-play" class="fbtn" type="button" title="Play/pause" style="min-width:34px;font-size:13px">&#10074;&#10074;</button><input id="scrub" type="range" min="0" max="1000" value="0"></div>   <span id="vstatus">starting viewer...</span>@@ -442,6 +450,59 @@ exported bodies + design rules.</p>     },400);      buildPanel();+    // ── Lighting panel: live-tunable settings + helper gizmo + snapshot ──+    (function(){+      const rows=document.getElementById("lt-rows"); if(!rows) return;+      const sc2=sc;+      const bundleHemi=sc2.getLightByName("light");+      const defs=[+        ["Spot intensity", ()=>SHADOW_LIGHT.intensity, v=>SHADOW_LIGHT.intensity=v, 0, 20, 0.1],+        ["Spot angle",     ()=>SHADOW_LIGHT.angle||0.45, v=>{if("angle" in SHADOW_LIGHT)SHADOW_LIGHT.angle=v;}, 0.1, 1.4, 0.01],+        ["Spot X",         ()=>SHADOW_LIGHT.position.x, v=>{SHADOW_LIGHT.position.x=v;aim();}, -1, 1.2, 0.01],+        ["Spot Y",         ()=>SHADOW_LIGHT.position.y, v=>{SHADOW_LIGHT.position.y=v;aim();}, -1, 1.2, 0.01],+        ["Spot Z",         ()=>SHADOW_LIGHT.position.z, v=>{SHADOW_LIGHT.position.z=v;aim();}, 0.2, 3, 0.01],+        ["Env intensity",  ()=>sc2.environmentIntensity, v=>sc2.environmentIntensity=v, 0, 2, 0.01],+        ["Hemi intensity", ()=>bundleHemi?bundleHemi.intensity:0, v=>{if(bundleHemi)bundleHemi.intensity=v;}, 0, 1.5, 0.01],+        ["Shadow darkness",()=>SHADOW_GEN.getDarkness(), v=>SHADOW_GEN.setDarkness(v), 0, 1, 0.01],+        ["Cu metallic",    ()=>copperMat.metallic, v=>{copperMat.metallic=v;sc2.materials.forEach(m=>{if(/_cu$/.test(m.name||""))m.metallic=v;});}, 0, 1, 0.01],+        ["Cu roughness",   ()=>copperMat.roughness, v=>{copperMat.roughness=v;sc2.materials.forEach(m=>{if(/_cu$/.test(m.name||""))m.roughness=v;});}, 0, 1, 0.01],+      ];+      function aim(){ SHADOW_LIGHT.direction=CENTER.subtract(SHADOW_LIGHT.position).normalize(); if(HELPER_LINE) drawHelper(); }+      const state={};+      defs.forEach(function(d){+        const [label,get,set,min,max,step]=d;+        const row=document.createElement("div"); row.className="lt-row";+        const lb=document.createElement("label"); lb.textContent=label;+        const r=document.createElement("input"); r.type="range"; r.min=min; r.max=max; r.step=step; r.value=get();+        const v=document.createElement("span"); v.className="lt-v"; v.textContent=(+get()).toFixed(2);+        r.addEventListener("input",function(){ const val=+r.value; set(val); v.textContent=val.toFixed(2); state[label]=val; });+        state[label]=+get();+        row.appendChild(lb); row.appendChild(r); row.appendChild(v); rows.appendChild(row);+      });+      // helper gizmo: sphere at the light + a line to the board center+      let HELPER=null, HELPER_LINE=null;+      function drawHelper(){+        if(HELPER_LINE){ HELPER_LINE.dispose(); HELPER_LINE=null; }+        HELPER_LINE=B().MeshBuilder.CreateLines("lt_line",{points:[SHADOW_LIGHT.position.clone(),CENTER.clone()]},sc2);+        HELPER_LINE.color=new (B().Color3)(1,0.85,0.2);+        if(HELPER) HELPER.position.copyFrom(SHADOW_LIGHT.position);+      }+      document.getElementById("lt-helpers").addEventListener("click",function(){+        if(HELPER){ HELPER.dispose(); HELPER=null; if(HELPER_LINE){HELPER_LINE.dispose();HELPER_LINE=null;} this.classList.remove("on"); set("light helper off"); return; }+        HELPER=B().MeshBuilder.CreateSphere("lt_helper",{diameter:0.05},sc2);+        HELPER.position.copyFrom(SHADOW_LIGHT.position);+        const hm=new (B().StandardMaterial)("lt_hm",sc2); hm.emissiveColor=new (B().Color3)(1,0.85,0.2); hm.disableLighting=true;+        HELPER.material=hm; HELPER.isPickable=false;+        drawHelper(); this.classList.add("on");+        set("light helper ON (sphere = spot, line = aim)");+      });+      document.getElementById("lt-snap").addEventListener("click",function(){+        window.__lightSnapshot=JSON.parse(JSON.stringify(state));+        set("lighting snapshot taken - tell the AI to read it");+        console.log("LIGHT_SNAPSHOT",JSON.stringify(state));+      });+      makeDraggable(document.getElementById("light-panel"));+    })();     try{ const cam0=viewer.getCamera(); if(cam0&&cam0.setClickToSetRotationPoint) cam0.setClickToSetRotationPoint(true,250); }catch(e){}     set("animating");   }