|
@@ -151,30 +151,30 @@ U.copy(ea.positionScreen),e(G,U))G.multiplyScalar(1/G.w),U.multiplyScalar(1/U.w)
|
|
|
N.scale.x*Math.abs(y.x-(E.x+g.projectionMatrix.n11)/(E.w+g.projectionMatrix.n14)),y.scale.y=N.scale.y*Math.abs(y.y-(E.y+g.projectionMatrix.n22)/(E.w+g.projectionMatrix.n24)),y.materials=N.materials,H.push(y);k&&H.sort(c);return H}};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;k=f/2};this.render=function(e,f){var n,p,o,t,u,v,x,B;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(u=b[n],u instanceof THREE.RenderableParticle){x=u.x*g+g;B=u.y*k+k;o=0;for(t=u.material.length;o<t;o++)if(v=u.material[o],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=x+"px",v.style.top=B+"px"}}};
|
|
|
THREE.CanvasRenderer=function(b){function c(b){if(y!=b)x.globalAlpha=y=b}function e(b){if(F!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}F=b}}function f(b){if(w!=b.hex)w=b.hex,x.strokeStyle="#"+k(w.toString(16))}function g(b){if(H!=b.hex)H=b.hex,x.fillStyle="#"+k(H.toString(16))}function k(b){for(;b.length<6;)b="0"+b;return b}
|
|
|
-var h=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,t,u,v,x=p.getContext("2d"),B=new THREE.Color(0),A=0,y=1,F=0,w=null,H=null,E=null,D=null,S=null,J,G,U,W,M=new THREE.RenderableVertex,X=new THREE.RenderableVertex,T,R,j,fa,P,da,ca,Y,ea,ga,la,pa,N=new THREE.Color(0),ia=new THREE.Color(0),Z=new THREE.Color(0),ma=new THREE.Color(0),$=new THREE.Color(0),I,V,oa,ha,na,wa,Aa,va,ya,Ma,qa=new THREE.Rectangle,sa=new THREE.Rectangle,ra=new THREE.Rectangle,
|
|
|
+var h=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,t,u,v,x=p.getContext("2d"),B=new THREE.Color(0),A=0,y=1,F=0,w=null,H=null,E=null,D=null,S=null,J,G,U,W,M=new THREE.RenderableVertex,X=new THREE.RenderableVertex,T,R,j,fa,P,da,ca,Y,ea,ga,la,pa,N=new THREE.Color(0),ia=new THREE.Color(0),Z=new THREE.Color(0),ma=new THREE.Color(0),$=new THREE.Color(0),I,V,oa,ha,na,wa,Aa,va,ya,Ma,sa=new THREE.Rectangle,ra=new THREE.Rectangle,qa=new THREE.Rectangle,
|
|
|
Ba=!1,aa=new THREE.Color,L=new THREE.Color,ua=new THREE.Color,Q=new THREE.Color,ka=new THREE.Vector3,ja,Pa,Va,xa,Qa,Ra,b=16;ja=document.createElement("canvas");ja.width=ja.height=2;Pa=ja.getContext("2d");Pa.fillStyle="rgba(0,0,0,1)";Pa.fillRect(0,0,2,2);Va=Pa.getImageData(0,0,2,2);xa=Va.data;Qa=document.createElement("canvas");Qa.width=Qa.height=b;Ra=Qa.getContext("2d");Ra.translate(-b/2,-b/2);Ra.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
|
|
|
-faces:0};this.setSize=function(b,e){o=b;t=e;u=o/2;v=t/2;p.width=o;p.height=t;qa.set(-u,-v,u,v);y=1;F=0;S=D=E=H=w=null};this.setClearColor=function(b,e){B=b;A=e};this.setClearColorHex=function(b,e){B.setHex(b);A=e};this.clear=function(){x.setTransform(1,0,0,-1,u,v);if(!sa.isEmpty())sa.inflate(1),sa.minSelf(qa),B.hex==0&&A==0?x.clearRect(sa.getX(),sa.getY(),sa.getWidth(),sa.getHeight()):(e(THREE.NormalBlending),c(1),x.fillStyle="rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*
|
|
|
-255)+","+A+")",x.fillRect(sa.getX(),sa.getY(),sa.getWidth(),sa.getHeight())),sa.empty()};this.render=function(b,k){function p(b){var e,c,f,g=b.lights;L.setRGB(0,0,0);ua.setRGB(0,0,0);Q.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(L.r+=f.r,L.g+=f.g,L.b+=f.b):c instanceof THREE.DirectionalLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.PointLight&&(Q.r+=f.r,Q.g+=f.g,Q.b+=f.b)}function o(b,e,c,f){var g,j,h,k,m=b.lights,b=0;for(g=m.length;b<g;b++)j=
|
|
|
-m[b],h=j.color,j instanceof THREE.DirectionalLight?(k=c.dot(j.position),k<=0||(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)):j instanceof THREE.PointLight&&(k=c.dot(ka.sub(j.position,e).normalize()),k<=0||(k*=j.distance==0?1:1-Math.min(e.distanceTo(j.position)/j.distance,1),k!=0&&(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)))}function t(b,j,h){c(h.opacity);e(h.blending);var k,m,p,n,o,ja;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)n=h.map.image,o=n.width>>1,ja=n.height>>1,h=j.scale.x*
|
|
|
-u,p=j.scale.y*v,k=h*o,m=p*ja,ra.set(b.x-k,b.y-m,b.x+k,b.y+m),qa.instersects(ra)&&(x.save(),x.translate(b.x,b.y),x.rotate(-j.rotation),x.scale(h,-p),x.translate(-o,-ja),x.drawImage(n,0,0),x.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*u,m=j.scale.y*v,ra.set(b.x-k,b.y-m,b.x+k,b.y+m),qa.instersects(ra)&&(f(h.color),g(h.color),x.save(),x.translate(b.x,b.y),x.rotate(-j.rotation),x.scale(k,m),h.program(x),x.restore()))}function y(b,g,j,h){c(h.opacity);e(h.blending);x.beginPath();
|
|
|
-x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(g.positionScreen.x,g.positionScreen.y);x.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(E!=b)x.lineWidth=E=b;b=h.linecap;if(D!=b)x.lineCap=D=b;b=h.linejoin;if(S!=b)x.lineJoin=S=b;f(h.color);x.stroke();ra.inflate(h.linewidth*2)}}function A(b,f,g,m,p,n,ja,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);T=b.positionScreen.x;R=b.positionScreen.y;j=f.positionScreen.x;fa=f.positionScreen.y;P=g.positionScreen.x;
|
|
|
-da=g.positionScreen.y;B(T,R,j,fa,P,da);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(ha=ja.uvs[0],Ca(T,R,j,fa,P,da,t.map.image,ha[m].u,ha[m].v,ha[p].u,ha[p].v,ha[n].u,ha[n].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,ka.copy(ja.vertexNormalsWorld[0]),na=(ka.x*b.n11+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,wa=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,ka.copy(ja.vertexNormalsWorld[1]),Aa=(ka.x*b.n11+
|
|
|
-ka.y*b.n12+ka.z*b.n13)*0.5+0.5,va=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,ka.copy(ja.vertexNormalsWorld[2]),ya=(ka.x*b.n11+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,Ma=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,Ca(T,R,j,fa,P,da,t.envMap.image,na,wa,Aa,va,ya,Ma)}else t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(ha=ja.uvs[0],Ca(T,R,j,fa,P,da,t.map.image,
|
|
|
-ha[m].u,ha[m].v,ha[p].u,ha[p].v,ha[n].u,ha[n].v)),e(THREE.SubtractiveBlending)),Ba?!t.wireframe&&t.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==3?(ia.r=Z.r=ma.r=L.r,ia.g=Z.g=ma.g=L.g,ia.b=Z.b=ma.b=L.b,o(u,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ia),o(u,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),o(u,ja.v3.positionWorld,ja.vertexNormalsWorld[2],ma),$.r=(Z.r+ma.r)*0.5,$.g=(Z.g+ma.g)*0.5,$.b=(Z.b+ma.b)*0.5,oa=Sa(ia,Z,ma,$),Ca(T,R,j,fa,P,da,oa,0,0,1,0,0,1)):(aa.r=L.r,aa.g=L.g,
|
|
|
-aa.b=L.b,o(u,ja.centroidWorld,ja.normalWorld,aa),N.r=Math.max(0,Math.min(t.color.r*aa.r,1)),N.g=Math.max(0,Math.min(t.color.g*aa.g,1)),N.b=Math.max(0,Math.min(t.color.b*aa.b,1)),N.updateHex(),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)):t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshDepthMaterial)I=k.near,V=k.far,ia.r=ia.g=ia.b=1-Ia(b.positionScreen.z,I,V),Z.r=Z.g=Z.b=1-Ia(f.positionScreen.z,
|
|
|
-I,V),ma.r=ma.g=ma.b=1-Ia(g.positionScreen.z,I,V),$.r=(Z.r+ma.r)*0.5,$.g=(Z.g+ma.g)*0.5,$.b=(Z.b+ma.b)*0.5,oa=Sa(ia,Z,ma,$),Ca(T,R,j,fa,P,da,oa,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)N.r=Na(ja.normalWorld.x),N.g=Na(ja.normalWorld.y),N.b=Na(ja.normalWorld.z),N.updateHex(),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)}function w(b,f,g,m,p,n,ja,t,u){h.data.vertices+=4;h.data.faces++;c(t.opacity);e(t.blending);if(t.map||t.envMap)A(b,f,m,0,1,3,ja,
|
|
|
-t,u),A(p,g,n,1,2,3,ja,t,u);else if(T=b.positionScreen.x,R=b.positionScreen.y,j=f.positionScreen.x,fa=f.positionScreen.y,P=g.positionScreen.x,da=g.positionScreen.y,ca=m.positionScreen.x,Y=m.positionScreen.y,ea=p.positionScreen.x,ga=p.positionScreen.y,la=n.positionScreen.x,pa=n.positionScreen.y,t instanceof THREE.MeshBasicMaterial)F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshLambertMaterial)Ba?!t.wireframe&&
|
|
|
-t.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==4?(ia.r=Z.r=ma.r=$.r=L.r,ia.g=Z.g=ma.g=$.g=L.g,ia.b=Z.b=ma.b=$.b=L.b,o(u,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ia),o(u,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),o(u,ja.v4.positionWorld,ja.vertexNormalsWorld[3],ma),o(u,ja.v3.positionWorld,ja.vertexNormalsWorld[2],$),oa=Sa(ia,Z,ma,$),B(T,R,j,fa,ca,Y),Ca(T,R,j,fa,ca,Y,oa,0,0,1,0,0,1),B(ea,ga,P,da,la,pa),Ca(ea,ga,P,da,la,pa,oa,1,0,1,1,0,1)):(aa.r=L.r,aa.g=L.g,aa.b=L.b,o(u,ja.centroidWorld,
|
|
|
-ja.normalWorld,aa),N.r=Math.max(0,Math.min(t.color.r*aa.r,1)),N.g=Math.max(0,Math.min(t.color.g*aa.g,1)),N.b=Math.max(0,Math.min(t.color.b*aa.b,1)),N.updateHex(),F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)):(F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color));else if(t instanceof THREE.MeshNormalMaterial)N.r=Na(ja.normalWorld.x),N.g=Na(ja.normalWorld.y),N.b=Na(ja.normalWorld.z),
|
|
|
-N.updateHex(),F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N);else if(t instanceof THREE.MeshDepthMaterial)I=k.near,V=k.far,ia.r=ia.g=ia.b=1-Ia(b.positionScreen.z,I,V),Z.r=Z.g=Z.b=1-Ia(f.positionScreen.z,I,V),ma.r=ma.g=ma.b=1-Ia(m.positionScreen.z,I,V),$.r=$.g=$.b=1-Ia(g.positionScreen.z,I,V),oa=Sa(ia,Z,ma,$),B(T,R,j,fa,ca,Y),Ca(T,R,j,fa,ca,Y,oa,0,0,1,0,0,1),B(ea,ga,P,da,la,pa),Ca(ea,ga,P,da,la,pa,oa,1,0,1,1,0,1)}function B(b,e,c,f,g,j){x.beginPath();
|
|
|
-x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,j);x.lineTo(b,e);x.closePath()}function F(b,e,c,f,g,j,h,k){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,j);x.lineTo(h,k);x.lineTo(b,e);x.closePath()}function H(b,e,c,g){if(E!=e)x.lineWidth=E=e;if(D!=c)x.lineCap=D=c;if(S!=g)x.lineJoin=S=g;f(b);x.stroke();ra.inflate(e*2)}function Ea(b){g(b);x.fill()}function Ca(b,e,c,f,g,j,h,k,m,t,p,n,ja){var o,u;o=h.width-1;u=h.height-1;k*=o;m*=u;t*=o;p*=u;n*=o;ja*=u;c-=b;f-=e;g-=b;j-=e;t-=k;p-=m;n-=k;ja-=m;o=t*ja-n*p;
|
|
|
-o!=0&&(u=1/o,o=(ja*c-p*g)*u,p=(ja*f-p*j)*u,c=(t*g-n*c)*u,f=(t*j-n*f)*u,b=b-o*k-c*m,e=e-p*k-f*m,x.save(),x.transform(o,p,c,f,b,e),x.clip(),x.drawImage(h,0,0),x.restore())}function Sa(b,e,c,f){var g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),n=~~(f.g*255),f=~~(f.b*255);xa[0]=g<0?0:g>255?255:g;xa[1]=j<0?0:j>255?255:j;xa[2]=b<0?0:b>255?255:b;xa[4]=h<0?0:h>255?255:h;xa[5]=k<0?0:k>255?255:k;xa[6]=e<0?0:e>255?
|
|
|
-255:e;xa[8]=m<0?0:m>255?255:m;xa[9]=t<0?0:t>255?255:t;xa[10]=c<0?0:c>255?255:c;xa[12]=p<0?0:p>255?255:p;xa[13]=n<0?0:n>255?255:n;xa[14]=f<0?0:f>255?255:f;Pa.putImageData(Va,0,0);Ra.drawImage(ja,0,0);return Qa}function Ia(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Fa(b,e){var c=e.x-b.x,f=e.y-b.y,g=1/Math.sqrt(c*c+f*f);c*=g;f*=g;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ta,C,K,z,Ga,Oa,Ua,ta;this.autoClear?this.clear():x.setTransform(1,0,0,-1,u,v);h.data.vertices=
|
|
|
-0;h.data.faces=0;m=n.projectScene(b,k,this.sortElements);(Ba=b.lights.length>0)&&p(b);Ta=0;for(C=m.length;Ta<C;Ta++){K=m[Ta];ra.empty();if(K instanceof THREE.RenderableParticle){J=K;J.x*=u;J.y*=v;z=0;for(Ga=K.materials.length;z<Ga;)ta=K.materials[z++],ta.opacity!=0&&t(J,K,ta,b)}else if(K instanceof THREE.RenderableLine){if(J=K.v1,G=K.v2,J.positionScreen.x*=u,J.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=v,ra.addPoint(J.positionScreen.x,J.positionScreen.y),ra.addPoint(G.positionScreen.x,
|
|
|
-G.positionScreen.y),qa.instersects(ra)){z=0;for(Ga=K.materials.length;z<Ga;)ta=K.materials[z++],ta.opacity!=0&&y(J,G,K,ta,b)}}else if(K instanceof THREE.RenderableFace3){if(J=K.v1,G=K.v2,U=K.v3,J.positionScreen.x*=u,J.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,K.overdraw&&(Fa(J.positionScreen,G.positionScreen),Fa(G.positionScreen,U.positionScreen),Fa(U.positionScreen,J.positionScreen)),ra.add3Points(J.positionScreen.x,J.positionScreen.y,
|
|
|
-G.positionScreen.x,G.positionScreen.y,U.positionScreen.x,U.positionScreen.y),qa.instersects(ra)){z=0;for(Ga=K.meshMaterials.length;z<Ga;)if(ta=K.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=K.faceMaterials.length;Oa<Ua;)(ta=K.faceMaterials[Oa++])&&ta.opacity!=0&&A(J,G,U,0,1,2,K,ta,b)}else ta.opacity!=0&&A(J,G,U,0,1,2,K,ta,b)}}else if(K instanceof THREE.RenderableFace4&&(J=K.v1,G=K.v2,U=K.v3,W=K.v4,J.positionScreen.x*=u,J.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=
|
|
|
-v,U.positionScreen.x*=u,U.positionScreen.y*=v,W.positionScreen.x*=u,W.positionScreen.y*=v,M.positionScreen.copy(G.positionScreen),X.positionScreen.copy(W.positionScreen),K.overdraw&&(Fa(J.positionScreen,G.positionScreen),Fa(G.positionScreen,W.positionScreen),Fa(W.positionScreen,J.positionScreen),Fa(U.positionScreen,M.positionScreen),Fa(U.positionScreen,X.positionScreen)),ra.addPoint(J.positionScreen.x,J.positionScreen.y),ra.addPoint(G.positionScreen.x,G.positionScreen.y),ra.addPoint(U.positionScreen.x,
|
|
|
-U.positionScreen.y),ra.addPoint(W.positionScreen.x,W.positionScreen.y),qa.instersects(ra))){z=0;for(Ga=K.meshMaterials.length;z<Ga;)if(ta=K.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=K.faceMaterials.length;Oa<Ua;)(ta=K.faceMaterials[Oa++])&&ta.opacity!=0&&w(J,G,U,W,M,X,K,ta,b)}else ta.opacity!=0&&w(J,G,U,W,M,X,K,ta,b)}sa.addRectangle(ra)}x.setTransform(1,0,0,1,0,0)}};
|
|
|
+faces:0};this.setSize=function(b,e){o=b;t=e;u=o/2;v=t/2;p.width=o;p.height=t;sa.set(-u,-v,u,v);ra.set(-u,-v,u,v);y=1;F=0;S=D=E=H=w=null};this.setClearColor=function(b,e){B=b;A=e};this.setClearColorHex=function(b,e){B.setHex(b);A=e};this.clear=function(){x.setTransform(1,0,0,-1,u,v);if(!ra.isEmpty())ra.inflate(1),ra.minSelf(sa),B.hex==0&&A==0?x.clearRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight()):(e(THREE.NormalBlending),c(1),x.fillStyle="rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+
|
|
|
+Math.floor(B.b*255)+","+A+")",x.fillRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight())),ra.empty()};this.render=function(b,k){function p(b){var e,c,f,g=b.lights;L.setRGB(0,0,0);ua.setRGB(0,0,0);Q.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(L.r+=f.r,L.g+=f.g,L.b+=f.b):c instanceof THREE.DirectionalLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.PointLight&&(Q.r+=f.r,Q.g+=f.g,Q.b+=f.b)}function o(b,e,c,f){var g,j,h,k,m=b.lights,b=0;for(g=m.length;b<
|
|
|
+g;b++)j=m[b],h=j.color,j instanceof THREE.DirectionalLight?(k=c.dot(j.position),k<=0||(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)):j instanceof THREE.PointLight&&(k=c.dot(ka.sub(j.position,e).normalize()),k<=0||(k*=j.distance==0?1:1-Math.min(e.distanceTo(j.position)/j.distance,1),k!=0&&(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)))}function t(b,j,h){c(h.opacity);e(h.blending);var k,m,p,n,o,ja;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)n=h.map.image,o=n.width>>1,ja=n.height>>
|
|
|
+1,h=j.scale.x*u,p=j.scale.y*v,k=h*o,m=p*ja,qa.set(b.x-k,b.y-m,b.x+k,b.y+m),sa.instersects(qa)&&(x.save(),x.translate(b.x,b.y),x.rotate(-j.rotation),x.scale(h,-p),x.translate(-o,-ja),x.drawImage(n,0,0),x.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*u,m=j.scale.y*v,qa.set(b.x-k,b.y-m,b.x+k,b.y+m),sa.instersects(qa)&&(f(h.color),g(h.color),x.save(),x.translate(b.x,b.y),x.rotate(-j.rotation),x.scale(k,m),h.program(x),x.restore()))}function y(b,g,j,h){c(h.opacity);e(h.blending);
|
|
|
+x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(g.positionScreen.x,g.positionScreen.y);x.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(E!=b)x.lineWidth=E=b;b=h.linecap;if(D!=b)x.lineCap=D=b;b=h.linejoin;if(S!=b)x.lineJoin=S=b;f(h.color);x.stroke();qa.inflate(h.linewidth*2)}}function A(b,f,g,m,p,n,ja,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);T=b.positionScreen.x;R=b.positionScreen.y;j=f.positionScreen.x;fa=f.positionScreen.y;P=
|
|
|
+g.positionScreen.x;da=g.positionScreen.y;B(T,R,j,fa,P,da);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(ha=ja.uvs[0],Ca(T,R,j,fa,P,da,t.map.image,ha[m].u,ha[m].v,ha[p].u,ha[p].v,ha[n].u,ha[n].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,ka.copy(ja.vertexNormalsWorld[0]),na=(ka.x*b.n11+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,wa=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,ka.copy(ja.vertexNormalsWorld[1]),
|
|
|
+Aa=(ka.x*b.n11+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,va=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,ka.copy(ja.vertexNormalsWorld[2]),ya=(ka.x*b.n11+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,Ma=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,Ca(T,R,j,fa,P,da,t.envMap.image,na,wa,Aa,va,ya,Ma)}else t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(ha=ja.uvs[0],Ca(T,
|
|
|
+R,j,fa,P,da,t.map.image,ha[m].u,ha[m].v,ha[p].u,ha[p].v,ha[n].u,ha[n].v)),e(THREE.SubtractiveBlending)),Ba?!t.wireframe&&t.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==3?(ia.r=Z.r=ma.r=L.r,ia.g=Z.g=ma.g=L.g,ia.b=Z.b=ma.b=L.b,o(u,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ia),o(u,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),o(u,ja.v3.positionWorld,ja.vertexNormalsWorld[2],ma),$.r=(Z.r+ma.r)*0.5,$.g=(Z.g+ma.g)*0.5,$.b=(Z.b+ma.b)*0.5,oa=Sa(ia,Z,ma,$),Ca(T,R,j,fa,P,da,oa,0,0,1,0,0,
|
|
|
+1)):(aa.r=L.r,aa.g=L.g,aa.b=L.b,o(u,ja.centroidWorld,ja.normalWorld,aa),N.r=Math.max(0,Math.min(t.color.r*aa.r,1)),N.g=Math.max(0,Math.min(t.color.g*aa.g,1)),N.b=Math.max(0,Math.min(t.color.b*aa.b,1)),N.updateHex(),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)):t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshDepthMaterial)I=k.near,V=k.far,ia.r=ia.g=ia.b=1-Ia(b.positionScreen.z,I,V),Z.r=
|
|
|
+Z.g=Z.b=1-Ia(f.positionScreen.z,I,V),ma.r=ma.g=ma.b=1-Ia(g.positionScreen.z,I,V),$.r=(Z.r+ma.r)*0.5,$.g=(Z.g+ma.g)*0.5,$.b=(Z.b+ma.b)*0.5,oa=Sa(ia,Z,ma,$),Ca(T,R,j,fa,P,da,oa,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)N.r=Na(ja.normalWorld.x),N.g=Na(ja.normalWorld.y),N.b=Na(ja.normalWorld.z),N.updateHex(),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)}function w(b,f,g,m,p,n,ja,t,u){h.data.vertices+=4;h.data.faces++;c(t.opacity);e(t.blending);if(t.map||
|
|
|
+t.envMap)A(b,f,m,0,1,3,ja,t,u),A(p,g,n,1,2,3,ja,t,u);else if(T=b.positionScreen.x,R=b.positionScreen.y,j=f.positionScreen.x,fa=f.positionScreen.y,P=g.positionScreen.x,da=g.positionScreen.y,ca=m.positionScreen.x,Y=m.positionScreen.y,ea=p.positionScreen.x,ga=p.positionScreen.y,la=n.positionScreen.x,pa=n.positionScreen.y,t instanceof THREE.MeshBasicMaterial)F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshLambertMaterial)Ba?
|
|
|
+!t.wireframe&&t.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==4?(ia.r=Z.r=ma.r=$.r=L.r,ia.g=Z.g=ma.g=$.g=L.g,ia.b=Z.b=ma.b=$.b=L.b,o(u,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ia),o(u,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),o(u,ja.v4.positionWorld,ja.vertexNormalsWorld[3],ma),o(u,ja.v3.positionWorld,ja.vertexNormalsWorld[2],$),oa=Sa(ia,Z,ma,$),B(T,R,j,fa,ca,Y),Ca(T,R,j,fa,ca,Y,oa,0,0,1,0,0,1),B(ea,ga,P,da,la,pa),Ca(ea,ga,P,da,la,pa,oa,1,0,1,1,0,1)):(aa.r=L.r,aa.g=L.g,aa.b=
|
|
|
+L.b,o(u,ja.centroidWorld,ja.normalWorld,aa),N.r=Math.max(0,Math.min(t.color.r*aa.r,1)),N.g=Math.max(0,Math.min(t.color.g*aa.g,1)),N.b=Math.max(0,Math.min(t.color.b*aa.b,1)),N.updateHex(),F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)):(F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color));else if(t instanceof THREE.MeshNormalMaterial)N.r=Na(ja.normalWorld.x),N.g=Na(ja.normalWorld.y),
|
|
|
+N.b=Na(ja.normalWorld.z),N.updateHex(),F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N);else if(t instanceof THREE.MeshDepthMaterial)I=k.near,V=k.far,ia.r=ia.g=ia.b=1-Ia(b.positionScreen.z,I,V),Z.r=Z.g=Z.b=1-Ia(f.positionScreen.z,I,V),ma.r=ma.g=ma.b=1-Ia(m.positionScreen.z,I,V),$.r=$.g=$.b=1-Ia(g.positionScreen.z,I,V),oa=Sa(ia,Z,ma,$),B(T,R,j,fa,ca,Y),Ca(T,R,j,fa,ca,Y,oa,0,0,1,0,0,1),B(ea,ga,P,da,la,pa),Ca(ea,ga,P,da,la,pa,oa,1,0,1,1,0,1)}function B(b,
|
|
|
+e,c,f,g,j){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,j);x.lineTo(b,e);x.closePath()}function F(b,e,c,f,g,j,h,k){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,j);x.lineTo(h,k);x.lineTo(b,e);x.closePath()}function H(b,e,c,g){if(E!=e)x.lineWidth=E=e;if(D!=c)x.lineCap=D=c;if(S!=g)x.lineJoin=S=g;f(b);x.stroke();qa.inflate(e*2)}function Ea(b){g(b);x.fill()}function Ca(b,e,c,f,g,j,h,k,m,t,p,n,ja){var o,u;o=h.width-1;u=h.height-1;k*=o;m*=u;t*=o;p*=u;n*=o;ja*=u;c-=b;f-=e;g-=b;j-=e;t-=k;p-=
|
|
|
+m;n-=k;ja-=m;o=t*ja-n*p;if(!((o<0?-o:o)<1))u=1/o,o=(ja*c-p*g)*u,p=(ja*f-p*j)*u,c=(t*g-n*c)*u,f=(t*j-n*f)*u,b=b-o*k-c*m,e=e-p*k-f*m,x.save(),x.transform(o,p,c,f,b,e),x.clip(),x.drawImage(h,0,0),x.restore()}function Sa(b,e,c,f){var g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),n=~~(f.g*255),f=~~(f.b*255);xa[0]=g<0?0:g>255?255:g;xa[1]=j<0?0:j>255?255:j;xa[2]=b<0?0:b>255?255:b;xa[4]=h<0?0:h>255?255:h;xa[5]=k<
|
|
|
+0?0:k>255?255:k;xa[6]=e<0?0:e>255?255:e;xa[8]=m<0?0:m>255?255:m;xa[9]=t<0?0:t>255?255:t;xa[10]=c<0?0:c>255?255:c;xa[12]=p<0?0:p>255?255:p;xa[13]=n<0?0:n>255?255:n;xa[14]=f<0?0:f>255?255:f;Pa.putImageData(Va,0,0);Ra.drawImage(ja,0,0);return Qa}function Ia(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Fa(b,e){var c=e.x-b.x,f=e.y-b.y,g=c*c+f*f;g!=0&&(g=1/Math.sqrt(g),c*=g,f*=g,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ta,C,K,z,Ga,Oa,Ua,ta;this.autoClear?this.clear():
|
|
|
+x.setTransform(1,0,0,-1,u,v);h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,k,this.sortElements);(Ba=b.lights.length>0)&&p(b);Ta=0;for(C=m.length;Ta<C;Ta++){K=m[Ta];qa.empty();if(K instanceof THREE.RenderableParticle){J=K;J.x*=u;J.y*=v;z=0;for(Ga=K.materials.length;z<Ga;)ta=K.materials[z++],ta.opacity!=0&&t(J,K,ta,b)}else if(K instanceof THREE.RenderableLine){if(J=K.v1,G=K.v2,J.positionScreen.x*=u,J.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=v,qa.addPoint(J.positionScreen.x,
|
|
|
+J.positionScreen.y),qa.addPoint(G.positionScreen.x,G.positionScreen.y),sa.instersects(qa)){z=0;for(Ga=K.materials.length;z<Ga;)ta=K.materials[z++],ta.opacity!=0&&y(J,G,K,ta,b)}}else if(K instanceof THREE.RenderableFace3){if(J=K.v1,G=K.v2,U=K.v3,J.positionScreen.x*=u,J.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,K.overdraw&&(Fa(J.positionScreen,G.positionScreen),Fa(G.positionScreen,U.positionScreen),Fa(U.positionScreen,J.positionScreen)),
|
|
|
+qa.add3Points(J.positionScreen.x,J.positionScreen.y,G.positionScreen.x,G.positionScreen.y,U.positionScreen.x,U.positionScreen.y),sa.instersects(qa)){z=0;for(Ga=K.meshMaterials.length;z<Ga;)if(ta=K.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=K.faceMaterials.length;Oa<Ua;)(ta=K.faceMaterials[Oa++])&&ta.opacity!=0&&A(J,G,U,0,1,2,K,ta,b)}else ta.opacity!=0&&A(J,G,U,0,1,2,K,ta,b)}}else if(K instanceof THREE.RenderableFace4&&(J=K.v1,G=K.v2,U=K.v3,W=K.v4,J.positionScreen.x*=u,J.positionScreen.y*=
|
|
|
+v,G.positionScreen.x*=u,G.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,W.positionScreen.x*=u,W.positionScreen.y*=v,M.positionScreen.copy(G.positionScreen),X.positionScreen.copy(W.positionScreen),K.overdraw&&(Fa(J.positionScreen,G.positionScreen),Fa(G.positionScreen,W.positionScreen),Fa(W.positionScreen,J.positionScreen),Fa(U.positionScreen,M.positionScreen),Fa(U.positionScreen,X.positionScreen)),qa.addPoint(J.positionScreen.x,J.positionScreen.y),qa.addPoint(G.positionScreen.x,G.positionScreen.y),
|
|
|
+qa.addPoint(U.positionScreen.x,U.positionScreen.y),qa.addPoint(W.positionScreen.x,W.positionScreen.y),sa.instersects(qa))){z=0;for(Ga=K.meshMaterials.length;z<Ga;)if(ta=K.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=K.faceMaterials.length;Oa<Ua;)(ta=K.faceMaterials[Oa++])&&ta.opacity!=0&&w(J,G,U,W,M,X,K,ta,b)}else ta.opacity!=0&&w(J,G,U,W,M,X,K,ta,b)}ra.addRectangle(qa)}x.setTransform(1,0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function b(b,e,c){var f,g,j,h;f=0;for(g=b.lights.length;f<g;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(j.position)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h)):j instanceof THREE.PointLight&&(W.sub(j.position,e.centroidWorld),W.normalize(),h=e.normalWorld.dot(W)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h))}function c(e,c,j,m,t,n){h.data.vertices+=3;h.data.faces++;T=f(R++);T.setAttribute("d",
|
|
|
"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?E.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?H?(D.r=S.r,D.g=S.g,D.b=S.b,b(n,m,D),E.r=Math.max(0,Math.min(t.color.r*D.r,1)),E.g=Math.max(0,Math.min(t.color.g*D.g,1)),E.b=Math.max(0,Math.min(t.color.b*D.b,1)),E.updateHex()):E.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(U=1-t.__2near/(t.__farPlusNear-
|
|
|
m.z*t.__farMinusNear),E.setRGB(U,U,U)):t instanceof THREE.MeshNormalMaterial&&E.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));t.wireframe?T.setAttribute("style","fill: none; stroke: #"+k(E.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):T.setAttribute("style","fill: #"+k(E.hex.toString(16))+"; fill-opacity: "+t.opacity);p.appendChild(T)}function e(e,c,j,m,
|
|
@@ -292,9 +292,9 @@ j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPT
|
|
|
b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function X(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function T(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
|
|
|
case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;
|
|
|
case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var R=this,j,fa=[],P=null,da=null,ca=!0,Y=null,ea=null,ga=null,la=null,pa=null,N=null,ia=null,Z=0,ma=0,$=0,I=0,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Matrix4,ha=new Float32Array(16),na=new Float32Array(16),wa=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ya=b.stencil!==void 0?b.stencil:!0,Ma=b.antialias!==void 0?b.antialias:!1,qa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),sa=b.clearAlpha!==
|
|
|
-void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;try{if(!(j=va.getContext("experimental-webgl",{antialias:Ma,stencil:ya})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(ra){console.error(ra)}j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);
|
|
|
-j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(qa.r,qa.g,qa.b,sa);this.context=j;var Ba=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ya){var aa={};aa.vertices=new Float32Array(12);aa.faces=new Uint16Array(6);aa.darkness=0.5;aa.vertices[0]=-20;aa.vertices[1]=-20;aa.vertices[2]=-1;aa.vertices[3]=20;aa.vertices[4]=-20;aa.vertices[5]=-1;aa.vertices[6]=20;
|
|
|
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Matrix4,ha=new Float32Array(16),na=new Float32Array(16),wa=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ya=b.stencil!==void 0?b.stencil:!0,Ma=b.antialias!==void 0?b.antialias:!1,sa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ra=b.clearAlpha!==
|
|
|
+void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;try{if(!(j=va.getContext("experimental-webgl",{antialias:Ma,stencil:ya})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(qa){console.error(qa)}j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);
|
|
|
+j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(sa.r,sa.g,sa.b,ra);this.context=j;var Ba=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ya){var aa={};aa.vertices=new Float32Array(12);aa.faces=new Uint16Array(6);aa.darkness=0.5;aa.vertices[0]=-20;aa.vertices[1]=-20;aa.vertices[2]=-1;aa.vertices[3]=20;aa.vertices[4]=-20;aa.vertices[5]=-1;aa.vertices[6]=20;
|
|
|
aa.vertices[7]=20;aa.vertices[8]=-1;aa.vertices[9]=-20;aa.vertices[10]=20;aa.vertices[11]=-1;aa.faces[0]=0;aa.faces[1]=1;aa.faces[2]=2;aa.faces[3]=0;aa.faces[4]=2;aa.faces[5]=3;aa.vertexBuffer=j.createBuffer();aa.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,aa.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,aa.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,aa.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,aa.faces,j.STATIC_DRAW);aa.program=j.createProgram();j.attachShader(aa.program,
|
|
|
M("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(aa.program,M("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(aa.program);aa.vertexLocation=j.getAttribLocation(aa.program,"position");aa.projectionLocation=j.getUniformLocation(aa.program,"projectionMatrix");aa.darknessLocation=j.getUniformLocation(aa.program,"darkness")}var L={};L.vertices=new Float32Array(16);L.faces=new Uint16Array(6);b=0;L.vertices[b++]=-1;L.vertices[b++]=-1;L.vertices[b++]=0;L.vertices[b++]=
|
|
|
0;L.vertices[b++]=1;L.vertices[b++]=-1;L.vertices[b++]=1;L.vertices[b++]=0;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=-1;L.vertices[b++]=1;L.vertices[b++]=0;L.vertices[b++]=1;b=0;L.faces[b++]=0;L.faces[b++]=1;L.faces[b++]=2;L.faces[b++]=0;L.faces[b++]=2;L.faces[b++]=3;L.vertexBuffer=j.createBuffer();L.elementBuffer=j.createBuffer();L.tempTexture=j.createTexture();L.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,L.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
@@ -306,7 +306,7 @@ j.getUniformLocation(L.program,"renderType");L.uniforms.map=j.getUniformLocation
|
|
|
Q.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Q.faces,j.STATIC_DRAW);Q.program=j.createProgram();j.attachShader(Q.program,M("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(Q.program,M("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.position=j.getAttribLocation(Q.program,"position");Q.attributes.uv=j.getAttribLocation(Q.program,"uv");Q.uniforms.uvOffset=
|
|
|
j.getUniformLocation(Q.program,"uvOffset");Q.uniforms.uvScale=j.getUniformLocation(Q.program,"uvScale");Q.uniforms.rotation=j.getUniformLocation(Q.program,"rotation");Q.uniforms.scale=j.getUniformLocation(Q.program,"scale");Q.uniforms.alignment=j.getUniformLocation(Q.program,"alignment");Q.uniforms.map=j.getUniformLocation(Q.program,"map");Q.uniforms.opacity=j.getUniformLocation(Q.program,"opacity");Q.uniforms.useScreenCoordinates=j.getUniformLocation(Q.program,"useScreenCoordinates");Q.uniforms.affectedByDistance=
|
|
|
j.getUniformLocation(Q.program,"affectedByDistance");Q.uniforms.screenPosition=j.getUniformLocation(Q.program,"screenPosition");Q.uniforms.modelViewMatrix=j.getUniformLocation(Q.program,"modelViewMatrix");Q.uniforms.projectionMatrix=j.getUniformLocation(Q.program,"projectionMatrix");var ka=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){Z=b;ma=e;$=c;I=f;j.viewport(Z,ma,$,I)};this.setScissor=function(b,e,c,f){j.scissor(b,
|
|
|
-e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ca=b;j.depthMask(b)};this.setClearColorHex=function(b,e){qa.setHex(b);sa=e;j.clearColor(qa.r,qa.g,qa.b,sa)};this.setClearColor=function(b,e){qa.copy(b);sa=e;j.clearColor(qa.r,qa.g,qa.b,sa)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){aa.darkness=b};this.getContext=function(){return j};
|
|
|
+e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ca=b;j.depthMask(b)};this.setClearColorHex=function(b,e){sa.setHex(b);ra=e;j.clearColor(sa.r,sa.g,sa.b,ra)};this.setClearColor=function(b,e){sa.copy(b);ra=e;j.clearColor(sa.r,sa.g,sa.b,ra)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){aa.darkness=b};this.getContext=function(){return j};
|
|
|
this.initMaterial=function(b,e,c,f){var g,h,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=
|
|
|
THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,o,t;n=t=m=0;for(o=e.length;n<o;n++)h=e[n],h instanceof THREE.DirectionalLight&&t++,h instanceof THREE.PointLight&&m++;m+t<=4?e=t:(e=Math.ceil(4*t/(m+t)),m=4-e);h={directional:e,point:m};t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var p;a:{n=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,
|
|
|
fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:t},u;h=[];k?h.push(k):(h.push(n),h.push(o));for(u in c)h.push(u),h.push(c[u]);k=h.join();u=0;for(h=fa.length;u<h;u++)if(fa[u].code==k){p=fa[u].program;break a}u=j.createProgram();h=[Ba?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+
|
|
@@ -433,8 +433,8 @@ b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1
|
|
|
THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
|
|
|
THREE.CubeGeometry=function(b,c,e,f,g,k,h,m,n){function p(b,c,e,h,m,n,p,t){var u,v,x=f||1,B=g||1,M=m/2,X=n/2,T=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",B=k||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",x=k||1;var R=x+1,j=B+1;m/=x;var fa=n/B;for(v=0;v<j;v++)for(n=0;n<R;n++){var P=new THREE.Vector3;P[b]=(n*m-M)*e;P[c]=(v*fa-X)*h;P[u]=p;o.vertices.push(new THREE.Vertex(P))}for(v=0;v<B;v++)for(n=0;n<x;n++)o.faces.push(new THREE.Face4(n+R*
|
|
|
v+T,n+R*(v+1)+T,n+1+R*(v+1)+T,n+1+R*v+T,null,null,t)),o.faceVertexUvs[0].push([new THREE.UV(n/x,v/B),new THREE.UV(n/x,(v+1)/B),new THREE.UV((n+1)/x,(v+1)/B),new THREE.UV((n+1)/x,v/B)])}THREE.Geometry.call(this);var o=this,t=b/2,u=c/2,v=e/2,m=m?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var B in n)this.sides[B]!=void 0&&(this.sides[B]=
|
|
|
-n[B]);this.sides.px&&p("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,u,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-u,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var h=o.vertices[e],g=!1,k=0,m=b.length;k<m;k++){var n=b[k];if(h.position.x==n.position.x&&
|
|
|
-h.position.y==n.position.y&&h.position.z==n.position.z){c[e]=k;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)h=o.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
+n[B]);this.sides.px&&p("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,u,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-u,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var g=o.vertices[e],h=!1,k=0,m=b.length;k<m;k++){var n=b[k];if(g.position.x==n.position.x&&
|
|
|
+g.position.y==n.position.y&&g.position.z==n.position.z){c[e]=k;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)g=o.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
THREE.CylinderGeometry=function(b,c,e,f,g,k){function h(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)h(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)h(Math.sin(p*n/b)*e,Math.cos(p*n/b)*e,o);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){h(0,0,-o-(k||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){h(0,0,o+
|
|
|
(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],k=this.vertices[e.b],o=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/p,0.5+k.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
|
|
|
f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
@@ -472,14 +472,14 @@ E=void 0,D=void 0,S=void 0,J=void 0,G=void 0,U=void 0,w=u[y[v]].x,H=u[y[v]].y,E=
|
|
|
THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
|
|
|
1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,k=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,k,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[k][0],b[k][1]),new THREE.UV(b[h][0],b[h][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
-THREE.TorusKnotGeometry=function(b,c,e,f,g,k,h){function m(b,c,e,f,h,g){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(h*(2+e)*0.5*Math.cos(b),h*(2+e)*Math.sin(b)*0.5,g*h*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=k||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
+THREE.TorusKnotGeometry=function(b,c,e,f,g,k,h){function m(b,c,e,f,g,h){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,h*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=k||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
this.segmentsT;++c){var n=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=m(n,h,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=n.x-g.x;e.y=n.y-g.y;e.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();n=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=n*f.x+h*k.x;g.y+=n*f.y+h*k.y;g.z+=n*f.z+h*k.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,k));this.faceVertexUvs[0].push([h,n,p,o])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
|
|
|
this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
|
|
|
-new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,k,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
|
|
|
-1)b[e].wrapT=THREE.RepeatWrapping}k&&b[e].offset.set(k[0],k[1]);if(m){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[m[0]]!==void 0)b[e].wrapS=g[m[0]];if(g[m[1]]!==void 0)b[e].wrapT=g[m[1]]}f(b[e],c+"/"+h)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,m,n;m="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
|
|
|
+new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,g,h,k,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=g;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(h[1]!=
|
|
|
+1)b[e].wrapT=THREE.RepeatWrapping}k&&b[e].offset.set(k[0],k[1]);if(m){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[m[0]]!==void 0)b[e].wrapS=h[m[0]];if(h[m[1]]!==void 0)b[e].wrapT=h[m[1]]}f(b[e],c+"/"+g)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,m,n;m="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
|
|
|
if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.colorDiffuse)h.color=k(b.colorDiffuse);
|
|
|
else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=k(b.colorSpecular);if(b.colorAmbient)h.ambient=k(b.colorAmbient);if(b.transparency)h.opacity=b.transparency;if(b.specularCoef)h.shininess=b.specularCoef;b.mapDiffuse&&c&&g(h,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(h,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(h,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
|
|
|
b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(p.uniforms),t=h.color;m=h.specular;n=h.ambient;var u=h.shininess;o.tNormal.texture=h.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(h.map)o.tDiffuse.texture=h.map,o.enableDiffuse.value=!0;if(h.specularMap)o.tSpecular.texture=h.specularMap,o.enableSpecular.value=!0;if(h.lightMap)o.tAO.texture=
|