浏览代码

Merge pull request #18303 from sniklaus/patch-2

Fixed binary compressed color in PCDLoader
Michael Herzog 5 年之前
父节点
当前提交
51b2c730f1
共有 2 个文件被更改,包括 6 次插入6 次删除
  1. 3 3
      examples/js/loaders/PCDLoader.js
  2. 3 3
      examples/jsm/loaders/PCDLoader.js

+ 3 - 3
examples/js/loaders/PCDLoader.js

@@ -298,9 +298,9 @@ THREE.PCDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 
 				if ( offset.rgb !== undefined ) {
 				if ( offset.rgb !== undefined ) {
 
 
-					color.push( dataview.getUint8( ( PCDheader.points * ( offset.rgb + 2 ) ) + PCDheader.size[ 3 ] * i ) / 255.0 );
-					color.push( dataview.getUint8( ( PCDheader.points * ( offset.rgb + 1 ) ) + PCDheader.size[ 3 ] * i ) / 255.0 );
-					color.push( dataview.getUint8( ( PCDheader.points * ( offset.rgb + 0 ) ) + PCDheader.size[ 3 ] * i ) / 255.0 );
+					color.push( dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ 3 ] * i + 0 ) / 255.0 );
+					color.push( dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ 3 ] * i + 1 ) / 255.0 );
+					color.push( dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ 3 ] * i + 2 ) / 255.0 );
 
 
 				}
 				}
 
 

+ 3 - 3
examples/jsm/loaders/PCDLoader.js

@@ -309,9 +309,9 @@ PCDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 
 				if ( offset.rgb !== undefined ) {
 				if ( offset.rgb !== undefined ) {
 
 
-					color.push( dataview.getUint8( ( PCDheader.points * ( offset.rgb + 2 ) ) + PCDheader.size[ 3 ] * i ) / 255.0 );
-					color.push( dataview.getUint8( ( PCDheader.points * ( offset.rgb + 1 ) ) + PCDheader.size[ 3 ] * i ) / 255.0 );
-					color.push( dataview.getUint8( ( PCDheader.points * ( offset.rgb + 0 ) ) + PCDheader.size[ 3 ] * i ) / 255.0 );
+					color.push( dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ 3 ] * i + 0 ) / 255.0 );
+					color.push( dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ 3 ] * i + 1 ) / 255.0 );
+					color.push( dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ 3 ] * i + 2 ) / 255.0 );
 
 
 				}
 				}