|
@@ -140,25 +140,9 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
var uvB = new Vector2();
|
|
var uvB = new Vector2();
|
|
var uvC = new Vector2();
|
|
var uvC = new Vector2();
|
|
|
|
|
|
- var barycoord = new Vector3();
|
|
|
|
-
|
|
|
|
var intersectionPoint = new Vector3();
|
|
var intersectionPoint = new Vector3();
|
|
var intersectionPointWorld = new Vector3();
|
|
var intersectionPointWorld = new Vector3();
|
|
|
|
|
|
- function uvIntersection( point, p1, p2, p3, uv1, uv2, uv3 ) {
|
|
|
|
-
|
|
|
|
- Triangle.getBarycoord( point, p1, p2, p3, barycoord );
|
|
|
|
-
|
|
|
|
- uv1.multiplyScalar( barycoord.x );
|
|
|
|
- uv2.multiplyScalar( barycoord.y );
|
|
|
|
- uv3.multiplyScalar( barycoord.z );
|
|
|
|
-
|
|
|
|
- uv1.add( uv2 ).add( uv3 );
|
|
|
|
-
|
|
|
|
- return uv1.clone();
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {
|
|
function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {
|
|
|
|
|
|
var intersect;
|
|
var intersect;
|
|
@@ -206,7 +190,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
uvB.fromBufferAttribute( uv, b );
|
|
uvB.fromBufferAttribute( uv, b );
|
|
uvC.fromBufferAttribute( uv, c );
|
|
uvC.fromBufferAttribute( uv, c );
|
|
|
|
|
|
- intersection.uv = uvIntersection( intersectionPoint, vA, vB, vC, uvA, uvB, uvC );
|
|
|
|
|
|
+ intersection.uv = Triangle.uvIntersection( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2() );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -448,7 +432,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
uvB.copy( uvs_f[ 1 ] );
|
|
uvB.copy( uvs_f[ 1 ] );
|
|
uvC.copy( uvs_f[ 2 ] );
|
|
uvC.copy( uvs_f[ 2 ] );
|
|
|
|
|
|
- intersection.uv = uvIntersection( intersectionPoint, fvA, fvB, fvC, uvA, uvB, uvC );
|
|
|
|
|
|
+ intersection.uv = Triangle.uvIntersection( intersectionPoint, fvA, fvB, fvC, uvA, uvB, uvC, new Vector2() );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|