@loaders.gl/draco 3.2.0-alpha.1 → 3.2.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,15 @@
1
- import type {Writer} from '@loaders.gl/loader-utils';
1
+ import type {Writer, WriterOptions} from '@loaders.gl/loader-utils';
2
2
  import type {DracoMesh} from './lib/draco-types';
3
3
  import type {DracoBuildOptions} from './lib/draco-builder';
4
4
  import DRACOBuilder from './lib/draco-builder';
5
5
  import {loadDracoEncoderModule} from './lib/draco-module-loader';
6
6
  import {VERSION} from './lib/utils/version';
7
7
 
8
- export type DracoWriterOptions = DracoBuildOptions & {};
8
+ export type DracoWriterOptions = WriterOptions & {
9
+ draco?: DracoBuildOptions & {
10
+ attributeNameEntry: string;
11
+ };
12
+ };
9
13
 
10
14
  const DEFAULT_DRACO_OPTIONS = {
11
15
  pointcloud: false, // Set to true if pointcloud (mode: 0, no indices)
@@ -33,10 +37,7 @@ export const DracoWriter: Writer = {
33
37
  }
34
38
  };
35
39
 
36
- async function encode(
37
- data: DracoMesh,
38
- options: {draco?: DracoWriterOptions} = {}
39
- ): Promise<ArrayBuffer> {
40
+ async function encode(data: DracoMesh, options: DracoWriterOptions = {}): Promise<ArrayBuffer> {
40
41
  // Dynamically load draco
41
42
  const {draco} = await loadDracoEncoderModule(options);
42
43
  const dracoBuilder = new DRACOBuilder(draco);
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@ import {DracoLoader as DracoWorkerLoader} from './draco-loader';
5
5
  import DracoParser from './lib/draco-parser';
6
6
  import {loadDracoDecoderModule} from './lib/draco-module-loader';
7
7
  import {VERSION} from './lib/utils/version';
8
+ import {isBrowser} from '@loaders.gl/worker-utils';
8
9
 
9
10
  // Draco data types
10
11
 
@@ -20,22 +21,14 @@ export {DracoWriter} from './draco-writer';
20
21
  * Refused to execute script from 'https://raw.githubusercontent.com/google/draco/1.4.1/javascript/draco_encoder.js' because its MIME type ('') is not executable.
21
22
  */
22
23
  export const DracoWriterWorker = {
23
- id: 'draco-writer',
24
+ id: isBrowser ? 'draco-writer' : 'draco-writer-nodejs',
24
25
  name: 'Draco compressed geometry writer',
25
26
  module: 'draco',
26
27
  version: VERSION,
28
+ worker: true,
27
29
  options: {
28
- draco: {}
29
- }
30
- };
31
-
32
- export const DracoWriterNodeJSWorker = {
33
- id: 'draco-writer-nodejs',
34
- name: 'Draco compressed geometry writer for NodeJS',
35
- module: 'draco',
36
- version: VERSION,
37
- options: {
38
- draco: {}
30
+ draco: {},
31
+ source: null
39
32
  }
40
33
  };
41
34