@loaders.gl/pcd 4.2.0-alpha.3 → 4.2.0-alpha.5

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,51 +1,58 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * from https://gitlab.com/taketwo/three-pcd-loader/blob/master/decompress-lzf.js
4
+ * @param inData
5
+ * @param outLength
6
+ * @returns
7
+ */
1
8
  export function decompressLZF(inData, outLength) {
2
- const inLength = inData.length;
3
- const outData = new Uint8Array(outLength);
4
- let inPtr = 0;
5
- let outPtr = 0;
6
- let ctrl;
7
- let len;
8
- let ref;
9
- do {
10
- ctrl = inData[inPtr++];
11
- if (ctrl < 1 << 5) {
12
- ctrl++;
13
- if (outPtr + ctrl > outLength) {
14
- throw new Error('Output buffer is not large enough');
15
- }
16
- if (inPtr + ctrl > inLength) {
17
- throw new Error('Invalid compressed data');
18
- }
19
- do {
20
- outData[outPtr++] = inData[inPtr++];
21
- } while (--ctrl);
22
- } else {
23
- len = ctrl >> 5;
24
- ref = outPtr - ((ctrl & 0x1f) << 8) - 1;
25
- if (inPtr >= inLength) {
26
- throw new Error('Invalid compressed data');
27
- }
28
- if (len === 7) {
29
- len += inData[inPtr++];
30
- if (inPtr >= inLength) {
31
- throw new Error('Invalid compressed data');
9
+ const inLength = inData.length;
10
+ const outData = new Uint8Array(outLength);
11
+ let inPtr = 0;
12
+ let outPtr = 0;
13
+ let ctrl;
14
+ let len;
15
+ let ref;
16
+ do {
17
+ ctrl = inData[inPtr++];
18
+ if (ctrl < 1 << 5) {
19
+ ctrl++;
20
+ if (outPtr + ctrl > outLength) {
21
+ throw new Error('Output buffer is not large enough');
22
+ }
23
+ if (inPtr + ctrl > inLength) {
24
+ throw new Error('Invalid compressed data');
25
+ }
26
+ do {
27
+ outData[outPtr++] = inData[inPtr++];
28
+ } while (--ctrl);
32
29
  }
33
- }
34
- ref -= inData[inPtr++];
35
- if (outPtr + len + 2 > outLength) {
36
- throw new Error('Output buffer is not large enough');
37
- }
38
- if (ref < 0) {
39
- throw new Error('Invalid compressed data');
40
- }
41
- if (ref >= outPtr) {
42
- throw new Error('Invalid compressed data');
43
- }
44
- do {
45
- outData[outPtr++] = outData[ref++];
46
- } while (--len + 2);
47
- }
48
- } while (inPtr < inLength);
49
- return outData;
30
+ else {
31
+ len = ctrl >> 5;
32
+ ref = outPtr - ((ctrl & 0x1f) << 8) - 1;
33
+ if (inPtr >= inLength) {
34
+ throw new Error('Invalid compressed data');
35
+ }
36
+ if (len === 7) {
37
+ len += inData[inPtr++];
38
+ if (inPtr >= inLength) {
39
+ throw new Error('Invalid compressed data');
40
+ }
41
+ }
42
+ ref -= inData[inPtr++];
43
+ if (outPtr + len + 2 > outLength) {
44
+ throw new Error('Output buffer is not large enough');
45
+ }
46
+ if (ref < 0) {
47
+ throw new Error('Invalid compressed data');
48
+ }
49
+ if (ref >= outPtr) {
50
+ throw new Error('Invalid compressed data');
51
+ }
52
+ do {
53
+ outData[outPtr++] = outData[ref++];
54
+ } while (--len + 2);
55
+ }
56
+ } while (inPtr < inLength);
57
+ return outData;
50
58
  }
51
- //# sourceMappingURL=decompress-lzf.js.map
@@ -1,5 +1,5 @@
1
1
  import { Schema } from '@loaders.gl/schema';
2
- import type { PCDHeader } from './pcd-types';
2
+ import type { PCDHeader } from "./pcd-types.js";
3
3
  /**
4
4
  * Gets schema from PCD header
5
5
  * @param PCDheader
@@ -1 +1 @@
1
- {"version":3,"file":"get-pcd-schema.d.ts","sourceRoot":"","sources":["../../src/lib/get-pcd-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAQ,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CA2B3F"}
1
+ {"version":3,"file":"get-pcd-schema.d.ts","sourceRoot":"","sources":["../../src/lib/get-pcd-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAQ,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAC,SAAS,EAAC,uBAAoB;AAE3C;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CA2B3F"}
@@ -1,48 +1,29 @@
1
+ /**
2
+ * Gets schema from PCD header
3
+ * @param PCDheader
4
+ * @param metadata
5
+ * @returns Schema
6
+ */
1
7
  export function getPCDSchema(PCDheader, metadata) {
2
- const offset = PCDheader.offset;
3
- const fields = [];
4
- if (offset.x !== undefined) {
5
- fields.push({
6
- name: 'POSITION',
7
- type: {
8
- type: 'fixed-size-list',
9
- listSize: 3,
10
- children: [{
11
- name: 'xyz',
12
- type: 'float32'
13
- }]
14
- }
15
- });
16
- }
17
- if (offset.normal_x !== undefined) {
18
- fields.push({
19
- name: 'NORMAL',
20
- type: {
21
- type: 'fixed-size-list',
22
- listSize: 3,
23
- children: [{
24
- name: 'xyz',
25
- type: 'float32'
26
- }]
27
- }
28
- });
29
- }
30
- if (offset.rgb !== undefined) {
31
- fields.push({
32
- name: 'COLOR_0',
33
- type: {
34
- type: 'fixed-size-list',
35
- listSize: 3,
36
- children: [{
37
- name: 'rgb',
38
- type: 'uint8'
39
- }]
40
- }
41
- });
42
- }
43
- return {
44
- fields,
45
- metadata
46
- };
8
+ const offset = PCDheader.offset;
9
+ const fields = [];
10
+ if (offset.x !== undefined) {
11
+ fields.push({
12
+ name: 'POSITION',
13
+ type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'xyz', type: 'float32' }] }
14
+ });
15
+ }
16
+ if (offset.normal_x !== undefined) {
17
+ fields.push({
18
+ name: 'NORMAL',
19
+ type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'xyz', type: 'float32' }] }
20
+ });
21
+ }
22
+ if (offset.rgb !== undefined) {
23
+ fields.push({
24
+ name: 'COLOR_0',
25
+ type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'rgb', type: 'uint8' }] }
26
+ });
27
+ }
28
+ return { fields, metadata };
47
29
  }
48
- //# sourceMappingURL=get-pcd-schema.js.map
@@ -1,4 +1,4 @@
1
- import type { PCDMesh } from './pcd-types';
1
+ import type { PCDMesh } from "./pcd-types.js";
2
2
  /**
3
3
  *
4
4
  * @param data
@@ -1 +1 @@
1
- {"version":3,"file":"parse-pcd.d.ts","sourceRoot":"","sources":["../../src/lib/parse-pcd.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAY,OAAO,EAAC,MAAM,aAAa,CAAC;AA4BpD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CA6C/D"}
1
+ {"version":3,"file":"parse-pcd.d.ts","sourceRoot":"","sources":["../../src/lib/parse-pcd.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAY,OAAO,EAAC,uBAAoB;AA4BpD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CA6C/D"}