three-slicer-viewer 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/TOOLPATH_SPEC.md CHANGED
@@ -53,7 +53,7 @@ being rewritten (`core/toolpath_views.js`, `use_move_scrub.js`). Everything else
53
53
  | `nTrav` | number | travel segments |
54
54
  | `nV` | number | vertices in the extrusion stream |
55
55
  | `position` | Float32Array | per-vertex geometry input |
56
- | `hwa` | Float32Array | per-vertex height / width / orientation |
56
+ | `hwa` | Float32Array | per-vertex height / width / joined heading / packed colour |
57
57
  | `segIndex` | Uint32Array | per-vertex segment identity |
58
58
  | `layerSegPrefix` | Uint32Array, length `layerCount + 1` | non-decreasing; `[0] === 0`, `[layerCount] === nSeg` |
59
59
  | `travelPos`, `travelPrefix`, `nTrav` | — | the same, for travels |
@@ -94,6 +94,10 @@ Requirements:
94
94
  0.2 mm layer: the bead spans half a layer height either side.
95
95
  - Orientation follows the segment direction in the XY plane.
96
96
  - Width and height come from `meta`, per vertex, so two segments in one draw call can differ.
97
+ - Consecutive beads meet. An endpoint shared with the next extrusion of the same layer (or, closing a loop, with
98
+ the first of its run) carries that neighbour's heading in `hwa[+2]`, and the side corners there sit on the
99
+ bisector of the two headings. Square ends left a wedge on the outside of every turn and a corner of every short
100
+ segment sticking out of a curved wall. Turns sharper than 140 degrees keep the square end.
97
101
 
98
102
  `makeToolpath(THREE, data) -> ToolpathHandle` builds the scene objects. The `THREE` namespace is **passed
99
103
  in, never imported** — that is what guarantees the consumer's own three.js instance is used, and it is why
@@ -106,7 +110,10 @@ setLayerRange(lo, hi) show only layers lo..hi inclusive
106
110
  setVisibleLayers(n) === setLayerRange(0, n - 1)
107
111
  setTravelVisible(bool) travels start hidden
108
112
  setColors(Float32Array) swap the per-vertex colours in place, without rebuilding geometry
113
+ setMoveRange(at) draw the top shown layer up to its move `at` (null = whole range again); returns
114
+ moveCursor's answer plus the `layer` it walked — the move scrub (use_move_scrub.js)
109
115
  dispose() release GPU resources
116
+ data the SegmentData it was built from — the move scrub counts moves in it
110
117
  nSeg, layerCount mirrored from the data
111
118
  ```
112
119
 
package/VIEWER.md CHANGED
@@ -256,6 +256,7 @@ opt-out only, everything on unless you say `false`, an unknown key stays on.
256
256
  | `filePicker` | The file dialog never opens, from any of the buttons that open it. |
257
257
  | `contextMenu` | No right-click menu. The browser's own menu stays suppressed over the canvas either way — OrbitControls preventDefaults `contextmenu` itself. |
258
258
  | `logs` | No console output, from the component or from the slice worker. |
259
+ | `versionBadge` | The build number at the right end of the status bar is not drawn. It is there so a bug report can name a build; turn it off when the viewer is embedded as part of your own product. `panels.status: false` hides it too, since it rides that bar. |
259
260
 
260
261
  ### Read-only panels
261
262
 
@@ -395,6 +396,29 @@ for 143MB) against a 4GB pool budget, which gives 2 for that model and does not
395
396
  manual count is capped the same way. What the browser has NOT measured yet is
396
397
  the arachne + tree-support preset, where the harness gains were largest.
397
398
 
399
+ ### The contour union on the GPU
400
+
401
+ The slice bar's **GPU** select (`gpu_acceleration` in the settings map: `auto`, `on`, `off`; absent is `auto`; a viewer
402
+ knob like `slice_workers`, not a kernel parameter) lets the slicer worker compute every layer's contour union with
403
+ WebGPU instead of Clipper. `auto` asks for it only when the single-threaded kernel loaded, `on` on either kernel,
404
+ `off` never. It applies to the selected plate's filament slice; pool workers, multi-material and resin slices compute
405
+ their contours themselves.
406
+
407
+ Measured in node (Dawn, Metal, 15 cores) with the kernel consuming the GPU's contours:
408
+
409
+ | model | kernel | CPU | GPU |
410
+ |---|---|---|---|
411
+ | 3M-facet scan, tree slim support, 420 layers | st | 9.6-9.8 s | 7.6-7.7 s |
412
+ | 1.13M-facet plate, tree hybrid support, 849 layers | st | 105 s | 102-104 s |
413
+ | either | mt | | within run-to-run spread of the CPU slice |
414
+
415
+ The union is about 2.5 s of the single-threaded slice and 50-100 ms on the GPU; on the threaded kernel the same union is
416
+ already spread over the threads, which is why `auto` leaves it alone. What it costs: the GPU's contours have the CPU
417
+ union's area (within 2e-10 relative) and other vertices, so the G-code is not the CPU slice's byte for byte (filament
418
+ within 0.3 % in those two models). The slice never depends on the GPU: without a device, or when the GPU refuses an
419
+ input, the kernel slices by itself, a layer whose loops the GPU leaves open gets the kernel's own union, and the stats
420
+ card says which happened (`Contours on the GPU`, with the count of layers that went back to the CPU).
421
+
398
422
  ## Theming
399
423
 
400
424
  Both shadow roots (the viewer and `<SettingsPanel/>`) paint their chrome from one palette, `UI_TOKENS` in