|
@@ -8356,56 +8356,58 @@ Object.assign( Box3.prototype, {
|
|
|
// Computes the world-axis-aligned bounding box of an object (including its children),
|
|
|
// accounting for both the object's, and children's, world transforms
|
|
|
|
|
|
+ var scope, i, l;
|
|
|
+
|
|
|
var v1 = new Vector3();
|
|
|
|
|
|
- return function expandByObject( object ) {
|
|
|
+ function traverse( node ) {
|
|
|
|
|
|
- var scope = this;
|
|
|
+ var geometry = node.geometry;
|
|
|
|
|
|
- object.updateMatrixWorld( true );
|
|
|
+ if ( geometry !== undefined ) {
|
|
|
|
|
|
- object.traverse( function ( node ) {
|
|
|
+ if ( geometry.isGeometry ) {
|
|
|
|
|
|
- var i, l;
|
|
|
+ var vertices = geometry.vertices;
|
|
|
|
|
|
- var geometry = node.geometry;
|
|
|
+ for ( i = 0, l = vertices.length; i < l; i ++ ) {
|
|
|
|
|
|
- if ( geometry !== undefined ) {
|
|
|
+ v1.copy( vertices[ i ] );
|
|
|
+ v1.applyMatrix4( node.matrixWorld );
|
|
|
|
|
|
- if ( geometry.isGeometry ) {
|
|
|
+ scope.expandByPoint( v1 );
|
|
|
|
|
|
- var vertices = geometry.vertices;
|
|
|
+ }
|
|
|
|
|
|
- for ( i = 0, l = vertices.length; i < l; i ++ ) {
|
|
|
+ } else if ( geometry.isBufferGeometry ) {
|
|
|
|
|
|
- v1.copy( vertices[ i ] );
|
|
|
- v1.applyMatrix4( node.matrixWorld );
|
|
|
+ var attribute = geometry.attributes.position;
|
|
|
|
|
|
- scope.expandByPoint( v1 );
|
|
|
+ if ( attribute !== undefined ) {
|
|
|
|
|
|
- }
|
|
|
+ for ( i = 0, l = attribute.count; i < l; i ++ ) {
|
|
|
|
|
|
- } else if ( geometry.isBufferGeometry ) {
|
|
|
+ v1.fromBufferAttribute( attribute, i ).applyMatrix4( node.matrixWorld );
|
|
|
|
|
|
- var attribute = geometry.attributes.position;
|
|
|
+ scope.expandByPoint( v1 );
|
|
|
|
|
|
- if ( attribute !== undefined ) {
|
|
|
+ }
|
|
|
|
|
|
- for ( i = 0, l = attribute.count; i < l; i ++ ) {
|
|
|
+ }
|
|
|
|
|
|
- v1.fromBufferAttribute( attribute, i ).applyMatrix4( node.matrixWorld );
|
|
|
+ }
|
|
|
|
|
|
- scope.expandByPoint( v1 );
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ return function expandByObject( object ) {
|
|
|
|
|
|
- }
|
|
|
+ scope = this;
|
|
|
|
|
|
- }
|
|
|
+ object.updateMatrixWorld( true );
|
|
|
|
|
|
- } );
|
|
|
+ object.traverse( traverse );
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -10352,6 +10354,26 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
|
|
|
|
|
|
}(),
|
|
|
|
|
|
+ rotateOnWorldAxis: function () {
|
|
|
+
|
|
|
+ // rotate object on axis in world space
|
|
|
+ // axis is assumed to be normalized
|
|
|
+ // method assumes no rotated parent
|
|
|
+
|
|
|
+ var q1 = new Quaternion();
|
|
|
+
|
|
|
+ return function rotateOnWorldAxis( axis, angle ) {
|
|
|
+
|
|
|
+ q1.setFromAxisAngle( axis, angle );
|
|
|
+
|
|
|
+ this.quaternion.premultiply( q1 );
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ }(),
|
|
|
+
|
|
|
rotateX: function () {
|
|
|
|
|
|
var v1 = new Vector3( 1, 0, 0 );
|
|
@@ -20546,7 +20568,7 @@ function WebVRManager( renderer ) {
|
|
|
var device = null;
|
|
|
var frameData = null;
|
|
|
|
|
|
- if ( 'VRFrameData' in window ) {
|
|
|
+ if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
|
|
|
|
|
|
frameData = new window.VRFrameData();
|
|
|
|
|
@@ -20594,7 +20616,11 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- window.addEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange, false );
|
|
|
+ if ( typeof window !== 'undefined' ) {
|
|
|
+
|
|
|
+ window.addEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange, false );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
//
|
|
|
|
|
@@ -26039,6 +26065,7 @@ function TubeBufferGeometry( path, tubularSegments, radius, radialSegments, clos
|
|
|
var vertex = new Vector3();
|
|
|
var normal = new Vector3();
|
|
|
var uv = new Vector2();
|
|
|
+ var P = new Vector3();
|
|
|
|
|
|
var i, j;
|
|
|
|
|
@@ -26092,7 +26119,7 @@ function TubeBufferGeometry( path, tubularSegments, radius, radialSegments, clos
|
|
|
|
|
|
// we use getPointAt to sample evenly distributed points from the given path
|
|
|
|
|
|
- var P = path.getPointAt( i / tubularSegments );
|
|
|
+ P = path.getPointAt( i / tubularSegments, P );
|
|
|
|
|
|
// retrieve corresponding normal and binormal
|
|
|
|
|
@@ -34399,9 +34426,13 @@ Object.assign( ObjectLoader.prototype, {
|
|
|
break;
|
|
|
|
|
|
case 'DodecahedronGeometry':
|
|
|
+ case 'DodecahedronBufferGeometry':
|
|
|
case 'IcosahedronGeometry':
|
|
|
+ case 'IcosahedronBufferGeometry':
|
|
|
case 'OctahedronGeometry':
|
|
|
+ case 'OctahedronBufferGeometry':
|
|
|
case 'TetrahedronGeometry':
|
|
|
+ case 'TetrahedronBufferGeometry':
|
|
|
|
|
|
geometry = new Geometries[ data.type ](
|
|
|
data.radius,
|
|
@@ -34463,6 +34494,18 @@ Object.assign( ObjectLoader.prototype, {
|
|
|
|
|
|
break;
|
|
|
|
|
|
+ case 'PolyhedronGeometry':
|
|
|
+ case 'PolyhedronBufferGeometry':
|
|
|
+
|
|
|
+ geometry = new Geometries[ data.type ](
|
|
|
+ data.vertices,
|
|
|
+ data.indices,
|
|
|
+ data.radius,
|
|
|
+ data.details
|
|
|
+ );
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
case 'BufferGeometry':
|
|
|
|
|
|
geometry = bufferGeometryLoader.parse( data );
|
|
@@ -35061,8 +35104,8 @@ function CubicBezier( t, p0, p1, p2, p3 ) {
|
|
|
* Extensible curve object
|
|
|
*
|
|
|
* Some common of curve methods:
|
|
|
- * .getPoint(t), getTangent(t)
|
|
|
- * .getPointAt(u), getTangentAt(u)
|
|
|
+ * .getPoint( t, optionalTarget ), .getTangent( t )
|
|
|
+ * .getPointAt( u, optionalTarget ), .getTangentAt( u )
|
|
|
* .getPoints(), .getSpacedPoints()
|
|
|
* .getLength()
|
|
|
* .updateArcLengths()
|
|
@@ -35102,7 +35145,7 @@ Object.assign( Curve.prototype, {
|
|
|
// Virtual base class method to overwrite and implement in subclasses
|
|
|
// - t [0 .. 1]
|
|
|
|
|
|
- getPoint: function () {
|
|
|
+ getPoint: function ( /* t, optionalTarget */ ) {
|
|
|
|
|
|
console.warn( 'THREE.Curve: .getPoint() not implemented.' );
|
|
|
return null;
|
|
@@ -35112,10 +35155,10 @@ Object.assign( Curve.prototype, {
|
|
|
// Get point at relative position in curve according to arc length
|
|
|
// - u [0 .. 1]
|
|
|
|
|
|
- getPointAt: function ( u ) {
|
|
|
+ getPointAt: function ( u, optionalTarget ) {
|
|
|
|
|
|
var t = this.getUtoTmapping( u );
|
|
|
- return this.getPoint( t );
|
|
|
+ return this.getPoint( t, optionalTarget );
|
|
|
|
|
|
},
|
|
|
|
|
@@ -35448,16 +35491,20 @@ LineCurve.prototype.constructor = LineCurve;
|
|
|
|
|
|
LineCurve.prototype.isLineCurve = true;
|
|
|
|
|
|
-LineCurve.prototype.getPoint = function ( t ) {
|
|
|
+LineCurve.prototype.getPoint = function ( t, optionalTarget ) {
|
|
|
+
|
|
|
+ var point = optionalTarget || new Vector2();
|
|
|
|
|
|
if ( t === 1 ) {
|
|
|
|
|
|
- return this.v2.clone();
|
|
|
+ point.copy( this.v2 );
|
|
|
|
|
|
- }
|
|
|
+ } else {
|
|
|
+
|
|
|
+ point.copy( this.v2 ).sub( this.v1 );
|
|
|
+ point.multiplyScalar( t ).add( this.v1 );
|
|
|
|
|
|
- var point = this.v2.clone().sub( this.v1 );
|
|
|
- point.multiplyScalar( t ).add( this.v1 );
|
|
|
+ }
|
|
|
|
|
|
return point;
|
|
|
|
|
@@ -35465,9 +35512,9 @@ LineCurve.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
// Line curve is linear, so we can overwrite default getPointAt
|
|
|
|
|
|
-LineCurve.prototype.getPointAt = function ( u ) {
|
|
|
+LineCurve.prototype.getPointAt = function ( u, optionalTarget ) {
|
|
|
|
|
|
- return this.getPoint( u );
|
|
|
+ return this.getPoint( u, optionalTarget );
|
|
|
|
|
|
};
|
|
|
|
|
@@ -35739,7 +35786,9 @@ EllipseCurve.prototype.constructor = EllipseCurve;
|
|
|
|
|
|
EllipseCurve.prototype.isEllipseCurve = true;
|
|
|
|
|
|
-EllipseCurve.prototype.getPoint = function ( t ) {
|
|
|
+EllipseCurve.prototype.getPoint = function ( t, optionalTarget ) {
|
|
|
+
|
|
|
+ var point = optionalTarget || new Vector2();
|
|
|
|
|
|
var twoPi = Math.PI * 2;
|
|
|
var deltaAngle = this.aEndAngle - this.aStartAngle;
|
|
@@ -35795,7 +35844,7 @@ EllipseCurve.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- return new Vector2( x, y );
|
|
|
+ return point.set( x, y );
|
|
|
|
|
|
};
|
|
|
|
|
@@ -35812,24 +35861,28 @@ SplineCurve.prototype.constructor = SplineCurve;
|
|
|
|
|
|
SplineCurve.prototype.isSplineCurve = true;
|
|
|
|
|
|
-SplineCurve.prototype.getPoint = function ( t ) {
|
|
|
+SplineCurve.prototype.getPoint = function ( t, optionalTarget ) {
|
|
|
+
|
|
|
+ var point = optionalTarget || new Vector2();
|
|
|
|
|
|
var points = this.points;
|
|
|
- var point = ( points.length - 1 ) * t;
|
|
|
+ var p = ( points.length - 1 ) * t;
|
|
|
|
|
|
- var intPoint = Math.floor( point );
|
|
|
- var weight = point - intPoint;
|
|
|
+ var intPoint = Math.floor( p );
|
|
|
+ var weight = p - intPoint;
|
|
|
|
|
|
- var point0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];
|
|
|
- var point1 = points[ intPoint ];
|
|
|
- var point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];
|
|
|
- var point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];
|
|
|
+ var p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];
|
|
|
+ var p1 = points[ intPoint ];
|
|
|
+ var p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];
|
|
|
+ var p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];
|
|
|
|
|
|
- return new Vector2(
|
|
|
- CatmullRom( weight, point0.x, point1.x, point2.x, point3.x ),
|
|
|
- CatmullRom( weight, point0.y, point1.y, point2.y, point3.y )
|
|
|
+ point.set(
|
|
|
+ CatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),
|
|
|
+ CatmullRom( weight, p0.y, p1.y, p2.y, p3.y )
|
|
|
);
|
|
|
|
|
|
+ return point;
|
|
|
+
|
|
|
};
|
|
|
|
|
|
function CubicBezierCurve( v0, v1, v2, v3 ) {
|
|
@@ -35846,15 +35899,21 @@ function CubicBezierCurve( v0, v1, v2, v3 ) {
|
|
|
CubicBezierCurve.prototype = Object.create( Curve.prototype );
|
|
|
CubicBezierCurve.prototype.constructor = CubicBezierCurve;
|
|
|
|
|
|
-CubicBezierCurve.prototype.getPoint = function ( t ) {
|
|
|
+CubicBezierCurve.prototype.isCubicBezierCurve = true;
|
|
|
+
|
|
|
+CubicBezierCurve.prototype.getPoint = function ( t, optionalTarget ) {
|
|
|
+
|
|
|
+ var point = optionalTarget || new Vector2();
|
|
|
|
|
|
var v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;
|
|
|
|
|
|
- return new Vector2(
|
|
|
+ point.set(
|
|
|
CubicBezier( t, v0.x, v1.x, v2.x, v3.x ),
|
|
|
CubicBezier( t, v0.y, v1.y, v2.y, v3.y )
|
|
|
);
|
|
|
|
|
|
+ return point;
|
|
|
+
|
|
|
};
|
|
|
|
|
|
function QuadraticBezierCurve( v0, v1, v2 ) {
|
|
@@ -35870,15 +35929,21 @@ function QuadraticBezierCurve( v0, v1, v2 ) {
|
|
|
QuadraticBezierCurve.prototype = Object.create( Curve.prototype );
|
|
|
QuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve;
|
|
|
|
|
|
-QuadraticBezierCurve.prototype.getPoint = function ( t ) {
|
|
|
+QuadraticBezierCurve.prototype.isQuadraticBezierCurve = true;
|
|
|
+
|
|
|
+QuadraticBezierCurve.prototype.getPoint = function ( t, optionalTarget ) {
|
|
|
+
|
|
|
+ var point = optionalTarget || new Vector2();
|
|
|
|
|
|
var v0 = this.v0, v1 = this.v1, v2 = this.v2;
|
|
|
|
|
|
- return new Vector2(
|
|
|
+ point.set(
|
|
|
QuadraticBezier( t, v0.x, v1.x, v2.x ),
|
|
|
QuadraticBezier( t, v0.y, v1.y, v2.y )
|
|
|
);
|
|
|
|
|
|
+ return point;
|
|
|
+
|
|
|
};
|
|
|
|
|
|
var PathPrototype = Object.assign( Object.create( CurvePath.prototype ), {
|
|
@@ -42410,14 +42475,18 @@ function CatmullRomCurve3( points ) {
|
|
|
CatmullRomCurve3.prototype = Object.create( Curve.prototype );
|
|
|
CatmullRomCurve3.prototype.constructor = CatmullRomCurve3;
|
|
|
|
|
|
-CatmullRomCurve3.prototype.getPoint = function ( t ) {
|
|
|
+CatmullRomCurve3.prototype.isCatmullRomCurve3 = true;
|
|
|
+
|
|
|
+CatmullRomCurve3.prototype.getPoint = function ( t, optionalTarget ) {
|
|
|
+
|
|
|
+ var point = optionalTarget || new Vector3();
|
|
|
|
|
|
var points = this.points;
|
|
|
var l = points.length;
|
|
|
|
|
|
- var point = ( l - ( this.closed ? 0 : 1 ) ) * t;
|
|
|
- var intPoint = Math.floor( point );
|
|
|
- var weight = point - intPoint;
|
|
|
+ var p = ( l - ( this.closed ? 0 : 1 ) ) * t;
|
|
|
+ var intPoint = Math.floor( p );
|
|
|
+ var weight = p - intPoint;
|
|
|
|
|
|
if ( this.closed ) {
|
|
|
|
|
@@ -42485,7 +42554,13 @@ CatmullRomCurve3.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- return new Vector3( px.calc( weight ), py.calc( weight ), pz.calc( weight ) );
|
|
|
+ point.set(
|
|
|
+ px.calc( weight ),
|
|
|
+ py.calc( weight ),
|
|
|
+ pz.calc( weight )
|
|
|
+ );
|
|
|
+
|
|
|
+ return point;
|
|
|
|
|
|
};
|
|
|
|
|
@@ -42503,16 +42578,22 @@ function CubicBezierCurve3( v0, v1, v2, v3 ) {
|
|
|
CubicBezierCurve3.prototype = Object.create( Curve.prototype );
|
|
|
CubicBezierCurve3.prototype.constructor = CubicBezierCurve3;
|
|
|
|
|
|
-CubicBezierCurve3.prototype.getPoint = function ( t ) {
|
|
|
+CubicBezierCurve3.prototype.isCubicBezierCurve3 = true;
|
|
|
+
|
|
|
+CubicBezierCurve3.prototype.getPoint = function ( t, optionalTarget ) {
|
|
|
+
|
|
|
+ var point = optionalTarget || new Vector3();
|
|
|
|
|
|
var v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;
|
|
|
|
|
|
- return new Vector3(
|
|
|
+ point.set(
|
|
|
CubicBezier( t, v0.x, v1.x, v2.x, v3.x ),
|
|
|
CubicBezier( t, v0.y, v1.y, v2.y, v3.y ),
|
|
|
CubicBezier( t, v0.z, v1.z, v2.z, v3.z )
|
|
|
);
|
|
|
|
|
|
+ return point;
|
|
|
+
|
|
|
};
|
|
|
|
|
|
function QuadraticBezierCurve3( v0, v1, v2 ) {
|
|
@@ -42528,16 +42609,22 @@ function QuadraticBezierCurve3( v0, v1, v2 ) {
|
|
|
QuadraticBezierCurve3.prototype = Object.create( Curve.prototype );
|
|
|
QuadraticBezierCurve3.prototype.constructor = QuadraticBezierCurve3;
|
|
|
|
|
|
-QuadraticBezierCurve3.prototype.getPoint = function ( t ) {
|
|
|
+QuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true;
|
|
|
+
|
|
|
+QuadraticBezierCurve3.prototype.getPoint = function ( t, optionalTarget ) {
|
|
|
+
|
|
|
+ var point = optionalTarget || new Vector3();
|
|
|
|
|
|
var v0 = this.v0, v1 = this.v1, v2 = this.v2;
|
|
|
|
|
|
- return new Vector3(
|
|
|
+ point.set(
|
|
|
QuadraticBezier( t, v0.x, v1.x, v2.x ),
|
|
|
QuadraticBezier( t, v0.y, v1.y, v2.y ),
|
|
|
QuadraticBezier( t, v0.z, v1.z, v2.z )
|
|
|
);
|
|
|
|
|
|
+ return point;
|
|
|
+
|
|
|
};
|
|
|
|
|
|
function LineCurve3( v1, v2 ) {
|
|
@@ -42552,21 +42639,32 @@ function LineCurve3( v1, v2 ) {
|
|
|
LineCurve3.prototype = Object.create( Curve.prototype );
|
|
|
LineCurve3.prototype.constructor = LineCurve3;
|
|
|
|
|
|
-LineCurve3.prototype.getPoint = function ( t ) {
|
|
|
+LineCurve3.prototype.isLineCurve3 = true;
|
|
|
+
|
|
|
+LineCurve3.prototype.getPoint = function ( t, optionalTarget ) {
|
|
|
+
|
|
|
+ var point = optionalTarget || new Vector3();
|
|
|
|
|
|
if ( t === 1 ) {
|
|
|
|
|
|
- return this.v2.clone();
|
|
|
+ point.copy( this.v2 );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ point.copy( this.v2 ).sub( this.v1 );
|
|
|
+ point.multiplyScalar( t ).add( this.v1 );
|
|
|
|
|
|
}
|
|
|
|
|
|
- var vector = new Vector3();
|
|
|
+ return point;
|
|
|
|
|
|
- vector.subVectors( this.v2, this.v1 ); // diff
|
|
|
- vector.multiplyScalar( t );
|
|
|
- vector.add( this.v1 );
|
|
|
+};
|
|
|
+
|
|
|
+// Line curve is linear, so we can overwrite default getPointAt
|
|
|
|
|
|
- return vector;
|
|
|
+LineCurve3.prototype.getPointAt = function ( u, optionalTarget ) {
|
|
|
+
|
|
|
+ return this.getPoint( u, optionalTarget );
|
|
|
|
|
|
};
|
|
|
|
|
@@ -42579,6 +42677,8 @@ function ArcCurve( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {
|
|
|
ArcCurve.prototype = Object.create( EllipseCurve.prototype );
|
|
|
ArcCurve.prototype.constructor = ArcCurve;
|
|
|
|
|
|
+ArcCurve.prototype.isArcCurve = true;
|
|
|
+
|
|
|
/**
|
|
|
* @author alteredq / http://alteredqualia.com/
|
|
|
*/
|