← Commit history

Initial commit: app/adom-glb2png

Kyle Bergstedt ·f4bb5b1b3f ·4mo ago
2 files changed +81
README.mdadded+27
@@ -0,0 +1,27 @@+# adom-glb2png++Render a GLB file to a PNG via headless three.js. Useful for verifying 3D component models without spinning up a webview + screenshot loop.++## Usage++```+adom-glb2png <glb-path> [--view top|iso|front|side|bottom] [--size N] [--out path]+```++- `--view` — camera direction, defaults to `iso`+- `--size` — output image is square `size × size`, defaults to 800+- `--out`  — output PNG path, defaults to `<basename>.png`++Exit codes: `0` on success, `1` on render error, `2` on bad input.++## How it works++A small Bun-compiled binary that spins up a headless Chromium (via puppeteer) pointing at a tiny three.js viewer page, loads the GLB, frames the camera so the bbox diagonal fills ~70% of the viewport, screenshots, exits.++- Camera near-plane is `0.0001` because most KiCad-pipeline GLBs use meters (a 0402 resistor's bbox diagonal is ~0.0012m).+- Double-render with `requestAnimationFrame` between passes makes the output buffer non-empty reliably under SwiftShader.+- First run downloads Chromium (~150 MB) into `~/.cache/puppeteer/`. Subsequent runs reuse the cache.++## Source++github.com/adom-inc/adom-glb2png
page.jsonadded+54
@@ -0,0 +1,54 @@+{+  "schema_version": 1,+  "type": "app",+  "slug": "adom-glb2png",+  "title": "adom-glb2png",+  "brief": "Render a GLB to a PNG via headless three.js. CLI sibling to step2glb / adom-pin1-truth — gives Claude (and you) a way to verify 3D component models without spinning up a webview screenshot loop.",+  "version": "0.1.0",+  "tags": [],+  "license": "MIT",+  "sample_prompts": [+    {+      "label": "0402 iso",+      "prompt": "adom-glb2png R_0402.glb --view iso --size 600 --out R_0402.png"+    },+    {+      "label": "Top down",+      "prompt": "adom-glb2png MyChip.glb --view top --size 800 --out MyChip_top.png"+    },+    {+      "label": "Quick check",+      "prompt": "adom-glb2png foo.glb"+    },+    {+      "label": "Help",+      "prompt": "adom-glb2png --help"+    },+    {+      "label": "Version",+      "prompt": "adom-glb2png --version"+    }+  ],+  "install": {+    "binary_name": "adom-glb2png",+    "install_dir": "",+    "install_hint": "",+    "version_cmd": ""+  },+  "readme": "# adom-glb2png\n\nRender a GLB file to a PNG via headless three.js. Useful for verifying 3D component models without spinning up a webview + screenshot loop.\n\n## Usage\n\n```\nadom-glb2png <glb-path> [--view top|iso|front|side|bottom] [--size N] [--out path]\n```\n\n- `--view` — camera direction, defaults to `iso`\n- `--size` — output image is square `size × size`, defaults to 800\n- `--out`  — output PNG path, defaults to `<basename>.png`\n\nExit codes: `0` on success, `1` on render error, `2` on bad input.\n\n## How it works\n\nA small Bun-compiled binary that spins up a headless Chromium (via puppeteer) pointing at a tiny three.js viewer page, loads the GLB, frames the camera so the bbox diagonal fills ~70% of the viewport, screenshots, exits.\n\n- Camera near-plane is `0.0001` because most KiCad-pipeline GLBs use meters (a 0402 resistor's bbox diagonal is ~0.0012m).\n- Double-render with `requestAnimationFrame` between passes makes the output buffer non-empty reliably under SwiftShader.\n- First run downloads Chromium (~150 MB) into `~/.cache/puppeteer/`. Subsequent runs reuse the cache.\n\n## Source\n\ngithub.com/adom-inc/adom-glb2png\n",+  "author": {+    "id": "695820315b5f1e4db2fcf602",+    "name": "Kyle Bergstedt",+    "email": "[email protected]"+  },+  "visibility": {+    "public": true+  },+  "hero": null,+  "discovery_triggers": [],+  "discovery_pitch": null,+  "metadata": {},+  "created_at": "2026-05-28T05:29:14.676Z",+  "updated_at": "2026-05-28T05:29:14.676Z",+  "skills": []+}\ No newline at end of file