|
@@ -179,7 +179,7 @@ Object.assign( EventDispatcher.prototype, {
|
|
|
|
|
|
} );
|
|
|
|
|
|
-var REVISION = '94dev';
|
|
|
+var REVISION = '94';
|
|
|
var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
|
|
|
var CullFaceNone = 0;
|
|
|
var CullFaceBack = 1;
|
|
@@ -2430,19 +2430,21 @@ Object.assign( Quaternion.prototype, {
|
|
|
|
|
|
}
|
|
|
|
|
|
- var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );
|
|
|
+ var sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;
|
|
|
|
|
|
- if ( Math.abs( sinHalfTheta ) < 0.001 ) {
|
|
|
+ if ( sqrSinHalfTheta <= Number.EPSILON ) {
|
|
|
|
|
|
- this._w = 0.5 * ( w + this._w );
|
|
|
- this._x = 0.5 * ( x + this._x );
|
|
|
- this._y = 0.5 * ( y + this._y );
|
|
|
- this._z = 0.5 * ( z + this._z );
|
|
|
+ var s = 1 - t;
|
|
|
+ this._w = s * w + t * this._w;
|
|
|
+ this._x = s * x + t * this._x;
|
|
|
+ this._y = s * y + t * this._y;
|
|
|
+ this._z = s * z + t * this._z;
|
|
|
|
|
|
- return this;
|
|
|
+ return this.normalize();
|
|
|
|
|
|
}
|
|
|
|
|
|
+ var sinHalfTheta = Math.sqrt( sqrSinHalfTheta );
|
|
|
var halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );
|
|
|
var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,
|
|
|
ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;
|
|
@@ -24775,18 +24777,80 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
raycast: ( function () {
|
|
|
|
|
|
var intersectPoint = new Vector3();
|
|
|
- var worldPosition = new Vector3();
|
|
|
var worldScale = new Vector3();
|
|
|
+ var mvPosition = new Vector3();
|
|
|
|
|
|
- return function raycast( raycaster, intersects ) {
|
|
|
+ var alignedPosition = new Vector2();
|
|
|
+ var rotatedPosition = new Vector2();
|
|
|
+ var viewWorldMatrix = new Matrix4();
|
|
|
+
|
|
|
+ var vA = new Vector3();
|
|
|
+ var vB = new Vector3();
|
|
|
+ var vC = new Vector3();
|
|
|
+
|
|
|
+ function transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {
|
|
|
|
|
|
- worldPosition.setFromMatrixPosition( this.matrixWorld );
|
|
|
- raycaster.ray.closestPointToPoint( worldPosition, intersectPoint );
|
|
|
+ // compute position in camera space
|
|
|
+ alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );
|
|
|
+
|
|
|
+ // to check if rotation is not zero
|
|
|
+ if ( sin !== undefined ) {
|
|
|
+
|
|
|
+ rotatedPosition.x = ( cos * alignedPosition.x ) - ( sin * alignedPosition.y );
|
|
|
+ rotatedPosition.y = ( sin * alignedPosition.x ) + ( cos * alignedPosition.y );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ rotatedPosition.copy( alignedPosition );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ vertexPosition.copy( mvPosition );
|
|
|
+ vertexPosition.x += rotatedPosition.x;
|
|
|
+ vertexPosition.y += rotatedPosition.y;
|
|
|
+
|
|
|
+ // transform to world space
|
|
|
+ vertexPosition.applyMatrix4( viewWorldMatrix );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return function raycast( raycaster, intersects ) {
|
|
|
|
|
|
worldScale.setFromMatrixScale( this.matrixWorld );
|
|
|
- var guessSizeSq = worldScale.x * worldScale.y / 4;
|
|
|
+ viewWorldMatrix.getInverse( this.modelViewMatrix ).premultiply( this.matrixWorld );
|
|
|
+ mvPosition.setFromMatrixPosition( this.modelViewMatrix );
|
|
|
+
|
|
|
+ var rotation = this.material.rotation;
|
|
|
+ var sin, cos;
|
|
|
+ if ( rotation !== 0 ) {
|
|
|
+
|
|
|
+ cos = Math.cos( rotation );
|
|
|
+ sin = Math.sin( rotation );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var center = this.center;
|
|
|
+
|
|
|
+ transformVertex( vA.set( - 0.5, - 0.5, 0 ), mvPosition, center, worldScale, sin, cos );
|
|
|
+ transformVertex( vB.set( 0.5, - 0.5, 0 ), mvPosition, center, worldScale, sin, cos );
|
|
|
+ transformVertex( vC.set( 0.5, 0.5, 0 ), mvPosition, center, worldScale, sin, cos );
|
|
|
|
|
|
- if ( worldPosition.distanceToSquared( intersectPoint ) > guessSizeSq ) return;
|
|
|
+ // check first triangle
|
|
|
+ var intersect = raycaster.ray.intersectTriangle( vA, vB, vC, false, intersectPoint );
|
|
|
+
|
|
|
+ if ( intersect === null ) {
|
|
|
+
|
|
|
+ // check second triangle
|
|
|
+ transformVertex( vB.set( - 0.5, 0.5, 0 ), mvPosition, center, worldScale, sin, cos );
|
|
|
+ intersect = raycaster.ray.intersectTriangle( vA, vC, vB, false, intersectPoint );
|
|
|
+ if ( intersect === null ) {
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
var distance = raycaster.ray.origin.distanceTo( intersectPoint );
|
|
|
|
|
@@ -39430,6 +39494,8 @@ AudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ return this;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
getFilter: function () {
|
|
@@ -39455,6 +39521,8 @@ AudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
this.gain.connect( this.filter );
|
|
|
this.filter.connect( this.context.destination );
|
|
|
|
|
|
+ return this;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
getMasterVolume: function () {
|
|
@@ -39467,6 +39535,8 @@ AudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
|
|
|
this.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );
|
|
|
|
|
|
+ return this;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
updateMatrixWorld: ( function () {
|
|
@@ -39860,6 +39930,8 @@ PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), {
|
|
|
|
|
|
this.panner.refDistance = value;
|
|
|
|
|
|
+ return this;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
getRolloffFactor: function () {
|
|
@@ -39872,6 +39944,8 @@ PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), {
|
|
|
|
|
|
this.panner.rolloffFactor = value;
|
|
|
|
|
|
+ return this;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
getDistanceModel: function () {
|
|
@@ -39884,6 +39958,8 @@ PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), {
|
|
|
|
|
|
this.panner.distanceModel = value;
|
|
|
|
|
|
+ return this;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
getMaxDistance: function () {
|
|
@@ -39896,6 +39972,18 @@ PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), {
|
|
|
|
|
|
this.panner.maxDistance = value;
|
|
|
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ setDirectionalCone: function ( coneInnerAngle, coneOuterAngle, coneOuterGain ) {
|
|
|
+
|
|
|
+ this.panner.coneInnerAngle = coneInnerAngle;
|
|
|
+ this.panner.coneOuterAngle = coneOuterAngle;
|
|
|
+ this.panner.coneOuterGain = coneOuterGain;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
updateMatrixWorld: ( function () {
|