Explorar o código

Add threshold option to Line2 raycast

Garrett Johnson %!s(int64=4) %!d(string=hai) anos
pai
achega
84deae15c8
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      examples/jsm/lines/LineSegments2.js

+ 8 - 1
examples/jsm/lines/LineSegments2.js

@@ -81,6 +81,13 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 
 			}
 
+			var threshold = 0;
+			if ( 'Line2' in raycaster.params ) {
+			
+				threshold = raycaster.params.Lines2.threshold || 0.0
+			
+			}
+			
 			var ray = raycaster.ray;
 			var camera = raycaster.camera;
 			var projectionMatrix = camera.projectionMatrix;
@@ -88,7 +95,7 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 			var geometry = this.geometry;
 			var material = this.material;
 			var resolution = material.resolution;
-			var lineWidth = material.linewidth;
+			var lineWidth = material.linewidth + threshold;
 
 			var instanceStart = geometry.attributes.instanceStart;
 			var instanceEnd = geometry.attributes.instanceEnd;