Skip to content

Commit

Permalink
Fix #90 RGB is only supported on binary PCD
Browse files Browse the repository at this point in the history
  • Loading branch information
dmandrioli committed Jun 16, 2020
1 parent 9cd1ec3 commit e5cdd32
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions imports/editor/3d/SsePCDLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ export default class SsePCDLoader {
}

// Initialize colors
if (offset.rgb != undefined) {
var colorRGB = parseInt(line[offset.rgb]);
var r = (colorRGB >> 16) & 0x0000ff;
var g = (colorRGB >> 8) & 0x0000ff;
var b = (colorRGB) & 0x0000ff;
rgb.push([r, g, b]);
}

color.push(0);
color.push(0);
color.push(0);
Expand Down Expand Up @@ -249,6 +257,14 @@ export default class SsePCDLoader {
}

// Initialize colors
if (offset.rgb != undefined) {
var colorRGB = dataview.getUint32(row + offset.rgb, true);
var r = (colorRGB >> 16) & 0x0000ff;
var g = (colorRGB >> 8) & 0x0000ff;
var b = (colorRGB) & 0x0000ff;
rgb.push([r, g, b]);
}

color.push(0);
color.push(0);
color.push(0);
Expand All @@ -274,7 +290,7 @@ export default class SsePCDLoader {
const x = dataview.getFloat32( row + offset.x, true );
const y = dataview.getFloat32( row + offset.y, true );
const z = dataview.getFloat32( row + offset.z, true );

pt = new THREE.Vector3(x, y, z);

if (!this.serverMode) {
Expand All @@ -298,14 +314,16 @@ export default class SsePCDLoader {
item.classIndex = 0;
label.push(0);
}

// Initialize colors
var colorRGB = dataview.getUint32( row + offset.rgb, true);
var r = (colorRGB >> 16) & 0x0000ff;
var g = (colorRGB >> 8) & 0x0000ff;
var b = (colorRGB ) & 0x0000ff;
rgb.push([r, g, b]);

if (offset.rgb != undefined) {
var colorRGB = dataview.getUint32(row + offset.rgb, true);
var r = (colorRGB >> 16) & 0x0000ff;
var g = (colorRGB >> 8) & 0x0000ff;
var b = (colorRGB) & 0x0000ff;
rgb.push([r, g, b]);
}

color.push(0);
color.push(0);
color.push(0);
Expand Down

0 comments on commit e5cdd32

Please sign in to comment.