智慧水务管理系统 - 精河县供水工程综合管理平台

draco_minimal_decoder_example.js 1.0KB

1234567891011121314151617181920212223242526272829303132
  1. // This is a minimal example showing how to create the Draco decoder module.
  2. // The decoder module is created asynchronously, so you need to set a
  3. // callback to make sure it is initialized before you try and call the module.
  4. 'use_strict';
  5. const draco3d = require('./draco3d');
  6. let decoderModule = null;
  7. // The code to create the encoder and decoder modules is asynchronous.
  8. // draco3d.createDecoderModule will return a promise to a funciton with a
  9. // module as a parameter when the module has been fully initialized.
  10. // Create and set the decoder module.
  11. draco3d.createDecoderModule({}).then(function(module) {
  12. // This is reached when everything is ready, and you can call methods on
  13. // Module.
  14. decoderModule = module;
  15. console.log('Decoder Module Initialized!');
  16. moduleInitialized();
  17. });
  18. function moduleInitialized() {
  19. let decoder = new decoderModule.Decoder();
  20. // Do the actual decoding here. See 'draco_nodejs_example.js' for a more
  21. // comprehensive example.
  22. cleanup(decoder);
  23. }
  24. function cleanup(decoder) {
  25. decoderModule.destroy(decoder);
  26. }