@ptloader/pcd
Advanced tools
Comparing version 3.3.24 to 3.3.26
@@ -561,8 +561,7 @@ (() => { | ||
if (offset.x !== void 0) { | ||
if (offset.intersity !== void 0) { | ||
fields.push(new Field("POSITION", new FixedSizeList(4, new Field("xyzi", new Float32())), false)); | ||
} else { | ||
fields.push(new Field("POSITION", new FixedSizeList(3, new Field("xyz", new Float32())), false)); | ||
} | ||
fields.push(new Field("POSITION", new FixedSizeList(3, new Field("xyz", new Float32())), false)); | ||
} | ||
if (offset.intensity !== void 0) { | ||
fields.push(new Field("INTENSITY", new FixedSizeList(1, new Field("intensity", new Float32())), false)); | ||
} | ||
if (offset.normal_x !== void 0) { | ||
@@ -647,2 +646,8 @@ fields.push(new Field("NORMAL", new FixedSizeList(3, new Field("xyz", new Float32())), false)); | ||
} | ||
if (attributes.intensity && attributes.intensity.length > 0) { | ||
normalizedAttributes.INTENSITY = { | ||
value: new Float32Array(attributes.intensity), | ||
size: 1 | ||
}; | ||
} | ||
return normalizedAttributes; | ||
@@ -725,2 +730,3 @@ } | ||
const color = []; | ||
const intensity = []; | ||
const offset = pcdHeader.offset; | ||
@@ -737,4 +743,9 @@ const pcdData = textData.substr(pcdHeader.headerLen); | ||
} | ||
if (offset.intersity !== void 0) { | ||
position.push(parseFloat(line[offset.intersity])); | ||
if (offset.intensity !== void 0) { | ||
if (pcdHeader.type[3] === "F") { | ||
intensity.push(parseFloat(line[offset.intensity])); | ||
} | ||
if (pcdHeader.type[3] === "U") { | ||
intensity.push(parseInt(line[offset.intensity])); | ||
} | ||
} | ||
@@ -756,3 +767,3 @@ if (offset.rgb !== void 0) { | ||
} | ||
return { position, normal, color }; | ||
return { position, intensity, normal, color }; | ||
} | ||
@@ -763,2 +774,3 @@ function parsePCDBinary(pcdHeader, data) { | ||
const color = []; | ||
const intensity = []; | ||
const dataview = new DataView(data, pcdHeader.headerLen); | ||
@@ -772,4 +784,9 @@ const offset = pcdHeader.offset; | ||
} | ||
if (offset.intersity !== void 0) { | ||
dataview.getFloat32(row + offset.intersity, LITTLE_ENDIAN); | ||
if (offset.intensity !== void 0) { | ||
if (pcdHeader.type[3] === "F") { | ||
intensity.push(dataview.getFloat32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
if (pcdHeader.type[3] === "U") { | ||
intensity.push(dataview.getUint32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -787,3 +804,3 @@ if (offset.rgb !== void 0) { | ||
} | ||
return { position, normal, color }; | ||
return { position, intensity, normal, color }; | ||
} | ||
@@ -794,2 +811,3 @@ function parsePCDBinaryCompressed(PCDheader, data) { | ||
const color = []; | ||
const intensity = []; | ||
const sizes = new Uint32Array(data.slice(PCDheader.headerLen, PCDheader.headerLen + 8)); | ||
@@ -807,4 +825,9 @@ const compressedSize = sizes[0]; | ||
} | ||
if (offset.intersity !== void 0) { | ||
position.push(dataview.getFloat32(PCDheader.points * offset.intersity + PCDheader.size[2] * i, LITTLE_ENDIAN)); | ||
if (offset.intensity !== void 0) { | ||
if (PCDheader.type[3] === "F") { | ||
intensity.push(dataview.getFloat32(PCDheader.points * offset.intensity + PCDheader.size[3] * i, LITTLE_ENDIAN)); | ||
} | ||
if (PCDheader.type[3] === "U") { | ||
intensity.push(dataview.getUint32(PCDheader.points * offset.intensity + PCDheader.size[3] * i, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -824,2 +847,3 @@ if (offset.rgb !== void 0) { | ||
position, | ||
intensity, | ||
normal, | ||
@@ -826,0 +850,0 @@ color |
@@ -12,8 +12,7 @@ "use strict"; | ||
if (offset.x !== undefined) { | ||
if (offset.intersity !== undefined) { | ||
fields.push(new _schema.Field('POSITION', new _schema.FixedSizeList(4, new _schema.Field('xyzi', new _schema.Float32())), false)); | ||
} else { | ||
fields.push(new _schema.Field('POSITION', new _schema.FixedSizeList(3, new _schema.Field('xyz', new _schema.Float32())), false)); | ||
} | ||
fields.push(new _schema.Field('POSITION', new _schema.FixedSizeList(3, new _schema.Field('xyz', new _schema.Float32())), false)); | ||
} | ||
if (offset.intensity !== undefined) { | ||
fields.push(new _schema.Field('INTENSITY', new _schema.FixedSizeList(1, new _schema.Field('intensity', new _schema.Float32())), false)); | ||
} | ||
if (offset.normal_x !== undefined) { | ||
@@ -20,0 +19,0 @@ fields.push(new _schema.Field('NORMAL', new _schema.FixedSizeList(3, new _schema.Field('xyz', new _schema.Float32())), false)); |
@@ -72,2 +72,8 @@ "use strict"; | ||
} | ||
if (attributes.intensity && attributes.intensity.length > 0) { | ||
normalizedAttributes.INTENSITY = { | ||
value: new Float32Array(attributes.intensity), | ||
size: 1 | ||
}; | ||
} | ||
return normalizedAttributes; | ||
@@ -154,2 +160,3 @@ } | ||
var color = []; | ||
var intensity = []; | ||
var offset = pcdHeader.offset; | ||
@@ -166,4 +173,9 @@ var pcdData = textData.substr(pcdHeader.headerLen); | ||
} | ||
if (offset.intersity !== undefined) { | ||
position.push(parseFloat(line[offset.intersity])); | ||
if (offset.intensity !== undefined) { | ||
if (pcdHeader.type[3] === 'F') { | ||
intensity.push(parseFloat(line[offset.intensity])); | ||
} | ||
if (pcdHeader.type[3] === 'U') { | ||
intensity.push(parseInt(line[offset.intensity])); | ||
} | ||
} | ||
@@ -187,2 +199,3 @@ if (offset.rgb !== undefined) { | ||
position: position, | ||
intensity: intensity, | ||
normal: normal, | ||
@@ -196,2 +209,3 @@ color: color | ||
var color = []; | ||
var intensity = []; | ||
var dataview = new DataView(data, pcdHeader.headerLen); | ||
@@ -205,4 +219,9 @@ var offset = pcdHeader.offset; | ||
} | ||
if (offset.intersity !== undefined) { | ||
dataview.getFloat32(row + offset.intersity, LITTLE_ENDIAN); | ||
if (offset.intensity !== undefined) { | ||
if (pcdHeader.type[3] === 'F') { | ||
intensity.push(dataview.getFloat32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
if (pcdHeader.type[3] === 'U') { | ||
intensity.push(dataview.getUint32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -222,2 +241,3 @@ if (offset.rgb !== undefined) { | ||
position: position, | ||
intensity: intensity, | ||
normal: normal, | ||
@@ -239,2 +259,3 @@ color: color | ||
var color = []; | ||
var intensity = []; | ||
var sizes = new Uint32Array(data.slice(PCDheader.headerLen, PCDheader.headerLen + 8)); | ||
@@ -252,4 +273,9 @@ var compressedSize = sizes[0]; | ||
} | ||
if (offset.intersity !== undefined) { | ||
position.push(dataview.getFloat32(PCDheader.points * offset.intersity + PCDheader.size[2] * i, LITTLE_ENDIAN)); | ||
if (offset.intensity !== undefined) { | ||
if (PCDheader.type[3] === 'F') { | ||
intensity.push(dataview.getFloat32(PCDheader.points * offset.intensity + PCDheader.size[3] * i, LITTLE_ENDIAN)); | ||
} | ||
if (PCDheader.type[3] === 'U') { | ||
intensity.push(dataview.getUint32(PCDheader.points * offset.intensity + PCDheader.size[3] * i, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -269,2 +295,3 @@ if (offset.rgb !== undefined) { | ||
position: position, | ||
intensity: intensity, | ||
normal: normal, | ||
@@ -271,0 +298,0 @@ color: color |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports._typecheckPCDLoader = exports.PCDLoader = void 0; | ||
var VERSION = typeof "3.3.24" !== 'undefined' ? "3.3.24" : 'latest'; | ||
var VERSION = typeof "3.3.26" !== 'undefined' ? "3.3.26" : 'latest'; | ||
var PCDLoader = { | ||
@@ -10,0 +10,0 @@ name: 'PCD (Point Cloud Data)', |
@@ -6,8 +6,7 @@ import { Schema, Field, Float32, Uint8, FixedSizeList } from '@ptloader/schema'; | ||
if (offset.x !== undefined) { | ||
if (offset.intersity !== undefined) { | ||
fields.push(new Field('POSITION', new FixedSizeList(4, new Field('xyzi', new Float32())), false)); | ||
} else { | ||
fields.push(new Field('POSITION', new FixedSizeList(3, new Field('xyz', new Float32())), false)); | ||
} | ||
fields.push(new Field('POSITION', new FixedSizeList(3, new Field('xyz', new Float32())), false)); | ||
} | ||
if (offset.intensity !== undefined) { | ||
fields.push(new Field('INTENSITY', new FixedSizeList(1, new Field('intensity', new Float32())), false)); | ||
} | ||
if (offset.normal_x !== undefined) { | ||
@@ -14,0 +13,0 @@ fields.push(new Field('NORMAL', new FixedSizeList(3, new Field('xyz', new Float32())), false)); |
@@ -66,2 +66,8 @@ import { getMeshBoundingBox } from '@ptloader/schema'; | ||
} | ||
if (attributes.intensity && attributes.intensity.length > 0) { | ||
normalizedAttributes.INTENSITY = { | ||
value: new Float32Array(attributes.intensity), | ||
size: 1 | ||
}; | ||
} | ||
return normalizedAttributes; | ||
@@ -144,2 +150,3 @@ } | ||
const color = []; | ||
const intensity = []; | ||
const offset = pcdHeader.offset; | ||
@@ -156,4 +163,9 @@ const pcdData = textData.substr(pcdHeader.headerLen); | ||
} | ||
if (offset.intersity !== undefined) { | ||
position.push(parseFloat(line[offset.intersity])); | ||
if (offset.intensity !== undefined) { | ||
if (pcdHeader.type[3] === 'F') { | ||
intensity.push(parseFloat(line[offset.intensity])); | ||
} | ||
if (pcdHeader.type[3] === 'U') { | ||
intensity.push(parseInt(line[offset.intensity])); | ||
} | ||
} | ||
@@ -177,2 +189,3 @@ if (offset.rgb !== undefined) { | ||
position, | ||
intensity, | ||
normal, | ||
@@ -186,2 +199,3 @@ color | ||
const color = []; | ||
const intensity = []; | ||
const dataview = new DataView(data, pcdHeader.headerLen); | ||
@@ -195,4 +209,9 @@ const offset = pcdHeader.offset; | ||
} | ||
if (offset.intersity !== undefined) { | ||
dataview.getFloat32(row + offset.intersity, LITTLE_ENDIAN); | ||
if (offset.intensity !== undefined) { | ||
if (pcdHeader.type[3] === 'F') { | ||
intensity.push(dataview.getFloat32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
if (pcdHeader.type[3] === 'U') { | ||
intensity.push(dataview.getUint32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -212,2 +231,3 @@ if (offset.rgb !== undefined) { | ||
position, | ||
intensity, | ||
normal, | ||
@@ -229,2 +249,3 @@ color | ||
const color = []; | ||
const intensity = []; | ||
const sizes = new Uint32Array(data.slice(PCDheader.headerLen, PCDheader.headerLen + 8)); | ||
@@ -242,4 +263,9 @@ const compressedSize = sizes[0]; | ||
} | ||
if (offset.intersity !== undefined) { | ||
position.push(dataview.getFloat32(PCDheader.points * offset.intersity + PCDheader.size[2] * i, LITTLE_ENDIAN)); | ||
if (offset.intensity !== undefined) { | ||
if (PCDheader.type[3] === 'F') { | ||
intensity.push(dataview.getFloat32(PCDheader.points * offset.intensity + PCDheader.size[3] * i, LITTLE_ENDIAN)); | ||
} | ||
if (PCDheader.type[3] === 'U') { | ||
intensity.push(dataview.getUint32(PCDheader.points * offset.intensity + PCDheader.size[3] * i, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -259,2 +285,3 @@ if (offset.rgb !== undefined) { | ||
position, | ||
intensity, | ||
normal, | ||
@@ -261,0 +288,0 @@ color |
@@ -1,2 +0,2 @@ | ||
const VERSION = typeof "3.3.24" !== 'undefined' ? "3.3.24" : 'latest'; | ||
const VERSION = typeof "3.3.26" !== 'undefined' ? "3.3.26" : 'latest'; | ||
export const PCDLoader = { | ||
@@ -3,0 +3,0 @@ name: 'PCD (Point Cloud Data)', |
@@ -15,9 +15,7 @@ "use strict"; | ||
if (offset.x !== undefined) { | ||
if (offset.intersity !== undefined) { | ||
fields.push(new schema_1.Field('POSITION', new schema_1.FixedSizeList(4, new schema_1.Field('xyzi', new schema_1.Float32())), false)); | ||
} | ||
else { | ||
fields.push(new schema_1.Field('POSITION', new schema_1.FixedSizeList(3, new schema_1.Field('xyz', new schema_1.Float32())), false)); | ||
} | ||
fields.push(new schema_1.Field('POSITION', new schema_1.FixedSizeList(3, new schema_1.Field('xyz', new schema_1.Float32())), false)); | ||
} | ||
if (offset.intensity !== undefined) { | ||
fields.push(new schema_1.Field('INTENSITY', new schema_1.FixedSizeList(1, new schema_1.Field('intensity', new schema_1.Float32())), false)); | ||
} | ||
if (offset.normal_x !== undefined) { | ||
@@ -24,0 +22,0 @@ fields.push(new schema_1.Field('NORMAL', new schema_1.FixedSizeList(3, new schema_1.Field('xyz', new schema_1.Float32())), false)); |
@@ -93,2 +93,8 @@ "use strict"; | ||
} | ||
if (attributes.intensity && attributes.intensity.length > 0) { | ||
normalizedAttributes.INTENSITY = { | ||
value: new Float32Array(attributes.intensity), | ||
size: 1 | ||
}; | ||
} | ||
return normalizedAttributes; | ||
@@ -192,2 +198,3 @@ } | ||
const color = []; | ||
const intensity = []; | ||
const offset = pcdHeader.offset; | ||
@@ -204,4 +211,9 @@ const pcdData = textData.substr(pcdHeader.headerLen); | ||
} | ||
if (offset.intersity !== undefined) { | ||
position.push(parseFloat(line[offset.intersity])); | ||
if (offset.intensity !== undefined) { | ||
if (pcdHeader.type[3] === 'F') { | ||
intensity.push(parseFloat(line[offset.intensity])); | ||
} | ||
if (pcdHeader.type[3] === 'U') { | ||
intensity.push(parseInt(line[offset.intensity])); | ||
} | ||
} | ||
@@ -224,3 +236,3 @@ if (offset.rgb !== undefined) { | ||
} | ||
return { position, normal, color }; | ||
return { position, intensity, normal, color }; | ||
} | ||
@@ -236,2 +248,3 @@ /** | ||
const color = []; | ||
const intensity = []; | ||
const dataview = new DataView(data, pcdHeader.headerLen); | ||
@@ -245,4 +258,9 @@ const offset = pcdHeader.offset; | ||
} | ||
if (offset.intersity !== undefined) { | ||
dataview.getFloat32(row + offset.intersity, LITTLE_ENDIAN); | ||
if (offset.intensity !== undefined) { | ||
if (pcdHeader.type[3] === 'F') { | ||
intensity.push(dataview.getFloat32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
if (pcdHeader.type[3] === 'U') { | ||
intensity.push(dataview.getUint32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -260,3 +278,3 @@ if (offset.rgb !== undefined) { | ||
} | ||
return { position, normal, color }; | ||
return { position, intensity, normal, color }; | ||
} | ||
@@ -270,2 +288,3 @@ /** Parse compressed PCD data in in binary_compressed form ( https://pointclouds.org/documentation/tutorials/pcd_file_format.html) | ||
*/ | ||
// eslint-disable-next-line max-statements | ||
function parsePCDBinaryCompressed(PCDheader, data) { | ||
@@ -275,2 +294,3 @@ const position = []; | ||
const color = []; | ||
const intensity = []; | ||
const sizes = new Uint32Array(data.slice(PCDheader.headerLen, PCDheader.headerLen + 8)); | ||
@@ -288,4 +308,9 @@ const compressedSize = sizes[0]; | ||
} | ||
if (offset.intersity !== undefined) { | ||
position.push(dataview.getFloat32(PCDheader.points * offset.intersity + PCDheader.size[2] * i, LITTLE_ENDIAN)); | ||
if (offset.intensity !== undefined) { | ||
if (PCDheader.type[3] === 'F') { | ||
intensity.push(dataview.getFloat32(PCDheader.points * offset.intensity + PCDheader.size[3] * i, LITTLE_ENDIAN)); | ||
} | ||
if (PCDheader.type[3] === 'U') { | ||
intensity.push(dataview.getUint32(PCDheader.points * offset.intensity + PCDheader.size[3] * i, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -305,2 +330,3 @@ if (offset.rgb !== undefined) { | ||
position, | ||
intensity, | ||
normal, | ||
@@ -307,0 +333,0 @@ color |
@@ -701,8 +701,7 @@ (() => { | ||
if (offset.x !== void 0) { | ||
if (offset.intersity !== void 0) { | ||
fields.push(new Field("POSITION", new FixedSizeList(4, new Field("xyzi", new Float32())), false)); | ||
} else { | ||
fields.push(new Field("POSITION", new FixedSizeList(3, new Field("xyz", new Float32())), false)); | ||
} | ||
fields.push(new Field("POSITION", new FixedSizeList(3, new Field("xyz", new Float32())), false)); | ||
} | ||
if (offset.intensity !== void 0) { | ||
fields.push(new Field("INTENSITY", new FixedSizeList(1, new Field("intensity", new Float32())), false)); | ||
} | ||
if (offset.normal_x !== void 0) { | ||
@@ -783,2 +782,8 @@ fields.push(new Field("NORMAL", new FixedSizeList(3, new Field("xyz", new Float32())), false)); | ||
} | ||
if (attributes.intensity && attributes.intensity.length > 0) { | ||
normalizedAttributes.INTENSITY = { | ||
value: new Float32Array(attributes.intensity), | ||
size: 1 | ||
}; | ||
} | ||
return normalizedAttributes; | ||
@@ -861,2 +866,3 @@ } | ||
const color = []; | ||
const intensity = []; | ||
const offset = pcdHeader.offset; | ||
@@ -873,4 +879,9 @@ const pcdData = textData.substr(pcdHeader.headerLen); | ||
} | ||
if (offset.intersity !== void 0) { | ||
position.push(parseFloat(line[offset.intersity])); | ||
if (offset.intensity !== void 0) { | ||
if (pcdHeader.type[3] === "F") { | ||
intensity.push(parseFloat(line[offset.intensity])); | ||
} | ||
if (pcdHeader.type[3] === "U") { | ||
intensity.push(parseInt(line[offset.intensity])); | ||
} | ||
} | ||
@@ -892,3 +903,3 @@ if (offset.rgb !== void 0) { | ||
} | ||
return { position, normal, color }; | ||
return { position, intensity, normal, color }; | ||
} | ||
@@ -899,2 +910,3 @@ function parsePCDBinary(pcdHeader, data) { | ||
const color = []; | ||
const intensity = []; | ||
const dataview = new DataView(data, pcdHeader.headerLen); | ||
@@ -908,4 +920,9 @@ const offset = pcdHeader.offset; | ||
} | ||
if (offset.intersity !== void 0) { | ||
dataview.getFloat32(row + offset.intersity, LITTLE_ENDIAN); | ||
if (offset.intensity !== void 0) { | ||
if (pcdHeader.type[3] === "F") { | ||
intensity.push(dataview.getFloat32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
if (pcdHeader.type[3] === "U") { | ||
intensity.push(dataview.getUint32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -923,3 +940,3 @@ if (offset.rgb !== void 0) { | ||
} | ||
return { position, normal, color }; | ||
return { position, intensity, normal, color }; | ||
} | ||
@@ -930,2 +947,3 @@ function parsePCDBinaryCompressed(PCDheader, data) { | ||
const color = []; | ||
const intensity = []; | ||
const sizes = new Uint32Array(data.slice(PCDheader.headerLen, PCDheader.headerLen + 8)); | ||
@@ -943,4 +961,9 @@ const compressedSize = sizes[0]; | ||
} | ||
if (offset.intersity !== void 0) { | ||
position.push(dataview.getFloat32(PCDheader.points * offset.intersity + PCDheader.size[2] * i, LITTLE_ENDIAN)); | ||
if (offset.intensity !== void 0) { | ||
if (PCDheader.type[3] === "F") { | ||
intensity.push(dataview.getFloat32(PCDheader.points * offset.intensity + PCDheader.size[3] * i, LITTLE_ENDIAN)); | ||
} | ||
if (PCDheader.type[3] === "U") { | ||
intensity.push(dataview.getUint32(PCDheader.points * offset.intensity + PCDheader.size[3] * i, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -960,2 +983,3 @@ if (offset.rgb !== void 0) { | ||
position, | ||
intensity, | ||
normal, | ||
@@ -967,3 +991,3 @@ color | ||
// src/pcd-loader.ts | ||
var VERSION = true ? "3.3.24" : "latest"; | ||
var VERSION = true ? "3.3.26" : "latest"; | ||
var PCDLoader = { | ||
@@ -970,0 +994,0 @@ name: "PCD (Point Cloud Data)", |
{ | ||
"name": "@ptloader/pcd", | ||
"version": "3.3.24", | ||
"version": "3.3.26", | ||
"description": "Framework-independent loader for the PCD format", | ||
@@ -36,6 +36,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"@ptloader/loader-utils": "3.3.24", | ||
"@ptloader/schema": "3.3.24" | ||
"@ptloader/loader-utils": "3.3.26", | ||
"@ptloader/schema": "3.3.26" | ||
}, | ||
"gitHead": "9e30455abfb5961ac76568178b1cdcde2e420abb" | ||
"gitHead": "b76d9d795edef0fc909391176d9f320498bd2a80" | ||
} |
@@ -18,13 +18,13 @@ import {Schema, Field, Float32, Uint8, FixedSizeList} from '@ptloader/schema'; | ||
if (offset.x !== undefined) { | ||
if (offset.intersity !== undefined) { | ||
fields.push( | ||
new Field('POSITION', new FixedSizeList(4, new Field('xyzi', new Float32())), false) | ||
); | ||
} else { | ||
fields.push( | ||
new Field('POSITION', new FixedSizeList(3, new Field('xyz', new Float32())), false) | ||
); | ||
} | ||
fields.push( | ||
new Field('POSITION', new FixedSizeList(3, new Field('xyz', new Float32())), false) | ||
); | ||
} | ||
if (offset.intensity !== undefined) { | ||
fields.push( | ||
new Field('INTENSITY', new FixedSizeList(1, new Field('intensity', new Float32())), false) | ||
); | ||
} | ||
if (offset.normal_x !== undefined) { | ||
@@ -31,0 +31,0 @@ fields.push(new Field('NORMAL', new FixedSizeList(3, new Field('xyz', new Float32())), false)); |
@@ -129,2 +129,9 @@ // PCD Loader, adapted from THREE.js (MIT license) | ||
if (attributes.intensity && attributes.intensity.length > 0) { | ||
normalizedAttributes.INTENSITY = { | ||
value: new Float32Array(attributes.intensity), | ||
size: 1 | ||
}; | ||
} | ||
return normalizedAttributes; | ||
@@ -250,2 +257,3 @@ } | ||
const color: number[] = []; | ||
const intensity: number[] = []; | ||
@@ -266,4 +274,9 @@ const offset = pcdHeader.offset; | ||
if (offset.intersity !== undefined) { | ||
position.push(parseFloat(line[offset.intersity])) | ||
if (offset.intensity !== undefined) { | ||
if((pcdHeader.type as string[])[3] === 'F') { | ||
intensity.push(parseFloat(line[offset.intensity])); | ||
} | ||
if((pcdHeader.type as string[])[3] === 'U') { | ||
intensity.push(parseInt(line[offset.intensity])); | ||
} | ||
} | ||
@@ -289,3 +302,3 @@ | ||
return {position, normal, color}; | ||
return {position, intensity, normal, color}; | ||
} | ||
@@ -302,2 +315,3 @@ | ||
const color: number[] = []; | ||
const intensity: number[] = []; | ||
@@ -314,4 +328,9 @@ const dataview = new DataView(data, pcdHeader.headerLen); | ||
if (offset.intersity !== undefined) { | ||
dataview.getFloat32(row + offset.intersity, LITTLE_ENDIAN); | ||
if (offset.intensity !== undefined) { | ||
if ((pcdHeader.type as string[])[3] === 'F') { | ||
intensity.push(dataview.getFloat32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
if ((pcdHeader.type as string[])[3] === 'U') { | ||
intensity.push(dataview.getUint32(row + offset.intensity, LITTLE_ENDIAN)); | ||
} | ||
} | ||
@@ -332,3 +351,3 @@ | ||
return {position, normal, color}; | ||
return {position, intensity, normal, color}; | ||
} | ||
@@ -343,2 +362,3 @@ | ||
*/ | ||
// eslint-disable-next-line max-statements | ||
function parsePCDBinaryCompressed(PCDheader: PCDHeader, data: ArrayBufferLike): HeaderAttributes { | ||
@@ -348,2 +368,3 @@ const position: number[] = []; | ||
const color: number[] = []; | ||
const intensity: number[] = []; | ||
@@ -358,3 +379,2 @@ const sizes = new Uint32Array(data.slice(PCDheader.headerLen, PCDheader.headerLen + 8)); | ||
const dataview = new DataView(decompressed.buffer); | ||
const offset = PCDheader.offset; | ||
@@ -384,9 +404,19 @@ | ||
if (offset.intersity !== undefined) { | ||
position.push( | ||
dataview.getFloat32( | ||
(PCDheader.points as number) * offset.intersity + (PCDheader.size as number[])[2] * i, | ||
LITTLE_ENDIAN | ||
) | ||
); | ||
if (offset.intensity !== undefined) { | ||
if ((PCDheader.type as string[])[3] === 'F') { | ||
intensity.push( | ||
dataview.getFloat32( | ||
(PCDheader.points as number) * offset.intensity + (PCDheader.size as number[])[3] * i, | ||
LITTLE_ENDIAN | ||
) | ||
); | ||
} | ||
if ((PCDheader.type as string[])[3] === 'U') { | ||
intensity.push( | ||
dataview.getUint32( | ||
(PCDheader.points as number) * offset.intensity + (PCDheader.size as number[])[3] * i, | ||
LITTLE_ENDIAN | ||
) | ||
); | ||
} | ||
} | ||
@@ -436,2 +466,3 @@ | ||
position, | ||
intensity, | ||
normal, | ||
@@ -438,0 +469,0 @@ color |
@@ -24,3 +24,2 @@ import type {Mesh} from '@ptloader/schema'; | ||
/** */ | ||
@@ -27,0 +26,0 @@ export type PCDMesh = Mesh & { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
212366
3783
+ Added@ptloader/loader-utils@3.3.26(transitive)
+ Added@ptloader/schema@3.3.26(transitive)
+ Added@ptloader/worker-utils@3.3.26(transitive)
- Removed@ptloader/loader-utils@3.3.24(transitive)
- Removed@ptloader/schema@3.3.24(transitive)
- Removed@ptloader/worker-utils@3.3.24(transitive)
Updated@ptloader/schema@3.3.26