瀏覽代碼

Updated builds.

Mr.doob 5 年之前
父節點
當前提交
5c98ce14ed
共有 3 個文件被更改,包括 89 次插入89 次删除
  1. 34 34
      build/three.js
  2. 21 21
      build/three.min.js
  3. 34 34
      build/three.module.js

+ 34 - 34
build/three.js

@@ -8661,6 +8661,7 @@
 			this.blending = source.blending;
 			this.side = source.side;
 			this.flatShading = source.flatShading;
+			this.vertexTangents = source.vertexTangents;
 			this.vertexColors = source.vertexColors;
 
 			this.opacity = source.opacity;
@@ -8677,7 +8678,6 @@
 			this.depthTest = source.depthTest;
 			this.depthWrite = source.depthWrite;
 
-			this.stencilWrite = source.stencilWrite;
 			this.stencilWriteMask = source.stencilWriteMask;
 			this.stencilFunc = source.stencilFunc;
 			this.stencilRef = source.stencilRef;
@@ -8685,6 +8685,26 @@
 			this.stencilFail = source.stencilFail;
 			this.stencilZFail = source.stencilZFail;
 			this.stencilZPass = source.stencilZPass;
+			this.stencilWrite = source.stencilWrite;
+
+			var srcPlanes = source.clippingPlanes,
+				dstPlanes = null;
+
+			if ( srcPlanes !== null ) {
+
+				var n = srcPlanes.length;
+				dstPlanes = new Array( n );
+
+				for ( var i = 0; i !== n; ++ i )
+					{ dstPlanes[ i ] = srcPlanes[ i ].clone(); }
+
+			}
+
+			this.clippingPlanes = dstPlanes;
+			this.clipIntersection = source.clipIntersection;
+			this.clipShadows = source.clipShadows;
+
+			this.shadowSide = source.shadowSide;
 
 			this.colorWrite = source.colorWrite;
 
@@ -8705,26 +8725,6 @@
 
 			this.userData = JSON.parse( JSON.stringify( source.userData ) );
 
-			this.clipShadows = source.clipShadows;
-			this.clipIntersection = source.clipIntersection;
-
-			var srcPlanes = source.clippingPlanes,
-				dstPlanes = null;
-
-			if ( srcPlanes !== null ) {
-
-				var n = srcPlanes.length;
-				dstPlanes = new Array( n );
-
-				for ( var i = 0; i !== n; ++ i )
-					{ dstPlanes[ i ] = srcPlanes[ i ].clone(); }
-
-			}
-
-			this.clippingPlanes = dstPlanes;
-
-			this.shadowSide = source.shadowSide;
-
 			return this;
 
 		},
@@ -17655,7 +17655,7 @@
 
 	}
 
-	function WebGLProgram( renderer, extensions, code, material, shader, parameters ) {
+	function WebGLProgram( renderer, extensions, cacheKey, material, shader, parameters ) {
 
 		var gl = renderer.getContext();
 
@@ -18162,7 +18162,7 @@
 
 		this.name = shader.name;
 		this.id = programIdCount ++;
-		this.code = code;
+		this.cacheKey = cacheKey;
 		this.usedTimes = 1;
 		this.program = program;
 		this.vertexShader = glVertexShader;
@@ -18412,7 +18412,7 @@
 
 		};
 
-		this.getProgramCode = function ( material, parameters ) {
+		this.getProgramCacheKey = function ( material, parameters ) {
 
 			var array = [];
 
@@ -18454,18 +18454,18 @@
 
 		};
 
-		this.acquireProgram = function ( material, shader, parameters, code ) {
+		this.acquireProgram = function ( material, shader, parameters, cacheKey ) {
 
 			var program;
 
 			// Check if code has been already compiled
 			for ( var p = 0, pl = programs.length; p < pl; p ++ ) {
 
-				var programInfo = programs[ p ];
+				var preexistingProgram = programs[ p ];
 
-				if ( programInfo.code === code ) {
+				if ( preexistingProgram.cacheKey === cacheKey ) {
 
-					program = programInfo;
+					program = preexistingProgram;
 					++ program.usedTimes;
 
 					break;
@@ -18476,7 +18476,7 @@
 
 			if ( program === undefined ) {
 
-				program = new WebGLProgram( renderer, extensions, code, material, shader, parameters );
+				program = new WebGLProgram( renderer, extensions, cacheKey, material, shader, parameters );
 				programs.push( program );
 
 			}
@@ -24890,7 +24890,7 @@
 			var parameters = programCache.getParameters(
 				material, lights.state, shadowsArray, fog, _clipping.numPlanes, _clipping.numIntersection, object );
 
-			var code = programCache.getProgramCode( material, parameters );
+			var programCacheKey = programCache.getProgramCacheKey( material, parameters );
 
 			var program = materialProperties.program;
 			var programChange = true;
@@ -24900,7 +24900,7 @@
 				// new material
 				material.addEventListener( 'dispose', onMaterialDispose );
 
-			} else if ( program.code !== code ) {
+			} else if ( program.cacheKey !== programCacheKey ) {
 
 				// changed glsl or parameters
 				releaseMaterialProgramReference( material );
@@ -24949,10 +24949,10 @@
 
 				material.onBeforeCompile( materialProperties.shader, _this );
 
-				// Computing code again as onBeforeCompile may have changed the shaders
-				code = programCache.getProgramCode( material, parameters );
+				// Computing cache key again as onBeforeCompile may have changed the shaders
+				programCacheKey = programCache.getProgramCacheKey( material, parameters );
 
-				program = programCache.acquireProgram( material, materialProperties.shader, parameters, code );
+				program = programCache.acquireProgram( material, materialProperties.shader, parameters, programCacheKey );
 
 				materialProperties.program = program;
 				material.program = program;

+ 21 - 21
build/three.min.js

@@ -79,7 +79,7 @@ f);m=Ch(m,f);l=l.replace(Fh,Dh);m=m.replace(Fh,Dh);f.isWebGL2&&!d.isRawShaderMat
 "\n"+b,0<x&&(h=h.replace("#version 300 es\n",["#version 300 es\n\n#extension GL_OVR_multiview2 : require","layout(num_views = "+x+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n")),h=h.replace("uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;",["uniform mat4 modelViewMatrices["+x+"];","uniform mat4 projectionMatrices["+x+"];","uniform mat4 viewMatrices["+x+"];","uniform mat3 normalMatrices["+x+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]\n#define projectionMatrix projectionMatrices[VIEW_ID]\n#define viewMatrix viewMatrices[VIEW_ID]\n#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),
 b=b.replace("#version 300 es\n","#version 300 es\n\n#extension GL_OVR_multiview2 : require\n#define VIEW_ID gl_ViewID_OVR"),b=b.replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+x+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n"))));m=b+m;l=yh(g,35633,h+l);m=yh(g,35632,m);g.attachShader(w,l);g.attachShader(w,m);void 0!==d.index0AttributeName?g.bindAttribLocation(w,0,d.index0AttributeName):!0===f.morphTargets&&g.bindAttribLocation(w,0,"position");g.linkProgram(w);if(a.debug.checkShaderErrors){a=
 g.getProgramInfoLog(w).trim();f=g.getShaderInfoLog(l).trim();r=g.getShaderInfoLog(m).trim();k=q=!0;if(!1===g.getProgramParameter(w,35714))q=!1,p=Ah(g,l,"vertex"),t=Ah(g,m,"fragment"),console.error("THREE.WebGLProgram: shader error: ",g.getError(),"35715",g.getProgramParameter(w,35715),"gl.getProgramInfoLog",a,p,t);else if(""!==a)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",a);else if(""===f||""===r)k=!1;k&&(this.diagnostics={runnable:q,material:d,programLog:a,vertexShader:{log:f,prefix:h},
-fragmentShader:{log:r,prefix:b}})}g.deleteShader(l);g.deleteShader(m);var F;this.getUniforms=function(){void 0===F&&(F=new Cb(g,w));return F};var H;this.getAttributes=function(){if(void 0===H){for(var a={},b=g.getProgramParameter(w,35721),c=0;c<b;c++){var d=g.getActiveAttrib(w,c).name;a[d]=g.getAttribLocation(w,d)}H=a}return H};this.destroy=function(){g.deleteProgram(w);this.program=void 0};this.name=e.name;this.id=Yj++;this.code=c;this.usedTimes=1;this.program=w;this.vertexShader=l;this.fragmentShader=
+fragmentShader:{log:r,prefix:b}})}g.deleteShader(l);g.deleteShader(m);var F;this.getUniforms=function(){void 0===F&&(F=new Cb(g,w));return F};var H;this.getAttributes=function(){if(void 0===H){for(var a={},b=g.getProgramParameter(w,35721),c=0;c<b;c++){var d=g.getActiveAttrib(w,c).name;a[d]=g.getAttribLocation(w,d)}H=a}return H};this.destroy=function(){g.deleteProgram(w);this.program=void 0};this.name=e.name;this.id=Yj++;this.cacheKey=c;this.usedTimes=1;this.program=w;this.vertexShader=l;this.fragmentShader=
 m;this.numMultiviewViews=x;return this}function Zj(a,b,c){function d(a,b){if(a)a.isTexture?c=a.encoding:a.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),c=a.texture.encoding);else var c=3E3;3E3===c&&b&&(c=3007);return c}var e=[],f=c.isWebGL2,g=c.logarithmicDepthBuffer,h=c.floatVertexTextures,l=c.precision,m=c.maxVertexUniforms,r=c.vertexTextures,q={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",
 MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},k="precision isWebGL2 supportsVertexTextures outputEncoding instancing numMultiviewViews map mapEncoding matcap matcapEncoding envMap envMapMode envMapEncoding envMapCubeUV lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap objectSpaceNormalMap tangentSpaceNormalMap clearcoatNormalMap displacementMap specularMap roughnessMap metalnessMap gradientMap alphaMap combine vertexColors vertexTangents vertexUvs fog useFog fogExp2 flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights numRectAreaLights numDirLightShadows numPointLightShadows numSpotLightShadows shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking dithering sheen".split(" ");
 this.getParameters=function(b,e,k,u,n,x,F){var t=q[b.type];if(F.isSkinnedMesh){var p=F.skeleton.bones;if(h)p=1024;else{var v=Math.min(Math.floor((m-20)/4),p.length);v<p.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+p.length+" bones. This GPU supports "+v+"."),p=0):p=v}}else p=0;null!==b.precision&&(l=c.getMaxPrecision(b.precision),l!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",l,"instead."));v=a.getRenderTarget();return{isWebGL2:f,
@@ -87,8 +87,8 @@ shaderID:t,precision:l,instancing:!0===F.isInstancedMesh,supportsVertexTextures:
 emissiveMap:!!b.emissiveMap,emissiveMapEncoding:d(b.emissiveMap,a.gammaInput),bumpMap:!!b.bumpMap,normalMap:!!b.normalMap,objectSpaceNormalMap:1===b.normalMapType,tangentSpaceNormalMap:0===b.normalMapType,clearcoatNormalMap:!!b.clearcoatNormalMap,displacementMap:!!b.displacementMap,roughnessMap:!!b.roughnessMap,metalnessMap:!!b.metalnessMap,specularMap:!!b.specularMap,alphaMap:!!b.alphaMap,gradientMap:!!b.gradientMap,sheen:!!b.sheen,combine:b.combine,vertexTangents:b.normalMap&&b.vertexTangents,vertexColors:b.vertexColors,
 vertexUvs:!!b.map||!!b.bumpMap||!!b.normalMap||!!b.specularMap||!!b.alphaMap||!!b.emissiveMap||!!b.roughnessMap||!!b.metalnessMap||!!b.clearcoatNormalMap||!!b.displacementMap,fog:!!u,useFog:b.fog,fogExp2:u&&u.isFogExp2,flatShading:b.flatShading,sizeAttenuation:b.sizeAttenuation,logarithmicDepthBuffer:g,skinning:b.skinning&&0<p,maxBones:p,useVertexTexture:h,morphTargets:b.morphTargets,morphNormals:b.morphNormals,maxMorphTargets:a.maxMorphTargets,maxMorphNormals:a.maxMorphNormals,numDirLights:e.directional.length,
 numPointLights:e.point.length,numSpotLights:e.spot.length,numRectAreaLights:e.rectArea.length,numHemiLights:e.hemi.length,numDirLightShadows:e.directionalShadowMap.length,numPointLightShadows:e.pointShadowMap.length,numSpotLightShadows:e.spotShadowMap.length,numClippingPlanes:n,numClipIntersection:x,dithering:b.dithering,shadowMapEnabled:a.shadowMap.enabled&&0<k.length,shadowMapType:a.shadowMap.type,toneMapping:b.toneMapped?a.toneMapping:0,physicallyCorrectLights:a.physicallyCorrectLights,premultipliedAlpha:b.premultipliedAlpha,
-alphaTest:b.alphaTest,doubleSided:2===b.side,flipSided:1===b.side,depthPacking:void 0!==b.depthPacking?b.depthPacking:!1}};this.getProgramCode=function(b,c){var d=[];c.shaderID?d.push(c.shaderID):(d.push(b.fragmentShader),d.push(b.vertexShader));if(void 0!==b.defines)for(var e in b.defines)d.push(e),d.push(b.defines[e]);for(e=0;e<k.length;e++)d.push(c[k[e]]);d.push(b.onBeforeCompile.toString());d.push(a.gammaOutput);d.push(a.gammaFactor);return d.join()};this.acquireProgram=function(c,d,f,g){for(var h,
-l=0,m=e.length;l<m;l++){var r=e[l];if(r.code===g){h=r;++h.usedTimes;break}}void 0===h&&(h=new Xj(a,b,g,c,d,f),e.push(h));return h};this.releaseProgram=function(a){if(0===--a.usedTimes){var b=e.indexOf(a);e[b]=e[e.length-1];e.pop();a.destroy()}};this.programs=e}function ak(){var a=new WeakMap;return{get:function(b){var c=a.get(b);void 0===c&&(c={},a.set(b,c));return c},remove:function(b){a.delete(b)},update:function(b,c,d){a.get(b)[c]=d},dispose:function(){a=new WeakMap}}}function bk(a,b){return a.groupOrder!==
+alphaTest:b.alphaTest,doubleSided:2===b.side,flipSided:1===b.side,depthPacking:void 0!==b.depthPacking?b.depthPacking:!1}};this.getProgramCacheKey=function(b,c){var d=[];c.shaderID?d.push(c.shaderID):(d.push(b.fragmentShader),d.push(b.vertexShader));if(void 0!==b.defines)for(var e in b.defines)d.push(e),d.push(b.defines[e]);for(e=0;e<k.length;e++)d.push(c[k[e]]);d.push(b.onBeforeCompile.toString());d.push(a.gammaOutput);d.push(a.gammaFactor);return d.join()};this.acquireProgram=function(c,d,f,g){for(var h,
+l=0,m=e.length;l<m;l++){var r=e[l];if(r.cacheKey===g){h=r;++h.usedTimes;break}}void 0===h&&(h=new Xj(a,b,g,c,d,f),e.push(h));return h};this.releaseProgram=function(a){if(0===--a.usedTimes){var b=e.indexOf(a);e[b]=e[e.length-1];e.pop();a.destroy()}};this.programs=e}function ak(){var a=new WeakMap;return{get:function(b){var c=a.get(b);void 0===c&&(c={},a.set(b,c));return c},remove:function(b){a.delete(b)},update:function(b,c,d){a.get(b)[c]=d},dispose:function(){a=new WeakMap}}}function bk(a,b){return a.groupOrder!==
 b.groupOrder?a.groupOrder-b.groupOrder:a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder: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 ck(a,b){return a.groupOrder!==b.groupOrder?a.groupOrder-b.groupOrder:a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function Gh(){function a(a,d,e,m,r,q){var g=b[c];void 0===g?(g={id:a.id,object:a,geometry:d,material:e,program:e.program||
 f,groupOrder:m,renderOrder:a.renderOrder,z:r,group:q},b[c]=g):(g.id=a.id,g.object=a,g.geometry=d,g.material=e,g.program=e.program||f,g.groupOrder=m,g.renderOrder=a.renderOrder,g.z=r,g.group=q);c++;return g}var b=[],c=0,d=[],e=[],f={id:-1};return{opaque:d,transparent:e,init:function(){c=0;d.length=0;e.length=0},push:function(b,c,f,m,r,q){b=a(b,c,f,m,r,q);(!0===f.transparent?e:d).push(b)},unshift:function(b,c,f,m,r,q){b=a(b,c,f,m,r,q);(!0===f.transparent?e:d).unshift(b)},sort:function(){1<d.length&&
 d.sort(bk);1<e.length&&e.sort(ck)}}}function dk(){function a(c){c=c.target;c.removeEventListener("dispose",a);b.delete(c)}var b=new WeakMap;return{get:function(c,d){var e=b.get(c);if(void 0===e){var f=new Gh;b.set(c,new WeakMap);b.get(c).set(d,f);c.addEventListener("dispose",a)}else f=e.get(d),void 0===f&&(f=new Gh,e.set(d,f));return f},dispose:function(){b=new WeakMap}}}function ek(){var a={};return{get:function(b){if(void 0!==a[b.id])return a[b.id];switch(b.type){case "DirectionalLight":var c={direction:new n,
@@ -180,8 +180,8 @@ console.log("THREE.WebGLRenderer: Context Lost.");N=!0}function e(){console.log(
 else if(a.isLight)G.pushLight(a),a.castShadow&&G.pushShadow(a);else if(a.isSprite){if(!a.frustumCulled||dg.intersectsSprite(a)){d&&Fb.setFromMatrixPosition(a.matrixWorld).applyMatrix4(Jd);var e=sa.update(a),f=a.material;f.visible&&I.push(a,e,f,c,Fb.z,null)}}else if(a.isImmediateRenderObject)d&&Fb.setFromMatrixPosition(a.matrixWorld).applyMatrix4(Jd),I.push(a,null,a.material,c,Fb.z,null);else if(a.isMesh||a.isLine||a.isPoints)if(a.isSkinnedMesh&&a.skeleton.frame!==ca.render.frame&&(a.skeleton.update(),
 a.skeleton.frame=ca.render.frame),!a.frustumCulled||dg.intersectsObject(a))if(d&&Fb.setFromMatrixPosition(a.matrixWorld).applyMatrix4(Jd),e=sa.update(a),f=a.material,Array.isArray(f))for(var g=e.groups,h=0,m=g.length;h<m;h++){var r=g[h],q=f[r.materialIndex];q&&q.visible&&I.push(a,e,q,c,Fb.z,r)}else f.visible&&I.push(a,e,f,c,Fb.z,null);a=a.children;h=0;for(m=a.length;h<m;h++)l(a[h],b,c,d)}}function m(a,b,c,d){for(var e=0,f=a.length;e<f;e++){var g=a[e],h=g.object,l=g.geometry,m=void 0===d?g.material:
 d;g=g.group;if(c.isArrayCamera)if($b=c,ja.enabled&&ua.isAvailable())r(h,b,c,l,m,g);else for(var q=c.cameras,k=0,p=q.length;k<p;k++){var u=q[k];h.layers.test(u.layers)&&(aa.viewport(T.copy(u.viewport)),G.setupLights(u),r(h,b,u,l,m,g))}else $b=null,r(h,b,c,l,m,g)}}function r(a,c,d,e,f,g){a.onBeforeRender(C,c,d,e,f,g);G=va.get(c,$b||d);a.modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,a.matrixWorld);a.normalMatrix.getNormalMatrix(a.modelViewMatrix);if(a.isImmediateRenderObject){aa.setMaterial(f);
-var l=k(d,c.fog,f,a);Je=b=null;Y=!1;h(a,l)}else C.renderBufferDirect(d,c.fog,e,f,a,g);a.onAfterRender(C,c,d,e,f,g);G=va.get(c,$b||d)}function q(a,b,c){var d=Z.get(a),e=G.state.lights,h=e.state.version;c=pa.getParameters(a,e.state,G.state.shadowsArray,b,Oa.numPlanes,Oa.numIntersection,c);var l=pa.getProgramCode(a,c),m=d.program,r=!0;if(void 0===m)a.addEventListener("dispose",f);else if(m.code!==l)g(a);else{if(d.lightsStateVersion!==h)d.lightsStateVersion=h;else if(void 0!==c.shaderID)return;r=!1}r&&
-(c.shaderID?(l=cb[c.shaderID],d.shader={name:a.type,uniforms:Xb(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}):d.shader={name:a.type,uniforms:a.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader},a.onBeforeCompile(d.shader,C),l=pa.getProgramCode(a,c),m=pa.acquireProgram(a,d.shader,c,l),d.program=m,a.program=m);c=m.getAttributes();if(a.morphTargets)for(l=a.numSupportedMorphTargets=0;l<C.maxMorphTargets;l++)0<=c["morphTarget"+l]&&a.numSupportedMorphTargets++;
+var l=k(d,c.fog,f,a);Je=b=null;Y=!1;h(a,l)}else C.renderBufferDirect(d,c.fog,e,f,a,g);a.onAfterRender(C,c,d,e,f,g);G=va.get(c,$b||d)}function q(a,b,c){var d=Z.get(a),e=G.state.lights,h=e.state.version;c=pa.getParameters(a,e.state,G.state.shadowsArray,b,Oa.numPlanes,Oa.numIntersection,c);var l=pa.getProgramCacheKey(a,c),m=d.program,r=!0;if(void 0===m)a.addEventListener("dispose",f);else if(m.cacheKey!==l)g(a);else{if(d.lightsStateVersion!==h)d.lightsStateVersion=h;else if(void 0!==c.shaderID)return;
+r=!1}r&&(c.shaderID?(l=cb[c.shaderID],d.shader={name:a.type,uniforms:Xb(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}):d.shader={name:a.type,uniforms:a.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader},a.onBeforeCompile(d.shader,C),l=pa.getProgramCacheKey(a,c),m=pa.acquireProgram(a,d.shader,c,l),d.program=m,a.program=m);c=m.getAttributes();if(a.morphTargets)for(l=a.numSupportedMorphTargets=0;l<C.maxMorphTargets;l++)0<=c["morphTarget"+l]&&a.numSupportedMorphTargets++;
 if(a.morphNormals)for(l=a.numSupportedMorphNormals=0;l<C.maxMorphNormals;l++)0<=c["morphNormal"+l]&&a.numSupportedMorphNormals++;c=d.shader.uniforms;if(!a.isShaderMaterial&&!a.isRawShaderMaterial||!0===a.clipping)d.numClippingPlanes=Oa.numPlanes,d.numIntersection=Oa.numIntersection,c.clippingPlanes=Oa.uniform;d.fog=b;d.needsLights=a.isMeshLambertMaterial||a.isMeshPhongMaterial||a.isMeshStandardMaterial||a.isShadowMaterial||a.isShaderMaterial&&!0===a.lights;d.lightsStateVersion=h;d.needsLights&&(c.ambientLightColor.value=
 e.state.ambient,c.lightProbe.value=e.state.probe,c.directionalLights.value=e.state.directional,c.spotLights.value=e.state.spot,c.rectAreaLights.value=e.state.rectArea,c.pointLights.value=e.state.point,c.hemisphereLights.value=e.state.hemi,c.directionalShadowMap.value=e.state.directionalShadowMap,c.directionalShadowMatrix.value=e.state.directionalShadowMatrix,c.spotShadowMap.value=e.state.spotShadowMap,c.spotShadowMatrix.value=e.state.spotShadowMatrix,c.pointShadowMap.value=e.state.pointShadowMap,
 c.pointShadowMatrix.value=e.state.pointShadowMatrix);a=d.program.getUniforms();a=Cb.seqWithValue(a.seq,c);d.uniformsList=a}function k(a,b,c,d){ba.resetTextureUnits();var e=Z.get(c),f=G.state.lights;He&&(ta||a!==X)&&Oa.setState(c.clippingPlanes,c.clipIntersection,c.clipShadows,a,e,a===X&&c.id===ha);!1===c.needsUpdate&&(void 0===e.program?c.needsUpdate=!0:c.fog&&e.fog!==b?c.needsUpdate=!0:e.needsLights&&e.lightsStateVersion!==f.state.version?c.needsUpdate=!0:void 0===e.numClippingPlanes||e.numClippingPlanes===
@@ -497,22 +497,22 @@ this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMa
 (d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;d.stencilWrite=this.stencilWrite;d.stencilWriteMask=this.stencilWriteMask;d.stencilFunc=this.stencilFunc;d.stencilRef=this.stencilRef;d.stencilFuncMask=this.stencilFuncMask;d.stencilFail=this.stencilFail;d.stencilZFail=this.stencilZFail;d.stencilZPass=this.stencilZPass;this.rotation&&0!==this.rotation&&(d.rotation=this.rotation);!0===this.polygonOffset&&(d.polygonOffset=!0);0!==this.polygonOffsetFactor&&
 (d.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(d.polygonOffsetUnits=this.polygonOffsetUnits);this.linewidth&&1!==this.linewidth&&(d.linewidth=this.linewidth);void 0!==this.dashSize&&(d.dashSize=this.dashSize);void 0!==this.gapSize&&(d.gapSize=this.gapSize);void 0!==this.scale&&(d.scale=this.scale);!0===this.dithering&&(d.dithering=!0);0<this.alphaTest&&(d.alphaTest=this.alphaTest);!0===this.premultipliedAlpha&&(d.premultipliedAlpha=this.premultipliedAlpha);!0===this.wireframe&&
 (d.wireframe=this.wireframe);1<this.wireframeLinewidth&&(d.wireframeLinewidth=this.wireframeLinewidth);"round"!==this.wireframeLinecap&&(d.wireframeLinecap=this.wireframeLinecap);"round"!==this.wireframeLinejoin&&(d.wireframeLinejoin=this.wireframeLinejoin);!0===this.morphTargets&&(d.morphTargets=!0);!0===this.morphNormals&&(d.morphNormals=!0);!0===this.skinning&&(d.skinning=!0);!1===this.visible&&(d.visible=!1);!1===this.toneMapped&&(d.toneMapped=!1);"{}"!==JSON.stringify(this.userData)&&(d.userData=
-this.userData);c&&(c=b(a.textures),a=b(a.images),0<c.length&&(d.textures=c),0<a.length&&(d.images=a));return d},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.name=a.name;this.fog=a.fog;this.blending=a.blending;this.side=a.side;this.flatShading=a.flatShading;this.vertexColors=a.vertexColors;this.opacity=a.opacity;this.transparent=a.transparent;this.blendSrc=a.blendSrc;this.blendDst=a.blendDst;this.blendEquation=a.blendEquation;this.blendSrcAlpha=a.blendSrcAlpha;this.blendDstAlpha=
-a.blendDstAlpha;this.blendEquationAlpha=a.blendEquationAlpha;this.depthFunc=a.depthFunc;this.depthTest=a.depthTest;this.depthWrite=a.depthWrite;this.stencilWrite=a.stencilWrite;this.stencilWriteMask=a.stencilWriteMask;this.stencilFunc=a.stencilFunc;this.stencilRef=a.stencilRef;this.stencilFuncMask=a.stencilFuncMask;this.stencilFail=a.stencilFail;this.stencilZFail=a.stencilZFail;this.stencilZPass=a.stencilZPass;this.colorWrite=a.colorWrite;this.precision=a.precision;this.polygonOffset=a.polygonOffset;
-this.polygonOffsetFactor=a.polygonOffsetFactor;this.polygonOffsetUnits=a.polygonOffsetUnits;this.dithering=a.dithering;this.alphaTest=a.alphaTest;this.premultipliedAlpha=a.premultipliedAlpha;this.visible=a.visible;this.toneMapped=a.toneMapped;this.userData=JSON.parse(JSON.stringify(a.userData));this.clipShadows=a.clipShadows;this.clipIntersection=a.clipIntersection;var b=a.clippingPlanes,c=null;if(null!==b){var d=b.length;c=Array(d);for(var e=0;e!==d;++e)c[e]=b[e].clone()}this.clippingPlanes=c;this.shadowSide=
-a.shadowSide;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Ga.prototype=Object.create(N.prototype);Ga.prototype.constructor=Ga;Ga.prototype.isMeshBasicMaterial=!0;Ga.prototype.copy=function(a){N.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=
-a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;return this};Object.defineProperty(O.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(O.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(a){this.usage=
-a;return this},copy:function(a){this.name=a.name;this.array=new a.array.constructor(a.array);this.itemSize=a.itemSize;this.count=a.count;this.normalized=a.normalized;this.usage=a.usage;return this},copyAt:function(a,b,c){a*=this.itemSize;c*=b.itemSize;for(var d=0,e=this.itemSize;d<e;d++)this.array[a+d]=b.array[c+d];return this},copyArray:function(a){this.array.set(a);return this},copyColorsArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",
-d),f=new J);b[c++]=f.r;b[c++]=f.g;b[c++]=f.b}return this},copyVector2sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",d),f=new B);b[c++]=f.x;b[c++]=f.y}return this},copyVector3sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",d),f=new n);b[c++]=f.x;b[c++]=f.y;
-b[c++]=f.z}return this},copyVector4sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",d),f=new da);b[c++]=f.x;b[c++]=f.y;b[c++]=f.z;b[c++]=f.w}return this},set:function(a,b){void 0===b&&(b=0);this.array.set(a,b);return this},getX:function(a){return this.array[a*this.itemSize]},setX:function(a,b){this.array[a*this.itemSize]=b;return this},getY:function(a){return this.array[a*this.itemSize+
-1]},setY:function(a,b){this.array[a*this.itemSize+1]=b;return this},getZ:function(a){return this.array[a*this.itemSize+2]},setZ:function(a,b){this.array[a*this.itemSize+2]=b;return this},getW:function(a){return this.array[a*this.itemSize+3]},setW:function(a,b){this.array[a*this.itemSize+3]=b;return this},setXY:function(a,b,c){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;return this},setXYZ:function(a,b,c,d){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;this.array[a+2]=d;return this},
-setXYZW:function(a,b,c,d,e){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;this.array[a+2]=d;this.array[a+3]=e;return this},onUpload:function(a){this.onUploadCallback=a;return this},clone:function(){return(new this.constructor(this.array,this.itemSize)).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}});xd.prototype=Object.create(O.prototype);xd.prototype.constructor=xd;yd.prototype=
-Object.create(O.prototype);yd.prototype.constructor=yd;zd.prototype=Object.create(O.prototype);zd.prototype.constructor=zd;Ad.prototype=Object.create(O.prototype);Ad.prototype.constructor=Ad;Sb.prototype=Object.create(O.prototype);Sb.prototype.constructor=Sb;Bd.prototype=Object.create(O.prototype);Bd.prototype.constructor=Bd;Tb.prototype=Object.create(O.prototype);Tb.prototype.constructor=Tb;A.prototype=Object.create(O.prototype);A.prototype.constructor=A;Cd.prototype=Object.create(O.prototype);Cd.prototype.constructor=
-Cd;Object.assign(ih.prototype,{computeGroups:function(a){var b=[],c=void 0;a=a.faces;for(var d=0;d<a.length;d++){var e=a[d];if(e.materialIndex!==c){c=e.materialIndex;void 0!==f&&(f.count=3*d-f.start,b.push(f));var f={start:3*d,materialIndex:c}}}void 0!==f&&(f.count=3*d-f.start,b.push(f));this.groups=b},fromGeometry:function(a){var b=a.faces,c=a.vertices,d=a.faceVertexUvs,e=d[0]&&0<d[0].length,f=d[1]&&0<d[1].length,g=a.morphTargets,h=g.length;if(0<h){var l=[];for(var m=0;m<h;m++)l[m]={name:g[m].name,
-data:[]};this.morphTargets.position=l}var k=a.morphNormals,n=k.length;if(0<n){var u=[];for(m=0;m<n;m++)u[m]={name:k[m].name,data:[]};this.morphTargets.normal=u}var p=a.skinIndices,t=a.skinWeights,v=p.length===c.length,y=t.length===c.length;0<c.length&&0===b.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(m=0;m<b.length;m++){var w=b[m];this.vertices.push(c[w.a],c[w.b],c[w.c]);var x=w.vertexNormals;3===x.length?this.normals.push(x[0],x[1],x[2]):(x=w.normal,
-this.normals.push(x,x,x));x=w.vertexColors;3===x.length?this.colors.push(x[0],x[1],x[2]):(x=w.color,this.colors.push(x,x,x));!0===e&&(x=d[0][m],void 0!==x?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",m),this.uvs.push(new B,new B,new B)));!0===f&&(x=d[1][m],void 0!==x?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",m),this.uvs2.push(new B,new B,new B)));for(x=0;x<h;x++){var A=g[x].vertices;
-l[x].data.push(A[w.a],A[w.b],A[w.c])}for(x=0;x<n;x++)A=k[x].vertexNormals[m],u[x].data.push(A.a,A.b,A.c);v&&this.skinIndices.push(p[w.a],p[w.b],p[w.c]);y&&this.skinWeights.push(t[w.a],t[w.b],t[w.c])}this.computeGroups(a);this.verticesNeedUpdate=a.verticesNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate=a.colorsNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.groupsNeedUpdate=a.groupsNeedUpdate;null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());null!==
-a.boundingBox&&(this.boundingBox=a.boundingBox.clone());return this}});var Vi=1,jb=new Q,Ug=new D,Af=new n,rc=new $a,Vg=new $a,Ya=new n;E.prototype=Object.assign(Object.create(Ba.prototype),{constructor:E,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(a){Array.isArray(a)?this.index=new (65535<jh(a)?Tb:Sb)(a,1):this.index=a},getAttribute:function(a){return this.attributes[a]},setAttribute:function(a,b){this.attributes[a]=b;return this},deleteAttribute:function(a){delete this.attributes[a];
+this.userData);c&&(c=b(a.textures),a=b(a.images),0<c.length&&(d.textures=c),0<a.length&&(d.images=a));return d},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.name=a.name;this.fog=a.fog;this.blending=a.blending;this.side=a.side;this.flatShading=a.flatShading;this.vertexTangents=a.vertexTangents;this.vertexColors=a.vertexColors;this.opacity=a.opacity;this.transparent=a.transparent;this.blendSrc=a.blendSrc;this.blendDst=a.blendDst;this.blendEquation=a.blendEquation;
+this.blendSrcAlpha=a.blendSrcAlpha;this.blendDstAlpha=a.blendDstAlpha;this.blendEquationAlpha=a.blendEquationAlpha;this.depthFunc=a.depthFunc;this.depthTest=a.depthTest;this.depthWrite=a.depthWrite;this.stencilWriteMask=a.stencilWriteMask;this.stencilFunc=a.stencilFunc;this.stencilRef=a.stencilRef;this.stencilFuncMask=a.stencilFuncMask;this.stencilFail=a.stencilFail;this.stencilZFail=a.stencilZFail;this.stencilZPass=a.stencilZPass;this.stencilWrite=a.stencilWrite;var b=a.clippingPlanes,c=null;if(null!==
+b){var d=b.length;c=Array(d);for(var e=0;e!==d;++e)c[e]=b[e].clone()}this.clippingPlanes=c;this.clipIntersection=a.clipIntersection;this.clipShadows=a.clipShadows;this.shadowSide=a.shadowSide;this.colorWrite=a.colorWrite;this.precision=a.precision;this.polygonOffset=a.polygonOffset;this.polygonOffsetFactor=a.polygonOffsetFactor;this.polygonOffsetUnits=a.polygonOffsetUnits;this.dithering=a.dithering;this.alphaTest=a.alphaTest;this.premultipliedAlpha=a.premultipliedAlpha;this.visible=a.visible;this.toneMapped=
+a.toneMapped;this.userData=JSON.parse(JSON.stringify(a.userData));return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Ga.prototype=Object.create(N.prototype);Ga.prototype.constructor=Ga;Ga.prototype.isMeshBasicMaterial=!0;Ga.prototype.copy=function(a){N.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.specularMap=a.specularMap;this.alphaMap=
+a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;return this};Object.defineProperty(O.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(O.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},
+setUsage:function(a){this.usage=a;return this},copy:function(a){this.name=a.name;this.array=new a.array.constructor(a.array);this.itemSize=a.itemSize;this.count=a.count;this.normalized=a.normalized;this.usage=a.usage;return this},copyAt:function(a,b,c){a*=this.itemSize;c*=b.itemSize;for(var d=0,e=this.itemSize;d<e;d++)this.array[a+d]=b.array[c+d];return this},copyArray:function(a){this.array.set(a);return this},copyColorsArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];
+void 0===f&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",d),f=new J);b[c++]=f.r;b[c++]=f.g;b[c++]=f.b}return this},copyVector2sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",d),f=new B);b[c++]=f.x;b[c++]=f.y}return this},copyVector3sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",
+d),f=new n);b[c++]=f.x;b[c++]=f.y;b[c++]=f.z}return this},copyVector4sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",d),f=new da);b[c++]=f.x;b[c++]=f.y;b[c++]=f.z;b[c++]=f.w}return this},set:function(a,b){void 0===b&&(b=0);this.array.set(a,b);return this},getX:function(a){return this.array[a*this.itemSize]},setX:function(a,b){this.array[a*this.itemSize]=b;return this},getY:function(a){return this.array[a*
+this.itemSize+1]},setY:function(a,b){this.array[a*this.itemSize+1]=b;return this},getZ:function(a){return this.array[a*this.itemSize+2]},setZ:function(a,b){this.array[a*this.itemSize+2]=b;return this},getW:function(a){return this.array[a*this.itemSize+3]},setW:function(a,b){this.array[a*this.itemSize+3]=b;return this},setXY:function(a,b,c){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;return this},setXYZ:function(a,b,c,d){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;this.array[a+2]=
+d;return this},setXYZW:function(a,b,c,d,e){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;this.array[a+2]=d;this.array[a+3]=e;return this},onUpload:function(a){this.onUploadCallback=a;return this},clone:function(){return(new this.constructor(this.array,this.itemSize)).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}});xd.prototype=Object.create(O.prototype);xd.prototype.constructor=
+xd;yd.prototype=Object.create(O.prototype);yd.prototype.constructor=yd;zd.prototype=Object.create(O.prototype);zd.prototype.constructor=zd;Ad.prototype=Object.create(O.prototype);Ad.prototype.constructor=Ad;Sb.prototype=Object.create(O.prototype);Sb.prototype.constructor=Sb;Bd.prototype=Object.create(O.prototype);Bd.prototype.constructor=Bd;Tb.prototype=Object.create(O.prototype);Tb.prototype.constructor=Tb;A.prototype=Object.create(O.prototype);A.prototype.constructor=A;Cd.prototype=Object.create(O.prototype);
+Cd.prototype.constructor=Cd;Object.assign(ih.prototype,{computeGroups:function(a){var b=[],c=void 0;a=a.faces;for(var d=0;d<a.length;d++){var e=a[d];if(e.materialIndex!==c){c=e.materialIndex;void 0!==f&&(f.count=3*d-f.start,b.push(f));var f={start:3*d,materialIndex:c}}}void 0!==f&&(f.count=3*d-f.start,b.push(f));this.groups=b},fromGeometry:function(a){var b=a.faces,c=a.vertices,d=a.faceVertexUvs,e=d[0]&&0<d[0].length,f=d[1]&&0<d[1].length,g=a.morphTargets,h=g.length;if(0<h){var l=[];for(var m=0;m<
+h;m++)l[m]={name:g[m].name,data:[]};this.morphTargets.position=l}var k=a.morphNormals,n=k.length;if(0<n){var u=[];for(m=0;m<n;m++)u[m]={name:k[m].name,data:[]};this.morphTargets.normal=u}var p=a.skinIndices,t=a.skinWeights,v=p.length===c.length,y=t.length===c.length;0<c.length&&0===b.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(m=0;m<b.length;m++){var w=b[m];this.vertices.push(c[w.a],c[w.b],c[w.c]);var x=w.vertexNormals;3===x.length?this.normals.push(x[0],
+x[1],x[2]):(x=w.normal,this.normals.push(x,x,x));x=w.vertexColors;3===x.length?this.colors.push(x[0],x[1],x[2]):(x=w.color,this.colors.push(x,x,x));!0===e&&(x=d[0][m],void 0!==x?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",m),this.uvs.push(new B,new B,new B)));!0===f&&(x=d[1][m],void 0!==x?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",m),this.uvs2.push(new B,new B,new B)));for(x=0;x<
+h;x++){var A=g[x].vertices;l[x].data.push(A[w.a],A[w.b],A[w.c])}for(x=0;x<n;x++)A=k[x].vertexNormals[m],u[x].data.push(A.a,A.b,A.c);v&&this.skinIndices.push(p[w.a],p[w.b],p[w.c]);y&&this.skinWeights.push(t[w.a],t[w.b],t[w.c])}this.computeGroups(a);this.verticesNeedUpdate=a.verticesNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate=a.colorsNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.groupsNeedUpdate=a.groupsNeedUpdate;null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());
+null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());return this}});var Vi=1,jb=new Q,Ug=new D,Af=new n,rc=new $a,Vg=new $a,Ya=new n;E.prototype=Object.assign(Object.create(Ba.prototype),{constructor:E,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(a){Array.isArray(a)?this.index=new (65535<jh(a)?Tb:Sb)(a,1):this.index=a},getAttribute:function(a){return this.attributes[a]},setAttribute:function(a,b){this.attributes[a]=b;return this},deleteAttribute:function(a){delete this.attributes[a];
 return this},addGroup:function(a,b,c){this.groups.push({start:a,count:b,materialIndex:void 0!==c?c:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(a,b){this.drawRange.start=a;this.drawRange.count=b},applyMatrix:function(a){var b=this.attributes.position;void 0!==b&&(a.applyToBufferAttribute(b),b.needsUpdate=!0);var c=this.attributes.normal;void 0!==c&&(b=(new Z).getNormalMatrix(a),b.applyToBufferAttribute(c),c.needsUpdate=!0);c=this.attributes.tangent;void 0!==c&&(b=(new Z).getNormalMatrix(a),
 b.applyToBufferAttribute(c),c.needsUpdate=!0);null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();return this},rotateX:function(a){jb.makeRotationX(a);this.applyMatrix(jb);return this},rotateY:function(a){jb.makeRotationY(a);this.applyMatrix(jb);return this},rotateZ:function(a){jb.makeRotationZ(a);this.applyMatrix(jb);return this},translate:function(a,b,c){jb.makeTranslation(a,b,c);this.applyMatrix(jb);return this},scale:function(a,b,c){jb.makeScale(a,
 b,c);this.applyMatrix(jb);return this},lookAt:function(a){Ug.lookAt(a);Ug.updateMatrix();this.applyMatrix(Ug.matrix);return this},center:function(){this.computeBoundingBox();this.boundingBox.getCenter(Af).negate();this.translate(Af.x,Af.y,Af.z);return this},setFromObject:function(a){var b=a.geometry;if(a.isPoints||a.isLine){a=new A(3*b.vertices.length,3);var c=new A(3*b.colors.length,3);this.setAttribute("position",a.copyVector3sArray(b.vertices));this.setAttribute("color",c.copyColorsArray(b.colors));

+ 34 - 34
build/three.module.js

@@ -8655,6 +8655,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		this.blending = source.blending;
 		this.side = source.side;
 		this.flatShading = source.flatShading;
+		this.vertexTangents = source.vertexTangents;
 		this.vertexColors = source.vertexColors;
 
 		this.opacity = source.opacity;
@@ -8671,7 +8672,6 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		this.depthTest = source.depthTest;
 		this.depthWrite = source.depthWrite;
 
-		this.stencilWrite = source.stencilWrite;
 		this.stencilWriteMask = source.stencilWriteMask;
 		this.stencilFunc = source.stencilFunc;
 		this.stencilRef = source.stencilRef;
@@ -8679,6 +8679,26 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		this.stencilFail = source.stencilFail;
 		this.stencilZFail = source.stencilZFail;
 		this.stencilZPass = source.stencilZPass;
+		this.stencilWrite = source.stencilWrite;
+
+		var srcPlanes = source.clippingPlanes,
+			dstPlanes = null;
+
+		if ( srcPlanes !== null ) {
+
+			var n = srcPlanes.length;
+			dstPlanes = new Array( n );
+
+			for ( var i = 0; i !== n; ++ i )
+				dstPlanes[ i ] = srcPlanes[ i ].clone();
+
+		}
+
+		this.clippingPlanes = dstPlanes;
+		this.clipIntersection = source.clipIntersection;
+		this.clipShadows = source.clipShadows;
+
+		this.shadowSide = source.shadowSide;
 
 		this.colorWrite = source.colorWrite;
 
@@ -8699,26 +8719,6 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		this.userData = JSON.parse( JSON.stringify( source.userData ) );
 
-		this.clipShadows = source.clipShadows;
-		this.clipIntersection = source.clipIntersection;
-
-		var srcPlanes = source.clippingPlanes,
-			dstPlanes = null;
-
-		if ( srcPlanes !== null ) {
-
-			var n = srcPlanes.length;
-			dstPlanes = new Array( n );
-
-			for ( var i = 0; i !== n; ++ i )
-				dstPlanes[ i ] = srcPlanes[ i ].clone();
-
-		}
-
-		this.clippingPlanes = dstPlanes;
-
-		this.shadowSide = source.shadowSide;
-
 		return this;
 
 	},
@@ -17642,7 +17642,7 @@ function generateEnvMapBlendingDefine( parameters ) {
 
 }
 
-function WebGLProgram( renderer, extensions, code, material, shader, parameters ) {
+function WebGLProgram( renderer, extensions, cacheKey, material, shader, parameters ) {
 
 	var gl = renderer.getContext();
 
@@ -18149,7 +18149,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
 
 	this.name = shader.name;
 	this.id = programIdCount ++;
-	this.code = code;
+	this.cacheKey = cacheKey;
 	this.usedTimes = 1;
 	this.program = program;
 	this.vertexShader = glVertexShader;
@@ -18399,7 +18399,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
 
 	};
 
-	this.getProgramCode = function ( material, parameters ) {
+	this.getProgramCacheKey = function ( material, parameters ) {
 
 		var array = [];
 
@@ -18441,18 +18441,18 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
 
 	};
 
-	this.acquireProgram = function ( material, shader, parameters, code ) {
+	this.acquireProgram = function ( material, shader, parameters, cacheKey ) {
 
 		var program;
 
 		// Check if code has been already compiled
 		for ( var p = 0, pl = programs.length; p < pl; p ++ ) {
 
-			var programInfo = programs[ p ];
+			var preexistingProgram = programs[ p ];
 
-			if ( programInfo.code === code ) {
+			if ( preexistingProgram.cacheKey === cacheKey ) {
 
-				program = programInfo;
+				program = preexistingProgram;
 				++ program.usedTimes;
 
 				break;
@@ -18463,7 +18463,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
 
 		if ( program === undefined ) {
 
-			program = new WebGLProgram( renderer, extensions, code, material, shader, parameters );
+			program = new WebGLProgram( renderer, extensions, cacheKey, material, shader, parameters );
 			programs.push( program );
 
 		}
@@ -24882,7 +24882,7 @@ function WebGLRenderer( parameters ) {
 		var parameters = programCache.getParameters(
 			material, lights.state, shadowsArray, fog, _clipping.numPlanes, _clipping.numIntersection, object );
 
-		var code = programCache.getProgramCode( material, parameters );
+		var programCacheKey = programCache.getProgramCacheKey( material, parameters );
 
 		var program = materialProperties.program;
 		var programChange = true;
@@ -24892,7 +24892,7 @@ function WebGLRenderer( parameters ) {
 			// new material
 			material.addEventListener( 'dispose', onMaterialDispose );
 
-		} else if ( program.code !== code ) {
+		} else if ( program.cacheKey !== programCacheKey ) {
 
 			// changed glsl or parameters
 			releaseMaterialProgramReference( material );
@@ -24941,10 +24941,10 @@ function WebGLRenderer( parameters ) {
 
 			material.onBeforeCompile( materialProperties.shader, _this );
 
-			// Computing code again as onBeforeCompile may have changed the shaders
-			code = programCache.getProgramCode( material, parameters );
+			// Computing cache key again as onBeforeCompile may have changed the shaders
+			programCacheKey = programCache.getProgramCacheKey( material, parameters );
 
-			program = programCache.acquireProgram( material, materialProperties.shader, parameters, code );
+			program = programCache.acquireProgram( material, materialProperties.shader, parameters, programCacheKey );
 
 			materialProperties.program = program;
 			material.program = program;