@loaders.gl/ply 4.0.0-beta.2 → 4.0.0-beta.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.
Files changed (51) hide show
  1. package/dist/{dist.min.js → dist.dev.js} +102 -134
  2. package/dist/index.cjs +644 -0
  3. package/dist/{esm/index.js → index.js} +3 -3
  4. package/dist/index.js.map +1 -0
  5. package/dist/lib/get-ply-schema.js.map +1 -0
  6. package/dist/{esm/lib → lib}/normalize-ply.js +1 -1
  7. package/dist/lib/normalize-ply.js.map +1 -0
  8. package/dist/{esm/lib → lib}/parse-ply-in-batches.js +1 -1
  9. package/dist/lib/parse-ply-in-batches.js.map +1 -0
  10. package/dist/{esm/lib → lib}/parse-ply.js +1 -1
  11. package/dist/lib/parse-ply.js.map +1 -0
  12. package/dist/lib/ply-types.js.map +1 -0
  13. package/dist/{esm/ply-loader.js → ply-loader.js} +1 -1
  14. package/dist/ply-loader.js.map +1 -0
  15. package/dist/ply-worker.js +24 -4
  16. package/dist/{esm/workers → workers}/ply-worker.js +1 -1
  17. package/dist/workers/ply-worker.js.map +1 -0
  18. package/package.json +16 -8
  19. package/dist/bundle.d.ts +0 -2
  20. package/dist/bundle.d.ts.map +0 -1
  21. package/dist/es5/bundle.js +0 -6
  22. package/dist/es5/bundle.js.map +0 -1
  23. package/dist/es5/index.js +0 -51
  24. package/dist/es5/index.js.map +0 -1
  25. package/dist/es5/lib/get-ply-schema.js +0 -28
  26. package/dist/es5/lib/get-ply-schema.js.map +0 -1
  27. package/dist/es5/lib/normalize-ply.js +0 -93
  28. package/dist/es5/lib/normalize-ply.js.map +0 -1
  29. package/dist/es5/lib/parse-ply-in-batches.js +0 -289
  30. package/dist/es5/lib/parse-ply-in-batches.js.map +0 -1
  31. package/dist/es5/lib/parse-ply.js +0 -348
  32. package/dist/es5/lib/parse-ply.js.map +0 -1
  33. package/dist/es5/lib/ply-types.js +0 -2
  34. package/dist/es5/lib/ply-types.js.map +0 -1
  35. package/dist/es5/ply-loader.js +0 -24
  36. package/dist/es5/ply-loader.js.map +0 -1
  37. package/dist/es5/workers/ply-worker.js +0 -6
  38. package/dist/es5/workers/ply-worker.js.map +0 -1
  39. package/dist/esm/bundle.js +0 -4
  40. package/dist/esm/bundle.js.map +0 -1
  41. package/dist/esm/index.js.map +0 -1
  42. package/dist/esm/lib/get-ply-schema.js.map +0 -1
  43. package/dist/esm/lib/normalize-ply.js.map +0 -1
  44. package/dist/esm/lib/parse-ply-in-batches.js.map +0 -1
  45. package/dist/esm/lib/parse-ply.js.map +0 -1
  46. package/dist/esm/lib/ply-types.js.map +0 -1
  47. package/dist/esm/ply-loader.js.map +0 -1
  48. package/dist/esm/workers/ply-worker.js.map +0 -1
  49. package/src/bundle.ts +0 -4
  50. /package/dist/{esm/lib → lib}/get-ply-schema.js +0 -0
  51. /package/dist/{esm/lib → lib}/ply-types.js +0 -0
@@ -1,40 +1,53 @@
1
- (() => {
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if (typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if (typeof define === 'function' && define.amd) define([], factory);
5
+ else if (typeof exports === 'object') exports['loader'] = factory();
6
+ else root['loader'] = factory();})(globalThis, function () {
7
+ "use strict";
8
+ var __exports__ = (() => {
2
9
  var __defProp = Object.defineProperty;
3
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
4
- var __esm = (fn, res) => function __init() {
5
- return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res;
6
- };
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
+ var __getOwnPropNames = Object.getOwnPropertyNames;
12
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
13
  var __export = (target, all) => {
11
- __markAsModule(target);
12
14
  for (var name in all)
13
15
  __defProp(target, name, { get: all[name], enumerable: true });
14
16
  };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
+
27
+ // src/index.ts
28
+ var src_exports = {};
29
+ __export(src_exports, {
30
+ PLYLoader: () => PLYLoader2,
31
+ PLYWorkerLoader: () => PLYLoader
32
+ });
15
33
 
16
34
  // src/ply-loader.ts
17
- var VERSION, PLYLoader;
18
- var init_ply_loader = __esm({
19
- "src/ply-loader.ts"() {
20
- VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
21
- PLYLoader = {
22
- name: "PLY",
23
- id: "ply",
24
- module: "ply",
25
- version: VERSION,
26
- worker: true,
27
- extensions: ["ply"],
28
- mimeTypes: ["text/plain", "application/octet-stream"],
29
- text: true,
30
- binary: true,
31
- tests: ["ply"],
32
- options: {
33
- ply: {}
34
- }
35
- };
35
+ var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
36
+ var PLYLoader = {
37
+ name: "PLY",
38
+ id: "ply",
39
+ module: "ply",
40
+ version: VERSION,
41
+ worker: true,
42
+ extensions: ["ply"],
43
+ mimeTypes: ["text/plain", "application/octet-stream"],
44
+ text: true,
45
+ binary: true,
46
+ tests: ["ply"],
47
+ options: {
48
+ ply: {}
36
49
  }
37
- });
50
+ };
38
51
 
39
52
  // ../schema/src/lib/table/simple-table/data-type.ts
40
53
  function getDataTypeFromTypedArray(array) {
@@ -60,10 +73,6 @@
60
73
  return "null";
61
74
  }
62
75
  }
63
- var init_data_type = __esm({
64
- "../schema/src/lib/table/simple-table/data-type.ts"() {
65
- }
66
- });
67
76
 
68
77
  // ../schema/src/lib/mesh/mesh-utils.ts
69
78
  function getMeshBoundingBox(attributes) {
@@ -86,27 +95,30 @@
86
95
  maxY = y > maxY ? y : maxY;
87
96
  maxZ = z > maxZ ? z : maxZ;
88
97
  }
89
- return [
90
- [minX, minY, minZ],
91
- [maxX, maxY, maxZ]
92
- ];
98
+ return [[minX, minY, minZ], [maxX, maxY, maxZ]];
93
99
  }
94
- var init_mesh_utils = __esm({
95
- "../schema/src/lib/mesh/mesh-utils.ts"() {
96
- }
97
- });
98
100
 
99
101
  // ../schema/src/lib/mesh/deduce-mesh-schema.ts
100
102
  function deduceMeshSchema(attributes, metadata = {}) {
101
103
  const fields = deduceMeshFields(attributes);
102
- return { fields, metadata };
104
+ return {
105
+ fields,
106
+ metadata
107
+ };
103
108
  }
104
109
  function deduceMeshField(name, attribute, optionalMetadata) {
105
110
  const type = getDataTypeFromTypedArray(attribute.value);
106
111
  const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
107
112
  return {
108
113
  name,
109
- type: { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "value", type }] },
114
+ type: {
115
+ type: "fixed-size-list",
116
+ listSize: attribute.size,
117
+ children: [{
118
+ name: "value",
119
+ type
120
+ }]
121
+ },
110
122
  nullable: false,
111
123
  metadata
112
124
  };
@@ -132,19 +144,6 @@
132
144
  }
133
145
  return result;
134
146
  }
135
- var init_deduce_mesh_schema = __esm({
136
- "../schema/src/lib/mesh/deduce-mesh-schema.ts"() {
137
- init_data_type();
138
- }
139
- });
140
-
141
- // ../schema/src/index.ts
142
- var init_src = __esm({
143
- "../schema/src/index.ts"() {
144
- init_mesh_utils();
145
- init_deduce_mesh_schema();
146
- }
147
- });
148
147
 
149
148
  // src/lib/get-ply-schema.ts
150
149
  function getPLYSchema(plyHeader, attributes) {
@@ -167,11 +166,6 @@
167
166
  }
168
167
  return metadata;
169
168
  }
170
- var init_get_ply_schema = __esm({
171
- "src/lib/get-ply-schema.ts"() {
172
- init_src();
173
- }
174
- });
175
169
 
176
170
  // src/lib/normalize-ply.ts
177
171
  function normalizePLY(plyHeader, plyAttributes, options) {
@@ -191,12 +185,18 @@
191
185
  },
192
186
  schema,
193
187
  attributes,
194
- indices: { value: new Uint32Array(0), size: 0 },
188
+ indices: {
189
+ value: new Uint32Array(0),
190
+ size: 0
191
+ },
195
192
  mode,
196
193
  topology
197
194
  };
198
195
  if (plyAttributes.indices.length > 0) {
199
- plyMesh.indices = { value: new Uint32Array(plyAttributes.indices), size: 1 };
196
+ plyMesh.indices = {
197
+ value: new Uint32Array(plyAttributes.indices),
198
+ size: 1
199
+ };
200
200
  }
201
201
  return plyMesh;
202
202
  }
@@ -206,41 +206,51 @@
206
206
  switch (attributeName) {
207
207
  case "vertices":
208
208
  if (attributes.vertices.length > 0) {
209
- accessors.POSITION = { value: new Float32Array(attributes.vertices), size: 3 };
209
+ accessors.POSITION = {
210
+ value: new Float32Array(attributes.vertices),
211
+ size: 3
212
+ };
210
213
  }
211
214
  break;
212
215
  case "normals":
213
216
  if (attributes.normals.length > 0) {
214
- accessors.NORMAL = { value: new Float32Array(attributes.normals), size: 3 };
217
+ accessors.NORMAL = {
218
+ value: new Float32Array(attributes.normals),
219
+ size: 3
220
+ };
215
221
  }
216
222
  break;
217
223
  case "uvs":
218
224
  if (attributes.uvs.length > 0) {
219
- accessors.TEXCOORD_0 = { value: new Float32Array(attributes.uvs), size: 2 };
225
+ accessors.TEXCOORD_0 = {
226
+ value: new Float32Array(attributes.uvs),
227
+ size: 2
228
+ };
220
229
  }
221
230
  break;
222
231
  case "colors":
223
232
  if (attributes.colors.length > 0) {
224
- accessors.COLOR_0 = { value: new Uint8Array(attributes.colors), size: 3, normalized: true };
233
+ accessors.COLOR_0 = {
234
+ value: new Uint8Array(attributes.colors),
235
+ size: 3,
236
+ normalized: true
237
+ };
225
238
  }
226
239
  break;
227
240
  case "indices":
228
241
  break;
229
242
  default:
230
243
  if (attributes[attributeName].length > 0) {
231
- accessors[attributeName] = { value: new Float32Array(attributes[attributeName]), size: 1 };
244
+ accessors[attributeName] = {
245
+ value: new Float32Array(attributes[attributeName]),
246
+ size: 1
247
+ };
232
248
  }
233
249
  break;
234
250
  }
235
251
  }
236
252
  return accessors;
237
253
  }
238
- var init_normalize_ply = __esm({
239
- "src/lib/normalize-ply.ts"() {
240
- init_src();
241
- init_get_ply_schema();
242
- }
243
- });
244
254
 
245
255
  // src/lib/parse-ply.ts
246
256
  function parsePLY(data, options = {}) {
@@ -558,17 +568,14 @@
558
568
  }
559
569
  return attributes;
560
570
  }
561
- var init_parse_ply = __esm({
562
- "src/lib/parse-ply.ts"() {
563
- init_normalize_ply();
564
- }
565
- });
566
571
 
567
572
  // ../loader-utils/src/lib/iterators/text-iterators.ts
568
573
  async function* makeTextDecoderIterator(arrayBufferIterator, options = {}) {
569
574
  const textDecoder = new TextDecoder(void 0, options);
570
575
  for await (const arrayBuffer of arrayBufferIterator) {
571
- yield typeof arrayBuffer === "string" ? arrayBuffer : textDecoder.decode(arrayBuffer, { stream: true });
576
+ yield typeof arrayBuffer === "string" ? arrayBuffer : textDecoder.decode(arrayBuffer, {
577
+ stream: true
578
+ });
572
579
  }
573
580
  }
574
581
  async function* makeLineIterator(textIterator) {
@@ -586,15 +593,14 @@
586
593
  yield previous;
587
594
  }
588
595
  }
589
- var init_text_iterators = __esm({
590
- "../loader-utils/src/lib/iterators/text-iterators.ts"() {
591
- }
592
- });
593
596
 
594
597
  // ../loader-utils/src/lib/iterators/async-iteration.ts
595
598
  async function forEach(iterator, visitor) {
596
599
  while (true) {
597
- const { done, value } = await iterator.next();
600
+ const {
601
+ done,
602
+ value
603
+ } = await iterator.next();
598
604
  if (done) {
599
605
  iterator.return();
600
606
  return;
@@ -605,20 +611,9 @@
605
611
  }
606
612
  }
607
613
  }
608
- var init_async_iteration = __esm({
609
- "../loader-utils/src/lib/iterators/async-iteration.ts"() {
610
- }
611
- });
612
-
613
- // ../loader-utils/src/index.ts
614
- var init_src2 = __esm({
615
- "../loader-utils/src/index.ts"() {
616
- init_text_iterators();
617
- init_async_iteration();
618
- }
619
- });
620
614
 
621
615
  // src/lib/parse-ply-in-batches.ts
616
+ var currentElement;
622
617
  async function* parsePLYInBatches(iterator, options) {
623
618
  const lineIterator = makeLineIterator(makeTextDecoderIterator(iterator));
624
619
  const header = await parsePLYHeader(lineIterator, options);
@@ -791,43 +786,16 @@
791
786
  break;
792
787
  }
793
788
  }
794
- var currentElement;
795
- var init_parse_ply_in_batches = __esm({
796
- "src/lib/parse-ply-in-batches.ts"() {
797
- init_src2();
798
- init_normalize_ply();
799
- }
800
- });
801
789
 
802
790
  // src/index.ts
803
- var src_exports = {};
804
- __export(src_exports, {
805
- PLYLoader: () => PLYLoader2,
806
- PLYWorkerLoader: () => PLYLoader
807
- });
808
- var PLYLoader2;
809
- var init_src3 = __esm({
810
- "src/index.ts"() {
811
- init_ply_loader();
812
- init_parse_ply();
813
- init_parse_ply_in_batches();
814
- PLYLoader2 = {
815
- ...PLYLoader,
816
- parse: async (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
817
- parseTextSync: (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
818
- parseSync: (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
819
- parseInBatches: (arrayBuffer, options) => parsePLYInBatches(arrayBuffer, options?.ply)
820
- };
821
- }
822
- });
823
-
824
- // src/bundle.ts
825
- var require_bundle = __commonJS({
826
- "src/bundle.ts"(exports, module) {
827
- var moduleExports = (init_src3(), src_exports);
828
- globalThis.loaders = globalThis.loaders || {};
829
- module.exports = Object.assign(globalThis.loaders, moduleExports);
830
- }
831
- });
832
- require_bundle();
791
+ var PLYLoader2 = {
792
+ ...PLYLoader,
793
+ parse: async (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
794
+ parseTextSync: (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
795
+ parseSync: (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),
796
+ parseInBatches: (arrayBuffer, options) => parsePLYInBatches(arrayBuffer, options?.ply)
797
+ };
798
+ return __toCommonJS(src_exports);
833
799
  })();
800
+ return __exports__;
801
+ });