Browse Source

Updated builds.

Mr.doob 5 years ago
parent
commit
f0ed0af8d9
3 changed files with 49 additions and 45 deletions
  1. 22 20
      build/three.js
  2. 5 5
      build/three.min.js
  3. 22 20
      build/three.module.js

+ 22 - 20
build/three.js

@@ -25235,7 +25235,7 @@
 
 
 			currentRenderState.setupLights( camera );
 			currentRenderState.setupLights( camera );
 
 
-			var compiled = {};
+			var compiled = new WeakMap();
 
 
 			scene.traverse( function ( object ) {
 			scene.traverse( function ( object ) {
 
 
@@ -25249,19 +25249,19 @@
 
 
 							var material2 = material[ i ];
 							var material2 = material[ i ];
 
 
-							if ( material2.uuid in compiled === false ) {
+							if ( compiled.has( material2 ) === false ) {
 
 
 								initMaterial( material2, scene, object );
 								initMaterial( material2, scene, object );
-								compiled[ material2.uuid ] = true;
+								compiled.set( material2 );
 
 
 							}
 							}
 
 
 						}
 						}
 
 
-					} else if ( material.uuid in compiled === false ) {
+					} else if ( compiled.has( material ) === false ) {
 
 
 						initMaterial( material, scene, object );
 						initMaterial( material, scene, object );
-						compiled[ material.uuid ] = true;
+						compiled.set( material );
 
 
 					}
 					}
 
 
@@ -48311,11 +48311,7 @@
 		 */
 		 */
 		fromEquirectangular: function ( equirectangular ) {
 		fromEquirectangular: function ( equirectangular ) {
 
 
-			equirectangular.magFilter = NearestFilter;
-			equirectangular.minFilter = NearestFilter;
-			equirectangular.generateMipmaps = false;
-
-			return this.fromCubemap( equirectangular );
+			return this._fromTexture( equirectangular );
 
 
 		},
 		},
 
 
@@ -48326,13 +48322,7 @@
 		 */
 		 */
 		fromCubemap: function ( cubemap ) {
 		fromCubemap: function ( cubemap ) {
 
 
-			_oldTarget = this._renderer.getRenderTarget();
-			var cubeUVRenderTarget = this._allocateTargets( cubemap );
-			this._textureToCubeUV( cubemap, cubeUVRenderTarget );
-			this._applyPMREM( cubeUVRenderTarget );
-			this._cleanup( cubeUVRenderTarget );
-
-			return cubeUVRenderTarget;
+			return this._fromTexture( cubemap );
 
 
 		},
 		},
 
 
@@ -48398,7 +48388,19 @@
 
 
 		},
 		},
 
 
-		_allocateTargets: function ( equirectangular ) {
+		_fromTexture: function ( texture ) {
+
+			_oldTarget = this._renderer.getRenderTarget();
+			var cubeUVRenderTarget = this._allocateTargets( texture );
+			this._textureToCubeUV( texture, cubeUVRenderTarget );
+			this._applyPMREM( cubeUVRenderTarget );
+			this._cleanup( cubeUVRenderTarget );
+
+			return cubeUVRenderTarget;
+
+		},
+
+		_allocateTargets: function ( texture ) { // warning: null texture is valid
 
 
 			var params = {
 			var params = {
 				magFilter: NearestFilter,
 				magFilter: NearestFilter,
@@ -48406,13 +48408,13 @@
 				generateMipmaps: false,
 				generateMipmaps: false,
 				type: UnsignedByteType,
 				type: UnsignedByteType,
 				format: RGBEFormat,
 				format: RGBEFormat,
-				encoding: _isLDR( equirectangular ) ? equirectangular.encoding : RGBEEncoding,
+				encoding: _isLDR( texture ) ? texture.encoding : RGBEEncoding,
 				depthBuffer: false,
 				depthBuffer: false,
 				stencilBuffer: false
 				stencilBuffer: false
 			};
 			};
 
 
 			var cubeUVRenderTarget = _createRenderTarget( params );
 			var cubeUVRenderTarget = _createRenderTarget( params );
-			cubeUVRenderTarget.depthBuffer = equirectangular ? false : true;
+			cubeUVRenderTarget.depthBuffer = texture ? false : true;
 			this._pingPongRenderTarget = _createRenderTarget( params );
 			this._pingPongRenderTarget = _createRenderTarget( params );
 			return cubeUVRenderTarget;
 			return cubeUVRenderTarget;
 
 

+ 5 - 5
build/three.min.js

@@ -214,8 +214,8 @@ var t=1;!0===e.wireframe&&(a=va.getWireframeAttribute(d),t=2);h=Aa;if(null!==a){
 r.data,w=C.stride;r=r.offset;C&&C.isInstancedInterleavedBuffer?(V.enableAttributeAndDivisor(u,C.meshPerAttribute),void 0===d._maxInstanceCount&&(d._maxInstanceCount=C.meshPerAttribute*C.count)):V.enableAttribute(u);I.bindBuffer(34962,x);V.vertexAttribPointer(u,n,z,v,w*A,r*A)}else r.isInstancedBufferAttribute?(V.enableAttributeAndDivisor(u,r.meshPerAttribute),void 0===d._maxInstanceCount&&(d._maxInstanceCount=r.meshPerAttribute*r.count)):V.enableAttribute(u),I.bindBuffer(34962,x),V.vertexAttribPointer(u,
 r.data,w=C.stride;r=r.offset;C&&C.isInstancedInterleavedBuffer?(V.enableAttributeAndDivisor(u,C.meshPerAttribute),void 0===d._maxInstanceCount&&(d._maxInstanceCount=C.meshPerAttribute*C.count)):V.enableAttribute(u);I.bindBuffer(34962,x);V.vertexAttribPointer(u,n,z,v,w*A,r*A)}else r.isInstancedBufferAttribute?(V.enableAttributeAndDivisor(u,r.meshPerAttribute),void 0===d._maxInstanceCount&&(d._maxInstanceCount=r.meshPerAttribute*r.count)):V.enableAttribute(u),I.bindBuffer(34962,x),V.vertexAttribPointer(u,
 n,z,v,0,0)}}else if("instanceMatrix"===N)n=la.get(f.instanceMatrix),void 0!==n&&(v=n.buffer,n=n.type,V.enableAttributeAndDivisor(u+0,1),V.enableAttributeAndDivisor(u+1,1),V.enableAttributeAndDivisor(u+2,1),V.enableAttributeAndDivisor(u+3,1),I.bindBuffer(34962,v),I.vertexAttribPointer(u+0,4,n,!1,64,0),I.vertexAttribPointer(u+1,4,n,!1,64,16),I.vertexAttribPointer(u+2,4,n,!1,64,32),I.vertexAttribPointer(u+3,4,n,!1,64,48));else if(void 0!==q&&(v=q[N],void 0!==v))switch(v.length){case 2:I.vertexAttrib2fv(u,
 n,z,v,0,0)}}else if("instanceMatrix"===N)n=la.get(f.instanceMatrix),void 0!==n&&(v=n.buffer,n=n.type,V.enableAttributeAndDivisor(u+0,1),V.enableAttributeAndDivisor(u+1,1),V.enableAttributeAndDivisor(u+2,1),V.enableAttributeAndDivisor(u+3,1),I.bindBuffer(34962,v),I.vertexAttribPointer(u+0,4,n,!1,64,0),I.vertexAttribPointer(u+1,4,n,!1,64,16),I.vertexAttribPointer(u+2,4,n,!1,64,32),I.vertexAttribPointer(u+3,4,n,!1,64,48));else if(void 0!==q&&(v=q[N],void 0!==v))switch(v.length){case 2:I.vertexAttrib2fv(u,
 v);break;case 3:I.vertexAttrib3fv(u,v);break;case 4:I.vertexAttrib4fv(u,v);break;default:I.vertexAttrib1fv(u,v)}}}V.disableUnusedAttributes()}null!==a&&I.bindBuffer(34963,p.buffer)}var N=d.drawRange.start*t;m=null!==g?g.start*t:0;p=Math.max(N,m);g=Math.max(0,Math.min(null!==a?a.count:c.count,N+d.drawRange.count*t,m+(null!==g?g.count*t:Infinity))-1-p+1);0!==g&&(f.isMesh?!0===e.wireframe?(V.setLineWidth(e.wireframeLinewidth*(null===G?X:1)),h.setMode(1)):h.setMode(4):f.isLine?(e=e.linewidth,void 0===
 v);break;case 3:I.vertexAttrib3fv(u,v);break;case 4:I.vertexAttrib4fv(u,v);break;default:I.vertexAttrib1fv(u,v)}}}V.disableUnusedAttributes()}null!==a&&I.bindBuffer(34963,p.buffer)}var N=d.drawRange.start*t;m=null!==g?g.start*t:0;p=Math.max(N,m);g=Math.max(0,Math.min(null!==a?a.count:c.count,N+d.drawRange.count*t,m+(null!==g?g.count*t:Infinity))-1-p+1);0!==g&&(f.isMesh?!0===e.wireframe?(V.setLineWidth(e.wireframeLinewidth*(null===G?X:1)),h.setMode(1)):h.setMode(4):f.isLine?(e=e.linewidth,void 0===
-e&&(e=1),V.setLineWidth(e*(null===G?X:1)),f.isLineSegments?h.setMode(1):f.isLineLoop?h.setMode(2):h.setMode(3)):f.isPoints?h.setMode(0):f.isSprite&&h.setMode(4),f.isInstancedMesh?h.renderInstances(d,p,g,f.count):d.isInstancedBufferGeometry?h.renderInstances(d,p,g,Math.min(d.instanceCount,d._maxInstanceCount)):h.render(p,g))};this.compile=function(a,b){y=ua.get(a,b);y.init();a.traverse(function(a){a.isLight&&(y.pushLight(a),a.castShadow&&y.pushShadow(a))});y.setupLights(b);var c={};a.traverse(function(b){var d=
-b.material;if(d)if(Array.isArray(d))for(var e=0;e<d.length;e++){var f=d[e];!1===f.uuid in c&&(p(f,a,b),c[f.uuid]=!0)}else!1===d.uuid in c&&(p(d,a,b),c[d.uuid]=!0)})};var Ca=null,za=new xh;za.setAnimationLoop(function(a){ta.isPresenting||Ca&&Ca(a)});"undefined"!==typeof window&&za.setContext(window);this.setAnimationLoop=function(a){Ca=a;ta.setAnimationLoop(a);za.start()};this.render=function(a,c,d,e){if(void 0!==d){console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.");
+e&&(e=1),V.setLineWidth(e*(null===G?X:1)),f.isLineSegments?h.setMode(1):f.isLineLoop?h.setMode(2):h.setMode(3)):f.isPoints?h.setMode(0):f.isSprite&&h.setMode(4),f.isInstancedMesh?h.renderInstances(d,p,g,f.count):d.isInstancedBufferGeometry?h.renderInstances(d,p,g,Math.min(d.instanceCount,d._maxInstanceCount)):h.render(p,g))};this.compile=function(a,b){y=ua.get(a,b);y.init();a.traverse(function(a){a.isLight&&(y.pushLight(a),a.castShadow&&y.pushShadow(a))});y.setupLights(b);var c=new WeakMap;a.traverse(function(b){var d=
+b.material;if(d)if(Array.isArray(d))for(var e=0;e<d.length;e++){var f=d[e];!1===c.has(f)&&(p(f,a,b),c.set(f))}else!1===c.has(d)&&(p(d,a,b),c.set(d))})};var Ca=null,za=new xh;za.setAnimationLoop(function(a){ta.isPresenting||Ca&&Ca(a)});"undefined"!==typeof window&&za.setContext(window);this.setAnimationLoop=function(a){Ca=a;ta.setAnimationLoop(a);za.start()};this.render=function(a,c,d,e){if(void 0!==d){console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.");
 var f=d}if(void 0!==e){console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.");var g=e}if(void 0!==c&&!0!==c.isCamera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else if(!0!==B){Q=b=null;Le=!1;H=-1;S=null;!0===a.autoUpdate&&a.updateMatrixWorld();null===c.parent&&c.updateMatrixWorld();!0===ta.enabled&&!0===ta.isPresenting&&(c=ta.getCamera(c));if(!0===a.isScene)a.onBeforeRender(O,a,c,f||G);y=ua.get(a,c);
 var f=d}if(void 0!==e){console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.");var g=e}if(void 0!==c&&!0!==c.isCamera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else if(!0!==B){Q=b=null;Le=!1;H=-1;S=null;!0===a.autoUpdate&&a.updateMatrixWorld();null===c.parent&&c.updateMatrixWorld();!0===ta.enabled&&!0===ta.isPresenting&&(c=ta.getCamera(c));if(!0===a.isScene)a.onBeforeRender(O,a,c,f||G);y=ua.get(a,c);
 y.init();Jd.multiplyMatrices(c.projectionMatrix,c.matrixWorldInverse);na.setFromProjectionMatrix(Jd);lg=this.localClippingEnabled;Je=Va.init(this.clippingPlanes,lg,c);P=wa.get(a,c);P.init();l(a,c,0,O.sortObjects);P.finish();!0===O.sortObjects&&P.sort(ha,ja);!0===Je&&Va.beginShadows();Ea.render(y.state.shadowsArray,a,c);y.setupLights(c);!0===Je&&Va.endShadows();!0===this.info.autoReset&&this.info.reset();void 0!==f&&this.setRenderTarget(f);oa.render(P,a,c,g);d=P.opaque;e=P.transparent;0<d.length&&
 y.init();Jd.multiplyMatrices(c.projectionMatrix,c.matrixWorldInverse);na.setFromProjectionMatrix(Jd);lg=this.localClippingEnabled;Je=Va.init(this.clippingPlanes,lg,c);P=wa.get(a,c);P.init();l(a,c,0,O.sortObjects);P.finish();!0===O.sortObjects&&P.sort(ha,ja);!0===Je&&Va.beginShadows();Ea.render(y.state.shadowsArray,a,c);y.setupLights(c);!0===Je&&Va.endShadows();!0===this.info.autoReset&&this.info.reset();void 0!==f&&this.setRenderTarget(f);oa.render(P,a,c,g);d=P.opaque;e=P.transparent;0<d.length&&
 m(d,a,c);0<e.length&&m(e,a,c);if(!0===a.isScene)a.onAfterRender(O,a,c);null!==G&&(aa.updateRenderTargetMipmap(G),aa.updateMultisampleRenderTarget(G));V.buffers.depth.setTest(!0);V.buffers.depth.setMask(!0);V.buffers.color.setMask(!0);V.setPolygonOffset(!1);y=P=null}};this.setFramebuffer=function(a){D!==a&&null===G&&I.bindFramebuffer(36160,a);D=a};this.getActiveCubeFace=function(){return F};this.getActiveMipmapLevel=function(){return J};this.getRenderTarget=function(){return G};this.setRenderTarget=
 m(d,a,c);0<e.length&&m(e,a,c);if(!0===a.isScene)a.onAfterRender(O,a,c);null!==G&&(aa.updateRenderTargetMipmap(G),aa.updateMultisampleRenderTarget(G));V.buffers.depth.setTest(!0);V.buffers.depth.setMask(!0);V.buffers.color.setMask(!0);V.setPolygonOffset(!1);y=P=null}};this.setFramebuffer=function(a){D!==a&&null===G&&I.bindFramebuffer(36160,a);D=a};this.getActiveCubeFace=function(){return F};this.getActiveMipmapLevel=function(){return J};this.getRenderTarget=function(){return G};this.setRenderTarget=
@@ -958,9 +958,9 @@ Math.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[
 b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(1E-4,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};vb.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};vb.prototype.copy=function(a){y.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};vb.prototype.clone=function(){return(new this.constructor).copy(this)};re.prototype=Object.create(da.prototype);
 b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(1E-4,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};vb.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};vb.prototype.copy=function(a){y.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};vb.prototype.clone=function(){return(new this.constructor).copy(this)};re.prototype=Object.create(da.prototype);
 re.prototype.constructor=re;var mb=Math.pow(2,8),cj=[.125,.215,.35,.446,.526,.582],dj=5+cj.length,lb={3E3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},rh=new dd,sh=function(){for(var a=[],b=[],c=[],d=8,e=0;e<dj;e++){var f=Math.pow(2,d);b.push(f);var g=1/f;4<e?g=cj[e-8+4-1]:0==e&&(g=0);c.push(g);g=1/(f-1);f=-g/2;g=1+g/2;var h=[f,f,g,f,g,g,f,f,g,g,f,g];f=new Float32Array(108);g=new Float32Array(72);for(var k=new Float32Array(36),m=0;6>m;m++){var n=m%3*2/3-1,p=2<m?0:-1;f.set([n,p,0,n+2/3,p,0,n+2/3,p+
 re.prototype.constructor=re;var mb=Math.pow(2,8),cj=[.125,.215,.35,.446,.526,.582],dj=5+cj.length,lb={3E3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},rh=new dd,sh=function(){for(var a=[],b=[],c=[],d=8,e=0;e<dj;e++){var f=Math.pow(2,d);b.push(f);var g=1/f;4<e?g=cj[e-8+4-1]:0==e&&(g=0);c.push(g);g=1/(f-1);f=-g/2;g=1+g/2;var h=[f,f,g,f,g,g,f,f,g,g,f,g];f=new Float32Array(108);g=new Float32Array(72);for(var k=new Float32Array(36),m=0;6>m;m++){var n=m%3*2/3-1,p=2<m?0:-1;f.set([n,p,0,n+2/3,p,0,n+2/3,p+
 1,0,n,p,0,n+2/3,p+1,0,n,p+1,0],18*m);g.set(h,12*m);k.set([m,m,m,m,m,m],6*m)}h=new F;h.setAttribute("position",new G(f,3));h.setAttribute("uv",new G(g,2));h.setAttribute("faceIndex",new G(k,1));a.push(h);4<d&&d--}return{_lodPlanes:a,_sizeLods:b,_sigmas:c}}(),Ce=sh._lodPlanes,ej=sh._sizeLods,Zf=sh._sigmas,th=null,xc=(1+Math.sqrt(5))/2,vd=1/xc,fj=[new n(1,1,1),new n(-1,1,1),new n(1,1,-1),new n(-1,1,-1),new n(0,xc,vd),new n(0,xc,-vd),new n(vd,0,xc),new n(-vd,0,xc),new n(xc,vd,0),new n(-xc,vd,0)];Sg.prototype=
 1,0,n,p,0,n+2/3,p+1,0,n,p+1,0],18*m);g.set(h,12*m);k.set([m,m,m,m,m,m],6*m)}h=new F;h.setAttribute("position",new G(f,3));h.setAttribute("uv",new G(g,2));h.setAttribute("faceIndex",new G(k,1));a.push(h);4<d&&d--}return{_lodPlanes:a,_sizeLods:b,_sigmas:c}}(),Ce=sh._lodPlanes,ej=sh._sizeLods,Zf=sh._sigmas,th=null,xc=(1+Math.sqrt(5))/2,vd=1/xc,fj=[new n(1,1,1),new n(-1,1,1),new n(1,1,-1),new n(-1,1,-1),new n(0,xc,vd),new n(0,xc,-vd),new n(vd,0,xc),new n(-vd,0,xc),new n(xc,vd,0),new n(-xc,vd,0)];Sg.prototype=
-{constructor:Sg,fromScene:function(a,b,c,d){void 0===b&&(b=0);void 0===c&&(c=.1);void 0===d&&(d=100);th=this._renderer.getRenderTarget();var e=this._allocateTargets();this._sceneToCubeUV(a,c,d,e);0<b&&this._blur(e,0,0,b);this._applyPMREM(e);this._cleanup(e);return e},fromEquirectangular:function(a){a.magFilter=1003;a.minFilter=1003;a.generateMipmaps=!1;return this.fromCubemap(a)},fromCubemap:function(a){th=this._renderer.getRenderTarget();var b=this._allocateTargets(a);this._textureToCubeUV(a,b);
-this._applyPMREM(b);this._cleanup(b);return b},compileCubemapShader:function(){null===this._cubemapShader&&(this._cubemapShader=si(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){null===this._equirectShader&&(this._equirectShader=ri(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose();null!==this._cubemapShader&&this._cubemapShader.dispose();null!==this._equirectShader&&this._equirectShader.dispose();for(var a=0;a<Ce.length;a++)Ce[a].dispose()},
-_cleanup:function(a){this._pingPongRenderTarget.dispose();this._renderer.setRenderTarget(th);a.scissorTest=!1;a.setSize(a.width,a.height)},_allocateTargets:function(a){var b=void 0===a||1009!==a.type?!1:3E3===a.encoding||3001===a.encoding||3007===a.encoding;b={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:b?a.encoding:3002,depthBuffer:!1,stencilBuffer:!1};var c=qi(b);c.depthBuffer=a?!1:!0;this._pingPongRenderTarget=qi(b);return c},_compileMaterial:function(a){a=new ba(Ce[0],
+{constructor:Sg,fromScene:function(a,b,c,d){void 0===b&&(b=0);void 0===c&&(c=.1);void 0===d&&(d=100);th=this._renderer.getRenderTarget();var e=this._allocateTargets();this._sceneToCubeUV(a,c,d,e);0<b&&this._blur(e,0,0,b);this._applyPMREM(e);this._cleanup(e);return e},fromEquirectangular:function(a){return this._fromTexture(a)},fromCubemap:function(a){return this._fromTexture(a)},compileCubemapShader:function(){null===this._cubemapShader&&(this._cubemapShader=si(),this._compileMaterial(this._cubemapShader))},
+compileEquirectangularShader:function(){null===this._equirectShader&&(this._equirectShader=ri(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose();null!==this._cubemapShader&&this._cubemapShader.dispose();null!==this._equirectShader&&this._equirectShader.dispose();for(var a=0;a<Ce.length;a++)Ce[a].dispose()},_cleanup:function(a){this._pingPongRenderTarget.dispose();this._renderer.setRenderTarget(th);a.scissorTest=!1;a.setSize(a.width,a.height)},_fromTexture:function(a){th=
+this._renderer.getRenderTarget();var b=this._allocateTargets(a);this._textureToCubeUV(a,b);this._applyPMREM(b);this._cleanup(b);return b},_allocateTargets:function(a){var b=void 0===a||1009!==a.type?!1:3E3===a.encoding||3001===a.encoding||3007===a.encoding;b={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:b?a.encoding:3002,depthBuffer:!1,stencilBuffer:!1};var c=qi(b);c.depthBuffer=a?!1:!0;this._pingPongRenderTarget=qi(b);return c},_compileMaterial:function(a){a=new ba(Ce[0],
 a);this._renderer.compile(a,rh)},_sceneToCubeUV:function(a,b,c,d){b=new T(90,1,b,c);c=[1,-1,1,1,1,1];var e=[1,1,1,-1,-1,-1],f=this._renderer,g=f.outputEncoding,h=f.toneMapping,k=f.toneMappingExposure,m=f.getClearColor(),n=f.getClearAlpha();f.toneMapping=1;f.toneMappingExposure=1;f.outputEncoding=3E3;var p=a.background;if(p&&p.isColor){p.convertSRGBToLinear();var u=Math.min(Math.max(Math.ceil(Math.log2(Math.max(p.r,p.g,p.b))),-128),127);p=p.multiplyScalar(Math.pow(2,-u));f.setClearColor(p,(u+128)/
 a);this._renderer.compile(a,rh)},_sceneToCubeUV:function(a,b,c,d){b=new T(90,1,b,c);c=[1,-1,1,1,1,1];var e=[1,1,1,-1,-1,-1],f=this._renderer,g=f.outputEncoding,h=f.toneMapping,k=f.toneMappingExposure,m=f.getClearColor(),n=f.getClearAlpha();f.toneMapping=1;f.toneMappingExposure=1;f.outputEncoding=3E3;var p=a.background;if(p&&p.isColor){p.convertSRGBToLinear();var u=Math.min(Math.max(Math.ceil(Math.log2(Math.max(p.r,p.g,p.b))),-128),127);p=p.multiplyScalar(Math.pow(2,-u));f.setClearColor(p,(u+128)/
 255);a.background=null}for(p=0;6>p;p++)u=p%3,0==u?(b.up.set(0,c[p],0),b.lookAt(e[p],0,0)):1==u?(b.up.set(0,0,c[p]),b.lookAt(0,e[p],0)):(b.up.set(0,c[p],0),b.lookAt(0,0,e[p])),Vg(d,u*mb,2<p?mb:0,mb,mb),f.setRenderTarget(d),f.render(a,b);f.toneMapping=h;f.toneMappingExposure=k;f.outputEncoding=g;f.setClearColor(m,n)},_textureToCubeUV:function(a,b){var c=this._renderer;a.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=si()):null==this._equirectShader&&(this._equirectShader=ri());var d=
 255);a.background=null}for(p=0;6>p;p++)u=p%3,0==u?(b.up.set(0,c[p],0),b.lookAt(e[p],0,0)):1==u?(b.up.set(0,0,c[p]),b.lookAt(0,e[p],0)):(b.up.set(0,c[p],0),b.lookAt(0,0,e[p])),Vg(d,u*mb,2<p?mb:0,mb,mb),f.setRenderTarget(d),f.render(a,b);f.toneMapping=h;f.toneMappingExposure=k;f.outputEncoding=g;f.setClearColor(m,n)},_textureToCubeUV:function(a,b){var c=this._renderer;a.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=si()):null==this._equirectShader&&(this._equirectShader=ri());var d=
 a.isCubeTexture?this._cubemapShader:this._equirectShader,e=new ba(Ce[0],d);d=d.uniforms;d.envMap.value=a;a.isCubeTexture||d.texelSize.value.set(1/a.image.width,1/a.image.height);d.inputEncoding.value=lb[a.encoding];d.outputEncoding.value=lb[b.texture.encoding];Vg(b,0,0,3*mb,2*mb);c.setRenderTarget(b);c.render(e,rh)},_applyPMREM:function(a){var b=this._renderer,c=b.autoClear;b.autoClear=!1;for(var d=1;d<dj;d++)this._blur(a,d-1,d,Math.sqrt(Zf[d]*Zf[d]-Zf[d-1]*Zf[d-1]),fj[(d-1)%fj.length]);b.autoClear=
 a.isCubeTexture?this._cubemapShader:this._equirectShader,e=new ba(Ce[0],d);d=d.uniforms;d.envMap.value=a;a.isCubeTexture||d.texelSize.value.set(1/a.image.width,1/a.image.height);d.inputEncoding.value=lb[a.encoding];d.outputEncoding.value=lb[b.texture.encoding];Vg(b,0,0,3*mb,2*mb);c.setRenderTarget(b);c.render(e,rh)},_applyPMREM:function(a){var b=this._renderer,c=b.autoClear;b.autoClear=!1;for(var d=1;d<dj;d++)this._blur(a,d-1,d,Math.sqrt(Zf[d]*Zf[d]-Zf[d-1]*Zf[d-1]),fj[(d-1)%fj.length]);b.autoClear=

+ 22 - 20
build/three.module.js

@@ -25227,7 +25227,7 @@ function WebGLRenderer( parameters ) {
 
 
 		currentRenderState.setupLights( camera );
 		currentRenderState.setupLights( camera );
 
 
-		const compiled = {};
+		const compiled = new WeakMap();
 
 
 		scene.traverse( function ( object ) {
 		scene.traverse( function ( object ) {
 
 
@@ -25241,19 +25241,19 @@ function WebGLRenderer( parameters ) {
 
 
 						let material2 = material[ i ];
 						let material2 = material[ i ];
 
 
-						if ( material2.uuid in compiled === false ) {
+						if ( compiled.has( material2 ) === false ) {
 
 
 							initMaterial( material2, scene, object );
 							initMaterial( material2, scene, object );
-							compiled[ material2.uuid ] = true;
+							compiled.set( material2 );
 
 
 						}
 						}
 
 
 					}
 					}
 
 
-				} else if ( material.uuid in compiled === false ) {
+				} else if ( compiled.has( material ) === false ) {
 
 
 					initMaterial( material, scene, object );
 					initMaterial( material, scene, object );
-					compiled[ material.uuid ] = true;
+					compiled.set( material );
 
 
 				}
 				}
 
 
@@ -48295,11 +48295,7 @@ PMREMGenerator.prototype = {
 	 */
 	 */
 	fromEquirectangular: function ( equirectangular ) {
 	fromEquirectangular: function ( equirectangular ) {
 
 
-		equirectangular.magFilter = NearestFilter;
-		equirectangular.minFilter = NearestFilter;
-		equirectangular.generateMipmaps = false;
-
-		return this.fromCubemap( equirectangular );
+		return this._fromTexture( equirectangular );
 
 
 	},
 	},
 
 
@@ -48310,13 +48306,7 @@ PMREMGenerator.prototype = {
 	 */
 	 */
 	fromCubemap: function ( cubemap ) {
 	fromCubemap: function ( cubemap ) {
 
 
-		_oldTarget = this._renderer.getRenderTarget();
-		const cubeUVRenderTarget = this._allocateTargets( cubemap );
-		this._textureToCubeUV( cubemap, cubeUVRenderTarget );
-		this._applyPMREM( cubeUVRenderTarget );
-		this._cleanup( cubeUVRenderTarget );
-
-		return cubeUVRenderTarget;
+		return this._fromTexture( cubemap );
 
 
 	},
 	},
 
 
@@ -48382,7 +48372,19 @@ PMREMGenerator.prototype = {
 
 
 	},
 	},
 
 
-	_allocateTargets: function ( equirectangular ) {
+	_fromTexture: function ( texture ) {
+
+		_oldTarget = this._renderer.getRenderTarget();
+		const cubeUVRenderTarget = this._allocateTargets( texture );
+		this._textureToCubeUV( texture, cubeUVRenderTarget );
+		this._applyPMREM( cubeUVRenderTarget );
+		this._cleanup( cubeUVRenderTarget );
+
+		return cubeUVRenderTarget;
+
+	},
+
+	_allocateTargets: function ( texture ) { // warning: null texture is valid
 
 
 		const params = {
 		const params = {
 			magFilter: NearestFilter,
 			magFilter: NearestFilter,
@@ -48390,13 +48392,13 @@ PMREMGenerator.prototype = {
 			generateMipmaps: false,
 			generateMipmaps: false,
 			type: UnsignedByteType,
 			type: UnsignedByteType,
 			format: RGBEFormat,
 			format: RGBEFormat,
-			encoding: _isLDR( equirectangular ) ? equirectangular.encoding : RGBEEncoding,
+			encoding: _isLDR( texture ) ? texture.encoding : RGBEEncoding,
 			depthBuffer: false,
 			depthBuffer: false,
 			stencilBuffer: false
 			stencilBuffer: false
 		};
 		};
 
 
 		const cubeUVRenderTarget = _createRenderTarget( params );
 		const cubeUVRenderTarget = _createRenderTarget( params );
-		cubeUVRenderTarget.depthBuffer = equirectangular ? false : true;
+		cubeUVRenderTarget.depthBuffer = texture ? false : true;
 		this._pingPongRenderTarget = _createRenderTarget( params );
 		this._pingPongRenderTarget = _createRenderTarget( params );
 		return cubeUVRenderTarget;
 		return cubeUVRenderTarget;