فهرست منبع

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();