Преглед изворни кода

Merge pull request #20375 from gkjohnson/patch-2

LineSegements2: Add a "threshold" Raycaster param
Mr.doob пре 4 година
родитељ
комит
07d8167f61
2 измењених фајлова са 6 додато и 2 уклоњено
  1. 3 1
      examples/js/lines/LineSegments2.js
  2. 3 1
      examples/jsm/lines/LineSegments2.js

+ 3 - 1
examples/js/lines/LineSegments2.js

@@ -70,6 +70,8 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy
 
 			}
 
+			var threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
+
 			var ray = raycaster.ray;
 			var camera = raycaster.camera;
 			var projectionMatrix = camera.projectionMatrix;
@@ -77,7 +79,7 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy
 			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;

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

@@ -81,6 +81,8 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 
 			}
 
+			var threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
+
 			var ray = raycaster.ray;
 			var camera = raycaster.camera;
 			var projectionMatrix = camera.projectionMatrix;
@@ -88,7 +90,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;