|
@@ -70,29 +70,37 @@ THREE.extend( THREE.Frustum.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- intersectsObject: function ( object ) {
|
|
|
+ intersectsObject: function () {
|
|
|
|
|
|
- // this method is expanded inlined for performance reasons.
|
|
|
- var matrix = object.matrixWorld;
|
|
|
- var planes = this.planes;
|
|
|
- var center = matrix.getPosition();
|
|
|
- var negRadius = - object.geometry.boundingSphere.radius * matrix.getMaxScaleOnAxis();
|
|
|
+ var center = new THREE.Vector3();
|
|
|
|
|
|
- for ( var i = 0; i < 6; i ++ ) {
|
|
|
+ return function ( object ) {
|
|
|
|
|
|
- var distance = planes[ i ].distanceToPoint( center );
|
|
|
+ // this method is expanded inlined for performance reasons.
|
|
|
|
|
|
- if( distance < negRadius ) {
|
|
|
+ var matrix = object.matrixWorld;
|
|
|
+ var planes = this.planes;
|
|
|
+ var negRadius = - object.geometry.boundingSphere.radius * matrix.getMaxScaleOnAxis();
|
|
|
|
|
|
- return false;
|
|
|
+ center.getPositionFromMatrix( matrix );
|
|
|
+
|
|
|
+ for ( var i = 0; i < 6; i ++ ) {
|
|
|
+
|
|
|
+ var distance = planes[ i ].distanceToPoint( center );
|
|
|
+
|
|
|
+ if ( distance < negRadius ) {
|
|
|
+
|
|
|
+ return false;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ return true;
|
|
|
|
|
|
- return true;
|
|
|
+ };
|
|
|
|
|
|
- },
|
|
|
+ }(),
|
|
|
|
|
|
intersectsSphere: function ( sphere ) {
|
|
|
|
|
@@ -104,7 +112,7 @@ THREE.extend( THREE.Frustum.prototype, {
|
|
|
|
|
|
var distance = planes[ i ].distanceToPoint( center );
|
|
|
|
|
|
- if( distance < negRadius ) {
|
|
|
+ if ( distance < negRadius ) {
|
|
|
|
|
|
return false;
|
|
|
|
|
@@ -122,7 +130,7 @@ THREE.extend( THREE.Frustum.prototype, {
|
|
|
|
|
|
for ( var i = 0; i < 6; i ++ ) {
|
|
|
|
|
|
- if( planes[ i ].distanceToPoint( point ) < 0 ) {
|
|
|
+ if ( planes[ i ].distanceToPoint( point ) < 0 ) {
|
|
|
|
|
|
return false;
|
|
|
|
|
@@ -140,4 +148,4 @@ THREE.extend( THREE.Frustum.prototype, {
|
|
|
|
|
|
}
|
|
|
|
|
|
-} );
|
|
|
+} );
|