|
@@ -108,7 +108,7 @@ a)}else!1===b.get(c).has(d)?(e=new Hh,b.get(c).set(d,e)):e=b.get(c).get(d);retur
|
|
|
!0===f.isPointLight&&(r=e,p=b.customDistanceMaterial);void 0===p?(p=!1,!0===c.morphTargets&&(!0===m.isBufferGeometry?p=m.morphAttributes&&m.morphAttributes.position&&0<m.morphAttributes.position.length:!0===m.isGeometry&&(p=m.morphTargets&&0<m.morphTargets.length)),m=!1,!0===b.isSkinnedMesh&&(!0===c.skinning?m=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",b)),b=r(p,m,!0===b.isInstancedMesh)):b=p;a.localClippingEnabled&&!0===c.clipShadows&&0!==c.clippingPlanes.length&&
|
|
|
(p=b.uuid,r=c.uuid,m=t[p],void 0===m&&(m={},t[p]=m),p=m[r],void 0===p&&(p=b.clone(),m[r]=p),b=p);b.visible=c.visible;b.wireframe=c.wireframe;b.side=3===l?null!==c.shadowSide?c.shadowSide:c.side:null!==c.shadowSide?c.shadowSide:q[c.side];b.clipShadows=c.clipShadows;b.clippingPlanes=c.clippingPlanes;b.clipIntersection=c.clipIntersection;b.wireframeLinewidth=c.wireframeLinewidth;b.linewidth=c.linewidth;!0===f.isPointLight&&!0===b.isMeshDistanceMaterial&&(b.referencePosition.setFromMatrixPosition(f.matrixWorld),
|
|
|
b.nearDistance=g,b.farDistance=h);return b}function g(c,d,e,l,m){if(!1!==c.visible){if(c.layers.test(d.layers)&&(c.isMesh||c.isLine||c.isPoints)&&(c.castShadow||c.receiveShadow&&3===m)&&(!c.frustumCulled||h.intersectsObject(c))){c.modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,c.matrixWorld);var p=b.update(c),r=c.material;if(Array.isArray(r))for(var k=p.groups,u=0,q=k.length;u<q;u++){var t=k[u],v=r[t.materialIndex];v&&v.visible&&(v=f(c,v,l,e.near,e.far,m),a.renderBufferDirect(e,null,p,v,c,
|
|
|
-t))}else r.visible&&(v=f(c,r,l,e.near,e.far,m),a.renderBufferDirect(e,null,p,v,c,null))}c=c.children;p=0;for(r=c.length;p<r;p++)g(c[p],d,e,l,m)}}var h=new Ed,l=new A,m=new A,r=new ba,p=[],k=[],t={},q={0:1,1:0,2:2},v=new na({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:.125},uniforms:{shadow_pass:{value:null},resolution:{value:new A},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackHalfToRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor = encodeHalfRGBA( vec2( mean, std_dev ) );\n}"}),
|
|
|
+t))}else r.visible&&(v=f(c,r,l,e.near,e.far,m),a.renderBufferDirect(e,null,p,v,c,null))}c=c.children;p=0;for(r=c.length;p<r;p++)g(c[p],d,e,l,m)}}var h=new Ed,l=new A,m=new A,r=new ba,p=[],k=[],t={},q={0:1,1:0,2:2},v=new na({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:.125},uniforms:{shadow_pass:{value:null},resolution:{value:new A},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackHalfToRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor = packHalfToRGBA( vec2( mean, std_dev ) );\n}"}),
|
|
|
n=v.clone();n.defines.HORIZONAL_PASS=1;var w=new E;w.setAttribute("position",new N(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var x=new ea(w,v),F=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.render=function(d,e,f){if(!1!==F.enabled&&(!1!==F.autoUpdate||!1!==F.needsUpdate)&&0!==d.length){var p=a.getRenderTarget(),k=a.getActiveCubeFace(),u=a.getActiveMipmapLevel(),q=a.state;q.setBlending(0);q.buffers.color.setClear(1,1,1,1);q.buffers.depth.setTest(!0);q.setScissorTest(!1);
|
|
|
for(var t=0,y=d.length;t<y;t++){var w=d[t],z=w.shadow;if(void 0===z)console.warn("THREE.WebGLShadowMap:",w,"has no shadow.");else{l.copy(z.mapSize);var G=z.getFrameExtents();l.multiply(G);m.copy(z.mapSize);if(l.x>c||l.y>c)console.warn("THREE.WebGLShadowMap:",w,"has shadow exceeding max texture size, reducing"),l.x>c&&(m.x=Math.floor(c/G.x),l.x=m.x*G.x,z.mapSize.x=m.x),l.y>c&&(m.y=Math.floor(c/G.y),l.y=m.y*G.y,z.mapSize.y=m.y);null!==z.map||z.isPointLightShadow||3!==this.type||(G={minFilter:1006,magFilter:1006,
|
|
|
format:1023},z.map=new la(l.x,l.y,G),z.map.texture.name=w.name+".shadowMap",z.mapPass=new la(l.x,l.y,G),z.camera.updateProjectionMatrix());null===z.map&&(G={minFilter:1003,magFilter:1003,format:1023},z.map=new la(l.x,l.y,G),z.map.texture.name=w.name+".shadowMap",z.camera.updateProjectionMatrix());a.setRenderTarget(z.map);a.clear();G=z.getViewportCount();for(var Ca=0;Ca<G;Ca++){var A=z.getViewport(Ca);r.set(m.x*A.x,m.y*A.y,m.x*A.z,m.y*A.w);q.viewport(r);z.updateMatrices(w,Ca);h=z.getFrustum();g(e,
|