Devesh36/orbit-turntable
ORBIT is a USB-C-powered display turntable for photographing jewellery, models and small products. Four-layer ESP32-C3 / ULN2003 PCB, geared stepper, OLED, push encoder, home switch and buzzer, with an enclosed and exploded assembly. Hardware prototype; firmware and physical qualification remain separate.
- Version
- 0.1.1
- License
- unset
- Stars
- 0
scripts/render-assembly.ts
import {readFile,writeFile,mkdir} from 'node:fs/promises'
import {convertCircuitJsonToGltf} from 'circuit-json-to-gltf'
import {renderGLTFToPNGFromGLB} from 'poppygl'
await mkdir('mechanical',{recursive:true})
for(const name of ['assembly','exploded']){
const circuit=JSON.parse(await readFile(`dist/${name}/circuit.json`,'utf8'))
const glb=await convertCircuitJsonToGltf(circuit,{format:'glb',includeModels:true,showBoundingBoxes:false,boardTextureResolution:1024})
if(!(glb instanceof ArrayBuffer))throw new Error('Expected GLB')
await writeFile(`mechanical/${name}.glb`,new Uint8Array(glb))
const png=await renderGLTFToPNGFromGLB(glb,{width:1500,height:1300,camPos:name==='exploded'?[175,185,-190]:[115,120,-115],lookAt:[0,name==='exploded'?42:12,35],up:'y+',backgroundColor:'#edf1f5',grid:false,realistic:true,supersampling:1})
await writeFile(`mechanical/${name}.png`,png)
console.log(`Rendered ${name}`)
}
