Open hrgdavor opened 2 years ago
@hrgdavor what are you using in jscadui now?
it may be possible to switch some of the math to glmatrix as the libraries seem to be heading the same direction now.
@z3dev yes, I am using gl-matrix in the above mentioned treeshaking friendly way .. for example here https://github.com/hrgdavor/jscadui/blob/main/packages/orbit/src/calcCamPos.js
... a bit of digression:
I also am doing this freaky thing for one specific combined operation I need... https://github.com/hrgdavor/jscadui/blob/main/packages/orbit/fromXZRotation.gen.js
I was building sth regl related for jscad and seen that regl-renderer uses some fork of gl-matrix, as probably an old way to reduce size of the bundle. Also jscad has copy of glmatrix functions....
nowdays when we have build tools that easily do tree shaking with ES imodules it would be a good idea to start using gl-matrix directly again in jscad V3. While testing how tree shaking performs also take steps that jscad remains easy to tree shake.
for example, gl-matrix has deployed esm and cjs variants for each version so this type of improvement does not have to impact old usage patterns.
naively importing gl-matrix and using just one function creates a 35KB bundle (not minified)
but these two variants work nicely with esbuild and treeshaking produces only 600B of code (not minified)
or
produces this: