|
@@ -5,24 +5,24 @@ import { Plane } from './Plane.js';
|
|
|
const _sphere = new Sphere();
|
|
|
const _vector = new Vector3();
|
|
|
|
|
|
-function Frustum( p0, p1, p2, p3, p4, p5 ) {
|
|
|
+class Frustum {
|
|
|
|
|
|
- this.planes = [
|
|
|
+ constructor( p0, p1, p2, p3, p4, p5 ) {
|
|
|
|
|
|
- ( p0 !== undefined ) ? p0 : new Plane(),
|
|
|
- ( p1 !== undefined ) ? p1 : new Plane(),
|
|
|
- ( p2 !== undefined ) ? p2 : new Plane(),
|
|
|
- ( p3 !== undefined ) ? p3 : new Plane(),
|
|
|
- ( p4 !== undefined ) ? p4 : new Plane(),
|
|
|
- ( p5 !== undefined ) ? p5 : new Plane()
|
|
|
+ this.planes = [
|
|
|
|
|
|
- ];
|
|
|
+ ( p0 !== undefined ) ? p0 : new Plane(),
|
|
|
+ ( p1 !== undefined ) ? p1 : new Plane(),
|
|
|
+ ( p2 !== undefined ) ? p2 : new Plane(),
|
|
|
+ ( p3 !== undefined ) ? p3 : new Plane(),
|
|
|
+ ( p4 !== undefined ) ? p4 : new Plane(),
|
|
|
+ ( p5 !== undefined ) ? p5 : new Plane()
|
|
|
|
|
|
-}
|
|
|
+ ];
|
|
|
|
|
|
-Object.assign( Frustum.prototype, {
|
|
|
+ }
|
|
|
|
|
|
- set: function ( p0, p1, p2, p3, p4, p5 ) {
|
|
|
+ set( p0, p1, p2, p3, p4, p5 ) {
|
|
|
|
|
|
const planes = this.planes;
|
|
|
|
|
@@ -35,15 +35,15 @@ Object.assign( Frustum.prototype, {
|
|
|
|
|
|
return this;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- clone: function () {
|
|
|
+ clone() {
|
|
|
|
|
|
return new this.constructor().copy( this );
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- copy: function ( frustum ) {
|
|
|
+ copy( frustum ) {
|
|
|
|
|
|
const planes = this.planes;
|
|
|
|
|
@@ -55,9 +55,9 @@ Object.assign( Frustum.prototype, {
|
|
|
|
|
|
return this;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- setFromProjectionMatrix: function ( m ) {
|
|
|
+ setFromProjectionMatrix( m ) {
|
|
|
|
|
|
const planes = this.planes;
|
|
|
const me = m.elements;
|
|
@@ -75,9 +75,9 @@ Object.assign( Frustum.prototype, {
|
|
|
|
|
|
return this;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- intersectsObject: function ( object ) {
|
|
|
+ intersectsObject( object ) {
|
|
|
|
|
|
const geometry = object.geometry;
|
|
|
|
|
@@ -87,9 +87,9 @@ Object.assign( Frustum.prototype, {
|
|
|
|
|
|
return this.intersectsSphere( _sphere );
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- intersectsSprite: function ( sprite ) {
|
|
|
+ intersectsSprite( sprite ) {
|
|
|
|
|
|
_sphere.center.set( 0, 0, 0 );
|
|
|
_sphere.radius = 0.7071067811865476;
|
|
@@ -97,9 +97,9 @@ Object.assign( Frustum.prototype, {
|
|
|
|
|
|
return this.intersectsSphere( _sphere );
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- intersectsSphere: function ( sphere ) {
|
|
|
+ intersectsSphere( sphere ) {
|
|
|
|
|
|
const planes = this.planes;
|
|
|
const center = sphere.center;
|
|
@@ -119,9 +119,9 @@ Object.assign( Frustum.prototype, {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- intersectsBox: function ( box ) {
|
|
|
+ intersectsBox( box ) {
|
|
|
|
|
|
const planes = this.planes;
|
|
|
|
|
@@ -145,9 +145,9 @@ Object.assign( Frustum.prototype, {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- containsPoint: function ( point ) {
|
|
|
+ containsPoint( point ) {
|
|
|
|
|
|
const planes = this.planes;
|
|
|
|
|
@@ -165,7 +165,7 @@ Object.assign( Frustum.prototype, {
|
|
|
|
|
|
}
|
|
|
|
|
|
-} );
|
|
|
+}
|
|
|
|
|
|
|
|
|
export { Frustum };
|