|
@@ -11794,7 +11794,7 @@ class Mesh extends Object3D {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {
|
|
|
|
|
|
+function checkIntersection$1( object, material, raycaster, ray, pA, pB, pC, point ) {
|
|
|
|
|
|
let intersect;
|
|
let intersect;
|
|
|
|
|
|
@@ -11831,7 +11831,7 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
object.getVertexPosition( b, _vB$1 );
|
|
object.getVertexPosition( b, _vB$1 );
|
|
object.getVertexPosition( c, _vC$1 );
|
|
object.getVertexPosition( c, _vC$1 );
|
|
|
|
|
|
- const intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );
|
|
|
|
|
|
+ const intersection = checkIntersection$1( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );
|
|
|
|
|
|
if ( intersection ) {
|
|
if ( intersection ) {
|
|
|
|
|
|
@@ -13825,8 +13825,6 @@ var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying flo
|
|
|
|
|
|
var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}";
|
|
var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}";
|
|
|
|
|
|
-var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif";
|
|
|
|
-
|
|
|
|
var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
|
|
var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
|
|
|
|
|
|
var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
@@ -14069,7 +14067,6 @@ const ShaderChunk = {
|
|
fog_fragment: fog_fragment,
|
|
fog_fragment: fog_fragment,
|
|
fog_pars_fragment: fog_pars_fragment,
|
|
fog_pars_fragment: fog_pars_fragment,
|
|
gradientmap_pars_fragment: gradientmap_pars_fragment,
|
|
gradientmap_pars_fragment: gradientmap_pars_fragment,
|
|
- lightmap_fragment: lightmap_fragment,
|
|
|
|
lightmap_pars_fragment: lightmap_pars_fragment,
|
|
lightmap_pars_fragment: lightmap_pars_fragment,
|
|
lights_lambert_fragment: lights_lambert_fragment,
|
|
lights_lambert_fragment: lights_lambert_fragment,
|
|
lights_lambert_pars_fragment: lights_lambert_pars_fragment,
|
|
lights_lambert_pars_fragment: lights_lambert_pars_fragment,
|
|
@@ -33789,12 +33786,16 @@ class LineBasicMaterial extends Material {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-const _start$1 = /*@__PURE__*/ new Vector3();
|
|
|
|
-const _end$1 = /*@__PURE__*/ new Vector3();
|
|
|
|
|
|
+const _vStart = /*@__PURE__*/ new Vector3();
|
|
|
|
+const _vEnd = /*@__PURE__*/ new Vector3();
|
|
|
|
+
|
|
const _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();
|
|
const _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();
|
|
const _ray$1 = /*@__PURE__*/ new Ray();
|
|
const _ray$1 = /*@__PURE__*/ new Ray();
|
|
const _sphere$1 = /*@__PURE__*/ new Sphere();
|
|
const _sphere$1 = /*@__PURE__*/ new Sphere();
|
|
|
|
|
|
|
|
+const _intersectPointOnRay = /*@__PURE__*/ new Vector3();
|
|
|
|
+const _intersectPointOnSegment = /*@__PURE__*/ new Vector3();
|
|
|
|
+
|
|
class Line extends Object3D {
|
|
class Line extends Object3D {
|
|
|
|
|
|
constructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {
|
|
constructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {
|
|
@@ -33836,11 +33837,11 @@ class Line extends Object3D {
|
|
|
|
|
|
for ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {
|
|
for ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {
|
|
|
|
|
|
- _start$1.fromBufferAttribute( positionAttribute, i - 1 );
|
|
|
|
- _end$1.fromBufferAttribute( positionAttribute, i );
|
|
|
|
|
|
+ _vStart.fromBufferAttribute( positionAttribute, i - 1 );
|
|
|
|
+ _vEnd.fromBufferAttribute( positionAttribute, i );
|
|
|
|
|
|
lineDistances[ i ] = lineDistances[ i - 1 ];
|
|
lineDistances[ i ] = lineDistances[ i - 1 ];
|
|
- lineDistances[ i ] += _start$1.distanceTo( _end$1 );
|
|
|
|
|
|
+ lineDistances[ i ] += _vStart.distanceTo( _vEnd );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -33881,10 +33882,6 @@ class Line extends Object3D {
|
|
const localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );
|
|
const localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );
|
|
const localThresholdSq = localThreshold * localThreshold;
|
|
const localThresholdSq = localThreshold * localThreshold;
|
|
|
|
|
|
- const vStart = new Vector3();
|
|
|
|
- const vEnd = new Vector3();
|
|
|
|
- const interSegment = new Vector3();
|
|
|
|
- const interRay = new Vector3();
|
|
|
|
const step = this.isLineSegments ? 2 : 1;
|
|
const step = this.isLineSegments ? 2 : 1;
|
|
|
|
|
|
const index = geometry.index;
|
|
const index = geometry.index;
|
|
@@ -33901,31 +33898,28 @@ class Line extends Object3D {
|
|
const a = index.getX( i );
|
|
const a = index.getX( i );
|
|
const b = index.getX( i + 1 );
|
|
const b = index.getX( i + 1 );
|
|
|
|
|
|
- vStart.fromBufferAttribute( positionAttribute, a );
|
|
|
|
- vEnd.fromBufferAttribute( positionAttribute, b );
|
|
|
|
|
|
+ const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );
|
|
|
|
+
|
|
|
|
+ if ( intersect ) {
|
|
|
|
|
|
- const distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
|
|
|
|
|
|
+ intersects.push( intersect );
|
|
|
|
|
|
- if ( distSq > localThresholdSq ) continue;
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
- interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
|
|
|
|
|
|
+ if ( this.isLineLoop ) {
|
|
|
|
|
|
- const distance = raycaster.ray.origin.distanceTo( interRay );
|
|
|
|
|
|
+ const a = index.getX( end - 1 );
|
|
|
|
+ const b = index.getX( start );
|
|
|
|
|
|
- if ( distance < raycaster.near || distance > raycaster.far ) continue;
|
|
|
|
|
|
+ const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );
|
|
|
|
|
|
- intersects.push( {
|
|
|
|
|
|
+ if ( intersect ) {
|
|
|
|
|
|
- distance: distance,
|
|
|
|
- // What do we want? intersection point on the ray or on the segment??
|
|
|
|
- // point: raycaster.ray.at( distance ),
|
|
|
|
- point: interSegment.clone().applyMatrix4( this.matrixWorld ),
|
|
|
|
- index: i,
|
|
|
|
- face: null,
|
|
|
|
- faceIndex: null,
|
|
|
|
- object: this
|
|
|
|
|
|
+ intersects.push( intersect );
|
|
|
|
|
|
- } );
|
|
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -33936,31 +33930,25 @@ class Line extends Object3D {
|
|
|
|
|
|
for ( let i = start, l = end - 1; i < l; i += step ) {
|
|
for ( let i = start, l = end - 1; i < l; i += step ) {
|
|
|
|
|
|
- vStart.fromBufferAttribute( positionAttribute, i );
|
|
|
|
- vEnd.fromBufferAttribute( positionAttribute, i + 1 );
|
|
|
|
|
|
+ const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, i, i + 1 );
|
|
|
|
|
|
- const distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
|
|
|
|
|
|
+ if ( intersect ) {
|
|
|
|
|
|
- if ( distSq > localThresholdSq ) continue;
|
|
|
|
|
|
+ intersects.push( intersect );
|
|
|
|
|
|
- interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- const distance = raycaster.ray.origin.distanceTo( interRay );
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if ( distance < raycaster.near || distance > raycaster.far ) continue;
|
|
|
|
|
|
+ if ( this.isLineLoop ) {
|
|
|
|
|
|
- intersects.push( {
|
|
|
|
|
|
+ const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, end - 1, start );
|
|
|
|
|
|
- distance: distance,
|
|
|
|
- // What do we want? intersection point on the ray or on the segment??
|
|
|
|
- // point: raycaster.ray.at( distance ),
|
|
|
|
- point: interSegment.clone().applyMatrix4( this.matrixWorld ),
|
|
|
|
- index: i,
|
|
|
|
- face: null,
|
|
|
|
- faceIndex: null,
|
|
|
|
- object: this
|
|
|
|
|
|
+ if ( intersect ) {
|
|
|
|
|
|
- } );
|
|
|
|
|
|
+ intersects.push( intersect );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -34001,6 +33989,38 @@ class Line extends Object3D {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
|
|
+
|
|
|
|
+ const positionAttribute = object.geometry.attributes.position;
|
|
|
|
+
|
|
|
|
+ _vStart.fromBufferAttribute( positionAttribute, a );
|
|
|
|
+ _vEnd.fromBufferAttribute( positionAttribute, b );
|
|
|
|
+
|
|
|
|
+ const distSq = ray.distanceSqToSegment( _vStart, _vEnd, _intersectPointOnRay, _intersectPointOnSegment );
|
|
|
|
+
|
|
|
|
+ if ( distSq > thresholdSq ) return;
|
|
|
|
+
|
|
|
|
+ _intersectPointOnRay.applyMatrix4( object.matrixWorld ); // Move back to world space for distance calculation
|
|
|
|
+
|
|
|
|
+ const distance = raycaster.ray.origin.distanceTo( _intersectPointOnRay );
|
|
|
|
+
|
|
|
|
+ if ( distance < raycaster.near || distance > raycaster.far ) return;
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+
|
|
|
|
+ distance: distance,
|
|
|
|
+ // What do we want? intersection point on the ray or on the segment??
|
|
|
|
+ // point: raycaster.ray.at( distance ),
|
|
|
|
+ point: _intersectPointOnSegment.clone().applyMatrix4( object.matrixWorld ),
|
|
|
|
+ index: a,
|
|
|
|
+ face: null,
|
|
|
|
+ faceIndex: null,
|
|
|
|
+ object: object
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
const _start = /*@__PURE__*/ new Vector3();
|
|
const _start = /*@__PURE__*/ new Vector3();
|
|
const _end = /*@__PURE__*/ new Vector3();
|
|
const _end = /*@__PURE__*/ new Vector3();
|
|
|
|
|