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

Updated builds.

上级 fe152bc4
......@@ -15744,8 +15744,8 @@ THREE.CanvasRenderer = function ( parameters ) {
var scaleX = element.scale.x * _canvasWidthHalf;
var scaleY = element.scale.y * _canvasHeightHalf;
_elemBox.min.set( v1.x - scaleX, v1.y - scaleY );
_elemBox.max.set( v1.x + scaleX, v1.y + scaleY );
_elemBox.min.set( v1.x - ( scaleX * 0.5 ), v1.y - ( scaleY * 0.5 ) );
_elemBox.max.set( v1.x + ( scaleX * 0.5 ), v1.y + ( scaleY * 0.5 ) );
if ( _clipBox.isIntersectionBox( _elemBox ) === false ) {
......
......@@ -307,17 +307,17 @@ void 0!==F.mozDash?function(a){F.mozDash=null!==a[0]?a:null}:function(){});this.
G.width=y;G.height=D;1!==this.devicePixelRatio&&!1!==c&&(G.style.width=a+"px",G.style.height=b+"px");va.set(new THREE.Vector2(-x,-J),new THREE.Vector2(x,J));la.set(new THREE.Vector2(-x,-J),new THREE.Vector2(x,J));z=1;I=0;na=ia=S=N=A=null};this.setClearColor=function(a,b){B.set(a);M=void 0!==b?b:1;la.set(new THREE.Vector2(-x,-J),new THREE.Vector2(x,J))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,
b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){F.setTransform(1,0,0,-1,x,J);!1===la.empty()&&(la.intersect(va),la.expandByScalar(2),1>M&&F.clearRect(la.min.x|0,la.min.y|0,la.max.x-la.min.x|0,la.max.y-la.min.y|0),0<M&&(k(THREE.NormalBlending),i(1),r("rgba("+Math.floor(255*B.r)+","+Math.floor(255*B.g)+","+Math.floor(255*B.b)+","+M+")"),F.fillRect(la.min.x|0,la.min.y|0,la.max.x-la.min.x|0,la.max.y-la.min.y|0)),la.makeEmpty())};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
else{!0===this.autoClear&&this.clear();F.setTransform(1,0,0,-1,x,J);t.info.render.vertices=0;t.info.render.faces=0;u=E.projectScene(a,j,this.sortObjects,this.sortElements);v=u.elements;w=u.lights;Q=j;gb.setRGB(0,0,0);ra.setRGB(0,0,0);ea.setRGB(0,0,0);for(var y=0,G=w.length;y<G;y++){var B=w[y],D=B.color;B instanceof THREE.AmbientLight?gb.add(D):B instanceof THREE.DirectionalLight?ra.add(D):B instanceof THREE.PointLight&&ea.add(D)}y=0;for(G=v.length;y<G;y++){var A=v[y],z=A.material;if(!(void 0===z||
!1===z.visible)){Ea.makeEmpty();if(A instanceof THREE.RenderableSprite){R=A;R.x*=x;R.y*=J;var B=R,D=A,I=z;i(I.opacity);k(I.blending);A=D.scale.x*x;z=D.scale.y*J;Ea.min.set(B.x-A,B.y-z);Ea.max.set(B.x+A,B.y+z);!1===va.isIntersectionBox(Ea)?Ea.makeEmpty():I instanceof THREE.SpriteMaterial||I instanceof THREE.ParticleSystemMaterial?(void 0!==I.map.image?(D=I.map.image,F.save(),F.translate(B.x,B.y),F.rotate(-I.rotation),F.scale(A,-z),F.drawImage(D,0,0,D.width,D.height,-0.5,-0.5,1,1)):(r(I.color.getStyle()),
F.save(),F.translate(B.x,B.y),F.rotate(-D.rotation),F.scale(A,z),F.fillRect(-0.5,-0.5,1,1)),F.restore()):I instanceof THREE.SpriteCanvasMaterial&&(s(I.color.getStyle()),r(I.color.getStyle()),F.save(),F.translate(B.x,B.y),F.rotate(-D.rotation),F.scale(A,z),I.program(F),F.restore())}else if(A instanceof THREE.RenderableLine){if(R=A.v1,K=A.v2,R.positionScreen.x*=x,R.positionScreen.y*=J,K.positionScreen.x*=x,K.positionScreen.y*=J,Ea.setFromPoints([R.positionScreen,K.positionScreen]),!0===va.isIntersectionBox(Ea))if(B=
R,D=K,I=A,A=z,i(A.opacity),k(A.blending),F.beginPath(),F.moveTo(B.positionScreen.x,B.positionScreen.y),F.lineTo(D.positionScreen.x,D.positionScreen.y),A instanceof THREE.LineBasicMaterial){m(A.linewidth);l(A.linecap);n(A.linejoin);if(A.vertexColors!==THREE.VertexColors)s(A.color.getStyle());else if(z=I.vertexColors[0].getStyle(),I=I.vertexColors[1].getStyle(),z===I)s(z);else{try{var M=F.createLinearGradient(B.positionScreen.x,B.positionScreen.y,D.positionScreen.x,D.positionScreen.y);M.addColorStop(0,
z);M.addColorStop(1,I)}catch(C){M=z}s(M)}F.stroke();Ea.expandByScalar(2*A.linewidth)}else A instanceof THREE.LineDashedMaterial&&(m(A.linewidth),l(A.linecap),n(A.linejoin),s(A.color.getStyle()),q(A.dashSize,A.gapSize),F.stroke(),Ea.expandByScalar(2*A.linewidth),q(null,null))}else if(A instanceof THREE.RenderableFace3){R=A.v1;K=A.v2;ca=A.v3;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>ca.positionScreen.z||1<ca.positionScreen.z)continue;
R.positionScreen.x*=x;R.positionScreen.y*=J;K.positionScreen.x*=x;K.positionScreen.y*=J;ca.positionScreen.x*=x;ca.positionScreen.y*=J;0<z.overdraw&&(g(R.positionScreen,K.positionScreen,z.overdraw),g(K.positionScreen,ca.positionScreen,z.overdraw),g(ca.positionScreen,R.positionScreen,z.overdraw));Ea.setFromPoints([R.positionScreen,K.positionScreen,ca.positionScreen]);if(!0===va.isIntersectionBox(Ea)){B=R;D=K;I=ca;t.info.render.vertices+=3;t.info.render.faces++;i(z.opacity);k(z.blending);wa=B.positionScreen.x;
Ba=B.positionScreen.y;P=D.positionScreen.x;Aa=D.positionScreen.y;Z=I.positionScreen.x;da=I.positionScreen.y;var S=wa,N=Ba,ia=P,ka=Aa,na=Z,pa=da;F.beginPath();F.moveTo(S,N);F.lineTo(ia,ka);F.lineTo(na,pa);F.closePath();(z instanceof THREE.MeshLambertMaterial||z instanceof THREE.MeshPhongMaterial)&&null===z.map?(sa.copy(z.color),ga.copy(z.emissive),z.vertexColors===THREE.FaceColors&&sa.multiply(A.color),!1===z.wireframe&&z.shading==THREE.SmoothShading&&3==A.vertexNormalsLength?(ba.copy(gb),$.copy(gb),
V.copy(gb),b(A.v1.positionWorld,A.vertexNormalsModel[0],ba),b(A.v2.positionWorld,A.vertexNormalsModel[1],$),b(A.v3.positionWorld,A.vertexNormalsModel[2],V),ba.multiply(sa).add(ga),$.multiply(sa).add(ga),V.multiply(sa).add(ga),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)):(O.copy(gb),b(A.centroidModel,A.normalModel,O),O.multiply(sa).add(ga),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O))):z instanceof THREE.MeshBasicMaterial||
z instanceof THREE.MeshLambertMaterial||z instanceof THREE.MeshPhongMaterial?null!==z.map?z.map.mapping instanceof THREE.UVMapping&&(xa=A.uvs[0],e(wa,Ba,P,Aa,Z,da,xa[0].x,xa[0].y,xa[1].x,xa[1].y,xa[2].x,xa[2].y,z.map)):null!==z.envMap?z.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ta.copy(A.vertexNormalsModelView[0]),bb=0.5*ta.x+0.5,cb=0.5*ta.y+0.5,ta.copy(A.vertexNormalsModelView[1]),Ma=0.5*ta.x+0.5,fb=0.5*ta.y+0.5,ta.copy(A.vertexNormalsModelView[2]),sb=0.5*ta.x+0.5,pb=0.5*ta.y+
0.5,e(wa,Ba,P,Aa,Z,da,bb,cb,Ma,fb,sb,pb,z.envMap)):(O.copy(z.color),z.vertexColors===THREE.FaceColors&&O.multiply(A.color),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O)):z instanceof THREE.MeshDepthMaterial?(Da=Q.near,Ua=Q.far,ba.r=ba.g=ba.b=1-p(B.positionScreen.z*B.positionScreen.w,Da,Ua),$.r=$.g=$.b=1-p(D.positionScreen.z*D.positionScreen.w,Da,Ua),V.r=V.g=V.b=1-p(I.positionScreen.z*I.positionScreen.w,Da,Ua),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,
V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)):z instanceof THREE.MeshNormalMaterial&&(B=void 0,z.shading==THREE.FlatShading?(B=A.normalModelView,O.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O)):z.shading==THREE.SmoothShading&&(B=A.vertexNormalsModelView[0],ba.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=A.vertexNormalsModelView[1],$.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=A.vertexNormalsModelView[2],
V.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)))}}la.union(Ea)}}F.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
!1===z.visible)){Ea.makeEmpty();if(A instanceof THREE.RenderableSprite){R=A;R.x*=x;R.y*=J;var B=R,D=A,I=z;i(I.opacity);k(I.blending);A=D.scale.x*x;z=D.scale.y*J;Ea.min.set(B.x-0.5*A,B.y-0.5*z);Ea.max.set(B.x+0.5*A,B.y+0.5*z);!1===va.isIntersectionBox(Ea)?Ea.makeEmpty():I instanceof THREE.SpriteMaterial||I instanceof THREE.ParticleSystemMaterial?(void 0!==I.map.image?(D=I.map.image,F.save(),F.translate(B.x,B.y),F.rotate(-I.rotation),F.scale(A,-z),F.drawImage(D,0,0,D.width,D.height,-0.5,-0.5,1,1)):
(r(I.color.getStyle()),F.save(),F.translate(B.x,B.y),F.rotate(-D.rotation),F.scale(A,z),F.fillRect(-0.5,-0.5,1,1)),F.restore()):I instanceof THREE.SpriteCanvasMaterial&&(s(I.color.getStyle()),r(I.color.getStyle()),F.save(),F.translate(B.x,B.y),F.rotate(-D.rotation),F.scale(A,z),I.program(F),F.restore())}else if(A instanceof THREE.RenderableLine){if(R=A.v1,K=A.v2,R.positionScreen.x*=x,R.positionScreen.y*=J,K.positionScreen.x*=x,K.positionScreen.y*=J,Ea.setFromPoints([R.positionScreen,K.positionScreen]),
!0===va.isIntersectionBox(Ea))if(B=R,D=K,I=A,A=z,i(A.opacity),k(A.blending),F.beginPath(),F.moveTo(B.positionScreen.x,B.positionScreen.y),F.lineTo(D.positionScreen.x,D.positionScreen.y),A instanceof THREE.LineBasicMaterial){m(A.linewidth);l(A.linecap);n(A.linejoin);if(A.vertexColors!==THREE.VertexColors)s(A.color.getStyle());else if(z=I.vertexColors[0].getStyle(),I=I.vertexColors[1].getStyle(),z===I)s(z);else{try{var M=F.createLinearGradient(B.positionScreen.x,B.positionScreen.y,D.positionScreen.x,
D.positionScreen.y);M.addColorStop(0,z);M.addColorStop(1,I)}catch(C){M=z}s(M)}F.stroke();Ea.expandByScalar(2*A.linewidth)}else A instanceof THREE.LineDashedMaterial&&(m(A.linewidth),l(A.linecap),n(A.linejoin),s(A.color.getStyle()),q(A.dashSize,A.gapSize),F.stroke(),Ea.expandByScalar(2*A.linewidth),q(null,null))}else if(A instanceof THREE.RenderableFace3){R=A.v1;K=A.v2;ca=A.v3;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>ca.positionScreen.z||
1<ca.positionScreen.z)continue;R.positionScreen.x*=x;R.positionScreen.y*=J;K.positionScreen.x*=x;K.positionScreen.y*=J;ca.positionScreen.x*=x;ca.positionScreen.y*=J;0<z.overdraw&&(g(R.positionScreen,K.positionScreen,z.overdraw),g(K.positionScreen,ca.positionScreen,z.overdraw),g(ca.positionScreen,R.positionScreen,z.overdraw));Ea.setFromPoints([R.positionScreen,K.positionScreen,ca.positionScreen]);if(!0===va.isIntersectionBox(Ea)){B=R;D=K;I=ca;t.info.render.vertices+=3;t.info.render.faces++;i(z.opacity);
k(z.blending);wa=B.positionScreen.x;Ba=B.positionScreen.y;P=D.positionScreen.x;Aa=D.positionScreen.y;Z=I.positionScreen.x;da=I.positionScreen.y;var S=wa,N=Ba,ia=P,ka=Aa,na=Z,pa=da;F.beginPath();F.moveTo(S,N);F.lineTo(ia,ka);F.lineTo(na,pa);F.closePath();(z instanceof THREE.MeshLambertMaterial||z instanceof THREE.MeshPhongMaterial)&&null===z.map?(sa.copy(z.color),ga.copy(z.emissive),z.vertexColors===THREE.FaceColors&&sa.multiply(A.color),!1===z.wireframe&&z.shading==THREE.SmoothShading&&3==A.vertexNormalsLength?
(ba.copy(gb),$.copy(gb),V.copy(gb),b(A.v1.positionWorld,A.vertexNormalsModel[0],ba),b(A.v2.positionWorld,A.vertexNormalsModel[1],$),b(A.v3.positionWorld,A.vertexNormalsModel[2],V),ba.multiply(sa).add(ga),$.multiply(sa).add(ga),V.multiply(sa).add(ga),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)):(O.copy(gb),b(A.centroidModel,A.normalModel,O),O.multiply(sa).add(ga),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O))):z instanceof
THREE.MeshBasicMaterial||z instanceof THREE.MeshLambertMaterial||z instanceof THREE.MeshPhongMaterial?null!==z.map?z.map.mapping instanceof THREE.UVMapping&&(xa=A.uvs[0],e(wa,Ba,P,Aa,Z,da,xa[0].x,xa[0].y,xa[1].x,xa[1].y,xa[2].x,xa[2].y,z.map)):null!==z.envMap?z.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ta.copy(A.vertexNormalsModelView[0]),bb=0.5*ta.x+0.5,cb=0.5*ta.y+0.5,ta.copy(A.vertexNormalsModelView[1]),Ma=0.5*ta.x+0.5,fb=0.5*ta.y+0.5,ta.copy(A.vertexNormalsModelView[2]),sb=
0.5*ta.x+0.5,pb=0.5*ta.y+0.5,e(wa,Ba,P,Aa,Z,da,bb,cb,Ma,fb,sb,pb,z.envMap)):(O.copy(z.color),z.vertexColors===THREE.FaceColors&&O.multiply(A.color),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O)):z instanceof THREE.MeshDepthMaterial?(Da=Q.near,Ua=Q.far,ba.r=ba.g=ba.b=1-p(B.positionScreen.z*B.positionScreen.w,Da,Ua),$.r=$.g=$.b=1-p(D.positionScreen.z*D.positionScreen.w,Da,Ua),V.r=V.g=V.b=1-p(I.positionScreen.z*I.positionScreen.w,Da,Ua),ja.addColors($,V).multiplyScalar(0.5),
Qa=h(ba,$,V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)):z instanceof THREE.MeshNormalMaterial&&(B=void 0,z.shading==THREE.FlatShading?(B=A.normalModelView,O.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O)):z.shading==THREE.SmoothShading&&(B=A.vertexNormalsModelView[0],ba.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=A.vertexNormalsModelView[1],$.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),
B=A.vertexNormalsModelView[2],V.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)))}}la.union(Ea)}}F.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册