|
@@ -5986,7 +5986,7 @@ var ShaderLib = {
|
|
|
{
|
|
|
emissive: { value: new Color( 0x000000 ) },
|
|
|
roughness: { value: 0.5 },
|
|
|
- metalness: { value: 0 },
|
|
|
+ metalness: { value: 0.5 },
|
|
|
envMapIntensity: { value: 1 } // temporary
|
|
|
}
|
|
|
] ),
|
|
@@ -16854,7 +16854,7 @@ function replaceLightNums( string, parameters ) {
|
|
|
|
|
|
function parseIncludes( string ) {
|
|
|
|
|
|
- var pattern = /#include +<([\w\d.]+)>/g;
|
|
|
+ var pattern = /^\s*#include +<([\w\d.]+)>/gm;
|
|
|
|
|
|
function replace( match, include ) {
|
|
|
|
|
@@ -24063,7 +24063,7 @@ function WireframeGeometry( geometry ) {
|
|
|
// helper variables
|
|
|
|
|
|
var i, j, l, o, ol;
|
|
|
- var edge = [ 0, 0 ], edges = {}, e;
|
|
|
+ var edge = [ 0, 0 ], edges = {}, e, edge1, edge2;
|
|
|
var key, keys = [ 'a', 'b', 'c' ];
|
|
|
var vertex;
|
|
|
|
|
@@ -24081,11 +24081,12 @@ function WireframeGeometry( geometry ) {
|
|
|
|
|
|
for ( j = 0; j < 3; j ++ ) {
|
|
|
|
|
|
- edge[ 0 ] = face[ keys[ j ] ];
|
|
|
- edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];
|
|
|
- edge.sort( sortFunction ); // sorting prevents duplicates
|
|
|
+ edge1 = face[ keys[ j ] ];
|
|
|
+ edge2 = face[ keys[ ( j + 1 ) % 3 ] ];
|
|
|
+ edge[ 0 ] = Math.min( edge1, edge2 ); // sorting prevents duplicates
|
|
|
+ edge[ 1 ] = Math.max( edge1, edge2 );
|
|
|
|
|
|
- key = edge.toString();
|
|
|
+ key = edge[ 0 ] + ',' + edge[ 1 ];
|
|
|
|
|
|
if ( edges[ key ] === undefined ) {
|
|
|
|
|
@@ -24146,11 +24147,12 @@ function WireframeGeometry( geometry ) {
|
|
|
|
|
|
for ( j = 0; j < 3; j ++ ) {
|
|
|
|
|
|
- edge[ 0 ] = indices.getX( i + j );
|
|
|
- edge[ 1 ] = indices.getX( i + ( j + 1 ) % 3 );
|
|
|
- edge.sort( sortFunction ); // sorting prevents duplicates
|
|
|
+ edge1 = indices.getX( i + j );
|
|
|
+ edge2 = indices.getX( i + ( j + 1 ) % 3 );
|
|
|
+ edge[ 0 ] = Math.min( edge1, edge2 ); // sorting prevents duplicates
|
|
|
+ edge[ 1 ] = Math.max( edge1, edge2 );
|
|
|
|
|
|
- key = edge.toString();
|
|
|
+ key = edge[ 0 ] + ',' + edge[ 1 ];
|
|
|
|
|
|
if ( edges[ key ] === undefined ) {
|
|
|
|
|
@@ -24211,14 +24213,6 @@ function WireframeGeometry( geometry ) {
|
|
|
|
|
|
this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
|
|
|
|
|
|
- // custom array sort function
|
|
|
-
|
|
|
- function sortFunction( a, b ) {
|
|
|
-
|
|
|
- return a - b;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
WireframeGeometry.prototype = Object.create( BufferGeometry.prototype );
|
|
@@ -27668,7 +27662,7 @@ function EdgesGeometry( geometry, thresholdAngle ) {
|
|
|
// helper variables
|
|
|
|
|
|
var thresholdDot = Math.cos( _Math.DEG2RAD * thresholdAngle );
|
|
|
- var edge = [ 0, 0 ], edges = {};
|
|
|
+ var edge = [ 0, 0 ], edges = {}, edge1, edge2;
|
|
|
var key, keys = [ 'a', 'b', 'c' ];
|
|
|
|
|
|
// prepare source geometry
|
|
@@ -27700,11 +27694,12 @@ function EdgesGeometry( geometry, thresholdAngle ) {
|
|
|
|
|
|
for ( var j = 0; j < 3; j ++ ) {
|
|
|
|
|
|
- edge[ 0 ] = face[ keys[ j ] ];
|
|
|
- edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];
|
|
|
- edge.sort( sortFunction );
|
|
|
+ edge1 = face[ keys[ j ] ];
|
|
|
+ edge2 = face[ keys[ ( j + 1 ) % 3 ] ];
|
|
|
+ edge[ 0 ] = Math.min( edge1, edge2 );
|
|
|
+ edge[ 1 ] = Math.max( edge1, edge2 );
|
|
|
|
|
|
- key = edge.toString();
|
|
|
+ key = edge[ 0 ] + ',' + edge[ 1 ];
|
|
|
|
|
|
if ( edges[ key ] === undefined ) {
|
|
|
|
|
@@ -27744,14 +27739,6 @@ function EdgesGeometry( geometry, thresholdAngle ) {
|
|
|
|
|
|
this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
|
|
|
|
|
|
- // custom array sort function
|
|
|
-
|
|
|
- function sortFunction( a, b ) {
|
|
|
-
|
|
|
- return a - b;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
EdgesGeometry.prototype = Object.create( BufferGeometry.prototype );
|
|
@@ -32019,9 +32006,10 @@ Object.assign( MaterialLoader.prototype, {
|
|
|
var scope = this;
|
|
|
|
|
|
var loader = new FileLoader( scope.manager );
|
|
|
- loader.load( url, function ( text ) {
|
|
|
+ loader.setResponseType( 'json' );
|
|
|
+ loader.load( url, function ( json ) {
|
|
|
|
|
|
- onLoad( scope.parse( JSON.parse( text ) ) );
|
|
|
+ onLoad( scope.parse( json ) );
|
|
|
|
|
|
}, onProgress, onError );
|
|
|
|
|
@@ -32177,9 +32165,10 @@ Object.assign( BufferGeometryLoader.prototype, {
|
|
|
var scope = this;
|
|
|
|
|
|
var loader = new FileLoader( scope.manager );
|
|
|
- loader.load( url, function ( text ) {
|
|
|
+ loader.setResponseType( 'json' );
|
|
|
+ loader.load( url, function ( json ) {
|
|
|
|
|
|
- onLoad( scope.parse( JSON.parse( text ) ) );
|
|
|
+ onLoad( scope.parse( json ) );
|
|
|
|
|
|
}, onProgress, onError );
|
|
|
|
|
@@ -32617,10 +32606,10 @@ Object.assign( JSONLoader.prototype, {
|
|
|
var texturePath = this.texturePath && ( typeof this.texturePath === "string" ) ? this.texturePath : Loader.prototype.extractUrlBase( url );
|
|
|
|
|
|
var loader = new FileLoader( this.manager );
|
|
|
+ loader.setResponseType( 'json' );
|
|
|
loader.setWithCredentials( this.withCredentials );
|
|
|
- loader.load( url, function ( text ) {
|
|
|
+ loader.load( url, function ( json ) {
|
|
|
|
|
|
- var json = JSON.parse( text );
|
|
|
var metadata = json.metadata;
|
|
|
|
|
|
if ( metadata !== undefined ) {
|
|
@@ -33966,30 +33955,30 @@ function CubicBezier( t, p0, p1, p2, p3 ) {
|
|
|
* @author zz85 / http://www.lab4games.net/zz85/blog
|
|
|
* Extensible curve object
|
|
|
*
|
|
|
- * Some common of Curve methods
|
|
|
+ * Some common of curve methods:
|
|
|
* .getPoint(t), getTangent(t)
|
|
|
* .getPointAt(u), getTangentAt(u)
|
|
|
* .getPoints(), .getSpacedPoints()
|
|
|
* .getLength()
|
|
|
* .updateArcLengths()
|
|
|
*
|
|
|
- * This following classes subclasses THREE.Curve:
|
|
|
+ * This following curves inherit from THREE.Curve:
|
|
|
*
|
|
|
- * -- 2d classes --
|
|
|
+ * -- 2D curves --
|
|
|
+ * THREE.ArcCurve
|
|
|
+ * THREE.CubicBezierCurve
|
|
|
+ * THREE.EllipseCurve
|
|
|
* THREE.LineCurve
|
|
|
* THREE.QuadraticBezierCurve
|
|
|
- * THREE.CubicBezierCurve
|
|
|
* THREE.SplineCurve
|
|
|
- * THREE.ArcCurve
|
|
|
- * THREE.EllipseCurve
|
|
|
*
|
|
|
- * -- 3d classes --
|
|
|
+ * -- 3D curves --
|
|
|
+ * THREE.CatmullRomCurve3
|
|
|
+ * THREE.CubicBezierCurve3
|
|
|
* THREE.LineCurve3
|
|
|
* THREE.QuadraticBezierCurve3
|
|
|
- * THREE.CubicBezierCurve3
|
|
|
- * THREE.CatmullRomCurve3
|
|
|
*
|
|
|
- * A series of curves can be represented as a THREE.CurvePath
|
|
|
+ * A series of curves can be represented as a THREE.CurvePath.
|
|
|
*
|
|
|
**/
|
|
|
|
|
@@ -33997,7 +33986,11 @@ function CubicBezier( t, p0, p1, p2, p3 ) {
|
|
|
* Abstract Curve base class
|
|
|
**************************************************************/
|
|
|
|
|
|
-function Curve() {}
|
|
|
+function Curve() {
|
|
|
+
|
|
|
+ this.arcLengthDivisions = 200;
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
Object.assign( Curve.prototype, {
|
|
|
|
|
@@ -34006,7 +33999,7 @@ Object.assign( Curve.prototype, {
|
|
|
|
|
|
getPoint: function () {
|
|
|
|
|
|
- console.warn( "THREE.Curve: Warning, getPoint() not implemented!" );
|
|
|
+ console.warn( 'THREE.Curve: .getPoint() not implemented.' );
|
|
|
return null;
|
|
|
|
|
|
},
|
|
@@ -34070,13 +34063,12 @@ Object.assign( Curve.prototype, {
|
|
|
|
|
|
getLengths: function ( divisions ) {
|
|
|
|
|
|
- if ( divisions === undefined ) divisions = ( this.__arcLengthDivisions ) ? ( this.__arcLengthDivisions ) : 200;
|
|
|
+ if ( divisions === undefined ) divisions = this.arcLengthDivisions;
|
|
|
|
|
|
- if ( this.cacheArcLengths
|
|
|
- && ( this.cacheArcLengths.length === divisions + 1 )
|
|
|
- && ! this.needsUpdate ) {
|
|
|
+ if ( this.cacheArcLengths &&
|
|
|
+ ( this.cacheArcLengths.length === divisions + 1 ) &&
|
|
|
+ ! this.needsUpdate ) {
|
|
|
|
|
|
- //console.log( "cached", this.cacheArcLengths );
|
|
|
return this.cacheArcLengths;
|
|
|
|
|
|
}
|
|
@@ -34100,7 +34092,7 @@ Object.assign( Curve.prototype, {
|
|
|
|
|
|
this.cacheArcLengths = cache;
|
|
|
|
|
|
- return cache; // { sums: cache, sum:sum }; Sum is in the last element.
|
|
|
+ return cache; // { sums: cache, sum: sum }; Sum is in the last element.
|
|
|
|
|
|
},
|
|
|
|
|
@@ -34131,8 +34123,6 @@ Object.assign( Curve.prototype, {
|
|
|
|
|
|
}
|
|
|
|
|
|
- //var time = Date.now();
|
|
|
-
|
|
|
// binary search for the index with largest value smaller than target u distance
|
|
|
|
|
|
var low = 0, high = il - 1, comparison;
|
|
@@ -34164,12 +34154,9 @@ Object.assign( Curve.prototype, {
|
|
|
|
|
|
i = high;
|
|
|
|
|
|
- //console.log('b' , i, low, high, Date.now()- time);
|
|
|
-
|
|
|
if ( arcLengths[ i ] === targetArcLength ) {
|
|
|
|
|
|
- var t = i / ( il - 1 );
|
|
|
- return t;
|
|
|
+ return i / ( il - 1 );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -34344,6 +34331,8 @@ Object.assign( Curve.prototype, {
|
|
|
|
|
|
function LineCurve( v1, v2 ) {
|
|
|
|
|
|
+ Curve.call( this );
|
|
|
+
|
|
|
this.v1 = v1;
|
|
|
this.v2 = v2;
|
|
|
|
|
@@ -34397,6 +34386,8 @@ LineCurve.prototype.getTangent = function ( t ) {
|
|
|
|
|
|
function CurvePath() {
|
|
|
|
|
|
+ Curve.call( this );
|
|
|
+
|
|
|
this.curves = [];
|
|
|
|
|
|
this.autoClose = false; // Automatically closes the path
|
|
@@ -34484,7 +34475,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), {
|
|
|
|
|
|
this.needsUpdate = true;
|
|
|
this.cacheLengths = null;
|
|
|
- this.getLengths();
|
|
|
+ this.getCurveLengths();
|
|
|
|
|
|
},
|
|
|
|
|
@@ -34621,6 +34612,8 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), {
|
|
|
|
|
|
function EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {
|
|
|
|
|
|
+ Curve.call( this );
|
|
|
+
|
|
|
this.aX = aX;
|
|
|
this.aY = aY;
|
|
|
|
|
@@ -34703,6 +34696,8 @@ EllipseCurve.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
function SplineCurve( points /* array of Vector2 */ ) {
|
|
|
|
|
|
+ Curve.call( this );
|
|
|
+
|
|
|
this.points = ( points === undefined ) ? [] : points;
|
|
|
|
|
|
}
|
|
@@ -34734,6 +34729,8 @@ SplineCurve.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
function CubicBezierCurve( v0, v1, v2, v3 ) {
|
|
|
|
|
|
+ Curve.call( this );
|
|
|
+
|
|
|
this.v0 = v0;
|
|
|
this.v1 = v1;
|
|
|
this.v2 = v2;
|
|
@@ -34757,6 +34754,8 @@ CubicBezierCurve.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
function QuadraticBezierCurve( v0, v1, v2 ) {
|
|
|
|
|
|
+ Curve.call( this );
|
|
|
+
|
|
|
this.v0 = v0;
|
|
|
this.v1 = v1;
|
|
|
this.v2 = v2;
|
|
@@ -37617,8 +37616,8 @@ function AnimationAction( mixer, clip, localRoot ) {
|
|
|
|
|
|
this.repetitions = Infinity; // no. of repetitions when looping
|
|
|
|
|
|
- this.paused = false; // false -> zero effective time scale
|
|
|
- this.enabled = true; // true -> zero effective weight
|
|
|
+ this.paused = false; // true -> zero effective time scale
|
|
|
+ this.enabled = true; // false -> zero effective weight
|
|
|
|
|
|
this.clampWhenFinished = false; // keep feeding the last frame?
|
|
|
|
|
@@ -37771,7 +37770,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
// Time Scale Control
|
|
|
|
|
|
- // set the weight stopping any scheduled warping
|
|
|
+ // set the time scale stopping any scheduled warping
|
|
|
// although .paused = true yields an effective time scale of zero, this
|
|
|
// method does *not* change .paused, because it would be confusing
|
|
|
setEffectiveTimeScale: function( timeScale ) {
|
|
@@ -37878,8 +37877,18 @@ Object.assign( AnimationAction.prototype, {
|
|
|
// Interna
|
|
|
|
|
|
_update: function( time, deltaTime, timeDirection, accuIndex ) {
|
|
|
+
|
|
|
// called by the mixer
|
|
|
|
|
|
+ if ( ! this.enabled ) {
|
|
|
+
|
|
|
+ // call ._updateWeight() to update ._effectiveWeight
|
|
|
+
|
|
|
+ this._updateWeight( time );
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
var startTime = this._startTime;
|
|
|
|
|
|
if ( startTime !== null ) {
|
|
@@ -38807,11 +38816,7 @@ Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, {
|
|
|
|
|
|
var action = actions[ i ];
|
|
|
|
|
|
- if ( action.enabled ) {
|
|
|
-
|
|
|
- action._update( time, deltaTime, timeDirection, accuIndex );
|
|
|
-
|
|
|
- }
|
|
|
+ action._update( time, deltaTime, timeDirection, accuIndex );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -41427,6 +41432,8 @@ var pz = new CubicPoly();
|
|
|
|
|
|
function CatmullRomCurve3( p /* array of Vector3 */ ) {
|
|
|
|
|
|
+ Curve.call( this );
|
|
|
+
|
|
|
this.points = p || [];
|
|
|
this.closed = false;
|
|
|
|
|
@@ -41518,6 +41525,8 @@ CatmullRomCurve3.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
function CubicBezierCurve3( v0, v1, v2, v3 ) {
|
|
|
|
|
|
+ Curve.call( this );
|
|
|
+
|
|
|
this.v0 = v0;
|
|
|
this.v1 = v1;
|
|
|
this.v2 = v2;
|
|
@@ -41542,6 +41551,8 @@ CubicBezierCurve3.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
function QuadraticBezierCurve3( v0, v1, v2 ) {
|
|
|
|
|
|
+ Curve.call( this );
|
|
|
+
|
|
|
this.v0 = v0;
|
|
|
this.v1 = v1;
|
|
|
this.v2 = v2;
|
|
@@ -41565,6 +41576,8 @@ QuadraticBezierCurve3.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
function LineCurve3( v1, v2 ) {
|
|
|
|
|
|
+ Curve.call( this );
|
|
|
+
|
|
|
this.v1 = v1;
|
|
|
this.v2 = v2;
|
|
|
|
|
@@ -42353,6 +42366,23 @@ Object.defineProperty( Skeleton.prototype, 'useVertexTexture', {
|
|
|
|
|
|
} );
|
|
|
|
|
|
+Object.defineProperty( Curve.prototype, '__arcLengthDivisions', {
|
|
|
+
|
|
|
+ get: function () {
|
|
|
+
|
|
|
+ console.warn( 'THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.' );
|
|
|
+ return this.arcLengthDivisions;
|
|
|
+
|
|
|
+ },
|
|
|
+ set: function ( value ) {
|
|
|
+
|
|
|
+ console.warn( 'THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.' );
|
|
|
+ this.arcLengthDivisions = value;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+} );
|
|
|
+
|
|
|
//
|
|
|
|
|
|
PerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) {
|