← Commit history

world-true layer offsets: every layer wrapped in a scene-root TransformNode (glTF __root__ conversion transform was amplifying local z offsets - the L1-flies-high bug)

John Lauer ·f14151d936 ·3mo ago ·parent ae70f49
3 files changed +20−10
package.json+1−1
@@ -2,7 +2,7 @@   "slug": "bq25792-charger",   "title": "BQ25792 Charger",   "type": "component",-  "version": "0.1.39",+  "version": "0.1.40",   "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.39",+  "version": "0.1.40",   "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+9−6
@@ -212,14 +212,17 @@ exported bodies + design rules.</p>   const N=LAYERS.length;   LAYERS.forEach(L=>{ L.meshes=[]; L.visible=true; });   const byKey={}; LAYERS.forEach(L=>byKey[L.key]=L);+  let SC=null;   function attach(key,meshes){-    meshes=meshes.filter(m=>!/ground|sky|env|viewcube|cube|axis|grid/i.test(m.name||""));-    meshes.forEach(m=>{ m.__z0=m.position.z; });-    byKey[key].meshes=byKey[key].meshes.concat(meshes);+    meshes=meshes.filter(m=>!/ground|sky|env|viewcube|axis|grid|arcRotate|Background|__root__/i.test(m.name||""));+    const L=byKey[key];+    if(!L.wrap){ L.wrap=new (B().TransformNode)(key+"_wrap",SC); }   // identity node at SCENE ROOT+    meshes.forEach(m=>{ try{ m.setParent(L.wrap); }catch(e){} });    // preserves world transform+    L.meshes=L.meshes.concat(meshes);   }    async function build(){-    const sc=viewer.getScene();+    const sc=viewer.getScene(); SC=sc;     set("loading board...");     // components via plain AppendAsync like every other group - the bundle's loadModel     // reparents/normalizes its model under a transformed root, which swallows our@@ -341,7 +344,7 @@ exported bodies + design rules.</p>     for(let i=0;i<N;i++){       const off=offsetFor(i,u);       LAYERS[i].curOff=off;-      for(const m of LAYERS[i].meshes) m.position.z=m.__z0+off;+      if(LAYERS[i].wrap) LAYERS[i].wrap.position.z=off;   // wrapper at scene root: world-true     }     if(scrub && mode!=="manual") scrub.value=String(Math.round(u*1000));   }@@ -352,7 +355,7 @@ exported bodies + design rules.</p>     LAYERS.forEach(function(L,i){       const row=document.createElement("div"); row.className="lp-row";       const cb=document.createElement("input"); cb.type="checkbox"; cb.checked=true;-      cb.addEventListener("change",function(){ L.visible=cb.checked; L.meshes.forEach(m=>m.setEnabled(cb.checked)); });+      cb.addEventListener("change",function(){ L.visible=cb.checked; if(L.wrap) L.wrap.setEnabled(cb.checked); });       const nm=document.createElement("span"); nm.className="lp-name"; nm.textContent=L.label;       const z=document.createElement("span"); z.className="lp-z"; L.zEl=z;       row.appendChild(cb); row.appendChild(nm); row.appendChild(z);