2
0
Эх сурвалжийг харах

Merge branch 'dev' into UpdateGLTFLoader

Takahiro 7 жил өмнө
parent
commit
7570857033

+ 208 - 38
build/three.js

@@ -22167,7 +22167,19 @@
 		function start() {
 
 			if ( isAnimating ) return;
-			( vr.getDevice() || window ).requestAnimationFrame( loop );
+
+			var device = vr.getDevice();
+			
+			if ( device && device.isPresenting ) {
+
+				device.requestAnimationFrame( loop );
+
+			} else {
+
+				window.requestAnimationFrame( loop );
+
+			}
+
 			isAnimating = true;
 
 		}
@@ -22175,7 +22187,18 @@
 		function loop( time ) {
 
 			if ( onAnimationFrame !== null ) onAnimationFrame( time );
-			( vr.getDevice() || window ).requestAnimationFrame( loop );
+
+			var device = vr.getDevice();
+			
+			if ( device && device.isPresenting ) {
+
+				device.requestAnimationFrame( loop );
+
+			} else {
+
+				window.requestAnimationFrame( loop );
+
+			}
 
 		}
 
@@ -28942,7 +28965,7 @@
 
 		openEnded = openEnded !== undefined ? openEnded : false;
 		thetaStart = thetaStart !== undefined ? thetaStart : 0.0;
-		thetaLength = thetaLength !== undefined ? thetaLength : 2.0 * Math.PI;
+		thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
 
 		// buffers
 
@@ -30508,6 +30531,8 @@
 
 					var callbacks = loading[ url ];
 
+					delete loading[ url ];
+
 					for ( var i = 0, il = callbacks.length; i < il; i ++ ) {
 
 						var callback = callbacks[ i ];
@@ -35603,6 +35628,20 @@
 				binormals: binormals
 			};
 
+		},
+
+		clone: function () {
+
+			return new this.constructor().copy( this );
+
+		},
+
+		copy: function ( source ) {
+
+			this.arcLengthDivisions = source.arcLengthDivisions;
+
+			return this;
+
 		}
 
 	} );
@@ -35613,8 +35652,8 @@
 
 		this.type = 'LineCurve';
 
-		this.v1 = v1;
-		this.v2 = v2;
+		this.v1 = v1 || new Vector2();
+		this.v2 = v2 || new Vector2();
 
 	}
 
@@ -35658,6 +35697,17 @@
 
 	};
 
+	LineCurve.prototype.copy = function ( source ) {
+
+		Curve.prototype.copy.call( this, source );
+
+		this.v1.copy( source.v1 );
+		this.v2.copy( source.v2 );
+
+		return this;
+
+	};
+
 	/**
 	 * @author zz85 / http://www.lab4games.net/zz85/blog
 	 *
@@ -35864,16 +35914,16 @@
 
 		this.type = 'EllipseCurve';
 
-		this.aX = aX;
-		this.aY = aY;
+		this.aX = aX || 0;
+		this.aY = aY || 0;
 
-		this.xRadius = xRadius;
-		this.yRadius = yRadius;
+		this.xRadius = xRadius || 1;
+		this.yRadius = yRadius || 1;
 
-		this.aStartAngle = aStartAngle;
-		this.aEndAngle = aEndAngle;
+		this.aStartAngle = aStartAngle || 0;
+		this.aEndAngle = aEndAngle || 2 * Math.PI;
 
-		this.aClockwise = aClockwise;
+		this.aClockwise = aClockwise || false;
 
 		this.aRotation = aRotation || 0;
 
@@ -35946,13 +35996,34 @@
 
 	};
 
+	EllipseCurve.prototype.copy = function ( source ) {
+
+		Curve.prototype.copy.call( this, source );
+
+		this.aX = source.aX;
+		this.aY = source.aY;
+
+		this.xRadius = source.xRadius;
+		this.yRadius = source.yRadius;
+
+		this.aStartAngle = source.aStartAngle;
+		this.aEndAngle = source.aEndAngle;
+
+		this.aClockwise = source.aClockwise;
+
+		this.aRotation = source.aRotation;
+
+		return this;
+
+	};
+
 	function SplineCurve( points /* array of Vector2 */ ) {
 
 		Curve.call( this );
 
 		this.type = 'SplineCurve';
 
-		this.points = ( points === undefined ) ? [] : points;
+		this.points = points || [];
 
 	}
 
@@ -35985,16 +36056,34 @@
 
 	};
 
+	SplineCurve.prototype.copy = function ( source ) {
+
+		Curve.prototype.copy.call( this, source );
+
+		this.points = [];
+
+		for ( var i = 0, l = source.points.length; i < l; i ++ ) {
+
+			var point = source.points[ i ];
+
+			this.points.push( point.clone() );
+
+		}
+
+		return this;
+
+	};
+
 	function CubicBezierCurve( v0, v1, v2, v3 ) {
 
 		Curve.call( this );
 
 		this.type = 'CubicBezierCurve';
 
-		this.v0 = v0;
-		this.v1 = v1;
-		this.v2 = v2;
-		this.v3 = v3;
+		this.v0 = v0 || new Vector2();
+		this.v1 = v1 || new Vector2();
+		this.v2 = v2 || new Vector2();
+		this.v3 = v3 || new Vector2();
 
 	}
 
@@ -36018,15 +36107,28 @@
 
 	};
 
+	CubicBezierCurve.prototype.copy = function ( source ) {
+
+		Curve.prototype.copy.call( this, source );
+
+		this.v0.copy( source.v0 );
+		this.v1.copy( source.v1 );
+		this.v2.copy( source.v2 );
+		this.v3.copy( source.v3 );
+
+		return this;
+
+	};
+
 	function QuadraticBezierCurve( v0, v1, v2 ) {
 
 		Curve.call( this );
 
 		this.type = 'QuadraticBezierCurve';
 
-		this.v0 = v0;
-		this.v1 = v1;
-		this.v2 = v2;
+		this.v0 = v0 || new Vector2();
+		this.v1 = v1 || new Vector2();
+		this.v2 = v2 || new Vector2();
 
 	}
 
@@ -36050,6 +36152,18 @@
 
 	};
 
+	QuadraticBezierCurve.prototype.copy = function ( source ) {
+
+		Curve.prototype.copy.call( this, source );
+
+		this.v0.copy( source.v0 );
+		this.v1.copy( source.v1 );
+		this.v2.copy( source.v2 );
+
+		return this;
+
+	};
+
 	var PathPrototype = Object.assign( Object.create( CurvePath.prototype ), {
 
 		fromPoints: function ( vectors ) {
@@ -42574,17 +42688,16 @@
 	var py = new CubicPoly();
 	var pz = new CubicPoly();
 
-	function CatmullRomCurve3( points ) {
+	function CatmullRomCurve3( points, closed, curveType, tension ) {
 
 		Curve.call( this );
 
 		this.type = 'CatmullRomCurve3';
 
-		if ( points.length < 2 ) console.warn( 'THREE.CatmullRomCurve3: Points array needs at least two entries.' );
-
 		this.points = points || [];
-		this.closed = false;
-		this.curveType = 'centripetal';
+		this.closed = closed || false;
+		this.curveType = curveType || 'centripetal';
+		this.tension = tension || 0.5;
 
 	}
 
@@ -42663,10 +42776,9 @@
 
 		} else if ( this.curveType === 'catmullrom' ) {
 
-			var tension = this.tension !== undefined ? this.tension : 0.5;
-			px.initCatmullRom( p0.x, p1.x, p2.x, p3.x, tension );
-			py.initCatmullRom( p0.y, p1.y, p2.y, p3.y, tension );
-			pz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, tension );
+			px.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );
+			py.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );
+			pz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );
 
 		}
 
@@ -42680,16 +42792,38 @@
 
 	};
 
+	CatmullRomCurve3.prototype.copy = function ( source ) {
+
+		Curve.prototype.copy.call( this, source );
+
+		this.points = [];
+
+		for ( var i = 0, l = source.points.length; i < l; i ++ ) {
+
+			var point = source.points[ i ];
+
+			this.points.push( point.clone() );
+
+		}
+
+		this.closed = source.closed;
+		this.curveType = source.curveType;
+		this.tension = source.tension;
+
+		return this;
+
+	};
+
 	function CubicBezierCurve3( v0, v1, v2, v3 ) {
 
 		Curve.call( this );
 
 		this.type = 'CubicBezierCurve3';
 
-		this.v0 = v0;
-		this.v1 = v1;
-		this.v2 = v2;
-		this.v3 = v3;
+		this.v0 = v0 || new Vector3();
+		this.v1 = v1 || new Vector3();
+		this.v2 = v2 || new Vector3();
+		this.v3 = v3 || new Vector3();
 
 	}
 
@@ -42714,15 +42848,28 @@
 
 	};
 
+	CubicBezierCurve3.prototype.copy = function ( source ) {
+
+		Curve.prototype.copy.call( this, source );
+
+		this.v0.copy( source.v0 );
+		this.v1.copy( source.v1 );
+		this.v2.copy( source.v2 );
+		this.v3.copy( source.v3 );
+
+		return this;
+
+	};
+
 	function QuadraticBezierCurve3( v0, v1, v2 ) {
 
 		Curve.call( this );
 
 		this.type = 'QuadraticBezierCurve3';
 
-		this.v0 = v0;
-		this.v1 = v1;
-		this.v2 = v2;
+		this.v0 = v0 || new Vector3();
+		this.v1 = v1 || new Vector3();
+		this.v2 = v2 || new Vector3();
 
 	}
 
@@ -42747,14 +42894,26 @@
 
 	};
 
+	QuadraticBezierCurve3.prototype.copy = function ( source ) {
+
+		Curve.prototype.copy.call( this, source );
+
+		this.v0.copy( source.v0 );
+		this.v1.copy( source.v1 );
+		this.v2.copy( source.v2 );
+
+		return this;
+
+	};
+
 	function LineCurve3( v1, v2 ) {
 
 		Curve.call( this );
 
 		this.type = 'LineCurve3';
 
-		this.v1 = v1;
-		this.v2 = v2;
+		this.v1 = v1 || new Vector3();
+		this.v2 = v2 || new Vector3();
 
 	}
 
@@ -42790,6 +42949,17 @@
 
 	};
 
+	LineCurve3.prototype.copy = function ( source ) {
+
+		Curve.prototype.copy.call( this, source );
+
+		this.v1.copy( source.v1 );
+		this.v2.copy( source.v2 );
+
+		return this;
+
+	};
+
 	function ArcCurve( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {
 
 		EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 341 - 340
build/three.min.js


+ 208 - 38
build/three.module.js

@@ -22161,7 +22161,19 @@ function WebGLRenderer( parameters ) {
 	function start() {
 
 		if ( isAnimating ) return;
-		( vr.getDevice() || window ).requestAnimationFrame( loop );
+
+		var device = vr.getDevice();
+		
+		if ( device && device.isPresenting ) {
+
+			device.requestAnimationFrame( loop );
+
+		} else {
+
+			window.requestAnimationFrame( loop );
+
+		}
+
 		isAnimating = true;
 
 	}
@@ -22169,7 +22181,18 @@ function WebGLRenderer( parameters ) {
 	function loop( time ) {
 
 		if ( onAnimationFrame !== null ) onAnimationFrame( time );
-		( vr.getDevice() || window ).requestAnimationFrame( loop );
+
+		var device = vr.getDevice();
+		
+		if ( device && device.isPresenting ) {
+
+			device.requestAnimationFrame( loop );
+
+		} else {
+
+			window.requestAnimationFrame( loop );
+
+		}
 
 	}
 
@@ -28936,7 +28959,7 @@ function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments
 
 	openEnded = openEnded !== undefined ? openEnded : false;
 	thetaStart = thetaStart !== undefined ? thetaStart : 0.0;
-	thetaLength = thetaLength !== undefined ? thetaLength : 2.0 * Math.PI;
+	thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
 
 	// buffers
 
@@ -30502,6 +30525,8 @@ Object.assign( FileLoader.prototype, {
 
 				var callbacks = loading[ url ];
 
+				delete loading[ url ];
+
 				for ( var i = 0, il = callbacks.length; i < il; i ++ ) {
 
 					var callback = callbacks[ i ];
@@ -35597,6 +35622,20 @@ Object.assign( Curve.prototype, {
 			binormals: binormals
 		};
 
+	},
+
+	clone: function () {
+
+		return new this.constructor().copy( this );
+
+	},
+
+	copy: function ( source ) {
+
+		this.arcLengthDivisions = source.arcLengthDivisions;
+
+		return this;
+
 	}
 
 } );
@@ -35607,8 +35646,8 @@ function LineCurve( v1, v2 ) {
 
 	this.type = 'LineCurve';
 
-	this.v1 = v1;
-	this.v2 = v2;
+	this.v1 = v1 || new Vector2();
+	this.v2 = v2 || new Vector2();
 
 }
 
@@ -35652,6 +35691,17 @@ LineCurve.prototype.getTangent = function ( /* t */ ) {
 
 };
 
+LineCurve.prototype.copy = function ( source ) {
+
+	Curve.prototype.copy.call( this, source );
+
+	this.v1.copy( source.v1 );
+	this.v2.copy( source.v2 );
+
+	return this;
+
+};
+
 /**
  * @author zz85 / http://www.lab4games.net/zz85/blog
  *
@@ -35858,16 +35908,16 @@ function EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockw
 
 	this.type = 'EllipseCurve';
 
-	this.aX = aX;
-	this.aY = aY;
+	this.aX = aX || 0;
+	this.aY = aY || 0;
 
-	this.xRadius = xRadius;
-	this.yRadius = yRadius;
+	this.xRadius = xRadius || 1;
+	this.yRadius = yRadius || 1;
 
-	this.aStartAngle = aStartAngle;
-	this.aEndAngle = aEndAngle;
+	this.aStartAngle = aStartAngle || 0;
+	this.aEndAngle = aEndAngle || 2 * Math.PI;
 
-	this.aClockwise = aClockwise;
+	this.aClockwise = aClockwise || false;
 
 	this.aRotation = aRotation || 0;
 
@@ -35940,13 +35990,34 @@ EllipseCurve.prototype.getPoint = function ( t, optionalTarget ) {
 
 };
 
+EllipseCurve.prototype.copy = function ( source ) {
+
+	Curve.prototype.copy.call( this, source );
+
+	this.aX = source.aX;
+	this.aY = source.aY;
+
+	this.xRadius = source.xRadius;
+	this.yRadius = source.yRadius;
+
+	this.aStartAngle = source.aStartAngle;
+	this.aEndAngle = source.aEndAngle;
+
+	this.aClockwise = source.aClockwise;
+
+	this.aRotation = source.aRotation;
+
+	return this;
+
+};
+
 function SplineCurve( points /* array of Vector2 */ ) {
 
 	Curve.call( this );
 
 	this.type = 'SplineCurve';
 
-	this.points = ( points === undefined ) ? [] : points;
+	this.points = points || [];
 
 }
 
@@ -35979,16 +36050,34 @@ SplineCurve.prototype.getPoint = function ( t, optionalTarget ) {
 
 };
 
+SplineCurve.prototype.copy = function ( source ) {
+
+	Curve.prototype.copy.call( this, source );
+
+	this.points = [];
+
+	for ( var i = 0, l = source.points.length; i < l; i ++ ) {
+
+		var point = source.points[ i ];
+
+		this.points.push( point.clone() );
+
+	}
+
+	return this;
+
+};
+
 function CubicBezierCurve( v0, v1, v2, v3 ) {
 
 	Curve.call( this );
 
 	this.type = 'CubicBezierCurve';
 
-	this.v0 = v0;
-	this.v1 = v1;
-	this.v2 = v2;
-	this.v3 = v3;
+	this.v0 = v0 || new Vector2();
+	this.v1 = v1 || new Vector2();
+	this.v2 = v2 || new Vector2();
+	this.v3 = v3 || new Vector2();
 
 }
 
@@ -36012,15 +36101,28 @@ CubicBezierCurve.prototype.getPoint = function ( t, optionalTarget ) {
 
 };
 
+CubicBezierCurve.prototype.copy = function ( source ) {
+
+	Curve.prototype.copy.call( this, source );
+
+	this.v0.copy( source.v0 );
+	this.v1.copy( source.v1 );
+	this.v2.copy( source.v2 );
+	this.v3.copy( source.v3 );
+
+	return this;
+
+};
+
 function QuadraticBezierCurve( v0, v1, v2 ) {
 
 	Curve.call( this );
 
 	this.type = 'QuadraticBezierCurve';
 
-	this.v0 = v0;
-	this.v1 = v1;
-	this.v2 = v2;
+	this.v0 = v0 || new Vector2();
+	this.v1 = v1 || new Vector2();
+	this.v2 = v2 || new Vector2();
 
 }
 
@@ -36044,6 +36146,18 @@ QuadraticBezierCurve.prototype.getPoint = function ( t, optionalTarget ) {
 
 };
 
+QuadraticBezierCurve.prototype.copy = function ( source ) {
+
+	Curve.prototype.copy.call( this, source );
+
+	this.v0.copy( source.v0 );
+	this.v1.copy( source.v1 );
+	this.v2.copy( source.v2 );
+
+	return this;
+
+};
+
 var PathPrototype = Object.assign( Object.create( CurvePath.prototype ), {
 
 	fromPoints: function ( vectors ) {
@@ -42568,17 +42682,16 @@ var px = new CubicPoly();
 var py = new CubicPoly();
 var pz = new CubicPoly();
 
-function CatmullRomCurve3( points ) {
+function CatmullRomCurve3( points, closed, curveType, tension ) {
 
 	Curve.call( this );
 
 	this.type = 'CatmullRomCurve3';
 
-	if ( points.length < 2 ) console.warn( 'THREE.CatmullRomCurve3: Points array needs at least two entries.' );
-
 	this.points = points || [];
-	this.closed = false;
-	this.curveType = 'centripetal';
+	this.closed = closed || false;
+	this.curveType = curveType || 'centripetal';
+	this.tension = tension || 0.5;
 
 }
 
@@ -42657,10 +42770,9 @@ CatmullRomCurve3.prototype.getPoint = function ( t, optionalTarget ) {
 
 	} else if ( this.curveType === 'catmullrom' ) {
 
-		var tension = this.tension !== undefined ? this.tension : 0.5;
-		px.initCatmullRom( p0.x, p1.x, p2.x, p3.x, tension );
-		py.initCatmullRom( p0.y, p1.y, p2.y, p3.y, tension );
-		pz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, tension );
+		px.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );
+		py.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );
+		pz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );
 
 	}
 
@@ -42674,16 +42786,38 @@ CatmullRomCurve3.prototype.getPoint = function ( t, optionalTarget ) {
 
 };
 
+CatmullRomCurve3.prototype.copy = function ( source ) {
+
+	Curve.prototype.copy.call( this, source );
+
+	this.points = [];
+
+	for ( var i = 0, l = source.points.length; i < l; i ++ ) {
+
+		var point = source.points[ i ];
+
+		this.points.push( point.clone() );
+
+	}
+
+	this.closed = source.closed;
+	this.curveType = source.curveType;
+	this.tension = source.tension;
+
+	return this;
+
+};
+
 function CubicBezierCurve3( v0, v1, v2, v3 ) {
 
 	Curve.call( this );
 
 	this.type = 'CubicBezierCurve3';
 
-	this.v0 = v0;
-	this.v1 = v1;
-	this.v2 = v2;
-	this.v3 = v3;
+	this.v0 = v0 || new Vector3();
+	this.v1 = v1 || new Vector3();
+	this.v2 = v2 || new Vector3();
+	this.v3 = v3 || new Vector3();
 
 }
 
@@ -42708,15 +42842,28 @@ CubicBezierCurve3.prototype.getPoint = function ( t, optionalTarget ) {
 
 };
 
+CubicBezierCurve3.prototype.copy = function ( source ) {
+
+	Curve.prototype.copy.call( this, source );
+
+	this.v0.copy( source.v0 );
+	this.v1.copy( source.v1 );
+	this.v2.copy( source.v2 );
+	this.v3.copy( source.v3 );
+
+	return this;
+
+};
+
 function QuadraticBezierCurve3( v0, v1, v2 ) {
 
 	Curve.call( this );
 
 	this.type = 'QuadraticBezierCurve3';
 
-	this.v0 = v0;
-	this.v1 = v1;
-	this.v2 = v2;
+	this.v0 = v0 || new Vector3();
+	this.v1 = v1 || new Vector3();
+	this.v2 = v2 || new Vector3();
 
 }
 
@@ -42741,14 +42888,26 @@ QuadraticBezierCurve3.prototype.getPoint = function ( t, optionalTarget ) {
 
 };
 
+QuadraticBezierCurve3.prototype.copy = function ( source ) {
+
+	Curve.prototype.copy.call( this, source );
+
+	this.v0.copy( source.v0 );
+	this.v1.copy( source.v1 );
+	this.v2.copy( source.v2 );
+
+	return this;
+
+};
+
 function LineCurve3( v1, v2 ) {
 
 	Curve.call( this );
 
 	this.type = 'LineCurve3';
 
-	this.v1 = v1;
-	this.v2 = v2;
+	this.v1 = v1 || new Vector3();
+	this.v2 = v2 || new Vector3();
 
 }
 
@@ -42784,6 +42943,17 @@ LineCurve3.prototype.getPointAt = function ( u, optionalTarget ) {
 
 };
 
+LineCurve3.prototype.copy = function ( source ) {
+
+	Curve.prototype.copy.call( this, source );
+
+	this.v1.copy( source.v1 );
+	this.v2.copy( source.v2 );
+
+	return this;
+
+};
+
 function ArcCurve( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {
 
 	EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );

+ 11 - 6
docs/api/extras/core/Shape.html

@@ -47,7 +47,16 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]()</h3>
+		<h3>[name]( [page:Array points] )</h3>
+		<div>
+		points -- (optional) array of [page:Vector2 Vector2s].<br /><br />
+
+		Creates a Shape from the points. The first point defines the offset, then successive points
+		are added to the [page:CurvePath.curves curves] array as [page:LineCurve LineCurves].<br /><br />
+
+		If no points are specified, an empty shape is created and the [page:.currentPoint] is set to
+		the origin.
+		</div>
 
 
 		<h2>Properties</h2>
@@ -59,7 +68,7 @@
 		<h2>Methods</h2>
 		<div>See the base [page:Path] class for common methods.</div>
 
-		<h3>[method:Array extractAllPoints]( [page:Integer divisions] )</h3>
+		<h3>[method:Array extractPoints]( [page:Integer divisions] )</h3>
 		<div>
 		divisions -- The fineness of the result.<br /><br />
 
@@ -73,10 +82,6 @@
 		where shape and holes are arrays of [page:Vector2 Vector2s].
 		</div>
 
-		<h3>[method:Object extractPoints]( [page:Integer divisions] )</h3>
-		<div>This is identical to [page:.extractAllPoints].</div>
-
-
 		<h3>[method:Array getPointsHoles]( [page:Integer divisions] )</h3>
 		<div>
 		divisions -- The fineness of the result.<br /><br />

+ 5 - 4
docs/examples/loaders/GLTFLoader.html

@@ -120,14 +120,15 @@
 		[page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
 		</div>
 
-		<h3>[method:null parse]( [page:Object json], [page:Function callBack], [page:String path] )</h3>
+		<h3>[method:null parse]( [page:ArrayBuffer data], [page:String path], [page:Function onLoad], [page:Function onError] )</h3>
 		<div>
-		[page:Object json] — <em>JSON</em> object to parse.<br />
-		[page:Function callBack] — Will be called when parse completes.<br />
+		[page:ArrayBuffer data] — glTF asset to parse, as an ArrayBuffer or <em>JSON</em> string.<br />
 		[page:String path] — The base path from which to find subsequent glTF resources such as textures and .bin data files.<br />
+		[page:Function onLoad] — A function to be called when parse completes.<br />
+		[page:Function onError] — (optional) A function to be called if an error occurs during parsing. The function receives error as an argument.<br />
 		</div>
 		<div>
-		Parse a glTF-based <em>JSON</em> structure and fire [page:Function callback] when complete. The argument to [page:Function callback] will be an [page:object] that contains loaded parts: .[page:Scene scene], .[page:Array scenes], .[page:Array cameras], and .[page:Array animations].
+		Parse a glTF-based ArrayBuffer or <em>JSON</em> String and fire [page:Function onLoad] callback when complete. The argument to [page:Function onLoad] will be an [page:object] that contains loaded parts: .[page:Scene scene], .[page:Array scenes], .[page:Array cameras], and .[page:Array animations].
 		</div>
 
 		<h2>Source</h2>

+ 1 - 12
editor/js/libs/app.js

@@ -113,18 +113,7 @@ var APP = {
 
 			if ( renderer.vr.enabled ) {
 
-				WEBVR.checkAvailability().catch( function( message ) {
-
-					dom.appendChild( WEBVR.getMessageContainer( message ) );
-
-				} );
-
-				WEBVR.getVRDisplay( function ( device ) {
-
-					renderer.vr.setDevice( device );
-					dom.appendChild( WEBVR.getButton( device, renderer.domElement ) );
-
-				} );
+				dom.appendChild( WEBVR.createButton( renderer ) );
 
 			}
 

+ 1 - 21
editor/js/libs/tern-threejs/threejs.js

@@ -960,7 +960,7 @@
           "!type": "array",
           "!doc": "The possible actions that define the path."
         },
-        "fromPoints": {
+        "setFromPoints": {
           "!type": "fn(vectors) -> todo",
           "!doc": "Adds to the Path from the points. The first vector defines the offset. After that the lines get defined."
         },
@@ -1012,34 +1012,14 @@
           "!type": "array",
           "!doc": "todo"
         },
-        "makeGeometry": {
-          "!type": "fn(options: todo) -> todo",
-          "!doc": "Convenience method to return ShapeGeometry"
-        },
-        "extractAllPoints": {
-          "!type": "fn(divisions: todo) -> todo",
-          "!doc": "Get points of shape and holes (keypoints based on segments parameter)"
-        },
-        "extrude": {
-          "!type": "fn(options: todo) -> todo",
-          "!doc": "Convenience method to return ExtrudeGeometry"
-        },
         "extractPoints": {
           "!type": "fn(divisions: todo) -> todo",
           "!doc": "todo"
         },
-        "extractAllSpacedPoints": {
-          "!type": "fn(divisions: todo) -> todo",
-          "!doc": "todo"
-        },
         "getPointsHoles": {
           "!type": "fn(divisions: todo) -> todo",
           "!doc": "Get points of holes"
         },
-        "getSpacedPointsHoles": {
-          "!type": "fn(divisions: todo) -> todo",
-          "!doc": "Get points of holes (spaced by regular distance)"
-        }
       },
       "!doc": "Defines a 2d shape plane using paths.",
       "!type": "fn()"

+ 1 - 1
examples/js/loaders/FBXLoader.js

@@ -1915,7 +1915,7 @@
 
 				var rawMatWrd = new THREE.Matrix4().fromArray( node.subNodes.Matrix.properties.a );
 
-				worldMatrices.set( parseInt( node.id ), rawMatWrd );
+				worldMatrices.set( parseInt( node.properties.Node ), rawMatWrd );
 
 			}
 

+ 1 - 1
examples/js/loaders/GLTFLoader.js

@@ -1431,7 +1431,7 @@ THREE.GLTFLoader = ( function () {
 
 		if ( bufferDef.type && bufferDef.type !== 'arraybuffer' ) {
 
-			throw new Error( 'THREE.GLTFLoader: %s buffer type is not supported.', bufferDef.type );
+			throw new Error( 'THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.' );
 
 		}
 

+ 90 - 81
examples/js/vr/WebVR.js

@@ -7,128 +7,137 @@
 
 var WEBVR = {
 
-	checkAvailability: function () {
+	createButton: function ( renderer ) {
 
-		return new Promise( function( resolve, reject ) {
+		function showEnterVR( display ) {
 
-			if ( navigator.getVRDisplays !== undefined ) {
+			button.style.display = '';
 
-				navigator.getVRDisplays().then( function ( displays ) {
+			button.style.cursor = 'pointer';
+			button.style.left = 'calc(50% - 50px)';
+			button.style.width = '100px';
 
-					if ( displays.length === 0 ) {
+			button.textContent = 'ENTER VR';
 
-						reject( 'WebVR supported, but no VRDisplays found.' );
+			button.onmouseenter = function () { button.style.opacity = '1.0'; };
+			button.onmouseleave = function () { button.style.opacity = '0.5'; };
 
-					} else {
+			button.onclick = function () {
 
-						resolve();
+				display.isPresenting ? display.exitPresent() : display.requestPresent( [ { source: renderer.domElement } ] );
 
-					}
+			};
 
-				}, function () {
+			renderer.vr.setDevice( display );
 
-					reject( 'Your browser does not support WebVR. See <a href="https://webvr.info">webvr.info</a> for assistance.' );
-				
-				} );
+		}
 
-			} else {
+		function showVRNotFound() {
 
-				reject( 'Your browser does not support WebVR. See <a href="https://webvr.info">webvr.info</a> for assistance.' );
+			button.style.display = '';
 
-			}
+			button.style.cursor = 'auto';
+			button.style.left = 'calc(50% - 75px)';
+			button.style.width = '150px';
 
-		} );
+			button.textContent = 'VR NOT FOUND';
 
-	},
+			button.onmouseenter = null;
+			button.onmouseleave = null;
 
-	getVRDisplay: function ( onDisplay ) {
+			button.onclick = null;
 
-		if ( 'getVRDisplays' in navigator ) {
-
-			navigator.getVRDisplays()
-				.then( function ( displays ) {
-					onDisplay( displays[ 0 ] );
-				} );
+			renderer.vr.setDevice( null );
 
 		}
 
-	},
+		function stylizeElement( element ) {
 
-	getMessageContainer: function ( message ) {
-
-		var container = document.createElement( 'div' );
-		container.style.position = 'absolute';
-		container.style.left = '0';
-		container.style.top = '0';
-		container.style.right = '0';
-		container.style.zIndex = '999';
-		container.align = 'center';
-
-		var error = document.createElement( 'div' );
-		error.style.fontFamily = 'sans-serif';
-		error.style.fontSize = '16px';
-		error.style.fontStyle = 'normal';
-		error.style.lineHeight = '26px';
-		error.style.backgroundColor = '#fff';
-		error.style.color = '#000';
-		error.style.padding = '10px 20px';
-		error.style.margin = '50px';
-		error.style.display = 'inline-block';
-		error.innerHTML = message;
-		container.appendChild( error );
-
-		return container;
+			element.style.position = 'absolute';
+			element.style.bottom = '20px';
+			element.style.padding = '12px 6px';
+			element.style.border = '1px solid #fff';
+			element.style.borderRadius = '4px';
+			element.style.background = 'transparent';
+			element.style.color = '#fff';
+			element.style.font = 'normal 13px sans-serif';
+			element.style.textAlign = 'center';
+			element.style.opacity = '0.5';
+			element.style.zIndex = '999';
 
-	},
+		}
 
-	getButton: function ( display, canvas ) {
+		if ( 'getVRDisplays' in navigator ) {
 
-		if ( 'VREffect' in THREE && display instanceof THREE.VREffect ) {
+			var button = document.createElement( 'button' );
+			button.style.display = 'none';
 
-			console.error( 'WebVR.getButton() now expects a VRDisplay.' );
-			return document.createElement( 'button' );
+			stylizeElement( button );
 
-		}
+			window.addEventListener( 'vrdisplayconnect', function ( event ) {
 
-		var button = document.createElement( 'button' );
-		button.style.position = 'absolute';
-		button.style.left = 'calc(50% - 50px)';
-		button.style.bottom = '20px';
-		button.style.width = '100px';
-		button.style.border = '0';
-		button.style.padding = '8px';
-		button.style.cursor = 'pointer';
-		button.style.backgroundColor = '#000';
-		button.style.color = '#fff';
-		button.style.fontFamily = 'sans-serif';
-		button.style.fontSize = '13px';
-		button.style.fontStyle = 'normal';
-		button.style.textAlign = 'center';
-		button.style.zIndex = '999';
-
-		if ( display ) {
+				showEnterVR( event.display );
 
-			button.textContent = 'ENTER VR';
-			button.onclick = function () {
+			}, false );
 
-				display.isPresenting ? display.exitPresent() : display.requestPresent( [ { source: canvas } ] );
+			window.addEventListener( 'vrdisplaydisconnect', function ( event ) {
 
-			};
+				showVRNotFound();
 
-			window.addEventListener( 'vrdisplaypresentchange', function () {
+			}, false );
+
+			window.addEventListener( 'vrdisplaypresentchange', function ( event ) {
 
-				button.textContent = display.isPresenting ? 'EXIT VR' : 'ENTER VR';
+				button.textContent = event.display.isPresenting ? 'EXIT VR' : 'ENTER VR';
 
 			}, false );
 
+			navigator.getVRDisplays()
+				.then( function ( displays ) {
+
+					if ( displays.length > 0 ) showEnterVR( displays[ 0 ] );
+
+				} );
+
+			return button;
+
 		} else {
 
-			button.textContent = 'NO VR DISPLAY';
+			var message = document.createElement( 'a' );
+			message.href = 'https://webvr.info';
+			message.innerHTML = 'WEBVR NOT SUPPORTED';
+
+			message.style.left = 'calc(50% - 90px)';
+			message.style.width = '180px';
+			message.style.textDecoration = 'none';
+
+			stylizeElement( message );
+
+			return message;
 
 		}
 
-		return button;
+	},
+
+	// DEPRECATED
+
+	checkAvailability: function () {
+		console.warn( 'WEBVR.checkAvailability has been deprecated.' );
+		return new Promise( function () {} );
+	},
+
+	getMessageContainer: function () {
+		console.warn( 'WEBVR.getMessageContainer has been deprecated.' );
+		return document.createElement( 'div' );
+	},
+
+	getButton: function () {
+		console.warn( 'WEBVR.getButton has been deprecated.' );
+		return document.createElement( 'div' );
+	},
 
+	getVRDisplay: function () {
+		console.warn( 'WEBVR.getVRDisplay has been deprecated.' );
 	}
 
 };

+ 6 - 20
examples/webvr_cubes.html

@@ -27,14 +27,6 @@
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
-			//
-
 			var clock = new THREE.Clock();
 
 			var container;
@@ -123,29 +115,23 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
-
 				renderer.vr.enabled = true;
-
-				WEBVR.getVRDisplay( function ( display ) {
-
-					renderer.vr.setDevice( display );
-
-					document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-				} );
+				container.appendChild( renderer.domElement );
 
 				renderer.domElement.addEventListener( 'mousedown', onMouseDown, false );
 				renderer.domElement.addEventListener( 'mouseup', onMouseUp, false );
 				renderer.domElement.addEventListener( 'touchstart', onMouseDown, false );
 				renderer.domElement.addEventListener( 'touchend', onMouseUp, false );
 
+				window.addEventListener( 'resize', onWindowResize, false );
+
 				//
 
 				window.addEventListener( 'vrdisplaypointerrestricted', onPointerRestricted, false );
 				window.addEventListener( 'vrdisplaypointerunrestricted', onPointerUnrestricted, false );
-				window.addEventListener( 'resize', onWindowResize, false );
-
+				
+				document.body.appendChild( WEBVR.createButton( renderer ) );
+				
 			}
 
 			function onMouseDown() {

+ 2 - 16
examples/webvr_daydream.html

@@ -28,14 +28,6 @@
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
-			//
-
 			var clock = new THREE.Clock();
 
 			var container;
@@ -120,18 +112,12 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
-
 				renderer.vr.enabled = true;
+				container.appendChild( renderer.domElement );
 
 				//
 
-				WEBVR.getVRDisplay( function ( device ) {
-
-					renderer.vr.setDevice( device );
-					document.body.appendChild( WEBVR.getButton( device, renderer.domElement ) );
-
-				} );
+				document.body.appendChild( WEBVR.createButton( renderer ) );
 
 				//
 

+ 3 - 16
examples/webvr_gearvr.html

@@ -24,17 +24,11 @@
 		<script src="js/loaders/MTLLoader.js"></script>
 		<script src="js/loaders/OBJLoader.js"></script>
 
-        <script src="js/vr/GearVRController.js"></script>
+		<script src="js/vr/GearVRController.js"></script>
 		<script src="js/vr/WebVR.js"></script>
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function ( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
 			var clock = new THREE.Clock();
 
 			var container;
@@ -116,9 +110,10 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
+				renderer.vr.enabled = true;
 				container.appendChild( renderer.domElement );
 
-				renderer.vr.enabled = true;
+				document.body.appendChild( WEBVR.createButton( renderer ) );
 
 				controller = new THREE.GearVRController();
 				camBox.position.y = 1.8;
@@ -160,14 +155,6 @@
 
 				} );
 
-				WEBVR.getVRDisplay( function ( display ) {
-
-					renderer.vr.setDevice( display );
-
-					document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-				} );
-
 				window.addEventListener( 'resize', onWindowResize, false );
 
 			}

+ 4 - 17
examples/webvr_panorama.html

@@ -23,14 +23,6 @@
 
 		<script>
 
-		WEBVR.checkAvailability().catch( function( message ) {
-
-			document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-		} );
-
-		//
-
 		var camera;
 		var renderer;
 		var scene;
@@ -43,23 +35,18 @@
 			renderer = new THREE.WebGLRenderer();
 			renderer.setPixelRatio( window.devicePixelRatio );
 			renderer.setSize( window.innerWidth, window.innerHeight );
+			renderer.vr.enabled = true;
 			document.body.appendChild( renderer.domElement );
 
-			renderer.vr.enabled = true;
+			document.body.appendChild( WEBVR.createButton( renderer ) );
+
+			//
 
 			scene = new THREE.Scene();
 
 			camera = new THREE.PerspectiveCamera( 90, window.innerWidth / window.innerHeight, 1, 1000 );
 			camera.layers.enable( 1 );
 
-			WEBVR.getVRDisplay( function ( display ) {
-
-				renderer.vr.setDevice( display );
-
-				document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-			} );
-
 			var geometry = new THREE.CubeGeometry( 100, 100, 100 );
 			var textures = getTexturesFromAtlasFile( "textures/cube/sun_temple_stripe_stereo.jpg", 12 );
 

+ 4 - 19
examples/webvr_rollercoaster.html

@@ -29,20 +29,15 @@
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
-			//
-
 			var renderer = new THREE.WebGLRenderer( { antialias: true } );
 			renderer.setPixelRatio( window.devicePixelRatio );
 			renderer.setSize( window.innerWidth, window.innerHeight );
+			renderer.vr.enabled = true;
 			document.body.appendChild( renderer.domElement );
 
-			renderer.vr.enabled = true;
+			document.body.appendChild( WEBVR.createButton( renderer ) );
+
+			//
 
 			var scene = new THREE.Scene();
 			scene.background = new THREE.Color( 0xf0f0ff );
@@ -188,16 +183,6 @@
 
 			//
 
-			WEBVR.getVRDisplay( function ( display ) {
-
-				renderer.vr.setDevice( display );
-
-				document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-			} );
-
-			//
-
 			window.addEventListener( 'resize', onWindowResize, false );
 
 			function onWindowResize() {

+ 2 - 19
examples/webvr_sandbox.html

@@ -23,14 +23,6 @@
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
-			//
-
 			var camera, scene, renderer;
 
 			var reflector;
@@ -117,19 +109,10 @@
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.shadowMap.enabled = true;
-				document.body.appendChild( renderer.domElement );
-
 				renderer.vr.enabled = true;
+				document.body.appendChild( renderer.domElement );
 
-				//
-
-				WEBVR.getVRDisplay( function ( display ) {
-
-					renderer.vr.setDevice( display );
-
-					document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-				} );
+				document.body.appendChild( WEBVR.createButton( renderer ) );
 
 				//
 

+ 2 - 20
examples/webvr_video.html

@@ -38,14 +38,6 @@
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
-			//
-
 			var camera, scene, renderer;
 			var video, texture;
 
@@ -137,20 +129,10 @@
 				renderer = new THREE.WebGLRenderer();
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
-
 				renderer.vr.enabled = true;
+				container.appendChild( renderer.domElement );
 
-				//
-
-				WEBVR.getVRDisplay( function ( display ) {
-
-					renderer.vr.setDevice( display );
-
-					document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-				} );
-
+				document.body.appendChild( WEBVR.createButton( renderer ) );
 
 				//
 

+ 3 - 18
examples/webvr_vive.html

@@ -28,14 +28,6 @@
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
-			//
-
 			var clock = new THREE.Clock();
 
 			var container;
@@ -159,10 +151,11 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
-
 				renderer.vr.enabled = true;
 				renderer.vr.standing = true;
+				container.appendChild( renderer.domElement );
+
+				document.body.appendChild( WEBVR.createButton( renderer ) );
 
 				// controllers
 
@@ -190,14 +183,6 @@
 
 				} );
 
-				WEBVR.getVRDisplay( function ( display ) {
-
-					renderer.vr.setDevice( display );
-
-					document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-				} );
-
 				//
 
 				window.addEventListener( 'resize', onWindowResize, false );

+ 3 - 18
examples/webvr_vive_camerarig.html

@@ -28,14 +28,6 @@
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
-			//
-
 			var clock = new THREE.Clock();
 
 			var container;
@@ -168,10 +160,11 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
-
 				renderer.vr.enabled = true;
 				renderer.vr.standing = true;
+				container.appendChild( renderer.domElement );
+
+				document.body.appendChild( WEBVR.createButton( renderer ) );
 
 				// controllers
 
@@ -203,14 +196,6 @@
 
 				} );
 
-				WEBVR.getVRDisplay( function ( display ) {
-
-					renderer.vr.setDevice( display );
-
-					document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-				} );
-
 				//
 
 				window.addEventListener( 'resize', onWindowResize, false );

+ 4 - 22
examples/webvr_vive_dragging.html

@@ -28,14 +28,6 @@
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
-			//
-
 			var container;
 			var camera, scene, renderer;
 			var controller1, controller2;
@@ -134,13 +126,14 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				renderer.shadowMap.enabled = true;
 				renderer.gammaInput = true;
 				renderer.gammaOutput = true;
-				container.appendChild( renderer.domElement );
-
+				renderer.shadowMap.enabled = true;
 				renderer.vr.enabled = true;
 				renderer.vr.standing = true;
+				container.appendChild( renderer.domElement );
+
+				document.body.appendChild( WEBVR.createButton( renderer ) );
 
 				// controllers
 
@@ -187,17 +180,6 @@
 
 				raycaster = new THREE.Raycaster();
 
-
-				//
-
-				WEBVR.getVRDisplay( function ( display ) {
-
-					renderer.vr.setDevice( display );
-
-					document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-				} );
-
 				//
 
 				window.addEventListener( 'resize', onWindowResize, false );

+ 4 - 19
examples/webvr_vive_paint.html

@@ -29,14 +29,6 @@
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
-			//
-
 			var container;
 			var camera, scene, renderer;
 			var controller1, controller2;
@@ -133,13 +125,14 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				renderer.shadowMap.enabled = true;
 				renderer.gammaInput = true;
 				renderer.gammaOutput = true;
-				container.appendChild( renderer.domElement );
-
+				renderer.shadowMap.enabled = true;
 				renderer.vr.enabled = true;
 				renderer.vr.standing = true;
+				container.appendChild( renderer.domElement );
+
+				document.body.appendChild( WEBVR.createButton( renderer ) );
 
 				// controllers
 
@@ -184,14 +177,6 @@
 
 				} );
 
-				WEBVR.getVRDisplay( function ( display ) {
-
-					renderer.vr.setDevice( display );
-
-					document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-				} );
-
 				//
 
 				window.addEventListener( 'resize', onWindowResize, false );

+ 4 - 19
examples/webvr_vive_sculpt.html

@@ -29,14 +29,6 @@
 
 		<script>
 
-			WEBVR.checkAvailability().catch( function( message ) {
-
-				document.body.appendChild( WEBVR.getMessageContainer( message ) );
-
-			} );
-
-			//
-
 			var container;
 			var camera, scene, renderer;
 			var controller1, controller2;
@@ -115,13 +107,14 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				renderer.shadowMap.enabled = true;
 				renderer.gammaInput = true;
 				renderer.gammaOutput = true;
-				container.appendChild( renderer.domElement );
-
+				renderer.shadowMap.enabled = true;
 				renderer.vr.enabled = true;
 				renderer.vr.standing = true;
+				container.appendChild( renderer.domElement );
+
+				document.body.appendChild( WEBVR.createButton( renderer ) );
 
 				// controllers
 
@@ -162,14 +155,6 @@
 
 				} );
 
-				WEBVR.getVRDisplay( function ( display ) {
-
-					renderer.vr.setDevice( display );
-
-					document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
-
-				} );
-
 				//
 
 				window.addEventListener( 'resize', onWindowResize, false );

+ 20 - 0
src/Three.Legacy.js

@@ -25,6 +25,7 @@ import { Object3D } from './core/Object3D.js';
 import { Uniform } from './core/Uniform.js';
 import { Curve } from './extras/core/Curve.js';
 import { CurvePath } from './extras/core/CurvePath.js';
+import { Path } from './extras/core/Path.js';
 import { CatmullRomCurve3 } from './extras/curves/CatmullRomCurve3.js';
 import { AxesHelper } from './helpers/AxesHelper.js';
 import { BoxHelper } from './helpers/BoxHelper.js';
@@ -288,6 +289,19 @@ Object.assign( CurvePath.prototype, {
 
 //
 
+Object.assign( Path.prototype, {
+
+	fromPoints: function ( points ) {
+
+		console.warn( 'THREE.Path: .fromPoints() has been renamed to .setFromPoints().' );
+		this.setFromPoints( points );
+
+	}
+
+} );
+
+//
+
 export function ClosedSplineCurve3( points ) {
 
 	console.warn( 'THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );
@@ -684,6 +698,12 @@ Object.assign( Ray.prototype, {
 
 Object.assign( Shape.prototype, {
 
+	extractAllPoints: function ( divisions ) {
+
+		console.warn( 'THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.' );
+		return this.extractPoints( divisions );
+
+	},
 	extrude: function ( options ) {
 
 		console.warn( 'THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.' );

+ 20 - 0
src/extras/core/CurvePath.js

@@ -197,6 +197,26 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), {
 
 		return points;
 
+	},
+
+	copy: function ( source ) {
+
+		Curve.prototype.copy.call( this, source );
+
+		this.curves = [];
+
+		for ( var i = 0, l = source.curves.length; i < l; i ++ ) {
+
+			var curve = source.curves[ i ];
+
+			this.curves.push( curve.clone() );
+
+		}
+
+		this.autoClose = source.autoClose;
+
+		return this;
+
 	}
 
 } );

+ 1 - 1
src/extras/core/Path.js

@@ -18,7 +18,7 @@ function Path( points ) {
 
 	if ( points ) {
 
-		this.fromPoints( points );
+		this.setFromPoints( points );
 
 	}
 

+ 14 - 4
src/extras/core/PathPrototype.js

@@ -8,13 +8,13 @@ import { LineCurve } from '../curves/LineCurve.js';
 
 var PathPrototype = Object.assign( Object.create( CurvePath.prototype ), {
 
-	fromPoints: function ( vectors ) {
+	setFromPoints: function ( points ) {
 
-		this.moveTo( vectors[ 0 ].x, vectors[ 0 ].y );
+		this.moveTo( points[ 0 ].x, points[ 0 ].y );
 
-		for ( var i = 1, l = vectors.length; i < l; i ++ ) {
+		for ( var i = 1, l = points.length; i < l; i ++ ) {
 
-			this.lineTo( vectors[ i ].x, vectors[ i ].y );
+			this.lineTo( points[ i ].x, points[ i ].y );
 
 		}
 
@@ -122,6 +122,16 @@ var PathPrototype = Object.assign( Object.create( CurvePath.prototype ), {
 		var lastPoint = curve.getPoint( 1 );
 		this.currentPoint.copy( lastPoint );
 
+	},
+
+	copy: function ( source ) {
+
+		CurvePath.prototype.copy.call( this, source );
+
+		this.currentPoint.copy( source.currentPoint );
+
+		return this;
+
 	}
 
 } );

+ 18 - 6
src/extras/core/Shape.js

@@ -12,9 +12,9 @@ import { Path } from './Path.js';
 // STEP 3a - Extract points from each shape, turn to vertices
 // STEP 3b - Triangulate each shape, add faces.
 
-function Shape() {
+function Shape( points ) {
 
-	Path.apply( this, arguments );
+	Path.call( this, points );
 
 	this.type = 'Shape';
 
@@ -40,9 +40,9 @@ Shape.prototype = Object.assign( Object.create( PathPrototype ), {
 
 	},
 
-	// Get points of shape and holes (keypoints based on segments parameter)
+	// get points of shape and holes (keypoints based on segments parameter)
 
-	extractAllPoints: function ( divisions ) {
+	extractPoints: function ( divisions ) {
 
 		return {
 
@@ -53,9 +53,21 @@ Shape.prototype = Object.assign( Object.create( PathPrototype ), {
 
 	},
 
-	extractPoints: function ( divisions ) {
+	copy: function ( source ) {
+
+		Path.prototype.copy.call( this, source );
+
+		this.holes = [];
+
+		for ( var i = 0, l = source.holes.length; i < l; i ++ ) {
+
+			var hole = source.holes[ i ];
+
+			this.holes.push( hole.clone() );
+
+		}
 
-		return this.extractAllPoints( divisions );
+		return this;
 
 	}
 

+ 25 - 2
src/renderers/WebGLRenderer.js

@@ -1024,7 +1024,19 @@ function WebGLRenderer( parameters ) {
 	function start() {
 
 		if ( isAnimating ) return;
-		( vr.getDevice() || window ).requestAnimationFrame( loop );
+
+		var device = vr.getDevice();
+		
+		if ( device && device.isPresenting ) {
+
+			device.requestAnimationFrame( loop );
+
+		} else {
+
+			window.requestAnimationFrame( loop );
+
+		}
+
 		isAnimating = true;
 
 	}
@@ -1032,7 +1044,18 @@ function WebGLRenderer( parameters ) {
 	function loop( time ) {
 
 		if ( onAnimationFrame !== null ) onAnimationFrame( time );
-		( vr.getDevice() || window ).requestAnimationFrame( loop );
+
+		var device = vr.getDevice();
+		
+		if ( device && device.isPresenting ) {
+
+			device.requestAnimationFrame( loop );
+
+		} else {
+
+			window.requestAnimationFrame( loop );
+
+		}
 
 	}
 

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно