浏览代码

Merge pull request #5348 from makemepulse/bb_tex_warn

improve compressed texture availability check
Mr.doob 11 年之前
父节点
当前提交
b9ef752736
共有 3 个文件被更改,包括 133 次插入96 次删除
  1. 24 5
      build/three.js
  2. 86 86
      build/three.min.js
  3. 23 5
      src/renderers/WebGLRenderer.js

+ 24 - 5
build/three.js

@@ -17605,7 +17605,18 @@ THREE.WebGLRenderer = function ( parameters ) {
 	var _supportsVertexTextures = ( _maxVertexTextures > 0 );
 	var _supportsBoneTextures = _supportsVertexTextures && _glExtensionTextureFloat;
 
-	var _compressedTextureFormats = ( _glExtensionCompressedTexturePVRTC || _glExtensionCompressedTextureS3TC ) ? _gl.getParameter( _gl.COMPRESSED_TEXTURE_FORMATS ) : [];
+	// COMPRESSED_TEXTURE_FORMATS return IntArray
+	// but we need Array.indexOf to test formats availabilities
+
+	var _compressedTextureFormats = [];
+
+	if( _glExtensionCompressedTexturePVRTC || _glExtensionCompressedTextureS3TC ) {
+		var compressedfmts = _gl.getParameter( _gl.COMPRESSED_TEXTURE_FORMATS );
+		for( var i = 0; i < compressedfmts.length; i++ ){
+			_compressedTextureFormats.push( compressedfmts[i] );
+		}
+	}
+
 
 	//
 
@@ -22981,7 +22992,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				mipmap = mipmaps[ i ];
 				if ( texture.format !== THREE.RGBAFormat ) {
-					_gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
+					if ( _compressedTextureFormats.indexOf( glFormat ) > -1 ) {
+						_gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
+					} else {
+						console.warn( "Attempt to load unsupported compressed texture format" );
+					}
 				} else {
 					_gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
 				}
@@ -23124,7 +23139,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 							mipmap = mipmaps[ j ];
 							if ( texture.format !== THREE.RGBAFormat ) {
 
-								_gl.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
+								if ( _compressedTextureFormats.indexOf( glFormat ) > -1 ) {
+									_gl.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
+								} else {
+									console.warn( "Attempt to load unsupported compressed texture format" );
+								}
 
 							} else {
 								_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
@@ -23431,7 +23450,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		if ( p === THREE.OneMinusDstColorFactor ) return _gl.ONE_MINUS_DST_COLOR;
 		if ( p === THREE.SrcAlphaSaturateFactor ) return _gl.SRC_ALPHA_SATURATE;
 
-		if ( _glExtensionCompressedTextureS3TC !== undefined ) {
+		if ( _glExtensionCompressedTextureS3TC !== null ) {
 
 			if ( p === THREE.RGB_S3TC_DXT1_Format ) return _glExtensionCompressedTextureS3TC.COMPRESSED_RGB_S3TC_DXT1_EXT;
 			if ( p === THREE.RGBA_S3TC_DXT1_Format ) return _glExtensionCompressedTextureS3TC.COMPRESSED_RGBA_S3TC_DXT1_EXT;
@@ -23440,7 +23459,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		if ( _glExtensionCompressedTexturePVRTC !== undefined ) {
+		if ( _glExtensionCompressedTexturePVRTC !== null ) {
 
 			if ( p === THREE.RGB_PVRTC_4BPPV1_Format  ) return _glExtensionCompressedTexturePVRTC.COMPRESSED_RGB_PVRTC_4BPPV1_IMG  ;
 			if ( p === THREE.RGB_PVRTC_2BPPV1_Format  ) return _glExtensionCompressedTexturePVRTC.COMPRESSED_RGB_PVRTC_2BPPV1_IMG  ;

+ 86 - 86
build/three.min.js

@@ -430,132 +430,132 @@ function c(a,b){var c=b.geometry,e=a.faces3,f=3*e.length,g=1*e.length,h=3*e.leng
 f));c=null!==Fb&&21845<g?Uint32Array:Uint16Array;a.__typeArray=c;a.__faceArray=new c(3*g);a.__lineArray=new c(2*h);var k;if(a.numMorphTargets)for(a.__morphTargetsArrays=[],c=0,k=a.numMorphTargets;c<k;c++)a.__morphTargetsArrays.push(new Float32Array(3*f));if(a.numMorphNormals)for(a.__morphNormalsArrays=[],c=0,k=a.numMorphNormals;c<k;c++)a.__morphNormalsArrays.push(new Float32Array(3*f));a.__webglFaceCount=3*g;a.__webglLineCount=2*h;if(e.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=
 []);for(var m in e.attributes){var g=e.attributes[m],h={},n;for(n in g)h[n]=g[n];if(!h.__webglInitialized||h.createUniqueBuffers)h.__webglInitialized=!0,c=1,"v2"===h.type?c=2:"v3"===h.type?c=3:"v4"===h.type?c=4:"c"===h.type&&(c=3),h.size=c,h.array=new Float32Array(f*c),h.buffer=l.createBuffer(),h.buffer.belongsToAttribute=m,g.needsUpdate=!0,h.__original=g;a.__webglCustomAttributesList.push(h)}}a.__inittedArrays=!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:
 a.material}function e(a,b,c,d){c=c.attributes;var e=b.attributes;b=b.attributesKeys;for(var g=0,k=b.length;g<k;g++){var m=b[g],n=e[m];if(0<=n){var r=c[m];void 0!==r?(m=r.itemSize,l.bindBuffer(l.ARRAY_BUFFER,r.buffer),f(n),l.vertexAttribPointer(n,m,l.FLOAT,!1,0,d*m*4)):void 0!==a.defaultAttributeValues&&(2===a.defaultAttributeValues[m].length?l.vertexAttrib2fv(n,a.defaultAttributeValues[m]):3===a.defaultAttributeValues[m].length&&l.vertexAttrib3fv(n,a.defaultAttributeValues[m]))}}h()}function g(){for(var a=
-0,b=rb.length;a<b;a++)rb[a]=0}function f(a){rb[a]=1;0===Gb[a]&&(l.enableVertexAttribArray(a),Gb[a]=1)}function h(){for(var a=0,b=Gb.length;a<b;a++)Gb[a]!==rb[a]&&(l.disableVertexAttribArray(a),Gb[a]=0)}function k(a,b){return a.material.id!==b.material.id?b.material.id-a.material.id:a.z!==b.z?b.z-a.z:a.id-b.id}function m(a,b){return a.z!==b.z?a.z-b.z:a.id-b.id}function n(a,b){return b[0]-a[0]}function q(a,e,f){if(!1!==e.visible){e instanceof THREE.Light&&Ga.push(e);if(!(e instanceof THREE.Scene)){void 0===
+0,b=sb.length;a<b;a++)sb[a]=0}function f(a){sb[a]=1;0===Gb[a]&&(l.enableVertexAttribArray(a),Gb[a]=1)}function h(){for(var a=0,b=Gb.length;a<b;a++)Gb[a]!==sb[a]&&(l.disableVertexAttribArray(a),Gb[a]=0)}function k(a,b){return a.material.id!==b.material.id?b.material.id-a.material.id:a.z!==b.z?b.z-a.z:a.id-b.id}function m(a,b){return a.z!==b.z?a.z-b.z:a.id-b.id}function n(a,b){return b[0]-a[0]}function q(a,e,f){if(!1!==e.visible){e instanceof THREE.Light&&Ga.push(e);if(!(e instanceof THREE.Scene)){void 0===
 e.__webglInit&&(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrix=new THREE.Matrix3,e.addEventListener("removed",Ec));var g=e.geometry;if(void 0!==g&&void 0===g.__webglInit&&(g.__webglInit=!0,g.addEventListener("dispose",Fc),!(g instanceof THREE.BufferGeometry)))if(e instanceof THREE.Mesh)v(a,e,g);else if(e instanceof THREE.Line){if(!g.__webglVertexBuffer){g.__webglVertexBuffer=l.createBuffer();g.__webglColorBuffer=l.createBuffer();g.__webglLineDistanceBuffer=l.createBuffer();
 I.info.memory.geometries++;var h=g.vertices.length;g.__vertexArray=new Float32Array(3*h);g.__colorArray=new Float32Array(3*h);g.__lineDistanceArray=new Float32Array(1*h);g.__webglLineCount=h;b(g,e);g.verticesNeedUpdate=!0;g.colorsNeedUpdate=!0;g.lineDistancesNeedUpdate=!0}}else if(e instanceof THREE.PointCloud&&!g.__webglVertexBuffer){g.__webglVertexBuffer=l.createBuffer();g.__webglColorBuffer=l.createBuffer();I.info.memory.geometries++;var k=g.vertices.length;g.__vertexArray=new Float32Array(3*k);
 g.__colorArray=new Float32Array(3*k);g.__sortArray=[];g.__webglParticleCount=k;b(g,e);g.verticesNeedUpdate=!0;g.colorsNeedUpdate=!0}if(void 0===e.__webglActive){if(e instanceof THREE.Mesh)if(g instanceof THREE.BufferGeometry)w(Ta,g,e);else{if(g instanceof THREE.Geometry)for(var m=0,r=g.geometryGroupsList.length;m<r;m++)w(Ta,g.geometryGroupsList[m],e)}else e instanceof THREE.Line||e instanceof THREE.PointCloud?w(Ta,g,e):(e instanceof THREE.ImmediateRenderObject||e.immediateRenderCallback)&&Ca.push({id:null,
 object:e,opaque:null,transparent:null,z:0});e.__webglActive=!0}var s=Ta[e.id];if(s&&(!1===e.frustumCulled||!0===Ac.intersectsObject(e))){var p=e.geometry,t,x,y;if(p instanceof THREE.BufferGeometry)for(var B=p.attributes,C=p.attributesKeys,G=0,D=C.length;G<D;G++){var N=C[G],L=B[N];void 0===L.buffer&&(L.buffer=l.createBuffer(),L.needsUpdate=!0);if(!0===L.needsUpdate){var J="index"===N?l.ELEMENT_ARRAY_BUFFER:l.ARRAY_BUFFER;l.bindBuffer(J,L.buffer);l.bufferData(J,L.array,l.STATIC_DRAW);L.needsUpdate=
 !1}}else if(e instanceof THREE.Mesh){(p.buffersNeedUpdate||p.groupsNeedUpdate)&&v(a,e,p);for(var Q=0,S=p.geometryGroupsList.length;Q<S;Q++)if(t=p.geometryGroupsList[Q],y=d(e,t),(p.buffersNeedUpdate||p.groupsNeedUpdate)&&c(t,e),x=y.attributes&&u(y),p.verticesNeedUpdate||p.morphTargetsNeedUpdate||p.elementsNeedUpdate||p.uvsNeedUpdate||p.normalsNeedUpdate||p.colorsNeedUpdate||p.tangentsNeedUpdate||x){var E=t,K=l.DYNAMIC_DRAW,ta=!p.dynamic,R=y;if(E.__inittedArrays){var V=R&&void 0!==R.shading&&R.shading===
-THREE.SmoothShading,M=void 0,P=void 0,Ja=void 0,W=void 0,da=void 0,wa=void 0,Na=void 0,la=void 0,va=void 0,sa=void 0,xa=void 0,X=void 0,Y=void 0,Z=void 0,ra=void 0,ha=void 0,Ia=void 0,oa=void 0,O=void 0,tb=void 0,ma=void 0,nc=void 0,ka=void 0,oc=void 0,pc=void 0,qc=void 0,Aa=void 0,Ea=void 0,Fa=void 0,ga=void 0,Xa=void 0,qb=void 0,ua=void 0,Bc=void 0,Oa=void 0,Tb=void 0,$a=void 0,mb=void 0,Hb=void 0,Mb=void 0,gb=0,Ya=0,rc=0,sc=0,vb=0,Za=0,Pa=0,ab=0,Ka=0,fa=0,qa=0,F=0,La=void 0,bb=E.__vertexArray,
-Nb=E.__uvArray,wb=E.__uv2Array,cb=E.__normalArray,ya=E.__tangentArray,Ma=E.__colorArray,pa=E.__skinIndexArray,Ba=E.__skinWeightArray,ec=E.__morphTargetsArrays,hb=E.__morphNormalsArrays,xb=E.__webglCustomAttributesList,z=void 0,uc=E.__faceArray,Sa=E.__lineArray,Ha=e.geometry,db=Ha.elementsNeedUpdate,yb=Ha.uvsNeedUpdate,eb=Ha.normalsNeedUpdate,Rc=Ha.tangentsNeedUpdate,Gb=Ha.colorsNeedUpdate,ea=Ha.morphTargetsNeedUpdate,Cc=Ha.vertices,H=E.faces3,$=Ha.faces,aa=Ha.faceVertexUvs[0],Ua=Ha.faceVertexUvs[1],
+THREE.SmoothShading,M=void 0,P=void 0,Ja=void 0,W=void 0,da=void 0,wa=void 0,Na=void 0,la=void 0,va=void 0,sa=void 0,xa=void 0,X=void 0,Y=void 0,Z=void 0,ra=void 0,ha=void 0,Ia=void 0,oa=void 0,O=void 0,tb=void 0,ma=void 0,oc=void 0,ka=void 0,pc=void 0,qc=void 0,rc=void 0,Aa=void 0,Ea=void 0,Fa=void 0,ga=void 0,Xa=void 0,rb=void 0,ua=void 0,Bc=void 0,Oa=void 0,Tb=void 0,$a=void 0,mb=void 0,Hb=void 0,Mb=void 0,gb=0,Ya=0,sc=0,tc=0,vb=0,Za=0,Pa=0,ab=0,Ka=0,fa=0,qa=0,F=0,La=void 0,bb=E.__vertexArray,
+Nb=E.__uvArray,wb=E.__uv2Array,cb=E.__normalArray,ya=E.__tangentArray,Ma=E.__colorArray,pa=E.__skinIndexArray,Ba=E.__skinWeightArray,ec=E.__morphTargetsArrays,hb=E.__morphNormalsArrays,xb=E.__webglCustomAttributesList,z=void 0,vc=E.__faceArray,Sa=E.__lineArray,Ha=e.geometry,db=Ha.elementsNeedUpdate,yb=Ha.uvsNeedUpdate,eb=Ha.normalsNeedUpdate,Uc=Ha.tangentsNeedUpdate,Gb=Ha.colorsNeedUpdate,ea=Ha.morphTargetsNeedUpdate,Cc=Ha.vertices,H=E.faces3,$=Ha.faces,aa=Ha.faceVertexUvs[0],Ua=Ha.faceVertexUvs[1],
 za=Ha.skinIndices,Yb=Ha.skinWeights,Zb=Ha.morphTargets,$b=Ha.morphNormals;if(Ha.verticesNeedUpdate){M=0;for(P=H.length;M<P;M++)W=$[H[M]],X=Cc[W.a],Y=Cc[W.b],Z=Cc[W.c],bb[Ya]=X.x,bb[Ya+1]=X.y,bb[Ya+2]=X.z,bb[Ya+3]=Y.x,bb[Ya+4]=Y.y,bb[Ya+5]=Y.z,bb[Ya+6]=Z.x,bb[Ya+7]=Z.y,bb[Ya+8]=Z.z,Ya+=9;l.bindBuffer(l.ARRAY_BUFFER,E.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,bb,K)}if(ea)for(Oa=0,Tb=Zb.length;Oa<Tb;Oa++){M=qa=0;for(P=H.length;M<P;M++)Hb=H[M],W=$[Hb],X=Zb[Oa].vertices[W.a],Y=Zb[Oa].vertices[W.b],
 Z=Zb[Oa].vertices[W.c],$a=ec[Oa],$a[qa]=X.x,$a[qa+1]=X.y,$a[qa+2]=X.z,$a[qa+3]=Y.x,$a[qa+4]=Y.y,$a[qa+5]=Y.z,$a[qa+6]=Z.x,$a[qa+7]=Z.y,$a[qa+8]=Z.z,R.morphNormals&&(V?(Mb=$b[Oa].vertexNormals[Hb],oa=Mb.a,O=Mb.b,tb=Mb.c):tb=O=oa=$b[Oa].faceNormals[Hb],mb=hb[Oa],mb[qa]=oa.x,mb[qa+1]=oa.y,mb[qa+2]=oa.z,mb[qa+3]=O.x,mb[qa+4]=O.y,mb[qa+5]=O.z,mb[qa+6]=tb.x,mb[qa+7]=tb.y,mb[qa+8]=tb.z),qa+=9;l.bindBuffer(l.ARRAY_BUFFER,E.__webglMorphTargetsBuffers[Oa]);l.bufferData(l.ARRAY_BUFFER,ec[Oa],K);R.morphNormals&&
-(l.bindBuffer(l.ARRAY_BUFFER,E.__webglMorphNormalsBuffers[Oa]),l.bufferData(l.ARRAY_BUFFER,hb[Oa],K))}if(Yb.length){M=0;for(P=H.length;M<P;M++)W=$[H[M]],oc=Yb[W.a],pc=Yb[W.b],qc=Yb[W.c],Ba[fa]=oc.x,Ba[fa+1]=oc.y,Ba[fa+2]=oc.z,Ba[fa+3]=oc.w,Ba[fa+4]=pc.x,Ba[fa+5]=pc.y,Ba[fa+6]=pc.z,Ba[fa+7]=pc.w,Ba[fa+8]=qc.x,Ba[fa+9]=qc.y,Ba[fa+10]=qc.z,Ba[fa+11]=qc.w,Aa=za[W.a],Ea=za[W.b],Fa=za[W.c],pa[fa]=Aa.x,pa[fa+1]=Aa.y,pa[fa+2]=Aa.z,pa[fa+3]=Aa.w,pa[fa+4]=Ea.x,pa[fa+5]=Ea.y,pa[fa+6]=Ea.z,pa[fa+7]=Ea.w,pa[fa+
-8]=Fa.x,pa[fa+9]=Fa.y,pa[fa+10]=Fa.z,pa[fa+11]=Fa.w,fa+=12;0<fa&&(l.bindBuffer(l.ARRAY_BUFFER,E.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,pa,K),l.bindBuffer(l.ARRAY_BUFFER,E.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,Ba,K))}if(Gb){M=0;for(P=H.length;M<P;M++)W=$[H[M]],Na=W.vertexColors,la=W.color,3===Na.length&&R.vertexColors===THREE.VertexColors?(ma=Na[0],nc=Na[1],ka=Na[2]):ka=nc=ma=la,Ma[Ka]=ma.r,Ma[Ka+1]=ma.g,Ma[Ka+2]=ma.b,Ma[Ka+3]=nc.r,Ma[Ka+4]=nc.g,Ma[Ka+5]=nc.b,Ma[Ka+6]=
-ka.r,Ma[Ka+7]=ka.g,Ma[Ka+8]=ka.b,Ka+=9;0<Ka&&(l.bindBuffer(l.ARRAY_BUFFER,E.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,Ma,K))}if(Rc&&Ha.hasTangents){M=0;for(P=H.length;M<P;M++)W=$[H[M]],va=W.vertexTangents,ra=va[0],ha=va[1],Ia=va[2],ya[Pa]=ra.x,ya[Pa+1]=ra.y,ya[Pa+2]=ra.z,ya[Pa+3]=ra.w,ya[Pa+4]=ha.x,ya[Pa+5]=ha.y,ya[Pa+6]=ha.z,ya[Pa+7]=ha.w,ya[Pa+8]=Ia.x,ya[Pa+9]=Ia.y,ya[Pa+10]=Ia.z,ya[Pa+11]=Ia.w,Pa+=12;l.bindBuffer(l.ARRAY_BUFFER,E.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,ya,K)}if(eb){M=
-0;for(P=H.length;M<P;M++)if(W=$[H[M]],da=W.vertexNormals,wa=W.normal,3===da.length&&V)for(ga=0;3>ga;ga++)qb=da[ga],cb[Za]=qb.x,cb[Za+1]=qb.y,cb[Za+2]=qb.z,Za+=3;else for(ga=0;3>ga;ga++)cb[Za]=wa.x,cb[Za+1]=wa.y,cb[Za+2]=wa.z,Za+=3;l.bindBuffer(l.ARRAY_BUFFER,E.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,cb,K)}if(yb&&aa){M=0;for(P=H.length;M<P;M++)if(Ja=H[M],sa=aa[Ja],void 0!==sa)for(ga=0;3>ga;ga++)ua=sa[ga],Nb[rc]=ua.x,Nb[rc+1]=ua.y,rc+=2;0<rc&&(l.bindBuffer(l.ARRAY_BUFFER,E.__webglUVBuffer),
-l.bufferData(l.ARRAY_BUFFER,Nb,K))}if(yb&&Ua){M=0;for(P=H.length;M<P;M++)if(Ja=H[M],xa=Ua[Ja],void 0!==xa)for(ga=0;3>ga;ga++)Bc=xa[ga],wb[sc]=Bc.x,wb[sc+1]=Bc.y,sc+=2;0<sc&&(l.bindBuffer(l.ARRAY_BUFFER,E.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,wb,K))}if(db){M=0;for(P=H.length;M<P;M++)uc[vb]=gb,uc[vb+1]=gb+1,uc[vb+2]=gb+2,vb+=3,Sa[ab]=gb,Sa[ab+1]=gb+1,Sa[ab+2]=gb,Sa[ab+3]=gb+2,Sa[ab+4]=gb+1,Sa[ab+5]=gb+2,ab+=6,gb+=3;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,E.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,
-uc,K);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,E.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Sa,K)}if(xb)for(ga=0,Xa=xb.length;ga<Xa;ga++)if(z=xb[ga],z.__original.needsUpdate){F=0;if(1===z.size)if(void 0===z.boundTo||"vertices"===z.boundTo)for(M=0,P=H.length;M<P;M++)W=$[H[M]],z.array[F]=z.value[W.a],z.array[F+1]=z.value[W.b],z.array[F+2]=z.value[W.c],F+=3;else{if("faces"===z.boundTo)for(M=0,P=H.length;M<P;M++)La=z.value[H[M]],z.array[F]=La,z.array[F+1]=La,z.array[F+2]=La,F+=3}else if(2===z.size)if(void 0===
+(l.bindBuffer(l.ARRAY_BUFFER,E.__webglMorphNormalsBuffers[Oa]),l.bufferData(l.ARRAY_BUFFER,hb[Oa],K))}if(Yb.length){M=0;for(P=H.length;M<P;M++)W=$[H[M]],pc=Yb[W.a],qc=Yb[W.b],rc=Yb[W.c],Ba[fa]=pc.x,Ba[fa+1]=pc.y,Ba[fa+2]=pc.z,Ba[fa+3]=pc.w,Ba[fa+4]=qc.x,Ba[fa+5]=qc.y,Ba[fa+6]=qc.z,Ba[fa+7]=qc.w,Ba[fa+8]=rc.x,Ba[fa+9]=rc.y,Ba[fa+10]=rc.z,Ba[fa+11]=rc.w,Aa=za[W.a],Ea=za[W.b],Fa=za[W.c],pa[fa]=Aa.x,pa[fa+1]=Aa.y,pa[fa+2]=Aa.z,pa[fa+3]=Aa.w,pa[fa+4]=Ea.x,pa[fa+5]=Ea.y,pa[fa+6]=Ea.z,pa[fa+7]=Ea.w,pa[fa+
+8]=Fa.x,pa[fa+9]=Fa.y,pa[fa+10]=Fa.z,pa[fa+11]=Fa.w,fa+=12;0<fa&&(l.bindBuffer(l.ARRAY_BUFFER,E.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,pa,K),l.bindBuffer(l.ARRAY_BUFFER,E.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,Ba,K))}if(Gb){M=0;for(P=H.length;M<P;M++)W=$[H[M]],Na=W.vertexColors,la=W.color,3===Na.length&&R.vertexColors===THREE.VertexColors?(ma=Na[0],oc=Na[1],ka=Na[2]):ka=oc=ma=la,Ma[Ka]=ma.r,Ma[Ka+1]=ma.g,Ma[Ka+2]=ma.b,Ma[Ka+3]=oc.r,Ma[Ka+4]=oc.g,Ma[Ka+5]=oc.b,Ma[Ka+6]=
+ka.r,Ma[Ka+7]=ka.g,Ma[Ka+8]=ka.b,Ka+=9;0<Ka&&(l.bindBuffer(l.ARRAY_BUFFER,E.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,Ma,K))}if(Uc&&Ha.hasTangents){M=0;for(P=H.length;M<P;M++)W=$[H[M]],va=W.vertexTangents,ra=va[0],ha=va[1],Ia=va[2],ya[Pa]=ra.x,ya[Pa+1]=ra.y,ya[Pa+2]=ra.z,ya[Pa+3]=ra.w,ya[Pa+4]=ha.x,ya[Pa+5]=ha.y,ya[Pa+6]=ha.z,ya[Pa+7]=ha.w,ya[Pa+8]=Ia.x,ya[Pa+9]=Ia.y,ya[Pa+10]=Ia.z,ya[Pa+11]=Ia.w,Pa+=12;l.bindBuffer(l.ARRAY_BUFFER,E.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,ya,K)}if(eb){M=
+0;for(P=H.length;M<P;M++)if(W=$[H[M]],da=W.vertexNormals,wa=W.normal,3===da.length&&V)for(ga=0;3>ga;ga++)rb=da[ga],cb[Za]=rb.x,cb[Za+1]=rb.y,cb[Za+2]=rb.z,Za+=3;else for(ga=0;3>ga;ga++)cb[Za]=wa.x,cb[Za+1]=wa.y,cb[Za+2]=wa.z,Za+=3;l.bindBuffer(l.ARRAY_BUFFER,E.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,cb,K)}if(yb&&aa){M=0;for(P=H.length;M<P;M++)if(Ja=H[M],sa=aa[Ja],void 0!==sa)for(ga=0;3>ga;ga++)ua=sa[ga],Nb[sc]=ua.x,Nb[sc+1]=ua.y,sc+=2;0<sc&&(l.bindBuffer(l.ARRAY_BUFFER,E.__webglUVBuffer),
+l.bufferData(l.ARRAY_BUFFER,Nb,K))}if(yb&&Ua){M=0;for(P=H.length;M<P;M++)if(Ja=H[M],xa=Ua[Ja],void 0!==xa)for(ga=0;3>ga;ga++)Bc=xa[ga],wb[tc]=Bc.x,wb[tc+1]=Bc.y,tc+=2;0<tc&&(l.bindBuffer(l.ARRAY_BUFFER,E.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,wb,K))}if(db){M=0;for(P=H.length;M<P;M++)vc[vb]=gb,vc[vb+1]=gb+1,vc[vb+2]=gb+2,vb+=3,Sa[ab]=gb,Sa[ab+1]=gb+1,Sa[ab+2]=gb,Sa[ab+3]=gb+2,Sa[ab+4]=gb+1,Sa[ab+5]=gb+2,ab+=6,gb+=3;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,E.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,
+vc,K);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,E.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Sa,K)}if(xb)for(ga=0,Xa=xb.length;ga<Xa;ga++)if(z=xb[ga],z.__original.needsUpdate){F=0;if(1===z.size)if(void 0===z.boundTo||"vertices"===z.boundTo)for(M=0,P=H.length;M<P;M++)W=$[H[M]],z.array[F]=z.value[W.a],z.array[F+1]=z.value[W.b],z.array[F+2]=z.value[W.c],F+=3;else{if("faces"===z.boundTo)for(M=0,P=H.length;M<P;M++)La=z.value[H[M]],z.array[F]=La,z.array[F+1]=La,z.array[F+2]=La,F+=3}else if(2===z.size)if(void 0===
 z.boundTo||"vertices"===z.boundTo)for(M=0,P=H.length;M<P;M++)W=$[H[M]],X=z.value[W.a],Y=z.value[W.b],Z=z.value[W.c],z.array[F]=X.x,z.array[F+1]=X.y,z.array[F+2]=Y.x,z.array[F+3]=Y.y,z.array[F+4]=Z.x,z.array[F+5]=Z.y,F+=6;else{if("faces"===z.boundTo)for(M=0,P=H.length;M<P;M++)Z=Y=X=La=z.value[H[M]],z.array[F]=X.x,z.array[F+1]=X.y,z.array[F+2]=Y.x,z.array[F+3]=Y.y,z.array[F+4]=Z.x,z.array[F+5]=Z.y,F+=6}else if(3===z.size){var ba;ba="c"===z.type?["r","g","b"]:["x","y","z"];if(void 0===z.boundTo||"vertices"===
 z.boundTo)for(M=0,P=H.length;M<P;M++)W=$[H[M]],X=z.value[W.a],Y=z.value[W.b],Z=z.value[W.c],z.array[F]=X[ba[0]],z.array[F+1]=X[ba[1]],z.array[F+2]=X[ba[2]],z.array[F+3]=Y[ba[0]],z.array[F+4]=Y[ba[1]],z.array[F+5]=Y[ba[2]],z.array[F+6]=Z[ba[0]],z.array[F+7]=Z[ba[1]],z.array[F+8]=Z[ba[2]],F+=9;else if("faces"===z.boundTo)for(M=0,P=H.length;M<P;M++)Z=Y=X=La=z.value[H[M]],z.array[F]=X[ba[0]],z.array[F+1]=X[ba[1]],z.array[F+2]=X[ba[2]],z.array[F+3]=Y[ba[0]],z.array[F+4]=Y[ba[1]],z.array[F+5]=Y[ba[2]],
 z.array[F+6]=Z[ba[0]],z.array[F+7]=Z[ba[1]],z.array[F+8]=Z[ba[2]],F+=9;else if("faceVertices"===z.boundTo)for(M=0,P=H.length;M<P;M++)La=z.value[H[M]],X=La[0],Y=La[1],Z=La[2],z.array[F]=X[ba[0]],z.array[F+1]=X[ba[1]],z.array[F+2]=X[ba[2]],z.array[F+3]=Y[ba[0]],z.array[F+4]=Y[ba[1]],z.array[F+5]=Y[ba[2]],z.array[F+6]=Z[ba[0]],z.array[F+7]=Z[ba[1]],z.array[F+8]=Z[ba[2]],F+=9}else if(4===z.size)if(void 0===z.boundTo||"vertices"===z.boundTo)for(M=0,P=H.length;M<P;M++)W=$[H[M]],X=z.value[W.a],Y=z.value[W.b],
 Z=z.value[W.c],z.array[F]=X.x,z.array[F+1]=X.y,z.array[F+2]=X.z,z.array[F+3]=X.w,z.array[F+4]=Y.x,z.array[F+5]=Y.y,z.array[F+6]=Y.z,z.array[F+7]=Y.w,z.array[F+8]=Z.x,z.array[F+9]=Z.y,z.array[F+10]=Z.z,z.array[F+11]=Z.w,F+=12;else if("faces"===z.boundTo)for(M=0,P=H.length;M<P;M++)Z=Y=X=La=z.value[H[M]],z.array[F]=X.x,z.array[F+1]=X.y,z.array[F+2]=X.z,z.array[F+3]=X.w,z.array[F+4]=Y.x,z.array[F+5]=Y.y,z.array[F+6]=Y.z,z.array[F+7]=Y.w,z.array[F+8]=Z.x,z.array[F+9]=Z.y,z.array[F+10]=Z.z,z.array[F+11]=
 Z.w,F+=12;else if("faceVertices"===z.boundTo)for(M=0,P=H.length;M<P;M++)La=z.value[H[M]],X=La[0],Y=La[1],Z=La[2],z.array[F]=X.x,z.array[F+1]=X.y,z.array[F+2]=X.z,z.array[F+3]=X.w,z.array[F+4]=Y.x,z.array[F+5]=Y.y,z.array[F+6]=Y.z,z.array[F+7]=Y.w,z.array[F+8]=Z.x,z.array[F+9]=Z.y,z.array[F+10]=Z.z,z.array[F+11]=Z.w,F+=12;l.bindBuffer(l.ARRAY_BUFFER,z.buffer);l.bufferData(l.ARRAY_BUFFER,z.array,K)}ta&&(delete E.__inittedArrays,delete E.__colorArray,delete E.__normalArray,delete E.__tangentArray,delete E.__uvArray,
 delete E.__uv2Array,delete E.__faceArray,delete E.__vertexArray,delete E.__lineArray,delete E.__skinIndexArray,delete E.__skinWeightArray)}}p.verticesNeedUpdate=!1;p.morphTargetsNeedUpdate=!1;p.elementsNeedUpdate=!1;p.uvsNeedUpdate=!1;p.normalsNeedUpdate=!1;p.colorsNeedUpdate=!1;p.tangentsNeedUpdate=!1;p.buffersNeedUpdate=!1;y.attributes&&A(y)}else if(e instanceof THREE.Line){y=d(e,p);x=y.attributes&&u(y);if(p.verticesNeedUpdate||p.colorsNeedUpdate||p.lineDistancesNeedUpdate||x){var ac=l.DYNAMIC_DRAW,
-Ob,sb,Pb,nb,ia,zb,Ub=p.vertices,ub=p.colors,Fb=p.lineDistances,rb=Ub.length,Vb=ub.length,Kb=Fb.length,ib=p.__vertexArray,jb=p.__colorArray,Db=p.__lineDistanceArray,lc=p.colorsNeedUpdate,mc=p.lineDistancesNeedUpdate,kb=p.__webglCustomAttributesList,lb,Eb,Da,ic,Va,na;if(p.verticesNeedUpdate){for(Ob=0;Ob<rb;Ob++)nb=Ub[Ob],ia=3*Ob,ib[ia]=nb.x,ib[ia+1]=nb.y,ib[ia+2]=nb.z;l.bindBuffer(l.ARRAY_BUFFER,p.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,ib,ac)}if(lc){for(sb=0;sb<Vb;sb++)zb=ub[sb],ia=3*sb,jb[ia]=
-zb.r,jb[ia+1]=zb.g,jb[ia+2]=zb.b;l.bindBuffer(l.ARRAY_BUFFER,p.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,jb,ac)}if(mc){for(Pb=0;Pb<Kb;Pb++)Db[Pb]=Fb[Pb];l.bindBuffer(l.ARRAY_BUFFER,p.__webglLineDistanceBuffer);l.bufferData(l.ARRAY_BUFFER,Db,ac)}if(kb)for(lb=0,Eb=kb.length;lb<Eb;lb++)if(na=kb[lb],na.needsUpdate&&(void 0===na.boundTo||"vertices"===na.boundTo)){ia=0;ic=na.value.length;if(1===na.size)for(Da=0;Da<ic;Da++)na.array[Da]=na.value[Da];else if(2===na.size)for(Da=0;Da<ic;Da++)Va=na.value[Da],
+Ob,nb,Pb,ob,ia,zb,Ub=p.vertices,ub=p.colors,Fb=p.lineDistances,sb=Ub.length,Vb=ub.length,Kb=Fb.length,ib=p.__vertexArray,jb=p.__colorArray,Eb=p.__lineDistanceArray,lc=p.colorsNeedUpdate,mc=p.lineDistancesNeedUpdate,kb=p.__webglCustomAttributesList,lb,Lb,Da,ic,Va,na;if(p.verticesNeedUpdate){for(Ob=0;Ob<sb;Ob++)ob=Ub[Ob],ia=3*Ob,ib[ia]=ob.x,ib[ia+1]=ob.y,ib[ia+2]=ob.z;l.bindBuffer(l.ARRAY_BUFFER,p.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,ib,ac)}if(lc){for(nb=0;nb<Vb;nb++)zb=ub[nb],ia=3*nb,jb[ia]=
+zb.r,jb[ia+1]=zb.g,jb[ia+2]=zb.b;l.bindBuffer(l.ARRAY_BUFFER,p.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,jb,ac)}if(mc){for(Pb=0;Pb<Kb;Pb++)Eb[Pb]=Fb[Pb];l.bindBuffer(l.ARRAY_BUFFER,p.__webglLineDistanceBuffer);l.bufferData(l.ARRAY_BUFFER,Eb,ac)}if(kb)for(lb=0,Lb=kb.length;lb<Lb;lb++)if(na=kb[lb],na.needsUpdate&&(void 0===na.boundTo||"vertices"===na.boundTo)){ia=0;ic=na.value.length;if(1===na.size)for(Da=0;Da<ic;Da++)na.array[Da]=na.value[Da];else if(2===na.size)for(Da=0;Da<ic;Da++)Va=na.value[Da],
 na.array[ia]=Va.x,na.array[ia+1]=Va.y,ia+=2;else if(3===na.size)if("c"===na.type)for(Da=0;Da<ic;Da++)Va=na.value[Da],na.array[ia]=Va.r,na.array[ia+1]=Va.g,na.array[ia+2]=Va.b,ia+=3;else for(Da=0;Da<ic;Da++)Va=na.value[Da],na.array[ia]=Va.x,na.array[ia+1]=Va.y,na.array[ia+2]=Va.z,ia+=3;else if(4===na.size)for(Da=0;Da<ic;Da++)Va=na.value[Da],na.array[ia]=Va.x,na.array[ia+1]=Va.y,na.array[ia+2]=Va.z,na.array[ia+3]=Va.w,ia+=4;l.bindBuffer(l.ARRAY_BUFFER,na.buffer);l.bufferData(l.ARRAY_BUFFER,na.array,
-ac)}}p.verticesNeedUpdate=!1;p.colorsNeedUpdate=!1;p.lineDistancesNeedUpdate=!1;y.attributes&&A(y)}else if(e instanceof THREE.PointCloud){y=d(e,p);x=y.attributes&&u(y);if(p.verticesNeedUpdate||p.colorsNeedUpdate||e.sortParticles||x){var fc=l.DYNAMIC_DRAW,Wa,Ab,Bb,U,Cb,Qb,vc=p.vertices,gc=vc.length,hc=p.colors,Wb=hc.length,bc=p.__vertexArray,cc=p.__colorArray,Ib=p.__sortArray,Xb=p.verticesNeedUpdate,kc=p.colorsNeedUpdate,Jb=p.__webglCustomAttributesList,ob,jc,ca,pb,ja,T;if(e.sortParticles){Dc.copy(wc);
-Dc.multiply(e.matrixWorld);for(Wa=0;Wa<gc;Wa++)Bb=vc[Wa],Qa.copy(Bb),Qa.applyProjection(Dc),Ib[Wa]=[Qa.z,Wa];Ib.sort(n);for(Wa=0;Wa<gc;Wa++)Bb=vc[Ib[Wa][1]],U=3*Wa,bc[U]=Bb.x,bc[U+1]=Bb.y,bc[U+2]=Bb.z;for(Ab=0;Ab<Wb;Ab++)U=3*Ab,Qb=hc[Ib[Ab][1]],cc[U]=Qb.r,cc[U+1]=Qb.g,cc[U+2]=Qb.b;if(Jb)for(ob=0,jc=Jb.length;ob<jc;ob++)if(T=Jb[ob],void 0===T.boundTo||"vertices"===T.boundTo)if(U=0,pb=T.value.length,1===T.size)for(ca=0;ca<pb;ca++)Cb=Ib[ca][1],T.array[ca]=T.value[Cb];else if(2===T.size)for(ca=0;ca<pb;ca++)Cb=
-Ib[ca][1],ja=T.value[Cb],T.array[U]=ja.x,T.array[U+1]=ja.y,U+=2;else if(3===T.size)if("c"===T.type)for(ca=0;ca<pb;ca++)Cb=Ib[ca][1],ja=T.value[Cb],T.array[U]=ja.r,T.array[U+1]=ja.g,T.array[U+2]=ja.b,U+=3;else for(ca=0;ca<pb;ca++)Cb=Ib[ca][1],ja=T.value[Cb],T.array[U]=ja.x,T.array[U+1]=ja.y,T.array[U+2]=ja.z,U+=3;else if(4===T.size)for(ca=0;ca<pb;ca++)Cb=Ib[ca][1],ja=T.value[Cb],T.array[U]=ja.x,T.array[U+1]=ja.y,T.array[U+2]=ja.z,T.array[U+3]=ja.w,U+=4}else{if(Xb)for(Wa=0;Wa<gc;Wa++)Bb=vc[Wa],U=3*
-Wa,bc[U]=Bb.x,bc[U+1]=Bb.y,bc[U+2]=Bb.z;if(kc)for(Ab=0;Ab<Wb;Ab++)Qb=hc[Ab],U=3*Ab,cc[U]=Qb.r,cc[U+1]=Qb.g,cc[U+2]=Qb.b;if(Jb)for(ob=0,jc=Jb.length;ob<jc;ob++)if(T=Jb[ob],T.needsUpdate&&(void 0===T.boundTo||"vertices"===T.boundTo))if(pb=T.value.length,U=0,1===T.size)for(ca=0;ca<pb;ca++)T.array[ca]=T.value[ca];else if(2===T.size)for(ca=0;ca<pb;ca++)ja=T.value[ca],T.array[U]=ja.x,T.array[U+1]=ja.y,U+=2;else if(3===T.size)if("c"===T.type)for(ca=0;ca<pb;ca++)ja=T.value[ca],T.array[U]=ja.r,T.array[U+1]=
-ja.g,T.array[U+2]=ja.b,U+=3;else for(ca=0;ca<pb;ca++)ja=T.value[ca],T.array[U]=ja.x,T.array[U+1]=ja.y,T.array[U+2]=ja.z,U+=3;else if(4===T.size)for(ca=0;ca<pb;ca++)ja=T.value[ca],T.array[U]=ja.x,T.array[U+1]=ja.y,T.array[U+2]=ja.z,T.array[U+3]=ja.w,U+=4}if(Xb||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,p.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,bc,fc);if(kc||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,p.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,cc,fc);if(Jb)for(ob=0,jc=Jb.length;ob<
-jc;ob++)if(T=Jb[ob],T.needsUpdate||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,T.buffer),l.bufferData(l.ARRAY_BUFFER,T.array,fc)}p.verticesNeedUpdate=!1;p.colorsNeedUpdate=!1;y.attributes&&A(y)}for(var dc=0,Lb=s.length;dc<Lb;dc++){var xc=s[dc],Rb=xc,tc=Rb.object,yc=Rb.buffer,zc=tc.geometry,Sb=tc.material;Sb instanceof THREE.MeshFaceMaterial?(Sb=Sb.materials[zc instanceof THREE.BufferGeometry?0:yc.materialIndex],Rb.material=Sb,Sb.transparent?Ra.push(Rb):fb.push(Rb)):Sb&&(Rb.material=Sb,Sb.transparent?
-Ra.push(Rb):fb.push(Rb));xc.render=!0;!0===I.sortObjects&&(null!==e.renderDepth?xc.z=e.renderDepth:(Qa.setFromMatrixPosition(e.matrixWorld),Qa.applyProjection(wc),xc.z=Qa.z))}}}dc=0;for(Lb=e.children.length;dc<Lb;dc++)q(a,e.children[dc],f)}}function r(a,b,c){if(0!==a.length)for(var d=0,e=a.length;d<e;d++)a[d].render(b,c,tc,yc)}function t(a,b,c,d,e,g){for(var f,h,k,l=a.length-1;-1!==l;l--){f=a[l];h=f.object;k=f.buffer;B(h,b);if(g)f=g;else{f=f.material;if(!f)continue;e&&I.setBlending(f.blending,f.blendEquation,
+ac)}}p.verticesNeedUpdate=!1;p.colorsNeedUpdate=!1;p.lineDistancesNeedUpdate=!1;y.attributes&&A(y)}else if(e instanceof THREE.PointCloud){y=d(e,p);x=y.attributes&&u(y);if(p.verticesNeedUpdate||p.colorsNeedUpdate||e.sortParticles||x){var fc=l.DYNAMIC_DRAW,Wa,Ab,Bb,U,Cb,Qb,wc=p.vertices,gc=wc.length,hc=p.colors,kc=hc.length,bc=p.__vertexArray,cc=p.__colorArray,Ib=p.__sortArray,Wb=p.verticesNeedUpdate,Xb=p.colorsNeedUpdate,Jb=p.__webglCustomAttributesList,pb,jc,ca,qb,ja,T;if(e.sortParticles){Dc.copy(xc);
+Dc.multiply(e.matrixWorld);for(Wa=0;Wa<gc;Wa++)Bb=wc[Wa],Qa.copy(Bb),Qa.applyProjection(Dc),Ib[Wa]=[Qa.z,Wa];Ib.sort(n);for(Wa=0;Wa<gc;Wa++)Bb=wc[Ib[Wa][1]],U=3*Wa,bc[U]=Bb.x,bc[U+1]=Bb.y,bc[U+2]=Bb.z;for(Ab=0;Ab<kc;Ab++)U=3*Ab,Qb=hc[Ib[Ab][1]],cc[U]=Qb.r,cc[U+1]=Qb.g,cc[U+2]=Qb.b;if(Jb)for(pb=0,jc=Jb.length;pb<jc;pb++)if(T=Jb[pb],void 0===T.boundTo||"vertices"===T.boundTo)if(U=0,qb=T.value.length,1===T.size)for(ca=0;ca<qb;ca++)Cb=Ib[ca][1],T.array[ca]=T.value[Cb];else if(2===T.size)for(ca=0;ca<qb;ca++)Cb=
+Ib[ca][1],ja=T.value[Cb],T.array[U]=ja.x,T.array[U+1]=ja.y,U+=2;else if(3===T.size)if("c"===T.type)for(ca=0;ca<qb;ca++)Cb=Ib[ca][1],ja=T.value[Cb],T.array[U]=ja.r,T.array[U+1]=ja.g,T.array[U+2]=ja.b,U+=3;else for(ca=0;ca<qb;ca++)Cb=Ib[ca][1],ja=T.value[Cb],T.array[U]=ja.x,T.array[U+1]=ja.y,T.array[U+2]=ja.z,U+=3;else if(4===T.size)for(ca=0;ca<qb;ca++)Cb=Ib[ca][1],ja=T.value[Cb],T.array[U]=ja.x,T.array[U+1]=ja.y,T.array[U+2]=ja.z,T.array[U+3]=ja.w,U+=4}else{if(Wb)for(Wa=0;Wa<gc;Wa++)Bb=wc[Wa],U=3*
+Wa,bc[U]=Bb.x,bc[U+1]=Bb.y,bc[U+2]=Bb.z;if(Xb)for(Ab=0;Ab<kc;Ab++)Qb=hc[Ab],U=3*Ab,cc[U]=Qb.r,cc[U+1]=Qb.g,cc[U+2]=Qb.b;if(Jb)for(pb=0,jc=Jb.length;pb<jc;pb++)if(T=Jb[pb],T.needsUpdate&&(void 0===T.boundTo||"vertices"===T.boundTo))if(qb=T.value.length,U=0,1===T.size)for(ca=0;ca<qb;ca++)T.array[ca]=T.value[ca];else if(2===T.size)for(ca=0;ca<qb;ca++)ja=T.value[ca],T.array[U]=ja.x,T.array[U+1]=ja.y,U+=2;else if(3===T.size)if("c"===T.type)for(ca=0;ca<qb;ca++)ja=T.value[ca],T.array[U]=ja.r,T.array[U+1]=
+ja.g,T.array[U+2]=ja.b,U+=3;else for(ca=0;ca<qb;ca++)ja=T.value[ca],T.array[U]=ja.x,T.array[U+1]=ja.y,T.array[U+2]=ja.z,U+=3;else if(4===T.size)for(ca=0;ca<qb;ca++)ja=T.value[ca],T.array[U]=ja.x,T.array[U+1]=ja.y,T.array[U+2]=ja.z,T.array[U+3]=ja.w,U+=4}if(Wb||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,p.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,bc,fc);if(Xb||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,p.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,cc,fc);if(Jb)for(pb=0,jc=Jb.length;pb<
+jc;pb++)if(T=Jb[pb],T.needsUpdate||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,T.buffer),l.bufferData(l.ARRAY_BUFFER,T.array,fc)}p.verticesNeedUpdate=!1;p.colorsNeedUpdate=!1;y.attributes&&A(y)}for(var dc=0,Db=s.length;dc<Db;dc++){var yc=s[dc],Rb=yc,nc=Rb.object,uc=Rb.buffer,zc=nc.geometry,Sb=nc.material;Sb instanceof THREE.MeshFaceMaterial?(Sb=Sb.materials[zc instanceof THREE.BufferGeometry?0:uc.materialIndex],Rb.material=Sb,Sb.transparent?Ra.push(Rb):fb.push(Rb)):Sb&&(Rb.material=Sb,Sb.transparent?
+Ra.push(Rb):fb.push(Rb));yc.render=!0;!0===I.sortObjects&&(null!==e.renderDepth?yc.z=e.renderDepth:(Qa.setFromMatrixPosition(e.matrixWorld),Qa.applyProjection(xc),yc.z=Qa.z))}}}dc=0;for(Db=e.children.length;dc<Db;dc++)q(a,e.children[dc],f)}}function r(a,b,c){if(0!==a.length)for(var d=0,e=a.length;d<e;d++)a[d].render(b,c,zc,Gc)}function t(a,b,c,d,e,g){for(var f,h,k,l=a.length-1;-1!==l;l--){f=a[l];h=f.object;k=f.buffer;B(h,b);if(g)f=g;else{f=f.material;if(!f)continue;e&&I.setBlending(f.blending,f.blendEquation,
 f.blendSrc,f.blendDst);I.setDepthTest(f.depthTest);I.setDepthWrite(f.depthWrite);N(f.polygonOffset,f.polygonOffsetFactor,f.polygonOffsetUnits)}I.setMaterialFaces(f);k instanceof THREE.BufferGeometry?I.renderBufferDirect(b,c,d,f,k,h):I.renderBuffer(b,c,d,f,k,h)}}function s(a,b,c,d,e,f,g){for(var h,k,l=0,m=a.length;l<m;l++)if(h=a[l],k=h.object,k.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&I.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);I.setDepthTest(h.depthTest);I.setDepthWrite(h.depthWrite);
 N(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}I.renderImmediateObject(c,d,e,h,k)}}function p(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function v(a,b,d){var e=!1;a=b.material;if(void 0===d.geometryGroups||d.groupsNeedUpdate)delete Ta[b.id],d.makeGroups(a instanceof THREE.MeshFaceMaterial,Fb?4294967296:65535),d.groupsNeedUpdate=!1;for(var f=0,g=d.geometryGroupsList.length;f<g;f++){a=d.geometryGroupsList[f];if(a.__webglVertexBuffer)e=
 !1;else{e=a;e.__webglVertexBuffer=l.createBuffer();e.__webglNormalBuffer=l.createBuffer();e.__webglTangentBuffer=l.createBuffer();e.__webglColorBuffer=l.createBuffer();e.__webglUVBuffer=l.createBuffer();e.__webglUV2Buffer=l.createBuffer();e.__webglSkinIndicesBuffer=l.createBuffer();e.__webglSkinWeightsBuffer=l.createBuffer();e.__webglFaceBuffer=l.createBuffer();e.__webglLineBuffer=l.createBuffer();var h=void 0,k=void 0;if(e.numMorphTargets)for(e.__webglMorphTargetsBuffers=[],h=0,k=e.numMorphTargets;h<
 k;h++)e.__webglMorphTargetsBuffers.push(l.createBuffer());if(e.numMorphNormals)for(e.__webglMorphNormalsBuffers=[],h=0,k=e.numMorphNormals;h<k;h++)e.__webglMorphNormalsBuffers.push(l.createBuffer());I.info.memory.geometries++;c(a,b);d.verticesNeedUpdate=!0;d.morphTargetsNeedUpdate=!0;d.elementsNeedUpdate=!0;d.uvsNeedUpdate=!0;d.normalsNeedUpdate=!0;d.tangentsNeedUpdate=!0;e=d.colorsNeedUpdate=!0}(e||void 0===b.__webglActive)&&w(Ta,a,b)}b.__webglActive=!0}function w(a,b,c){var d=c.id;a[d]=a[d]||[];
-a[d].push({id:d,buffer:b,object:c,material:null,z:0})}function u(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function A(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function x(a,b,c,d,e){var f,g,h,k;ec=0;if(d.needsUpdate){d.program&&zc(d);d.addEventListener("dispose",Gc);var m;d instanceof THREE.MeshDepthMaterial?m="depth":d instanceof THREE.MeshNormalMaterial?m="normal":d instanceof THREE.MeshBasicMaterial?m="basic":d instanceof THREE.MeshLambertMaterial?
+a[d].push({id:d,buffer:b,object:c,material:null,z:0})}function u(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function A(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function x(a,b,c,d,e){var f,g,h,k;ec=0;if(d.needsUpdate){d.program&&Hc(d);d.addEventListener("dispose",Ic);var m;d instanceof THREE.MeshDepthMaterial?m="depth":d instanceof THREE.MeshNormalMaterial?m="normal":d instanceof THREE.MeshBasicMaterial?m="basic":d instanceof THREE.MeshLambertMaterial?
 m="lambert":d instanceof THREE.MeshPhongMaterial?m="phong":d instanceof THREE.LineBasicMaterial?m="basic":d instanceof THREE.LineDashedMaterial?m="dashed":d instanceof THREE.PointCloudMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];d.__webglShader={uniforms:THREE.UniformsUtils.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}}else d.__webglShader={uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};for(var p=0,r=0,s=0,t=0,q=0,
 u=b.length;q<u;q++){var v=b[q];v.onlyShadow||!1===v.visible||(v instanceof THREE.DirectionalLight&&p++,v instanceof THREE.PointLight&&r++,v instanceof THREE.SpotLight&&s++,v instanceof THREE.HemisphereLight&&t++)}f=p;g=r;h=s;k=t;for(var w,x=0,A=0,B=b.length;A<B;A++){var N=b[A];N.castShadow&&(N instanceof THREE.SpotLight&&x++,N instanceof THREE.DirectionalLight&&!N.shadowCascade&&x++)}w=x;var J;if(fc&&e&&e.skeleton&&e.skeleton.useVertexTexture)J=1024;else{var K=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),
 ta=Math.floor((K-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(ta=Math.min(e.skeleton.bones.length,ta),ta<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+ta+" (try OpenGL instead of ANGLE)"));J=ta}var R={precision:P,supportsVertexTextures:gc,map:!!d.map,envMap:!!d.envMap,lightMap:!!d.lightMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,vertexColors:d.vertexColors,fog:c,
 useFog:d.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:Ia,skinning:d.skinning,maxBones:J,useVertexTexture:fc&&e&&e.skeleton&&e.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:I.maxMorphTargets,maxMorphNormals:I.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:w,shadowMapEnabled:I.shadowMapEnabled&&e.receiveShadow&&0<w,shadowMapType:I.shadowMapType,shadowMapDebug:I.shadowMapDebug,
 shadowMapCascade:I.shadowMapCascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side===THREE.BackSide},M=[];m?M.push(m):(M.push(d.fragmentShader),M.push(d.vertexShader));if(void 0!==d.defines)for(var V in d.defines)M.push(V),M.push(d.defines[V]);for(V in R)M.push(V),M.push(R[V]);for(var Ga=M.join(),W,Ta=0,Ja=Na.length;Ta<Ja;Ta++){var da=Na[Ta];if(da.code===Ga){W=da;W.usedTimes++;break}}void 0===W&&(W=new THREE.WebGLProgram(I,Ga,d,R),
 Na.push(W),I.info.memory.programs=Na.length);d.program=W;var wa=W.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var Ca,la="morphTarget",Ra=0;Ra<I.maxMorphTargets;Ra++)Ca=la+Ra,0<=wa[Ca]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=0,la="morphNormal",Ra=0;Ra<I.maxMorphNormals;Ra++)Ca=la+Ra,0<=wa[Ca]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var X in d.__webglShader.uniforms){var Y=d.program.uniforms[X];Y&&d.uniformsList.push([d.__webglShader.uniforms[X],
-Y])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets));var Z=!1,fb=!1,sa=!1,ra=d.program,oa=ra.uniforms,O=d.__webglShader.uniforms;ra.id!==tb&&(l.useProgram(ra.program),tb=ra.id,sa=fb=Z=!0);d.id!==qb&&(-1===qb&&(sa=!0),qb=d.id,fb=!0);if(Z||a!==Tb)l.uniformMatrix4fv(oa.projectionMatrix,!1,a.projectionMatrix.elements),Ia&&l.uniform1f(oa.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==Tb&&(Tb=a),(d instanceof THREE.ShaderMaterial||
+Y])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets));var Z=!1,fb=!1,sa=!1,ra=d.program,oa=ra.uniforms,O=d.__webglShader.uniforms;ra.id!==tb&&(l.useProgram(ra.program),tb=ra.id,sa=fb=Z=!0);d.id!==rb&&(-1===rb&&(sa=!0),rb=d.id,fb=!0);if(Z||a!==Tb)l.uniformMatrix4fv(oa.projectionMatrix,!1,a.projectionMatrix.elements),Ia&&l.uniform1f(oa.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==Tb&&(Tb=a),(d instanceof THREE.ShaderMaterial||
 d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==oa.cameraPosition&&(Qa.setFromMatrixPosition(a.matrixWorld),l.uniform3f(oa.cameraPosition,Qa.x,Qa.y,Qa.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==oa.viewMatrix&&l.uniformMatrix4fv(oa.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&null!==oa.bindMatrix&&l.uniformMatrix4fv(oa.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&
 null!==oa.bindMatrixInverse&&l.uniformMatrix4fv(oa.bindMatrixInverse,!1,e.bindMatrixInverse.elements),fc&&e.skeleton&&e.skeleton.useVertexTexture){if(null!==oa.boneTexture){var xa=C();l.uniform1i(oa.boneTexture,xa);I.setTexture(e.skeleton.boneTexture,xa)}null!==oa.boneTextureWidth&&l.uniform1i(oa.boneTextureWidth,e.skeleton.boneTextureWidth);null!==oa.boneTextureHeight&&l.uniform1i(oa.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&null!==oa.boneGlobalMatrices&&
-l.uniformMatrix4fv(oa.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(fb){c&&d.fog&&(O.fogColor.value=c.color,c instanceof THREE.Fog?(O.fogNear.value=c.near,O.fogFar.value=c.far):c instanceof THREE.FogExp2&&(O.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ub){var sa=!0,ma,ha,ka,Ea=0,Fa=0,Xa=0,Aa,hb,ib,ga,jb,lb,ua=Hc,kb=ua.directional.colors,Oa=ua.directional.positions,ub=ua.point.colors,$a=ua.point.positions,mb=ua.point.distances,
+l.uniformMatrix4fv(oa.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(fb){c&&d.fog&&(O.fogColor.value=c.color,c instanceof THREE.Fog?(O.fogNear.value=c.near,O.fogFar.value=c.far):c instanceof THREE.FogExp2&&(O.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ub){var sa=!0,ma,ha,ka,Ea=0,Fa=0,Xa=0,Aa,hb,ib,ga,jb,lb,ua=Jc,kb=ua.directional.colors,Oa=ua.directional.positions,ub=ua.point.colors,$a=ua.point.positions,mb=ua.point.distances,
 Hb=ua.spot.colors,Mb=ua.spot.positions,gb=ua.spot.distances,Ya=ua.spot.directions,Fb=ua.spot.anglesCos,Gb=ua.spot.exponents,vb=ua.hemi.skyColors,Za=ua.hemi.groundColors,Pa=ua.hemi.positions,ab=0,Ka=0,fa=0,qa=0,F=0,La=0,bb=0,Nb=0,wb=0,cb=0,ya=0,Ma=0;ma=0;for(ha=b.length;ma<ha;ma++)ka=b[ma],ka.onlyShadow||(Aa=ka.color,ga=ka.intensity,lb=ka.distance,ka instanceof THREE.AmbientLight?ka.visible&&(I.gammaInput?(Ea+=Aa.r*Aa.r,Fa+=Aa.g*Aa.g,Xa+=Aa.b*Aa.b):(Ea+=Aa.r,Fa+=Aa.g,Xa+=Aa.b)):ka instanceof THREE.DirectionalLight?
 (F+=1,ka.visible&&(va.setFromMatrixPosition(ka.matrixWorld),Qa.setFromMatrixPosition(ka.target.matrixWorld),va.sub(Qa),va.normalize(),wb=3*ab,Oa[wb]=va.x,Oa[wb+1]=va.y,Oa[wb+2]=va.z,I.gammaInput?y(kb,wb,Aa,ga*ga):D(kb,wb,Aa,ga),ab+=1)):ka instanceof THREE.PointLight?(La+=1,ka.visible&&(cb=3*Ka,I.gammaInput?y(ub,cb,Aa,ga*ga):D(ub,cb,Aa,ga),Qa.setFromMatrixPosition(ka.matrixWorld),$a[cb]=Qa.x,$a[cb+1]=Qa.y,$a[cb+2]=Qa.z,mb[Ka]=lb,Ka+=1)):ka instanceof THREE.SpotLight?(bb+=1,ka.visible&&(ya=3*fa,I.gammaInput?
 y(Hb,ya,Aa,ga*ga):D(Hb,ya,Aa,ga),va.setFromMatrixPosition(ka.matrixWorld),Mb[ya]=va.x,Mb[ya+1]=va.y,Mb[ya+2]=va.z,gb[fa]=lb,Qa.setFromMatrixPosition(ka.target.matrixWorld),va.sub(Qa),va.normalize(),Ya[ya]=va.x,Ya[ya+1]=va.y,Ya[ya+2]=va.z,Fb[fa]=Math.cos(ka.angle),Gb[fa]=ka.exponent,fa+=1)):ka instanceof THREE.HemisphereLight&&(Nb+=1,ka.visible&&(va.setFromMatrixPosition(ka.matrixWorld),va.normalize(),Ma=3*qa,Pa[Ma]=va.x,Pa[Ma+1]=va.y,Pa[Ma+2]=va.z,hb=ka.color,ib=ka.groundColor,I.gammaInput?(jb=ga*
 ga,y(vb,Ma,hb,jb),y(Za,Ma,ib,jb)):(D(vb,Ma,hb,ga),D(Za,Ma,ib,ga)),qa+=1)));ma=3*ab;for(ha=Math.max(kb.length,3*F);ma<ha;ma++)kb[ma]=0;ma=3*Ka;for(ha=Math.max(ub.length,3*La);ma<ha;ma++)ub[ma]=0;ma=3*fa;for(ha=Math.max(Hb.length,3*bb);ma<ha;ma++)Hb[ma]=0;ma=3*qa;for(ha=Math.max(vb.length,3*Nb);ma<ha;ma++)vb[ma]=0;ma=3*qa;for(ha=Math.max(Za.length,3*Nb);ma<ha;ma++)Za[ma]=0;ua.directional.length=ab;ua.point.length=Ka;ua.spot.length=fa;ua.hemi.length=qa;ua.ambient[0]=Ea;ua.ambient[1]=Fa;ua.ambient[2]=
-Xa;Ub=!1}if(sa){var pa=Hc;O.ambientLightColor.value=pa.ambient;O.directionalLightColor.value=pa.directional.colors;O.directionalLightDirection.value=pa.directional.positions;O.pointLightColor.value=pa.point.colors;O.pointLightPosition.value=pa.point.positions;O.pointLightDistance.value=pa.point.distances;O.spotLightColor.value=pa.spot.colors;O.spotLightPosition.value=pa.spot.positions;O.spotLightDistance.value=pa.spot.distances;O.spotLightDirection.value=pa.spot.directions;O.spotLightAngleCos.value=
+Xa;Ub=!1}if(sa){var pa=Jc;O.ambientLightColor.value=pa.ambient;O.directionalLightColor.value=pa.directional.colors;O.directionalLightDirection.value=pa.directional.positions;O.pointLightColor.value=pa.point.colors;O.pointLightPosition.value=pa.point.positions;O.pointLightDistance.value=pa.point.distances;O.spotLightColor.value=pa.spot.colors;O.spotLightPosition.value=pa.spot.positions;O.spotLightDistance.value=pa.spot.distances;O.spotLightDirection.value=pa.spot.directions;O.spotLightAngleCos.value=
 pa.spot.anglesCos;O.spotLightExponent.value=pa.spot.exponents;O.hemisphereLightSkyColor.value=pa.hemi.skyColors;O.hemisphereLightGroundColor.value=pa.hemi.groundColors;O.hemisphereLightDirection.value=pa.hemi.positions;G(O,!0)}else G(O,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){O.opacity.value=d.opacity;I.gammaInput?O.diffuse.value.copyGammaToLinear(d.color):O.diffuse.value=d.color;O.map.value=d.map;O.lightMap.value=d.lightMap;
 O.specularMap.value=d.specularMap;O.alphaMap.value=d.alphaMap;d.bumpMap&&(O.bumpMap.value=d.bumpMap,O.bumpScale.value=d.bumpScale);d.normalMap&&(O.normalMap.value=d.normalMap,O.normalScale.value.copy(d.normalScale));var Ba;d.map?Ba=d.map:d.specularMap?Ba=d.specularMap:d.normalMap?Ba=d.normalMap:d.bumpMap?Ba=d.bumpMap:d.alphaMap&&(Ba=d.alphaMap);if(void 0!==Ba){var Db=Ba.offset,Eb=Ba.repeat;O.offsetRepeat.value.set(Db.x,Db.y,Eb.x,Eb.y)}O.envMap.value=d.envMap;O.flipEnvMap.value=d.envMap instanceof
 THREE.WebGLRenderTargetCube?1:-1;O.reflectivity.value=d.reflectivity;O.refractionRatio.value=d.refractionRatio;O.combine.value=d.combine;O.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(O.diffuse.value=d.color,O.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(O.diffuse.value=d.color,O.opacity.value=d.opacity,O.dashSize.value=d.dashSize,O.totalSize.value=d.dashSize+d.gapSize,O.scale.value=d.scale):d instanceof
 THREE.PointCloudMaterial?(O.psColor.value=d.color,O.opacity.value=d.opacity,O.size.value=d.size,O.scale.value=L.height/2,O.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(O.shininess.value=d.shininess,I.gammaInput?(O.ambient.value.copyGammaToLinear(d.ambient),O.emissive.value.copyGammaToLinear(d.emissive),O.specular.value.copyGammaToLinear(d.specular)):(O.ambient.value=d.ambient,O.emissive.value=d.emissive,O.specular.value=d.specular),d.wrapAround&&O.wrapRGB.value.copy(d.wrapRGB)):d instanceof
 THREE.MeshLambertMaterial?(I.gammaInput?(O.ambient.value.copyGammaToLinear(d.ambient),O.emissive.value.copyGammaToLinear(d.emissive)):(O.ambient.value=d.ambient,O.emissive.value=d.emissive),d.wrapAround&&O.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(O.mNear.value=a.near,O.mFar.value=a.far,O.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(O.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&O.shadowMatrix)for(var xb=0,z=0,Lb=b.length;z<Lb;z++){var Sa=
-b[z];Sa.castShadow&&(Sa instanceof THREE.SpotLight||Sa instanceof THREE.DirectionalLight&&!Sa.shadowCascade)&&(O.shadowMap.value[xb]=Sa.shadowMap,O.shadowMapSize.value[xb]=Sa.shadowMapSize,O.shadowMatrix.value[xb]=Sa.shadowMatrix,O.shadowDarkness.value[xb]=Sa.shadowDarkness,O.shadowBias.value[xb]=Sa.shadowBias,xb++)}for(var Ha=d.uniformsList,db,yb,eb,rb=0,Vb=Ha.length;rb<Vb;rb++){var ea=Ha[rb][0];if(!1!==ea.needsUpdate){var Kb=ea.type,H=ea.value,$=Ha[rb][1];switch(Kb){case "1i":l.uniform1i($,H);break;
+b[z];Sa.castShadow&&(Sa instanceof THREE.SpotLight||Sa instanceof THREE.DirectionalLight&&!Sa.shadowCascade)&&(O.shadowMap.value[xb]=Sa.shadowMap,O.shadowMapSize.value[xb]=Sa.shadowMapSize,O.shadowMatrix.value[xb]=Sa.shadowMatrix,O.shadowDarkness.value[xb]=Sa.shadowDarkness,O.shadowBias.value[xb]=Sa.shadowBias,xb++)}for(var Ha=d.uniformsList,db,yb,eb,sb=0,Vb=Ha.length;sb<Vb;sb++){var ea=Ha[sb][0];if(!1!==ea.needsUpdate){var Kb=ea.type,H=ea.value,$=Ha[sb][1];switch(Kb){case "1i":l.uniform1i($,H);break;
 case "1f":l.uniform1f($,H);break;case "2f":l.uniform2f($,H[0],H[1]);break;case "3f":l.uniform3f($,H[0],H[1],H[2]);break;case "4f":l.uniform4f($,H[0],H[1],H[2],H[3]);break;case "1iv":l.uniform1iv($,H);break;case "3iv":l.uniform3iv($,H);break;case "1fv":l.uniform1fv($,H);break;case "2fv":l.uniform2fv($,H);break;case "3fv":l.uniform3fv($,H);break;case "4fv":l.uniform4fv($,H);break;case "Matrix3fv":l.uniformMatrix3fv($,!1,H);break;case "Matrix4fv":l.uniformMatrix4fv($,!1,H);break;case "i":l.uniform1i($,
 H);break;case "f":l.uniform1f($,H);break;case "v2":l.uniform2f($,H.x,H.y);break;case "v3":l.uniform3f($,H.x,H.y,H.z);break;case "v4":l.uniform4f($,H.x,H.y,H.z,H.w);break;case "c":l.uniform3f($,H.r,H.g,H.b);break;case "iv1":l.uniform1iv($,H);break;case "iv":l.uniform3iv($,H);break;case "fv1":l.uniform1fv($,H);break;case "fv":l.uniform3fv($,H);break;case "v2v":void 0===ea._array&&(ea._array=new Float32Array(2*H.length));for(var aa=0,Ua=H.length;aa<Ua;aa++)eb=2*aa,ea._array[eb]=H[aa].x,ea._array[eb+
 1]=H[aa].y;l.uniform2fv($,ea._array);break;case "v3v":void 0===ea._array&&(ea._array=new Float32Array(3*H.length));aa=0;for(Ua=H.length;aa<Ua;aa++)eb=3*aa,ea._array[eb]=H[aa].x,ea._array[eb+1]=H[aa].y,ea._array[eb+2]=H[aa].z;l.uniform3fv($,ea._array);break;case "v4v":void 0===ea._array&&(ea._array=new Float32Array(4*H.length));aa=0;for(Ua=H.length;aa<Ua;aa++)eb=4*aa,ea._array[eb]=H[aa].x,ea._array[eb+1]=H[aa].y,ea._array[eb+2]=H[aa].z,ea._array[eb+3]=H[aa].w;l.uniform4fv($,ea._array);break;case "m3":l.uniformMatrix3fv($,
 !1,H.elements);break;case "m3v":void 0===ea._array&&(ea._array=new Float32Array(9*H.length));aa=0;for(Ua=H.length;aa<Ua;aa++)H[aa].flattenToArrayOffset(ea._array,9*aa);l.uniformMatrix3fv($,!1,ea._array);break;case "m4":l.uniformMatrix4fv($,!1,H.elements);break;case "m4v":void 0===ea._array&&(ea._array=new Float32Array(16*H.length));aa=0;for(Ua=H.length;aa<Ua;aa++)H[aa].flattenToArrayOffset(ea._array,16*aa);l.uniformMatrix4fv($,!1,ea._array);break;case "t":db=H;yb=C();l.uniform1i($,yb);if(!db)continue;
 if(db instanceof THREE.CubeTexture||db.image instanceof Array&&6===db.image.length){var za=db,Yb=yb;if(6===za.image.length)if(za.needsUpdate){za.image.__webglTextureCube||(za.addEventListener("dispose",hc),za.image.__webglTextureCube=l.createTexture(),I.info.memory.textures++);l.activeTexture(l.TEXTURE0+Yb);l.bindTexture(l.TEXTURE_CUBE_MAP,za.image.__webglTextureCube);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,za.flipY);for(var Zb=za instanceof THREE.CompressedTexture,$b=[],ba=0;6>ba;ba++)$b[ba]=I.autoScaleCubemaps&&
-!Zb?E(za.image[ba],Sc):za.image[ba];var ac=$b[0],Ob=THREE.Math.isPowerOfTwo(ac.width)&&THREE.Math.isPowerOfTwo(ac.height),sb=S(za.format),Pb=S(za.type);Q(l.TEXTURE_CUBE_MAP,za,Ob);for(ba=0;6>ba;ba++)if(Zb)for(var nb,ia=$b[ba].mipmaps,zb=0,Wb=ia.length;zb<Wb;zb++)nb=ia[zb],za.format!==THREE.RGBAFormat?l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ba,zb,sb,nb.width,nb.height,0,nb.data):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ba,zb,sb,nb.width,nb.height,0,sb,Pb,nb.data);else l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
-ba,0,sb,sb,Pb,$b[ba]);za.generateMipmaps&&Ob&&l.generateMipmap(l.TEXTURE_CUBE_MAP);za.needsUpdate=!1;if(za.onUpdate)za.onUpdate()}else l.activeTexture(l.TEXTURE0+Yb),l.bindTexture(l.TEXTURE_CUBE_MAP,za.image.__webglTextureCube)}else if(db instanceof THREE.WebGLRenderTargetCube){var Xb=db;l.activeTexture(l.TEXTURE0+yb);l.bindTexture(l.TEXTURE_CUBE_MAP,Xb.__webglTexture)}else I.setTexture(db,yb);break;case "tv":void 0===ea._array&&(ea._array=[]);aa=0;for(Ua=ea.value.length;aa<Ua;aa++)ea._array[aa]=
-C();l.uniform1iv($,ea._array);aa=0;for(Ua=ea.value.length;aa<Ua;aa++)db=ea.value[aa],yb=ea._array[aa],db&&I.setTexture(db,yb);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+Kb)}}}}l.uniformMatrix4fv(oa.modelViewMatrix,!1,e._modelViewMatrix.elements);oa.normalMatrix&&l.uniformMatrix3fv(oa.normalMatrix,!1,e._normalMatrix.elements);null!==oa.modelMatrix&&l.uniformMatrix4fv(oa.modelMatrix,!1,e.matrixWorld.elements);return ra}function G(a,b){a.ambientLightColor.needsUpdate=b;
-a.directionalLightColor.needsUpdate=b;a.directionalLightDirection.needsUpdate=b;a.pointLightColor.needsUpdate=b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=b;a.hemisphereLightDirection.needsUpdate=
-b}function C(){var a=ec;a>=Ic&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Ic);ec+=1;return a}function B(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)}function y(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function D(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function J(a){a!==Jc&&(l.lineWidth(a),Jc=a)}function N(a,b,c){Kc!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):
-l.disable(l.POLYGON_OFFSET_FILL),Kc=a);!a||Lc===b&&Mc===c||(l.polygonOffset(b,c),Lc=b,Mc=c)}function Q(a,b,c){c?(l.texParameteri(a,l.TEXTURE_WRAP_S,S(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,S(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,S(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,S(b.minFilter))):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,R(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,
-R(b.minFilter)));hb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(l.texParameterf(a,hb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Nc)),b.__oldAnisotropy=b.anisotropy)}function E(a,b){if(a.width>b||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.log("THREE.WebGLRenderer:",a,"is too big ("+a.width+"x"+
-a.height+"). Resized to "+d.width+"x"+d.height+".");return d}return a}function da(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,
-l.RGBA4,b.width,b.height)}function V(a){a instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,a.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null))}function R(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?l.NEAREST:l.LINEAR}function S(a){if(a===THREE.RepeatWrapping)return l.REPEAT;
-if(a===THREE.ClampToEdgeWrapping)return l.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return l.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return l.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return l.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return l.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return l.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return l.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return l.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return l.UNSIGNED_BYTE;
-if(a===THREE.UnsignedShort4444Type)return l.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return l.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return l.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return l.BYTE;if(a===THREE.ShortType)return l.SHORT;if(a===THREE.UnsignedShortType)return l.UNSIGNED_SHORT;if(a===THREE.IntType)return l.INT;if(a===THREE.UnsignedIntType)return l.UNSIGNED_INT;if(a===THREE.FloatType)return l.FLOAT;if(a===THREE.AlphaFormat)return l.ALPHA;if(a===THREE.RGBFormat)return l.RGB;
-if(a===THREE.RGBAFormat)return l.RGBA;if(a===THREE.LuminanceFormat)return l.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return l.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return l.FUNC_ADD;if(a===THREE.SubtractEquation)return l.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return l.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return l.ZERO;if(a===THREE.OneFactor)return l.ONE;if(a===THREE.SrcColorFactor)return l.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return l.ONE_MINUS_SRC_COLOR;if(a===
-THREE.SrcAlphaFactor)return l.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return l.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return l.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return l.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return l.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return l.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return l.SRC_ALPHA_SATURATE;if(void 0!==Ea){if(a===THREE.RGB_S3TC_DXT1_Format)return Ea.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Ea.COMPRESSED_RGBA_S3TC_DXT1_EXT;
-if(a===THREE.RGBA_S3TC_DXT3_Format)return Ea.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ea.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(void 0!==Fa){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return Fa.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return Fa.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return Fa.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return Fa.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}return 0}console.log("THREE.WebGLRenderer",
-THREE.REVISION);a=a||{};var L=void 0!==a.canvas?a.canvas:document.createElement("canvas"),wa=void 0!==a.context?a.context:null,P=void 0!==a.precision?a.precision:"highp",xa=void 0!==a.alpha?a.alpha:!1,la=void 0!==a.depth?a.depth:!0,sa=void 0!==a.stencil?a.stencil:!0,K=void 0!==a.antialias?a.antialias:!1,ha=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ra=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Ia=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,ta=new THREE.Color(0),
-Ja=0,Ga=[],Ta={},Ca=[],fb=[],Ra=[];this.domElement=L;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=
-!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var I=this,Na=[],tb=null,ub=null,qb=-1,Xa=null,Tb=null,ec=0,Vb=-1,Kb=-1,ib=-1,Wb=-1,Xb=-1,kc=-1,jb=-1,Db=-1,Kc=null,Lc=null,Mc=null,Jc=null,lc=0,mc=0,kb=L.width,lb=L.height,tc=0,yc=0,rb=new Uint8Array(16),Gb=new Uint8Array(16),Ac=new THREE.Frustum,wc=new THREE.Matrix4,Dc=new THREE.Matrix4,
-Qa=new THREE.Vector3,va=new THREE.Vector3,Ub=!0,Hc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},l,Eb,Lb,hb,Ea,Fa,Fb;(function(){try{var a={alpha:xa,depth:la,stencil:sa,antialias:K,premultipliedAlpha:ha,preserveDrawingBuffer:ra};l=wa||L.getContext("webgl",a)||L.getContext("experimental-webgl",
-a);if(null===l)throw"Error creating WebGL context.";}catch(b){console.error(b)}Eb=l.getExtension("OES_texture_float");l.getExtension("OES_texture_float_linear");Lb=l.getExtension("OES_standard_derivatives");hb=l.getExtension("EXT_texture_filter_anisotropic")||l.getExtension("MOZ_EXT_texture_filter_anisotropic")||l.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ea=l.getExtension("WEBGL_compressed_texture_s3tc")||l.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
-Fa=l.getExtension("WEBGL_compressed_texture_pvrtc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");Fb=l.getExtension("OES_element_index_uint");null===Eb&&console.log("THREE.WebGLRenderer: Float textures not supported.");null===Lb&&console.log("THREE.WebGLRenderer: Standard derivatives not supported.");null===hb&&console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");null===Ea&&console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");null===Fa&&
-console.log("THREE.WebGLRenderer: PVRTC compressed textures not supported.");null===Fb&&console.log("THREE.WebGLRenderer: elementindex as unsigned integer not supported.");void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});Ia&&l.getExtension("EXT_frag_depth")})();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);
-l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.viewport(lc,mc,kb,lb);l.clearColor(ta.r,ta.g,ta.b,Ja);this.context=l;var Ic=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Tc=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Uc=l.getParameter(l.MAX_TEXTURE_SIZE),Sc=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),Nc=hb?l.getParameter(hb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,gc=0<Tc,fc=gc&&Eb;(Fa||Ea)&&l.getParameter(l.COMPRESSED_TEXTURE_FORMATS);var Vc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,
-l.HIGH_FLOAT),Wc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var Xc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),Yc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var Zc=0<Vc.precision&&0<Xc.precision,Oc=0<Wc.precision&&0<Yc.precision;"highp"!==P||Zc||(Oc?(P="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(P=
-"lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==P||Oc||(P="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));this.getContext=function(){return l};this.supportsVertexTextures=function(){return gc};this.supportsFloatTextures=function(){return Eb};this.supportsStandardDerivatives=function(){return Lb};this.supportsCompressedTextureS3TC=function(){return Ea};this.supportsCompressedTexturePVRTC=function(){return Fa};this.getMaxAnisotropy=
-function(){return Nc};this.getPrecision=function(){return P};this.setSize=function(a,b,c){L.width=a*this.devicePixelRatio;L.height=b*this.devicePixelRatio;!1!==c&&(L.style.width=a+"px",L.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){lc=a*this.devicePixelRatio;mc=b*this.devicePixelRatio;kb=c*this.devicePixelRatio;lb=d*this.devicePixelRatio;l.viewport(lc,mc,kb,lb)};this.setScissor=function(a,b,c,d){l.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,
-d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColor=function(a,b){ta.set(a);Ja=void 0!==b?b:1;l.clearColor(ta.r,ta.g,ta.b,Ja)};this.setClearColorHex=function(a,b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return ta};this.getClearAlpha=function(){return Ja};this.clear=function(a,b,c){var d=0;if(void 0===
-a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearColor=function(){l.clear(l.COLOR_BUFFER_BIT)};this.clearDepth=function(){l.clear(l.DEPTH_BUFFER_BIT)};this.clearStencil=function(){l.clear(l.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this,Ga,Ta,Ca);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this,Ga,Ta,
-Ca);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){tb=null;qb=Xa=Db=jb=ib=-1;Ub=!0;Kb=Vb=-1;this.shadowMapPlugin.update(a,b)};var Ec=function(a){a.target.traverse(function(a){a.removeEventListener("remove",Ec);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete Ta[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=Ca,c=b.length-1;0<=c;c--)b[c].object===a&&b.splice(c,1);delete a.__webglInit;delete a._modelViewMatrix;
-delete a._normalMatrix;delete a.__webglActive})},Fc=function(a){a=a.target;a.removeEventListener("dispose",Fc);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes)void 0!==a.attributes[b].buffer&&l.deleteBuffer(a.attributes[b].buffer);I.info.memory.geometries--}else if(void 0!==a.geometryGroups){b=0;for(var c=a.geometryGroupsList.length;b<c;b++){var d=a.geometryGroupsList[b];if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)l.deleteBuffer(d.__webglMorphTargetsBuffers[e]);
-if(void 0!==d.numMorphNormals)for(e=0,f=d.numMorphNormals;e<f;e++)l.deleteBuffer(d.__webglMorphNormalsBuffers[e]);Pc(d)}}else Pc(a)},hc=function(a){a=a.target;a.removeEventListener("dispose",hc);a.image&&a.image.__webglTextureCube?l.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,l.deleteTexture(a.__webglTexture));I.info.memory.textures--},Qc=function(a){a=a.target;a.removeEventListener("dispose",Qc);if(a&&a.__webglTexture)if(l.deleteTexture(a.__webglTexture),a instanceof
-THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)l.deleteFramebuffer(a.__webglFramebuffer[b]),l.deleteRenderbuffer(a.__webglRenderbuffer[b]);else l.deleteFramebuffer(a.__webglFramebuffer),l.deleteRenderbuffer(a.__webglRenderbuffer);I.info.memory.textures--},Gc=function(a){a=a.target;a.removeEventListener("dispose",Gc);zc(a)},Pc=function(a){void 0!==a.__webglVertexBuffer&&l.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&l.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&
-l.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&l.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&l.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&l.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&l.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&l.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&l.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&l.deleteBuffer(a.__webglLineBuffer);
-void 0!==a.__webglLineDistanceBuffer&&l.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)l.deleteBuffer(a.__webglCustomAttributesList[b].buffer);I.info.memory.geometries--},zc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Na.length;a<c;a++)if(d=Na[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Na.length;a<c;a++)d=Na[a],d.program!==b&&e.push(d);
-Na=e;l.deleteProgram(b);I.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){g();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=l.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=l.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=l.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=l.createBuffer());a.hasPositions&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,
-l.DYNAMIC_DRAW),f(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormals){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,k,m,n,p,r,s,t,q,u,v=3*a.count;for(u=0;u<v;u+=9)q=a.normalArray,d=q[u],e=q[u+1],k=q[u+2],m=q[u+3],p=q[u+4],s=q[u+5],n=q[u+6],r=q[u+7],t=q[u+8],d=(d+m+n)/3,e=(e+p+r)/3,k=(k+s+t)/3,q[u]=d,q[u+1]=e,q[u+2]=k,q[u+3]=d,q[u+4]=e,q[u+5]=k,q[u+6]=d,q[u+7]=e,q[u+8]=k}l.bufferData(l.ARRAY_BUFFER,a.normalArray,
-l.DYNAMIC_DRAW);f(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglUvBuffer),l.bufferData(l.ARRAY_BUFFER,a.uvArray,l.DYNAMIC_DRAW),f(b.attributes.uv),l.vertexAttribPointer(b.attributes.uv,2,l.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,a.colorArray,l.DYNAMIC_DRAW),f(b.attributes.color),l.vertexAttribPointer(b.attributes.color,
-3,l.FLOAT,!1,0,0));h();l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,h){if(!1!==d.visible)if(a=x(a,b,c,d,h),b=!1,c=16777215*f.id+2*a.id+(d.wireframe?1:0),c!==Xa&&(Xa=c,b=!0),b&&g(),h instanceof THREE.Mesh)if(h=!0===d.wireframe?l.LINES:l.TRIANGLES,c=f.attributes.index){var k,m;c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2);var n=f.offsets;if(0===n.length)b&&(e(d,a,f,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,
-c.array.length,k,0),I.info.render.calls++,I.info.render.vertices+=c.array.length,I.info.render.faces+=c.array.length/3;else{b=!0;for(var p=0,r=n.length;p<r;p++){var s=n[p].index;b&&(e(d,a,f,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer));l.drawElements(h,n[p].count,k,n[p].start*m);I.info.render.calls++;I.info.render.vertices+=n[p].count;I.info.render.faces+=n[p].count/3}}}else b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(h,0,d.array.length/3),I.info.render.calls++,I.info.render.vertices+=
-d.array.length/3,I.info.render.faces+=d.array.length/9;else if(h instanceof THREE.PointCloud)b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(l.POINTS,0,d.array.length/3),I.info.render.calls++,I.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,J(d.linewidth),c=f.attributes.index)if(c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=f.offsets,0===n.length)b&&(e(d,a,f,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,
-c.buffer)),l.drawElements(h,c.array.length,k,0),I.info.render.calls++,I.info.render.vertices+=c.array.length;else for(1<n.length&&(b=!0),p=0,r=n.length;p<r;p++)s=n[p].index,b&&(e(d,a,f,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),I.info.render.calls++,I.info.render.vertices+=n[p].count;else b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(h,0,d.array.length/3),I.info.render.calls++,I.info.render.points+=d.array.length/3};this.renderBuffer=function(a,
-b,c,d,e,k){if(!1!==d.visible){var m,p;c=x(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Xa&&(Xa=c,a=!0);a&&g();if(!d.morphTargets&&0<=b.position)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),f(b.position),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(k.morphTargetBase){c=d.program.attributes;-1!==k.morphTargetBase&&0<=c.position?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k.morphTargetBase]),f(c.position),l.vertexAttribPointer(c.position,
-3,l.FLOAT,!1,0,0)):0<=c.position&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),f(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length){var r=0;p=k.morphTargetForcedOrder;for(m=k.morphTargetInfluences;r<d.numSupportedMorphTargets&&r<p.length;)0<=c["morphTarget"+r]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[p[r]]),f(c["morphTarget"+r]),l.vertexAttribPointer(c["morphTarget"+r],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+r]&&d.morphNormals&&
-(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[p[r]]),f(c["morphNormal"+r]),l.vertexAttribPointer(c["morphNormal"+r],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[r]=m[p[r]],r++}else{p=[];m=k.morphTargetInfluences;var s,q=m.length;for(s=0;s<q;s++)r=m[s],0<r&&p.push([r,s]);p.length>d.numSupportedMorphTargets?(p.sort(n),p.length=d.numSupportedMorphTargets):p.length>d.numSupportedMorphNormals?p.sort(n):0===p.length&&p.push([0,0]);for(r=0;r<d.numSupportedMorphTargets;)p[r]?(s=p[r][1],0<=
-c["morphTarget"+r]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[s]),f(c["morphTarget"+r]),l.vertexAttribPointer(c["morphTarget"+r],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+r]&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[s]),f(c["morphNormal"+r]),l.vertexAttribPointer(c["morphNormal"+r],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[r]=m[s]):k.__webglMorphTargetInfluences[r]=0,r++}null!==d.program.uniforms.morphTargetInfluences&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,
-k.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(m=0,p=e.__webglCustomAttributesList.length;m<p;m++)c=e.__webglCustomAttributesList[m],0<=b[c.buffer.belongsToAttribute]&&(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),f(b[c.buffer.belongsToAttribute]),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0));0<=b.color&&(0<k.geometry.colors.length||0<k.geometry.faces.length?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),f(b.color),l.vertexAttribPointer(b.color,
-3,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=b.normal&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),f(b.normal),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));0<=b.tangent&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer),f(b.tangent),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));0<=b.uv&&(k.geometry.faceVertexUvs[0]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),f(b.uv),l.vertexAttribPointer(b.uv,2,l.FLOAT,
-!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(k.geometry.faceVertexUvs[1]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),f(b.uv2),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),f(b.skinIndex),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,
-e.__webglSkinWeightsBuffer),f(b.skinWeight),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0));0<=b.lineDistance&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglLineDistanceBuffer),f(b.lineDistance),l.vertexAttribPointer(b.lineDistance,1,l.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?l.UNSIGNED_INT:l.UNSIGNED_SHORT,d.wireframe?(J(d.wireframeLinewidth),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,k,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,
-e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,k,0)),I.info.render.calls++,I.info.render.vertices+=e.__webglFaceCount,I.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,J(d.linewidth),l.drawArrays(k,0,e.__webglLineCount),I.info.render.calls++):k instanceof THREE.PointCloud&&(l.drawArrays(l.POINTS,0,e.__webglParticleCount),I.info.render.calls++,I.info.render.points+=e.__webglParticleCount)}};this.render=function(a,
-b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h=a.fog;qb=-1;Tb=null;Ub=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});b.matrixWorldInverse.getInverse(b.matrixWorld);wc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ac.setFromMatrix(wc);Ga.length=0;fb.length=0;Ra.length=0;q(a,a,
-b);!0===I.sortObjects&&(fb.sort(k),Ra.sort(m));r(this.renderPluginsPre,a,b);I.info.render.calls=0;I.info.render.vertices=0;I.info.render.faces=0;I.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(e=Ca.length;d<e;d++)f=Ca[d],g=f.object,g.visible&&(B(g,b),p(f));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),
-N(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),t(fb,b,Ga,h,!0,d),t(Ra,b,Ga,h,!0,d),s(Ca,"",b,Ga,h,!1,d)):(d=null,this.setBlending(THREE.NoBlending),t(fb,b,Ga,h,!1,d),s(Ca,"opaque",b,Ga,h,!1,d),t(Ra,b,Ga,h,!0,d),s(Ca,"transparent",b,Ga,h,!0,d));r(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&V(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=x(a,b,c,d,e);Xa=
--1;I.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,Ac):e.render(function(a){I.renderBufferImmediate(a,f,d)})};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?l.disable(l.CULL_FACE):(b===THREE.FrontFaceDirectionCW?l.frontFace(l.CW):l.frontFace(l.CCW),a===THREE.CullFaceBack?l.cullFace(l.BACK):a===THREE.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),
-l.enable(l.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide;a=a.side===THREE.BackSide;Vb!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),Vb=b);Kb!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),Kb=a)};this.setDepthTest=function(a){jb!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),jb=a)};this.setDepthWrite=function(a){Db!==a&&(l.depthMask(a),Db=a)};this.setBlending=function(a,b,c,d){a!==ib&&(a===THREE.NoBlending?l.disable(l.BLEND):a===THREE.AdditiveBlending?
-(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):a===THREE.SubtractiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR)):a===THREE.CustomBlending?l.enable(l.BLEND):(l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),ib=
-a);if(a===THREE.CustomBlending){if(b!==Wb&&(l.blendEquation(S(b)),Wb=b),c!==Xb||d!==kc)l.blendFunc(S(c),S(d)),Xb=c,kc=d}else kc=Xb=Wb=null};this.uploadTexture=function(a){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",hc),a.__webglTexture=l.createTexture(),I.info.memory.textures++);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);
-a.image=E(a.image,Uc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=S(a.format),e=S(a.type);Q(l.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=0,h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,b.width,b.height,0,d,e,b.data);else if(a instanceof THREE.CompressedTexture)for(g=0,h=f.length;g<h;g++)b=f[g],a.format!==THREE.RGBAFormat?
-l.compressedTexImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,b.data):l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,d,e,a.image);a.generateMipmaps&&c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()};this.setTexture=function(a,b){l.activeTexture(l.TEXTURE0+b);a.needsUpdate?I.uploadTexture(a):l.bindTexture(l.TEXTURE_2D,
-a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Qc);a.__webglTexture=l.createTexture();I.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=S(a.format),e=S(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);
-Q(l.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=l.createFramebuffer();a.__webglRenderbuffer[f]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=l.TEXTURE_CUBE_MAP_POSITIVE_X+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,h,g.__webglTexture,0);da(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),
-a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),Q(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):
-a.depthBuffer&&a.stencilBuffer&&l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):da(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=kb,a=lb,d=lc,e=mc);b!==ub&&(l.bindFramebuffer(l.FRAMEBUFFER,
-b),l.viewport(d,e,c,a),ub=b);tc=c;yc=a};this.resetGLState=function(){Tb=tb=null;qb=Xa=Kb=Vb=Db=jb=ib=-1;Ub=!0};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+!Zb?E(za.image[ba],Vc):za.image[ba];var ac=$b[0],Ob=THREE.Math.isPowerOfTwo(ac.width)&&THREE.Math.isPowerOfTwo(ac.height),nb=S(za.format),Pb=S(za.type);Q(l.TEXTURE_CUBE_MAP,za,Ob);for(ba=0;6>ba;ba++)if(Zb)for(var ob,ia=$b[ba].mipmaps,zb=0,Wb=ia.length;zb<Wb;zb++)ob=ia[zb],za.format!==THREE.RGBAFormat?-1<kc.indexOf(nb)?l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ba,zb,nb,ob.width,ob.height,0,ob.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
+ba,zb,nb,ob.width,ob.height,0,nb,Pb,ob.data);else l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ba,0,nb,nb,Pb,$b[ba]);za.generateMipmaps&&Ob&&l.generateMipmap(l.TEXTURE_CUBE_MAP);za.needsUpdate=!1;if(za.onUpdate)za.onUpdate()}else l.activeTexture(l.TEXTURE0+Yb),l.bindTexture(l.TEXTURE_CUBE_MAP,za.image.__webglTextureCube)}else if(db instanceof THREE.WebGLRenderTargetCube){var Xb=db;l.activeTexture(l.TEXTURE0+yb);l.bindTexture(l.TEXTURE_CUBE_MAP,Xb.__webglTexture)}else I.setTexture(db,yb);break;case "tv":void 0===
+ea._array&&(ea._array=[]);aa=0;for(Ua=ea.value.length;aa<Ua;aa++)ea._array[aa]=C();l.uniform1iv($,ea._array);aa=0;for(Ua=ea.value.length;aa<Ua;aa++)db=ea.value[aa],yb=ea._array[aa],db&&I.setTexture(db,yb);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+Kb)}}}}l.uniformMatrix4fv(oa.modelViewMatrix,!1,e._modelViewMatrix.elements);oa.normalMatrix&&l.uniformMatrix3fv(oa.normalMatrix,!1,e._normalMatrix.elements);null!==oa.modelMatrix&&l.uniformMatrix4fv(oa.modelMatrix,!1,e.matrixWorld.elements);
+return ra}function G(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=b;a.directionalLightDirection.needsUpdate=b;a.pointLightColor.needsUpdate=b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=
+b;a.hemisphereLightDirection.needsUpdate=b}function C(){var a=ec;a>=Kc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Kc);ec+=1;return a}function B(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)}function y(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function D(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function J(a){a!==Lc&&(l.lineWidth(a),Lc=a)}function N(a,
+b,c){Mc!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),Mc=a);!a||Nc===b&&Oc===c||(l.polygonOffset(b,c),Nc=b,Oc=c)}function Q(a,b,c){c?(l.texParameteri(a,l.TEXTURE_WRAP_S,S(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,S(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,S(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,S(b.minFilter))):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,
+R(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,R(b.minFilter)));hb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(l.texParameterf(a,hb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Pc)),b.__oldAnisotropy=b.anisotropy)}function E(a,b){if(a.width>b||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.log("THREE.WebGLRenderer:",
+a,"is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height+".");return d}return a}function da(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,
+l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function V(a){a instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,a.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null))}function R(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?l.NEAREST:
+l.LINEAR}function S(a){if(a===THREE.RepeatWrapping)return l.REPEAT;if(a===THREE.ClampToEdgeWrapping)return l.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return l.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return l.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return l.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return l.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return l.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return l.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return l.LINEAR_MIPMAP_LINEAR;
+if(a===THREE.UnsignedByteType)return l.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return l.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return l.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return l.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return l.BYTE;if(a===THREE.ShortType)return l.SHORT;if(a===THREE.UnsignedShortType)return l.UNSIGNED_SHORT;if(a===THREE.IntType)return l.INT;if(a===THREE.UnsignedIntType)return l.UNSIGNED_INT;if(a===THREE.FloatType)return l.FLOAT;
+if(a===THREE.AlphaFormat)return l.ALPHA;if(a===THREE.RGBFormat)return l.RGB;if(a===THREE.RGBAFormat)return l.RGBA;if(a===THREE.LuminanceFormat)return l.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return l.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return l.FUNC_ADD;if(a===THREE.SubtractEquation)return l.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return l.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return l.ZERO;if(a===THREE.OneFactor)return l.ONE;if(a===THREE.SrcColorFactor)return l.SRC_COLOR;
+if(a===THREE.OneMinusSrcColorFactor)return l.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return l.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return l.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return l.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return l.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return l.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return l.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return l.SRC_ALPHA_SATURATE;if(null!==Ea){if(a===THREE.RGB_S3TC_DXT1_Format)return Ea.COMPRESSED_RGB_S3TC_DXT1_EXT;
+if(a===THREE.RGBA_S3TC_DXT1_Format)return Ea.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Ea.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ea.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==Fa){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return Fa.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return Fa.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return Fa.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return Fa.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}return 0}
+console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var L=void 0!==a.canvas?a.canvas:document.createElement("canvas"),wa=void 0!==a.context?a.context:null,P=void 0!==a.precision?a.precision:"highp",xa=void 0!==a.alpha?a.alpha:!1,la=void 0!==a.depth?a.depth:!0,sa=void 0!==a.stencil?a.stencil:!0,K=void 0!==a.antialias?a.antialias:!1,ha=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ra=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Ia=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:
+!1,ta=new THREE.Color(0),Ja=0,Ga=[],Ta={},Ca=[],fb=[],Ra=[];this.domElement=L;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=
+this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var I=this,Na=[],tb=null,ub=null,rb=-1,Xa=null,Tb=null,ec=0,Vb=-1,Kb=-1,ib=-1,Wb=-1,Xb=-1,Db=-1,jb=-1,Eb=-1,Mc=null,Nc=null,Oc=null,Lc=null,lc=0,mc=0,kb=L.width,lb=L.height,zc=0,Gc=0,sb=new Uint8Array(16),Gb=new Uint8Array(16),Ac=new THREE.Frustum,xc=new THREE.Matrix4,
+Dc=new THREE.Matrix4,Qa=new THREE.Vector3,va=new THREE.Vector3,Ub=!0,Jc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},l,Lb,nc,hb,Ea,Fa,Fb;(function(){try{var a={alpha:xa,depth:la,stencil:sa,antialias:K,premultipliedAlpha:ha,preserveDrawingBuffer:ra};l=wa||L.getContext("webgl",a)||
+L.getContext("experimental-webgl",a);if(null===l)throw"Error creating WebGL context.";}catch(b){console.error(b)}Lb=l.getExtension("OES_texture_float");l.getExtension("OES_texture_float_linear");nc=l.getExtension("OES_standard_derivatives");hb=l.getExtension("EXT_texture_filter_anisotropic")||l.getExtension("MOZ_EXT_texture_filter_anisotropic")||l.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ea=l.getExtension("WEBGL_compressed_texture_s3tc")||l.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||
+l.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Fa=l.getExtension("WEBGL_compressed_texture_pvrtc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");Fb=l.getExtension("OES_element_index_uint");null===Lb&&console.log("THREE.WebGLRenderer: Float textures not supported.");null===nc&&console.log("THREE.WebGLRenderer: Standard derivatives not supported.");null===hb&&console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");null===Ea&&console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");
+null===Fa&&console.log("THREE.WebGLRenderer: PVRTC compressed textures not supported.");null===Fb&&console.log("THREE.WebGLRenderer: elementindex as unsigned integer not supported.");void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});Ia&&l.getExtension("EXT_frag_depth")})();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);
+l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.viewport(lc,mc,kb,lb);l.clearColor(ta.r,ta.g,ta.b,Ja);this.context=l;var Kc=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Wc=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Xc=l.getParameter(l.MAX_TEXTURE_SIZE),Vc=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),Pc=hb?l.getParameter(hb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,gc=0<Wc,fc=gc&&Lb,kc=[];if(Fa||Ea)for(var Qc=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),uc=
+0;uc<Qc.length;uc++)kc.push(Qc[uc]);var Yc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT),Zc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var $c=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),ad=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var bd=0<Yc.precision&&0<$c.precision,Rc=0<Zc.precision&&0<ad.precision;"highp"!==P||bd||(Rc?(P=
+"mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(P="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==P||Rc||(P="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));this.getContext=function(){return l};this.supportsVertexTextures=function(){return gc};this.supportsFloatTextures=function(){return Lb};this.supportsStandardDerivatives=function(){return nc};this.supportsCompressedTextureS3TC=
+function(){return Ea};this.supportsCompressedTexturePVRTC=function(){return Fa};this.getMaxAnisotropy=function(){return Pc};this.getPrecision=function(){return P};this.setSize=function(a,b,c){L.width=a*this.devicePixelRatio;L.height=b*this.devicePixelRatio;!1!==c&&(L.style.width=a+"px",L.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){lc=a*this.devicePixelRatio;mc=b*this.devicePixelRatio;kb=c*this.devicePixelRatio;lb=d*this.devicePixelRatio;l.viewport(lc,mc,kb,lb)};
+this.setScissor=function(a,b,c,d){l.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColor=function(a,b){ta.set(a);Ja=void 0!==b?b:1;l.clearColor(ta.r,ta.g,ta.b,Ja)};this.setClearColorHex=function(a,b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=
+function(){return ta};this.getClearAlpha=function(){return Ja};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearColor=function(){l.clear(l.COLOR_BUFFER_BIT)};this.clearDepth=function(){l.clear(l.DEPTH_BUFFER_BIT)};this.clearStencil=function(){l.clear(l.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this,
+Ga,Ta,Ca);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this,Ga,Ta,Ca);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){tb=null;rb=Xa=Eb=jb=ib=-1;Ub=!0;Kb=Vb=-1;this.shadowMapPlugin.update(a,b)};var Ec=function(a){a.target.traverse(function(a){a.removeEventListener("remove",Ec);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete Ta[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=
+Ca,c=b.length-1;0<=c;c--)b[c].object===a&&b.splice(c,1);delete a.__webglInit;delete a._modelViewMatrix;delete a._normalMatrix;delete a.__webglActive})},Fc=function(a){a=a.target;a.removeEventListener("dispose",Fc);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes)void 0!==a.attributes[b].buffer&&l.deleteBuffer(a.attributes[b].buffer);I.info.memory.geometries--}else if(void 0!==a.geometryGroups){b=0;for(var c=a.geometryGroupsList.length;b<c;b++){var d=a.geometryGroupsList[b];
+if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)l.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals)for(e=0,f=d.numMorphNormals;e<f;e++)l.deleteBuffer(d.__webglMorphNormalsBuffers[e]);Sc(d)}}else Sc(a)},hc=function(a){a=a.target;a.removeEventListener("dispose",hc);a.image&&a.image.__webglTextureCube?l.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,l.deleteTexture(a.__webglTexture));I.info.memory.textures--},Tc=function(a){a=
+a.target;a.removeEventListener("dispose",Tc);if(a&&a.__webglTexture)if(l.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)l.deleteFramebuffer(a.__webglFramebuffer[b]),l.deleteRenderbuffer(a.__webglRenderbuffer[b]);else l.deleteFramebuffer(a.__webglFramebuffer),l.deleteRenderbuffer(a.__webglRenderbuffer);I.info.memory.textures--},Ic=function(a){a=a.target;a.removeEventListener("dispose",Ic);Hc(a)},Sc=function(a){void 0!==a.__webglVertexBuffer&&l.deleteBuffer(a.__webglVertexBuffer);
+void 0!==a.__webglNormalBuffer&&l.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&l.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&l.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&l.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&l.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&l.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&l.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==
+a.__webglFaceBuffer&&l.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&l.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&l.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)l.deleteBuffer(a.__webglCustomAttributesList[b].buffer);I.info.memory.geometries--},Hc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Na.length;a<c;a++)if(d=Na[a],d.program===
+b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Na.length;a<c;a++)d=Na[a],d.program!==b&&e.push(d);Na=e;l.deleteProgram(b);I.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){g();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=l.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=l.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=l.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=
+l.createBuffer());a.hasPositions&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),f(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormals){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,k,m,n,p,r,s,t,q,u,v=3*a.count;for(u=0;u<v;u+=9)q=a.normalArray,d=q[u],e=q[u+1],k=q[u+2],m=q[u+3],p=q[u+4],s=q[u+5],n=q[u+6],r=q[u+7],t=q[u+8],d=(d+m+n)/3,e=(e+
+p+r)/3,k=(k+s+t)/3,q[u]=d,q[u+1]=e,q[u+2]=k,q[u+3]=d,q[u+4]=e,q[u+5]=k,q[u+6]=d,q[u+7]=e,q[u+8]=k}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);f(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglUvBuffer),l.bufferData(l.ARRAY_BUFFER,a.uvArray,l.DYNAMIC_DRAW),f(b.attributes.uv),l.vertexAttribPointer(b.attributes.uv,2,l.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(l.bindBuffer(l.ARRAY_BUFFER,
+a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,a.colorArray,l.DYNAMIC_DRAW),f(b.attributes.color),l.vertexAttribPointer(b.attributes.color,3,l.FLOAT,!1,0,0));h();l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,h){if(!1!==d.visible)if(a=x(a,b,c,d,h),b=!1,c=16777215*f.id+2*a.id+(d.wireframe?1:0),c!==Xa&&(Xa=c,b=!0),b&&g(),h instanceof THREE.Mesh)if(h=!0===d.wireframe?l.LINES:l.TRIANGLES,c=f.attributes.index){var k,m;c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,
+m=4):(k=l.UNSIGNED_SHORT,m=2);var n=f.offsets;if(0===n.length)b&&(e(d,a,f,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),I.info.render.calls++,I.info.render.vertices+=c.array.length,I.info.render.faces+=c.array.length/3;else{b=!0;for(var p=0,r=n.length;p<r;p++){var s=n[p].index;b&&(e(d,a,f,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer));l.drawElements(h,n[p].count,k,n[p].start*m);I.info.render.calls++;I.info.render.vertices+=n[p].count;I.info.render.faces+=
+n[p].count/3}}}else b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(h,0,d.array.length/3),I.info.render.calls++,I.info.render.vertices+=d.array.length/3,I.info.render.faces+=d.array.length/9;else if(h instanceof THREE.PointCloud)b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(l.POINTS,0,d.array.length/3),I.info.render.calls++,I.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,J(d.linewidth),c=f.attributes.index)if(c.array instanceof
+Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=f.offsets,0===n.length)b&&(e(d,a,f,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),I.info.render.calls++,I.info.render.vertices+=c.array.length;else for(1<n.length&&(b=!0),p=0,r=n.length;p<r;p++)s=n[p].index,b&&(e(d,a,f,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),I.info.render.calls++,I.info.render.vertices+=n[p].count;else b&&e(d,a,f,0),d=f.attributes.position,
+l.drawArrays(h,0,d.array.length/3),I.info.render.calls++,I.info.render.points+=d.array.length/3};this.renderBuffer=function(a,b,c,d,e,k){if(!1!==d.visible){var m,p;c=x(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Xa&&(Xa=c,a=!0);a&&g();if(!d.morphTargets&&0<=b.position)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),f(b.position),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(k.morphTargetBase){c=d.program.attributes;-1!==k.morphTargetBase&&0<=c.position?
+(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k.morphTargetBase]),f(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):0<=c.position&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),f(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length){var r=0;p=k.morphTargetForcedOrder;for(m=k.morphTargetInfluences;r<d.numSupportedMorphTargets&&r<p.length;)0<=c["morphTarget"+r]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[p[r]]),
+f(c["morphTarget"+r]),l.vertexAttribPointer(c["morphTarget"+r],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+r]&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[p[r]]),f(c["morphNormal"+r]),l.vertexAttribPointer(c["morphNormal"+r],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[r]=m[p[r]],r++}else{p=[];m=k.morphTargetInfluences;var s,q=m.length;for(s=0;s<q;s++)r=m[s],0<r&&p.push([r,s]);p.length>d.numSupportedMorphTargets?(p.sort(n),p.length=d.numSupportedMorphTargets):p.length>
+d.numSupportedMorphNormals?p.sort(n):0===p.length&&p.push([0,0]);for(r=0;r<d.numSupportedMorphTargets;)p[r]?(s=p[r][1],0<=c["morphTarget"+r]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[s]),f(c["morphTarget"+r]),l.vertexAttribPointer(c["morphTarget"+r],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+r]&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[s]),f(c["morphNormal"+r]),l.vertexAttribPointer(c["morphNormal"+r],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[r]=
+m[s]):k.__webglMorphTargetInfluences[r]=0,r++}null!==d.program.uniforms.morphTargetInfluences&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(m=0,p=e.__webglCustomAttributesList.length;m<p;m++)c=e.__webglCustomAttributesList[m],0<=b[c.buffer.belongsToAttribute]&&(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),f(b[c.buffer.belongsToAttribute]),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0));0<=b.color&&
+(0<k.geometry.colors.length||0<k.geometry.faces.length?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),f(b.color),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=b.normal&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),f(b.normal),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));0<=b.tangent&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer),f(b.tangent),l.vertexAttribPointer(b.tangent,4,
+l.FLOAT,!1,0,0));0<=b.uv&&(k.geometry.faceVertexUvs[0]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),f(b.uv),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(k.geometry.faceVertexUvs[1]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),f(b.uv2),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&
+0<=b.skinWeight&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),f(b.skinIndex),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),f(b.skinWeight),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0));0<=b.lineDistance&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglLineDistanceBuffer),f(b.lineDistance),l.vertexAttribPointer(b.lineDistance,1,l.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?l.UNSIGNED_INT:l.UNSIGNED_SHORT,
+d.wireframe?(J(d.wireframeLinewidth),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,k,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,k,0)),I.info.render.calls++,I.info.render.vertices+=e.__webglFaceCount,I.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,J(d.linewidth),l.drawArrays(k,0,e.__webglLineCount),I.info.render.calls++):
+k instanceof THREE.PointCloud&&(l.drawArrays(l.POINTS,0,e.__webglParticleCount),I.info.render.calls++,I.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h=a.fog;rb=-1;Tb=null;Ub=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});
+b.matrixWorldInverse.getInverse(b.matrixWorld);xc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ac.setFromMatrix(xc);Ga.length=0;fb.length=0;Ra.length=0;q(a,a,b);!0===I.sortObjects&&(fb.sort(k),Ra.sort(m));r(this.renderPluginsPre,a,b);I.info.render.calls=0;I.info.render.vertices=0;I.info.render.faces=0;I.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(e=Ca.length;d<e;d++)f=Ca[d],g=f.object,
+g.visible&&(B(g,b),p(f));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),N(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),t(fb,b,Ga,h,!0,d),t(Ra,b,Ga,h,!0,d),s(Ca,"",b,Ga,h,!1,d)):(d=null,this.setBlending(THREE.NoBlending),t(fb,b,Ga,h,!1,d),s(Ca,"opaque",b,Ga,h,!1,d),t(Ra,b,Ga,h,!0,d),s(Ca,"transparent",b,Ga,h,!0,d));r(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&
+c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&V(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=x(a,b,c,d,e);Xa=-1;I.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,Ac):e.render(function(a){I.renderBufferImmediate(a,f,d)})};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?l.disable(l.CULL_FACE):
+(b===THREE.FrontFaceDirectionCW?l.frontFace(l.CW):l.frontFace(l.CCW),a===THREE.CullFaceBack?l.cullFace(l.BACK):a===THREE.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide;a=a.side===THREE.BackSide;Vb!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),Vb=b);Kb!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),Kb=a)};this.setDepthTest=function(a){jb!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),
+jb=a)};this.setDepthWrite=function(a){Eb!==a&&(l.depthMask(a),Eb=a)};this.setBlending=function(a,b,c,d){a!==ib&&(a===THREE.NoBlending?l.disable(l.BLEND):a===THREE.AdditiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):a===THREE.SubtractiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR)):a===THREE.CustomBlending?
+l.enable(l.BLEND):(l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),ib=a);if(a===THREE.CustomBlending){if(b!==Wb&&(l.blendEquation(S(b)),Wb=b),c!==Xb||d!==Db)l.blendFunc(S(c),S(d)),Xb=c,Db=d}else Db=Xb=Wb=null};this.uploadTexture=function(a){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",hc),a.__webglTexture=l.createTexture(),I.info.memory.textures++);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);
+l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=E(a.image,Xc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=S(a.format),e=S(a.type);Q(l.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=0,h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);a.generateMipmaps=
+!1}else l.texImage2D(l.TEXTURE_2D,0,d,b.width,b.height,0,d,e,b.data);else if(a instanceof THREE.CompressedTexture)for(g=0,h=f.length;g<h;g++)b=f[g],a.format!==THREE.RGBAFormat?-1<kc.indexOf(d)?l.compressedTexImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,b.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=
+!1}else l.texImage2D(l.TEXTURE_2D,0,d,d,e,a.image);a.generateMipmaps&&c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()};this.setTexture=function(a,b){l.activeTexture(l.TEXTURE0+b);a.needsUpdate?I.uploadTexture(a):l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",
+Tc);a.__webglTexture=l.createTexture();I.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=S(a.format),e=S(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);Q(l.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=l.createFramebuffer();a.__webglRenderbuffer[f]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=l.TEXTURE_CUBE_MAP_POSITIVE_X+
+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,h,g.__webglTexture,0);da(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),Q(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,
+a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):da(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,
+null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=kb,a=lb,d=lc,e=mc);b!==ub&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),ub=b);zc=c;Gc=a};this.resetGLState=function(){Tb=tb=null;rb=Xa=Kb=Vb=Eb=jb=ib=-1;Ub=!0};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:
 THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
 THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){this.width=a;this.height=b},clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;

+ 23 - 5
src/renderers/WebGLRenderer.js

@@ -212,7 +212,17 @@ THREE.WebGLRenderer = function ( parameters ) {
 	var _supportsVertexTextures = ( _maxVertexTextures > 0 );
 	var _supportsBoneTextures = _supportsVertexTextures && _glExtensionTextureFloat;
 
-	var _compressedTextureFormats = ( _glExtensionCompressedTexturePVRTC || _glExtensionCompressedTextureS3TC ) ? _gl.getParameter( _gl.COMPRESSED_TEXTURE_FORMATS ) : [];
+	// COMPRESSED_TEXTURE_FORMATS return IntArray
+	// but we need Array.indexOf to test formats availabilities
+	var _compressedTextureFormats = [];
+
+	if( _glExtensionCompressedTexturePVRTC || _glExtensionCompressedTextureS3TC ) {
+		var compressedfmts = _gl.getParameter( _gl.COMPRESSED_TEXTURE_FORMATS );
+		for( var i = 0; i < compressedfmts.length; i++ ){
+			_compressedTextureFormats.push( compressedfmts[i] );
+		}
+	}
+
 
 	//
 
@@ -5588,7 +5598,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				mipmap = mipmaps[ i ];
 				if ( texture.format !== THREE.RGBAFormat ) {
-					_gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
+					if ( _compressedTextureFormats.indexOf( glFormat ) > -1 ) {
+						_gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
+					} else {
+						console.warn( "Attempt to load unsupported compressed texture format" );
+					}
 				} else {
 					_gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
 				}
@@ -5731,7 +5745,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 							mipmap = mipmaps[ j ];
 							if ( texture.format !== THREE.RGBAFormat ) {
 
-								_gl.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
+								if ( _compressedTextureFormats.indexOf( glFormat ) > -1 ) {
+									_gl.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
+								} else {
+									console.warn( "Attempt to load unsupported compressed texture format" );
+								}
 
 							} else {
 								_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
@@ -6038,7 +6056,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		if ( p === THREE.OneMinusDstColorFactor ) return _gl.ONE_MINUS_DST_COLOR;
 		if ( p === THREE.SrcAlphaSaturateFactor ) return _gl.SRC_ALPHA_SATURATE;
 
-		if ( _glExtensionCompressedTextureS3TC !== undefined ) {
+		if ( _glExtensionCompressedTextureS3TC !== null ) {
 
 			if ( p === THREE.RGB_S3TC_DXT1_Format ) return _glExtensionCompressedTextureS3TC.COMPRESSED_RGB_S3TC_DXT1_EXT;
 			if ( p === THREE.RGBA_S3TC_DXT1_Format ) return _glExtensionCompressedTextureS3TC.COMPRESSED_RGBA_S3TC_DXT1_EXT;
@@ -6047,7 +6065,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		if ( _glExtensionCompressedTexturePVRTC !== undefined ) {
+		if ( _glExtensionCompressedTexturePVRTC !== null ) {
 
 			if ( p === THREE.RGB_PVRTC_4BPPV1_Format  ) return _glExtensionCompressedTexturePVRTC.COMPRESSED_RGB_PVRTC_4BPPV1_IMG  ;
 			if ( p === THREE.RGB_PVRTC_2BPPV1_Format  ) return _glExtensionCompressedTexturePVRTC.COMPRESSED_RGB_PVRTC_2BPPV1_IMG  ;