gradientspace / geometry3Sharp

C# library for 2D/3D geometric computation, mesh algorithms, and so on. Boost license.
http://www.gradientspace.com
Boost Software License 1.0
1.71k stars 384 forks source link

Cross-compilation to WASM? #121

Open johncalvinyoung opened 4 years ago

johncalvinyoung commented 4 years ago

Has anyone looked into trying to compile the C# to WASM? This library appears to be well ahead of any non-GPL library in JS, and I'd love to be able to bind it in to some heavy JS geometry work I'm doing. Not sure of the current state of the C#-to-WebAssembly ecosystem though...

visose commented 4 years ago

From what I understand there are two ways to approach this:

  1. Ahead of time compilation to wasm This is the route Unity takes, see: https://blogs.unity3d.com/2018/08/15/webassembly-is-here/ Unity's is probably the most tested/mature and performant.

  2. Only the runtime is compiled to wasm Mono has a wasm version of the runtime, this is used by Blazor (a SPA framework): https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor You can then run .NET dlls directly in the browser, they don't need to be compiled/transpiled. The main issue is performance, you are basically running a virtual machine (.NET) on top of a virtual machine (the javascript vm).

johncalvinyoung commented 4 years ago

Thanks for those details! I'm looking into the Unity approach.