@loaders.gl/pcd 3.1.0-alpha.5 → 3.1.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.
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports._typecheckPCDLoader = exports.PCDLoader = void 0;
7
- const VERSION = typeof "3.1.0-alpha.5" !== 'undefined' ? "3.1.0-alpha.5" : 'latest';
7
+ const VERSION = typeof "3.1.0-beta.4" !== 'undefined' ? "3.1.0-beta.4" : 'latest';
8
8
  const PCDLoader = {
9
9
  name: 'PCD (Point Cloud Data)',
10
10
  id: 'pcd',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pcd-loader.ts"],"names":["VERSION","PCDLoader","name","id","module","version","worker","extensions","mimeTypes","options","pcd","_typecheckPCDLoader"],"mappings":";;;;;;AAIA,MAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAKO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,wBADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEL,OAJc;AAKvBM,EAAAA,MAAM,EAAE,IALe;AAMvBC,EAAAA,UAAU,EAAE,CAAC,KAAD,CANW;AAOvBC,EAAAA,SAAS,EAAE,CAAC,YAAD,CAPY;AAQvBC,EAAAA,OAAO,EAAE;AACPC,IAAAA,GAAG,EAAE;AADE;AARc,CAAlB;;AAaA,MAAMC,mBAA2B,GAAGV,SAApC","sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Worker loader for PCD - Point Cloud Data\n */\nexport const PCDLoader = {\n name: 'PCD (Point Cloud Data)',\n id: 'pcd',\n module: 'pcd',\n version: VERSION,\n worker: true,\n extensions: ['pcd'],\n mimeTypes: ['text/plain'],\n options: {\n pcd: {}\n }\n};\n\nexport const _typecheckPCDLoader: Loader = PCDLoader;\n"],"file":"pcd-loader.js"}
1
+ {"version":3,"sources":["../../src/pcd-loader.ts"],"names":["VERSION","PCDLoader","name","id","module","version","worker","extensions","mimeTypes","options","pcd","_typecheckPCDLoader"],"mappings":";;;;;;AAIA,MAAMA,OAAO,GAAG,0BAAuB,WAAvB,oBAAmD,QAAnE;AAKO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,wBADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEL,OAJc;AAKvBM,EAAAA,MAAM,EAAE,IALe;AAMvBC,EAAAA,UAAU,EAAE,CAAC,KAAD,CANW;AAOvBC,EAAAA,SAAS,EAAE,CAAC,YAAD,CAPY;AAQvBC,EAAAA,OAAO,EAAE;AACPC,IAAAA,GAAG,EAAE;AADE;AARc,CAAlB;;AAaA,MAAMC,mBAA2B,GAAGV,SAApC","sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Worker loader for PCD - Point Cloud Data\n */\nexport const PCDLoader = {\n name: 'PCD (Point Cloud Data)',\n id: 'pcd',\n module: 'pcd',\n version: VERSION,\n worker: true,\n extensions: ['pcd'],\n mimeTypes: ['text/plain'],\n options: {\n pcd: {}\n }\n};\n\nexport const _typecheckPCDLoader: Loader = PCDLoader;\n"],"file":"pcd-loader.js"}
@@ -1,4 +1,4 @@
1
- const VERSION = typeof "3.1.0-alpha.5" !== 'undefined' ? "3.1.0-alpha.5" : 'latest';
1
+ const VERSION = typeof "3.1.0-beta.4" !== 'undefined' ? "3.1.0-beta.4" : 'latest';
2
2
  export const PCDLoader = {
3
3
  name: 'PCD (Point Cloud Data)',
4
4
  id: 'pcd',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pcd-loader.ts"],"names":["VERSION","PCDLoader","name","id","module","version","worker","extensions","mimeTypes","options","pcd","_typecheckPCDLoader"],"mappings":"AAIA,MAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAKA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,wBADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEL,OAJc;AAKvBM,EAAAA,MAAM,EAAE,IALe;AAMvBC,EAAAA,UAAU,EAAE,CAAC,KAAD,CANW;AAOvBC,EAAAA,SAAS,EAAE,CAAC,YAAD,CAPY;AAQvBC,EAAAA,OAAO,EAAE;AACPC,IAAAA,GAAG,EAAE;AADE;AARc,CAAlB;AAaP,OAAO,MAAMC,mBAA2B,GAAGV,SAApC","sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Worker loader for PCD - Point Cloud Data\n */\nexport const PCDLoader = {\n name: 'PCD (Point Cloud Data)',\n id: 'pcd',\n module: 'pcd',\n version: VERSION,\n worker: true,\n extensions: ['pcd'],\n mimeTypes: ['text/plain'],\n options: {\n pcd: {}\n }\n};\n\nexport const _typecheckPCDLoader: Loader = PCDLoader;\n"],"file":"pcd-loader.js"}
1
+ {"version":3,"sources":["../../src/pcd-loader.ts"],"names":["VERSION","PCDLoader","name","id","module","version","worker","extensions","mimeTypes","options","pcd","_typecheckPCDLoader"],"mappings":"AAIA,MAAMA,OAAO,GAAG,0BAAuB,WAAvB,oBAAmD,QAAnE;AAKA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,wBADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEL,OAJc;AAKvBM,EAAAA,MAAM,EAAE,IALe;AAMvBC,EAAAA,UAAU,EAAE,CAAC,KAAD,CANW;AAOvBC,EAAAA,SAAS,EAAE,CAAC,YAAD,CAPY;AAQvBC,EAAAA,OAAO,EAAE;AACPC,IAAAA,GAAG,EAAE;AADE;AARc,CAAlB;AAaP,OAAO,MAAMC,mBAA2B,GAAGV,SAApC","sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Worker loader for PCD - Point Cloud Data\n */\nexport const PCDLoader = {\n name: 'PCD (Point Cloud Data)',\n id: 'pcd',\n module: 'pcd',\n version: VERSION,\n worker: true,\n extensions: ['pcd'],\n mimeTypes: ['text/plain'],\n options: {\n pcd: {}\n }\n};\n\nexport const _typecheckPCDLoader: Loader = PCDLoader;\n"],"file":"pcd-loader.js"}
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare const PCDLoader: {
11
11
  header: import("./lib/pcd-types").PCDHeader;
12
12
  };
13
13
  header: Partial<import("./lib/pcd-types").PCDHeader>;
14
- schema: import("modules/schema/dist").Schema;
14
+ schema: import("@loaders.gl/schema").Schema;
15
15
  mode: number;
16
16
  indices: null;
17
17
  attributes: any;
@@ -29,3 +29,4 @@ export declare const PCDLoader: {
29
29
  };
30
30
  };
31
31
  export declare const _typecheckPCDLoader: LoaderWithParser;
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC/D,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,SAAS,IAAI,eAAe,EAAC,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,CAAC;AAEzB;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;CAIrB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,gBAA4B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports._typecheckPCDLoader = exports.PCDLoader = exports.PCDWorkerLoader = void 0;
7
+ const parse_pcd_1 = __importDefault(require("./lib/parse-pcd"));
8
+ const pcd_loader_1 = require("./pcd-loader");
9
+ Object.defineProperty(exports, "PCDWorkerLoader", { enumerable: true, get: function () { return pcd_loader_1.PCDLoader; } });
10
+ /**
11
+ * Loader for PCD - Point Cloud Data
12
+ */
13
+ exports.PCDLoader = {
14
+ ...pcd_loader_1.PCDLoader,
15
+ parse: async (arrayBuffer) => (0, parse_pcd_1.default)(arrayBuffer),
16
+ parseSync: parse_pcd_1.default
17
+ };
18
+ exports._typecheckPCDLoader = exports.PCDLoader;
@@ -9,3 +9,4 @@ declare type SchemaMetadata = Map<string, any>;
9
9
  */
10
10
  export declare function getPCDSchema(PCDheader: PCDHeader, metadata: SchemaMetadata): Schema;
11
11
  export {};
12
+ //# sourceMappingURL=get-pcd-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-pcd-schema.d.ts","sourceRoot":"","sources":["../../src/lib/get-pcd-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAuC,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAE3C,aAAK,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEvC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM,CAoBnF"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPCDSchema = void 0;
4
+ const schema_1 = require("@loaders.gl/schema");
5
+ /**
6
+ * Gets schema from PCD header
7
+ * @param PCDheader
8
+ * @param metadata
9
+ * @returns Schema
10
+ */
11
+ function getPCDSchema(PCDheader, metadata) {
12
+ const offset = PCDheader.offset;
13
+ const fields = [];
14
+ if (offset.x !== undefined) {
15
+ fields.push(new schema_1.Field('POSITION', new schema_1.FixedSizeList(3, new schema_1.Field('xyz', new schema_1.Float32())), false));
16
+ }
17
+ if (offset.normal_x !== undefined) {
18
+ fields.push(new schema_1.Field('NORMAL', new schema_1.FixedSizeList(3, new schema_1.Field('xyz', new schema_1.Float32())), false));
19
+ }
20
+ if (offset.rgb !== undefined) {
21
+ fields.push(new schema_1.Field('COLOR_0', new schema_1.FixedSizeList(3, new schema_1.Field('rgb', new schema_1.Uint8())), false));
22
+ }
23
+ return new schema_1.Schema(fields, metadata);
24
+ }
25
+ exports.getPCDSchema = getPCDSchema;
@@ -14,3 +14,4 @@ export default function parsePCD(data: ArrayBufferLike): {
14
14
  indices: null;
15
15
  attributes: any;
16
16
  };
17
+ //# sourceMappingURL=parse-pcd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-pcd.d.ts","sourceRoot":"","sources":["../../src/lib/parse-pcd.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAwB3C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,IAAI,EAAE,eAAe;;;;;;;;;EA2CrD"}
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ // PCD Loader, adapted from THREE.js (MIT license)
3
+ // Description: A loader for PCD ascii and binary files.
4
+ // Limitations: Compressed binary files are not supported.
5
+ //
6
+ // Attributions per original THREE.js source file:
7
+ // @author Filipe Caixeta / http://filipecaixeta.com.br
8
+ // @author Mugen87 / https://github.com/Mugen87
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const schema_1 = require("@loaders.gl/schema");
11
+ const get_pcd_schema_1 = require("./get-pcd-schema");
12
+ const LITTLE_ENDIAN = true;
13
+ /**
14
+ *
15
+ * @param data
16
+ * @returns
17
+ */
18
+ function parsePCD(data) {
19
+ // parse header (always ascii format)
20
+ const textData = new TextDecoder().decode(data);
21
+ const pcdHeader = parsePCDHeader(textData);
22
+ let attributes = {};
23
+ // parse data
24
+ switch (pcdHeader.data) {
25
+ case 'ascii':
26
+ attributes = parsePCDASCII(pcdHeader, textData);
27
+ break;
28
+ case 'binary':
29
+ attributes = parsePCDBinary(pcdHeader, data);
30
+ break;
31
+ case 'binary_compressed':
32
+ default:
33
+ throw new Error(`PCD: ${pcdHeader.data} files are not supported`);
34
+ }
35
+ attributes = getMeshAttributes(attributes);
36
+ const header = getMeshHeader(pcdHeader, attributes);
37
+ const metadata = new Map([
38
+ ['mode', '0'],
39
+ ['boundingBox', JSON.stringify(header.boundingBox)]
40
+ ]);
41
+ const schema = (0, get_pcd_schema_1.getPCDSchema)(pcdHeader, metadata);
42
+ return {
43
+ loaderData: {
44
+ header: pcdHeader
45
+ },
46
+ header,
47
+ schema,
48
+ mode: 0,
49
+ indices: null,
50
+ attributes
51
+ };
52
+ }
53
+ exports.default = parsePCD;
54
+ // Create a header that contains common data for PointCloud category loaders
55
+ function getMeshHeader(pcdHeader, attributes) {
56
+ if (typeof pcdHeader.width === 'number' && typeof pcdHeader.height === 'number') {
57
+ const pointCount = pcdHeader.width * pcdHeader.height; // Supports "organized" point sets
58
+ return {
59
+ vertexCount: pointCount,
60
+ boundingBox: (0, schema_1.getMeshBoundingBox)(attributes)
61
+ };
62
+ }
63
+ return pcdHeader;
64
+ }
65
+ /**
66
+ * @param attributes
67
+ * @returns Normalized attributes
68
+ */
69
+ function getMeshAttributes(attributes) {
70
+ const normalizedAttributes = {
71
+ POSITION: {
72
+ // Binary PCD is only 32 bit
73
+ value: new Float32Array(attributes.position),
74
+ size: 3
75
+ }
76
+ };
77
+ if (attributes.normal && attributes.normal.length > 0) {
78
+ normalizedAttributes.NORMAL = {
79
+ value: new Float32Array(attributes.normal),
80
+ size: 3
81
+ };
82
+ }
83
+ if (attributes.color && attributes.color.length > 0) {
84
+ // TODO - RGBA
85
+ normalizedAttributes.COLOR_0 = {
86
+ value: new Uint8Array(attributes.color),
87
+ size: 3
88
+ };
89
+ }
90
+ return normalizedAttributes;
91
+ }
92
+ /**
93
+ * Incoming data parsing
94
+ * @param data
95
+ * @returns Header
96
+ */
97
+ /* eslint-disable complexity, max-statements */
98
+ function parsePCDHeader(data) {
99
+ const result1 = data.search(/[\r\n]DATA\s(\S*)\s/i);
100
+ const result2 = /[\r\n]DATA\s(\S*)\s/i.exec(data.substr(result1 - 1));
101
+ const pcdHeader = {};
102
+ pcdHeader.data = result2 && result2[1];
103
+ if (result2 !== null) {
104
+ pcdHeader.headerLen = (result2 && result2[0].length) + result1;
105
+ }
106
+ pcdHeader.str = data.substr(0, pcdHeader.headerLen);
107
+ // remove comments
108
+ pcdHeader.str = pcdHeader.str.replace(/\#.*/gi, '');
109
+ // parse
110
+ pcdHeader.version = /VERSION (.*)/i.exec(pcdHeader.str);
111
+ pcdHeader.fields = /FIELDS (.*)/i.exec(pcdHeader.str);
112
+ pcdHeader.size = /SIZE (.*)/i.exec(pcdHeader.str);
113
+ pcdHeader.type = /TYPE (.*)/i.exec(pcdHeader.str);
114
+ pcdHeader.count = /COUNT (.*)/i.exec(pcdHeader.str);
115
+ pcdHeader.width = /WIDTH (.*)/i.exec(pcdHeader.str);
116
+ pcdHeader.height = /HEIGHT (.*)/i.exec(pcdHeader.str);
117
+ pcdHeader.viewpoint = /VIEWPOINT (.*)/i.exec(pcdHeader.str);
118
+ pcdHeader.points = /POINTS (.*)/i.exec(pcdHeader.str);
119
+ // evaluate
120
+ if (pcdHeader.version !== null) {
121
+ pcdHeader.version = parseFloat(pcdHeader.version[1]);
122
+ }
123
+ if (pcdHeader.fields !== null) {
124
+ pcdHeader.fields = pcdHeader.fields[1].split(' ');
125
+ }
126
+ if (pcdHeader.type !== null) {
127
+ pcdHeader.type = pcdHeader.type[1].split(' ');
128
+ }
129
+ if (pcdHeader.width !== null) {
130
+ pcdHeader.width = parseInt(pcdHeader.width[1], 10);
131
+ }
132
+ if (pcdHeader.height !== null) {
133
+ pcdHeader.height = parseInt(pcdHeader.height[1], 10);
134
+ }
135
+ if (pcdHeader.viewpoint !== null) {
136
+ pcdHeader.viewpoint = pcdHeader.viewpoint[1];
137
+ }
138
+ if (pcdHeader.points !== null) {
139
+ pcdHeader.points = parseInt(pcdHeader.points[1], 10);
140
+ }
141
+ if (pcdHeader.points === null &&
142
+ typeof pcdHeader.width === 'number' &&
143
+ typeof pcdHeader.height === 'number') {
144
+ pcdHeader.points = pcdHeader.width * pcdHeader.height;
145
+ }
146
+ if (pcdHeader.size !== null) {
147
+ pcdHeader.size = pcdHeader.size[1].split(' ').map((x) => parseInt(x, 10));
148
+ }
149
+ if (pcdHeader.count !== null) {
150
+ pcdHeader.count = pcdHeader.count[1].split(' ').map((x) => parseInt(x, 10));
151
+ }
152
+ else {
153
+ pcdHeader.count = [];
154
+ if (pcdHeader.fields !== null) {
155
+ for (let i = 0; i < pcdHeader.fields.length; i++) {
156
+ pcdHeader.count.push(1);
157
+ }
158
+ }
159
+ }
160
+ pcdHeader.offset = {};
161
+ let sizeSum = 0;
162
+ if (pcdHeader.fields !== null && pcdHeader.size !== null) {
163
+ for (let i = 0; i < pcdHeader.fields.length; i++) {
164
+ if (pcdHeader.data === 'ascii') {
165
+ pcdHeader.offset[pcdHeader.fields[i]] = i;
166
+ }
167
+ else {
168
+ pcdHeader.offset[pcdHeader.fields[i]] = sizeSum;
169
+ sizeSum += pcdHeader.size[i];
170
+ }
171
+ }
172
+ }
173
+ // for binary only
174
+ pcdHeader.rowSize = sizeSum;
175
+ return pcdHeader;
176
+ }
177
+ /**
178
+ * @param pcdHeader
179
+ * @param textData
180
+ * @returns [attributes]
181
+ */
182
+ /* eslint-enable complexity, max-statements */
183
+ function parsePCDASCII(pcdHeader, textData) {
184
+ const position = [];
185
+ const normal = [];
186
+ const color = [];
187
+ const offset = pcdHeader.offset;
188
+ const pcdData = textData.substr(pcdHeader.headerLen);
189
+ const lines = pcdData.split('\n');
190
+ for (let i = 0; i < lines.length; i++) {
191
+ if (lines[i] !== '') {
192
+ const line = lines[i].split(' ');
193
+ if (offset.x !== undefined) {
194
+ position.push(parseFloat(line[offset.x]));
195
+ position.push(parseFloat(line[offset.y]));
196
+ position.push(parseFloat(line[offset.z]));
197
+ }
198
+ if (offset.rgb !== undefined) {
199
+ const floatValue = parseFloat(line[offset.rgb]);
200
+ const binaryColor = new Float32Array([floatValue]);
201
+ const dataview = new DataView(binaryColor.buffer, 0);
202
+ color.push(dataview.getUint8(0));
203
+ color.push(dataview.getUint8(1));
204
+ color.push(dataview.getUint8(2));
205
+ // TODO - handle alpha channel / RGBA?
206
+ }
207
+ if (offset.normal_x !== undefined) {
208
+ normal.push(parseFloat(line[offset.normal_x]));
209
+ normal.push(parseFloat(line[offset.normal_y]));
210
+ normal.push(parseFloat(line[offset.normal_z]));
211
+ }
212
+ }
213
+ }
214
+ return { position, normal, color };
215
+ }
216
+ /**
217
+ * @param pcdHeader
218
+ * @param data
219
+ * @returns [attributes]
220
+ */
221
+ function parsePCDBinary(pcdHeader, data) {
222
+ const position = [];
223
+ const normal = [];
224
+ const color = [];
225
+ const dataview = new DataView(data, pcdHeader.headerLen);
226
+ const offset = pcdHeader.offset;
227
+ for (let i = 0, row = 0; i < pcdHeader.points; i++, row += pcdHeader.rowSize) {
228
+ if (offset.x !== undefined) {
229
+ position.push(dataview.getFloat32(row + offset.x, LITTLE_ENDIAN));
230
+ position.push(dataview.getFloat32(row + offset.y, LITTLE_ENDIAN));
231
+ position.push(dataview.getFloat32(row + offset.z, LITTLE_ENDIAN));
232
+ }
233
+ if (offset.rgb !== undefined) {
234
+ color.push(dataview.getUint8(row + offset.rgb + 0));
235
+ color.push(dataview.getUint8(row + offset.rgb + 1));
236
+ color.push(dataview.getUint8(row + offset.rgb + 2));
237
+ }
238
+ if (offset.normal_x !== undefined) {
239
+ normal.push(dataview.getFloat32(row + offset.normal_x, LITTLE_ENDIAN));
240
+ normal.push(dataview.getFloat32(row + offset.normal_y, LITTLE_ENDIAN));
241
+ normal.push(dataview.getFloat32(row + offset.normal_z, LITTLE_ENDIAN));
242
+ }
243
+ }
244
+ return { position, normal, color };
245
+ }
@@ -28,3 +28,4 @@ export declare type PCDMesh = Mesh & {
28
28
  mode: 0;
29
29
  };
30
30
  export {};
31
+ //# sourceMappingURL=pcd-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pcd-types.d.ts","sourceRoot":"","sources":["../../src/lib/pcd-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AAE7C,aAAK,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAExE,oBAAY,SAAS,GAAG;IACtB,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,CAAC;IACzC,MAAM,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,EAAE,CAAC;IAC1C,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,EAAE,CAAC;IACxC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,EAAE,CAAC;IACxC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,EAAE,CAAC;IACzC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC;IAChC,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,SAAS,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,CAAC;IAC3C,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,MAAM,EAAE;QAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,OAAO;AACP,oBAAY,OAAO,GAAG,IAAI,GAAG;IAC3B,MAAM,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,SAAS,CAAC;IACtB,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -15,3 +15,4 @@ export declare const PCDLoader: {
15
15
  };
16
16
  };
17
17
  export declare const _typecheckPCDLoader: Loader;
18
+ //# sourceMappingURL=pcd-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pcd-loader.d.ts","sourceRoot":"","sources":["../src/pcd-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAMrD;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;CAWrB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAkB,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._typecheckPCDLoader = exports.PCDLoader = void 0;
4
+ // __VERSION__ is injected by babel-plugin-version-inline
5
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
6
+ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
7
+ /**
8
+ * Worker loader for PCD - Point Cloud Data
9
+ */
10
+ exports.PCDLoader = {
11
+ name: 'PCD (Point Cloud Data)',
12
+ id: 'pcd',
13
+ module: 'pcd',
14
+ version: VERSION,
15
+ worker: true,
16
+ extensions: ['pcd'],
17
+ mimeTypes: ['text/plain'],
18
+ options: {
19
+ pcd: {}
20
+ }
21
+ };
22
+ exports._typecheckPCDLoader = exports.PCDLoader;