3D viewer: switch STEP engine to occt-wasm (OCCT V8, module worker); fix mobile rendering (Uint16 chunking, index wrapping, tight near/far); state-coloured box + debug line; app widget parity; licenses/docs
This commit is contained in:
+14
-6
@@ -40,10 +40,11 @@ exists as its own (published) file note — the model stays in one place.
|
||||
You can embed several models per post this way.
|
||||
|
||||
> Tip: STL (plain triangle meshes) is rendered with three.js only; STEP (CAD B-rep) is
|
||||
> parsed by occt-import-js (OpenCASCADE WASM, LGPL-2.1) in a **Web Worker** (non-blocking).
|
||||
> The first STEP view downloads the ~7.6 MB WASM once and then caches it in the browser.
|
||||
> STEP tessellation is set to `linearDeflection: 0.0002, angularDeflection: 0.1`
|
||||
> (dense meshes, typically a few hundred k to >1 M triangles for assemblies).
|
||||
> parsed by **occt-wasm** (OpenCASCADE **V8**, WASM, MIT/Apache-2.0) in a **Web Worker**
|
||||
> (module worker, non-blocking). The first STEP view downloads the ~22 MB WASM once and
|
||||
> then caches it in the browser.
|
||||
> STEP tessellation is set to `linearDeflection: 0.4, angularDeflection: 0.2`
|
||||
> (≈480k triangles for the ignis battery module; tuned for mobile).
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -51,8 +52,15 @@ exists as its own (published) file note — the model stays in one place.
|
||||
(inheritable) on the blog root, `shareHtmlLocation=body:end`.
|
||||
- The five libraries must exist as notes and be referenced by the script via the
|
||||
placeholder tokens in `scripts/3d_model_viewer.js`:
|
||||
`__THREE_ID__`, `__THREE_ORBIT_ID__`, `__THREE_STL_ID__`, `__OCCT_JS_ID__`,
|
||||
`__OCCT_WASM_ID__` (see the README installation for the note titles).
|
||||
`__THREE_ID__`, `__THREE_ORBIT_ID__`, `__THREE_STL_ID__`, `__OCCT_JS_ID__`
|
||||
(the occt-wasm **bundle**), `__OCCT_WASM_ID__` (occt-wasm.wasm) – see the README
|
||||
installation for the note titles. The STEP worker is a **module worker** (`type: "module"`),
|
||||
so the browser must support ES modules in workers (all modern browsers).
|
||||
- **Mobile compatibility**: the mesh is split into chunks of ≤65000 vertices
|
||||
(`chunkGeometry`, `Uint16` indices) so it renders on GPUs without
|
||||
`OES_element_index_uint`; the camera near/far is tightened after `fit()` for 16-bit
|
||||
depth buffers. The caption always shows a small **debug line** with the current step
|
||||
(`loading` / `parsing` / `done` / `error`) – useful while diagnosing.
|
||||
- For **inline embedding from a file note (Option C)** the `blog_data` note must be
|
||||
present and the target model must be a published article (the viewer resolves
|
||||
`./<alias>` links against `window.blogData`).
|
||||
|
||||
Reference in New Issue
Block a user