@loaders.gl/ply 4.3.2 → 4.4.0-alpha.2

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.
@@ -237,28 +237,7 @@
237
237
  }
238
238
  }
239
239
 
240
- // src/ply-loader.ts
241
- var VERSION = true ? "4.3.1" : "latest";
242
- var PLYLoader = {
243
- dataType: null,
244
- batchType: null,
245
- name: "PLY",
246
- id: "ply",
247
- module: "ply",
248
- // shapes: ['mesh', 'gltf', 'columnar-table'],
249
- version: VERSION,
250
- worker: true,
251
- extensions: ["ply"],
252
- mimeTypes: ["text/plain", "application/octet-stream"],
253
- text: true,
254
- binary: true,
255
- tests: ["ply"],
256
- options: {
257
- ply: {}
258
- }
259
- };
260
-
261
- // ../schema/src/lib/table/simple-table/data-type.ts
240
+ // ../schema-utils/src/lib/schema/data-type.ts
262
241
  function getDataTypeFromTypedArray(array) {
263
242
  switch (array.constructor) {
264
243
  case Int8Array:
@@ -283,7 +262,7 @@
283
262
  }
284
263
  }
285
264
 
286
- // ../schema/src/lib/mesh/mesh-utils.ts
265
+ // ../schema-utils/src/lib/mesh/mesh-utils.ts
287
266
  function getMeshBoundingBox(attributes) {
288
267
  let minX = Infinity;
289
268
  let minY = Infinity;
@@ -310,7 +289,7 @@
310
289
  ];
311
290
  }
312
291
 
313
- // ../schema/src/lib/mesh/deduce-mesh-schema.ts
292
+ // ../schema-utils/src/lib/mesh/deduce-mesh-schema.ts
314
293
  function deduceMeshSchema(attributes, metadata = {}) {
315
294
  const fields = deduceMeshFields(attributes);
316
295
  return { fields, metadata };
@@ -930,9 +909,28 @@
930
909
  }
931
910
  }
932
911
 
933
- // src/index.ts
934
- var PLYLoader2 = {
935
- ...PLYLoader,
912
+ // src/ply-loader.ts
913
+ var VERSION = true ? "4.4.0-alpha.1" : "latest";
914
+ var PLYWorkerLoader = {
915
+ dataType: null,
916
+ batchType: null,
917
+ name: "PLY",
918
+ id: "ply",
919
+ module: "ply",
920
+ // shapes: ['mesh', 'gltf', 'columnar-table'],
921
+ version: VERSION,
922
+ worker: true,
923
+ extensions: ["ply"],
924
+ mimeTypes: ["text/plain", "application/octet-stream"],
925
+ text: true,
926
+ binary: true,
927
+ tests: ["ply"],
928
+ options: {
929
+ ply: {}
930
+ }
931
+ };
932
+ var PLYLoader = {
933
+ ...PLYWorkerLoader,
936
934
  // Note: parsePLY supports both text and binary
937
935
  parse: async (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
938
936
  // TODO - this may not detect text correctly?
@@ -942,5 +940,5 @@
942
940
  };
943
941
 
944
942
  // src/workers/ply-worker.ts
945
- createLoaderWorker(PLYLoader2);
943
+ createLoaderWorker(PLYLoader);
946
944
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/ply",
3
- "version": "4.3.2",
3
+ "version": "4.4.0-alpha.2",
4
4
  "description": "Framework-independent loader for the PLY format",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,11 +42,12 @@
42
42
  "build-worker": "esbuild src/workers/ply-worker.ts --bundle --outfile=dist/ply-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
43
43
  },
44
44
  "dependencies": {
45
- "@loaders.gl/loader-utils": "4.3.2",
46
- "@loaders.gl/schema": "4.3.2"
45
+ "@loaders.gl/loader-utils": "4.4.0-alpha.2",
46
+ "@loaders.gl/schema": "4.4.0-alpha.2",
47
+ "@loaders.gl/schema-utils": "4.4.0-alpha.2"
47
48
  },
48
49
  "peerDependencies": {
49
- "@loaders.gl/core": "^4.3.0"
50
+ "@loaders.gl/core": "4.4.0-alpha.1"
50
51
  },
51
- "gitHead": "b4203b8703f64a38d6f79a3113bc7bb51d45c93a"
52
+ "gitHead": "3d9fed050eabdc0812ddf2f4d5fb9914a34ee0c2"
52
53
  }
package/src/index.ts CHANGED
@@ -2,27 +2,9 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import type {LoaderWithParser} from '@loaders.gl/loader-utils';
6
- import type {PLYMesh} from './lib/ply-types';
7
- import type {PLYLoaderOptions} from './ply-loader';
8
- import {PLYLoader as PLYWorkerLoader} from './ply-loader';
9
- import {parsePLY} from './lib/parse-ply';
10
- import {parsePLYInBatches} from './lib/parse-ply-in-batches';
11
-
12
5
  // PLYLoader
6
+ export {PLYFormat} from './ply-format';
13
7
 
14
- export type {PLYLoaderOptions};
15
-
16
- export {PLYWorkerLoader};
17
-
18
- /**
19
- * Loader for PLY - Polygon File Format
20
- */
21
- export const PLYLoader = {
22
- ...PLYWorkerLoader,
23
- // Note: parsePLY supports both text and binary
24
- parse: async (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply), // TODO - this may not detect text correctly?
25
- parseTextSync: (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
26
- parseSync: (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
27
- parseInBatches: (arrayBuffer, options) => parsePLYInBatches(arrayBuffer, options?.ply)
28
- } as const satisfies LoaderWithParser<PLYMesh, any, PLYLoaderOptions>;
8
+ export type {PLYLoaderOptions} from './ply-loader';
9
+ export {PLYWorkerLoader, PLYLoader} from './ply-loader';
10
+ export {PLYArrowLoader} from './ply-arrow-loader';
@@ -1,4 +1,9 @@
1
- import {Schema, MeshAttributes, deduceMeshSchema} from '@loaders.gl/schema';
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {Schema, MeshAttributes} from '@loaders.gl/schema';
6
+ import {deduceMeshSchema} from '@loaders.gl/schema-utils';
2
7
  import type {PLYHeader} from './ply-types';
3
8
 
4
9
  /**
@@ -1,5 +1,9 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import type {MeshAttributes} from '@loaders.gl/schema';
2
- import {getMeshBoundingBox} from '@loaders.gl/schema';
6
+ import {getMeshBoundingBox} from '@loaders.gl/schema-utils';
3
7
  import type {PLYMesh, PLYHeader, PLYAttributes, MeshHeader} from './ply-types';
4
8
  import {getPLYSchema} from './get-ply-schema';
5
9
 
@@ -1,3 +1,7 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  // PLY Loader, adapted from THREE.js (MIT license)
2
6
  //
3
7
  // Attributions per original THREE.js source file:
@@ -1,3 +1,7 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  // PLY Loader, adapted from THREE.js (MIT license)
2
6
  //
3
7
  // Attributions per original THREE.js source file:
@@ -0,0 +1,25 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {LoaderWithParser} from '@loaders.gl/loader-utils';
6
+ import type {ArrowTable} from '@loaders.gl/schema';
7
+
8
+ import {PLYLoaderOptions, PLYWorkerLoader} from './ply-loader';
9
+ import {convertMeshToTable} from '@loaders.gl/schema-utils';
10
+ import {parsePLY} from './lib/parse-ply';
11
+
12
+ /**
13
+ * Worker loader for PLY -
14
+ */
15
+ export const PLYArrowLoader = {
16
+ ...PLYWorkerLoader,
17
+ dataType: null as unknown as ArrowTable,
18
+ batchType: null as never,
19
+ worker: false,
20
+ parse: async (arrayBuffer: ArrayBuffer) => {
21
+ const mesh = parsePLY(arrayBuffer);
22
+ const arrowTable = convertMeshToTable(mesh, 'arrow-table');
23
+ return arrowTable;
24
+ }
25
+ } as const satisfies LoaderWithParser<ArrowTable, never, PLYLoaderOptions>;
@@ -0,0 +1,22 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {Format} from '@loaders.gl/loader-utils';
6
+
7
+ /**
8
+ * PLY - Polygon File Format (aka Stanford Triangle Format)
9
+ * @see http://paulbourke.net/dataformats/ply/,
10
+ * @see https://en.wikipedia.org/wiki/PLY_(file_format)
11
+ */
12
+ export const PLYFormat = {
13
+ name: 'PLY',
14
+ id: 'ply',
15
+ module: 'ply',
16
+ // shapes: ['mesh', 'gltf', 'columnar-table'],
17
+ extensions: ['ply'],
18
+ mimeTypes: ['text/plain', 'application/octet-stream'],
19
+ text: true,
20
+ binary: true,
21
+ tests: ['ply']
22
+ } as const satisfies Format;
package/src/ply-loader.ts CHANGED
@@ -1,7 +1,13 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  // PLY Loader
2
- import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';
3
- import {PLYMesh} from './lib/ply-types';
6
+ import type {Loader, LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
7
+ import type {PLYMesh} from './lib/ply-types';
4
8
  import type {ParsePLYOptions} from './lib/parse-ply';
9
+ import {parsePLY} from './lib/parse-ply';
10
+ import {parsePLYInBatches} from './lib/parse-ply-in-batches';
5
11
 
6
12
  // __VERSION__ is injected by babel-plugin-version-inline
7
13
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -19,7 +25,7 @@ export type PLYLoaderOptions = LoaderOptions & {
19
25
  * links: ['http://paulbourke.net/dataformats/ply/',
20
26
  * 'https://en.wikipedia.org/wiki/PLY_(file_format)']
21
27
  */
22
- export const PLYLoader = {
28
+ export const PLYWorkerLoader = {
23
29
  dataType: null as unknown as PLYMesh,
24
30
  batchType: null as never,
25
31
 
@@ -38,3 +44,15 @@ export const PLYLoader = {
38
44
  ply: {}
39
45
  }
40
46
  } as const satisfies Loader<PLYMesh, never, LoaderOptions>;
47
+
48
+ /**
49
+ * Loader for PLY - Polygon File Format
50
+ */
51
+ export const PLYLoader = {
52
+ ...PLYWorkerLoader,
53
+ // Note: parsePLY supports both text and binary
54
+ parse: async (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply), // TODO - this may not detect text correctly?
55
+ parseTextSync: (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
56
+ parseSync: (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
57
+ parseInBatches: (arrayBuffer, options) => parsePLYInBatches(arrayBuffer, options?.ply)
58
+ } as const satisfies LoaderWithParser<PLYMesh, any, PLYLoaderOptions>;