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

Updated builds.

上级 bccd460a
......@@ -24467,6 +24467,10 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
var scope = this;
this.enabled = false;
this.autoUpdate = true;
this.needsUpdate = false;
this.type = THREE.PCFShadowMap;
this.cullFace = THREE.CullFaceFront;
this.cascade = false;
......@@ -24474,6 +24478,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
this.render = function ( scene, camera ) {
if ( scope.enabled === false ) return;
if ( scope.autoUpdate === false && scope.needsUpdate === false ) return;
var i, il, j, jl, n,
......@@ -24750,6 +24755,8 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
_renderer.resetGLState();
scope.needsUpdate = false;
};
function projectObject( object, shadowCamera ) {
......
......@@ -607,16 +607,16 @@ return this.getUniforms()}},attributes:{get:function(){console.warn("THREE.WebGL
THREE.WebGLShader=function(){var a=function(a){a=a.split("\n");for(var c=0;c<a.length;c++)a[c]=c+1+": "+a[c];return a.join("\n")};return function(b,c,d){var e=b.createShader(c);b.shaderSource(e,d);b.compileShader(e);!1===b.getShaderParameter(e,b.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile.");""!==b.getShaderInfoLog(e)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",c===b.VERTEX_SHADER?"vertex":"fragment",b.getShaderInfoLog(e),a(d));return e}}();
THREE.WebGLShadowMap=function(a,b,c){function d(a,b){if(!0===a.visible){var e=c.objects[a.id];e&&a.castShadow&&(!1===a.frustumCulled||!0===f.intersectsObject(a))&&(a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld),n.push(e));for(var e=0,g=a.children.length;e<g;e++)d(a.children[e],b)}}var e=a.context,g=a.state,f=new THREE.Frustum,h=new THREE.Matrix4,k=new THREE.Vector3,l=new THREE.Vector3,m=c.objectsImmediate,r=new THREE.Vector3,n=[],q=THREE.ShaderLib.depthRGBA,t=THREE.UniformsUtils.clone(q.uniforms),
p=new THREE.ShaderMaterial({uniforms:t,vertexShader:q.vertexShader,fragmentShader:q.fragmentShader}),u=new THREE.ShaderMaterial({uniforms:t,vertexShader:q.vertexShader,fragmentShader:q.fragmentShader,morphTargets:!0}),w=new THREE.ShaderMaterial({uniforms:t,vertexShader:q.vertexShader,fragmentShader:q.fragmentShader,skinning:!0}),x=new THREE.ShaderMaterial({uniforms:t,vertexShader:q.vertexShader,fragmentShader:q.fragmentShader,morphTargets:!0,skinning:!0});p._shadowPass=!0;u._shadowPass=!0;w._shadowPass=
!0;x._shadowPass=!0;var z=this;this.enabled=!1;this.type=THREE.PCFShadowMap;this.cullFace=THREE.CullFaceFront;this.cascade=!1;this.render=function(c,q){if(!1!==z.enabled){var t,A,y,G,F,C,L,O=[];G=0;e.clearColor(1,1,1,1);g.disable(e.BLEND);g.enable(e.CULL_FACE);e.frontFace(e.CCW);z.cullFace===THREE.CullFaceFront?e.cullFace(e.FRONT):e.cullFace(e.BACK);g.setDepthTest(!0);t=0;for(A=b.length;t<A;t++)if(y=b[t],y.castShadow)if(y instanceof THREE.DirectionalLight&&y.shadowCascade)for(F=0;F<y.shadowCascadeCount;F++){var E;
if(y.shadowCascadeArray[F])E=y.shadowCascadeArray[F];else{var D=y;L=F;E=new THREE.DirectionalLight;E.isVirtual=!0;E.onlyShadow=!0;E.castShadow=!0;E.shadowCameraNear=D.shadowCameraNear;E.shadowCameraFar=D.shadowCameraFar;E.shadowCameraLeft=D.shadowCameraLeft;E.shadowCameraRight=D.shadowCameraRight;E.shadowCameraBottom=D.shadowCameraBottom;E.shadowCameraTop=D.shadowCameraTop;E.shadowCameraVisible=D.shadowCameraVisible;E.shadowDarkness=D.shadowDarkness;E.shadowBias=D.shadowCascadeBias[L];E.shadowMapWidth=
D.shadowCascadeWidth[L];E.shadowMapHeight=D.shadowCascadeHeight[L];E.pointsWorld=[];E.pointsFrustum=[];var B=E.pointsWorld;C=E.pointsFrustum;for(var N=0;8>N;N++)B[N]=new THREE.Vector3,C[N]=new THREE.Vector3;B=D.shadowCascadeNearZ[L];D=D.shadowCascadeFarZ[L];C[0].set(-1,-1,B);C[1].set(1,-1,B);C[2].set(-1,1,B);C[3].set(1,1,B);C[4].set(-1,-1,D);C[5].set(1,-1,D);C[6].set(-1,1,D);C[7].set(1,1,D);E.originalCamera=q;C=new THREE.Gyroscope;C.position.copy(y.shadowCascadeOffset);C.add(E);C.add(E.target);q.add(C);
y.shadowCascadeArray[F]=E}L=y;B=F;D=L.shadowCascadeArray[B];D.position.copy(L.position);D.target.position.copy(L.target.position);D.lookAt(D.target);D.shadowCameraVisible=L.shadowCameraVisible;D.shadowDarkness=L.shadowDarkness;D.shadowBias=L.shadowCascadeBias[B];C=L.shadowCascadeNearZ[B];L=L.shadowCascadeFarZ[B];D=D.pointsFrustum;D[0].z=C;D[1].z=C;D[2].z=C;D[3].z=C;D[4].z=L;D[5].z=L;D[6].z=L;D[7].z=L;O[G]=E;G++}else O[G]=y,G++;t=0;for(A=O.length;t<A;t++){y=O[t];y.shadowMap||(F=THREE.LinearFilter,
z.type===THREE.PCFSoftShadowMap&&(F=THREE.NearestFilter),y.shadowMap=new THREE.WebGLRenderTarget(y.shadowMapWidth,y.shadowMapHeight,{minFilter:F,magFilter:F,format:THREE.RGBAFormat}),y.shadowMapSize=new THREE.Vector2(y.shadowMapWidth,y.shadowMapHeight),y.shadowMatrix=new THREE.Matrix4);if(!y.shadowCamera){if(y instanceof THREE.SpotLight)y.shadowCamera=new THREE.PerspectiveCamera(y.shadowCameraFov,y.shadowMapWidth/y.shadowMapHeight,y.shadowCameraNear,y.shadowCameraFar);else if(y instanceof THREE.DirectionalLight)y.shadowCamera=
new THREE.OrthographicCamera(y.shadowCameraLeft,y.shadowCameraRight,y.shadowCameraTop,y.shadowCameraBottom,y.shadowCameraNear,y.shadowCameraFar);else{console.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",y);continue}c.add(y.shadowCamera);!0===c.autoUpdate&&c.updateMatrixWorld()}y.shadowCameraVisible&&!y.cameraHelper&&(y.cameraHelper=new THREE.CameraHelper(y.shadowCamera),c.add(y.cameraHelper));if(y.isVirtual&&E.originalCamera==q){F=q;G=y.shadowCamera;C=y.pointsFrustum;D=y.pointsWorld;
k.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(L=0;8>L;L++)B=D[L],B.copy(C[L]),B.unproject(F),B.applyMatrix4(G.matrixWorldInverse),B.x<k.x&&(k.x=B.x),B.x>l.x&&(l.x=B.x),B.y<k.y&&(k.y=B.y),B.y>l.y&&(l.y=B.y),B.z<k.z&&(k.z=B.z),B.z>l.z&&(l.z=B.z);G.left=k.x;G.right=l.x;G.top=l.y;G.bottom=k.y;G.updateProjectionMatrix()}G=y.shadowMap;C=y.shadowMatrix;F=y.shadowCamera;F.position.setFromMatrixPosition(y.matrixWorld);r.setFromMatrixPosition(y.target.matrixWorld);F.lookAt(r);F.updateMatrixWorld();
F.matrixWorldInverse.getInverse(F.matrixWorld);y.cameraHelper&&(y.cameraHelper.visible=y.shadowCameraVisible);y.shadowCameraVisible&&y.cameraHelper.update();C.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);C.multiply(F.projectionMatrix);C.multiply(F.matrixWorldInverse);h.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse);f.setFromMatrix(h);a.setRenderTarget(G);a.clear();n.length=0;d(c,F);y=0;for(G=n.length;y<G;y++)C=n[y],C=C.object,D=C.material instanceof THREE.MeshFaceMaterial?C.material.materials[0]:
C.material,L=void 0!==C.geometry.morphTargets&&0<C.geometry.morphTargets.length&&D.morphTargets,B=C instanceof THREE.SkinnedMesh&&D.skinning,L=C.customDepthMaterial?C.customDepthMaterial:B?L?x:w:L?u:p,a.setMaterialFaces(D),a.renderBufferDirect(F,b,null,L,C);y=0;for(G=m.length;y<G;y++)C=m[y],C=C.object,C.visible&&C.castShadow&&(C._modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,C.matrixWorld),a.renderImmediateObject(F,b,null,p,C))}t=a.getClearColor();A=a.getClearAlpha();e.clearColor(t.r,t.g,
t.b,A);g.enable(e.BLEND);z.cullFace===THREE.CullFaceFront&&e.cullFace(e.BACK);a.resetGLState()}}};
!0;x._shadowPass=!0;var z=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=THREE.PCFShadowMap;this.cullFace=THREE.CullFaceFront;this.cascade=!1;this.render=function(c,q){if(!1!==z.enabled&&(!1!==z.autoUpdate||!1!==z.needsUpdate)){var t,A,y,G,F,C,L,O=[];G=0;e.clearColor(1,1,1,1);g.disable(e.BLEND);g.enable(e.CULL_FACE);e.frontFace(e.CCW);z.cullFace===THREE.CullFaceFront?e.cullFace(e.FRONT):e.cullFace(e.BACK);g.setDepthTest(!0);t=0;for(A=b.length;t<A;t++)if(y=b[t],y.castShadow)if(y instanceof
THREE.DirectionalLight&&y.shadowCascade)for(F=0;F<y.shadowCascadeCount;F++){var E;if(y.shadowCascadeArray[F])E=y.shadowCascadeArray[F];else{var D=y;L=F;E=new THREE.DirectionalLight;E.isVirtual=!0;E.onlyShadow=!0;E.castShadow=!0;E.shadowCameraNear=D.shadowCameraNear;E.shadowCameraFar=D.shadowCameraFar;E.shadowCameraLeft=D.shadowCameraLeft;E.shadowCameraRight=D.shadowCameraRight;E.shadowCameraBottom=D.shadowCameraBottom;E.shadowCameraTop=D.shadowCameraTop;E.shadowCameraVisible=D.shadowCameraVisible;
E.shadowDarkness=D.shadowDarkness;E.shadowBias=D.shadowCascadeBias[L];E.shadowMapWidth=D.shadowCascadeWidth[L];E.shadowMapHeight=D.shadowCascadeHeight[L];E.pointsWorld=[];E.pointsFrustum=[];var B=E.pointsWorld;C=E.pointsFrustum;for(var N=0;8>N;N++)B[N]=new THREE.Vector3,C[N]=new THREE.Vector3;B=D.shadowCascadeNearZ[L];D=D.shadowCascadeFarZ[L];C[0].set(-1,-1,B);C[1].set(1,-1,B);C[2].set(-1,1,B);C[3].set(1,1,B);C[4].set(-1,-1,D);C[5].set(1,-1,D);C[6].set(-1,1,D);C[7].set(1,1,D);E.originalCamera=q;C=
new THREE.Gyroscope;C.position.copy(y.shadowCascadeOffset);C.add(E);C.add(E.target);q.add(C);y.shadowCascadeArray[F]=E}L=y;B=F;D=L.shadowCascadeArray[B];D.position.copy(L.position);D.target.position.copy(L.target.position);D.lookAt(D.target);D.shadowCameraVisible=L.shadowCameraVisible;D.shadowDarkness=L.shadowDarkness;D.shadowBias=L.shadowCascadeBias[B];C=L.shadowCascadeNearZ[B];L=L.shadowCascadeFarZ[B];D=D.pointsFrustum;D[0].z=C;D[1].z=C;D[2].z=C;D[3].z=C;D[4].z=L;D[5].z=L;D[6].z=L;D[7].z=L;O[G]=
E;G++}else O[G]=y,G++;t=0;for(A=O.length;t<A;t++){y=O[t];y.shadowMap||(F=THREE.LinearFilter,z.type===THREE.PCFSoftShadowMap&&(F=THREE.NearestFilter),y.shadowMap=new THREE.WebGLRenderTarget(y.shadowMapWidth,y.shadowMapHeight,{minFilter:F,magFilter:F,format:THREE.RGBAFormat}),y.shadowMapSize=new THREE.Vector2(y.shadowMapWidth,y.shadowMapHeight),y.shadowMatrix=new THREE.Matrix4);if(!y.shadowCamera){if(y instanceof THREE.SpotLight)y.shadowCamera=new THREE.PerspectiveCamera(y.shadowCameraFov,y.shadowMapWidth/
y.shadowMapHeight,y.shadowCameraNear,y.shadowCameraFar);else if(y instanceof THREE.DirectionalLight)y.shadowCamera=new THREE.OrthographicCamera(y.shadowCameraLeft,y.shadowCameraRight,y.shadowCameraTop,y.shadowCameraBottom,y.shadowCameraNear,y.shadowCameraFar);else{console.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",y);continue}c.add(y.shadowCamera);!0===c.autoUpdate&&c.updateMatrixWorld()}y.shadowCameraVisible&&!y.cameraHelper&&(y.cameraHelper=new THREE.CameraHelper(y.shadowCamera),
c.add(y.cameraHelper));if(y.isVirtual&&E.originalCamera==q){F=q;G=y.shadowCamera;C=y.pointsFrustum;D=y.pointsWorld;k.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(L=0;8>L;L++)B=D[L],B.copy(C[L]),B.unproject(F),B.applyMatrix4(G.matrixWorldInverse),B.x<k.x&&(k.x=B.x),B.x>l.x&&(l.x=B.x),B.y<k.y&&(k.y=B.y),B.y>l.y&&(l.y=B.y),B.z<k.z&&(k.z=B.z),B.z>l.z&&(l.z=B.z);G.left=k.x;G.right=l.x;G.top=l.y;G.bottom=k.y;G.updateProjectionMatrix()}G=y.shadowMap;C=y.shadowMatrix;F=y.shadowCamera;
F.position.setFromMatrixPosition(y.matrixWorld);r.setFromMatrixPosition(y.target.matrixWorld);F.lookAt(r);F.updateMatrixWorld();F.matrixWorldInverse.getInverse(F.matrixWorld);y.cameraHelper&&(y.cameraHelper.visible=y.shadowCameraVisible);y.shadowCameraVisible&&y.cameraHelper.update();C.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);C.multiply(F.projectionMatrix);C.multiply(F.matrixWorldInverse);h.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse);f.setFromMatrix(h);a.setRenderTarget(G);a.clear();
n.length=0;d(c,F);y=0;for(G=n.length;y<G;y++)C=n[y],C=C.object,D=C.material instanceof THREE.MeshFaceMaterial?C.material.materials[0]:C.material,L=void 0!==C.geometry.morphTargets&&0<C.geometry.morphTargets.length&&D.morphTargets,B=C instanceof THREE.SkinnedMesh&&D.skinning,L=C.customDepthMaterial?C.customDepthMaterial:B?L?x:w:L?u:p,a.setMaterialFaces(D),a.renderBufferDirect(F,b,null,L,C);y=0;for(G=m.length;y<G;y++)C=m[y],C=C.object,C.visible&&C.castShadow&&(C._modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,
C.matrixWorld),a.renderImmediateObject(F,b,null,p,C))}t=a.getClearColor();A=a.getClearAlpha();e.clearColor(t.r,t.g,t.b,A);g.enable(e.BLEND);z.cullFace===THREE.CullFaceFront&&e.cullFace(e.BACK);a.resetGLState();z.needsUpdate=!1}}};
THREE.WebGLState=function(a,b){var c=this,d=new Uint8Array(16),e=new Uint8Array(16),g={},f=null,h=null,k=null,l=null,m=null,r=null,n=null,q=null,t=null,p=null,u=null,w=null,x=null,z=null,v=null,H=null,K=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),A=void 0,y={};this.init=function(){a.clearColor(0,0,0,1);a.clearDepth(1);a.clearStencil(0);a.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.frontFace(a.CCW);a.cullFace(a.BACK);this.enable(a.CULL_FACE);this.enable(a.BLEND);a.blendEquation(a.FUNC_ADD);a.blendFunc(a.SRC_ALPHA,
a.ONE_MINUS_SRC_ALPHA)};this.initAttributes=function(){for(var a=0,b=d.length;a<b;a++)d[a]=0};this.enableAttribute=function(b){d[b]=1;0===e[b]&&(a.enableVertexAttribArray(b),e[b]=1)};this.disableUnusedAttributes=function(){for(var b=0,c=e.length;b<c;b++)e[b]!==d[b]&&(a.disableVertexAttribArray(b),e[b]=0)};this.enable=function(b){!0!==g[b]&&(a.enable(b),g[b]=!0)};this.disable=function(b){!1!==g[b]&&(a.disable(b),g[b]=!1)};this.setBlending=function(c,d,e,g,q,p,t){c!==f&&(c===THREE.NoBlending?this.disable(a.BLEND):
c===THREE.AdditiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):c===THREE.SubtractiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):c===THREE.MultiplyBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):c===THREE.CustomBlending?this.enable(a.BLEND):(this.enable(a.BLEND),a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册