From 755a2284788776f9590f3ab1612a5f74d07d86a3 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 4 Mar 2016 18:10:13 +0000 Subject: [PATCH] Updated builds. --- build/three.js | 424 ++++++++++++++++++++------------------------- build/three.min.js | 290 +++++++++++++++---------------- 2 files changed, 332 insertions(+), 382 deletions(-) diff --git a/build/three.js b/build/three.js index d899b6a27e..8b4669c30a 100644 --- a/build/three.js +++ b/build/three.js @@ -26510,417 +26510,367 @@ THREE.WebGLRenderer = function ( parameters ) { } - function loadUniformsGeneric ( uniforms ) { + function loadUniform( uniform, type, location, value ) { var texture, textureUnit; - for ( var j = 0, jl = uniforms.length; j < jl; j ++ ) { - - var uniform = uniforms[ j ][ 0 ]; - - // needsUpdate property is not added to all uniforms. - if ( uniform.needsUpdate === false ) continue; - - var type = uniform.type; - var value = uniform.value; - var location = uniforms[ j ][ 1 ]; - - if ( type === '1i' ) { - - _gl.uniform1i( location, value ); + if ( type === '1i' ) { - } else if ( type === '1f' ) { + _gl.uniform1i( location, value ); - _gl.uniform1f( location, value ); + } else if ( type === '1f' ) { - } else if ( type === '2f' ) { + _gl.uniform1f( location, value ); - _gl.uniform2f( location, value[ 0 ], value[ 1 ] ); + } else if ( type === '2f' ) { - } else if ( type === '3f' ) { + _gl.uniform2f( location, value[ 0 ], value[ 1 ] ); - _gl.uniform3f( location, value[ 0 ], value[ 1 ], value[ 2 ] ); + } else if ( type === '3f' ) { - } else if ( type === '4f' ) { + _gl.uniform3f( location, value[ 0 ], value[ 1 ], value[ 2 ] ); - _gl.uniform4f( location, value[ 0 ], value[ 1 ], value[ 2 ], value[ 3 ] ); + } else if ( type === '4f' ) { - } else if ( type === '1iv' ) { + _gl.uniform4f( location, value[ 0 ], value[ 1 ], value[ 2 ], value[ 3 ] ); - _gl.uniform1iv( location, value ); + } else if ( type === '1iv' ) { - } else if ( type === '3iv' ) { + _gl.uniform1iv( location, value ); - _gl.uniform3iv( location, value ); + } else if ( type === '3iv' ) { - } else if ( type === '1fv' ) { + _gl.uniform3iv( location, value ); - _gl.uniform1fv( location, value ); + } else if ( type === '1fv' ) { - } else if ( type === '2fv' ) { + _gl.uniform1fv( location, value ); - _gl.uniform2fv( location, value ); + } else if ( type === '2fv' ) { - } else if ( type === '3fv' ) { + _gl.uniform2fv( location, value ); - _gl.uniform3fv( location, value ); + } else if ( type === '3fv' ) { - } else if ( type === '4fv' ) { + _gl.uniform3fv( location, value ); - _gl.uniform4fv( location, value ); + } else if ( type === '4fv' ) { - } else if ( type === 'Matrix2fv' ) { + _gl.uniform4fv( location, value ); - _gl.uniformMatrix2fv( location, false, value ); + } else if ( type === 'Matrix2fv' ) { - } else if ( type === 'Matrix3fv' ) { + _gl.uniformMatrix2fv( location, false, value ); - _gl.uniformMatrix3fv( location, false, value ); + } else if ( type === 'Matrix3fv' ) { - } else if ( type === 'Matrix4fv' ) { + _gl.uniformMatrix3fv( location, false, value ); - _gl.uniformMatrix4fv( location, false, value ); + } else if ( type === 'Matrix4fv' ) { - // - - } else if ( type === 'i' ) { - - // single integer - _gl.uniform1i( location, value ); + _gl.uniformMatrix4fv( location, false, value ); - } else if ( type === 'f' ) { + // - // single float - _gl.uniform1f( location, value ); + } else if ( type === 'i' ) { - } else if ( type === 'v2' ) { + // single integer + _gl.uniform1i( location, value ); - // single THREE.Vector2 - _gl.uniform2f( location, value.x, value.y ); + } else if ( type === 'f' ) { - } else if ( type === 'v3' ) { + // single float + _gl.uniform1f( location, value ); - // single THREE.Vector3 - _gl.uniform3f( location, value.x, value.y, value.z ); + } else if ( type === 'v2' ) { - } else if ( type === 'v4' ) { + // single THREE.Vector2 + _gl.uniform2f( location, value.x, value.y ); - // single THREE.Vector4 - _gl.uniform4f( location, value.x, value.y, value.z, value.w ); + } else if ( type === 'v3' ) { - } else if ( type === 'c' ) { + // single THREE.Vector3 + _gl.uniform3f( location, value.x, value.y, value.z ); - // single THREE.Color - _gl.uniform3f( location, value.r, value.g, value.b ); + } else if ( type === 'v4' ) { - /* - } else if ( type === 's' ) { + // single THREE.Vector4 + _gl.uniform4f( location, value.x, value.y, value.z, value.w ); - // TODO: Optimize this + } else if ( type === 'c' ) { - for ( var propertyName in uniform.properties ) { + // single THREE.Color + _gl.uniform3f( location, value.r, value.g, value.b ); - var property = uniform.properties[ propertyName ]; - var locationProperty = location[ propertyName ]; - var valueProperty = value[ propertyName ]; + } else if ( type === 's' ) { - type = property.type; + // TODO: Optimize this - if ( type === 'i' ) { + var properties = uniform.properties; - _gl.uniform1i( locationProperty, valueProperty ); + for ( var name in properties ) { - } else if ( type === 'f' ) { + var property = properties[ name ]; + var locationProperty = location[ name ]; + var valueProperty = value[ name ]; - _gl.uniform1f( locationProperty, valueProperty ); + loadUniform( property, property.type, locationProperty, valueProperty ); - } else if ( type === 'v2' ) { + } - _gl.uniform2f( locationProperty, valueProperty.x, valueProperty.y ); + } else if ( type === 'sa' ) { - } else if ( type === 'v3' ) { + // TODO: Optimize this - _gl.uniform3f( locationProperty, valueProperty.x, valueProperty.y, valueProperty.z ); + var properties = uniform.properties; - } else if ( type === 'v4' ) { + for ( var i = 0, l = value.length; i < l; i ++ ) { - _gl.uniform4f( locationProperty, valueProperty.x, valueProperty.y, valueProperty.z, valueProperty.w ); + for ( var name in properties ) { - } else if ( type === 'c' ) { + var property = properties[ name ]; + var locationProperty = location[ i ][ name ]; + var valueProperty = value[ i ][ name ]; - _gl.uniform3f( locationProperty, valueProperty.r, valueProperty.g, valueProperty.b ); - - } + loadUniform( property, property.type, locationProperty, valueProperty ); } + } - */ - - } else if ( type === 'sa' ) { - - // TODO: Optimize this + } else if ( type === 'iv1' ) { - for ( var i = 0; i < value.length; i ++ ) { + // flat array of integers (JS or typed array) + _gl.uniform1iv( location, value ); - for ( var propertyName in uniform.properties ) { + } else if ( type === 'iv' ) { - var property = uniform.properties[ propertyName ]; - var locationProperty = location[ i ][ propertyName ]; - var valueProperty = value[ i ][ propertyName ]; + // flat array of integers with 3 x N size (JS or typed array) + _gl.uniform3iv( location, value ); - type = property.type; + } else if ( type === 'fv1' ) { - if ( type === 'i' ) { + // flat array of floats (JS or typed array) + _gl.uniform1fv( location, value ); - _gl.uniform1i( locationProperty, valueProperty ); + } else if ( type === 'fv' ) { - } else if ( type === 'f' ) { + // flat array of floats with 3 x N size (JS or typed array) + _gl.uniform3fv( location, value ); - _gl.uniform1f( locationProperty, valueProperty ); + } else if ( type === 'v2v' ) { - } else if ( type === 'v2' ) { + // array of THREE.Vector2 - _gl.uniform2f( locationProperty, valueProperty.x, valueProperty.y ); + if ( uniform._array === undefined ) { - } else if ( type === 'v3' ) { + uniform._array = new Float32Array( 2 * value.length ); - _gl.uniform3f( locationProperty, valueProperty.x, valueProperty.y, valueProperty.z ); + } - } else if ( type === 'v4' ) { + for ( var i = 0, i2 = 0, il = value.length; i < il; i ++, i2 += 2 ) { - _gl.uniform4f( locationProperty, valueProperty.x, valueProperty.y, valueProperty.z, valueProperty.w ); + uniform._array[ i2 + 0 ] = value[ i ].x; + uniform._array[ i2 + 1 ] = value[ i ].y; - } else if ( type === 'c' ) { + } - _gl.uniform3f( locationProperty, valueProperty.r, valueProperty.g, valueProperty.b ); + _gl.uniform2fv( location, uniform._array ); - } else if ( type === 'm4' ) { + } else if ( type === 'v3v' ) { - _gl.uniformMatrix4fv( locationProperty, false, valueProperty.elements ); + // array of THREE.Vector3 - } + if ( uniform._array === undefined ) { - } + uniform._array = new Float32Array( 3 * value.length ); - } + } - } else if ( type === 'iv1' ) { + for ( var i = 0, i3 = 0, il = value.length; i < il; i ++, i3 += 3 ) { - // flat array of integers (JS or typed array) - _gl.uniform1iv( location, value ); + uniform._array[ i3 + 0 ] = value[ i ].x; + uniform._array[ i3 + 1 ] = value[ i ].y; + uniform._array[ i3 + 2 ] = value[ i ].z; - } else if ( type === 'iv' ) { + } - // flat array of integers with 3 x N size (JS or typed array) - _gl.uniform3iv( location, value ); + _gl.uniform3fv( location, uniform._array ); - } else if ( type === 'fv1' ) { + } else if ( type === 'v4v' ) { - // flat array of floats (JS or typed array) - _gl.uniform1fv( location, value ); + // array of THREE.Vector4 - } else if ( type === 'fv' ) { + if ( uniform._array === undefined ) { - // flat array of floats with 3 x N size (JS or typed array) - _gl.uniform3fv( location, value ); + uniform._array = new Float32Array( 4 * value.length ); - } else if ( type === 'v2v' ) { + } - // array of THREE.Vector2 + for ( var i = 0, i4 = 0, il = value.length; i < il; i ++, i4 += 4 ) { - if ( uniform._array === undefined ) { + uniform._array[ i4 + 0 ] = value[ i ].x; + uniform._array[ i4 + 1 ] = value[ i ].y; + uniform._array[ i4 + 2 ] = value[ i ].z; + uniform._array[ i4 + 3 ] = value[ i ].w; - uniform._array = new Float32Array( 2 * value.length ); + } - } + _gl.uniform4fv( location, uniform._array ); - for ( var i = 0, i2 = 0, il = value.length; i < il; i ++, i2 += 2 ) { + } else if ( type === 'm2' ) { - uniform._array[ i2 + 0 ] = value[ i ].x; - uniform._array[ i2 + 1 ] = value[ i ].y; + // single THREE.Matrix2 + _gl.uniformMatrix2fv( location, false, value.elements ); - } + } else if ( type === 'm3' ) { - _gl.uniform2fv( location, uniform._array ); + // single THREE.Matrix3 + _gl.uniformMatrix3fv( location, false, value.elements ); - } else if ( type === 'v3v' ) { + } else if ( type === 'm3v' ) { - // array of THREE.Vector3 + // array of THREE.Matrix3 - if ( uniform._array === undefined ) { + if ( uniform._array === undefined ) { - uniform._array = new Float32Array( 3 * value.length ); + uniform._array = new Float32Array( 9 * value.length ); - } + } - for ( var i = 0, i3 = 0, il = value.length; i < il; i ++, i3 += 3 ) { + for ( var i = 0, il = value.length; i < il; i ++ ) { - uniform._array[ i3 + 0 ] = value[ i ].x; - uniform._array[ i3 + 1 ] = value[ i ].y; - uniform._array[ i3 + 2 ] = value[ i ].z; + value[ i ].flattenToArrayOffset( uniform._array, i * 9 ); - } + } - _gl.uniform3fv( location, uniform._array ); + _gl.uniformMatrix3fv( location, false, uniform._array ); - } else if ( type === 'v4v' ) { + } else if ( type === 'm4' ) { - // array of THREE.Vector4 + // single THREE.Matrix4 + _gl.uniformMatrix4fv( location, false, value.elements ); - if ( uniform._array === undefined ) { + } else if ( type === 'm4v' ) { - uniform._array = new Float32Array( 4 * value.length ); + // array of THREE.Matrix4 - } + if ( uniform._array === undefined ) { - for ( var i = 0, i4 = 0, il = value.length; i < il; i ++, i4 += 4 ) { + uniform._array = new Float32Array( 16 * value.length ); - uniform._array[ i4 + 0 ] = value[ i ].x; - uniform._array[ i4 + 1 ] = value[ i ].y; - uniform._array[ i4 + 2 ] = value[ i ].z; - uniform._array[ i4 + 3 ] = value[ i ].w; + } - } + for ( var i = 0, il = value.length; i < il; i ++ ) { - _gl.uniform4fv( location, uniform._array ); + value[ i ].flattenToArrayOffset( uniform._array, i * 16 ); - } else if ( type === 'm2' ) { + } - // single THREE.Matrix2 - _gl.uniformMatrix2fv( location, false, value.elements ); + _gl.uniformMatrix4fv( location, false, uniform._array ); - } else if ( type === 'm3' ) { + } else if ( type === 't' ) { - // single THREE.Matrix3 - _gl.uniformMatrix3fv( location, false, value.elements ); + // single THREE.Texture (2d or cube) - } else if ( type === 'm3v' ) { + texture = value; + textureUnit = getTextureUnit(); - // array of THREE.Matrix3 + _gl.uniform1i( location, textureUnit ); - if ( uniform._array === undefined ) { + if ( ! texture ) return; - uniform._array = new Float32Array( 9 * value.length ); + if ( texture instanceof THREE.CubeTexture || + ( Array.isArray( texture.image ) && texture.image.length === 6 ) ) { - } + // CompressedTexture can have Array in image :/ - for ( var i = 0, il = value.length; i < il; i ++ ) { + setCubeTexture( texture, textureUnit ); - value[ i ].flattenToArrayOffset( uniform._array, i * 9 ); + } else if ( texture instanceof THREE.WebGLRenderTargetCube ) { - } + setCubeTextureDynamic( texture.texture, textureUnit ); - _gl.uniformMatrix3fv( location, false, uniform._array ); + } else if ( texture instanceof THREE.WebGLRenderTarget ) { - } else if ( type === 'm4' ) { + _this.setTexture( texture.texture, textureUnit ); - // single THREE.Matrix4 - _gl.uniformMatrix4fv( location, false, value.elements ); + } else { - } else if ( type === 'm4v' ) { + _this.setTexture( texture, textureUnit ); - // array of THREE.Matrix4 + } - if ( uniform._array === undefined ) { + } else if ( type === 'tv' ) { - uniform._array = new Float32Array( 16 * value.length ); + // array of THREE.Texture (2d or cube) - } + if ( uniform._array === undefined ) { - for ( var i = 0, il = value.length; i < il; i ++ ) { + uniform._array = []; - value[ i ].flattenToArrayOffset( uniform._array, i * 16 ); + } - } + for ( var i = 0, il = uniform.value.length; i < il; i ++ ) { - _gl.uniformMatrix4fv( location, false, uniform._array ); + uniform._array[ i ] = getTextureUnit(); - } else if ( type === 't' ) { + } - // single THREE.Texture (2d or cube) + _gl.uniform1iv( location, uniform._array ); - texture = value; - textureUnit = getTextureUnit(); + for ( var i = 0, il = uniform.value.length; i < il; i ++ ) { - _gl.uniform1i( location, textureUnit ); + texture = uniform.value[ i ]; + textureUnit = uniform._array[ i ]; if ( ! texture ) continue; if ( texture instanceof THREE.CubeTexture || - ( Array.isArray( texture.image ) && texture.image.length === 6 ) ) { + ( texture.image instanceof Array && texture.image.length === 6 ) ) { // CompressedTexture can have Array in image :/ setCubeTexture( texture, textureUnit ); - } else if ( texture instanceof THREE.WebGLRenderTargetCube ) { - - setCubeTextureDynamic( texture.texture, textureUnit ); - } else if ( texture instanceof THREE.WebGLRenderTarget ) { _this.setTexture( texture.texture, textureUnit ); - } else { - - _this.setTexture( texture, textureUnit ); - - } - - } else if ( type === 'tv' ) { - - // array of THREE.Texture (2d or cube) - - if ( uniform._array === undefined ) { - - uniform._array = []; + } else if ( texture instanceof THREE.WebGLRenderTargetCube ) { - } + setCubeTextureDynamic( texture.texture, textureUnit ); - for ( var i = 0, il = uniform.value.length; i < il; i ++ ) { + } else { - uniform._array[ i ] = getTextureUnit(); + _this.setTexture( texture, textureUnit ); } - _gl.uniform1iv( location, uniform._array ); - - for ( var i = 0, il = uniform.value.length; i < il; i ++ ) { - - texture = uniform.value[ i ]; - textureUnit = uniform._array[ i ]; - - if ( ! texture ) continue; - - if ( texture instanceof THREE.CubeTexture || - ( texture.image instanceof Array && texture.image.length === 6 ) ) { - - // CompressedTexture can have Array in image :/ - - setCubeTexture( texture, textureUnit ); - - } else if ( texture instanceof THREE.WebGLRenderTarget ) { + } - _this.setTexture( texture.texture, textureUnit ); + } else { - } else if ( texture instanceof THREE.WebGLRenderTargetCube ) { + console.warn( 'THREE.WebGLRenderer: Unknown uniform type: ' + type ); - setCubeTextureDynamic( texture.texture, textureUnit ); + } - } else { + } - _this.setTexture( texture, textureUnit ); + function loadUniformsGeneric( uniforms ) { - } + for ( var i = 0, l = uniforms.length; i < l; i ++ ) { - } + var uniform = uniforms[ i ][ 0 ]; - } else { + // needsUpdate property is not added to all uniforms. + if ( uniform.needsUpdate === false ) continue; - console.warn( 'THREE.WebGLRenderer: Unknown uniform type: ' + type ); + var type = uniform.type; + var location = uniforms[ i ][ 1 ]; + var value = uniform.value; - } + loadUniform( uniform, type, location, value ); } diff --git a/build/three.min.js b/build/three.min.js index d0ce720f2d..ff12c1fe83 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -105,14 +105,14 @@ c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8 d;b[1]=k+l*d;b[5]=a-p*d;b[9]=-c*g;b[2]=p-a*d;b[6]=l+k*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,k=g*e,l=d*h,p=d*e,b[0]=a+p*c,b[4]=l*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-l,b[6]=p+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,l=d*h,p=d*e,b[0]=a-p*c,b[4]=-f*e,b[8]=l+k*c,b[1]=k+l*c,b[5]=f*h,b[9]=p-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,l=c*h,p=c*e,b[0]=g*h,b[4]=l*d-k,b[8]=a*d+p,b[1]=g*e,b[5]=p*d+a,b[9]=k*d-l,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*d,l=c*g,p= c*d,b[0]=g*h,b[4]=p-a*e,b[8]=l*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+l,b[10]=a-p*e):"XZY"===a.order&&(a=f*g,k=f*d,l=c*g,p=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+p,b[5]=f*h,b[9]=k*e-l,b[2]=l*e-k,b[6]=c*h,b[10]=p*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,k=e+e;a=c*g;var l=c*h,c=c*k,p=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(p+e);b[4]=l-f;b[8]=c+h;b[1]=l+f;b[5]=1-(a+ e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+p);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a,b,c;return function(d,e,f){void 0===a&&(a=new THREE.Vector3);void 0===b&&(b=new THREE.Vector3);void 0===c&&(c=new THREE.Vector3);var g=this.elements;c.subVectors(d,e).normalize();0===c.lengthSq()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.lengthSq()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]= -c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],k=c[12],l=c[1],p=c[5],n=c[9],m=c[13],q=c[2],u=c[6],v=c[10],t=c[14],s=c[3],w=c[7],D=c[11],c=c[15],x=d[0],E=d[4],A=d[8],y=d[12],B=d[1],G=d[5],F= -d[9],z=d[13],L=d[2],K=d[6],N=d[10],M=d[14],I=d[3],O=d[7],Q=d[11],d=d[15];e[0]=f*x+g*B+h*L+k*I;e[4]=f*E+g*G+h*K+k*O;e[8]=f*A+g*F+h*N+k*Q;e[12]=f*y+g*z+h*M+k*d;e[1]=l*x+p*B+n*L+m*I;e[5]=l*E+p*G+n*K+m*O;e[9]=l*A+p*F+n*N+m*Q;e[13]=l*y+p*z+n*M+m*d;e[2]=q*x+u*B+v*L+t*I;e[6]=q*E+u*G+v*K+t*O;e[10]=q*A+u*F+v*N+t*Q;e[14]=q*y+u*z+v*M+t*d;e[3]=s*x+w*B+D*L+c*I;e[7]=s*E+w*G+D*K+c*O;e[11]=s*A+w*F+D*N+c*Q;e[15]=s*y+w*z+D*M+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a, +c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],k=c[12],l=c[1],p=c[5],n=c[9],m=c[13],q=c[2],u=c[6],v=c[10],t=c[14],s=c[3],w=c[7],E=c[11],c=c[15],x=d[0],D=d[4],z=d[8],y=d[12],A=d[1],H=d[5],F= +d[9],I=d[13],L=d[2],G=d[6],O=d[10],M=d[14],B=d[3],N=d[7],Q=d[11],d=d[15];e[0]=f*x+g*A+h*L+k*B;e[4]=f*D+g*H+h*G+k*N;e[8]=f*z+g*F+h*O+k*Q;e[12]=f*y+g*I+h*M+k*d;e[1]=l*x+p*A+n*L+m*B;e[5]=l*D+p*H+n*G+m*N;e[9]=l*z+p*F+n*O+m*Q;e[13]=l*y+p*I+n*M+m*d;e[2]=q*x+u*A+v*L+t*B;e[6]=q*D+u*H+v*G+t*N;e[10]=q*z+u*F+v*O+t*Q;e[14]=q*y+u*I+v*M+t*d;e[3]=s*x+w*A+E*L+c*B;e[7]=s*D+w*H+E*G+c*N;e[11]=s*z+w*F+E*O+c*Q;e[15]=s*y+w*I+E*M+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a, b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Vector3);void 0===c&&(c=0);void 0=== d&&(d=b.length);for(var e=0;ethis.determinant()&&(g=-g);c.x= @@ -221,14 +221,14 @@ this.merge(a.geometry,a.matrix))},mergeVertices:function(){var a={},b=[],c=[],d, 1),c=0,g=this.faceVertexUvs.length;cg;g++)m=w[k++],s=t[2*m],m=t[2*m+1],s=new THREE.Vector2(s,m),2!==g&&c.faceVertexUvs[d][h].push(s),0!==g&&c.faceVertexUvs[d][h+1].push(s);n&&(n=3*w[k++],q.normal.set(D[n++],D[n++],D[n]),v.normal.copy(q.normal));if(u)for(d=0;4>d;d++)n=3*w[k++],u=new THREE.Vector3(D[n++],D[n++],D[n]),2!==d&&q.vertexNormals.push(u),0!==d&&v.vertexNormals.push(u); -p&&(p=w[k++],p=x[p],q.color.setHex(p),v.color.setHex(p));if(b)for(d=0;4>d;d++)p=w[k++],p=x[p],2!==d&&q.vertexColors.push(new THREE.Color(p)),0!==d&&v.vertexColors.push(new THREE.Color(p));c.faces.push(q);c.faces.push(v)}else{q=new THREE.Face3;q.a=w[k++];q.b=w[k++];q.c=w[k++];h&&(h=w[k++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;dg;g++)m=w[k++],s=t[2*m],m=t[2*m+1],s=new THREE.Vector2(s,m),c.faceVertexUvs[d][h].push(s);n&&(n=3*w[k++],q.normal.set(D[n++], -D[n++],D[n]));if(u)for(d=0;3>d;d++)n=3*w[k++],u=new THREE.Vector3(D[n++],D[n++],D[n]),q.vertexNormals.push(u);p&&(p=w[k++],q.color.setHex(x[p]));if(b)for(d=0;3>d;d++)p=w[k++],q.vertexColors.push(new THREE.Color(x[p]));c.faces.push(q)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;dg;g++)m=w[k++],s=t[2*m],m=t[2*m+1],s=new THREE.Vector2(s,m),2!==g&&c.faceVertexUvs[d][h].push(s),0!==g&&c.faceVertexUvs[d][h+1].push(s);n&&(n=3*w[k++],q.normal.set(E[n++],E[n++],E[n]),v.normal.copy(q.normal));if(u)for(d=0;4>d;d++)n=3*w[k++],u=new THREE.Vector3(E[n++],E[n++],E[n]),2!==d&&q.vertexNormals.push(u),0!==d&&v.vertexNormals.push(u); +p&&(p=w[k++],p=x[p],q.color.setHex(p),v.color.setHex(p));if(b)for(d=0;4>d;d++)p=w[k++],p=x[p],2!==d&&q.vertexColors.push(new THREE.Color(p)),0!==d&&v.vertexColors.push(new THREE.Color(p));c.faces.push(q);c.faces.push(v)}else{q=new THREE.Face3;q.a=w[k++];q.b=w[k++];q.c=w[k++];h&&(h=w[k++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;dg;g++)m=w[k++],s=t[2*m],m=t[2*m+1],s=new THREE.Vector2(s,m),c.faceVertexUvs[d][h].push(s);n&&(n=3*w[k++],q.normal.set(E[n++], +E[n++],E[n]));if(u)for(d=0;3>d;d++)n=3*w[k++],u=new THREE.Vector3(E[n++],E[n++],E[n]),q.vertexNormals.push(u);p&&(p=w[k++],q.color.setHex(x[p]));if(b)for(d=0;3>d;d++)p=w[k++],q.vertexColors.push(new THREE.Color(x[p]));c.faces.push(q)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;db.far?null:{distance:c,point:s.clone(), object:a}}function c(c,d,e,f,l,p,n,s){g.fromArray(f,3*p);h.fromArray(f,3*n);k.fromArray(f,3*s);if(c=b(c,d,e,g,h,k,t))l&&(m.fromArray(l,2*p),q.fromArray(l,2*n),u.fromArray(l,2*s),c.uv=a(t,g,h,k,m,q,u)),c.face=new THREE.Face3(p,n,s,THREE.Triangle.normal(g,h,k)),c.faceIndex=p;return c}var d=new THREE.Matrix4,e=new THREE.Ray,f=new THREE.Sphere,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector2,q=new THREE.Vector2, -u=new THREE.Vector2,v=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3;return function(s,v){var x=this.geometry,E=this.material,A=this.matrixWorld;if(void 0!==E&&(null===x.boundingSphere&&x.computeBoundingSphere(),f.copy(x.boundingSphere),f.applyMatrix4(A),!1!==s.ray.intersectsSphere(f)&&(d.getInverse(A),e.copy(s.ray).applyMatrix4(d),null===x.boundingBox||!1!==e.intersectsBox(x.boundingBox)))){var y,B;if(x instanceof THREE.BufferGeometry){var G,F,E=x.index,A=x.attributes,x=A.position.array; -void 0!==A.uv&&(y=A.uv.array);if(null!==E)for(var A=E.array,z=0,L=A.length;zc;c++)r.deleteFramebuffer(b.__webglFramebuffer[c]),r.deleteRenderbuffer(b.__webglDepthbuffer[c]);else r.deleteFramebuffer(b.__webglFramebuffer),r.deleteRenderbuffer(b.__webglDepthbuffer);U.delete(a.texture); -U.delete(a)}ha.textures--}function h(a){a=a.target;a.removeEventListener("dispose",h);k(a);U.delete(a)}function k(a){var b=U.get(a).program;a.program=void 0;void 0!==b&&oa.releaseProgram(b)}function l(a,b){return Math.abs(b[0])-Math.abs(a[0])}function p(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function n(a,b){return a.object.renderOrder!==b.object.renderOrder? -a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function m(a,b,c,d,e){var g;c.transparent?(d=Y,g=++T):(d=H,g=++C);g=d[g];void 0!==g?(g.id=a.id,g.object=a,g.geometry=b,g.material=c,g.z=X.z,g.group=e):(g={id:a.id,object:a,geometry:b,material:c,z:X.z,group:e},d.push(g))}function q(a,b){if(!1!==a.visible){if(a.layers.test(b.layers))if(a instanceof THREE.Light)S.push(a);else if(a instanceof THREE.Sprite)!1!==a.frustumCulled&&!0!==ya.intersectsObject(a)||ca.push(a);else if(a instanceof -THREE.LensFlare)ia.push(a);else if(a instanceof THREE.ImmediateRenderObject)!0===W.sortObjects&&(X.setFromMatrixPosition(a.matrixWorld),X.applyProjection(sa)),m(a,null,a.material,X.z,null);else if(a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Points)if(a instanceof THREE.SkinnedMesh&&a.skeleton.update(),!1===a.frustumCulled||!0===ya.intersectsObject(a)){var c=a.material;if(!0===c.visible){!0===W.sortObjects&&(X.setFromMatrixPosition(a.matrixWorld),X.applyProjection(sa));var d= -pa.update(a);if(c instanceof THREE.MultiMaterial)for(var e=d.groups,g=c.materials,c=0,f=e.length;cc;c++)r.deleteFramebuffer(b.__webglFramebuffer[c]),r.deleteRenderbuffer(b.__webglDepthbuffer[c]);else r.deleteFramebuffer(b.__webglFramebuffer),r.deleteRenderbuffer(b.__webglDepthbuffer);U.delete(a.texture); +U.delete(a)}ia.textures--}function h(a){a=a.target;a.removeEventListener("dispose",h);k(a);U.delete(a)}function k(a){var b=U.get(a).program;a.program=void 0;void 0!==b&&oa.releaseProgram(b)}function l(a,b){return Math.abs(b[0])-Math.abs(a[0])}function p(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function n(a,b){return a.object.renderOrder!==b.object.renderOrder? +a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function m(a,b,c,d,e){var g;c.transparent?(d=S,g=++Z):(d=C,g=++Y);g=d[g];void 0!==g?(g.id=a.id,g.object=a,g.geometry=b,g.material=c,g.z=W.z,g.group=e):(g={id:a.id,object:a,geometry:b,material:c,z:W.z,group:e},d.push(g))}function q(a,b){if(!1!==a.visible){if(a.layers.test(b.layers))if(a instanceof THREE.Light)J.push(a);else if(a instanceof THREE.Sprite)!1!==a.frustumCulled&&!0!==za.intersectsObject(a)||ja.push(a);else if(a instanceof +THREE.LensFlare)ea.push(a);else if(a instanceof THREE.ImmediateRenderObject)!0===X.sortObjects&&(W.setFromMatrixPosition(a.matrixWorld),W.applyProjection(sa)),m(a,null,a.material,W.z,null);else if(a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Points)if(a instanceof THREE.SkinnedMesh&&a.skeleton.update(),!1===a.frustumCulled||!0===za.intersectsObject(a)){var c=a.material;if(!0===c.visible){!0===X.sortObjects&&(W.setFromMatrixPosition(a.matrixWorld),W.applyProjection(sa));var d= +pa.update(a);if(c instanceof THREE.MultiMaterial)for(var e=d.groups,g=c.materials,c=0,f=e.length;c=da.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+da.maxTextures);ta+=1;return a}function w(a){for(var b,c,d=0,e=a.length;db||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+ -"). Resized to "+d.width+"x"+d.height,a);return d}return a}function E(a){return THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height)}function A(a,b){var c=U.get(a);if(6===a.image.length)if(0h;h++)g[h]=!W.autoScaleCubemaps||d||e?e?a.image[h].image:a.image[h]:x(a.image[h],da.maxCubemapSize);var k=E(g[0]),l=z(a.format),m=z(a.type);D(r.TEXTURE_CUBE_MAP,a,k);for(h=0;6>h;h++)if(d)for(var n,p=g[h].mipmaps,q=0,s=p.length;qf;f++)b.__webglFramebuffer[f]=r.createFramebuffer()}else b.__webglFramebuffer=r.createFramebuffer();if(d){J.bindTexture(r.TEXTURE_CUBE_MAP,c.__webglTexture);D(r.TEXTURE_CUBE_MAP,a.texture,e);for(f= -0;6>f;f++)B(b.__webglFramebuffer[f],a,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+f);a.texture.generateMipmaps&&e&&r.generateMipmap(r.TEXTURE_CUBE_MAP);J.bindTexture(r.TEXTURE_CUBE_MAP,null)}else J.bindTexture(r.TEXTURE_2D,c.__webglTexture),D(r.TEXTURE_2D,a.texture,e),B(b.__webglFramebuffer,a,r.COLOR_ATTACHMENT0,r.TEXTURE_2D),a.texture.generateMipmaps&&e&&r.generateMipmap(r.TEXTURE_2D),J.bindTexture(r.TEXTURE_2D,null);if(a.depthBuffer){b=U.get(a);if(a instanceof THREE.WebGLRenderTargetCube)for(b.__webglDepthbuffer= -[],c=0;6>c;c++)r.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer[c]),b.__webglDepthbuffer[c]=r.createRenderbuffer(),G(b.__webglDepthbuffer[c],a);else r.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer=r.createRenderbuffer(),G(b.__webglDepthbuffer,a);r.bindFramebuffer(r.FRAMEBUFFER,null)}}b=a instanceof THREE.WebGLRenderTargetCube;a?(c=U.get(a),c=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,qa.copy(a.scissor),za=a.scissorTest,ja.copy(a.viewport)):(c=null, -qa.copy(xa).multiplyScalar($),za=Aa,ja.copy(ka).multiplyScalar($));ba!==c&&(r.bindFramebuffer(r.FRAMEBUFFER,c),ba=c);J.scissor(qa);J.setScissorTest(za);J.viewport(ja);b&&(b=U.get(a.texture),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,b.__webglTexture,0))};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===a instanceof THREE.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); -else{var g=U.get(a).__webglFramebuffer;if(g){var h=!1;g!==ba&&(r.bindFramebuffer(r.FRAMEBUFFER,g),h=!0);try{var k=a.texture;k.format!==THREE.RGBAFormat&&z(k.format)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):k.type===THREE.UnsignedByteType||z(k.type)===r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)||k.type===THREE.FloatType&&V.get("WEBGL_color_buffer_float")||k.type=== -THREE.HalfFloatType&&V.get("EXT_color_buffer_half_float")?r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE?r.readPixels(b,c,d,e,z(k.format),z(k.type),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&r.bindFramebuffer(r.FRAMEBUFFER,ba)}}}}}; +(f.envMapIntensity.value=c.envMapIntensity)):c instanceof THREE.MeshDepthMaterial?(f.mNear.value=a.near,f.mFar.value=a.far,f.opacity.value=c.opacity):c instanceof THREE.MeshNormalMaterial&&(f.opacity.value=c.opacity);E(e.uniformsList)}r.uniformMatrix4fv(n.modelViewMatrix,!1,d.modelViewMatrix.elements);n.normalMatrix&&r.uniformMatrix3fv(n.normalMatrix,!1,d.normalMatrix.elements);void 0!==n.modelMatrix&&r.uniformMatrix4fv(n.modelMatrix,!1,d.matrixWorld.elements);if(!0===e.hasDynamicUniforms){e=e.uniformsList; +c=[];q=0;for(b=e.length;q=ca.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ca.maxTextures);ta+=1;return a}function w(a,b,c,d){var e;if("1i"===b)r.uniform1i(c,d);else if("1f"===b)r.uniform1f(c,d);else if("2f"===b)r.uniform2f(c,d[0],d[1]);else if("3f"===b)r.uniform3f(c,d[0],d[1],d[2]);else if("4f"===b)r.uniform4f(c,d[0],d[1], +d[2],d[3]);else if("1iv"===b)r.uniform1iv(c,d);else if("3iv"===b)r.uniform3iv(c,d);else if("1fv"===b)r.uniform1fv(c,d);else if("2fv"===b)r.uniform2fv(c,d);else if("3fv"===b)r.uniform3fv(c,d);else if("4fv"===b)r.uniform4fv(c,d);else if("Matrix2fv"===b)r.uniformMatrix2fv(c,!1,d);else if("Matrix3fv"===b)r.uniformMatrix3fv(c,!1,d);else if("Matrix4fv"===b)r.uniformMatrix4fv(c,!1,d);else if("i"===b)r.uniform1i(c,d);else if("f"===b)r.uniform1f(c,d);else if("v2"===b)r.uniform2f(c,d.x,d.y);else if("v3"=== +b)r.uniform3f(c,d.x,d.y,d.z);else if("v4"===b)r.uniform4f(c,d.x,d.y,d.z,d.w);else if("c"===b)r.uniform3f(c,d.r,d.g,d.b);else if("s"===b){a=a.properties;for(var f in a){e=a[f];var g=c[f],h=d[f];w(e,e.type,g,h)}}else if("sa"===b){a=a.properties;b=0;for(var k=d.length;bb||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a}function z(a){return THREE.Math.isPowerOfTwo(a.width)&& +THREE.Math.isPowerOfTwo(a.height)}function y(a,b){var c=U.get(a);if(6===a.image.length)if(0h;h++)g[h]=!X.autoScaleCubemaps|| +d||e?e?a.image[h].image:a.image[h]:D(a.image[h],ca.maxCubemapSize);var k=z(g[0]),l=L(a.format),m=L(a.type);x(r.TEXTURE_CUBE_MAP,a,k);for(h=0;6>h;h++)if(d)for(var n,p=g[h].mipmaps,q=0,s=p.length;qf;f++)b.__webglFramebuffer[f]=r.createFramebuffer()}else b.__webglFramebuffer=r.createFramebuffer();if(d){K.bindTexture(r.TEXTURE_CUBE_MAP,c.__webglTexture);x(r.TEXTURE_CUBE_MAP,a.texture,e);for(f= +0;6>f;f++)H(b.__webglFramebuffer[f],a,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+f);a.texture.generateMipmaps&&e&&r.generateMipmap(r.TEXTURE_CUBE_MAP);K.bindTexture(r.TEXTURE_CUBE_MAP,null)}else K.bindTexture(r.TEXTURE_2D,c.__webglTexture),x(r.TEXTURE_2D,a.texture,e),H(b.__webglFramebuffer,a,r.COLOR_ATTACHMENT0,r.TEXTURE_2D),a.texture.generateMipmaps&&e&&r.generateMipmap(r.TEXTURE_2D),K.bindTexture(r.TEXTURE_2D,null);if(a.depthBuffer){b=U.get(a);if(a instanceof THREE.WebGLRenderTargetCube)for(b.__webglDepthbuffer= +[],c=0;6>c;c++)r.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer[c]),b.__webglDepthbuffer[c]=r.createRenderbuffer(),F(b.__webglDepthbuffer[c],a);else r.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer=r.createRenderbuffer(),F(b.__webglDepthbuffer,a);r.bindFramebuffer(r.FRAMEBUFFER,null)}}b=a instanceof THREE.WebGLRenderTargetCube;a?(c=U.get(a),c=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,qa.copy(a.scissor),Aa=a.scissorTest,ka.copy(a.viewport)):(c=null, +qa.copy(ya).multiplyScalar($),Aa=Ba,ka.copy(la).multiplyScalar($));ua!==c&&(r.bindFramebuffer(r.FRAMEBUFFER,c),ua=c);K.scissor(qa);K.setScissorTest(Aa);K.viewport(ka);b&&(b=U.get(a.texture),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,b.__webglTexture,0))};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===a instanceof THREE.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); +else{var g=U.get(a).__webglFramebuffer;if(g){var h=!1;g!==ua&&(r.bindFramebuffer(r.FRAMEBUFFER,g),h=!0);try{var k=a.texture;k.format!==THREE.RGBAFormat&&L(k.format)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):k.type===THREE.UnsignedByteType||L(k.type)===r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)||k.type===THREE.FloatType&&V.get("WEBGL_color_buffer_float")||k.type=== +THREE.HalfFloatType&&V.get("EXT_color_buffer_half_float")?r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE?r.readPixels(b,c,d,e,L(k.format),L(k.type),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&r.bindFramebuffer(r.FRAMEBUFFER,ua)}}}}}; THREE.WebGLRenderTarget=function(a,b,c){this.uuid=THREE.Math.generateUUID();this.width=a;this.height=b;this.scissor=new THREE.Vector4(0,0,a,b);this.scissorTest=!1;this.viewport=new THREE.Vector4(0,0,a,b);c=c||{};void 0===c.minFilter&&(c.minFilter=THREE.LinearFilter);this.texture=new THREE.Texture(void 0,void 0,c.wrapS,c.wrapT,c.magFilter,c.minFilter,c.format,c.type,c.anisotropy);this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0}; THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.shareDepthFrom=a.shareDepthFrom; return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube; @@ -688,22 +688,22 @@ THREE.WebGLProgram=function(){function a(a){switch(a){case THREE.LinearEncoding: a);}}function b(b,c){var d=a(c);return"vec4 "+b+"( vec4 value ) { return "+d[0]+"ToLinear"+d[1]+"; }"}function c(b,c){var d=a(c);return"vec4 "+b+"( vec4 value ) { return LinearTo"+d[0]+d[1]+"; }"}function d(a,b){var c;switch(b){case THREE.LinearToneMapping:c="Linear";break;case THREE.ReinhardToneMapping:c="Reinhard";break;case THREE.Uncharted2ToneMapping:c="Uncharted2";break;case THREE.CineonToneMapping:c="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+b);}return"vec3 "+a+ "( vec3 color ) { return "+c+"ToneMapping( color ); }"}function e(a,b,c){a=a||{};return[a.derivatives||b.envMapCubeUV||b.bumpMap||b.normalMap||b.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(a.fragDepth||b.logarithmicDepthBuffer)&&c.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",a.drawBuffers&&c.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(a.shaderTextureLOD||b.envMap)&&c.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable": ""].filter(g).join("\n")}function f(a){var b=[],c;for(c in a){var d=a[c];!1!==d&&b.push("#define "+c+" "+d)}return b.join("\n")}function g(a){return""!==a}function h(a,b){return a.replace(/NUM_DIR_LIGHTS/g,b.numDirLights).replace(/NUM_SPOT_LIGHTS/g,b.numSpotLights).replace(/NUM_POINT_LIGHTS/g,b.numPointLights).replace(/NUM_HEMI_LIGHTS/g,b.numHemiLights)}function k(a){return a.replace(/#include +<([\w\d.]+)>/g,function(a,b){var c=THREE.ShaderChunk[b];if(void 0===c)throw Error("Can not resolve #include <"+ -b+">");return k(c)})}function l(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,b,c,d){a="";for(b=parseInt(b);b");return k(c)})}function l(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,b,c,d){a="";for(b=parseInt(b);b 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); -x.compileShader(I);x.compileShader(O);x.attachShader(M,I);x.attachShader(M,O);x.linkProgram(M);B=M;s=x.getAttribLocation(B,"position");w=x.getAttribLocation(B,"uv");c=x.getUniformLocation(B,"uvOffset");d=x.getUniformLocation(B,"uvScale");e=x.getUniformLocation(B,"rotation");f=x.getUniformLocation(B,"scale");g=x.getUniformLocation(B,"color");h=x.getUniformLocation(B,"map");k=x.getUniformLocation(B,"opacity");l=x.getUniformLocation(B,"modelViewMatrix");p=x.getUniformLocation(B,"projectionMatrix");n= -x.getUniformLocation(B,"fogType");m=x.getUniformLocation(B,"fogDensity");q=x.getUniformLocation(B,"fogNear");u=x.getUniformLocation(B,"fogFar");v=x.getUniformLocation(B,"fogColor");t=x.getUniformLocation(B,"alphaTest");M=document.createElement("canvas");M.width=8;M.height=8;I=M.getContext("2d");I.fillStyle="white";I.fillRect(0,0,8,8);G=new THREE.Texture(M);G.needsUpdate=!0}x.useProgram(B);E.initAttributes();E.enableAttribute(s);E.enableAttribute(w);E.disableUnusedAttributes();E.disable(x.CULL_FACE); -E.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,A);x.vertexAttribPointer(s,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(w,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,y);x.uniformMatrix4fv(p,!1,N.projectionMatrix.elements);E.activeTexture(x.TEXTURE0);x.uniform1i(h,0);I=M=0;(O=K.fog)?(x.uniform3f(v,O.color.r,O.color.g,O.color.b),O instanceof THREE.Fog?(x.uniform1f(q,O.near),x.uniform1f(u,O.far),x.uniform1i(n,1),I=M=1):O instanceof THREE.FogExp2&&(x.uniform1f(m,O.density),x.uniform1i(n,2),I=M=2)): -(x.uniform1i(n,0),I=M=0);for(var O=0,Q=b.length;O 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); +x.compileShader(B);x.compileShader(N);x.attachShader(M,B);x.attachShader(M,N);x.linkProgram(M);A=M;s=x.getAttribLocation(A,"position");w=x.getAttribLocation(A,"uv");c=x.getUniformLocation(A,"uvOffset");d=x.getUniformLocation(A,"uvScale");e=x.getUniformLocation(A,"rotation");f=x.getUniformLocation(A,"scale");g=x.getUniformLocation(A,"color");h=x.getUniformLocation(A,"map");k=x.getUniformLocation(A,"opacity");l=x.getUniformLocation(A,"modelViewMatrix");p=x.getUniformLocation(A,"projectionMatrix");n= +x.getUniformLocation(A,"fogType");m=x.getUniformLocation(A,"fogDensity");q=x.getUniformLocation(A,"fogNear");u=x.getUniformLocation(A,"fogFar");v=x.getUniformLocation(A,"fogColor");t=x.getUniformLocation(A,"alphaTest");M=document.createElement("canvas");M.width=8;M.height=8;B=M.getContext("2d");B.fillStyle="white";B.fillRect(0,0,8,8);H=new THREE.Texture(M);H.needsUpdate=!0}x.useProgram(A);D.initAttributes();D.enableAttribute(s);D.enableAttribute(w);D.disableUnusedAttributes();D.disable(x.CULL_FACE); +D.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,z);x.vertexAttribPointer(s,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(w,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,y);x.uniformMatrix4fv(p,!1,O.projectionMatrix.elements);D.activeTexture(x.TEXTURE0);x.uniform1i(h,0);B=M=0;(N=G.fog)?(x.uniform3f(v,N.color.r,N.color.g,N.color.b),N instanceof THREE.Fog?(x.uniform1f(q,N.near),x.uniform1f(u,N.far),x.uniform1i(n,1),B=M=1):N instanceof THREE.FogExp2&&(x.uniform1f(m,N.density),x.uniform1i(n,2),B=M=2)): +(x.uniform1i(n,0),B=M=0);for(var N=0,Q=b.length;Nc)return null;var d=[],e=[],f=[],g,h,k;if(0=l--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}g=h;c<=g&&(g=0);h=g+1;c<=h&&(h=0);k=h+1;c<=k&&(k=0);var p;a:{var n= -p=void 0,m=void 0,q=void 0,u=void 0,v=void 0,t=void 0,s=void 0,w=void 0,n=a[e[g]].x,m=a[e[g]].y,q=a[e[h]].x,u=a[e[h]].y,v=a[e[k]].x,t=a[e[k]].y;if(Number.EPSILON>(q-n)*(t-m)-(u-m)*(v-n))p=!1;else{var D=void 0,x=void 0,E=void 0,A=void 0,y=void 0,B=void 0,G=void 0,F=void 0,z=void 0,L=void 0,z=F=G=w=s=void 0,D=v-q,x=t-u,E=n-v,A=m-t,y=q-n,B=u-m;for(p=0;p=-Number.EPSILON&& -F>=-Number.EPSILON&&G>=-Number.EPSILON)){p=!1;break a}p=!0}}if(p){d.push([a[e[g]],a[e[h]],a[e[k]]]);f.push([e[g],e[h],e[k]]);g=h;for(k=h+1;kNumber.EPSILON){if(0B||B> -y)return[];k=l*n-k*p;if(0>k||k>y)return[]}else{if(0(q-n)*(t-m)-(u-m)*(v-n))p=!1;else{var E=void 0,x=void 0,D=void 0,z=void 0,y=void 0,A=void 0,H=void 0,F=void 0,I=void 0,L=void 0,I=F=H=w=s=void 0,E=v-q,x=t-u,D=n-v,z=m-t,y=q-n,A=u-m;for(p=0;p=-Number.EPSILON&& +F>=-Number.EPSILON&&H>=-Number.EPSILON)){p=!1;break a}p=!0}}if(p){d.push([a[e[g]],a[e[h]],a[e[k]]]);f.push([e[g],e[h],e[k]]);g=h;for(k=h+1;kNumber.EPSILON){if(0A||A> +y)return[];k=l*n-k*p;if(0>k||k>y)return[]}else{if(0d?[]:k===d?f?[]:[g]:a<=d?[g,h]:[g,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return Math.abs(a)>Number.EPSILON?(b=g*c-d*b,0f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1;d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;cN){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(p=F;ph;h++)l=k[h].x+":"+k[h].y,l=p[l],void 0!==l&&(k[h]=l);return n.concat()},isClockWise:function(a){return 0>THREE.ShapeUtils.area(a)},b2:function(){return function(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}}(),b3:function(){return function(a,b,c,d,e){var f= +h=0;hO){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(p=F;ph;h++)l=k[h].x+":"+k[h].y,l=p[l],void 0!==l&&(k[h]=l);return n.concat()},isClockWise:function(a){return 0>THREE.ShapeUtils.area(a)},b2:function(){return function(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}}(),b3:function(){return function(a,b,c,d,e){var f= 1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}}()};THREE.Curve=function(){}; THREE.Curve.prototype={constructor:THREE.Curve,getPoint:function(a){console.warn("THREE.Curve: Warning, getPoint() not implemented!");return null},getPointAt:function(a){a=this.getUtoTmapping(a);return this.getPoint(a)},getPoints:function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c},getSpacedPoints:function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c},getLength:function(){var a=this.getLengths();return a[a.length-1]},getLengths:function(a){a|| (a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length===a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b},updateArcLengths:function(){this.needsUpdate=!0;this.getLengths()},getUtoTmapping:function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e- @@ -809,8 +809,8 @@ THREE.Curve.create=function(a,b){a.prototype=Object.create(THREE.Curve.prototype THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),d=0;d=b)return a=this.curves[d],b=1-(c[d]-b)/a.getLength(),a.getPointAt(b);d++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]}; THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,c=0,d=this.curves.length;cNumber.EPSILON){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x|| g.x<=a.x&&a.x<=h.x))return!0}return d}var e=THREE.ShapeUtils.isClockWise,f=function(a){for(var b=[],c=new THREE.Path,d=0,e=a.length;dh&&(h=1);1E-4>k&&(k=h);1E-4>m&&(m=h);c.initNonuniformCatmullRom(l.x,p.x,n.x,g.x,k,h,m);d.initNonuniformCatmullRom(l.y,p.y,n.y,g.y,k,h,m);e.initNonuniformCatmullRom(l.z,p.z,n.z,g.z,k,h,m)}else"catmullrom"===this.type&&(k=void 0!==this.tension?this.tension:.5,c.initCatmullRom(l.x,p.x,n.x,g.x, k),d.initCatmullRom(l.y,p.y,n.y,g.y,k),e.initCatmullRom(l.z,p.z,n.z,g.z,k));return new THREE.Vector3(c.calc(a),d.calc(a),e.calc(a))})}();THREE.ClosedSplineCurve3=function(a){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3.");THREE.CatmullRomCurve3.call(this,a);this.type="catmullrom";this.closed=!0};THREE.ClosedSplineCurve3.prototype=Object.create(THREE.CatmullRomCurve3.prototype); THREE.BoxGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new THREE.BoxBufferGeometry(a,b,c,d,e,f));this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry;THREE.CubeGeometry=THREE.BoxGeometry; -THREE.BoxBufferGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,k,l,L,K){var N=f/l,M=g/L,I=f/2,O=g/2,Q=k/2;g=l+1;for(var P=L+1,S=f=0,H=new THREE.Vector3,C=0;Cm;m++){e[0]=n[g[m]];e[1]=n[g[(m+1)%3]];e.sort(c);var q=e.toString();void 0===f[q]?f[q]={vert1:e[0],vert2:e[1],face1:l, face2:void 0}:f[q].face2=l}e=[];for(q in f)if(g=f[q],void 0===g.face2||h[g.face1].normal.dot(h[g.face2].normal)<=d)l=k[g.vert1],e.push(l.x),e.push(l.y),e.push(l.z),l=k[g.vert2],e.push(l.x),e.push(l.y),e.push(l.z);this.addAttribute("position",new THREE.BufferAttribute(new Float32Array(e),3))};THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry; THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=Array.isArray(a)?a:[a],this.addShapeList(a,b),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;dNumber.EPSILON){var k=Math.sqrt(h),l=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/l-h)*g-(c.y+f/l-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,d>Number.EPSILON? -f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(C=a.length;0<=--C;){c=C;d=C-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*p,e=0;eNumber.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(C=a.length;0<=--C;){c=C;d=C-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*p,e=0;eMath.abs(b.y-c.y)?[new THREE.Vector2(b.x,1-b.z),new THREE.Vector2(c.x,1-c.z),new THREE.Vector2(d.x,1-d.z),new THREE.Vector2(e.x,1-e.z)]:[new THREE.Vector2(b.y,1-b.z),new THREE.Vector2(c.y,1-c.z),new THREE.Vector2(d.y, 1-d.z),new THREE.Vector2(e.y,1-e.z)]}};THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);this.type="ShapeGeometry";!1===Array.isArray(a)&&(a=[a]);this.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry;THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c