提交 8b446fb5 编写于 作者: S stephomi

Remove remaining ray normalization in Raycaster.

上级 15ac1a6f
/** /**
* @author mrdoob / http://mrdoob.com/ * @author mrdoob / http://mrdoob.com/
* @author bhouston / http://exocortex.com/ * @author bhouston / http://exocortex.com/
* @author stephomi / http://stephaneginier.com/
*/ */
( function ( THREE ) { ( function ( THREE ) {
...@@ -8,13 +9,7 @@ ...@@ -8,13 +9,7 @@
THREE.Raycaster = function ( origin, direction, near, far ) { THREE.Raycaster = function ( origin, direction, near, far ) {
this.ray = new THREE.Ray( origin, direction ); this.ray = new THREE.Ray( origin, direction );
// direction is assumed to be normalized (for accurate distance calculations)
// normalized ray.direction required for accurate distance calculations
if ( this.ray.direction.lengthSq() > 0 ) {
this.ray.direction.normalize();
}
this.near = near || 0; this.near = near || 0;
this.far = far || Infinity; this.far = far || Infinity;
...@@ -172,8 +167,6 @@ ...@@ -172,8 +167,6 @@
intersects.push( { intersects.push( {
// this works because the original ray was normalized,
// and the transformed localRay wasn't
distance: distance, distance: distance,
point: interPoint, point: interPoint,
face: null, face: null,
...@@ -288,7 +281,6 @@ ...@@ -288,7 +281,6 @@
inverseMatrix.getInverse( object.matrixWorld ); inverseMatrix.getInverse( object.matrixWorld );
localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
localRay.direction.normalize(); // for scale matrix
var vertices = geometry.vertices; var vertices = geometry.vertices;
var nbVertices = vertices.length; var nbVertices = vertices.length;
...@@ -347,13 +339,7 @@ ...@@ -347,13 +339,7 @@
THREE.Raycaster.prototype.set = function ( origin, direction ) { THREE.Raycaster.prototype.set = function ( origin, direction ) {
this.ray.set( origin, direction ); this.ray.set( origin, direction );
// direction is assumed to be normalized (for accurate distance calculations)
// normalized ray.direction required for accurate distance calculations
if ( this.ray.direction.length() > 0 ) {
this.ray.direction.normalize();
}
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册