google / draco

Draco is a library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.
https://google.github.io/draco/
Apache License 2.0
6.46k stars 960 forks source link

How to build the 'draco3d' npm package? #1017

Open Apidcloud opened 1 year ago

Apidcloud commented 1 year ago

Hello!

I need to rebuild the draco3d package with backwards compatibility off, but when I follow the BUILDING.md, it's only generating the following files:

image

Here's what I'm using:

Steps:

I also tried without -DDRACO_WASM=ON, but there's no javascript files being generated, to then use the closure compiler (as suggested in BUILDING.md).

What am I missing?

Thank you!

Edit: Just found https://github.com/google/draco/issues/793 but using the relative paths results in the same output. if there are no js files then it must be something with the emscripten installation, correct? I tried the following, but there's still no js files:

Edit 2:

Remaining questions:

Apidcloud commented 1 year ago

Ah. using this last version of paths without the intermediate cmake ../ worked. I tried without it before but I would get some error about not finding emscripten, so it makes sense.

For those wondering, here's what worked for me (with the latest emscripten):

Can you just confirm the default flags you use to build draco3d? As mentioned above I'm only looking to change the backwards compatibility to off, but the output still differs.

For instance, should I use -DDRACO_JS_GLUE=OFF ? What should I do to generate draco_decoder_nodejs ? Close compiler in simple or bundle mode don't seem to output the same as the draco_decoder_nodejs.js inside npm draco3d. I'm using Java 17.

Here's the current output (with js glue off) vs the npm draco3d files:

image

And here's the size comparison between the original npm draco3d package and the one I'm building locally:

image

Even in the wasm files there's a considerable file size difference.

But I must still be missing something more important, because when I replace the files and try to use this new rebuilt package, I get draco3d.createEncoderModule is not a function

I'll be happy to create a PR with all these details once I get it working.