xzw 1 year ago
parent
commit
679e4b31d0

+ 1 - 1
src/custom/modules/panos/DepthImageSampler.js

@@ -11,7 +11,7 @@ class DepthImageSampler extends THREE.EventDispatcher{
         super()
         var canvas = document.createElement("canvas");
         this.canvas = canvas
-        this.context = canvas.getContext("2d")  
+        this.context = canvas.getContext("2d", {willReadFrequently: true})  
         this.imgDatas = []
         
         /* document.getElementsByTagName('body')[0].appendChild(canvas);

+ 6 - 6
src/materials/ExtendPointCloudMaterial.js

@@ -314,21 +314,21 @@ export class ExtendPointCloudMaterial extends PointCloudMaterial {
  
         
 		this.uniforms.clipBoxBig_in.value = bigClipInBox && bigClipInBox.inverse
-		this.uniforms.clipBoxes_in.value = new Float32Array(this.clipBoxes_in.length * 16);
-		this.uniforms.clipBoxes_out.value = new Float32Array(this.clipBoxes_out.length * 16);
-		this.uniforms.boxes_highlight.value = new Float32Array(this.highlightBoxes.length * 16);
+		this.uniforms.clipBoxes_in.value = new Float32Array(clipBoxes_in.length * 16);
+		this.uniforms.clipBoxes_out.value = new Float32Array(clipBoxes_out.length * 16);
+		this.uniforms.boxes_highlight.value = new Float32Array(highlightBoxes.length * 16);
         
         
         
-		for (let i = 0; i < this.clipBoxes_in.length; i++) {
+		for (let i = 0; i < clipBoxes_in.length; i++) {
 			let box = clipBoxes_in[i];  
 			this.uniforms.clipBoxes_in.value.set(box.inverse.elements, 16 * i);
 		}
-		for (let i = 0; i < this.clipBoxes_out.length; i++) {
+		for (let i = 0; i < clipBoxes_out.length; i++) {
 			let box = clipBoxes_out[i];  
 			this.uniforms.clipBoxes_out.value.set(box.inverse.elements, 16 * i);
 		}
-		for (let i = 0; i < this.highlightBoxes.length; i++) {
+		for (let i = 0; i < highlightBoxes.length; i++) {
 			let box = highlightBoxes[i];  
 			this.uniforms.boxes_highlight.value.set(box.inverse.elements, 16 * i);
 		}

+ 12 - 7
src/materials/shaders/depthBasic.fs

@@ -7,14 +7,19 @@ uniform vec3 baseColor;
     uniform sampler2D map; 
     
     vec4 getMapColor(vec4 color){ 
-        vec2 uv = (vUv - 0.5) / mapScale + 0.5; 
-        if(uv.x > 1.0 || uv.y > 1.0 || uv.x < 0.0 || uv.y < 0.0){
-            //color = vec4(0.0,0.0,0.0,0.0);
-            discard;
-        }else{
-            color = texture2D(map, uv) * color; 
+        if(mapScale == 1.0){
+            color = texture2D(map, vUv) * color; 
+            return color;
+        }else{ 
+            vec2 uv = (vUv - 0.5) / mapScale + 0.5; 
+            if(uv.x > 1.0 || uv.y > 1.0 || uv.x < 0.0 || uv.y < 0.0){
+                //color = vec4(0.0,0.0,0.0,0.0);
+                discard;
+            }else{
+                color = texture2D(map, uv) * color; 
+            }
+            return color; 
         }
-        return color; 
     }
 #endif