2
0
Mr.doob 8 жил өмнө
parent
commit
c95f926603

+ 6 - 4
build/three.js

@@ -16333,11 +16333,8 @@
 
 				if ( boxMesh === undefined ) {
 
-					// Normalized box
-					// 1.1547 = (1,1,1).normalize() * 2.0
-
 					boxMesh = new Mesh(
-						new BoxBufferGeometry( 1.1547, 1.1547, 1.1547 ),
+						new BoxBufferGeometry( 1, 1, 1 ),
 						new ShaderMaterial( {
 							uniforms: ShaderLib.cube.uniforms,
 							vertexShader: ShaderLib.cube.vertexShader,
@@ -16345,6 +16342,7 @@
 							side: BackSide,
 							depthTest: true,
 							depthWrite: false,
+							polygonOffset: true,
 							fog: false
 						} )
 					);
@@ -16359,6 +16357,8 @@
 						this.matrixWorld.makeScale( scale, scale, scale );
 						this.matrixWorld.copyPosition( camera.matrixWorld );
 
+						this.material.polygonOffsetUnits = scale * 10;
+
 					};
 
 					geometries.update( boxMesh.geometry );
@@ -21868,6 +21868,8 @@
 			state.buffers.depth.setMask( true );
 			state.buffers.color.setMask( true );
 
+			state.setPolygonOffset( false );
+
 			if ( vr.enabled ) {
 
 				vr.submitFrame();

+ 39 - 39
build/three.min.js

@@ -15,13 +15,13 @@ h.map[e.id]=e;break}else q=g.map[n],void 0===q&&(q=new Ke(n),n=g,g=q,n.seq.push(
 0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);c.bindTexture(b.TEXTURE_2D,B);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
 b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);var J=y={vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
 fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},Ma=b.createProgram(),z=b.createShader(b.FRAGMENT_SHADER),
-Z=b.createShader(b.VERTEX_SHADER),w="precision "+e.precision+" float;\n";b.shaderSource(z,w+J.fragmentShader);b.shaderSource(Z,w+J.vertexShader);b.compileShader(z);b.compileShader(Z);b.attachShader(Ma,z);b.attachShader(Ma,Z);b.linkProgram(Ma);A=Ma;t=b.getAttribLocation(A,"position");m=b.getAttribLocation(A,"uv");f=b.getUniformLocation(A,"renderType");g=b.getUniformLocation(A,"map");h=b.getUniformLocation(A,"occlusionMap");k=b.getUniformLocation(A,"opacity");l=b.getUniformLocation(A,"color");r=b.getUniformLocation(A,
-"scale");n=b.getUniformLocation(A,"rotation");q=b.getUniformLocation(A,"screenPosition")}c.useProgram(A);c.initAttributes();c.enableAttribute(t);c.enableAttribute(m);c.disableUnusedAttributes();b.uniform1i(h,0);b.uniform1i(g,1);b.bindBuffer(b.ARRAY_BUFFER,v);b.vertexAttribPointer(t,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,x);c.disable(b.CULL_FACE);c.buffers.depth.setMask(!1);Ma=0;for(z=a.length;Ma<z;Ma++)if(J=16/ma.w,Ba.set(J*H,J),Z=a[Ma],u.set(Z.matrixWorld.elements[12],
-Z.matrixWorld.elements[13],Z.matrixWorld.elements[14]),u.applyMatrix4(ya.matrixWorldInverse),u.applyMatrix4(ya.projectionMatrix),U.copy(u),M.x=ma.x+U.x*sa+sa-8,M.y=ma.y+U.y*ld+ld-8,!0===V.containsPoint(M)){c.activeTexture(b.TEXTURE0);c.bindTexture(b.TEXTURE_2D,null);c.activeTexture(b.TEXTURE1);c.bindTexture(b.TEXTURE_2D,I);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,M.x,M.y,16,16,0);b.uniform1i(f,0);b.uniform2f(r,Ba.x,Ba.y);b.uniform3f(q,U.x,U.y,U.z);c.disable(b.BLEND);c.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,
-6,b.UNSIGNED_SHORT,0);c.activeTexture(b.TEXTURE0);c.bindTexture(b.TEXTURE_2D,B);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,M.x,M.y,16,16,0);b.uniform1i(f,1);c.disable(b.DEPTH_TEST);c.activeTexture(b.TEXTURE1);c.bindTexture(b.TEXTURE_2D,I);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);Z.positionScreen.copy(U);Z.customUpdateCallback?Z.customUpdateCallback(Z):Z.updateLensFlares();b.uniform1i(f,2);c.enable(b.BLEND);for(var w=0,F=Z.lensFlares.length;w<F;w++){var D=Z.lensFlares[w];.001<D.opacity&&.001<D.scale&&
-(U.x=D.x,U.y=D.y,U.z=D.z,J=D.size*D.scale/ma.w,Ba.x=J*H,Ba.y=J,b.uniform3f(q,U.x,U.y,U.z),b.uniform2f(r,Ba.x,Ba.y),b.uniform1f(n,D.rotation),b.uniform1f(k,D.opacity),b.uniform3f(l,D.color.r,D.color.g,D.color.b),c.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst),d.setTexture2D(D.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}}c.enable(b.CULL_FACE);c.enable(b.DEPTH_TEST);c.buffers.depth.setMask(!0);c.reset()}}}function qc(a,b,c,d,e,f,g,h,k){ca.call(this,a,b,c,d,e,f,g,h,k);
-this.needsUpdate=!0}function Nf(a,b,c,d,e){var f,g,h,k,l,r,n,q,t,m,v,x,y,A,I,B,H;function sa(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:b.id-a.id}var ya,ma,ea,Le,ld=new p,J=new Y,Ba=new p;this.render=function(u,p,V){if(0!==u.length){if(void 0===ea){var M=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),z=new Uint16Array([0,1,2,0,2,3]);ya=b.createBuffer();ma=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,ya);b.bufferData(b.ARRAY_BUFFER,M,b.STATIC_DRAW);
-b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,ma);b.bufferData(b.ELEMENT_ARRAY_BUFFER,z,b.STATIC_DRAW);M=b.createProgram();z=b.createShader(b.VERTEX_SHADER);var w=b.createShader(b.FRAGMENT_SHADER);b.shaderSource(z,["precision "+e.precision+" float;","#define SHADER_NAME SpriteMaterial\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
+aa=b.createShader(b.VERTEX_SHADER),w="precision "+e.precision+" float;\n";b.shaderSource(z,w+J.fragmentShader);b.shaderSource(aa,w+J.vertexShader);b.compileShader(z);b.compileShader(aa);b.attachShader(Ma,z);b.attachShader(Ma,aa);b.linkProgram(Ma);A=Ma;t=b.getAttribLocation(A,"position");m=b.getAttribLocation(A,"uv");f=b.getUniformLocation(A,"renderType");g=b.getUniformLocation(A,"map");h=b.getUniformLocation(A,"occlusionMap");k=b.getUniformLocation(A,"opacity");l=b.getUniformLocation(A,"color");r=
+b.getUniformLocation(A,"scale");n=b.getUniformLocation(A,"rotation");q=b.getUniformLocation(A,"screenPosition")}c.useProgram(A);c.initAttributes();c.enableAttribute(t);c.enableAttribute(m);c.disableUnusedAttributes();b.uniform1i(h,0);b.uniform1i(g,1);b.bindBuffer(b.ARRAY_BUFFER,v);b.vertexAttribPointer(t,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,x);c.disable(b.CULL_FACE);c.buffers.depth.setMask(!1);Ma=0;for(z=a.length;Ma<z;Ma++)if(J=16/ma.w,
+Ba.set(J*H,J),aa=a[Ma],u.set(aa.matrixWorld.elements[12],aa.matrixWorld.elements[13],aa.matrixWorld.elements[14]),u.applyMatrix4(ya.matrixWorldInverse),u.applyMatrix4(ya.projectionMatrix),U.copy(u),M.x=ma.x+U.x*sa+sa-8,M.y=ma.y+U.y*ld+ld-8,!0===V.containsPoint(M)){c.activeTexture(b.TEXTURE0);c.bindTexture(b.TEXTURE_2D,null);c.activeTexture(b.TEXTURE1);c.bindTexture(b.TEXTURE_2D,I);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,M.x,M.y,16,16,0);b.uniform1i(f,0);b.uniform2f(r,Ba.x,Ba.y);b.uniform3f(q,U.x,U.y,
+U.z);c.disable(b.BLEND);c.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);c.activeTexture(b.TEXTURE0);c.bindTexture(b.TEXTURE_2D,B);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,M.x,M.y,16,16,0);b.uniform1i(f,1);c.disable(b.DEPTH_TEST);c.activeTexture(b.TEXTURE1);c.bindTexture(b.TEXTURE_2D,I);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);aa.positionScreen.copy(U);aa.customUpdateCallback?aa.customUpdateCallback(aa):aa.updateLensFlares();b.uniform1i(f,2);c.enable(b.BLEND);for(var w=
+0,F=aa.lensFlares.length;w<F;w++){var D=aa.lensFlares[w];.001<D.opacity&&.001<D.scale&&(U.x=D.x,U.y=D.y,U.z=D.z,J=D.size*D.scale/ma.w,Ba.x=J*H,Ba.y=J,b.uniform3f(q,U.x,U.y,U.z),b.uniform2f(r,Ba.x,Ba.y),b.uniform1f(n,D.rotation),b.uniform1f(k,D.opacity),b.uniform3f(l,D.color.r,D.color.g,D.color.b),c.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst),d.setTexture2D(D.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}}c.enable(b.CULL_FACE);c.enable(b.DEPTH_TEST);c.buffers.depth.setMask(!0);
+c.reset()}}}function qc(a,b,c,d,e,f,g,h,k){ca.call(this,a,b,c,d,e,f,g,h,k);this.needsUpdate=!0}function Nf(a,b,c,d,e){var f,g,h,k,l,r,n,q,t,m,v,x,y,A,I,B,H;function sa(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:b.id-a.id}var ya,ma,ea,Le,ld=new p,J=new Y,Ba=new p;this.render=function(u,p,V){if(0!==u.length){if(void 0===ea){var M=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),z=new Uint16Array([0,1,2,0,2,3]);ya=b.createBuffer();ma=b.createBuffer();
+b.bindBuffer(b.ARRAY_BUFFER,ya);b.bufferData(b.ARRAY_BUFFER,M,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,ma);b.bufferData(b.ELEMENT_ARRAY_BUFFER,z,b.STATIC_DRAW);M=b.createProgram();z=b.createShader(b.VERTEX_SHADER);var w=b.createShader(b.FRAGMENT_SHADER);b.shaderSource(z,["precision "+e.precision+" float;","#define SHADER_NAME SpriteMaterial\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
 b.shaderSource(w,["precision "+e.precision+" float;","#define SHADER_NAME SpriteMaterial\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n"));
 b.compileShader(z);b.compileShader(w);b.attachShader(M,z);b.attachShader(M,w);b.linkProgram(M);ea=M;B=b.getAttribLocation(ea,"position");H=b.getAttribLocation(ea,"uv");f=b.getUniformLocation(ea,"uvOffset");g=b.getUniformLocation(ea,"uvScale");h=b.getUniformLocation(ea,"rotation");k=b.getUniformLocation(ea,"scale");l=b.getUniformLocation(ea,"color");r=b.getUniformLocation(ea,"map");n=b.getUniformLocation(ea,"opacity");q=b.getUniformLocation(ea,"modelViewMatrix");t=b.getUniformLocation(ea,"projectionMatrix");
 m=b.getUniformLocation(ea,"fogType");v=b.getUniformLocation(ea,"fogDensity");x=b.getUniformLocation(ea,"fogNear");y=b.getUniformLocation(ea,"fogFar");A=b.getUniformLocation(ea,"fogColor");I=b.getUniformLocation(ea,"alphaTest");M=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");M.width=8;M.height=8;z=M.getContext("2d");z.fillStyle="white";z.fillRect(0,0,8,8);Le=new qc(M)}c.useProgram(ea);c.initAttributes();c.enableAttribute(B);c.enableAttribute(H);c.disableUnusedAttributes();c.disable(b.CULL_FACE);
@@ -57,13 +57,13 @@ new z(r,3));this.addAttribute("uv",new z(n,2))}function xc(a,b,c,d){O.call(this)
 for(b=0;b<g;b++)n.push(b*k-e,-m,0),q.push(0,0,1),t.push(b/c),t.push(1-a/d)}for(a=0;a<d;a++)for(b=0;b<c;b++)e=b+g*(a+1),f=b+1+g*(a+1),h=b+1+g*a,r.push(b+g*a,e,h),r.push(e,f,h);this.setIndex(r);this.addAttribute("position",new z(n,3));this.addAttribute("normal",new z(q,3));this.addAttribute("uv",new z(t,2))}function va(a){N.call(this);this.type="MeshBasicMaterial";this.color=new D(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=
 this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=this.skinning=!1;this.setValues(a)}function ib(a,b){this.origin=void 0!==a?a:new p;this.direction=void 0!==b?b:new p}function Hb(a,b){this.start=void 0!==a?a:new p;this.end=void 0!==b?b:new p}function Sa(a,b,c){this.a=void 0!==a?a:new p;this.b=void 0!==b?b:new p;this.c=void 0!==c?c:new p}function fa(a,
 b){w.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new F;this.material=void 0!==b?b:new va({color:16777215*Math.random()});this.drawMode=0;this.updateMorphTargets()}function Rf(a,b,c,d){function e(a,c){b.buffers.color.setClear(a.r,a.g,a.b,c,d)}var f=new D(0),g=0,h,k,l;return{getClearColor:function(){return f},setClearColor:function(a,b){f.set(a);g=void 0!==b?b:1;e(f,g)},getClearAlpha:function(){return g},setClearAlpha:function(a){g=a;e(f,g)},render:function(b,d,q,t){d=d.background;null===
-d?e(f,g):d&&d.isColor&&(e(d,1),t=!0);(a.autoClear||t)&&a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil);d&&d.isCubeTexture?(void 0===l&&(l=new fa(new gb(1.1547,1.1547,1.1547),new qa({uniforms:jb.cube.uniforms,vertexShader:jb.cube.vertexShader,fragmentShader:jb.cube.fragmentShader,side:1,depthTest:!0,depthWrite:!1,fog:!1})),l.geometry.removeAttribute("normal"),l.geometry.removeAttribute("uv"),l.onBeforeRender=function(a,b,c){a=c.far;this.matrixWorld.makeScale(a,a,a);this.matrixWorld.copyPosition(c.matrixWorld)},
-c.update(l.geometry)),l.material.uniforms.tCube.value=d,b.push(l,l.geometry,l.material,0,null)):d&&d.isTexture&&(void 0===h&&(h=new Fb(-1,1,1,-1,0,1),k=new fa(new hb(2,2),new va({depthTest:!1,depthWrite:!1,fog:!1})),c.update(k.geometry)),k.material.map=d,a.renderBufferDirect(h,null,k.geometry,k.material,k,null))}}}function Sf(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.program&&b.program&&a.program!==b.program?a.program.id-b.program.id:a.material.id!==b.material.id?a.material.id-
-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function Tf(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function Uf(){var a=[],b=0,c=[],d=[];return{opaque:c,transparent:d,init:function(){b=0;c.length=0;d.length=0},push:function(e,f,g,h,k){var l=a[b];void 0===l?(l={id:e.id,object:e,geometry:f,material:g,program:g.program,renderOrder:e.renderOrder,z:h,group:k},a[b]=l):(l.id=e.id,l.object=e,l.geometry=f,l.material=g,l.program=g.program,l.renderOrder=e.renderOrder,
-l.z=h,l.group=k);(!0===g.transparent?d:c).push(l);b++},sort:function(){1<c.length&&c.sort(Sf);1<d.length&&d.sort(Tf)}}}function Vf(){var a={};return{get:function(b,c){b=b.id+","+c.id;c=a[b];void 0===c&&(c=new Uf,a[b]=c);return c},dispose:function(){a={}}}}function Wf(a,b){return Math.abs(b[1])-Math.abs(a[1])}function Xf(a){var b={},c=new Float32Array(8);return{update:function(d,e,f,g){var h=d.morphTargetInfluences,k=h.length;d=b[e.id];if(void 0===d){d=[];for(var l=0;l<k;l++)d[l]=[l,0];b[e.id]=d}var r=
-f.morphTargets&&e.morphAttributes.position;f=f.morphNormals&&e.morphAttributes.normal;for(l=0;l<k;l++){var n=d[l];0!==n[1]&&(r&&e.removeAttribute("morphTarget"+l),f&&e.removeAttribute("morphNormal"+l))}for(l=0;l<k;l++)n=d[l],n[0]=l,n[1]=h[l];d.sort(Wf);for(l=0;8>l;l++){if(n=d[l])if(h=n[0],n=n[1]){r&&e.addAttribute("morphTarget"+l,r[h]);f&&e.addAttribute("morphNormal"+l,f[h]);c[l]=n;continue}c[l]=0}g.getUniforms().setValue(a,"morphTargetInfluences",c)}}}function Yf(a,b,c){var d,e,f;this.setMode=function(a){d=
-a};this.setIndex=function(a){e=a.type;f=a.bytesPerElement};this.render=function(b,h){a.drawElements(d,h,e,b*f);c.calls++;c.vertices+=h;d===a.TRIANGLES?c.faces+=h/3:d===a.POINTS&&(c.points+=h)};this.renderInstances=function(g,h,k){var l=b.get("ANGLE_instanced_arrays");null===l?console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(l.drawElementsInstancedANGLE(d,k,e,h*f,g.maxInstancedCount),c.calls++,c.vertices+=
-k*g.maxInstancedCount,d===a.TRIANGLES?c.faces+=g.maxInstancedCount*k/3:d===a.POINTS&&(c.points+=g.maxInstancedCount*k))}}function Zf(a,b,c){var d;this.setMode=function(a){d=a};this.render=function(b,f){a.drawArrays(d,b,f);c.calls++;c.vertices+=f;d===a.TRIANGLES?c.faces+=f/3:d===a.POINTS&&(c.points+=f)};this.renderInstances=function(e,f,g){var h=b.get("ANGLE_instanced_arrays");if(null===h)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
+d?e(f,g):d&&d.isColor&&(e(d,1),t=!0);(a.autoClear||t)&&a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil);d&&d.isCubeTexture?(void 0===l&&(l=new fa(new gb(1,1,1),new qa({uniforms:jb.cube.uniforms,vertexShader:jb.cube.vertexShader,fragmentShader:jb.cube.fragmentShader,side:1,depthTest:!0,depthWrite:!1,polygonOffset:!0,fog:!1})),l.geometry.removeAttribute("normal"),l.geometry.removeAttribute("uv"),l.onBeforeRender=function(a,b,c){a=c.far;this.matrixWorld.makeScale(a,a,a);this.matrixWorld.copyPosition(c.matrixWorld);
+this.material.polygonOffsetUnits=10*a},c.update(l.geometry)),l.material.uniforms.tCube.value=d,b.push(l,l.geometry,l.material,0,null)):d&&d.isTexture&&(void 0===h&&(h=new Fb(-1,1,1,-1,0,1),k=new fa(new hb(2,2),new va({depthTest:!1,depthWrite:!1,fog:!1})),c.update(k.geometry)),k.material.map=d,a.renderBufferDirect(h,null,k.geometry,k.material,k,null))}}}function Sf(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.program&&b.program&&a.program!==b.program?a.program.id-b.program.id:
+a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function Tf(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function Uf(){var a=[],b=0,c=[],d=[];return{opaque:c,transparent:d,init:function(){b=0;c.length=0;d.length=0},push:function(e,f,g,h,k){var l=a[b];void 0===l?(l={id:e.id,object:e,geometry:f,material:g,program:g.program,renderOrder:e.renderOrder,z:h,group:k},a[b]=l):(l.id=e.id,l.object=e,l.geometry=f,l.material=
+g,l.program=g.program,l.renderOrder=e.renderOrder,l.z=h,l.group=k);(!0===g.transparent?d:c).push(l);b++},sort:function(){1<c.length&&c.sort(Sf);1<d.length&&d.sort(Tf)}}}function Vf(){var a={};return{get:function(b,c){b=b.id+","+c.id;c=a[b];void 0===c&&(c=new Uf,a[b]=c);return c},dispose:function(){a={}}}}function Wf(a,b){return Math.abs(b[1])-Math.abs(a[1])}function Xf(a){var b={},c=new Float32Array(8);return{update:function(d,e,f,g){var h=d.morphTargetInfluences,k=h.length;d=b[e.id];if(void 0===
+d){d=[];for(var l=0;l<k;l++)d[l]=[l,0];b[e.id]=d}var r=f.morphTargets&&e.morphAttributes.position;f=f.morphNormals&&e.morphAttributes.normal;for(l=0;l<k;l++){var n=d[l];0!==n[1]&&(r&&e.removeAttribute("morphTarget"+l),f&&e.removeAttribute("morphNormal"+l))}for(l=0;l<k;l++)n=d[l],n[0]=l,n[1]=h[l];d.sort(Wf);for(l=0;8>l;l++){if(n=d[l])if(h=n[0],n=n[1]){r&&e.addAttribute("morphTarget"+l,r[h]);f&&e.addAttribute("morphNormal"+l,f[h]);c[l]=n;continue}c[l]=0}g.getUniforms().setValue(a,"morphTargetInfluences",
+c)}}}function Yf(a,b,c){var d,e,f;this.setMode=function(a){d=a};this.setIndex=function(a){e=a.type;f=a.bytesPerElement};this.render=function(b,h){a.drawElements(d,h,e,b*f);c.calls++;c.vertices+=h;d===a.TRIANGLES?c.faces+=h/3:d===a.POINTS&&(c.points+=h)};this.renderInstances=function(g,h,k){var l=b.get("ANGLE_instanced_arrays");null===l?console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(l.drawElementsInstancedANGLE(d,
+k,e,h*f,g.maxInstancedCount),c.calls++,c.vertices+=k*g.maxInstancedCount,d===a.TRIANGLES?c.faces+=g.maxInstancedCount*k/3:d===a.POINTS&&(c.points+=g.maxInstancedCount*k))}}function Zf(a,b,c){var d;this.setMode=function(a){d=a};this.render=function(b,f){a.drawArrays(d,b,f);c.calls++;c.vertices+=f;d===a.TRIANGLES?c.faces+=f/3:d===a.POINTS&&(c.points+=f)};this.renderInstances=function(e,f,g){var h=b.get("ANGLE_instanced_arrays");if(null===h)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
 else{var k=e.attributes.position;k.isInterleavedBufferAttribute?(g=k.data.count,h.drawArraysInstancedANGLE(d,0,g,e.maxInstancedCount)):h.drawArraysInstancedANGLE(d,f,g,e.maxInstancedCount);c.calls++;c.vertices+=g*e.maxInstancedCount;d===a.TRIANGLES?c.faces+=e.maxInstancedCount*g/3:d===a.POINTS&&(c.points+=e.maxInstancedCount*g)}}}function $f(a,b,c){function d(a){a=a.target;var g=e[a.id];null!==g.index&&b.remove(g.index);for(var k in g.attributes)b.remove(g.attributes[k]);a.removeEventListener("dispose",
 d);delete e[a.id];if(k=f[a.id])b.remove(k),delete f[a.id];if(k=f[g.id])b.remove(k),delete f[g.id];c.geometries--}var e={},f={};return{get:function(a,b){var f=e[b.id];if(f)return f;b.addEventListener("dispose",d);b.isBufferGeometry?f=b:b.isGeometry&&(void 0===b._bufferGeometry&&(b._bufferGeometry=(new F).setFromObject(a)),f=b._bufferGeometry);e[b.id]=f;c.geometries++;return f},update:function(c){var d=c.index,e=c.attributes;null!==d&&b.update(d,a.ELEMENT_ARRAY_BUFFER);for(var f in e)b.update(e[f],
 a.ARRAY_BUFFER);c=c.morphAttributes;for(f in c)for(var d=c[f],e=0,g=d.length;e<g;e++)b.update(d[e],a.ARRAY_BUFFER)},getWireframeAttribute:function(c){var d=f[c.id];if(d)return d;d=[];var e=c.index;var g=c.attributes;if(null!==e){var r=e.array;for(var n=0,q=r.length;n<q;n+=3){var t=r[n+0];g=r[n+1];e=r[n+2];d.push(t,g,g,e,e,t)}}else for(r=g.position.array,n=0,q=r.length/3-1;n<q;n+=3)t=n+0,g=n+1,e=n+2,d.push(t,g,g,e,e,t);d=new (65535<Ud(d)?fb:eb)(d,1);b.update(d,a.ELEMENT_ARRAY_BUFFER);return f[c.id]=
@@ -145,16 +145,16 @@ break;case "EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter
 a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case "WEBGL_compressed_texture_etc1":d=a.getExtension("WEBGL_compressed_texture_etc1");break;default:d=a.getExtension(c)}null===d&&console.warn("THREE.WebGLRenderer: "+c+" extension not supported.");return b[c]=d}}}function rg(){function a(){l.value!==d&&(l.value=d,l.needsUpdate=0<e);c.numPlanes=e;c.numIntersection=0}function b(a,b,d,e){var f=null!==a?a.length:0,g=null;if(0!==f){g=l.value;if(!0!==e||null===g){e=d+4*f;b=b.matrixWorldInverse;
 k.getNormalMatrix(b);if(null===g||g.length<e)g=new Float32Array(e);for(e=0;e!==f;++e,d+=4)h.copy(a[e]).applyMatrix4(b,k),h.normal.toArray(g,d),g[d+3]=h.constant}l.value=g;l.needsUpdate=!0}c.numPlanes=f;return g}var c=this,d=null,e=0,f=!1,g=!1,h=new ia,k=new Da,l={value:null,needsUpdate:!1};this.uniform=l;this.numIntersection=this.numPlanes=0;this.init=function(a,c,g){var h=0!==a.length||c||0!==e||f;f=c;d=b(a,g,0);e=a.length;return h};this.beginShadows=function(){g=!0;b(null)};this.endShadows=function(){g=
 !1;a()};this.setState=function(c,h,k,t,m,p){if(!f||null===c||0===c.length||g&&!k)g?b(null):a();else{k=g?0:e;var n=4*k,r=m.clippingState||null;l.value=r;r=b(c,t,n,p);for(c=0;c!==n;++c)r[c]=d[c];m.clippingState=r;this.numIntersection=h?this.numPlanes:0;this.numPlanes+=k}}}function $d(a){function b(){ha=new qg(C);ha.get("WEBGL_depth_texture");ha.get("OES_texture_float");ha.get("OES_texture_float_linear");ha.get("OES_texture_half_float");ha.get("OES_texture_half_float_linear");ha.get("OES_standard_derivatives");
-ha.get("ANGLE_instanced_arrays");ha.get("OES_element_index_uint")&&(F.MaxIndex=4294967296);Y=new og(C,ha,a);aa=new ng(C,ha,m);aa.scissor(Eb.copy(ba).multiplyScalar(ja));aa.viewport(S.copy(ca).multiplyScalar(ja));X=new mg;fa=new lg(C,ha,aa,X,Y,m,Zd);la=new Pf(C);oa=new $f(C,la,Zd);pa=new cg(oa,Ta);ta=new Xf(C);ka=new kg(J,ha,Y);ra=new bg;qa=new Vf;na=new Rf(J,aa,oa,H);ua=new Zf(C,ha,Ta);va=new Yf(C,ha,Ta);wa=new Mf(J,C,aa,fa,Y);xa=new Nf(J,C,aa,fa,Y);J.info.programs=ka.programs;J.context=C;J.capabilities=
-Y;J.extensions=ha;J.properties=X;J.renderLists=qa;J.state=aa}function c(a){a.preventDefault();console.log("THREE.WebGLRenderer: Context Lost.");O=!0}function d(a){console.log("THREE.WebGLRenderer: Context Restored.");O=!1;b()}function e(a){a=a.target;a.removeEventListener("dispose",e);f(a);X.remove(a)}function f(a){var b=X.get(a).program;a.program=void 0;void 0!==b&&ka.releaseProgram(b)}function g(a,b,c){a.render(function(a){J.renderBufferImmediate(a,b,c)})}function h(a,b,c){if(a.visible){if(a.layers.test(b.layers))if(a.isLight)w.push(a),
+ha.get("ANGLE_instanced_arrays");ha.get("OES_element_index_uint")&&(F.MaxIndex=4294967296);Y=new og(C,ha,a);Z=new ng(C,ha,m);Z.scissor(Eb.copy(ba).multiplyScalar(ja));Z.viewport(S.copy(ca).multiplyScalar(ja));X=new mg;fa=new lg(C,ha,Z,X,Y,m,Zd);la=new Pf(C);oa=new $f(C,la,Zd);pa=new cg(oa,Ta);ta=new Xf(C);ka=new kg(J,ha,Y);ra=new bg;qa=new Vf;na=new Rf(J,Z,oa,H);ua=new Zf(C,ha,Ta);va=new Yf(C,ha,Ta);wa=new Mf(J,C,Z,fa,Y);xa=new Nf(J,C,Z,fa,Y);J.info.programs=ka.programs;J.context=C;J.capabilities=
+Y;J.extensions=ha;J.properties=X;J.renderLists=qa;J.state=Z}function c(a){a.preventDefault();console.log("THREE.WebGLRenderer: Context Lost.");O=!0}function d(a){console.log("THREE.WebGLRenderer: Context Restored.");O=!1;b()}function e(a){a=a.target;a.removeEventListener("dispose",e);f(a);X.remove(a)}function f(a){var b=X.get(a).program;a.program=void 0;void 0!==b&&ka.releaseProgram(b)}function g(a,b,c){a.render(function(a){J.renderBufferImmediate(a,b,c)})}function h(a,b,c){if(a.visible){if(a.layers.test(b.layers))if(a.isLight)w.push(a),
 a.castShadow&&z.push(a);else if(a.isSprite)a.frustumCulled&&!Xd.intersectsSprite(a)||E.push(a);else if(a.isLensFlare)D.push(a);else if(a.isImmediateRenderObject)c&&Ib.setFromMatrixPosition(a.matrixWorld).applyMatrix4(nd),ea.push(a,null,a.material,Ib.z,null);else if(a.isMesh||a.isLine||a.isPoints)if(a.isSkinnedMesh&&a.skeleton.update(),!a.frustumCulled||Xd.intersectsObject(a)){c&&Ib.setFromMatrixPosition(a.matrixWorld).applyMatrix4(nd);var d=pa.update(a),e=a.material;if(Array.isArray(e))for(var f=
-d.groups,g=0,l=f.length;g<l;g++){var k=f[g],n=e[k.materialIndex];n&&n.visible&&ea.push(a,d,n,Ib.z,k)}else e.visible&&ea.push(a,d,e,Ib.z,null)}a=a.children;g=0;for(l=a.length;g<l;g++)h(a[g],b,c)}}function k(a,b,c,d){for(var e=0,f=a.length;e<f;e++){var g=a[e],h=g.object,k=g.geometry,n=void 0===d?g.material:d,g=g.group;if(c.isArrayCamera){Z=c;for(var r=c.cameras,q=0,t=r.length;q<t;q++){var m=r[q];if(h.layers.test(m.layers)){var u=m.bounds,p=u.x*W,x=u.y*ga,v=u.z*W,u=u.w*ga;aa.viewport(S.set(p,x,v,u).multiplyScalar(ja));
-aa.scissor(Eb.set(p,x,v,u).multiplyScalar(ja));aa.setScissorTest(!0);l(h,b,m,k,n,g)}}}else Z=null,l(h,b,c,k,n,g)}}function l(a,b,c,d,e,f){a.onBeforeRender(J,b,c,d,e,f);a.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,a.matrixWorld);a.normalMatrix.getNormalMatrix(a.modelViewMatrix);if(a.isImmediateRenderObject){aa.setMaterial(e);var h=n(c,b.fog,e,a);K="";g(a,h,e)}else J.renderBufferDirect(c,b.fog,d,e,a,f);a.onAfterRender(J,b,c,d,e,f)}function r(a,b,c){var d=X.get(a);c=ka.getParameters(a,ra.state,
+d.groups,g=0,l=f.length;g<l;g++){var k=f[g],n=e[k.materialIndex];n&&n.visible&&ea.push(a,d,n,Ib.z,k)}else e.visible&&ea.push(a,d,e,Ib.z,null)}a=a.children;g=0;for(l=a.length;g<l;g++)h(a[g],b,c)}}function k(a,b,c,d){for(var e=0,f=a.length;e<f;e++){var g=a[e],h=g.object,k=g.geometry,n=void 0===d?g.material:d,g=g.group;if(c.isArrayCamera){aa=c;for(var r=c.cameras,q=0,t=r.length;q<t;q++){var m=r[q];if(h.layers.test(m.layers)){var u=m.bounds,p=u.x*W,x=u.y*ga,v=u.z*W,u=u.w*ga;Z.viewport(S.set(p,x,v,u).multiplyScalar(ja));
+Z.scissor(Eb.set(p,x,v,u).multiplyScalar(ja));Z.setScissorTest(!0);l(h,b,m,k,n,g)}}}else aa=null,l(h,b,c,k,n,g)}}function l(a,b,c,d,e,f){a.onBeforeRender(J,b,c,d,e,f);a.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,a.matrixWorld);a.normalMatrix.getNormalMatrix(a.modelViewMatrix);if(a.isImmediateRenderObject){Z.setMaterial(e);var h=n(c,b.fog,e,a);K="";g(a,h,e)}else J.renderBufferDirect(c,b.fog,d,e,a,f);a.onAfterRender(J,b,c,d,e,f)}function r(a,b,c){var d=X.get(a);c=ka.getParameters(a,ra.state,
 z,b,Ea.numPlanes,Ea.numIntersection,c);var g=ka.getProgramCode(a,c),h=d.program,l=!0;if(void 0===h)a.addEventListener("dispose",e);else if(h.code!==g)f(a);else{if(void 0!==c.shaderID)return;l=!1}l&&(c.shaderID?(h=jb[c.shaderID],d.shader={name:a.type,uniforms:Aa.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}):d.shader={name:a.type,uniforms:a.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader},a.onBeforeCompile(d.shader),h=ka.acquireProgram(a,d.shader,
 c,g),d.program=h,a.program=h);c=h.getAttributes();if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<J.maxMorphTargets;g++)0<=c["morphTarget"+g]&&a.numSupportedMorphTargets++;if(a.morphNormals)for(g=a.numSupportedMorphNormals=0;g<J.maxMorphNormals;g++)0<=c["morphNormal"+g]&&a.numSupportedMorphNormals++;c=d.shader.uniforms;if(!a.isShaderMaterial&&!a.isRawShaderMaterial||!0===a.clipping)d.numClippingPlanes=Ea.numPlanes,d.numIntersection=Ea.numIntersection,c.clippingPlanes=Ea.uniform;d.fog=b;d.lightsHash=
 ra.state.hash;a.lights&&(c.ambientLightColor.value=ra.state.ambient,c.directionalLights.value=ra.state.directional,c.spotLights.value=ra.state.spot,c.rectAreaLights.value=ra.state.rectArea,c.pointLights.value=ra.state.point,c.hemisphereLights.value=ra.state.hemi,c.directionalShadowMap.value=ra.state.directionalShadowMap,c.directionalShadowMatrix.value=ra.state.directionalShadowMatrix,c.spotShadowMap.value=ra.state.spotShadowMap,c.spotShadowMatrix.value=ra.state.spotShadowMatrix,c.pointShadowMap.value=
 ra.state.pointShadowMap,c.pointShadowMatrix.value=ra.state.pointShadowMatrix);a=d.program.getUniforms();a=db.seqWithValue(a.seq,c);d.uniformsList=a}function n(a,b,c,d){G=0;var e=X.get(c);R&&(Yd||a!==N)&&Ea.setState(c.clippingPlanes,c.clipIntersection,c.clipShadows,a,e,a===N&&c.id===V);!1===c.needsUpdate&&(void 0===e.program?c.needsUpdate=!0:c.fog&&e.fog!==b?c.needsUpdate=!0:c.lights&&e.lightsHash!==ra.state.hash?c.needsUpdate=!0:void 0===e.numClippingPlanes||e.numClippingPlanes===Ea.numPlanes&&e.numIntersection===
-Ea.numIntersection||(c.needsUpdate=!0));c.needsUpdate&&(r(c,b,d),c.needsUpdate=!1);var f=!1,g=!1,h=!1,l=e.program,k=l.getUniforms(),n=e.shader.uniforms;aa.useProgram(l.program)&&(h=g=f=!0);c.id!==V&&(V=c.id,g=!0);if(f||a!==N){k.setValue(C,"projectionMatrix",a.projectionMatrix);Y.logarithmicDepthBuffer&&k.setValue(C,"logDepthBufFC",2/(Math.log(a.far+1)/Math.LN2));N!==(Z||a)&&(N=Z||a,h=g=!0);if(c.isShaderMaterial||c.isMeshPhongMaterial||c.isMeshStandardMaterial||c.envMap)f=k.map.cameraPosition,void 0!==
+Ea.numIntersection||(c.needsUpdate=!0));c.needsUpdate&&(r(c,b,d),c.needsUpdate=!1);var f=!1,g=!1,h=!1,l=e.program,k=l.getUniforms(),n=e.shader.uniforms;Z.useProgram(l.program)&&(h=g=f=!0);c.id!==V&&(V=c.id,g=!0);if(f||a!==N){k.setValue(C,"projectionMatrix",a.projectionMatrix);Y.logarithmicDepthBuffer&&k.setValue(C,"logDepthBufFC",2/(Math.log(a.far+1)/Math.LN2));N!==(aa||a)&&(N=aa||a,h=g=!0);if(c.isShaderMaterial||c.isMeshPhongMaterial||c.isMeshStandardMaterial||c.envMap)f=k.map.cameraPosition,void 0!==
 f&&f.setValue(C,Ib.setFromMatrixPosition(a.matrixWorld));(c.isMeshPhongMaterial||c.isMeshLambertMaterial||c.isMeshBasicMaterial||c.isMeshStandardMaterial||c.isShaderMaterial||c.skinning)&&k.setValue(C,"viewMatrix",a.matrixWorldInverse)}if(c.skinning&&(k.setOptional(C,d,"bindMatrix"),k.setOptional(C,d,"bindMatrixInverse"),a=d.skeleton))if(f=a.bones,Y.floatVertexTextures){if(void 0===a.boneTexture){var f=Math.sqrt(4*f.length),f=Q.nextPowerOfTwo(Math.ceil(f)),f=Math.max(f,4),m=new Float32Array(f*f*4);
 m.set(a.boneMatrices);var u=new cb(m,f,f,1023,1015);a.boneMatrices=m;a.boneTexture=u;a.boneTextureSize=f}k.setValue(C,"boneTexture",a.boneTexture);k.setValue(C,"boneTextureSize",a.boneTextureSize)}else k.setOptional(C,a,"boneMatrices");if(g){k.setValue(C,"toneMappingExposure",J.toneMappingExposure);k.setValue(C,"toneMappingWhitePoint",J.toneMappingWhitePoint);c.lights&&(g=h,n.ambientLightColor.needsUpdate=g,n.directionalLights.needsUpdate=g,n.pointLights.needsUpdate=g,n.spotLights.needsUpdate=g,n.rectAreaLights.needsUpdate=
 g,n.hemisphereLights.needsUpdate=g);b&&c.fog&&(n.fogColor.value=b.color,b.isFog?(n.fogNear.value=b.near,n.fogFar.value=b.far):b.isFogExp2&&(n.fogDensity.value=b.density));if(c.isMeshBasicMaterial||c.isMeshLambertMaterial||c.isMeshPhongMaterial||c.isMeshStandardMaterial||c.isMeshNormalMaterial||c.isMeshDepthMaterial||c.isMeshDistanceMaterial){n.opacity.value=c.opacity;c.color&&(n.diffuse.value=c.color);c.emissive&&n.emissive.value.copy(c.emissive).multiplyScalar(c.emissiveIntensity);c.map&&(n.map.value=
@@ -171,27 +171,27 @@ if(1024===a)return C.LUMINANCE;if(1025===a)return C.LUMINANCE_ALPHA;if(1026===a)
 if(208===a)return C.DST_COLOR;if(209===a)return C.ONE_MINUS_DST_COLOR;if(210===a)return C.SRC_ALPHA_SATURATE;if(2001===a||2002===a||2003===a||2004===a)if(b=ha.get("WEBGL_compressed_texture_s3tc"),null!==b){if(2001===a)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;if(2002===a)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(2003===a)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(2004===a)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(2100===a||2101===a||2102===a||2103===a)if(b=ha.get("WEBGL_compressed_texture_pvrtc"),null!==
 b){if(2100===a)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(2101===a)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(2102===a)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(2103===a)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(2151===a&&(b=ha.get("WEBGL_compressed_texture_etc1"),null!==b))return b.COMPRESSED_RGB_ETC1_WEBGL;if(103===a||104===a)if(b=ha.get("EXT_blend_minmax"),null!==b){if(103===a)return b.MIN_EXT;if(104===a)return b.MAX_EXT}return 1020===a&&(b=ha.get("WEBGL_depth_texture"),null!==b)?b.UNSIGNED_INT_24_8_WEBGL:
 0}console.log("THREE.WebGLRenderer","87dev");a=a||{};var v=void 0!==a.canvas?a.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),x=void 0!==a.context?a.context:null,y=void 0!==a.alpha?a.alpha:!1,A=void 0!==a.depth?a.depth:!0,I=void 0!==a.stencil?a.stencil:!0,B=void 0!==a.antialias?a.antialias:!1,H=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,sa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,w=[],z=[],ea=null,E=[],D=[];this.domElement=v;this.context=null;
-this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.clippingPlanes=[];this.localClippingEnabled=!1;this.gammaFactor=2;this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1;this.toneMappingWhitePoint=this.toneMappingExposure=this.toneMapping=1;this.maxMorphTargets=8;this.maxMorphNormals=4;var J=this,O=!1,U=null,M=null,V=-1,K="",N=null,Z=null,S=new da,Eb=new da,T=null,G=0,W=v.width,ga=v.height,ja=1,ca=new da(0,0,W,ga),ba=new da(0,0,W,ga),
+this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.clippingPlanes=[];this.localClippingEnabled=!1;this.gammaFactor=2;this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1;this.toneMappingWhitePoint=this.toneMappingExposure=this.toneMapping=1;this.maxMorphTargets=8;this.maxMorphNormals=4;var J=this,O=!1,U=null,M=null,V=-1,K="",N=null,aa=null,S=new da,Eb=new da,T=null,G=0,W=v.width,ga=v.height,ja=1,ca=new da(0,0,W,ga),ba=new da(0,0,W,ga),
 Se=!1,Xd=new md,Ea=new rg,R=!1,Yd=!1,nd=new P,Ib=new p,Zd={geometries:0,textures:0},Ta={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:Ta,memory:Zd,programs:null};try{y={alpha:y,depth:A,stencil:I,antialias:B,premultipliedAlpha:H,preserveDrawingBuffer:sa};var C=x||v.getContext("webgl",y)||v.getContext("experimental-webgl",y);if(null===C){if(null!==v.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}void 0===
-C.getShaderPrecisionFormat&&(C.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});v.addEventListener("webglcontextlost",c,!1);v.addEventListener("webglcontextrestored",d,!1)}catch(sg){console.error("THREE.WebGLRenderer: "+sg)}var ha,Y,aa,X,fa,la,oa,pa,ra,ka,qa,na,ta,ua,va,wa,xa;b();var ia=new pg(J);this.vr=ia;var za=new Me(J,pa,Y.maxTextureSize);this.shadowMap=za;this.getContext=function(){return C};this.getContextAttributes=function(){return C.getContextAttributes()};
+C.getShaderPrecisionFormat&&(C.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});v.addEventListener("webglcontextlost",c,!1);v.addEventListener("webglcontextrestored",d,!1)}catch(sg){console.error("THREE.WebGLRenderer: "+sg)}var ha,Y,Z,X,fa,la,oa,pa,ra,ka,qa,na,ta,ua,va,wa,xa;b();var ia=new pg(J);this.vr=ia;var za=new Me(J,pa,Y.maxTextureSize);this.shadowMap=za;this.getContext=function(){return C};this.getContextAttributes=function(){return C.getContextAttributes()};
 this.forceContextLoss=function(){var a=ha.get("WEBGL_lose_context");a&&a.loseContext()};this.forceContextRestore=function(){var a=ha.get("WEBGL_lose_context");a&&a.restoreContext()};this.getPixelRatio=function(){return ja};this.setPixelRatio=function(a){void 0!==a&&(ja=a,this.setSize(W,ga,!1))};this.getSize=function(){return{width:W,height:ga}};this.setSize=function(a,b,c){var d=ia.getDevice();d&&d.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):
-(W=a,ga=b,v.width=a*ja,v.height=b*ja,!1!==c&&(v.style.width=a+"px",v.style.height=b+"px"),this.setViewport(0,0,a,b))};this.getDrawingBufferSize=function(){return{width:W*ja,height:ga*ja}};this.setDrawingBufferSize=function(a,b,c){W=a;ga=b;ja=c;v.width=a*c;v.height=b*c;this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){ca.set(a,ga-b-d,c,d);aa.viewport(S.copy(ca).multiplyScalar(ja))};this.setScissor=function(a,b,c,d){ba.set(a,ga-b-d,c,d);aa.scissor(Eb.copy(ba).multiplyScalar(ja))};this.setScissorTest=
-function(a){aa.setScissorTest(Se=a)};this.getClearColor=na.getClearColor;this.setClearColor=na.setClearColor;this.getClearAlpha=na.getClearAlpha;this.setClearAlpha=na.setClearAlpha;this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=C.COLOR_BUFFER_BIT;if(void 0===b||b)d|=C.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=C.STENCIL_BUFFER_BIT;C.clear(d)};this.clearColor=function(){this.clear(!0,!1,!1)};this.clearDepth=function(){this.clear(!1,!0,!1)};this.clearStencil=function(){this.clear(!1,!1,!0)};this.clearTarget=
-function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.dispose=function(){v.removeEventListener("webglcontextlost",c,!1);v.removeEventListener("webglcontextrestored",d,!1);qa.dispose();ia.dispose()};this.renderBufferImmediate=function(a,b,c){aa.initAttributes();var d=X.get(a);a.hasPositions&&!d.position&&(d.position=C.createBuffer());a.hasNormals&&!d.normal&&(d.normal=C.createBuffer());a.hasUvs&&!d.uv&&(d.uv=C.createBuffer());a.hasColors&&!d.color&&(d.color=C.createBuffer());b=b.getAttributes();
-a.hasPositions&&(C.bindBuffer(C.ARRAY_BUFFER,d.position),C.bufferData(C.ARRAY_BUFFER,a.positionArray,C.DYNAMIC_DRAW),aa.enableAttribute(b.position),C.vertexAttribPointer(b.position,3,C.FLOAT,!1,0,0));if(a.hasNormals){C.bindBuffer(C.ARRAY_BUFFER,d.normal);if(!c.isMeshPhongMaterial&&!c.isMeshStandardMaterial&&!c.isMeshNormalMaterial&&!0===c.flatShading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,l=(g[e+1]+g[e+4]+g[e+7])/3,k=(g[e+2]+g[e+5]+g[e+8])/3;g[e+0]=h;g[e+
-1]=l;g[e+2]=k;g[e+3]=h;g[e+4]=l;g[e+5]=k;g[e+6]=h;g[e+7]=l;g[e+8]=k}C.bufferData(C.ARRAY_BUFFER,a.normalArray,C.DYNAMIC_DRAW);aa.enableAttribute(b.normal);C.vertexAttribPointer(b.normal,3,C.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(C.bindBuffer(C.ARRAY_BUFFER,d.uv),C.bufferData(C.ARRAY_BUFFER,a.uvArray,C.DYNAMIC_DRAW),aa.enableAttribute(b.uv),C.vertexAttribPointer(b.uv,2,C.FLOAT,!1,0,0));a.hasColors&&0!==c.vertexColors&&(C.bindBuffer(C.ARRAY_BUFFER,d.color),C.bufferData(C.ARRAY_BUFFER,a.colorArray,C.DYNAMIC_DRAW),
-aa.enableAttribute(b.color),C.vertexAttribPointer(b.color,3,C.FLOAT,!1,0,0));aa.disableUnusedAttributes();C.drawArrays(C.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){aa.setMaterial(d);var g=n(a,b,d,e);a=c.id+"_"+g.id+"_"+(!0===d.wireframe);var h=!1;a!==K&&(K=a,h=!0);e.morphTargetInfluences&&(ta.update(e,c,d,g),h=!0);var l=c.index,k=c.attributes.position;b=1;!0===d.wireframe&&(l=oa.getWireframeAttribute(c),b=2);a=ua;if(null!==l){var r=la.get(l);a=va;a.setIndex(r)}if(h){h=
-void 0;if(c&&c.isInstancedBufferGeometry&&null===ha.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===h&&(h=0);aa.initAttributes();var q=c.attributes,g=g.getAttributes(),t=d.defaultAttributeValues;for(H in g){var m=g[H];if(0<=m){var p=q[H];if(void 0!==p){var u=p.normalized,x=p.itemSize,v=la.get(p);if(void 0!==v){var A=v.buffer,B=v.type,v=v.bytesPerElement;
-if(p.isInterleavedBufferAttribute){var y=p.data,I=y.stride,p=p.offset;y&&y.isInstancedInterleavedBuffer?(aa.enableAttributeAndDivisor(m,y.meshPerAttribute),void 0===c.maxInstancedCount&&(c.maxInstancedCount=y.meshPerAttribute*y.count)):aa.enableAttribute(m);C.bindBuffer(C.ARRAY_BUFFER,A);C.vertexAttribPointer(m,x,B,u,I*v,(h*I+p)*v)}else p.isInstancedBufferAttribute?(aa.enableAttributeAndDivisor(m,p.meshPerAttribute),void 0===c.maxInstancedCount&&(c.maxInstancedCount=p.meshPerAttribute*p.count)):aa.enableAttribute(m),
-C.bindBuffer(C.ARRAY_BUFFER,A),C.vertexAttribPointer(m,x,B,u,0,h*x*v)}}else if(void 0!==t&&(u=t[H],void 0!==u))switch(u.length){case 2:C.vertexAttrib2fv(m,u);break;case 3:C.vertexAttrib3fv(m,u);break;case 4:C.vertexAttrib4fv(m,u);break;default:C.vertexAttrib1fv(m,u)}}}aa.disableUnusedAttributes()}null!==l&&C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,r.buffer)}r=0;null!==l?r=l.count:void 0!==k&&(r=k.count);l=c.drawRange.start*b;k=null!==f?f.start*b:0;var H=Math.max(l,k);f=Math.max(0,Math.min(r,l+c.drawRange.count*
-b,k+(null!==f?f.count*b:Infinity))-1-H+1);if(0!==f){if(e.isMesh)if(!0===d.wireframe)aa.setLineWidth(d.wireframeLinewidth*(null===U?ja:1)),a.setMode(C.LINES);else switch(e.drawMode){case 0:a.setMode(C.TRIANGLES);break;case 1:a.setMode(C.TRIANGLE_STRIP);break;case 2:a.setMode(C.TRIANGLE_FAN)}else e.isLine?(d=d.linewidth,void 0===d&&(d=1),aa.setLineWidth(d*(null===U?ja:1)),e.isLineSegments?a.setMode(C.LINES):e.isLineLoop?a.setMode(C.LINE_LOOP):a.setMode(C.LINE_STRIP)):e.isPoints&&a.setMode(C.POINTS);
-c&&c.isInstancedBufferGeometry?0<c.maxInstancedCount&&a.renderInstances(c,H,f):a.render(H,f)}};this.compile=function(a,b){w.length=0;z.length=0;a.traverse(function(a){a.isLight&&(w.push(a),a.castShadow&&z.push(a))});ra.setup(w,z,b);a.traverse(function(b){if(b.material)if(Array.isArray(b.material))for(var c=0;c<b.material.length;c++)r(b.material[c],a.fog,b);else r(b.material,a.fog,b)})};this.animate=function(a){function b(){a();(ia.getDevice()||window).requestAnimationFrame(b)}(ia.getDevice()||window).requestAnimationFrame(b)};
+(W=a,ga=b,v.width=a*ja,v.height=b*ja,!1!==c&&(v.style.width=a+"px",v.style.height=b+"px"),this.setViewport(0,0,a,b))};this.getDrawingBufferSize=function(){return{width:W*ja,height:ga*ja}};this.setDrawingBufferSize=function(a,b,c){W=a;ga=b;ja=c;v.width=a*c;v.height=b*c;this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){ca.set(a,ga-b-d,c,d);Z.viewport(S.copy(ca).multiplyScalar(ja))};this.setScissor=function(a,b,c,d){ba.set(a,ga-b-d,c,d);Z.scissor(Eb.copy(ba).multiplyScalar(ja))};this.setScissorTest=
+function(a){Z.setScissorTest(Se=a)};this.getClearColor=na.getClearColor;this.setClearColor=na.setClearColor;this.getClearAlpha=na.getClearAlpha;this.setClearAlpha=na.setClearAlpha;this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=C.COLOR_BUFFER_BIT;if(void 0===b||b)d|=C.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=C.STENCIL_BUFFER_BIT;C.clear(d)};this.clearColor=function(){this.clear(!0,!1,!1)};this.clearDepth=function(){this.clear(!1,!0,!1)};this.clearStencil=function(){this.clear(!1,!1,!0)};this.clearTarget=
+function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.dispose=function(){v.removeEventListener("webglcontextlost",c,!1);v.removeEventListener("webglcontextrestored",d,!1);qa.dispose();ia.dispose()};this.renderBufferImmediate=function(a,b,c){Z.initAttributes();var d=X.get(a);a.hasPositions&&!d.position&&(d.position=C.createBuffer());a.hasNormals&&!d.normal&&(d.normal=C.createBuffer());a.hasUvs&&!d.uv&&(d.uv=C.createBuffer());a.hasColors&&!d.color&&(d.color=C.createBuffer());b=b.getAttributes();
+a.hasPositions&&(C.bindBuffer(C.ARRAY_BUFFER,d.position),C.bufferData(C.ARRAY_BUFFER,a.positionArray,C.DYNAMIC_DRAW),Z.enableAttribute(b.position),C.vertexAttribPointer(b.position,3,C.FLOAT,!1,0,0));if(a.hasNormals){C.bindBuffer(C.ARRAY_BUFFER,d.normal);if(!c.isMeshPhongMaterial&&!c.isMeshStandardMaterial&&!c.isMeshNormalMaterial&&!0===c.flatShading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,l=(g[e+1]+g[e+4]+g[e+7])/3,k=(g[e+2]+g[e+5]+g[e+8])/3;g[e+0]=h;g[e+1]=
+l;g[e+2]=k;g[e+3]=h;g[e+4]=l;g[e+5]=k;g[e+6]=h;g[e+7]=l;g[e+8]=k}C.bufferData(C.ARRAY_BUFFER,a.normalArray,C.DYNAMIC_DRAW);Z.enableAttribute(b.normal);C.vertexAttribPointer(b.normal,3,C.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(C.bindBuffer(C.ARRAY_BUFFER,d.uv),C.bufferData(C.ARRAY_BUFFER,a.uvArray,C.DYNAMIC_DRAW),Z.enableAttribute(b.uv),C.vertexAttribPointer(b.uv,2,C.FLOAT,!1,0,0));a.hasColors&&0!==c.vertexColors&&(C.bindBuffer(C.ARRAY_BUFFER,d.color),C.bufferData(C.ARRAY_BUFFER,a.colorArray,C.DYNAMIC_DRAW),
+Z.enableAttribute(b.color),C.vertexAttribPointer(b.color,3,C.FLOAT,!1,0,0));Z.disableUnusedAttributes();C.drawArrays(C.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){Z.setMaterial(d);var g=n(a,b,d,e);a=c.id+"_"+g.id+"_"+(!0===d.wireframe);var h=!1;a!==K&&(K=a,h=!0);e.morphTargetInfluences&&(ta.update(e,c,d,g),h=!0);var l=c.index,k=c.attributes.position;b=1;!0===d.wireframe&&(l=oa.getWireframeAttribute(c),b=2);a=ua;if(null!==l){var r=la.get(l);a=va;a.setIndex(r)}if(h){h=
+void 0;if(c&&c.isInstancedBufferGeometry&&null===ha.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===h&&(h=0);Z.initAttributes();var q=c.attributes,g=g.getAttributes(),t=d.defaultAttributeValues;for(H in g){var m=g[H];if(0<=m){var p=q[H];if(void 0!==p){var u=p.normalized,x=p.itemSize,v=la.get(p);if(void 0!==v){var A=v.buffer,B=v.type,v=v.bytesPerElement;
+if(p.isInterleavedBufferAttribute){var y=p.data,I=y.stride,p=p.offset;y&&y.isInstancedInterleavedBuffer?(Z.enableAttributeAndDivisor(m,y.meshPerAttribute),void 0===c.maxInstancedCount&&(c.maxInstancedCount=y.meshPerAttribute*y.count)):Z.enableAttribute(m);C.bindBuffer(C.ARRAY_BUFFER,A);C.vertexAttribPointer(m,x,B,u,I*v,(h*I+p)*v)}else p.isInstancedBufferAttribute?(Z.enableAttributeAndDivisor(m,p.meshPerAttribute),void 0===c.maxInstancedCount&&(c.maxInstancedCount=p.meshPerAttribute*p.count)):Z.enableAttribute(m),
+C.bindBuffer(C.ARRAY_BUFFER,A),C.vertexAttribPointer(m,x,B,u,0,h*x*v)}}else if(void 0!==t&&(u=t[H],void 0!==u))switch(u.length){case 2:C.vertexAttrib2fv(m,u);break;case 3:C.vertexAttrib3fv(m,u);break;case 4:C.vertexAttrib4fv(m,u);break;default:C.vertexAttrib1fv(m,u)}}}Z.disableUnusedAttributes()}null!==l&&C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,r.buffer)}r=0;null!==l?r=l.count:void 0!==k&&(r=k.count);l=c.drawRange.start*b;k=null!==f?f.start*b:0;var H=Math.max(l,k);f=Math.max(0,Math.min(r,l+c.drawRange.count*
+b,k+(null!==f?f.count*b:Infinity))-1-H+1);if(0!==f){if(e.isMesh)if(!0===d.wireframe)Z.setLineWidth(d.wireframeLinewidth*(null===U?ja:1)),a.setMode(C.LINES);else switch(e.drawMode){case 0:a.setMode(C.TRIANGLES);break;case 1:a.setMode(C.TRIANGLE_STRIP);break;case 2:a.setMode(C.TRIANGLE_FAN)}else e.isLine?(d=d.linewidth,void 0===d&&(d=1),Z.setLineWidth(d*(null===U?ja:1)),e.isLineSegments?a.setMode(C.LINES):e.isLineLoop?a.setMode(C.LINE_LOOP):a.setMode(C.LINE_STRIP)):e.isPoints&&a.setMode(C.POINTS);c&&
+c.isInstancedBufferGeometry?0<c.maxInstancedCount&&a.renderInstances(c,H,f):a.render(H,f)}};this.compile=function(a,b){w.length=0;z.length=0;a.traverse(function(a){a.isLight&&(w.push(a),a.castShadow&&z.push(a))});ra.setup(w,z,b);a.traverse(function(b){if(b.material)if(Array.isArray(b.material))for(var c=0;c<b.material.length;c++)r(b.material[c],a.fog,b);else r(b.material,a.fog,b)})};this.animate=function(a){function b(){a();(ia.getDevice()||window).requestAnimationFrame(b)}(ia.getDevice()||window).requestAnimationFrame(b)};
 this.render=function(a,b,c,d){if(!b||!b.isCamera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else if(!O){K="";V=-1;N=null;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();ia.enabled&&(b=ia.getCamera(b));nd.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Xd.setFromMatrix(nd);w.length=0;z.length=0;E.length=0;D.length=0;Yd=this.localClippingEnabled;R=Ea.init(this.clippingPlanes,Yd,b);ea=qa.get(a,b);ea.init();h(a,b,J.sortObjects);
-!0===J.sortObjects&&ea.sort();R&&Ea.beginShadows();za.render(z,a,b);ra.setup(w,z,b);R&&Ea.endShadows();Ta.frame++;Ta.calls=0;Ta.vertices=0;Ta.faces=0;Ta.points=0;void 0===c&&(c=null);this.setRenderTarget(c);na.render(ea,a,b,d);d=ea.opaque;var e=ea.transparent;if(a.overrideMaterial){var f=a.overrideMaterial;d.length&&k(d,a,b,f);e.length&&k(e,a,b,f)}else d.length&&k(d,a,b),e.length&&k(e,a,b);xa.render(E,a,b);wa.render(D,a,b,S);c&&fa.updateRenderTargetMipmap(c);aa.buffers.depth.setTest(!0);aa.buffers.depth.setMask(!0);
-aa.buffers.color.setMask(!0);ia.enabled&&ia.submitFrame()}};this.setFaceCulling=function(a,b){aa.setCullFace(a);aa.setFlipSided(0===b)};this.allocTextureUnit=function(){var a=G;a>=Y.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+a+" texture units while this GPU supports only "+Y.maxTextures);G+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),
+!0===J.sortObjects&&ea.sort();R&&Ea.beginShadows();za.render(z,a,b);ra.setup(w,z,b);R&&Ea.endShadows();Ta.frame++;Ta.calls=0;Ta.vertices=0;Ta.faces=0;Ta.points=0;void 0===c&&(c=null);this.setRenderTarget(c);na.render(ea,a,b,d);d=ea.opaque;var e=ea.transparent;if(a.overrideMaterial){var f=a.overrideMaterial;d.length&&k(d,a,b,f);e.length&&k(e,a,b,f)}else d.length&&k(d,a,b),e.length&&k(e,a,b);xa.render(E,a,b);wa.render(D,a,b,S);c&&fa.updateRenderTargetMipmap(c);Z.buffers.depth.setTest(!0);Z.buffers.depth.setMask(!0);
+Z.buffers.color.setMask(!0);Z.setPolygonOffset(!1);ia.enabled&&ia.submitFrame()}};this.setFaceCulling=function(a,b){Z.setCullFace(a);Z.setFlipSided(0===b)};this.allocTextureUnit=function(){var a=G;a>=Y.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+a+" texture units while this GPU supports only "+Y.maxTextures);G+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),
 a=!0),b=b.texture);fa.setTexture2D(b,c)}}();this.setTexture=function(){var a=!1;return function(b,c){a||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),a=!0);fa.setTexture2D(b,c)}}();this.setTextureCube=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTargetCube&&(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);b&&b.isCubeTexture||Array.isArray(b.image)&&
-6===b.image.length?fa.setTextureCube(b,c):fa.setTextureCubeDynamic(b,c)}}();this.getRenderTarget=function(){return U};this.setRenderTarget=function(a){(U=a)&&void 0===X.get(a).__webglFramebuffer&&fa.setupRenderTarget(a);var b=null,c=!1;a?(b=X.get(a).__webglFramebuffer,a.isWebGLRenderTargetCube&&(b=b[a.activeCubeFace],c=!0),S.copy(a.viewport),Eb.copy(a.scissor),T=a.scissorTest):(S.copy(ca).multiplyScalar(ja),Eb.copy(ba).multiplyScalar(ja),T=Se);M!==b&&(C.bindFramebuffer(C.FRAMEBUFFER,b),M=b);aa.viewport(S);
-aa.scissor(Eb);aa.setScissorTest(T);c&&(c=X.get(a.texture),C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,c.__webglTexture,a.activeMipMapLevel))};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(a&&a.isWebGLRenderTarget){var g=X.get(a).__webglFramebuffer;if(g){var h=!1;g!==M&&(C.bindFramebuffer(C.FRAMEBUFFER,g),h=!0);try{var l=a.texture,k=l.format,n=l.type;1023!==k&&m(k)!==C.getParameter(C.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):
+6===b.image.length?fa.setTextureCube(b,c):fa.setTextureCubeDynamic(b,c)}}();this.getRenderTarget=function(){return U};this.setRenderTarget=function(a){(U=a)&&void 0===X.get(a).__webglFramebuffer&&fa.setupRenderTarget(a);var b=null,c=!1;a?(b=X.get(a).__webglFramebuffer,a.isWebGLRenderTargetCube&&(b=b[a.activeCubeFace],c=!0),S.copy(a.viewport),Eb.copy(a.scissor),T=a.scissorTest):(S.copy(ca).multiplyScalar(ja),Eb.copy(ba).multiplyScalar(ja),T=Se);M!==b&&(C.bindFramebuffer(C.FRAMEBUFFER,b),M=b);Z.viewport(S);
+Z.scissor(Eb);Z.setScissorTest(T);c&&(c=X.get(a.texture),C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,c.__webglTexture,a.activeMipMapLevel))};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(a&&a.isWebGLRenderTarget){var g=X.get(a).__webglFramebuffer;if(g){var h=!1;g!==M&&(C.bindFramebuffer(C.FRAMEBUFFER,g),h=!0);try{var l=a.texture,k=l.format,n=l.type;1023!==k&&m(k)!==C.getParameter(C.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):
 1009===n||m(n)===C.getParameter(C.IMPLEMENTATION_COLOR_READ_TYPE)||1015===n&&(ha.get("OES_texture_float")||ha.get("WEBGL_color_buffer_float"))||1016===n&&ha.get("EXT_color_buffer_half_float")?C.checkFramebufferStatus(C.FRAMEBUFFER)===C.FRAMEBUFFER_COMPLETE?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&C.readPixels(b,c,d,e,m(k),m(n),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&
 C.bindFramebuffer(C.FRAMEBUFFER,M)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function Jb(a,b){this.name="";this.color=new D(a);this.density=void 0!==b?b:2.5E-4}function Kb(a,b,c){this.name="";this.color=new D(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3}function pd(){w.call(this);this.type="Scene";this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function ae(a,b,c,d,e){w.call(this);this.lensFlares=
 [];this.positionScreen=new p;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)}function $a(a){N.call(this);this.type="SpriteMaterial";this.color=new D(16777215);this.map=null;this.rotation=0;this.lights=this.fog=!1;this.setValues(a)}function zc(a){w.call(this);this.type="Sprite";this.material=void 0!==a?a:new $a}function Ac(){w.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Bc(a,b){a=a||[];this.bones=a.slice(0);this.boneMatrices=
@@ -615,9 +615,9 @@ Ga.prototype.constructor=Ga;Ga.prototype.getArrays=function(){var a=this.getAttr
 2)}else a=!1,d>Number.EPSILON?f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(f=-e,e=Math.sqrt(h)):(f=d,d=e,e=Math.sqrt(h/2));return new E(f/e,d/e)}function e(a,b){for(G=a.length;0<=--G;){var c=G;var d=G-1;0>d&&(d=a.length-1);var e,f=w+2*x;for(e=0;e<f;e++){var g=Y*e,l=Y*(e+1),n=b+d+g,p=b+d+l,l=b+c+l;h(b+c+g);h(n);h(l);h(n);h(p);h(l);g=m.length/3;g=F.generateSideWallUV(Q,m,g-6,g-3,g-2,g-1);k(g[0]);k(g[1]);k(g[3]);k(g[1]);k(g[2]);k(g[3])}}}
 function f(a,b,c){t.push(a);t.push(b);t.push(c)}function g(a,b,c){h(a);h(b);h(c);a=m.length/3;a=F.generateTopUV(Q,m,a-3,a-2,a-1);k(a[0]);k(a[1]);k(a[2])}function h(a){n.push(m.length/3);m.push(t[3*a+0]);m.push(t[3*a+1]);m.push(t[3*a+2])}function k(a){q.push(a.x);q.push(a.y)}var l=b.arrays?b.arrays:this.getArrays(),m=l.position,n=l.index,q=l.uv,t=[],l=void 0!==b.amount?b.amount:100,u=void 0!==b.bevelThickness?b.bevelThickness:6,v=void 0!==b.bevelSize?b.bevelSize:u-2,x=void 0!==b.bevelSegments?b.bevelSegments:
 3,y=void 0!==b.bevelEnabled?b.bevelEnabled:!0,A=void 0!==b.curveSegments?b.curveSegments:12,w=void 0!==b.steps?b.steps:1,B=b.extrudePath,D=!1,F=void 0!==b.UVGenerator?b.UVGenerator:ab.WorldUVGenerator;if(B){var K=B.getSpacedPoints(w);D=!0;y=!1;var L=void 0!==b.frames?b.frames:B.computeFrenetFrames(w,!1);var O=new p;var P=new p;var N=new p}y||(v=u=x=0);var J,Q=this,A=a.extractPoints(A);a=A.shape;var U=A.holes;if(!Ha.isClockWise(a)){a=a.reverse();var M=0;for(J=U.length;M<J;M++){var V=U[M];Ha.isClockWise(V)&&
-(U[M]=V.reverse())}}var S=Ha.triangulateShape(a,U),X=a;M=0;for(J=U.length;M<J;M++)V=U[M],a=a.concat(V);var Z,Y=a.length,T,ca=S.length,A=[],G=0;var W=X.length;var ga=W-1;for(Z=G+1;G<W;G++,ga++,Z++)ga===W&&(ga=0),Z===W&&(Z=0),A[G]=d(X[G],X[ga],X[Z]);var B=[],da=A.concat();M=0;for(J=U.length;M<J;M++){V=U[M];var ba=[];G=0;W=V.length;ga=W-1;for(Z=G+1;G<W;G++,ga++,Z++)ga===W&&(ga=0),Z===W&&(Z=0),ba[G]=d(V[G],V[ga],V[Z]);B.push(ba);da=da.concat(ba)}for(ga=0;ga<x;ga++){W=ga/x;var fa=u*Math.cos(W*Math.PI/
-2);Z=v*Math.sin(W*Math.PI/2);G=0;for(W=X.length;G<W;G++){var R=c(X[G],A[G],Z);f(R.x,R.y,-fa)}M=0;for(J=U.length;M<J;M++)for(V=U[M],ba=B[M],G=0,W=V.length;G<W;G++)R=c(V[G],ba[G],Z),f(R.x,R.y,-fa)}Z=v;for(G=0;G<Y;G++)R=y?c(a[G],da[G],Z):a[G],D?(P.copy(L.normals[0]).multiplyScalar(R.x),O.copy(L.binormals[0]).multiplyScalar(R.y),N.copy(K[0]).add(P).add(O),f(N.x,N.y,N.z)):f(R.x,R.y,0);for(W=1;W<=w;W++)for(G=0;G<Y;G++)R=y?c(a[G],da[G],Z):a[G],D?(P.copy(L.normals[W]).multiplyScalar(R.x),O.copy(L.binormals[W]).multiplyScalar(R.y),
-N.copy(K[W]).add(P).add(O),f(N.x,N.y,N.z)):f(R.x,R.y,l/w*W);for(ga=x-1;0<=ga;ga--){W=ga/x;fa=u*Math.cos(W*Math.PI/2);Z=v*Math.sin(W*Math.PI/2);G=0;for(W=X.length;G<W;G++)R=c(X[G],A[G],Z),f(R.x,R.y,l+fa);M=0;for(J=U.length;M<J;M++)for(V=U[M],ba=B[M],G=0,W=V.length;G<W;G++)R=c(V[G],ba[G],Z),D?f(R.x,R.y+K[w-1].y,K[w-1].x+fa):f(R.x,R.y,l+fa)}(function(){var a=m.length/3;if(y){var c=0*Y;for(G=0;G<ca;G++)T=S[G],g(T[2]+c,T[1]+c,T[0]+c);c=Y*(w+2*x);for(G=0;G<ca;G++)T=S[G],g(T[0]+c,T[1]+c,T[2]+c)}else{for(G=
+(U[M]=V.reverse())}}var S=Ha.triangulateShape(a,U),X=a;M=0;for(J=U.length;M<J;M++)V=U[M],a=a.concat(V);var aa,Y=a.length,T,ca=S.length,A=[],G=0;var W=X.length;var ga=W-1;for(aa=G+1;G<W;G++,ga++,aa++)ga===W&&(ga=0),aa===W&&(aa=0),A[G]=d(X[G],X[ga],X[aa]);var B=[],da=A.concat();M=0;for(J=U.length;M<J;M++){V=U[M];var ba=[];G=0;W=V.length;ga=W-1;for(aa=G+1;G<W;G++,ga++,aa++)ga===W&&(ga=0),aa===W&&(aa=0),ba[G]=d(V[G],V[ga],V[aa]);B.push(ba);da=da.concat(ba)}for(ga=0;ga<x;ga++){W=ga/x;var fa=u*Math.cos(W*
+Math.PI/2);aa=v*Math.sin(W*Math.PI/2);G=0;for(W=X.length;G<W;G++){var R=c(X[G],A[G],aa);f(R.x,R.y,-fa)}M=0;for(J=U.length;M<J;M++)for(V=U[M],ba=B[M],G=0,W=V.length;G<W;G++)R=c(V[G],ba[G],aa),f(R.x,R.y,-fa)}aa=v;for(G=0;G<Y;G++)R=y?c(a[G],da[G],aa):a[G],D?(P.copy(L.normals[0]).multiplyScalar(R.x),O.copy(L.binormals[0]).multiplyScalar(R.y),N.copy(K[0]).add(P).add(O),f(N.x,N.y,N.z)):f(R.x,R.y,0);for(W=1;W<=w;W++)for(G=0;G<Y;G++)R=y?c(a[G],da[G],aa):a[G],D?(P.copy(L.normals[W]).multiplyScalar(R.x),O.copy(L.binormals[W]).multiplyScalar(R.y),
+N.copy(K[W]).add(P).add(O),f(N.x,N.y,N.z)):f(R.x,R.y,l/w*W);for(ga=x-1;0<=ga;ga--){W=ga/x;fa=u*Math.cos(W*Math.PI/2);aa=v*Math.sin(W*Math.PI/2);G=0;for(W=X.length;G<W;G++)R=c(X[G],A[G],aa),f(R.x,R.y,l+fa);M=0;for(J=U.length;M<J;M++)for(V=U[M],ba=B[M],G=0,W=V.length;G<W;G++)R=c(V[G],ba[G],aa),D?f(R.x,R.y+K[w-1].y,K[w-1].x+fa):f(R.x,R.y,l+fa)}(function(){var a=m.length/3;if(y){var c=0*Y;for(G=0;G<ca;G++)T=S[G],g(T[2]+c,T[1]+c,T[0]+c);c=Y*(w+2*x);for(G=0;G<ca;G++)T=S[G],g(T[0]+c,T[1]+c,T[2]+c)}else{for(G=
 0;G<ca;G++)T=S[G],g(T[2],T[1],T[0]);for(G=0;G<ca;G++)T=S[G],g(T[0]+Y*w,T[1]+Y*w,T[2]+Y*w)}Q.addGroup(a,m.length/3-a,void 0!==b.material?b.material:0)})();(function(){var a=m.length/3,c=0;e(X,c);c+=X.length;M=0;for(J=U.length;M<J;M++)V=U[M],e(V,c),c+=V.length;Q.addGroup(a,m.length/3-a,void 0!==b.extrudeMaterial?b.extrudeMaterial:1)})();b.arrays||(this.setIndex(n),this.addAttribute("position",new z(m,3)),this.addAttribute("uv",new z(b.arrays.uv,2)))};ab.WorldUVGenerator={generateTopUV:function(a,b,
 c,d,e){a=b[3*d];d=b[3*d+1];var f=b[3*e];e=b[3*e+1];return[new E(b[3*c],b[3*c+1]),new E(a,d),new E(f,e)]},generateSideWallUV:function(a,b,c,d,e,f){a=b[3*c];var g=b[3*c+1];c=b[3*c+2];var h=b[3*d],k=b[3*d+1];d=b[3*d+2];var l=b[3*e],m=b[3*e+1];e=b[3*e+2];var n=b[3*f],p=b[3*f+1];b=b[3*f+2];return.01>Math.abs(g-k)?[new E(a,1-c),new E(h,1-d),new E(l,1-e),new E(n,1-b)]:[new E(g,1-c),new E(k,1-d),new E(m,1-e),new E(p,1-b)]}};Nc.prototype=Object.create(O.prototype);Nc.prototype.constructor=Nc;Vb.prototype=
 Object.create(Ga.prototype);Vb.prototype.constructor=Vb;Oc.prototype=Object.create(O.prototype);Oc.prototype.constructor=Oc;lb.prototype=Object.create(F.prototype);lb.prototype.constructor=lb;Pc.prototype=Object.create(O.prototype);Pc.prototype.constructor=Pc;Wb.prototype=Object.create(F.prototype);Wb.prototype.constructor=Wb;Qc.prototype=Object.create(O.prototype);Qc.prototype.constructor=Qc;Xb.prototype=Object.create(F.prototype);Xb.prototype.constructor=Xb;Yb.prototype=Object.create(O.prototype);

+ 6 - 4
build/three.module.js

@@ -16327,11 +16327,8 @@ function WebGLBackground( renderer, state, geometries, premultipliedAlpha ) {
 
 			if ( boxMesh === undefined ) {
 
-				// Normalized box
-				// 1.1547 = (1,1,1).normalize() * 2.0
-
 				boxMesh = new Mesh(
-					new BoxBufferGeometry( 1.1547, 1.1547, 1.1547 ),
+					new BoxBufferGeometry( 1, 1, 1 ),
 					new ShaderMaterial( {
 						uniforms: ShaderLib.cube.uniforms,
 						vertexShader: ShaderLib.cube.vertexShader,
@@ -16339,6 +16336,7 @@ function WebGLBackground( renderer, state, geometries, premultipliedAlpha ) {
 						side: BackSide,
 						depthTest: true,
 						depthWrite: false,
+						polygonOffset: true,
 						fog: false
 					} )
 				);
@@ -16353,6 +16351,8 @@ function WebGLBackground( renderer, state, geometries, premultipliedAlpha ) {
 					this.matrixWorld.makeScale( scale, scale, scale );
 					this.matrixWorld.copyPosition( camera.matrixWorld );
 
+					this.material.polygonOffsetUnits = scale * 10;
+
 				};
 
 				geometries.update( boxMesh.geometry );
@@ -21862,6 +21862,8 @@ function WebGLRenderer( parameters ) {
 		state.buffers.depth.setMask( true );
 		state.buffers.color.setMask( true );
 
+		state.setPolygonOffset( false );
+
 		if ( vr.enabled ) {
 
 			vr.submitFrame();