瀏覽代碼

Update webgl_lines_fat_raycasting.html (#23690)

Garrett Johnson 2 年之前
父節點
當前提交
f07ec20c18
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      examples/webgl_lines_fat_raycasting.html

+ 5 - 4
examples/webgl_lines_fat_raycasting.html

@@ -233,6 +233,11 @@
 				renderer.setViewport( 0, 0, window.innerWidth, window.innerHeight );
 
 				raycaster.setFromCamera( pointer, camera );
+				
+				// renderer will set this eventually
+				// set the new resolution before raycasting so it is set correctly
+				matLine.resolution.set( window.innerWidth, window.innerHeight ); // resolution of the viewport
+				matThresholdLine.resolution.set( window.innerWidth, window.innerHeight ); // resolution of the viewport
 
 				const obj = line.visible ? line : segments;
 				const intersects = raycaster.intersectObject( obj, true );
@@ -258,10 +263,6 @@
 
 				}
 
-				// renderer will set this eventually
-				matLine.resolution.set( window.innerWidth, window.innerHeight ); // resolution of the viewport
-				matThresholdLine.resolution.set( window.innerWidth, window.innerHeight ); // resolution of the viewport
-
 				gpuPanel.startQuery();
 				renderer.render( scene, camera );
 				gpuPanel.endQuery();