|
@@ -182,6 +182,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
var index = geometry.index;
|
|
|
var position = geometry.attributes.position;
|
|
|
var morphPosition = geometry.morphAttributes.position;
|
|
|
+ var morphTargetsRelative = geometry.morphTargetsRelative;
|
|
|
var uv = geometry.attributes.uv;
|
|
|
var uv2 = geometry.attributes.uv2;
|
|
|
var groups = geometry.groups;
|
|
@@ -210,7 +211,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
b = index.getX( j + 1 );
|
|
|
c = index.getX( j + 2 );
|
|
|
|
|
|
- intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, uv, uv2, a, b, c );
|
|
|
+ intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
|
|
|
|
|
|
if ( intersection ) {
|
|
|
|
|
@@ -235,7 +236,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
b = index.getX( i + 1 );
|
|
|
c = index.getX( i + 2 );
|
|
|
|
|
|
- intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, uv, uv2, a, b, c );
|
|
|
+ intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
|
|
|
|
|
|
if ( intersection ) {
|
|
|
|
|
@@ -268,7 +269,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
b = j + 1;
|
|
|
c = j + 2;
|
|
|
|
|
|
- intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, uv, uv2, a, b, c );
|
|
|
+ intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
|
|
|
|
|
|
if ( intersection ) {
|
|
|
|
|
@@ -293,7 +294,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
b = i + 1;
|
|
|
c = i + 2;
|
|
|
|
|
|
- intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, uv, uv2, a, b, c );
|
|
|
+ intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
|
|
|
|
|
|
if ( intersection ) {
|
|
|
|
|
@@ -397,7 +398,7 @@ function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point
|
|
|
|
|
|
}
|
|
|
|
|
|
-function checkBufferGeometryIntersection( object, material, raycaster, ray, position, morphPosition, uv, uv2, a, b, c ) {
|
|
|
+function checkBufferGeometryIntersection( object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ) {
|
|
|
|
|
|
_vA.fromBufferAttribute( position, a );
|
|
|
_vB.fromBufferAttribute( position, b );
|
|
@@ -422,9 +423,19 @@ function checkBufferGeometryIntersection( object, material, raycaster, ray, posi
|
|
|
_tempB.fromBufferAttribute( morphAttribute, b );
|
|
|
_tempC.fromBufferAttribute( morphAttribute, c );
|
|
|
|
|
|
- _morphA.addScaledVector( _tempA.sub( _vA ), influence );
|
|
|
- _morphB.addScaledVector( _tempB.sub( _vB ), influence );
|
|
|
- _morphC.addScaledVector( _tempC.sub( _vC ), influence );
|
|
|
+ if ( morphTargetsRelative ) {
|
|
|
+
|
|
|
+ _morphA.addScaledVector( _tempA, influence );
|
|
|
+ _morphB.addScaledVector( _tempB, influence );
|
|
|
+ _morphC.addScaledVector( _tempC, influence );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ _morphA.addScaledVector( _tempA.sub( _vA ), influence );
|
|
|
+ _morphB.addScaledVector( _tempB.sub( _vB ), influence );
|
|
|
+ _morphC.addScaledVector( _tempC.sub( _vC ), influence );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|