# Renderer STEP conversion tooling

This directory contains the OpenCascade.js build recipe and local measurement helpers for browser-side STEP conversion.

```text
Dioxus app
  ├─ renderer worker: `polymodel-renderer-worker`
  └─ STEP conversion worker: `public/step_worker_loader.js` → `public/step_worker.js`
```

The STEP worker owns OpenCascade.js initialization, STEP import, tessellation, GLB export, and timing/error reporting. The app receives GLB bytes, creates a `Blob` object URL, and sends that URL to the existing renderer worker as `MeshFormat::Gltf`.

## Expected OpenCascade.js artifacts

The committed worker harness expects local/generated artifacts at:

```text
public/vendor/opencascade/opencascade.js
public/vendor/opencascade/opencascade.wasm
```

These files are intentionally ignored by git. The current build is single-threaded, so it does not produce an `opencascade.worker.js` sidecar and does not require cross-origin isolation headers.

## Custom build target

`opencascade.yml` records the intended single-threaded STEP→GLB build.

To build and stage the custom artifact from Docker:

```sh
just build-opencascade-step
```

The recipe uses `donalffons/opencascade.js` by default. Override with `OPENCASCADE_JS_DOCKER_IMAGE=...` if a different build image is needed.

## Full npm control

To stage the published full build for a browser control run:

```sh
node tools/renderer-step/prepare-full-npm-control.mjs
node tools/renderer-step/measure-assets.mjs
```

This copies only the published JS/WASM pair into `public/vendor/opencascade/`; it does not add npm dependencies or Cargo dependencies to the app.

See `evidence.md` for measurements and browser observations.
