@loaders.gl/pcd 4.2.0-alpha.4 → 4.2.0-alpha.6
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 +97 -61
- package/dist/dist.min.js +17 -0
- package/dist/index.cjs +24 -63
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/lib/decompress-lzf.js +55 -48
- package/dist/lib/get-pcd-schema.d.ts +1 -1
- package/dist/lib/get-pcd-schema.d.ts.map +1 -1
- package/dist/lib/get-pcd-schema.js +27 -46
- package/dist/lib/parse-pcd.d.ts +1 -1
- package/dist/lib/parse-pcd.d.ts.map +1 -1
- package/dist/lib/parse-pcd.js +296 -255
- package/dist/lib/pcd-types.js +0 -1
- package/dist/pcd-loader.d.ts +1 -1
- package/dist/pcd-loader.d.ts.map +1 -1
- package/dist/pcd-loader.js +19 -12
- package/dist/pcd-worker.js +4 -2
- package/dist/workers/pcd-worker.js +0 -1
- package/package.json +10 -6
- package/dist/index.js.map +0 -1
- package/dist/lib/decompress-lzf.js.map +0 -1
- package/dist/lib/get-pcd-schema.js.map +0 -1
- package/dist/lib/parse-pcd.js.map +0 -1
- package/dist/lib/pcd-types.js.map +0 -1
- package/dist/pcd-loader.js.map +0 -1
- package/dist/workers/pcd-worker.js.map +0 -1
|
@@ -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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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 +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,
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
package/dist/lib/parse-pcd.d.ts
CHANGED
|
@@ -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,
|
|
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"}
|