Closed wallabyway closed 2 years ago
In https://github.com/petrbroz/forge-convert-utils/commit/b3397ebbccee75ccfff95cce7e7b1f49e054ad6c I've updated the GltfWriter
class so that you can override the actual serialization process. And the https://github.com/petrbroz/forge-convert-utils/blob/develop/samples/serialize-msgpack.js sample shows how you can pack the in-memory glTF manifest directly to msgpack.
related to this.. https://github.com/KhronosGroup/glTF/issues/1699
in the src/common/gltf/writer.ts file, this line 119...
... will crash
JSON.stringify
, because thethis.manifest
object is too large to serialize into a string (nodejs 8GB option).Instead, allow the writer to generate a msgpack (or BSON) output file, without invoking the JSON.stringify().
The current branch
experiment/BSON
uses a postProcess, but still executes JSON.stringify, and hence still crashes.In my limited testing, exporting to
msgpack
does the following:note: I used the faster...
const msgpack = require('msgpackr'); //https://github.com/kriszyp/msgpackr
and notconst msgpack = require('msgpack');
https://github.com/petrbroz/forge-convert-utils/blob/experiment/bson/samples/output-bson-msgpack.js