|
@@ -341,8 +341,8 @@ Da=new THREE.Vector3,Ja=new THREE.Vector3,ja=new THREE.Vector3,ra=new THREE.Matr
|
|
|
this.setSize=function(a,b,c){I=a*this.devicePixelRatio;A=b*this.devicePixelRatio;x.width=I;x.height=A;D=Math.floor(I/2);L=Math.floor(A/2);1!==this.devicePixelRatio&&!1!==c&&(x.style.width=a+"px",x.style.height=b+"px");ya.min.set(-D,-L);ya.max.set(D,L);Z.min.set(-D,-L);Z.max.set(D,L);C=1;J=0;Y=Q=H=N=F=null;this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){z.setTransform(c/I,0,0,-d/A,a,A-b);z.translate(D,L)};this.setScissor=function(){};this.enableScissorTest=function(){};this.setClearColor=
|
|
|
function(a,b){G.set(a);B=void 0!==b?b:1;Z.min.set(-D,-L);Z.max.set(D,L)};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(){!1===Z.empty()&&(Z.intersect(ya),Z.expandByScalar(2),1>B&&z.clearRect(Z.min.x|0,Z.min.y|0,Z.max.x-Z.min.x|0,Z.max.y-Z.min.y|0),0<B&&(k(THREE.NormalBlending),h(1),s("rgba("+Math.floor(255*G.r)+","+Math.floor(255*
|
|
|
G.g)+","+Math.floor(255*G.b)+","+B+")"),z.fillRect(Z.min.x|0,Z.min.y|0,Z.max.x-Z.min.x|0,Z.max.y-Z.min.y|0)),Z.makeEmpty())};this.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(a,x){if(!1===x instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();w.info.render.vertices=0;w.info.render.faces=0;v=E.projectScene(a,x,this.sortObjects,this.sortElements);
|
|
|
-t=v.elements;y=v.lights;W=x;ra.getNormalMatrix(x.matrixWorldInverse);ua.setRGB(0,0,0);Ca.setRGB(0,0,0);va.setRGB(0,0,0);for(var C=0,F=y.length;C<F;C++){var A=y[C],G=A.color;A instanceof THREE.AmbientLight?ua.add(G):A instanceof THREE.DirectionalLight?Ca.add(G):A instanceof THREE.PointLight&&va.add(G)}C=0;for(F=t.length;C<F;C++){var H=t[C],N=H.material;if(void 0!==N&&!1!==N.visible){qa.makeEmpty();if(H instanceof THREE.RenderableSprite){R=H;R.x*=D;R.y*=L;var A=R,I=H,G=N;h(G.opacity);k(G.blending);
|
|
|
-var m=I.scale.x*D,I=I.scale.y*L,H=0.5*Math.sqrt(m*m+I*I);qa.min.set(A.x-H,A.y-H);qa.max.set(A.x+H,A.y+H);if(G instanceof THREE.SpriteMaterial||G instanceof THREE.ParticleSystemMaterial){var B=G.map;if(null!==B){!1===B.hasEventListener("update",d)&&(void 0!==B.image&&0<B.image.width&&e(B),B.addEventListener("update",d));H=Ga[B.id];void 0!==H?s(H):s("rgba( 0, 0, 0, 1 )");var J=B.image,H=J.width*B.offset.x,N=J.height*B.offset.y,Q=J.width*B.repeat.x,B=J.height*B.repeat.y,J=m/Q,U=I/B;z.save();z.translate(A.x,
|
|
|
+t=v.elements;y=v.lights;W=x;ra.getNormalMatrix(x.matrixWorldInverse);ua.setRGB(0,0,0);Ca.setRGB(0,0,0);va.setRGB(0,0,0);for(var C=0,F=y.length;C<F;C++){var A=y[C],G=A.color;A instanceof THREE.AmbientLight?ua.add(G):A instanceof THREE.DirectionalLight?Ca.add(G):A instanceof THREE.PointLight&&va.add(G)}C=0;for(F=t.length;C<F;C++){var H=t[C],N=H.material;if(void 0!==N&&0!==N.opacity){qa.makeEmpty();if(H instanceof THREE.RenderableSprite){R=H;R.x*=D;R.y*=L;var A=R,I=H,G=N;h(G.opacity);k(G.blending);var m=
|
|
|
+I.scale.x*D,I=I.scale.y*L,H=0.5*Math.sqrt(m*m+I*I);qa.min.set(A.x-H,A.y-H);qa.max.set(A.x+H,A.y+H);if(G instanceof THREE.SpriteMaterial||G instanceof THREE.ParticleSystemMaterial){var B=G.map;if(null!==B){!1===B.hasEventListener("update",d)&&(void 0!==B.image&&0<B.image.width&&e(B),B.addEventListener("update",d));H=Ga[B.id];void 0!==H?s(H):s("rgba( 0, 0, 0, 1 )");var J=B.image,H=J.width*B.offset.x,N=J.height*B.offset.y,Q=J.width*B.repeat.x,B=J.height*B.repeat.y,J=m/Q,U=I/B;z.save();z.translate(A.x,
|
|
|
A.y);0!==G.rotation&&z.rotate(G.rotation);z.translate(-m/2,-I/2);z.scale(J,U);z.translate(-H,-N);z.fillRect(H,N,Q,B)}else s(G.color.getStyle()),z.save(),z.translate(A.x,A.y),0!==G.rotation&&z.rotate(G.rotation),z.scale(m,-I),z.fillRect(-0.5,-0.5,1,1);z.restore()}else G instanceof THREE.SpriteCanvasMaterial&&(p(G.color.getStyle()),s(G.color.getStyle()),z.save(),z.translate(A.x,A.y),0!==G.rotation&&z.rotate(G.rotation),z.scale(m,I),G.program(z),z.restore())}else if(H instanceof THREE.RenderableLine){if(R=
|
|
|
H.v1,K=H.v2,R.positionScreen.x*=D,R.positionScreen.y*=L,K.positionScreen.x*=D,K.positionScreen.y*=L,qa.setFromPoints([R.positionScreen,K.positionScreen]),!0===ya.isIntersectionBox(qa))if(A=R,G=K,m=H,I=N,h(I.opacity),k(I.blending),z.beginPath(),z.moveTo(A.positionScreen.x,A.positionScreen.y),z.lineTo(G.positionScreen.x,G.positionScreen.y),I instanceof THREE.LineBasicMaterial){l(I.linewidth);n(I.linecap);r(I.linejoin);if(I.vertexColors!==THREE.VertexColors)p(I.color.getStyle());else if(H=m.vertexColors[0].getStyle(),
|
|
|
m=m.vertexColors[1].getStyle(),H===m)p(H);else{try{var Y=z.createLinearGradient(A.positionScreen.x,A.positionScreen.y,G.positionScreen.x,G.positionScreen.y);Y.addColorStop(0,H);Y.addColorStop(1,m)}catch(la){Y=H}p(Y)}z.stroke();qa.expandByScalar(2*I.linewidth)}else I instanceof THREE.LineDashedMaterial&&(l(I.linewidth),n(I.linecap),r(I.linejoin),p(I.color.getStyle()),u(I.dashSize,I.gapSize),z.stroke(),qa.expandByScalar(2*I.linewidth),u(null,null))}else if(H instanceof THREE.RenderableFace){R=H.v1;
|