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

draco_minimal_encoder_example.js 1019B

12345678910111213141516171819202122232425262728293031
  1. // This is a minimal example showing how to create the Draco encoder module.
  2. // The encoder 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 encoderModule = null;
  7. // The code to create the encoder module is asynchronous.
  8. // draco3d.createEncoderModule will return a promise to a funciton with a
  9. // module as a parameter when the module has been fully initialized.
  10. draco3d.createEncoderModule({}).then(function(module) {
  11. // This is reached when everything is ready, and you can call methods on
  12. // Module.
  13. encoderModule = module;
  14. console.log('Encoder Module Initialized!');
  15. moduleInitialized();
  16. });
  17. function moduleInitialized() {
  18. let encoder = new encoderModule.Encoder();
  19. // Do the actual encoding here. See 'draco_nodejs_example.js' for a more
  20. // comprehensive example.
  21. cleanup(encoder);
  22. }
  23. function cleanup(encoder) {
  24. encoderModule.destroy(encoder);
  25. }