document wasm setup with wasmBinary
Currently, it is necessary to find examples which use the wasm version of draco to learn how to use it. Many examples refer back to https://github.com/google/draco/blob/master/javascript/time_draco_decode.html which appears to be only place in this repo where there is some documentation in a comment on:
- a config object with a wasmBinary property for DracoDecoderModule()
- how the property value has to be an ArrayBuffer (containing the binary wasm data)
Strictly speaking the wasmBinary configuration option is an emscripten feature and is part of the emscripten documentation. But since draco distributes the wasm file widely, it would be very beneficial to document briefly its use with the config object's wasmBinary property.
Documentation could be added to
https://codelabs.developers.google.com/codelabs/draco-3d/index.html#4
which uses the wasm wrapper but then does not seem to use the wasm file.
https://github.com/google/draco#wasm-and-javascript-decoders could be perhaps expanded.
Below was fixed by #968:
Relatedly,
https://github.com/google/draco/blob/master/javascript/time_draco_decode.html
sets up a config object for wasm in
https://github.com/google/draco/blob/master/javascript/time_draco_decode.html#L42
but then seemingly does not use it when the Module is created in
https://github.com/google/draco/blob/master/javascript/time_draco_decode.html#L54
Perhaps this is somehow intended but appears to be an oversight at first glance.
Finally,
Module['wasmBinaryFile'] is deprecated according to
https://groups.google.com/g/emscripten-discuss/c/66zg2GQO2vg?pli=1
It could likely be removed from the example.
After adding DracoDecoderType as in
DracoDecoderModule(dracoDecoderType).then((module) => {
the decode timing went down from 1.6ms to 0.5ms on my system. https://github.com/google/draco/pull/968 is short PR for consideration.
https://github.com/google/draco/commit/8a979f79a5f139880f17f296ace90bcfff025c4b#r98753400
seems to be the commit when this change was introduced.