Przeglądaj źródła

Updated builds.

Mr.doob 9 lat temu
rodzic
commit
865f248f4f
2 zmienionych plików z 10 dodań i 10 usunięć
  1. 8 8
      build/three.js
  2. 2 2
      build/three.min.js

+ 8 - 8
build/three.js

@@ -21896,11 +21896,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.getViewport = function ( dimensions ) {
 
-		dimensions.x = _viewportX;
-		dimensions.y = _viewportY;
+		dimensions.x = _viewportX / pixelRatio;
+		dimensions.y = _viewportY / pixelRatio;
 
-		dimensions.z = _viewportWidth;
-		dimensions.w = _viewportHeight;
+		dimensions.z = _viewportWidth / pixelRatio;
+		dimensions.w = _viewportHeight / pixelRatio;
 
 	};
 
@@ -23503,7 +23503,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 						uniforms.shadowDarkness.value[ j ] = - light.shadowDarkness;
 
 					} else {
-						
+
 						uniforms.shadowDarkness.value[ j ] = light.shadowDarkness;
 
 					}
@@ -26732,15 +26732,15 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 		_state.setDepthTest( true );
 
+		// save the existing viewport so it can be restored later
+		_renderer.getViewport( _vector4 );
+
 		// render depth map
 
 		for ( var i = 0, il = _lights.length; i < il; i ++ ) {
 
 			var light = _lights[ i ];
 
-			// save the existing viewport so it can be restored later
-			_renderer.getViewport( _vector4 );
-
 			if ( light instanceof THREE.PointLight ) {
 
 				faceCount = 6;

+ 2 - 2
build/three.min.js

@@ -587,7 +587,7 @@ vertices:0,faces:0,points:0};this.info={render:ka,memory:la,programs:null};var r
 S.get("OES_texture_float");S.get("OES_texture_float_linear");S.get("OES_texture_half_float");S.get("OES_texture_half_float_linear");S.get("OES_standard_derivatives");S.get("ANGLE_instanced_arrays");S.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);var ga=new THREE.WebGLCapabilities(r,S,a),J=new THREE.WebGLState(r,S,A),X=new THREE.WebGLProperties,va=new THREE.WebGLObjects(r,X,this.info),ua=new THREE.WebGLPrograms(this,ga);this.info.programs=ua.programs;var Fa=new THREE.WebGLBufferRenderer(r,
 S,ka),Ga=new THREE.WebGLIndexedBufferRenderer(r,S,ka);c();this.context=r;this.capabilities=ga;this.extensions=S;this.state=J;var ha=new THREE.WebGLShadowMap(this,Y,va);this.shadowMap=ha;var Ha=new THREE.SpritePlugin(this,ja),Ia=new THREE.LensFlarePlugin(this,ba);this.getContext=function(){return r};this.getContextAttributes=function(){return r.getContextAttributes()};this.forceContextLoss=function(){S.get("WEBGL_lose_context").loseContext()};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==
 a)return a;var b=S.get("EXT_texture_filter_anisotropic");return a=null!==b?r.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return ga.precision};this.getPixelRatio=function(){return y};this.setPixelRatio=function(a){void 0!==a&&(y=a)};this.getSize=function(){return{width:N,height:H}};this.setSize=function(a,b,c){N=a;H=b;I.width=a*y;I.height=b*y;!1!==c&&(I.style.width=a+"px",I.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){na=a*
-y;oa=b*y;pa=c*y;qa=d*y;r.viewport(na,oa,pa,qa)};this.getViewport=function(a){a.x=na;a.y=oa;a.z=pa;a.w=qa};this.setScissor=function(a,b,c,d){r.scissor(a*y,b*y,c*y,d*y)};this.enableScissorTest=function(a){J.setScissorTest(a)};this.getClearColor=function(){return V};this.setClearColor=function(a,c){V.set(a);U=void 0!==c?c:1;b(V.r,V.g,V.b,U)};this.getClearAlpha=function(){return U};this.setClearAlpha=function(a){U=a;b(V.r,V.g,V.b,U)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=r.COLOR_BUFFER_BIT;
+y;oa=b*y;pa=c*y;qa=d*y;r.viewport(na,oa,pa,qa)};this.getViewport=function(a){a.x=na/y;a.y=oa/y;a.z=pa/y;a.w=qa/y};this.setScissor=function(a,b,c,d){r.scissor(a*y,b*y,c*y,d*y)};this.enableScissorTest=function(a){J.setScissorTest(a)};this.getClearColor=function(){return V};this.setClearColor=function(a,c){V.set(a);U=void 0!==c?c:1;b(V.r,V.g,V.b,U)};this.getClearAlpha=function(){return U};this.setClearAlpha=function(a){U=a;b(V.r,V.g,V.b,U)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=r.COLOR_BUFFER_BIT;
 if(void 0===b||b)d|=r.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=r.STENCIL_BUFFER_BIT;r.clear(d)};this.clearColor=function(){r.clear(r.COLOR_BUFFER_BIT)};this.clearDepth=function(){r.clear(r.DEPTH_BUFFER_BIT)};this.clearStencil=function(){r.clear(r.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=d;this.dispose=function(){I.removeEventListener("webglcontextlost",e,!1)};this.renderBufferImmediate=function(a,b,c){J.initAttributes();var d=
 X.get(a);a.hasPositions&&!d.position&&(d.position=r.createBuffer());a.hasNormals&&!d.normal&&(d.normal=r.createBuffer());a.hasUvs&&!d.uv&&(d.uv=r.createBuffer());a.hasColors&&!d.color&&(d.color=r.createBuffer());b=b.getAttributes();a.hasPositions&&(r.bindBuffer(r.ARRAY_BUFFER,d.position),r.bufferData(r.ARRAY_BUFFER,a.positionArray,r.DYNAMIC_DRAW),J.enableAttribute(b.position),r.vertexAttribPointer(b.position,3,r.FLOAT,!1,0,0));if(a.hasNormals){r.bindBuffer(r.ARRAY_BUFFER,d.normal);if("MeshPhongMaterial"!==
 c.type&&c.shading===THREE.FlatShading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,k=(g[e+1]+g[e+4]+g[e+7])/3,l=(g[e+2]+g[e+5]+g[e+8])/3;g[e+0]=h;g[e+1]=k;g[e+2]=l;g[e+3]=h;g[e+4]=k;g[e+5]=l;g[e+6]=h;g[e+7]=k;g[e+8]=l}r.bufferData(r.ARRAY_BUFFER,a.normalArray,r.DYNAMIC_DRAW);J.enableAttribute(b.normal);r.vertexAttribPointer(b.normal,3,r.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(r.bindBuffer(r.ARRAY_BUFFER,d.uv),r.bufferData(r.ARRAY_BUFFER,a.uvArray,r.DYNAMIC_DRAW),J.enableAttribute(b.uv),
@@ -662,7 +662,7 @@ THREE.WebGLShadowMap=function(a,b,c){function d(a,b,c,d){var e=a.geometry,f=null
 THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Points)&&a.castShadow&&(!1===a.frustumCulled||!0===h.intersectsObject(a))&&!0===a.material.visible&&(a.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld),p.push(a));for(var c=a.children,d=0,f=c.length;d<f;d++)e(c[d],b)}}var g=a.context,f=a.state,h=new THREE.Frustum,l=new THREE.Matrix4;new THREE.Vector3;new THREE.Vector3;for(var k=new THREE.Vector3,n=new THREE.Vector3,p=[],m=Array(4),q=Array(4),s=[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)],t=[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)],v=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],x=new THREE.Vector4,u=THREE.ShaderLib.depthRGBA,B=THREE.UniformsUtils.clone(u.uniforms),w=THREE.ShaderLib.distanceRGBA,C=THREE.UniformsUtils.clone(w.uniforms),
 E=0;4!==E;++E){var z=0!==(E&1),D=0!==(E&2),G=new THREE.ShaderMaterial({uniforms:B,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:z,skinning:D});G._shadowPass=!0;m[E]=G;z=new THREE.ShaderMaterial({uniforms:C,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:z,skinning:D});z._shadowPass=!0;q[E]=z}var K=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=THREE.PCFShadowMap;this.cullFace=THREE.CullFaceFront;this.render=function(m){var q,
-u;if(!1!==K.enabled&&(!1!==K.autoUpdate||!1!==K.needsUpdate)){g.clearColor(1,1,1,1);f.disable(g.BLEND);f.enable(g.CULL_FACE);g.frontFace(g.CCW);K.cullFace===THREE.CullFaceFront?g.cullFace(g.FRONT):g.cullFace(g.BACK);f.setDepthTest(!0);for(var w=0,B=b.length;w<B;w++){var y=b[w];a.getViewport(x);if(y instanceof THREE.PointLight){q=6;u=!0;var z=y.shadowMapWidth/4,C=y.shadowMapHeight/2;v[0].set(2*z,C,z,C);v[1].set(0,C,z,C);v[2].set(3*z,C,z,C);v[3].set(z,C,z,C);v[4].set(3*z,0,z,C);v[5].set(z,0,z,C)}else q=
+u;if(!1!==K.enabled&&(!1!==K.autoUpdate||!1!==K.needsUpdate)){g.clearColor(1,1,1,1);f.disable(g.BLEND);f.enable(g.CULL_FACE);g.frontFace(g.CCW);K.cullFace===THREE.CullFaceFront?g.cullFace(g.FRONT):g.cullFace(g.BACK);f.setDepthTest(!0);a.getViewport(x);for(var w=0,B=b.length;w<B;w++){var y=b[w];if(y instanceof THREE.PointLight){q=6;u=!0;var z=y.shadowMapWidth/4,C=y.shadowMapHeight/2;v[0].set(2*z,C,z,C);v[1].set(0,C,z,C);v[2].set(3*z,C,z,C);v[3].set(z,C,z,C);v[4].set(3*z,0,z,C);v[5].set(z,0,z,C)}else q=
 1,u=!1;if(y.castShadow){y.shadowMap||(z=THREE.LinearFilter,K.type===THREE.PCFSoftShadowMap&&(z=THREE.NearestFilter),y.shadowMap=new THREE.WebGLRenderTarget(y.shadowMapWidth,y.shadowMapHeight,{minFilter:z,magFilter:z,format:THREE.RGBAFormat}),y.shadowMapSize=new THREE.Vector2(y.shadowMapWidth,y.shadowMapHeight),y.shadowMatrix=new THREE.Matrix4);y.shadowCamera||(y.shadowCamera=y instanceof THREE.SpotLight?new THREE.PerspectiveCamera(y.shadowCameraFov,y.shadowMapWidth/y.shadowMapHeight,y.shadowCameraNear,
 y.shadowCameraFar):y instanceof THREE.DirectionalLight?new THREE.OrthographicCamera(y.shadowCameraLeft,y.shadowCameraRight,y.shadowCameraTop,y.shadowCameraBottom,y.shadowCameraNear,y.shadowCameraFar):new THREE.PerspectiveCamera(y.shadowCameraFov,1,y.shadowCameraNear,y.shadowCameraFar),m.add(y.shadowCamera),!0===m.autoUpdate&&m.updateMatrixWorld());y.shadowCameraVisible&&!y.cameraHelper&&(y.cameraHelper=new THREE.CameraHelper(y.shadowCamera),m.add(y.cameraHelper));var D=y.shadowMap,z=y.shadowMatrix,
 C=y.shadowCamera;n.setFromMatrixPosition(y.matrixWorld);C.position.copy(n);a.setRenderTarget(D);a.clear();for(D=0;D<q;D++){if(u){k.copy(C.position);k.add(s[D]);C.up.copy(t[D]);C.lookAt(k);var E=v[D];a.setViewport(E.x,E.y,E.z,E.w)}else k.setFromMatrixPosition(y.target.matrixWorld),C.lookAt(k);C.updateMatrixWorld();C.matrixWorldInverse.getInverse(C.matrixWorld);y.cameraHelper&&(y.cameraHelper.visible=y.shadowCameraVisible);y.shadowCameraVisible&&y.cameraHelper.update();z.set(.5,0,0,.5,0,.5,0,.5,0,0,