xyz-tools / gcode-preview

A simple GCode parser & previewer lib with 3D printing in mind. Written in Typescript.
https://gcode-preview.web.app/
MIT License
160 stars 31 forks source link

Use clipping to render layers with `startLayer` and `endLayer` #234

Closed sophiedeziel closed 3 weeks ago

sophiedeziel commented 3 weeks ago

Part of https://github.com/remcoder/gcode-preview/issues/221

This PR ended up needing more changes than I initially anticipated, but it's leaving the files in a better state than when I started.

The first implementation of clipping turned out to be easy to add. It became complex after needing to batch lines together as well to have a single material with the clipping planes.

Progressive rendering is always a forcing function for good implementations. You'll notice how clean the rendering methods turned out! All lines and tube use some sort of batching per color, and batches can be build progressively. The difference with how it's implemented. Instead of using layers, it uses subsets of paths.

Todo

github-actions[bot] commented 3 weeks ago

Visit the preview URL for this PR (updated for commit 92acbf6):

https://gcode-preview--pr234-10-17-partial-render-lovgumqh.web.app

(expires Thu, 21 Nov 2024 02:20:08 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 59bd114ae4847b32c2bba0b68620b9069a3e3531