molecule
BQ25792 Charger
Public Made by Adomby adom
Buck-boost 1S-4S battery charger board (TI BQ25792) with 14 Adom machine pins, by Adonis
← Commit history
REAL ground + shadows: bundle ground had null material (my /ground/ regex was hitting the skybox). Build own semi-transparent ground plane + directional shadow generator; retarget Ground/Shadows toggles to them
3 files changed
+40−38
package.json+1−1@@ -2,7 +2,7 @@ "slug": "bq25792-charger", "title": "BQ25792 Charger", "type": "component",- "version": "0.1.57",+ "version": "0.1.58", "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.57",+ "version": "0.1.58", "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+29−34@@ -221,7 +221,7 @@ 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, GROUND=[];+ let SC=null, GROUND_PLANE=null, SHADOW_GEN=null, SHADOW_LIGHT=null; function attach(key,meshes){ meshes=meshes.filter(m=>!/ground|sky|env|viewcube|axis|grid|arcRotate|Background|__root__/i.test(m.name||"")); const L=byKey[key];@@ -332,36 +332,33 @@ exported bodies + design rules.</p> quad("mask_bot","layer-mask-bot.png",-0.075*mm,true,false); quad("silk_bot","layer-silk-bot.png",-0.083*mm,true,false); - // fallback rig only if the bundle's own rig is absent- let sg=null;- if(sc.lights.length===0){- new (B().HemisphericLight)("hemi",new (B().Vector3)(0.2,0.2,1),sc).intensity=1.0;- const key=new (B().DirectionalLight)("key",new (B().Vector3)(-0.4,-0.5,-1),sc);- key.intensity=1.3; key.position=new (B().Vector3)(0.1,0.1,0.3);- sg=new (B().ShadowGenerator)(2048,key); sg.useBlurExponentialShadowMap=true;- }else{- sc.lights.forEach(l=>{ const g=l.getShadowGenerator&&l.getShadowGenerator(); if(g&&!sg) sg=g; });- }- if(sg){- LAYERS.forEach(L=>L.meshes.forEach(m=>{ try{ sg.addShadowCaster(m,true);}catch(e){} }));- // the bundle freezes the shadow map after load - re-render it EVERY frame so- // shadows track the moving layers- try{- const smap=sg.getShadowMap();- smap.refreshRate=B().RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME;- if(sg.getLight&&sg.getLight().autoUpdateExtends!==undefined) sg.getLight().autoUpdateExtends=true;- }catch(e){}- }+ // Our OWN shadow rig (the bundle's ground has a null material + darkness 0 in this+ // sandbox, so it catches nothing). A directional light casts every layer onto a+ // dedicated semi-transparent ground we own.+ if(sc.lights.length===0){ new (B().HemisphericLight)("rm_hemi",new (B().Vector3)(0.2,0.2,1),sc).intensity=0.9; }+ SHADOW_LIGHT=new (B().DirectionalLight)("rm_shadow",new (B().Vector3)(-0.35,-0.45,-1),sc);+ SHADOW_LIGHT.position=new (B().Vector3)(0.02,0.02,0.15);+ SHADOW_LIGHT.intensity=0.0001; // essentially only a shadow source (env already lights)+ SHADOW_LIGHT.autoUpdateExtends=true; SHADOW_LIGHT.shadowMinZ=0.001; SHADOW_LIGHT.shadowMaxZ=0.5;+ SHADOW_GEN=new (B().ShadowGenerator)(2048,SHADOW_LIGHT);+ SHADOW_GEN.useBlurCloseExponentialShadowMap=true; SHADOW_GEN.blurKernel=24; SHADOW_GEN.darkness=0.15;+ SHADOW_GEN.getShadowMap().refreshRate=B().RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME;+ LAYERS.forEach(L=>L.meshes.forEach(m=>{ try{ SHADOW_GEN.addShadowCaster(m,true);}catch(e){} }));++ // Dedicated ground: a big plane just under the board. Semi-transparent (see under the+ // board) but it RECEIVES the shadow so the animation reads in 3D.+ GROUND_PLANE=B().MeshBuilder.CreateGround("adomGround",{width:0.3,height:0.3},sc);+ GROUND_PLANE.rotation.x=-Math.PI/2; // ground is XZ by default; scene is z-up -> face +Z+ GROUND_PLANE.position=new (B().Vector3)(0.0252,0.0132,-0.001);+ const gm=new (B().StandardMaterial)("adomGroundMat",sc);+ gm.diffuseColor=new (B().Color3)(0.5,0.52,0.55); gm.specularColor=new (B().Color3)(0,0,0);+ gm.alpha=0.2; gm.backFaceCulling=false;+ GROUND_PLANE.material=gm; GROUND_PLANE.receiveShadows=true;+ // hide the bundle's decorative background ground/skybox tinting I mistakenly touched+ sc.meshes.filter(m=>/BackgroundSkybox/i.test(m.name||"")).forEach(m=>{ try{ if(m.material) m.material.alpha=1; }catch(e){} }); // ground: 80% transparent, receives shadows- GROUND=sc.meshes.filter(m=>/ground/i.test(m.name||""));- GROUND.forEach(m=>{- try{- m.receiveShadows=true;- if(m.material){ m.material.alpha=0.2; m.material.transparencyMode=2; if("useAlphaFromDiffuseTexture" in m.material) m.material.useAlphaFromDiffuseTexture=false; }- m.visibility=1;- }catch(e){}- });+ // frame: assembled view + headroom for the +55mm cascade setTimeout(function(){@@ -482,8 +479,7 @@ exported bodies + design rules.</p> const btnGround=document.getElementById("btn-ground"); btnGround.addEventListener("click",function(){ groundOn=!groundOn;- const sc=viewer.getScene();- sc.meshes.filter(m=>/ground/i.test(m.name||"")).forEach(m=>{ try{ m.setEnabled(groundOn); }catch(e){} });+ if(GROUND_PLANE) GROUND_PLANE.setEnabled(groundOn); btnGround.classList.toggle("active",groundOn); set(groundOn?"ground shown":"ground hidden"); });@@ -492,9 +488,8 @@ exported bodies + design rules.</p> const btnShadows=document.getElementById("btn-shadows"); btnShadows.addEventListener("click",function(){ shadowsOn=!shadowsOn;- const sc=viewer.getScene();- sc.shadowsEnabled=shadowsOn;- sc.lights.forEach(l=>{ const g=l.getShadowGenerator&&l.getShadowGenerator(); if(g&&g.getShadowMap()) g.getShadowMap().refreshRate = shadowsOn ? window.BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME : 0; });+ if(SHADOW_GEN && SHADOW_GEN.getShadowMap()) SHADOW_GEN.getShadowMap().refreshRate = shadowsOn ? window.BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME : 0;+ if(GROUND_PLANE) GROUND_PLANE.receiveShadows = shadowsOn; btnShadows.classList.toggle("active",shadowsOn); set(shadowsOn?"shadows on":"shadows off"); });