提交 0b088b42 编写于 作者: M Mr.doob

Updated builds.

上级 9e6719be
......@@ -30228,8 +30228,15 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
for ( var i = 0, il = _lightShadows.length; i < il; i ++ ) {
var light = _lightShadows[ i ];
var shadow = light.shadow;
if ( shadow === undefined ) {
console.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' );
continue;
}
var shadowCamera = shadow.camera;
_shadowMapSize.copy( shadow.mapSize );
......@@ -30809,7 +30816,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
if ( premultipliedAlpha ) {
gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD );
gl.blendFuncSeparate( gl.ZERO, gl.ZERO, gl.SRC_COLOR, gl.SRC_ALPHA );
gl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );
} else {
......
......@@ -731,15 +731,16 @@ f=c.side;y.renderSingleSided&&f==THREE.DoubleSide&&(f=THREE.FrontSide);y.renderR
THREE.Points)&&a.castShadow&&(!1===a.frustumCulled||!0===h.intersectsObject(a))&&!0===a.material.visible&&(a.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,a.matrixWorld),q.push(a));a=a.children;for(var d=0,f=a.length;d<f;d++)e(a[d],b,c)}}var f=a.context,g=a.state,h=new THREE.Frustum,k=new THREE.Matrix4,l=b.shadows,n=new THREE.Vector2,p=new THREE.Vector3,m=new THREE.Vector3,q=[],r=Array(4),s=Array(4),u={},x=[new THREE.Vector3(1,0,0),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,
0,-1),new THREE.Vector3(0,1,0),new THREE.Vector3(0,-1,0)],v=[new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1)],C=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4];b=new THREE.MeshDepthMaterial;b.depthPacking=THREE.RGBADepthPacking;b.clipping=!0;for(var w=THREE.ShaderLib.distanceRGBA,D=THREE.UniformsUtils.clone(w.uniforms),A=0;4!==A;++A){var z=
0!==(A&1),B=0!==(A&2),G=b.clone();G.morphTargets=z;G.skinning=B;r[A]=G;z=new THREE.ShaderMaterial({defines:{USE_SHADOWMAP:""},uniforms:D,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:z,skinning:B,clipping:!0});s[A]=z}var y=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=THREE.PCFShadowMap;this.renderSingleSided=this.renderReverseSided=!0;this.render=function(b,r){if(!1!==y.enabled&&(!1!==y.autoUpdate||!1!==y.needsUpdate)&&0!==l.length){g.clearColor(1,
1,1,1);g.disable(f.BLEND);g.setDepthTest(!0);g.setScissorTest(!1);for(var s,u,w=0,z=l.length;w<z;w++){var A=l[w],K=A.shadow,N=K.camera;n.copy(K.mapSize);if(A instanceof THREE.PointLight){s=6;u=!0;var B=n.x,D=n.y;C[0].set(2*B,D,B,D);C[1].set(0,D,B,D);C[2].set(3*B,D,B,D);C[3].set(B,D,B,D);C[4].set(3*B,0,B,D);C[5].set(B,0,B,D);n.x*=4;n.y*=2}else s=1,u=!1;null===K.map&&(K.map=new THREE.WebGLRenderTarget(n.x,n.y,{minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat}),N.updateProjectionMatrix());
K instanceof THREE.SpotLightShadow&&K.update(A);B=K.map;K=K.matrix;m.setFromMatrixPosition(A.matrixWorld);N.position.copy(m);a.setRenderTarget(B);a.clear();for(B=0;B<s;B++){u?(p.copy(N.position),p.add(x[B]),N.up.copy(v[B]),N.lookAt(p),g.viewport(C[B])):(p.setFromMatrixPosition(A.target.matrixWorld),N.lookAt(p));N.updateMatrixWorld();N.matrixWorldInverse.getInverse(N.matrixWorld);K.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);K.multiply(N.projectionMatrix);K.multiply(N.matrixWorldInverse);k.multiplyMatrices(N.projectionMatrix,
N.matrixWorldInverse);h.setFromMatrix(k);q.length=0;e(b,r,N);for(var D=0,E=q.length;D<E;D++){var G=q[D],T=c.update(G),X=G.material;if(X instanceof THREE.MultiMaterial)for(var W=T.groups,X=X.materials,da=0,ea=W.length;da<ea;da++){var Z=W[da],$=X[Z.materialIndex];!0===$.visible&&($=d(G,$,u,m),a.renderBufferDirect(N,null,T,$,G,Z))}else $=d(G,X,u,m),a.renderBufferDirect(N,null,T,$,G,null)}}}s=a.getClearColor();u=a.getClearAlpha();a.setClearColor(s,u);y.needsUpdate=!1}}};
1,1,1);g.disable(f.BLEND);g.setDepthTest(!0);g.setScissorTest(!1);for(var s,u,w=0,z=l.length;w<z;w++){var A=l[w],K=A.shadow;if(void 0===K)console.warn("THREE.WebGLShadowMap:",A,"has no shadow.");else{var N=K.camera;n.copy(K.mapSize);if(A instanceof THREE.PointLight){s=6;u=!0;var B=n.x,D=n.y;C[0].set(2*B,D,B,D);C[1].set(0,D,B,D);C[2].set(3*B,D,B,D);C[3].set(B,D,B,D);C[4].set(3*B,0,B,D);C[5].set(B,0,B,D);n.x*=4;n.y*=2}else s=1,u=!1;null===K.map&&(K.map=new THREE.WebGLRenderTarget(n.x,n.y,{minFilter:THREE.NearestFilter,
magFilter:THREE.NearestFilter,format:THREE.RGBAFormat}),N.updateProjectionMatrix());K instanceof THREE.SpotLightShadow&&K.update(A);B=K.map;K=K.matrix;m.setFromMatrixPosition(A.matrixWorld);N.position.copy(m);a.setRenderTarget(B);a.clear();for(B=0;B<s;B++){u?(p.copy(N.position),p.add(x[B]),N.up.copy(v[B]),N.lookAt(p),g.viewport(C[B])):(p.setFromMatrixPosition(A.target.matrixWorld),N.lookAt(p));N.updateMatrixWorld();N.matrixWorldInverse.getInverse(N.matrixWorld);K.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,
0,0,0,1);K.multiply(N.projectionMatrix);K.multiply(N.matrixWorldInverse);k.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse);h.setFromMatrix(k);q.length=0;e(b,r,N);for(var D=0,E=q.length;D<E;D++){var G=q[D],T=c.update(G),X=G.material;if(X instanceof THREE.MultiMaterial)for(var W=T.groups,X=X.materials,da=0,ea=W.length;da<ea;da++){var Z=W[da],$=X[Z.materialIndex];!0===$.visible&&($=d(G,$,u,m),a.renderBufferDirect(N,null,T,$,G,Z))}else $=d(G,X,u,m),a.renderBufferDirect(N,null,T,$,G,null)}}}}s=
a.getClearColor();u=a.getClearAlpha();a.setClearColor(s,u);y.needsUpdate=!1}}};
THREE.WebGLState=function(a,b,c){function d(b,c,d){var e=new Uint8Array(3),f=a.createTexture();a.bindTexture(b,f);a.texParameteri(b,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(b,a.TEXTURE_MAG_FILTER,a.NEAREST);for(b=0;b<d;b++)a.texImage2D(c+b,0,a.RGB,1,1,0,a.RGB,a.UNSIGNED_BYTE,e);return f}var e=this,f=new THREE.Vector4,g=a.getParameter(a.MAX_VERTEX_ATTRIBS),h=new Uint8Array(g),k=new Uint8Array(g),l=new Uint8Array(g),n={},p=null,m=null,q=null,r=null,s=null,u=null,x=null,v=null,C=!1,w=null,D=null,
A=null,z=null,B=null,G=null,y=null,H=null,M=null,Q=null,O=null,F=null,I=null,J=null,K=null,N=null,R=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),P=null,E={},ca=new THREE.Vector4,T=null,X=null,W=new THREE.Vector4,da=new THREE.Vector4,ea={};ea[a.TEXTURE_2D]=d(a.TEXTURE_2D,a.TEXTURE_2D,1);ea[a.TEXTURE_CUBE_MAP]=d(a.TEXTURE_CUBE_MAP,a.TEXTURE_CUBE_MAP_POSITIVE_X,6);this.init=function(){this.clearColor(0,0,0,1);this.clearDepth(1);this.clearStencil(0);this.enable(a.DEPTH_TEST);this.setDepthFunc(THREE.LessEqualDepth);
this.setFlipSided(!1);this.setCullFace(THREE.CullFaceBack);this.enable(a.CULL_FACE);this.enable(a.BLEND);this.setBlending(THREE.NormalBlending)};this.initAttributes=function(){for(var a=0,b=h.length;a<b;a++)h[a]=0};this.enableAttribute=function(c){h[c]=1;0===k[c]&&(a.enableVertexAttribArray(c),k[c]=1);0!==l[c]&&(b.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(c,0),l[c]=0)};this.enableAttributeAndDivisor=function(b,c,d){h[b]=1;0===k[b]&&(a.enableVertexAttribArray(b),k[b]=1);l[b]!==c&&(d.vertexAttribDivisorANGLE(b,
c),l[b]=c)};this.disableUnusedAttributes=function(){for(var b=0,c=k.length;b!==c;++b)k[b]!==h[b]&&(a.disableVertexAttribArray(b),k[b]=0)};this.enable=function(b){!0!==n[b]&&(a.enable(b),n[b]=!0)};this.disable=function(b){!1!==n[b]&&(a.disable(b),n[b]=!1)};this.getCompressedTextureFormats=function(){if(null===p&&(p=[],b.get("WEBGL_compressed_texture_pvrtc")||b.get("WEBGL_compressed_texture_s3tc")||b.get("WEBGL_compressed_texture_etc1")))for(var c=a.getParameter(a.COMPRESSED_TEXTURE_FORMATS),d=0;d<
c.length;d++)p.push(c[d]);return p};this.setBlending=function(b,d,e,f,g,h,k,l){if(b!==THREE.NoBlending){this.enable(a.BLEND);if(b!==m||l!==C)b===THREE.AdditiveBlending?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ONE,a.ONE,a.ONE,a.ONE)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):b===THREE.SubtractiveBlending?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.ZERO,a.ONE_MINUS_SRC_COLOR,a.ONE_MINUS_SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),
a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):b===THREE.MultiplyBlending?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.ZERO,a.SRC_COLOR,a.SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)):(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),
a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):b===THREE.MultiplyBlending?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.SRC_COLOR,a.ZERO,a.SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)):(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),
m=b,C=l;if(b===THREE.CustomBlending){g=g||d;h=h||e;k=k||f;if(d!==q||g!==u)a.blendEquationSeparate(c(d),c(g)),q=d,u=g;if(e!==r||f!==s||h!==x||k!==v)a.blendFuncSeparate(c(e),c(f),c(h),c(k)),r=e,s=f,x=h,v=k}else v=x=u=s=r=q=null}else this.disable(a.BLEND),m=b};this.setDepthFunc=function(b){if(w!==b){if(b)switch(b){case THREE.NeverDepth:a.depthFunc(a.NEVER);break;case THREE.AlwaysDepth:a.depthFunc(a.ALWAYS);break;case THREE.LessDepth:a.depthFunc(a.LESS);break;case THREE.LessEqualDepth:a.depthFunc(a.LEQUAL);
break;case THREE.EqualDepth:a.depthFunc(a.EQUAL);break;case THREE.GreaterEqualDepth:a.depthFunc(a.GEQUAL);break;case THREE.GreaterDepth:a.depthFunc(a.GREATER);break;case THREE.NotEqualDepth:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}else a.depthFunc(a.LEQUAL);w=b}};this.setDepthTest=function(b){b?this.enable(a.DEPTH_TEST):this.disable(a.DEPTH_TEST)};this.setDepthWrite=function(b){D!==b&&(a.depthMask(b),D=b)};this.setColorWrite=function(b){A!==b&&(a.colorMask(b,b,b,b),A=b)};this.setStencilFunc=
function(b,c,d){if(B!==b||G!==c||y!==d)a.stencilFunc(b,c,d),B=b,G=c,y=d};this.setStencilOp=function(b,c,d){if(H!==b||M!==c||Q!==d)a.stencilOp(b,c,d),H=b,M=c,Q=d};this.setStencilTest=function(b){b?this.enable(a.STENCIL_TEST):this.disable(a.STENCIL_TEST)};this.setStencilWrite=function(b){z!==b&&(a.stencilMask(b),z=b)};this.setFlipSided=function(b){O!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),O=b)};this.setCullFace=function(b){b!==THREE.CullFaceNone?(this.enable(a.CULL_FACE),b!==F&&(b===THREE.CullFaceBack?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册