xzw 3 年之前
父节点
当前提交
2564465821
共有 4 个文件被更改,包括 9 次插入9 次删除
  1. 5 5
      src/PointCloudOctree.js
  2. 1 1
      src/materials/shaders/pointcloud.fs
  3. 1 1
      src/materials/shaders/pointcloud.vs
  4. 2 2
      src/utils.js

+ 5 - 5
src/PointCloudOctree.js

@@ -1392,7 +1392,7 @@ export class PointCloudOctree extends PointCloudTree {
 
 		let getVal = (a, b) => a !== undefined ? a : b;
 
-		let pickWindowSize = getVal(params.pickWindowSize, 65);  //拾取像素边长
+		let pickWindowSize = getVal(params.pickWindowSize, 5/* 65 */);  //拾取像素边长
 		let pickOutsideClipRegion = getVal(params.pickOutsideClipRegion, false);
 
 		let size = renderer.getSize(new THREE.Vector2());
@@ -1527,7 +1527,7 @@ export class PointCloudOctree extends PointCloudTree {
 		gl.disable(gl.SCISSOR_TEST);
 
 		let pixels = buffer;
-		let ibuffer = new Uint32Array(buffer.buffer);
+		let ibuffer = new Uint32Array(buffer.buffer); //四个数整合成一个
 
 		// find closest hit inside pixelWindow boundaries
 		let min = Number.MAX_VALUE;
@@ -1537,9 +1537,9 @@ export class PointCloudOctree extends PointCloudTree {
 				let offset = (u + v * pickWindowSize);
 				let distance = Math.pow(u - (pickWindowSize - 1) / 2, 2) + Math.pow(v - (pickWindowSize - 1) / 2, 2);
 
-				let pcIndex = pixels[4 * offset + 3];
-				pixels[4 * offset + 3] = 0;
-				let pIndex = ibuffer[offset];
+				let pcIndex = pixels[4 * offset + 3];//nodes index(第四位)
+				pixels[4 * offset + 3] = 0; //去除nodes index后剩下的是index(前三位)
+				let pIndex = ibuffer[offset]; //index
 
 				if(!(pcIndex === 0 && pIndex === 0) && (pcIndex !== undefined) && (pIndex !== undefined)){
 					let hit = {

+ 1 - 1
src/materials/shaders/pointcloud.fs

@@ -130,7 +130,7 @@ void main() {
 	
  
     #if defined color_type_indices    //pick point recognize
-		gl_FragColor = vec4(color, uPCIndex / 255.0);
+		gl_FragColor = vec4(color, uPCIndex / 255.0); //uPCIndex : node Index
 	#else
 		gl_FragColor = vec4(color, vOpacity);
 	#endif

+ 1 - 1
src/materials/shaders/pointcloud.vs

@@ -46,7 +46,7 @@ attribute float classification;
 attribute float returnNumber;
 attribute float numberOfReturns;
 attribute float pointSourceID;
-attribute vec4 indices;
+attribute vec4 indices;    //每个点的index
 attribute float spacing;
 attribute float gpsTime;
 attribute vec3 normal;

+ 2 - 2
src/utils.js

@@ -431,7 +431,7 @@ export class Utils {
         
         let density
         let sizeType
-        if(params.isMeasuring){ 
+        if(params.isMeasuring || Potree.settings.displayMode == 'showPanos'){ //测量或全景模式提高精准度
             density = Potree.settings.pointDensity 
             Potree.settings.pointDensity = 'magnifier' 
              
@@ -463,7 +463,7 @@ export class Utils {
 		}
 
 
-        if(params.isMeasuring){
+        if(params.isMeasuring || Potree.settings.displayMode == 'showPanos'){
             Potree.settings.pointDensity = density
             
             pointclouds.forEach(e=>{