|
@@ -1,5 +1,5 @@
|
|
|
// threejs.org/license
|
|
|
-const REVISION = '121dev';
|
|
|
+const REVISION = '122dev';
|
|
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
|
const CullFaceNone = 0;
|
|
@@ -917,9 +917,7 @@ class Vector2 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- fromArray( array, offset ) {
|
|
|
-
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ fromArray( array, offset = 0 ) {
|
|
|
|
|
|
this.x = array[ offset ];
|
|
|
this.y = array[ offset + 1 ];
|
|
@@ -928,10 +926,7 @@ class Vector2 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- toArray( array, offset ) {
|
|
|
-
|
|
|
- if ( array === undefined ) array = [];
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ toArray( array = [], offset = 0 ) {
|
|
|
|
|
|
array[ offset ] = this.x;
|
|
|
array[ offset + 1 ] = this.y;
|
|
@@ -1289,9 +1284,7 @@ class Matrix3 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- fromArray( array, offset ) {
|
|
|
-
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ fromArray( array, offset = 0 ) {
|
|
|
|
|
|
for ( let i = 0; i < 9; i ++ ) {
|
|
|
|
|
@@ -1303,10 +1296,7 @@ class Matrix3 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- toArray( array, offset ) {
|
|
|
-
|
|
|
- if ( array === undefined ) array = [];
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ toArray( array = [], offset = 0 ) {
|
|
|
|
|
|
const te = this.elements;
|
|
|
|
|
@@ -2291,9 +2281,7 @@ class Vector4 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- fromArray( array, offset ) {
|
|
|
-
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ fromArray( array, offset = 0 ) {
|
|
|
|
|
|
this.x = array[ offset ];
|
|
|
this.y = array[ offset + 1 ];
|
|
@@ -2304,10 +2292,7 @@ class Vector4 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- toArray( array, offset ) {
|
|
|
-
|
|
|
- if ( array === undefined ) array = [];
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ toArray( array = [], offset = 0 ) {
|
|
|
|
|
|
array[ offset ] = this.x;
|
|
|
array[ offset + 1 ] = this.y;
|
|
@@ -3051,9 +3036,7 @@ class Quaternion {
|
|
|
|
|
|
}
|
|
|
|
|
|
- fromArray( array, offset ) {
|
|
|
-
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ fromArray( array, offset = 0 ) {
|
|
|
|
|
|
this._x = array[ offset ];
|
|
|
this._y = array[ offset + 1 ];
|
|
@@ -3066,10 +3049,7 @@ class Quaternion {
|
|
|
|
|
|
}
|
|
|
|
|
|
- toArray( array, offset ) {
|
|
|
-
|
|
|
- if ( array === undefined ) array = [];
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ toArray( array = [], offset = 0 ) {
|
|
|
|
|
|
array[ offset ] = this._x;
|
|
|
array[ offset + 1 ] = this._y;
|
|
@@ -3769,9 +3749,7 @@ class Vector3 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- fromArray( array, offset ) {
|
|
|
-
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ fromArray( array, offset = 0 ) {
|
|
|
|
|
|
this.x = array[ offset ];
|
|
|
this.y = array[ offset + 1 ];
|
|
@@ -3781,10 +3759,7 @@ class Vector3 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- toArray( array, offset ) {
|
|
|
-
|
|
|
- if ( array === undefined ) array = [];
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ toArray( array = [], offset = 0 ) {
|
|
|
|
|
|
array[ offset ] = this.x;
|
|
|
array[ offset + 1 ] = this.y;
|
|
@@ -5887,9 +5862,7 @@ class Matrix4 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- fromArray( array, offset ) {
|
|
|
-
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ fromArray( array, offset = 0 ) {
|
|
|
|
|
|
for ( let i = 0; i < 16; i ++ ) {
|
|
|
|
|
@@ -5901,10 +5874,7 @@ class Matrix4 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- toArray( array, offset ) {
|
|
|
-
|
|
|
- if ( array === undefined ) array = [];
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ toArray( array = [], offset = 0 ) {
|
|
|
|
|
|
const te = this.elements;
|
|
|
|
|
@@ -6219,10 +6189,7 @@ class Euler {
|
|
|
|
|
|
}
|
|
|
|
|
|
- toArray( array, offset ) {
|
|
|
-
|
|
|
- if ( array === undefined ) array = [];
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ toArray( array = [], offset = 0 ) {
|
|
|
|
|
|
array[ offset ] = this._x;
|
|
|
array[ offset + 1 ] = this._y;
|
|
@@ -6680,6 +6647,25 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
|
|
|
|
|
|
},
|
|
|
|
|
|
+ clear: function () {
|
|
|
+
|
|
|
+ for ( let i = 0; i < this.children.length; i ++ ) {
|
|
|
+
|
|
|
+ const object = this.children[ i ];
|
|
|
+
|
|
|
+ object.parent = null;
|
|
|
+
|
|
|
+ object.dispatchEvent( _removedEvent );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ this.children.length = 0;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
attach: function ( object ) {
|
|
|
|
|
|
// adds object as a child of this, while maintaining the object's world transform
|
|
@@ -8255,9 +8241,7 @@ class Color {
|
|
|
|
|
|
}
|
|
|
|
|
|
- fromArray( array, offset ) {
|
|
|
-
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ fromArray( array, offset = 0 ) {
|
|
|
|
|
|
this.r = array[ offset ];
|
|
|
this.g = array[ offset + 1 ];
|
|
@@ -8267,10 +8251,7 @@ class Color {
|
|
|
|
|
|
}
|
|
|
|
|
|
- toArray( array, offset ) {
|
|
|
-
|
|
|
- if ( array === undefined ) array = [];
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ toArray( array = [], offset = 0 ) {
|
|
|
|
|
|
array[ offset ] = this.r;
|
|
|
array[ offset + 1 ] = this.g;
|
|
@@ -12245,6 +12226,16 @@ function CubeTexture( images, mapping, wrapS, wrapT, magFilter, minFilter, forma
|
|
|
|
|
|
this.flipY = false;
|
|
|
|
|
|
+ // Why CubeTexture._needsFlipEnvMap is necessary:
|
|
|
+ //
|
|
|
+ // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
|
|
|
+ // in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
|
|
|
+ // in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.
|
|
|
+
|
|
|
+ // three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped
|
|
|
+ // and the flag _needsFlipEnvMap controls this conversion. The flip is not required (and thus _needsFlipEnvMap is set to false)
|
|
|
+ // when using WebGLCubeRenderTarget.texture as a cube texture.
|
|
|
+
|
|
|
this._needsFlipEnvMap = true;
|
|
|
|
|
|
}
|
|
@@ -14973,6 +14964,8 @@ function WebGLCubeMaps( renderer ) {
|
|
|
renderer.setRenderList( currentRenderList );
|
|
|
renderer.setRenderState( currentRenderState );
|
|
|
|
|
|
+ texture.addEventListener( 'dispose', onTextureDispose );
|
|
|
+
|
|
|
return mapTextureMapping( renderTarget.texture, texture.mapping );
|
|
|
|
|
|
} else {
|
|
@@ -14993,6 +14986,23 @@ function WebGLCubeMaps( renderer ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ function onTextureDispose( event ) {
|
|
|
+
|
|
|
+ const texture = event.target;
|
|
|
+
|
|
|
+ texture.removeEventListener( 'dispose', onTextureDispose );
|
|
|
+
|
|
|
+ const cubemap = cubemaps.get( texture );
|
|
|
+
|
|
|
+ if ( cubemap !== undefined ) {
|
|
|
+
|
|
|
+ cubemaps.delete( texture );
|
|
|
+ cubemap.dispose();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
function dispose() {
|
|
|
|
|
|
cubemaps = new WeakMap();
|
|
@@ -15102,7 +15112,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- bindingStates.releaseStatesOfGeometry( geometry );
|
|
|
+ bindingStates.releaseStatesOfGeometry( buffergeometry );
|
|
|
|
|
|
if ( geometry.isInstancedBufferGeometry === true ) {
|
|
|
|
|
@@ -23906,9 +23916,9 @@ function WebGLRenderer( parameters ) {
|
|
|
currentRenderState = renderStates.get( scene, camera );
|
|
|
currentRenderState.init();
|
|
|
|
|
|
- scene.traverse( function ( object ) {
|
|
|
+ scene.traverseVisible( function ( object ) {
|
|
|
|
|
|
- if ( object.isLight ) {
|
|
|
+ if ( object.isLight && object.layers.test( camera.layers ) ) {
|
|
|
|
|
|
currentRenderState.pushLight( object );
|
|
|
|
|
@@ -34350,7 +34360,7 @@ const AnimationUtils = {
|
|
|
if ( referenceClip === undefined ) referenceClip = targetClip;
|
|
|
if ( fps === undefined || fps <= 0 ) fps = 30;
|
|
|
|
|
|
- const numTracks = targetClip.tracks.length;
|
|
|
+ const numTracks = referenceClip.tracks.length;
|
|
|
const referenceTime = referenceFrame / fps;
|
|
|
|
|
|
// Make each track's values relative to the values at the reference frame
|
|
@@ -39903,9 +39913,7 @@ class SphericalHarmonics3 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- fromArray( array, offset ) {
|
|
|
-
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ fromArray( array, offset = 0 ) {
|
|
|
|
|
|
const coefficients = this.coefficients;
|
|
|
|
|
@@ -39919,10 +39927,7 @@ class SphericalHarmonics3 {
|
|
|
|
|
|
}
|
|
|
|
|
|
- toArray( array, offset ) {
|
|
|
-
|
|
|
- if ( array === undefined ) array = [];
|
|
|
- if ( offset === undefined ) offset = 0;
|
|
|
+ toArray( array = [], offset = 0 ) {
|
|
|
|
|
|
const coefficients = this.coefficients;
|
|
|
|