ricosjp / truck

Truck is a Rust CAD Kernel.
Apache License 2.0
1.02k stars 53 forks source link

How to convert Solid or Shell to triangle mesh for rendering? #42

Closed MattFerraro closed 1 year ago

MattFerraro commented 1 year ago

I've been able to generate Solids and Shells in Rust, but I'd like to create a triangle mesh that I can send to three.js for rendering. Clearly truck is capable of generating that mesh, since we can view the bottle with webGPU, but I can't figure out how to do it! Could you offer some pointers?

ytanimura commented 1 year ago

Thank you for your question.

There are APIs for handling meshes with JavaScript.

There is an example for using truck with WebGL. In script.js,

MattFerraro commented 1 year ago

incredible, thank you!