@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.
- package/dist/dist.dev.js +12001 -38
- package/dist/dist.min.js +13 -4
- package/dist/index.cjs +47 -20
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +4 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -15
- package/dist/lib/get-ply-schema.d.ts +1 -1
- package/dist/lib/get-ply-schema.d.ts.map +1 -1
- package/dist/lib/get-ply-schema.js +4 -1
- package/dist/lib/normalize-ply.d.ts.map +1 -1
- package/dist/lib/normalize-ply.js +4 -1
- package/dist/lib/parse-ply-in-batches.d.ts.map +1 -1
- package/dist/lib/parse-ply-in-batches.js +3 -0
- package/dist/lib/parse-ply.d.ts.map +1 -1
- package/dist/lib/parse-ply.js +3 -0
- package/dist/ply-arrow-loader.d.ts +23 -0
- package/dist/ply-arrow-loader.d.ts.map +1 -0
- package/dist/ply-arrow-loader.js +20 -0
- package/dist/ply-format.d.ts +16 -0
- package/dist/ply-format.d.ts.map +1 -0
- package/dist/ply-format.js +19 -0
- package/dist/ply-loader.d.ts +25 -1
- package/dist/ply-loader.d.ts.map +1 -1
- package/dist/ply-loader.js +18 -2
- package/dist/ply-worker.js +26 -28
- package/package.json +6 -5
- package/src/index.ts +4 -22
- package/src/lib/get-ply-schema.ts +6 -1
- package/src/lib/normalize-ply.ts +5 -1
- package/src/lib/parse-ply-in-batches.ts +4 -0
- package/src/lib/parse-ply.ts +4 -0
- package/src/ply-arrow-loader.ts +25 -0
- package/src/ply-format.ts +22 -0
- package/src/ply-loader.ts +21 -3
package/dist/ply-worker.js
CHANGED
|
@@ -237,28 +237,7 @@
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
// src/
|
|
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/
|
|
934
|
-
var
|
|
935
|
-
|
|
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(
|
|
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
|
+
"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.
|
|
46
|
-
"@loaders.gl/schema": "4.
|
|
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": "
|
|
50
|
+
"@loaders.gl/core": "4.4.0-alpha.1"
|
|
50
51
|
},
|
|
51
|
-
"gitHead": "
|
|
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 {
|
|
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
|
-
|
|
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
|
/**
|
package/src/lib/normalize-ply.ts
CHANGED
|
@@ -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
|
|
package/src/lib/parse-ply.ts
CHANGED
|
@@ -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
|
|
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>;
|