|
@@ -7333,6 +7333,232 @@ Object.assign( Ray.prototype, {
|
|
|
|
|
|
} );
|
|
|
|
|
|
+/**
|
|
|
+ * @author bhouston / http://clara.io
|
|
|
+ */
|
|
|
+
|
|
|
+var _vector1 = new Vector3();
|
|
|
+var _vector2 = new Vector3();
|
|
|
+var _normalMatrix = new Matrix3();
|
|
|
+
|
|
|
+function Plane( normal, constant ) {
|
|
|
+
|
|
|
+ // normal is assumed to be normalized
|
|
|
+
|
|
|
+ this.normal = ( normal !== undefined ) ? normal : new Vector3( 1, 0, 0 );
|
|
|
+ this.constant = ( constant !== undefined ) ? constant : 0;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+Object.assign( Plane.prototype, {
|
|
|
+
|
|
|
+ isPlane: true,
|
|
|
+
|
|
|
+ set: function ( normal, constant ) {
|
|
|
+
|
|
|
+ this.normal.copy( normal );
|
|
|
+ this.constant = constant;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ setComponents: function ( x, y, z, w ) {
|
|
|
+
|
|
|
+ this.normal.set( x, y, z );
|
|
|
+ this.constant = w;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ setFromNormalAndCoplanarPoint: function ( normal, point ) {
|
|
|
+
|
|
|
+ this.normal.copy( normal );
|
|
|
+ this.constant = - point.dot( this.normal );
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ setFromCoplanarPoints: function ( a, b, c ) {
|
|
|
+
|
|
|
+ var normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();
|
|
|
+
|
|
|
+ // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
|
|
|
+
|
|
|
+ this.setFromNormalAndCoplanarPoint( normal, a );
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ clone: function () {
|
|
|
+
|
|
|
+ return new this.constructor().copy( this );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ copy: function ( plane ) {
|
|
|
+
|
|
|
+ this.normal.copy( plane.normal );
|
|
|
+ this.constant = plane.constant;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ normalize: function () {
|
|
|
+
|
|
|
+ // Note: will lead to a divide by zero if the plane is invalid.
|
|
|
+
|
|
|
+ var inverseNormalLength = 1.0 / this.normal.length();
|
|
|
+ this.normal.multiplyScalar( inverseNormalLength );
|
|
|
+ this.constant *= inverseNormalLength;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ negate: function () {
|
|
|
+
|
|
|
+ this.constant *= - 1;
|
|
|
+ this.normal.negate();
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ distanceToPoint: function ( point ) {
|
|
|
+
|
|
|
+ return this.normal.dot( point ) + this.constant;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ distanceToSphere: function ( sphere ) {
|
|
|
+
|
|
|
+ return this.distanceToPoint( sphere.center ) - sphere.radius;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ projectPoint: function ( point, target ) {
|
|
|
+
|
|
|
+ if ( target === undefined ) {
|
|
|
+
|
|
|
+ console.warn( 'THREE.Plane: .projectPoint() target is now required' );
|
|
|
+ target = new Vector3();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return target.copy( this.normal ).multiplyScalar( - this.distanceToPoint( point ) ).add( point );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ intersectLine: function ( line, target ) {
|
|
|
+
|
|
|
+ if ( target === undefined ) {
|
|
|
+
|
|
|
+ console.warn( 'THREE.Plane: .intersectLine() target is now required' );
|
|
|
+ target = new Vector3();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var direction = line.delta( _vector1 );
|
|
|
+
|
|
|
+ var denominator = this.normal.dot( direction );
|
|
|
+
|
|
|
+ if ( denominator === 0 ) {
|
|
|
+
|
|
|
+ // line is coplanar, return origin
|
|
|
+ if ( this.distanceToPoint( line.start ) === 0 ) {
|
|
|
+
|
|
|
+ return target.copy( line.start );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // Unsure if this is the correct method to handle this case.
|
|
|
+ return undefined;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;
|
|
|
+
|
|
|
+ if ( t < 0 || t > 1 ) {
|
|
|
+
|
|
|
+ return undefined;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return target.copy( direction ).multiplyScalar( t ).add( line.start );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ intersectsLine: function ( line ) {
|
|
|
+
|
|
|
+ // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
|
|
|
+
|
|
|
+ var startSign = this.distanceToPoint( line.start );
|
|
|
+ var endSign = this.distanceToPoint( line.end );
|
|
|
+
|
|
|
+ return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ intersectsBox: function ( box ) {
|
|
|
+
|
|
|
+ return box.intersectsPlane( this );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ intersectsSphere: function ( sphere ) {
|
|
|
+
|
|
|
+ return sphere.intersectsPlane( this );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ coplanarPoint: function ( target ) {
|
|
|
+
|
|
|
+ if ( target === undefined ) {
|
|
|
+
|
|
|
+ console.warn( 'THREE.Plane: .coplanarPoint() target is now required' );
|
|
|
+ target = new Vector3();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return target.copy( this.normal ).multiplyScalar( - this.constant );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ applyMatrix4: function ( matrix, optionalNormalMatrix ) {
|
|
|
+
|
|
|
+ var normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );
|
|
|
+
|
|
|
+ var referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );
|
|
|
+
|
|
|
+ var normal = this.normal.applyMatrix3( normalMatrix ).normalize();
|
|
|
+
|
|
|
+ this.constant = - referencePoint.dot( normal );
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ translate: function ( offset ) {
|
|
|
+
|
|
|
+ this.constant -= offset.dot( this.normal );
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ equals: function ( plane ) {
|
|
|
+
|
|
|
+ return plane.normal.equals( this.normal ) && ( plane.constant === this.constant );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+} );
|
|
|
+
|
|
|
/**
|
|
|
* @author bhouston / http://clara.io
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
@@ -7529,7 +7755,7 @@ Object.assign( Triangle.prototype, {
|
|
|
if ( target === undefined ) {
|
|
|
|
|
|
console.warn( 'THREE.Triangle: .getPlane() target is now required' );
|
|
|
- target = new Vector3();
|
|
|
+ target = new Plane();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -13600,232 +13826,6 @@ DataTexture.prototype.constructor = DataTexture;
|
|
|
|
|
|
DataTexture.prototype.isDataTexture = true;
|
|
|
|
|
|
-/**
|
|
|
- * @author bhouston / http://clara.io
|
|
|
- */
|
|
|
-
|
|
|
-var _vector1 = new Vector3();
|
|
|
-var _vector2 = new Vector3();
|
|
|
-var _normalMatrix = new Matrix3();
|
|
|
-
|
|
|
-function Plane( normal, constant ) {
|
|
|
-
|
|
|
- // normal is assumed to be normalized
|
|
|
-
|
|
|
- this.normal = ( normal !== undefined ) ? normal : new Vector3( 1, 0, 0 );
|
|
|
- this.constant = ( constant !== undefined ) ? constant : 0;
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-Object.assign( Plane.prototype, {
|
|
|
-
|
|
|
- isPlane: true,
|
|
|
-
|
|
|
- set: function ( normal, constant ) {
|
|
|
-
|
|
|
- this.normal.copy( normal );
|
|
|
- this.constant = constant;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- setComponents: function ( x, y, z, w ) {
|
|
|
-
|
|
|
- this.normal.set( x, y, z );
|
|
|
- this.constant = w;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- setFromNormalAndCoplanarPoint: function ( normal, point ) {
|
|
|
-
|
|
|
- this.normal.copy( normal );
|
|
|
- this.constant = - point.dot( this.normal );
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- setFromCoplanarPoints: function ( a, b, c ) {
|
|
|
-
|
|
|
- var normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();
|
|
|
-
|
|
|
- // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
|
|
|
-
|
|
|
- this.setFromNormalAndCoplanarPoint( normal, a );
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- clone: function () {
|
|
|
-
|
|
|
- return new this.constructor().copy( this );
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- copy: function ( plane ) {
|
|
|
-
|
|
|
- this.normal.copy( plane.normal );
|
|
|
- this.constant = plane.constant;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- normalize: function () {
|
|
|
-
|
|
|
- // Note: will lead to a divide by zero if the plane is invalid.
|
|
|
-
|
|
|
- var inverseNormalLength = 1.0 / this.normal.length();
|
|
|
- this.normal.multiplyScalar( inverseNormalLength );
|
|
|
- this.constant *= inverseNormalLength;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- negate: function () {
|
|
|
-
|
|
|
- this.constant *= - 1;
|
|
|
- this.normal.negate();
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- distanceToPoint: function ( point ) {
|
|
|
-
|
|
|
- return this.normal.dot( point ) + this.constant;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- distanceToSphere: function ( sphere ) {
|
|
|
-
|
|
|
- return this.distanceToPoint( sphere.center ) - sphere.radius;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- projectPoint: function ( point, target ) {
|
|
|
-
|
|
|
- if ( target === undefined ) {
|
|
|
-
|
|
|
- console.warn( 'THREE.Plane: .projectPoint() target is now required' );
|
|
|
- target = new Vector3();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return target.copy( this.normal ).multiplyScalar( - this.distanceToPoint( point ) ).add( point );
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- intersectLine: function ( line, target ) {
|
|
|
-
|
|
|
- if ( target === undefined ) {
|
|
|
-
|
|
|
- console.warn( 'THREE.Plane: .intersectLine() target is now required' );
|
|
|
- target = new Vector3();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- var direction = line.delta( _vector1 );
|
|
|
-
|
|
|
- var denominator = this.normal.dot( direction );
|
|
|
-
|
|
|
- if ( denominator === 0 ) {
|
|
|
-
|
|
|
- // line is coplanar, return origin
|
|
|
- if ( this.distanceToPoint( line.start ) === 0 ) {
|
|
|
-
|
|
|
- return target.copy( line.start );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- // Unsure if this is the correct method to handle this case.
|
|
|
- return undefined;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- var t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;
|
|
|
-
|
|
|
- if ( t < 0 || t > 1 ) {
|
|
|
-
|
|
|
- return undefined;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return target.copy( direction ).multiplyScalar( t ).add( line.start );
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- intersectsLine: function ( line ) {
|
|
|
-
|
|
|
- // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
|
|
|
-
|
|
|
- var startSign = this.distanceToPoint( line.start );
|
|
|
- var endSign = this.distanceToPoint( line.end );
|
|
|
-
|
|
|
- return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- intersectsBox: function ( box ) {
|
|
|
-
|
|
|
- return box.intersectsPlane( this );
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- intersectsSphere: function ( sphere ) {
|
|
|
-
|
|
|
- return sphere.intersectsPlane( this );
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- coplanarPoint: function ( target ) {
|
|
|
-
|
|
|
- if ( target === undefined ) {
|
|
|
-
|
|
|
- console.warn( 'THREE.Plane: .coplanarPoint() target is now required' );
|
|
|
- target = new Vector3();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return target.copy( this.normal ).multiplyScalar( - this.constant );
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- applyMatrix4: function ( matrix, optionalNormalMatrix ) {
|
|
|
-
|
|
|
- var normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );
|
|
|
-
|
|
|
- var referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );
|
|
|
-
|
|
|
- var normal = this.normal.applyMatrix3( normalMatrix ).normalize();
|
|
|
-
|
|
|
- this.constant = - referencePoint.dot( normal );
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- translate: function ( offset ) {
|
|
|
-
|
|
|
- this.constant -= offset.dot( this.normal );
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- equals: function ( plane ) {
|
|
|
-
|
|
|
- return plane.normal.equals( this.normal ) && ( plane.constant === this.constant );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-} );
|
|
|
-
|
|
|
/**
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
|
* @author alteredq / http://alteredqualia.com/
|
|
@@ -19594,7 +19594,7 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
|
|
|
|
|
|
_state.viewport( _viewport );
|
|
|
|
|
|
- shadow.updateMatrices( light, camera, vp );
|
|
|
+ shadow.updateMatrices( light, vp );
|
|
|
|
|
|
_frustum = shadow.getFrustum();
|
|
|
|
|
@@ -32451,7 +32451,6 @@ CircleBufferGeometry.prototype.constructor = CircleBufferGeometry;
|
|
|
|
|
|
|
|
|
var Geometries = /*#__PURE__*/Object.freeze({
|
|
|
- __proto__: null,
|
|
|
WireframeGeometry: WireframeGeometry,
|
|
|
ParametricGeometry: ParametricGeometry,
|
|
|
ParametricBufferGeometry: ParametricBufferGeometry,
|
|
@@ -33365,7 +33364,6 @@ LineDashedMaterial.prototype.copy = function ( source ) {
|
|
|
|
|
|
|
|
|
var Materials = /*#__PURE__*/Object.freeze({
|
|
|
- __proto__: null,
|
|
|
ShadowMaterial: ShadowMaterial,
|
|
|
SpriteMaterial: SpriteMaterial,
|
|
|
RawShaderMaterial: RawShaderMaterial,
|
|
@@ -37673,7 +37671,6 @@ SplineCurve.prototype.fromJSON = function ( json ) {
|
|
|
|
|
|
|
|
|
var Curves = /*#__PURE__*/Object.freeze({
|
|
|
- __proto__: null,
|
|
|
ArcCurve: ArcCurve,
|
|
|
CatmullRomCurve3: CatmullRomCurve3,
|
|
|
CubicBezierCurve: CubicBezierCurve,
|
|
@@ -38483,7 +38480,7 @@ SpotLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype
|
|
|
|
|
|
isSpotLightShadow: true,
|
|
|
|
|
|
- updateMatrices: function ( light, viewCamera, viewportIndex ) {
|
|
|
+ updateMatrices: function ( light ) {
|
|
|
|
|
|
var camera = this.camera;
|
|
|
|
|
@@ -38500,7 +38497,7 @@ SpotLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype
|
|
|
|
|
|
}
|
|
|
|
|
|
- LightShadow.prototype.updateMatrices.call( this, light, viewCamera, viewportIndex );
|
|
|
+ LightShadow.prototype.updateMatrices.call( this, light );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -38626,7 +38623,9 @@ PointLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype
|
|
|
|
|
|
isPointLightShadow: true,
|
|
|
|
|
|
- updateMatrices: function ( light, viewCamera, viewportIndex ) {
|
|
|
+ updateMatrices: function ( light, viewportIndex ) {
|
|
|
+
|
|
|
+ if ( viewportIndex === undefined ) viewportIndex = 0;
|
|
|
|
|
|
var camera = this.camera,
|
|
|
shadowMatrix = this.matrix,
|
|
@@ -38866,9 +38865,9 @@ DirectionalLightShadow.prototype = Object.assign( Object.create( LightShadow.pro
|
|
|
|
|
|
isDirectionalLightShadow: true,
|
|
|
|
|
|
- updateMatrices: function ( light, viewCamera, viewportIndex ) {
|
|
|
+ updateMatrices: function ( light ) {
|
|
|
|
|
|
- LightShadow.prototype.updateMatrices.call( this, light, viewCamera, viewportIndex );
|
|
|
+ LightShadow.prototype.updateMatrices.call( this, light );
|
|
|
|
|
|
}
|
|
|
|