|
@@ -72,8 +72,8 @@ U}};THREE.Edge=function(b,d,c,f){this.vertices=[b,d];this.vertexIndices=[c,f];th
|
|
|
THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
THREE.Camera.prototype.update=function(b,d,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&this.updateMatrix();if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
|
!1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
|
-THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,d,c){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,d,c){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=d||1;this.distance=c||0};THREE.PointLight.prototype=new THREE.Light;
|
|
|
-THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(b,d,c,f){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;b!==undefined&&this.add(b,d,c,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
|
|
|
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,d,c,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1;this.distance=c||0;this.castShadow=f!==undefined?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,d,c){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=d||1;this.distance=c||0};
|
|
|
+THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(b,d,c,f){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;b!==undefined&&this.add(b,d,c,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.LensFlare.prototype.add=function(b,d,c,f){d===undefined&&(d=-1);c===undefined&&(c=0);if(f===undefined)f=THREE.BillboardBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:b,size:d,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:f})};
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var b,d=this.lensFlares.length,c,f=-this.positionScreen.x*2,g=-this.positionScreen.y*2;for(b=0;b<d;b++){c=this.lensFlares[b];c.x=this.positionScreen.x+f*c.distance;c.y=this.positionScreen.y+g*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation+=(c.wantedRotation-c.rotation)*0.25}};
|
|
|
THREE.Material=function(b){this.id=THREE.MaterialCounter.value++;b=b||{};this.opacity=b.opacity!==undefined?b.opacity:1;this.transparent=b.transparent!==undefined?b.transparent:!1;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==undefined?b.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
|
|
@@ -150,12 +150,12 @@ ca=b();ca.positionScreen.copy(qa[0].position);va.multiplyVector4(ca.positionScre
|
|
|
THREE.Particle){O.set(da.position.x,da.position.y,da.position.z,1);M.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){Ja=B[W]=B[W]||new THREE.RenderableParticle;W++;J=Ja;J.x=O.x/O.w;J.y=O.y/O.w;J.z=O.z;J.rotation=da.rotation.z;J.scale.x=da.scale.x*Math.abs(J.x-(O.x+e.projectionMatrix.n11)/(O.w+e.projectionMatrix.n14));J.scale.y=da.scale.y*Math.abs(J.y-(O.y+e.projectionMatrix.n22)/(O.w+e.projectionMatrix.n24));J.materials=da.materials;Da.push(J)}}}}oa&&Da.sort(d);return Da}};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var m,o,p,t,z,u,A,E;b=d.projectScene(j,k);m=0;for(o=b.length;m<o;m++){z=b[m];if(z instanceof THREE.RenderableParticle){A=z.x*g+g;E=z.y*h+h;p=0;for(t=z.material.length;p<t;p++){u=z.material[p];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=A+"px";u.style.top=E+"px"}}}}}};
|
|
|
THREE.CanvasRenderer=function(){function b(Ga){if(A!=Ga)t.globalAlpha=A=Ga}function d(Ga){if(E!=Ga){switch(Ga){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}E=Ga}}function c(Ga){if(H!=Ga)t.strokeStyle=H=Ga}var f=this,g=null,h=new THREE.Projector,j=document.createElement("canvas"),k,m,o,p,t=j.getContext("2d"),z=new THREE.Color(0),u=0,A=
|
|
|
-1,E=0,H=null,J=null,W=null,B=null,U=null,O,M,va,la,pa=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ha,e,oa,Da,Aa,ia,fa,wa,ta,qa,ca,ka,ma=new THREE.Color,Fa=new THREE.Color,ja=new THREE.Color,da=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,R,S,P,Ba,La,n,C,w=new THREE.Rectangle,x=new THREE.Rectangle,y=new THREE.Rectangle,Q=!1,K=new THREE.Color,F=new THREE.Color,T=new THREE.Color,G=new THREE.Color,I=new THREE.Vector3,L,Z,Y,ra,Ka,Ca,Ha=16;L=document.createElement("canvas");L.width=L.height=
|
|
|
-2;Z=L.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Y=Z.getImageData(0,0,2,2);ra=Y.data;Ka=document.createElement("canvas");Ka.width=Ka.height=Ha;Ca=Ka.getContext("2d");Ca.translate(-Ha/2,-Ha/2);Ca.scale(Ha,Ha);Ha--;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function(Ga,xa){k=Ga;m=xa;o=k/2;p=m/2;j.width=k;j.height=m;w.set(-o,-p,o,p);A=1;E=0;U=B=W=J=H=null};this.setClearColor=function(Ga,xa){z=Ga;u=xa};
|
|
|
-this.setClearColorHex=function(Ga,xa){z.setHex(Ga);u=xa};this.clear=function(){t.setTransform(1,0,0,-1,o,p);if(!x.isEmpty()){x.inflate(1);x.minSelf(w);if(z.hex==0&&u==0)t.clearRect(x.getX(),x.getY(),x.getWidth(),x.getHeight());else{d(THREE.NormalBlending);b(1);t.fillStyle="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+u+")";t.fillRect(x.getX(),x.getY(),x.getWidth(),x.getHeight())}x.empty()}};this.render=function(Ga,xa){function Ea(V){var na,ea,$,ua=V.lights;F.setRGB(0,
|
|
|
+1,E=0,H=null,J=null,W=null,B=null,U=null,O,M,va,la,pa=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ha,e,oa,Da,Aa,ia,fa,wa,ta,qa,ca,ka,ma=new THREE.Color,Fa=new THREE.Color,ja=new THREE.Color,da=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,R,S,P,Ba,La,n,C,x=new THREE.Rectangle,w=new THREE.Rectangle,y=new THREE.Rectangle,Q=!1,K=new THREE.Color,F=new THREE.Color,T=new THREE.Color,G=new THREE.Color,I=new THREE.Vector3,L,Z,Y,ra,Ka,Ca,Ha=16;L=document.createElement("canvas");L.width=L.height=
|
|
|
+2;Z=L.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Y=Z.getImageData(0,0,2,2);ra=Y.data;Ka=document.createElement("canvas");Ka.width=Ka.height=Ha;Ca=Ka.getContext("2d");Ca.translate(-Ha/2,-Ha/2);Ca.scale(Ha,Ha);Ha--;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function(Ga,xa){k=Ga;m=xa;o=k/2;p=m/2;j.width=k;j.height=m;x.set(-o,-p,o,p);A=1;E=0;U=B=W=J=H=null};this.setClearColor=function(Ga,xa){z=Ga;u=xa};
|
|
|
+this.setClearColorHex=function(Ga,xa){z.setHex(Ga);u=xa};this.clear=function(){t.setTransform(1,0,0,-1,o,p);if(!w.isEmpty()){w.inflate(1);w.minSelf(x);if(z.hex==0&&u==0)t.clearRect(w.getX(),w.getY(),w.getWidth(),w.getHeight());else{d(THREE.NormalBlending);b(1);t.fillStyle="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+u+")";t.fillRect(w.getX(),w.getY(),w.getWidth(),w.getHeight())}w.empty()}};this.render=function(Ga,xa){function Ea(V){var na,ea,$,ua=V.lights;F.setRGB(0,
|
|
|
0,0);T.setRGB(0,0,0);G.setRGB(0,0,0);V=0;for(na=ua.length;V<na;V++){ea=ua[V];$=ea.color;if(ea instanceof THREE.AmbientLight){F.r+=$.r;F.g+=$.g;F.b+=$.b}else if(ea instanceof THREE.DirectionalLight){T.r+=$.r;T.g+=$.g;T.b+=$.b}else if(ea instanceof THREE.PointLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}}}function za(V,na,ea,$){var ua,sa,ya,X,Ia=V.lights;V=0;for(ua=Ia.length;V<ua;V++){sa=Ia[V];ya=sa.color;if(sa instanceof THREE.DirectionalLight){X=ea.dot(sa.position);if(!(X<=0)){X*=sa.intensity;$.r+=ya.r*X;$.g+=
|
|
|
ya.g*X;$.b+=ya.b*X}}else if(sa instanceof THREE.PointLight){X=ea.dot(I.sub(sa.position,na).normalize());if(!(X<=0)){X*=sa.distance==0?1:1-Math.min(na.distanceTo(sa.position)/sa.distance,1);if(X!=0){X*=sa.intensity;$.r+=ya.r*X;$.g+=ya.g*X;$.b+=ya.b*X}}}}}function Ua(V,na,ea){b(ea.opacity);d(ea.blending);var $,ua,sa,ya,X,Ia;if(ea instanceof THREE.ParticleBasicMaterial){if(ea.map){ya=ea.map.image;X=ya.width>>1;Ia=ya.height>>1;ea=na.scale.x*o;sa=na.scale.y*p;$=ea*X;ua=sa*Ia;y.set(V.x-$,V.y-ua,V.x+$,V.y+
|
|
|
-ua);if(w.instersects(y)){t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale(ea,-sa);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ua=na.scale.y*p;y.set(V.x-$,V.y-ua,V.x+$,V.y+ua);if(w.instersects(y)){c(ea.color.__styleString);sa=ea.color.__styleString;if(J!=sa)t.fillStyle=J=sa;t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale($,ua);ea.program(t);t.restore()}}}function D(V,na,ea,$){b($.opacity);d($.blending);
|
|
|
+ua);if(x.instersects(y)){t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale(ea,-sa);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ua=na.scale.y*p;y.set(V.x-$,V.y-ua,V.x+$,V.y+ua);if(x.instersects(y)){c(ea.color.__styleString);sa=ea.color.__styleString;if(J!=sa)t.fillStyle=J=sa;t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale($,ua);ea.program(t);t.restore()}}}function D(V,na,ea,$){b($.opacity);d($.blending);
|
|
|
t.beginPath();t.moveTo(V.positionScreen.x,V.positionScreen.y);t.lineTo(na.positionScreen.x,na.positionScreen.y);t.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;V=$.linewidth;if(W!=V)t.lineWidth=W=V;V=$.linecap;if(B!=V)t.lineCap=B=V;V=$.linejoin;if(U!=V)t.lineJoin=U=V;c(ma.__styleString);t.stroke();y.inflate($.linewidth*2)}}function aa(V,na,ea,$,ua,sa,ya,X,Ia){f.data.vertices+=3;f.data.faces++;b(X.opacity);d(X.blending);ha=V.positionScreen.x;e=V.positionScreen.y;
|
|
|
oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ea.positionScreen.x;ia=ea.positionScreen.y;ab(ha,e,oa,Da,Aa,ia);if(X instanceof THREE.MeshBasicMaterial)if(X.map){if(X.map.mapping instanceof THREE.UVMapping){R=ya.uvs[0];cb(ha,e,oa,Da,Aa,ia,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}}else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){V=xa.matrixWorldInverse;I.copy(ya.vertexNormalsWorld[0]);S=(I.x*V.n11+I.y*V.n12+I.z*V.n13)*0.5+0.5;P=-(I.x*V.n21+I.y*V.n22+
|
|
|
I.z*V.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[1]);Ba=(I.x*V.n11+I.y*V.n12+I.z*V.n13)*0.5+0.5;La=-(I.x*V.n21+I.y*V.n22+I.z*V.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[2]);n=(I.x*V.n11+I.y*V.n12+I.z*V.n13)*0.5+0.5;C=-(I.x*V.n21+I.y*V.n22+I.z*V.n23)*0.5+0.5;cb(ha,e,oa,Da,Aa,ia,X.envMap.image,S,P,Ba,La,n,C)}}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){if(X.map.mapping instanceof
|
|
@@ -171,10 +171,10 @@ $);t.lineTo(ua,sa);t.lineTo(ya,X);t.lineTo(V,na);t.closePath()}function Oa(V,na,
|
|
|
Sa*ea)*db;$=(Ya*sa-Sa*$)*db;V=V-gb*X-ea*Ia;na=na-eb*X-$*Ia;t.save();t.transform(gb,eb,ea,$,V,na);t.clip();t.drawImage(ya,0,0);t.restore()}}function hb(V,na,ea,$){var ua=~~(V.r*255),sa=~~(V.g*255);V=~~(V.b*255);var ya=~~(na.r*255),X=~~(na.g*255);na=~~(na.b*255);var Ia=~~(ea.r*255),Ya=~~(ea.g*255);ea=~~(ea.b*255);var eb=~~($.r*255),Sa=~~($.g*255);$=~~($.b*255);ra[0]=ua<0?0:ua>255?255:ua;ra[1]=sa<0?0:sa>255?255:sa;ra[2]=V<0?0:V>255?255:V;ra[4]=ya<0?0:ya>255?255:ya;ra[5]=X<0?0:X>255?255:X;ra[6]=na<0?
|
|
|
0:na>255?255:na;ra[8]=Ia<0?0:Ia>255?255:Ia;ra[9]=Ya<0?0:Ya>255?255:Ya;ra[10]=ea<0?0:ea>255?255:ea;ra[12]=eb<0?0:eb>255?255:eb;ra[13]=Sa<0?0:Sa>255?255:Sa;ra[14]=$<0?0:$>255?255:$;Z.putImageData(Y,0,0);Ca.drawImage(L,0,0);return Ka}function Wa(V,na,ea){V=(V-na)/(ea-na);return V*V*(3-2*V)}function $a(V){V=(V+1)*0.5;return V<0?0:V>1?1:V}function Ma(V,na){var ea=na.x-V.x,$=na.y-V.y,ua=1/Math.sqrt(ea*ea+$*$);ea*=ua;$*=ua;na.x+=ea;na.y+=$;V.x-=ea;V.y-=$}var bb,Va,N,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
|
|
|
t.setTransform(1,0,0,-1,o,p);f.data.vertices=0;f.data.faces=0;g=h.projectScene(Ga,xa,this.sortElements);(Q=Ga.lights.length>0)&&Ea(Ga);bb=0;for(Va=g.length;bb<Va;bb++){N=g[bb];y.empty();if(N instanceof THREE.RenderableParticle){O=N;O.x*=o;O.y*=p;Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&Ua(O,N,Pa,Ga)}}else if(N instanceof THREE.RenderableLine){O=N.v1;M=N.v2;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;y.addPoint(O.positionScreen.x,
|
|
|
-O.positionScreen.y);y.addPoint(M.positionScreen.x,M.positionScreen.y);if(w.instersects(y)){Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&D(O,M,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace3){O=N.v1;M=N.v2;va=N.v3;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,va.positionScreen);Ma(va.positionScreen,O.positionScreen)}y.add3Points(O.positionScreen.x,
|
|
|
-O.positionScreen.y,M.positionScreen.x,M.positionScreen.y,va.positionScreen.x,va.positionScreen.y);if(w.instersects(y)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}else Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace4){O=N.v1;M=N.v2;va=N.v3;la=N.v4;O.positionScreen.x*=o;O.positionScreen.y*=
|
|
|
+O.positionScreen.y);y.addPoint(M.positionScreen.x,M.positionScreen.y);if(x.instersects(y)){Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&D(O,M,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace3){O=N.v1;M=N.v2;va=N.v3;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,va.positionScreen);Ma(va.positionScreen,O.positionScreen)}y.add3Points(O.positionScreen.x,
|
|
|
+O.positionScreen.y,M.positionScreen.x,M.positionScreen.y,va.positionScreen.x,va.positionScreen.y);if(x.instersects(y)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}else Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace4){O=N.v1;M=N.v2;va=N.v3;la=N.v4;O.positionScreen.x*=o;O.positionScreen.y*=
|
|
|
p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;la.positionScreen.x*=o;la.positionScreen.y*=p;pa.positionScreen.copy(M.positionScreen);ga.positionScreen.copy(la.positionScreen);if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,la.positionScreen);Ma(la.positionScreen,O.positionScreen);Ma(va.positionScreen,pa.positionScreen);Ma(va.positionScreen,ga.positionScreen)}y.addPoint(O.positionScreen.x,O.positionScreen.y);y.addPoint(M.positionScreen.x,
|
|
|
-M.positionScreen.y);y.addPoint(va.positionScreen.x,va.positionScreen.y);y.addPoint(la.positionScreen.x,la.positionScreen.y);if(w.instersects(y)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&v(O,M,va,la,pa,ga,N,Pa,Ga)}else Pa.opacity!=0&&v(O,M,va,la,pa,ga,N,Pa,Ga)}}}x.addRectangle(y)}t.setTransform(1,0,0,1,0,0)}};
|
|
|
+M.positionScreen.y);y.addPoint(va.positionScreen.x,va.positionScreen.y);y.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(y)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&v(O,M,va,la,pa,ga,N,Pa,Ga)}else Pa.opacity!=0&&v(O,M,va,la,pa,ga,N,Pa,Ga)}}}w.addRectangle(y)}t.setTransform(1,0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function b(fa,wa,ta){var qa,ca,ka,ma;qa=0;for(ca=fa.lights.length;qa<ca;qa++){ka=fa.lights[qa];if(ka instanceof THREE.DirectionalLight){ma=wa.normalWorld.dot(ka.position)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}else if(ka instanceof THREE.PointLight){ga.sub(ka.position,wa.centroidWorld);ga.normalize();ma=wa.normalWorld.dot(ga)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}}}function d(fa,wa,
|
|
|
ta,qa,ca,ka){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)U.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(B){O.r=M.r;O.g=M.g;O.b=M.b;b(ka,qa,O);U.r=ca.color.r*O.r;U.g=ca.color.g*O.g;U.b=ca.color.b*O.b;U.updateStyleString()}else U.__styleString=
|
|
|
ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){pa=1-ca.__2near/(ca.__farPlusNear-qa.z*ca.__farMinusNear);U.setRGB(pa,pa,pa)}else ca instanceof THREE.MeshNormalMaterial&&U.setRGB(g(qa.normalWorld.x),g(qa.normalWorld.y),g(qa.normalWorld.z));ca.wireframe?oa.setAttribute("style","fill: none; stroke: "+U.__styleString+"; stroke-width: "+ca.wireframeLinewidth+"; stroke-opacity: "+ca.opacity+"; stroke-linecap: "+ca.wireframeLinecap+"; stroke-linejoin: "+ca.wireframeLinejoin):oa.setAttribute("style",
|
|
@@ -219,81 +219,81 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
|
|
|
"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
|
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
|
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
|
-THREE.WebGLRenderer=function(b){function d(n,C,w){var x,y,Q,K=n.vertices,F=K.length,T=n.colors,G=T.length,I=n.__vertexArray,L=n.__colorArray,Z=n.__sortArray,Y=n.__dirtyVertices,ra=n.__dirtyColors;if(w.sortParticles){Ja.multiplySelf(w.matrixWorld);for(x=0;x<F;x++){y=K[x].position;Ta.copy(y);Ja.multiplyVector3(Ta);Z[x]=[Ta.z,x]}Z.sort(function(Ka,Ca){return Ca[0]-Ka[0]});for(x=0;x<F;x++){y=K[Z[x][1]].position;Q=x*3;I[Q]=y.x;I[Q+1]=y.y;I[Q+2]=y.z}for(x=0;x<G;x++){Q=x*3;color=T[Z[x][1]];L[Q]=color.r;
|
|
|
-L[Q+1]=color.g;L[Q+2]=color.b}}else{if(Y)for(x=0;x<F;x++){y=K[x].position;Q=x*3;I[Q]=y.x;I[Q+1]=y.y;I[Q+2]=y.z}if(ra)for(x=0;x<G;x++){color=T[x];Q=x*3;L[Q]=color.r;L[Q+1]=color.g;L[Q+2]=color.b}}if(Y||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,C)}if(ra||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}function c(n,C,w,x,y){x.program||ha.initMaterial(x,C,w,y);var Q=x.program,K=Q.uniforms,F=x.uniforms;
|
|
|
-if(Q!=Aa){e.useProgram(Q);Aa=Q}e.uniformMatrix4fv(K.projectionMatrix,!1,Xa);if(w&&(x instanceof THREE.MeshBasicMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial||x instanceof THREE.LineBasicMaterial||x instanceof THREE.ParticleBasicMaterial||x.fog)){F.fogColor.value=w.color;if(w instanceof THREE.Fog){F.fogNear.value=w.near;F.fogFar.value=w.far}else if(w instanceof THREE.FogExp2)F.fogDensity.value=w.density}if(x instanceof THREE.MeshPhongMaterial||x instanceof THREE.MeshLambertMaterial||
|
|
|
-x.lights){var T,G,I=0,L=0,Z=0,Y,ra,Ka,Ca,Ha=R,Ga=Ha.directional.colors,xa=Ha.directional.positions,Ea=Ha.point.colors,za=Ha.point.positions,Ua=Ha.point.distances,D=0,aa=0;w=G=Ca=0;for(T=C.length;w<T;w++){G=C[w];Y=G.color;ra=G.position;Ka=G.intensity;Ca=G.distance;if(G instanceof THREE.AmbientLight){I+=Y.r;L+=Y.g;Z+=Y.b}else if(G instanceof THREE.DirectionalLight){Ca=D*3;Ga[Ca]=Y.r*Ka;Ga[Ca+1]=Y.g*Ka;Ga[Ca+2]=Y.b*Ka;xa[Ca]=ra.x;xa[Ca+1]=ra.y;xa[Ca+2]=ra.z;D+=1}else if(G instanceof THREE.PointLight){G=
|
|
|
-aa*3;Ea[G]=Y.r*Ka;Ea[G+1]=Y.g*Ka;Ea[G+2]=Y.b*Ka;za[G]=ra.x;za[G+1]=ra.y;za[G+2]=ra.z;Ua[aa]=Ca;aa+=1}}for(w=D*3;w<Ga.length;w++)Ga[w]=0;for(w=aa*3;w<Ea.length;w++)Ea[w]=0;Ha.point.length=aa;Ha.directional.length=D;Ha.ambient[0]=I;Ha.ambient[1]=L;Ha.ambient[2]=Z;w=R;F.enableLighting.value=w.directional.length+w.point.length;F.ambientLightColor.value=w.ambient;F.directionalLightColor.value=w.directional.colors;F.directionalLightDirection.value=w.directional.positions;F.pointLightColor.value=w.point.colors;
|
|
|
-F.pointLightPosition.value=w.point.positions;F.pointLightDistance.value=w.point.distances}if(x instanceof THREE.MeshBasicMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial){F.diffuse.value=x.color;F.opacity.value=x.opacity;F.map.texture=x.map;F.lightMap.texture=x.lightMap;F.envMap.texture=x.envMap;F.reflectivity.value=x.reflectivity;F.refractionRatio.value=x.refractionRatio;F.combine.value=x.combine;F.useRefract.value=x.envMap&&x.envMap.mapping instanceof THREE.CubeRefractionMapping}if(x instanceof
|
|
|
-THREE.LineBasicMaterial){F.diffuse.value=x.color;F.opacity.value=x.opacity}else if(x instanceof THREE.ParticleBasicMaterial){F.psColor.value=x.color;F.opacity.value=x.opacity;F.size.value=x.size;F.scale.value=oa.height/2;F.map.texture=x.map}else if(x instanceof THREE.MeshPhongMaterial){F.ambient.value=x.ambient;F.specular.value=x.specular;F.shininess.value=x.shininess}else if(x instanceof THREE.MeshDepthMaterial){F.mNear.value=n.near;F.mFar.value=n.far;F.opacity.value=x.opacity}else if(x instanceof
|
|
|
-THREE.MeshNormalMaterial)F.opacity.value=x.opacity;for(var v in F)if(L=Q.uniforms[v]){T=F[v];I=T.type;w=T.value;if(I=="i")e.uniform1i(L,w);else if(I=="f")e.uniform1f(L,w);else if(I=="fv1")e.uniform1fv(L,w);else if(I=="fv")e.uniform3fv(L,w);else if(I=="v2")e.uniform2f(L,w.x,w.y);else if(I=="v3")e.uniform3f(L,w.x,w.y,w.z);else if(I=="v4")e.uniform4f(L,w.x,w.y,w.z,w.w);else if(I=="c")e.uniform3f(L,w.r,w.g,w.b);else if(I=="t"){e.uniform1i(L,w);if(T=T.texture)if(T.image instanceof Array&&T.image.length==
|
|
|
+THREE.WebGLRenderer=function(b){function d(n,C,x){var w,y,Q,K=n.vertices,F=K.length,T=n.colors,G=T.length,I=n.__vertexArray,L=n.__colorArray,Z=n.__sortArray,Y=n.__dirtyVertices,ra=n.__dirtyColors;if(x.sortParticles){Ja.multiplySelf(x.matrixWorld);for(w=0;w<F;w++){y=K[w].position;Ta.copy(y);Ja.multiplyVector3(Ta);Z[w]=[Ta.z,w]}Z.sort(function(Ka,Ca){return Ca[0]-Ka[0]});for(w=0;w<F;w++){y=K[Z[w][1]].position;Q=w*3;I[Q]=y.x;I[Q+1]=y.y;I[Q+2]=y.z}for(w=0;w<G;w++){Q=w*3;color=T[Z[w][1]];L[Q]=color.r;
|
|
|
+L[Q+1]=color.g;L[Q+2]=color.b}}else{if(Y)for(w=0;w<F;w++){y=K[w].position;Q=w*3;I[Q]=y.x;I[Q+1]=y.y;I[Q+2]=y.z}if(ra)for(w=0;w<G;w++){color=T[w];Q=w*3;L[Q]=color.r;L[Q+1]=color.g;L[Q+2]=color.b}}if(Y||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,C)}if(ra||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}function c(n,C,x,w,y){w.program||ha.initMaterial(w,C,x,y);var Q=w.program,K=Q.uniforms,F=w.uniforms;
|
|
|
+if(Q!=Aa){e.useProgram(Q);Aa=Q}e.uniformMatrix4fv(K.projectionMatrix,!1,Xa);if(x&&(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial||w instanceof THREE.LineBasicMaterial||w instanceof THREE.ParticleBasicMaterial||w.fog)){F.fogColor.value=x.color;if(x instanceof THREE.Fog){F.fogNear.value=x.near;F.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)F.fogDensity.value=x.density}if(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||
|
|
|
+w.lights){var T,G,I=0,L=0,Z=0,Y,ra,Ka,Ca,Ha=R,Ga=Ha.directional.colors,xa=Ha.directional.positions,Ea=Ha.point.colors,za=Ha.point.positions,Ua=Ha.point.distances,D=0,aa=0;x=G=Ca=0;for(T=C.length;x<T;x++){G=C[x];Y=G.color;ra=G.position;Ka=G.intensity;Ca=G.distance;if(G instanceof THREE.AmbientLight){I+=Y.r;L+=Y.g;Z+=Y.b}else if(G instanceof THREE.DirectionalLight){Ca=D*3;Ga[Ca]=Y.r*Ka;Ga[Ca+1]=Y.g*Ka;Ga[Ca+2]=Y.b*Ka;xa[Ca]=ra.x;xa[Ca+1]=ra.y;xa[Ca+2]=ra.z;D+=1}else if(G instanceof THREE.PointLight){G=
|
|
|
+aa*3;Ea[G]=Y.r*Ka;Ea[G+1]=Y.g*Ka;Ea[G+2]=Y.b*Ka;za[G]=ra.x;za[G+1]=ra.y;za[G+2]=ra.z;Ua[aa]=Ca;aa+=1}}for(x=D*3;x<Ga.length;x++)Ga[x]=0;for(x=aa*3;x<Ea.length;x++)Ea[x]=0;Ha.point.length=aa;Ha.directional.length=D;Ha.ambient[0]=I;Ha.ambient[1]=L;Ha.ambient[2]=Z;x=R;F.enableLighting.value=x.directional.length+x.point.length;F.ambientLightColor.value=x.ambient;F.directionalLightColor.value=x.directional.colors;F.directionalLightDirection.value=x.directional.positions;F.pointLightColor.value=x.point.colors;
|
|
|
+F.pointLightPosition.value=x.point.positions;F.pointLightDistance.value=x.point.distances}if(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial){F.diffuse.value=w.color;F.opacity.value=w.opacity;F.map.texture=w.map;F.lightMap.texture=w.lightMap;F.envMap.texture=w.envMap;F.reflectivity.value=w.reflectivity;F.refractionRatio.value=w.refractionRatio;F.combine.value=w.combine;F.useRefract.value=w.envMap&&w.envMap.mapping instanceof THREE.CubeRefractionMapping}if(w instanceof
|
|
|
+THREE.LineBasicMaterial){F.diffuse.value=w.color;F.opacity.value=w.opacity}else if(w instanceof THREE.ParticleBasicMaterial){F.psColor.value=w.color;F.opacity.value=w.opacity;F.size.value=w.size;F.scale.value=oa.height/2;F.map.texture=w.map}else if(w instanceof THREE.MeshPhongMaterial){F.ambient.value=w.ambient;F.specular.value=w.specular;F.shininess.value=w.shininess}else if(w instanceof THREE.MeshDepthMaterial){F.mNear.value=n.near;F.mFar.value=n.far;F.opacity.value=w.opacity}else if(w instanceof
|
|
|
+THREE.MeshNormalMaterial)F.opacity.value=w.opacity;for(var v in F)if(L=Q.uniforms[v]){T=F[v];I=T.type;x=T.value;if(I=="i")e.uniform1i(L,x);else if(I=="f")e.uniform1f(L,x);else if(I=="fv1")e.uniform1fv(L,x);else if(I=="fv")e.uniform3fv(L,x);else if(I=="v2")e.uniform2f(L,x.x,x.y);else if(I=="v3")e.uniform3f(L,x.x,x.y,x.z);else if(I=="v4")e.uniform4f(L,x.x,x.y,x.z,x.w);else if(I=="c")e.uniform3f(L,x.r,x.g,x.b);else if(I=="t"){e.uniform1i(L,x);if(T=T.texture)if(T.image instanceof Array&&T.image.length==
|
|
|
6){if(T.image.length==6){if(T.needsUpdate){if(T.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube);for(I=0;I<6;++I)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,e.RGBA,e.UNSIGNED_BYTE,T.image[I])}else{T.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube);for(I=0;I<6;++I)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,T.image[I]);T.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,T,T.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
|
|
|
-null);T.needsUpdate=!1}e.activeTexture(e.TEXTURE0+w);e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube)}}else M(T,w)}}e.uniformMatrix4fv(K.modelViewMatrix,!1,y._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,!1,y._normalMatrixArray);(x instanceof THREE.MeshShaderMaterial||x instanceof THREE.MeshPhongMaterial||x.envMap)&&e.uniform3f(K.cameraPosition,n.position.x,n.position.y,n.position.z);(x instanceof THREE.MeshShaderMaterial||x.envMap||x.skinning)&&e.uniformMatrix4fv(K.objectMatrix,
|
|
|
-!1,y._objectMatrixArray);(x instanceof THREE.MeshPhongMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshShaderMaterial||x.skinning)&&e.uniformMatrix4fv(K.viewMatrix,!1,Za);if(x instanceof THREE.ShadowVolumeDynamicMaterial){n=F.directionalLightDirection.value;n[0]=-C[1].position.x;n[1]=-C[1].position.y;n[2]=-C[1].position.z;e.uniform3fv(K.directionalLightDirection,n);e.uniformMatrix4fv(K.objectMatrix,!1,y._objectMatrixArray);e.uniformMatrix4fv(K.viewMatrix,!1,Za)}if(x.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,
|
|
|
-!1,Za);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,y.boneMatrices)}return Q}function f(n,C,w,x,y,Q){if(x.opacity!=0){var K;n=c(n,C,w,x,Q).attributes;if(x.morphTargets){C=x.program.attributes;Q.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[Q.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,y.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(Q.morphTargetForcedOrder.length){w=0;for(var F=Q.morphTargetForcedOrder,T=Q.morphTargetInfluences;w<x.numSupportedMorphTargets&&
|
|
|
-w<F.length;){e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[F[w]]);e.vertexAttribPointer(C["morphTarget"+w],3,e.FLOAT,!1,0,0);Q.__webglMorphTargetInfluences[w]=T[F[w]];w++}}else{F=[];var G=-1,I=0;T=Q.morphTargetInfluences;var L,Z=T.length;w=0;for(Q.morphTargetBase!==-1&&(F[Q.morphTargetBase]=!0);w<x.numSupportedMorphTargets;){for(L=0;L<Z;L++)if(!F[L]&&T[L]>G){I=L;G=T[I]}e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[I]);e.vertexAttribPointer(C["morphTarget"+w],3,e.FLOAT,!1,0,0);
|
|
|
-Q.__webglMorphTargetInfluences[w]=G;F[I]=1;G=-1;w++}}e.uniform1fv(x.program.uniforms.morphTargetInfluences,Q.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,y.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}if(y.__webglCustomAttributes)for(K in y.__webglCustomAttributes)if(n[K]>=0){C=y.__webglCustomAttributes[K];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(n[K],C.size,e.FLOAT,!1,0,0)}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglColorBuffer);
|
|
|
+null);T.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube)}}else M(T,x)}}e.uniformMatrix4fv(K.modelViewMatrix,!1,y._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,!1,y._normalMatrixArray);(w instanceof THREE.MeshShaderMaterial||w instanceof THREE.MeshPhongMaterial||w.envMap)&&e.uniform3f(K.cameraPosition,n.position.x,n.position.y,n.position.z);(w instanceof THREE.MeshShaderMaterial||w.envMap||w.skinning)&&e.uniformMatrix4fv(K.objectMatrix,
|
|
|
+!1,y._objectMatrixArray);(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshShaderMaterial||w.skinning)&&e.uniformMatrix4fv(K.viewMatrix,!1,Za);if(w instanceof THREE.ShadowVolumeDynamicMaterial){n=F.directionalLightDirection.value;n[0]=-C[1].position.x;n[1]=-C[1].position.y;n[2]=-C[1].position.z;e.uniform3fv(K.directionalLightDirection,n);e.uniformMatrix4fv(K.objectMatrix,!1,y._objectMatrixArray);e.uniformMatrix4fv(K.viewMatrix,!1,Za)}if(w.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,
|
|
|
+!1,Za);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,y.boneMatrices)}return Q}function f(n,C,x,w,y,Q){if(w.opacity!=0){var K;n=c(n,C,x,w,Q).attributes;if(w.morphTargets){C=w.program.attributes;Q.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[Q.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,y.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(Q.morphTargetForcedOrder.length){x=0;for(var F=Q.morphTargetForcedOrder,T=Q.morphTargetInfluences;x<w.numSupportedMorphTargets&&
|
|
|
+x<F.length;){e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[F[x]]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);Q.__webglMorphTargetInfluences[x]=T[F[x]];x++}}else{F=[];var G=-1,I=0;T=Q.morphTargetInfluences;var L,Z=T.length;x=0;for(Q.morphTargetBase!==-1&&(F[Q.morphTargetBase]=!0);x<w.numSupportedMorphTargets;){for(L=0;L<Z;L++)if(!F[L]&&T[L]>G){I=L;G=T[I]}e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[I]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);
|
|
|
+Q.__webglMorphTargetInfluences[x]=G;F[I]=1;G=-1;x++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,Q.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,y.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}if(y.__webglCustomAttributes)for(K in y.__webglCustomAttributes)if(n[K]>=0){C=y.__webglCustomAttributes[K];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(n[K],C.size,e.FLOAT,!1,0,0)}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglColorBuffer);
|
|
|
e.vertexAttribPointer(n.color,3,e.FLOAT,!1,0,0)}if(n.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglNormalBuffer);e.vertexAttribPointer(n.normal,3,e.FLOAT,!1,0,0)}if(n.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglTangentBuffer);e.vertexAttribPointer(n.tangent,4,e.FLOAT,!1,0,0)}if(n.uv>=0)if(y.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,y.__webglUVBuffer);e.vertexAttribPointer(n.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv)}else e.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(y.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-y.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv2)}else e.disableVertexAttribArray(n.uv2);if(x.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex,
|
|
|
-4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(Q instanceof THREE.Mesh){if(x.wireframe){e.lineWidth(x.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webglLineBuffer);e.drawElements(e.LINES,y.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webglFaceBuffer);e.drawElements(e.TRIANGLES,y.__webglFaceCount,e.UNSIGNED_SHORT,0)}ha.data.vertices+=y.__webglFaceCount;ha.data.faces+=
|
|
|
-y.__webglFaceCount/3}else if(Q instanceof THREE.Line){Q=Q.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(x.linewidth);e.drawArrays(Q,0,y.__webglLineCount)}else if(Q instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,y.__webglParticleCount);else Q instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,y.__webglVertexCount)}}function g(n,C,w){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(w==THREE.FlatShading){var x,y,Q,K,F,T,G,I,L,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){w=n.normalArray;x=w[Z];y=w[Z+1];Q=w[Z+2];K=w[Z+3];T=w[Z+4];I=w[Z+5];F=w[Z+6];G=w[Z+7];L=w[Z+8];x=(x+K+F)/3;y=(y+T+G)/3;Q=(Q+I+L)/3;w[Z]=x;w[Z+1]=y;w[Z+2]=Q;w[Z+3]=
|
|
|
-x;w[Z+4]=y;w[Z+5]=Q;w[Z+6]=x;w[Z+7]=y;w[Z+8]=Q}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}function h(n){if(wa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);wa=n.doubleSided}if(ta!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=n.flipSided}}function j(n){if(ca!=n){n?e.enable(e.DEPTH_TEST):
|
|
|
+y.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv2)}else e.disableVertexAttribArray(n.uv2);if(w.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex,
|
|
|
+4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(Q instanceof THREE.Mesh){if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webglLineBuffer);e.drawElements(e.LINES,y.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webglFaceBuffer);e.drawElements(e.TRIANGLES,y.__webglFaceCount,e.UNSIGNED_SHORT,0)}ha.data.vertices+=y.__webglFaceCount;ha.data.faces+=
|
|
|
+y.__webglFaceCount/3}else if(Q instanceof THREE.Line){Q=Q.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(Q,0,y.__webglLineCount)}else if(Q instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,y.__webglParticleCount);else Q instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,y.__webglVertexCount)}}function g(n,C,x){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
+n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(x==THREE.FlatShading){var w,y,Q,K,F,T,G,I,L,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){x=n.normalArray;w=x[Z];y=x[Z+1];Q=x[Z+2];K=x[Z+3];T=x[Z+4];I=x[Z+5];F=x[Z+6];G=x[Z+7];L=x[Z+8];w=(w+K+F)/3;y=(y+T+G)/3;Q=(Q+I+L)/3;x[Z]=w;x[Z+1]=y;x[Z+2]=Q;x[Z+3]=
|
|
|
+w;x[Z+4]=y;x[Z+5]=Q;x[Z+6]=w;x[Z+7]=y;x[Z+8]=Q}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}function h(n){if(wa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);wa=n.doubleSided}if(ta!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=n.flipSided}}function j(n){if(ca!=n){n?e.enable(e.DEPTH_TEST):
|
|
|
e.disable(e.DEPTH_TEST);ca=n}}function k(n){da[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);da[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);da[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);da[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);da[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);da[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var C;for(n=0;n<6;n++){C=da[n];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function m(n){for(var C=
|
|
|
-n.matrixWorld,w=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),x=0;x<6;x++){n=da[x].x*C.n14+da[x].y*C.n24+da[x].z*C.n34+da[x].w;if(n<=w)return!1}return!0}function o(n,C){n.list[n.count]=C;n.count+=1}function p(n){var C,w,x=n.object,y=n.opaque,Q=n.transparent;Q.count=0;n=y.count=0;for(C=x.materials.length;n<C;n++){w=x.materials[n];w.transparent?o(Q,w):o(y,w)}}function t(n){var C,w,x,y,Q=n.object,K=n.buffer,F=n.opaque,T=n.transparent;T.count=0;n=F.count=0;for(x=
|
|
|
-Q.materials.length;n<x;n++){C=Q.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(w=K.materials.length;C<w;C++)(y=K.materials[C])&&(y.transparent?o(T,y):o(F,y))}else(y=C)&&(y.transparent?o(T,y):o(F,y))}}function z(n,C){return C.z-n.z}function u(n){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,
|
|
|
-e.KEEP,e.DECR,e.KEEP);var C,w=n.lights.length,x,y=n.lights,Q=[],K,F,T,G,I,L=n.__webglShadowVolumes.length;for(C=0;C<w;C++){x=n.lights[C];if(x instanceof THREE.DirectionalLight){Q[0]=-x.position.x;Q[1]=-x.position.y;Q[2]=-x.position.z;for(I=0;I<L;I++){x=n.__webglShadowVolumes[I].object;K=n.__webglShadowVolumes[I].buffer;F=x.materials[0];F.program||ha.initMaterial(F,y,undefined,x);F=F.program;T=F.uniforms;G=F.attributes;if(Aa!==F){e.useProgram(F);Aa=F;e.uniformMatrix4fv(T.projectionMatrix,!1,Xa);e.uniformMatrix4fv(T.viewMatrix,
|
|
|
-!1,Za);e.uniform3fv(T.directionalLightDirection,Q)}x.matrixWorld.flattenToArray(x._objectMatrixArray);e.uniformMatrix4fv(T.objectMatrix,!1,x._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(G.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(G.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,K.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,
|
|
|
-0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);qa="";Aa=S.program;e.useProgram(S.program);e.uniformMatrix4fv(S.projectionLocation,!1,Xa);e.uniform1f(S.darknessLocation,S.darkness);e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.vertexAttribPointer(S.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(S.vertexLocation);
|
|
|
-e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function A(n,C){var w,x,y;w=_sprite.attributes;var Q=_sprite.uniforms,K=ja/Fa,F,T=[],G=Fa*0.5,I=ja*0.5,L=!0;e.useProgram(_sprite.program);Aa=_sprite.program;qa="";if(!La){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);
|
|
|
-La=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(w.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(w.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(Q.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(Q.map,0);w=0;for(x=n.__webglSprites.length;w<x;w++){y=n.__webglSprites[w];if(y.useScreenCoordinates)y.z=-y.position.z;else{y._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,
|
|
|
-y.matrixWorld,y._modelViewMatrixArray);y.z=-y._modelViewMatrix.n34}}n.__webglSprites.sort(z);w=0;for(x=n.__webglSprites.length;w<x;w++){y=n.__webglSprites[w];if(y.material===undefined&&y.map&&y.map.image&&y.map.image.width){if(y.useScreenCoordinates){e.uniform1i(Q.useScreenCoordinates,1);e.uniform3f(Q.screenPosition,(y.position.x-G)/G,(I-y.position.y)/I,Math.max(0,Math.min(1,y.position.z)))}else{e.uniform1i(Q.useScreenCoordinates,0);e.uniform1i(Q.affectedByDistance,y.affectedByDistance?1:0);e.uniformMatrix4fv(Q.modelViewMatrix,
|
|
|
-!1,y._modelViewMatrixArray)}F=y.map.image.width/(y.affectedByDistance?1:ja);T[0]=F*K*y.scale.x;T[1]=F*y.scale.y;e.uniform2f(Q.uvScale,y.uvScale.x,y.uvScale.y);e.uniform2f(Q.uvOffset,y.uvOffset.x,y.uvOffset.y);e.uniform2f(Q.alignment,y.alignment.x,y.alignment.y);e.uniform1f(Q.opacity,y.opacity);e.uniform1f(Q.rotation,y.rotation);e.uniform2fv(Q.scale,T);if(y.mergeWith3D&&!L){e.enable(e.DEPTH_TEST);L=!0}else if(!y.mergeWith3D&&L){e.disable(e.DEPTH_TEST);L=!1}U(y.blending);M(y.map,0);e.drawElements(e.TRIANGLES,
|
|
|
-6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function E(n,C){var w,x,y=n.__webglLensFlares.length,Q,K,F,T=new THREE.Vector3,G=ja/Fa,I=Fa*0.5,L=ja*0.5,Z=16/ja,Y=[Z*G,Z],ra=[1,1,0],Ka=[1,1],Ca=P.uniforms;w=P.attributes;e.useProgram(P.program);Aa=P.program;qa="";if(!Ba){e.enableVertexAttribArray(P.attributes.vertex);e.enableVertexAttribArray(P.attributes.uv);Ba=!0}e.uniform1i(Ca.occlusionMap,0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.vertexAttribPointer(w.vertex,
|
|
|
-2,e.FLOAT,!1,16,0);e.vertexAttribPointer(w.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,P.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.activeTexture(e.TEXTURE1);for(x=0;x<y;x++){w=n.__webglLensFlares[x].object;T.set(w.matrixWorld.n14,w.matrixWorld.n24,w.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(T);C.projectionMatrix.multiplyVector3(T);ra[0]=T.x;ra[1]=T.y;ra[2]=T.z;Ka[0]=ra[0]*I+I;Ka[1]=ra[1]*
|
|
|
-L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,0);e.uniform2fv(Ca.scale,Y);e.uniform3fv(Ca.screenPosition,ra);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,1);e.disable(e.DEPTH_TEST);
|
|
|
-e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);w.positionScreen.x=ra[0];w.positionScreen.y=ra[1];w.positionScreen.z=ra[2];w.customUpdateCallback?w.customUpdateCallback(w):w.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);Q=0;for(K=w.lensFlares.length;Q<K;Q++){F=w.lensFlares[Q];if(F.opacity>0.0010&&F.scale>0.0010){ra[0]=F.x;ra[1]=F.y;ra[2]=F.z;Z=F.size*F.scale/ja;Y[0]=Z*G;Y[1]=Z;e.uniform3fv(Ca.screenPosition,ra);e.uniform2fv(Ca.scale,Y);
|
|
|
-e.uniform1f(Ca.rotation,F.rotation);e.uniform1f(Ca.opacity,F.opacity);U(F.blending);M(F.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function H(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function J(n){var C,w,x,y,Q;if(n instanceof THREE.Mesh){w=n.geometry;for(C in w.geometryGroups){x=
|
|
|
-w.geometryGroups[C];Q=!1;for(y in x.__webglCustomAttributes)if(x.__webglCustomAttributes[y].needsUpdate){Q=!0;break}if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents||Q){Q=e.DYNAMIC_DRAW;var K=void 0,F=void 0,T=void 0,G=void 0;T=void 0;var I=void 0,L=void 0,Z=void 0,Y=void 0,ra=void 0,Ka=void 0,Ca=void 0,Ha=void 0,Ga=void 0,xa=void 0,Ea=void 0,za=void 0,Ua=void 0;L=void 0;Z=void 0;G=void 0;Y=void 0;G=void 0;var D=void 0,
|
|
|
-aa=void 0;L=void 0;D=void 0;aa=void 0;var v=void 0,ab=void 0;D=void 0;aa=void 0;v=void 0;ab=void 0;D=void 0;aa=void 0;v=void 0;ab=void 0;D=void 0;aa=void 0;v=void 0;G=void 0;Y=void 0;I=void 0;T=void 0;T=void 0;D=void 0;aa=void 0;v=void 0;var fb=void 0,Oa=0,Qa=0,cb=0,hb=0,Wa=0,$a=0,Ma=0,bb=0,Va=0,N=0,Na=0;aa=D=0;var Ra=x.__vertexArray,ib=x.__uvArray,jb=x.__uv2Array,Pa=x.__normalArray,V=x.__tangentArray,na=x.__colorArray,ea=x.__skinVertexAArray,$=x.__skinVertexBArray,ua=x.__skinIndexArray,sa=x.__skinWeightArray,
|
|
|
-ya=x.__morphTargetsArrays,X=x.__webglCustomAttributes;v=void 0;var Ia=x.__faceArray,Ya=x.__lineArray,eb=x.__needsSmoothNormals;Ka=x.__vertexColorType;ra=x.__uvType;Ca=x.__normalType;var Sa=n.geometry,kb=Sa.__dirtyVertices,gb=Sa.__dirtyElements,db=Sa.__dirtyUvs,rb=Sa.__dirtyNormals,sb=Sa.__dirtyTangents,tb=Sa.__dirtyColors,ub=Sa.__dirtyMorphTargets,nb=Sa.vertices,vb=x.faces,yb=Sa.faces,wb=Sa.faceVertexUvs[0],xb=Sa.faceVertexUvs[1],ob=Sa.skinVerticesA,pb=Sa.skinVerticesB,qb=Sa.skinIndices,lb=Sa.skinWeights,
|
|
|
-mb=n instanceof THREE.ShadowVolume?Sa.edgeFaces:undefined;morphTargets=Sa.morphTargets;if(X)for(fb in X){X[fb].offset=0;X[fb].offsetSrc=0}K=0;for(F=vb.length;K<F;K++){T=vb[K];G=yb[T];wb&&(Ha=wb[T]);xb&&(Ga=xb[T]);T=G.vertexNormals;I=G.normal;L=G.vertexColors;Z=G.color;Y=G.vertexTangents;if(G instanceof THREE.Face3){if(kb){xa=nb[G.a].position;Ea=nb[G.b].position;za=nb[G.c].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=
|
|
|
-za.z;Qa+=9}if(X)for(fb in X){v=X[fb];if(v.needsUpdate){D=v.offset;aa=v.offsetSrc;if(v.size===1){if(v.boundTo===undefined||v.boundTo==="vertices"){v.array[D+0]=v.value[G.a];v.array[D+1]=v.value[G.b];v.array[D+2]=v.value[G.c]}else if(v.boundTo==="faces"){v.array[D+0]=v.value[aa];v.array[D+1]=v.value[aa];v.array[D+2]=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){v.array[D+0]=v.value[aa+0];v.array[D+1]=v.value[aa+1];v.array[D+2]=v.value[aa+2];v.offsetSrc+=3}v.offset+=3}else{if(v.boundTo===
|
|
|
-undefined||v.boundTo==="vertices"){xa=v.value[G.a];Ea=v.value[G.b];za=v.value[G.c]}else if(v.boundTo==="faces"){xa=v.value[aa];Ea=v.value[aa];za=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){xa=v.value[aa+0];Ea=v.value[aa+1];za=v.value[aa+2];v.offsetSrc+=3}if(v.size===2){v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=Ea.x;v.array[D+3]=Ea.y;v.array[D+4]=za.x;v.array[D+5]=za.y;v.offset+=6}else if(v.size===3){if(v.type==="c"){v.array[D+0]=xa.r;v.array[D+1]=xa.g;v.array[D+2]=xa.b;v.array[D+
|
|
|
-3]=Ea.r;v.array[D+4]=Ea.g;v.array[D+5]=Ea.b;v.array[D+6]=za.r;v.array[D+7]=za.g;v.array[D+8]=za.b}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=Ea.x;v.array[D+4]=Ea.y;v.array[D+5]=Ea.z;v.array[D+6]=za.x;v.array[D+7]=za.y;v.array[D+8]=za.z}v.offset+=9}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=xa.w;v.array[D+4]=Ea.x;v.array[D+5]=Ea.y;v.array[D+6]=Ea.z;v.array[D+7]=Ea.w;v.array[D+8]=za.x;v.array[D+9]=za.y;v.array[D+10]=za.z;v.array[D+11]=za.w;v.offset+=
|
|
|
-12}}}}if(ub){D=0;for(aa=morphTargets.length;D<aa;D++){xa=morphTargets[D].vertices[G.a].position;Ea=morphTargets[D].vertices[G.b].position;za=morphTargets[D].vertices[G.c].position;v=ya[D];v[Na+0]=xa.x;v[Na+1]=xa.y;v[Na+2]=xa.z;v[Na+3]=Ea.x;v[Na+4]=Ea.y;v[Na+5]=Ea.z;v[Na+6]=za.x;v[Na+7]=za.y;v[Na+8]=za.z}Na+=9}if(lb.length){D=lb[G.a];aa=lb[G.b];v=lb[G.c];sa[N]=D.x;sa[N+1]=D.y;sa[N+2]=D.z;sa[N+3]=D.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=v.x;sa[N+9]=v.y;sa[N+10]=v.z;sa[N+11]=v.w;
|
|
|
-D=qb[G.a];aa=qb[G.b];v=qb[G.c];ua[N]=D.x;ua[N+1]=D.y;ua[N+2]=D.z;ua[N+3]=D.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=v.x;ua[N+9]=v.y;ua[N+10]=v.z;ua[N+11]=v.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ea[N]=D.x;ea[N+1]=D.y;ea[N+2]=D.z;ea[N+3]=1;ea[N+4]=aa.x;ea[N+5]=aa.y;ea[N+6]=aa.z;ea[N+7]=1;ea[N+8]=v.x;ea[N+9]=v.y;ea[N+10]=v.z;ea[N+11]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];$[N]=D.x;$[N+1]=D.y;$[N+2]=D.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=v.x;$[N+9]=v.y;$[N+10]=v.z;
|
|
|
-$[N+11]=1;N+=12}if(tb&&Ka){if(L.length==3&&Ka==THREE.VertexColors){G=L[0];D=L[1];aa=L[2]}else aa=D=G=Z;na[Va]=G.r;na[Va+1]=G.g;na[Va+2]=G.b;na[Va+3]=D.r;na[Va+4]=D.g;na[Va+5]=D.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;Va+=9}if(sb&&Sa.hasTangents){L=Y[0];Z=Y[1];G=Y[2];V[Ma]=L.x;V[Ma+1]=L.y;V[Ma+2]=L.z;V[Ma+3]=L.w;V[Ma+4]=Z.x;V[Ma+5]=Z.y;V[Ma+6]=Z.z;V[Ma+7]=Z.w;V[Ma+8]=G.x;V[Ma+9]=G.y;V[Ma+10]=G.z;V[Ma+11]=G.w;Ma+=12}if(rb&&Ca)if(T.length==3&&eb)for(Y=0;Y<3;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+
|
|
|
-2]=I.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+2;Wa+=3;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+2;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;bb+=6;Oa+=3}}else if(G instanceof THREE.Face4){if(kb){xa=nb[G.a].position;Ea=nb[G.b].position;za=nb[G.c].position;Ua=nb[G.d].position;
|
|
|
-Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Ra[Qa+9]=Ua.x;Ra[Qa+10]=Ua.y;Ra[Qa+11]=Ua.z;Qa+=12}if(X)for(fb in X){v=X[fb];if(v.needsUpdate){D=v.offset;aa=v.offsetSrc;if(v.size===1){if(v.boundTo===undefined||v.boundTo==="vertices"){v.array[D+0]=v.value[G.a];v.array[D+1]=v.value[G.b];v.array[D+2]=v.value[G.c];v.array[D+2]=v.value[G.d]}else if(v.boundTo==="faces"){v.array[D+0]=v.value[aa];v.array[D+1]=v.value[aa];v.array[D+
|
|
|
-2]=v.value[aa];v.array[D+2]=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){v.array[D+0]=v.value[aa+0];v.array[D+1]=v.value[aa+1];v.array[D+2]=v.value[aa+2];v.array[D+2]=v.value[aa+3];v.offsetSrc+=4}v.offset+=4}else{if(v.boundTo===undefined||v.boundTo==="vertices"){xa=v.value[G.a];Ea=v.value[G.b];za=v.value[G.c];Ua=v.value[G.d]}else if(v.boundTo==="faces"){xa=v.value[aa];Ea=v.value[aa];za=v.value[aa];Ua=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){xa=v.value[aa+0];Ea=
|
|
|
-v.value[aa+1];za=v.value[aa+2];Ua=v.value[aa+3];v.offsetSrc+=4}if(v.size===2){v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=Ea.x;v.array[D+3]=Ea.y;v.array[D+4]=za.x;v.array[D+5]=za.y;v.array[D+6]=Ua.x;v.array[D+7]=Ua.y;v.offset+=8}else if(v.size===3){if(v.type==="c"){v.array[D+0]=xa.r;v.array[D+1]=xa.g;v.array[D+2]=xa.b;v.array[D+3]=Ea.r;v.array[D+4]=Ea.g;v.array[D+5]=Ea.b;v.array[D+6]=za.r;v.array[D+7]=za.g;v.array[D+8]=za.b;v.array[D+9]=Ua.r;v.array[D+10]=Ua.g;v.array[D+11]=Ua.b}else{v.array[D+
|
|
|
-0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=Ea.x;v.array[D+4]=Ea.y;v.array[D+5]=Ea.z;v.array[D+6]=za.x;v.array[D+7]=za.y;v.array[D+8]=za.z;v.array[D+9]=Ua.x;v.array[D+10]=Ua.y;v.array[D+11]=Ua.z}v.offset+=12}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=xa.w;v.array[D+4]=Ea.x;v.array[D+5]=Ea.y;v.array[D+6]=Ea.z;v.array[D+7]=Ea.w;v.array[D+8]=za.x;v.array[D+9]=za.y;v.array[D+10]=za.z;v.array[D+11]=za.w;v.array[D+12]=Ua.x;v.array[D+13]=Ua.y;v.array[D+14]=Ua.z;
|
|
|
-v.array[D+15]=Ua.w;v.offset+=16}}}}if(ub){D=0;for(aa=morphTargets.length;D<aa;D++){xa=morphTargets[D].vertices[G.a].position;Ea=morphTargets[D].vertices[G.b].position;za=morphTargets[D].vertices[G.c].position;Ua=morphTargets[D].vertices[G.d].position;v=ya[D];v[Na+0]=xa.x;v[Na+1]=xa.y;v[Na+2]=xa.z;v[Na+3]=Ea.x;v[Na+4]=Ea.y;v[Na+5]=Ea.z;v[Na+6]=za.x;v[Na+7]=za.y;v[Na+8]=za.z;v[Na+9]=Ua.x;v[Na+10]=Ua.y;v[Na+11]=Ua.z}Na+=12}if(lb.length){D=lb[G.a];aa=lb[G.b];v=lb[G.c];ab=lb[G.d];sa[N]=D.x;sa[N+1]=D.y;
|
|
|
-sa[N+2]=D.z;sa[N+3]=D.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=v.x;sa[N+9]=v.y;sa[N+10]=v.z;sa[N+11]=v.w;sa[N+12]=ab.x;sa[N+13]=ab.y;sa[N+14]=ab.z;sa[N+15]=ab.w;D=qb[G.a];aa=qb[G.b];v=qb[G.c];ab=qb[G.d];ua[N]=D.x;ua[N+1]=D.y;ua[N+2]=D.z;ua[N+3]=D.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=v.x;ua[N+9]=v.y;ua[N+10]=v.z;ua[N+11]=v.w;ua[N+12]=ab.x;ua[N+13]=ab.y;ua[N+14]=ab.z;ua[N+15]=ab.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ab=ob[G.d];ea[N]=D.x;ea[N+1]=D.y;ea[N+2]=D.z;
|
|
|
-ea[N+3]=1;ea[N+4]=aa.x;ea[N+5]=aa.y;ea[N+6]=aa.z;ea[N+7]=1;ea[N+8]=v.x;ea[N+9]=v.y;ea[N+10]=v.z;ea[N+11]=1;ea[N+12]=ab.x;ea[N+13]=ab.y;ea[N+14]=ab.z;ea[N+15]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];G=pb[G.d];$[N]=D.x;$[N+1]=D.y;$[N+2]=D.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=v.x;$[N+9]=v.y;$[N+10]=v.z;$[N+11]=1;$[N+12]=G.x;$[N+13]=G.y;$[N+14]=G.z;$[N+15]=1;N+=16}if(tb&&Ka){if(L.length==4&&Ka==THREE.VertexColors){G=L[0];D=L[1];aa=L[2];L=L[3]}else L=aa=D=G=Z;na[Va]=G.r;na[Va+1]=G.g;
|
|
|
-na[Va+2]=G.b;na[Va+3]=D.r;na[Va+4]=D.g;na[Va+5]=D.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;na[Va+9]=L.r;na[Va+10]=L.g;na[Va+11]=L.b;Va+=12}if(sb&&Sa.hasTangents){L=Y[0];Z=Y[1];G=Y[2];Y=Y[3];V[Ma]=L.x;V[Ma+1]=L.y;V[Ma+2]=L.z;V[Ma+3]=L.w;V[Ma+4]=Z.x;V[Ma+5]=Z.y;V[Ma+6]=Z.z;V[Ma+7]=Z.w;V[Ma+8]=G.x;V[Ma+9]=G.y;V[Ma+10]=G.z;V[Ma+11]=G.w;V[Ma+12]=Y.x;V[Ma+13]=Y.y;V[Ma+14]=Y.z;V[Ma+15]=Y.w;Ma+=16}if(rb&&Ca)if(T.length==4&&eb)for(Y=0;Y<4;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=
|
|
|
-0;Y<4;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+3;Ia[Wa+3]=Oa+1;Ia[Wa+4]=Oa+2;Ia[Wa+5]=Oa+3;Wa+=6;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+3;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;Ya[bb+6]=Oa+2;Ya[bb+7]=Oa+3;bb+=8;Oa+=4}}}if(mb){K=0;for(F=mb.length;K<F;K++){Ia[Wa]=mb[K].a;Ia[Wa+1]=mb[K].b;Ia[Wa+
|
|
|
-2]=mb[K].c;Ia[Wa+3]=mb[K].a;Ia[Wa+4]=mb[K].c;Ia[Wa+5]=mb[K].d;Wa+=6}}if(kb){e.bindBuffer(e.ARRAY_BUFFER,x.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,Q)}if(X)for(fb in X){v=X[fb];if(v.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,v.buffer);e.bufferData(e.ARRAY_BUFFER,v.array,Q);v.needsUpdate=!1}}if(ub){D=0;for(aa=morphTargets.length;D<aa;D++){e.bindBuffer(e.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[D]);e.bufferData(e.ARRAY_BUFFER,ya[D],Q)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglColorBuffer);
|
|
|
-e.bufferData(e.ARRAY_BUFFER,na,Q)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,x.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,Q)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,x.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,V,Q)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,Q)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,Q)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,
|
|
|
-Ia,Q);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,Q)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ea,Q);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,Q);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ua,Q);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,sa,Q)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=
|
|
|
-!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Ka=n.vertices;x=n.colors;Ca=Ka.length;Q=x.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){ra=Ka[F].position;y=F*3;Ha[y]=ra.x;Ha[y+1]=ra.y;Ha[y+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=
|
|
|
-0;F<Q;F++){color=x[F];y=F*3;K[y]=color.r;K[y+1]=color.g;K[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Line){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Ka=n.vertices;x=n.colors;Ca=Ka.length;Q=x.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){ra=Ka[F].position;y=F*3;Ha[y]=ra.x;Ha[y+1]=ra.y;Ha[y+2]=
|
|
|
-ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=0;F<Q;F++){color=x[F];y=F*3;K[y]=color.r;K[y+1]=color.g;K[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){w=n.geometry;(w.__dirtyVertices||w.__dirtyColors||n.sortParticles)&&d(w,e.DYNAMIC_DRAW,n);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function W(n){function C(Z){var Y=
|
|
|
-[];w=0;for(x=Z.length;w<x;w++)Z[w]==undefined?Y.push("undefined"):Y.push(Z[w].id);return Y.join("_")}var w,x,y,Q,K,F,T,G,I={},L=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};y=0;for(Q=n.faces.length;y<Q;y++){K=n.faces[y];F=K.materials;T=C(F);I[T]==undefined&&(I[T]={hash:T,counter:0});G=I[T].hash+"_"+I[T].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:L});K=K instanceof THREE.Face3?3:4;if(n.geometryGroups[G].vertices+
|
|
|
-K>65535){I[T].counter+=1;G=I[T].hash+"_"+I[T].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:L})}n.geometryGroups[G].faces.push(y);n.geometryGroups[G].vertices+=K}}function B(n,C,w){n.push({buffer:C,object:w,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function U(n){if(n!=qa){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
|
|
|
-e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}qa=n}}function O(n,C,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ga(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ga(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ga(C.magFilter));
|
|
|
+n.matrixWorld,x=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),w=0;w<6;w++){n=da[w].x*C.n14+da[w].y*C.n24+da[w].z*C.n34+da[w].w;if(n<=x)return!1}return!0}function o(n,C){n.list[n.count]=C;n.count+=1}function p(n){var C,x,w=n.object,y=n.opaque,Q=n.transparent;Q.count=0;n=y.count=0;for(C=w.materials.length;n<C;n++){x=w.materials[n];x.transparent?o(Q,x):o(y,x)}}function t(n){var C,x,w,y,Q=n.object,K=n.buffer,F=n.opaque,T=n.transparent;T.count=0;n=F.count=0;for(w=
|
|
|
+Q.materials.length;n<w;n++){C=Q.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(x=K.materials.length;C<x;C++)(y=K.materials[C])&&(y.transparent?o(T,y):o(F,y))}else(y=C)&&(y.transparent?o(T,y):o(F,y))}}function z(n,C){return C.z-n.z}function u(n){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,
|
|
|
+e.KEEP,e.DECR,e.KEEP);var C,x=n.lights.length,w,y=n.lights,Q=[],K,F,T,G,I,L=n.__webglShadowVolumes.length;for(C=0;C<x;C++){w=n.lights[C];if(w instanceof THREE.DirectionalLight&&w.castShadow){Q[0]=-w.position.x;Q[1]=-w.position.y;Q[2]=-w.position.z;for(I=0;I<L;I++){w=n.__webglShadowVolumes[I].object;K=n.__webglShadowVolumes[I].buffer;F=w.materials[0];F.program||ha.initMaterial(F,y,undefined,w);F=F.program;T=F.uniforms;G=F.attributes;if(Aa!==F){e.useProgram(F);Aa=F;e.uniformMatrix4fv(T.projectionMatrix,
|
|
|
+!1,Xa);e.uniformMatrix4fv(T.viewMatrix,!1,Za);e.uniform3fv(T.directionalLightDirection,Q)}w.matrixWorld.flattenToArray(w._objectMatrixArray);e.uniformMatrix4fv(T.objectMatrix,!1,w._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(G.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(G.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,K.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,
|
|
|
+K.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);qa="";Aa=S.program;e.useProgram(S.program);e.uniformMatrix4fv(S.projectionLocation,!1,Xa);e.uniform1f(S.darknessLocation,S.darkness);e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.vertexAttribPointer(S.vertexLocation,3,e.FLOAT,!1,
|
|
|
+0,0);e.enableVertexAttribArray(S.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function A(n,C){var x,w,y;x=_sprite.attributes;var Q=_sprite.uniforms,K=ja/Fa,F,T=[],G=Fa*0.5,I=ja*0.5,L=!0;e.useProgram(_sprite.program);Aa=_sprite.program;qa="";if(!La){e.enableVertexAttribArray(_sprite.attributes.position);
|
|
|
+e.enableVertexAttribArray(_sprite.attributes.uv);La=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(x.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(Q.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(Q.map,0);x=0;for(w=n.__webglSprites.length;x<w;x++){y=n.__webglSprites[x];if(y.useScreenCoordinates)y.z=
|
|
|
+-y.position.z;else{y._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,y.matrixWorld,y._modelViewMatrixArray);y.z=-y._modelViewMatrix.n34}}n.__webglSprites.sort(z);x=0;for(w=n.__webglSprites.length;x<w;x++){y=n.__webglSprites[x];if(y.material===undefined&&y.map&&y.map.image&&y.map.image.width){if(y.useScreenCoordinates){e.uniform1i(Q.useScreenCoordinates,1);e.uniform3f(Q.screenPosition,(y.position.x-G)/G,(I-y.position.y)/I,Math.max(0,Math.min(1,y.position.z)))}else{e.uniform1i(Q.useScreenCoordinates,
|
|
|
+0);e.uniform1i(Q.affectedByDistance,y.affectedByDistance?1:0);e.uniformMatrix4fv(Q.modelViewMatrix,!1,y._modelViewMatrixArray)}F=y.map.image.width/(y.affectedByDistance?1:ja);T[0]=F*K*y.scale.x;T[1]=F*y.scale.y;e.uniform2f(Q.uvScale,y.uvScale.x,y.uvScale.y);e.uniform2f(Q.uvOffset,y.uvOffset.x,y.uvOffset.y);e.uniform2f(Q.alignment,y.alignment.x,y.alignment.y);e.uniform1f(Q.opacity,y.opacity);e.uniform1f(Q.rotation,y.rotation);e.uniform2fv(Q.scale,T);if(y.mergeWith3D&&!L){e.enable(e.DEPTH_TEST);L=!0}else if(!y.mergeWith3D&&
|
|
|
+L){e.disable(e.DEPTH_TEST);L=!1}U(y.blending);M(y.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function E(n,C){var x,w,y=n.__webglLensFlares.length,Q,K,F,T=new THREE.Vector3,G=ja/Fa,I=Fa*0.5,L=ja*0.5,Z=16/ja,Y=[Z*G,Z],ra=[1,1,0],Ka=[1,1],Ca=P.uniforms;x=P.attributes;e.useProgram(P.program);Aa=P.program;qa="";if(!Ba){e.enableVertexAttribArray(P.attributes.vertex);e.enableVertexAttribArray(P.attributes.uv);Ba=!0}e.uniform1i(Ca.occlusionMap,
|
|
|
+0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.vertexAttribPointer(x.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,P.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.activeTexture(e.TEXTURE1);for(w=0;w<y;w++){x=n.__webglLensFlares[w].object;T.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(T);
|
|
|
+C.projectionMatrix.multiplyVector3(T);ra[0]=T.x;ra[1]=T.y;ra[2]=T.z;Ka[0]=ra[0]*I+I;Ka[1]=ra[1]*L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,0);e.uniform2fv(Ca.scale,Y);e.uniform3fv(Ca.screenPosition,ra);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,
|
|
|
+0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=ra[0];x.positionScreen.y=ra[1];x.positionScreen.z=ra[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);Q=0;for(K=x.lensFlares.length;Q<K;Q++){F=x.lensFlares[Q];if(F.opacity>0.0010&&F.scale>0.0010){ra[0]=F.x;ra[1]=F.y;ra[2]=F.z;Z=F.size*
|
|
|
+F.scale/ja;Y[0]=Z*G;Y[1]=Z;e.uniform3fv(Ca.screenPosition,ra);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,F.rotation);e.uniform1f(Ca.opacity,F.opacity);U(F.blending);M(F.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function H(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function J(n){var C,
|
|
|
+x,w,y,Q;if(n instanceof THREE.Mesh){x=n.geometry;for(C in x.geometryGroups){w=x.geometryGroups[C];Q=!1;for(y in w.__webglCustomAttributes)if(w.__webglCustomAttributes[y].needsUpdate){Q=!0;break}if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||Q){Q=e.DYNAMIC_DRAW;var K=void 0,F=void 0,T=void 0,G=void 0;T=void 0;var I=void 0,L=void 0,Z=void 0,Y=void 0,ra=void 0,Ka=void 0,Ca=void 0,Ha=void 0,Ga=void 0,xa=void 0,Ea=void 0,
|
|
|
+za=void 0,Ua=void 0;L=void 0;Z=void 0;G=void 0;Y=void 0;G=void 0;var D=void 0,aa=void 0;L=void 0;D=void 0;aa=void 0;var v=void 0,ab=void 0;D=void 0;aa=void 0;v=void 0;ab=void 0;D=void 0;aa=void 0;v=void 0;ab=void 0;D=void 0;aa=void 0;v=void 0;G=void 0;Y=void 0;I=void 0;T=void 0;T=void 0;D=void 0;aa=void 0;v=void 0;var fb=void 0,Oa=0,Qa=0,cb=0,hb=0,Wa=0,$a=0,Ma=0,bb=0,Va=0,N=0,Na=0;aa=D=0;var Ra=w.__vertexArray,ib=w.__uvArray,jb=w.__uv2Array,Pa=w.__normalArray,V=w.__tangentArray,na=w.__colorArray,
|
|
|
+ea=w.__skinVertexAArray,$=w.__skinVertexBArray,ua=w.__skinIndexArray,sa=w.__skinWeightArray,ya=w.__morphTargetsArrays,X=w.__webglCustomAttributes;v=void 0;var Ia=w.__faceArray,Ya=w.__lineArray,eb=w.__needsSmoothNormals;Ka=w.__vertexColorType;ra=w.__uvType;Ca=w.__normalType;var Sa=n.geometry,kb=Sa.__dirtyVertices,gb=Sa.__dirtyElements,db=Sa.__dirtyUvs,rb=Sa.__dirtyNormals,sb=Sa.__dirtyTangents,tb=Sa.__dirtyColors,ub=Sa.__dirtyMorphTargets,nb=Sa.vertices,vb=w.faces,yb=Sa.faces,wb=Sa.faceVertexUvs[0],
|
|
|
+xb=Sa.faceVertexUvs[1],ob=Sa.skinVerticesA,pb=Sa.skinVerticesB,qb=Sa.skinIndices,lb=Sa.skinWeights,mb=n instanceof THREE.ShadowVolume?Sa.edgeFaces:undefined;morphTargets=Sa.morphTargets;if(X)for(fb in X){X[fb].offset=0;X[fb].offsetSrc=0}K=0;for(F=vb.length;K<F;K++){T=vb[K];G=yb[T];wb&&(Ha=wb[T]);xb&&(Ga=xb[T]);T=G.vertexNormals;I=G.normal;L=G.vertexColors;Z=G.color;Y=G.vertexTangents;if(G instanceof THREE.Face3){if(kb){xa=nb[G.a].position;Ea=nb[G.b].position;za=nb[G.c].position;Ra[Qa]=xa.x;Ra[Qa+
|
|
|
+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Qa+=9}if(X)for(fb in X){v=X[fb];if(v.needsUpdate){D=v.offset;aa=v.offsetSrc;if(v.size===1){if(v.boundTo===undefined||v.boundTo==="vertices"){v.array[D+0]=v.value[G.a];v.array[D+1]=v.value[G.b];v.array[D+2]=v.value[G.c]}else if(v.boundTo==="faces"){v.array[D+0]=v.value[aa];v.array[D+1]=v.value[aa];v.array[D+2]=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){v.array[D+0]=v.value[aa+
|
|
|
+0];v.array[D+1]=v.value[aa+1];v.array[D+2]=v.value[aa+2];v.offsetSrc+=3}v.offset+=3}else{if(v.boundTo===undefined||v.boundTo==="vertices"){xa=v.value[G.a];Ea=v.value[G.b];za=v.value[G.c]}else if(v.boundTo==="faces"){xa=v.value[aa];Ea=v.value[aa];za=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){xa=v.value[aa+0];Ea=v.value[aa+1];za=v.value[aa+2];v.offsetSrc+=3}if(v.size===2){v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=Ea.x;v.array[D+3]=Ea.y;v.array[D+4]=za.x;v.array[D+5]=za.y;v.offset+=
|
|
|
+6}else if(v.size===3){if(v.type==="c"){v.array[D+0]=xa.r;v.array[D+1]=xa.g;v.array[D+2]=xa.b;v.array[D+3]=Ea.r;v.array[D+4]=Ea.g;v.array[D+5]=Ea.b;v.array[D+6]=za.r;v.array[D+7]=za.g;v.array[D+8]=za.b}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=Ea.x;v.array[D+4]=Ea.y;v.array[D+5]=Ea.z;v.array[D+6]=za.x;v.array[D+7]=za.y;v.array[D+8]=za.z}v.offset+=9}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=xa.w;v.array[D+4]=Ea.x;v.array[D+5]=Ea.y;v.array[D+
|
|
|
+6]=Ea.z;v.array[D+7]=Ea.w;v.array[D+8]=za.x;v.array[D+9]=za.y;v.array[D+10]=za.z;v.array[D+11]=za.w;v.offset+=12}}}}if(ub){D=0;for(aa=morphTargets.length;D<aa;D++){xa=morphTargets[D].vertices[G.a].position;Ea=morphTargets[D].vertices[G.b].position;za=morphTargets[D].vertices[G.c].position;v=ya[D];v[Na+0]=xa.x;v[Na+1]=xa.y;v[Na+2]=xa.z;v[Na+3]=Ea.x;v[Na+4]=Ea.y;v[Na+5]=Ea.z;v[Na+6]=za.x;v[Na+7]=za.y;v[Na+8]=za.z}Na+=9}if(lb.length){D=lb[G.a];aa=lb[G.b];v=lb[G.c];sa[N]=D.x;sa[N+1]=D.y;sa[N+2]=D.z;sa[N+
|
|
|
+3]=D.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=v.x;sa[N+9]=v.y;sa[N+10]=v.z;sa[N+11]=v.w;D=qb[G.a];aa=qb[G.b];v=qb[G.c];ua[N]=D.x;ua[N+1]=D.y;ua[N+2]=D.z;ua[N+3]=D.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=v.x;ua[N+9]=v.y;ua[N+10]=v.z;ua[N+11]=v.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ea[N]=D.x;ea[N+1]=D.y;ea[N+2]=D.z;ea[N+3]=1;ea[N+4]=aa.x;ea[N+5]=aa.y;ea[N+6]=aa.z;ea[N+7]=1;ea[N+8]=v.x;ea[N+9]=v.y;ea[N+10]=v.z;ea[N+11]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];$[N]=D.x;$[N+
|
|
|
+1]=D.y;$[N+2]=D.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=v.x;$[N+9]=v.y;$[N+10]=v.z;$[N+11]=1;N+=12}if(tb&&Ka){if(L.length==3&&Ka==THREE.VertexColors){G=L[0];D=L[1];aa=L[2]}else aa=D=G=Z;na[Va]=G.r;na[Va+1]=G.g;na[Va+2]=G.b;na[Va+3]=D.r;na[Va+4]=D.g;na[Va+5]=D.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;Va+=9}if(sb&&Sa.hasTangents){L=Y[0];Z=Y[1];G=Y[2];V[Ma]=L.x;V[Ma+1]=L.y;V[Ma+2]=L.z;V[Ma+3]=L.w;V[Ma+4]=Z.x;V[Ma+5]=Z.y;V[Ma+6]=Z.z;V[Ma+7]=Z.w;V[Ma+8]=G.x;V[Ma+9]=G.y;V[Ma+10]=
|
|
|
+G.z;V[Ma+11]=G.w;Ma+=12}if(rb&&Ca)if(T.length==3&&eb)for(Y=0;Y<3;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+2;Wa+=3;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+2;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;bb+=6;Oa+=3}}else if(G instanceof
|
|
|
+THREE.Face4){if(kb){xa=nb[G.a].position;Ea=nb[G.b].position;za=nb[G.c].position;Ua=nb[G.d].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Ra[Qa+9]=Ua.x;Ra[Qa+10]=Ua.y;Ra[Qa+11]=Ua.z;Qa+=12}if(X)for(fb in X){v=X[fb];if(v.needsUpdate){D=v.offset;aa=v.offsetSrc;if(v.size===1){if(v.boundTo===undefined||v.boundTo==="vertices"){v.array[D+0]=v.value[G.a];v.array[D+1]=v.value[G.b];v.array[D+2]=v.value[G.c];v.array[D+2]=
|
|
|
+v.value[G.d]}else if(v.boundTo==="faces"){v.array[D+0]=v.value[aa];v.array[D+1]=v.value[aa];v.array[D+2]=v.value[aa];v.array[D+2]=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){v.array[D+0]=v.value[aa+0];v.array[D+1]=v.value[aa+1];v.array[D+2]=v.value[aa+2];v.array[D+2]=v.value[aa+3];v.offsetSrc+=4}v.offset+=4}else{if(v.boundTo===undefined||v.boundTo==="vertices"){xa=v.value[G.a];Ea=v.value[G.b];za=v.value[G.c];Ua=v.value[G.d]}else if(v.boundTo==="faces"){xa=v.value[aa];Ea=v.value[aa];
|
|
|
+za=v.value[aa];Ua=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){xa=v.value[aa+0];Ea=v.value[aa+1];za=v.value[aa+2];Ua=v.value[aa+3];v.offsetSrc+=4}if(v.size===2){v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=Ea.x;v.array[D+3]=Ea.y;v.array[D+4]=za.x;v.array[D+5]=za.y;v.array[D+6]=Ua.x;v.array[D+7]=Ua.y;v.offset+=8}else if(v.size===3){if(v.type==="c"){v.array[D+0]=xa.r;v.array[D+1]=xa.g;v.array[D+2]=xa.b;v.array[D+3]=Ea.r;v.array[D+4]=Ea.g;v.array[D+5]=Ea.b;v.array[D+6]=za.r;v.array[D+
|
|
|
+7]=za.g;v.array[D+8]=za.b;v.array[D+9]=Ua.r;v.array[D+10]=Ua.g;v.array[D+11]=Ua.b}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=Ea.x;v.array[D+4]=Ea.y;v.array[D+5]=Ea.z;v.array[D+6]=za.x;v.array[D+7]=za.y;v.array[D+8]=za.z;v.array[D+9]=Ua.x;v.array[D+10]=Ua.y;v.array[D+11]=Ua.z}v.offset+=12}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=xa.w;v.array[D+4]=Ea.x;v.array[D+5]=Ea.y;v.array[D+6]=Ea.z;v.array[D+7]=Ea.w;v.array[D+8]=za.x;v.array[D+9]=za.y;
|
|
|
+v.array[D+10]=za.z;v.array[D+11]=za.w;v.array[D+12]=Ua.x;v.array[D+13]=Ua.y;v.array[D+14]=Ua.z;v.array[D+15]=Ua.w;v.offset+=16}}}}if(ub){D=0;for(aa=morphTargets.length;D<aa;D++){xa=morphTargets[D].vertices[G.a].position;Ea=morphTargets[D].vertices[G.b].position;za=morphTargets[D].vertices[G.c].position;Ua=morphTargets[D].vertices[G.d].position;v=ya[D];v[Na+0]=xa.x;v[Na+1]=xa.y;v[Na+2]=xa.z;v[Na+3]=Ea.x;v[Na+4]=Ea.y;v[Na+5]=Ea.z;v[Na+6]=za.x;v[Na+7]=za.y;v[Na+8]=za.z;v[Na+9]=Ua.x;v[Na+10]=Ua.y;v[Na+
|
|
|
+11]=Ua.z}Na+=12}if(lb.length){D=lb[G.a];aa=lb[G.b];v=lb[G.c];ab=lb[G.d];sa[N]=D.x;sa[N+1]=D.y;sa[N+2]=D.z;sa[N+3]=D.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=v.x;sa[N+9]=v.y;sa[N+10]=v.z;sa[N+11]=v.w;sa[N+12]=ab.x;sa[N+13]=ab.y;sa[N+14]=ab.z;sa[N+15]=ab.w;D=qb[G.a];aa=qb[G.b];v=qb[G.c];ab=qb[G.d];ua[N]=D.x;ua[N+1]=D.y;ua[N+2]=D.z;ua[N+3]=D.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=v.x;ua[N+9]=v.y;ua[N+10]=v.z;ua[N+11]=v.w;ua[N+12]=ab.x;ua[N+13]=ab.y;ua[N+14]=
|
|
|
+ab.z;ua[N+15]=ab.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ab=ob[G.d];ea[N]=D.x;ea[N+1]=D.y;ea[N+2]=D.z;ea[N+3]=1;ea[N+4]=aa.x;ea[N+5]=aa.y;ea[N+6]=aa.z;ea[N+7]=1;ea[N+8]=v.x;ea[N+9]=v.y;ea[N+10]=v.z;ea[N+11]=1;ea[N+12]=ab.x;ea[N+13]=ab.y;ea[N+14]=ab.z;ea[N+15]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];G=pb[G.d];$[N]=D.x;$[N+1]=D.y;$[N+2]=D.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=v.x;$[N+9]=v.y;$[N+10]=v.z;$[N+11]=1;$[N+12]=G.x;$[N+13]=G.y;$[N+14]=G.z;$[N+15]=1;N+=16}if(tb&&Ka){if(L.length==
|
|
|
+4&&Ka==THREE.VertexColors){G=L[0];D=L[1];aa=L[2];L=L[3]}else L=aa=D=G=Z;na[Va]=G.r;na[Va+1]=G.g;na[Va+2]=G.b;na[Va+3]=D.r;na[Va+4]=D.g;na[Va+5]=D.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;na[Va+9]=L.r;na[Va+10]=L.g;na[Va+11]=L.b;Va+=12}if(sb&&Sa.hasTangents){L=Y[0];Z=Y[1];G=Y[2];Y=Y[3];V[Ma]=L.x;V[Ma+1]=L.y;V[Ma+2]=L.z;V[Ma+3]=L.w;V[Ma+4]=Z.x;V[Ma+5]=Z.y;V[Ma+6]=Z.z;V[Ma+7]=Z.w;V[Ma+8]=G.x;V[Ma+9]=G.y;V[Ma+10]=G.z;V[Ma+11]=G.w;V[Ma+12]=Y.x;V[Ma+13]=Y.y;V[Ma+14]=Y.z;V[Ma+15]=Y.w;Ma+=16}if(rb&&Ca)if(T.length==
|
|
|
+4&&eb)for(Y=0;Y<4;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<4;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+3;Ia[Wa+3]=Oa+1;Ia[Wa+4]=Oa+2;Ia[Wa+5]=Oa+3;Wa+=6;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+3;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;Ya[bb+6]=Oa+2;Ya[bb+7]=Oa+3;bb+=
|
|
|
+8;Oa+=4}}}if(mb){K=0;for(F=mb.length;K<F;K++){Ia[Wa]=mb[K].a;Ia[Wa+1]=mb[K].b;Ia[Wa+2]=mb[K].c;Ia[Wa+3]=mb[K].a;Ia[Wa+4]=mb[K].c;Ia[Wa+5]=mb[K].d;Wa+=6}}if(kb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,Q)}if(X)for(fb in X){v=X[fb];if(v.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,v.buffer);e.bufferData(e.ARRAY_BUFFER,v.array,Q);v.needsUpdate=!1}}if(ub){D=0;for(aa=morphTargets.length;D<aa;D++){e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[D]);e.bufferData(e.ARRAY_BUFFER,
|
|
|
+ya[D],Q)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,Q)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,Q)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,V,Q)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,Q)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,Q)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
|
|
|
+w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,Q);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,Q)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ea,Q);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,Q);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ua,Q);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
+sa,Q)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;C=e.DYNAMIC_DRAW;Ka=n.vertices;w=n.colors;Ca=Ka.length;Q=w.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){ra=Ka[F].position;y=F*3;Ha[y]=ra.x;Ha[y+1]=ra.y;Ha[y+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);
|
|
|
+e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=0;F<Q;F++){color=w[F];y=F*3;K[y]=color.r;K[y+1]=color.g;K[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Line){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;C=e.DYNAMIC_DRAW;Ka=n.vertices;w=n.colors;Ca=Ka.length;Q=w.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){ra=Ka[F].position;
|
|
|
+y=F*3;Ha[y]=ra.x;Ha[y+1]=ra.y;Ha[y+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=0;F<Q;F++){color=w[F];y=F*3;K[y]=color.r;K[y+1]=color.g;K[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){x=n.geometry;(x.__dirtyVertices||x.__dirtyColors||n.sortParticles)&&d(x,e.DYNAMIC_DRAW,n);x.__dirtyVertices=!1;x.__dirtyColors=
|
|
|
+!1}}function W(n){function C(Z){var Y=[];x=0;for(w=Z.length;x<w;x++)Z[x]==undefined?Y.push("undefined"):Y.push(Z[x].id);return Y.join("_")}var x,w,y,Q,K,F,T,G,I={},L=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};y=0;for(Q=n.faces.length;y<Q;y++){K=n.faces[y];F=K.materials;T=C(F);I[T]==undefined&&(I[T]={hash:T,counter:0});G=I[T].hash+"_"+I[T].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:L});K=K instanceof THREE.Face3?
|
|
|
+3:4;if(n.geometryGroups[G].vertices+K>65535){I[T].counter+=1;G=I[T].hash+"_"+I[T].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:L})}n.geometryGroups[G].faces.push(y);n.geometryGroups[G].vertices+=K}}function B(n,C,x){n.push({buffer:C,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function U(n){if(n!=qa){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
|
|
|
+e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}qa=n}}function O(n,C,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ga(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ga(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ga(C.magFilter));
|
|
|
e.texParameteri(n,e.TEXTURE_MIN_FILTER,ga(C.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_MAG_FILTER,pa(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,pa(C.minFilter))}}function M(n,C){if(n.needsUpdate){if(n.__webglInit){e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n.image)}else{n.__webglTexture=e.createTexture();
|
|
|
e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n.image);n.__webglInit=!0}O(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+C);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function va(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();
|
|
|
n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,ga(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,ga(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,ga(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,ga(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,ga(n.format),n.width,n.height,0,ga(n.format),ga(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,
|
|
|
n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,
|
|
|
-n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,w;if(n){C=n.__webglFramebuffer;w=n.width;n=n.height}else{C=null;w=Fa;n=ja}if(C!=ia){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ka,ma,w,n);ia=C}}function la(n,C){var w;if(n=="fragment")w=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(w=e.createShader(e.VERTEX_SHADER));e.shaderSource(w,
|
|
|
-C);e.compileShader(w);if(!e.getShaderParameter(w,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(w));console.error(C);return null}return w}function pa(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function ga(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;
|
|
|
+n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,x;if(n){C=n.__webglFramebuffer;x=n.width;n=n.height}else{C=null;x=Fa;n=ja}if(C!=ia){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ka,ma,x,n);ia=C}}function la(n,C){var x;if(n=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,
|
|
|
+C);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(C);return null}return x}function pa(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function ga(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;
|
|
|
case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;
|
|
|
case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var ha=this,e,oa=document.createElement("canvas"),Da=[],Aa=null,ia=null,fa=!0,wa=null,ta=null,qa=null,ca=null,ka=0,ma=0,Fa=0,ja=0,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
new THREE.Vector4,new THREE.Vector4],Ja=new THREE.Matrix4,Xa=new Float32Array(16),Za=new Float32Array(16),Ta=new THREE.Vector4,R={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,
|
|
|
-faces:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,C,w,x){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:x})))throw"Error creating WebGL context.";}catch(y){console.error(y)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);
|
|
|
-e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,w)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var S={};S.vertices=new Float32Array(12);S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=
|
|
|
+faces:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,C,x,w){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:w})))throw"Error creating WebGL context.";}catch(y){console.error(y)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);
|
|
|
+e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,x)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var S={};S.vertices=new Float32Array(12);S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=
|
|
|
-20;S.vertices[10]=20;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=e.createBuffer();S.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,S.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,S.faces,e.STATIC_DRAW);S.program=e.createProgram();e.attachShader(S.program,la("fragment",THREE.ShaderLib.shadowPost.fragmentShader));
|
|
|
e.attachShader(S.program,la("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(S.program);S.vertexLocation=e.getAttribLocation(S.program,"position");S.projectionLocation=e.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=e.getUniformLocation(S.program,"darkness")}var P={};P.vertices=new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=
|
|
|
0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=e.createBuffer();P.elementBuffer=e.createBuffer();P.tempTexture=e.createTexture();P.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,P.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
|
|
@@ -305,34 +305,34 @@ la("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{P.hasVertexTexture=!0;
|
|
|
e.createBuffer();_sprite.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();e.attachShader(_sprite.program,la("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,la("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);
|
|
|
_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=
|
|
|
e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=
|
|
|
-e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var La=!1;this.setSize=function(n,C){oa.width=n;oa.height=C;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(n,C,w,x){ka=n;ma=C;Fa=w;ja=x;e.viewport(ka,ma,Fa,ja)};this.setScissor=function(n,C,w,x){e.scissor(n,C,w,x)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){fa=
|
|
|
-n;e.depthMask(n)};this.setClearColorHex=function(n,C){var w=new THREE.Color(n);e.clearColor(w.r,w.g,w.b,C)};this.setClearColor=function(n,C){e.clearColor(n.r,n.g,n.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){S.darkness=n};this.initMaterial=function(n,C,w,x){var y,Q,K;if(n instanceof THREE.MeshDepthMaterial)K="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)K="shadowVolumeDynamic";else if(n instanceof
|
|
|
-THREE.MeshNormalMaterial)K="normal";else if(n instanceof THREE.MeshBasicMaterial)K="basic";else if(n instanceof THREE.MeshLambertMaterial)K="lambert";else if(n instanceof THREE.MeshPhongMaterial)K="phong";else if(n instanceof THREE.LineBasicMaterial)K="basic";else n instanceof THREE.ParticleBasicMaterial&&(K="particle_basic");if(K){var F=THREE.ShaderLib[K];n.uniforms=THREE.UniformsUtils.clone(F.uniforms);n.vertexShader=F.vertexShader;n.fragmentShader=F.fragmentShader}var T,G,I;T=I=F=0;for(G=C.length;T<
|
|
|
-G;T++){Q=C[T];Q instanceof THREE.DirectionalLight&&I++;Q instanceof THREE.PointLight&&F++}if(F+I<=4)C=I;else{C=Math.ceil(4*I/(F+I));F=4-C}Q={directional:C,point:F};I=50;if(x!==undefined&&x instanceof THREE.SkinnedMesh)I=x.bones.length;var L;a:{T=n.fragmentShader;G=n.vertexShader;F=n.uniforms;C=n.attributes;w={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:w,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
-maxDirLights:Q.directional,maxPointLights:Q.point,maxBones:I};var Z;Q=[];if(K)Q.push(K);else{Q.push(T);Q.push(G)}for(Z in w){Q.push(Z);Q.push(w[Z])}K=Q.join();Z=0;for(Q=Da.length;Z<Q;Z++)if(Da[Z].code==K){L=Da[Z].program;break a}Z=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,w.fog?"#define USE_FOG":"",w.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",w.map?"#define USE_MAP":
|
|
|
-"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,"#define MAX_BONES "+w.maxBones,w.map?"#define USE_MAP":"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?
|
|
|
-"#define USE_COLOR":"",w.skinning?"#define USE_SKINNING":"",w.morphTargets?"#define USE_MORPHTARGETS":"",w.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var La=!1;this.setSize=function(n,C){oa.width=n;oa.height=C;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(n,C,x,w){ka=n;ma=C;Fa=x;ja=w;e.viewport(ka,ma,Fa,ja)};this.setScissor=function(n,C,x,w){e.scissor(n,C,x,w)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){fa=
|
|
|
+n;e.depthMask(n)};this.setClearColorHex=function(n,C){var x=new THREE.Color(n);e.clearColor(x.r,x.g,x.b,C)};this.setClearColor=function(n,C){e.clearColor(n.r,n.g,n.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){S.darkness=n};this.getContext=function(){return e};this.initMaterial=function(n,C,x,w){var y,Q,K;if(n instanceof THREE.MeshDepthMaterial)K="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)K=
|
|
|
+"shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)K="normal";else if(n instanceof THREE.MeshBasicMaterial)K="basic";else if(n instanceof THREE.MeshLambertMaterial)K="lambert";else if(n instanceof THREE.MeshPhongMaterial)K="phong";else if(n instanceof THREE.LineBasicMaterial)K="basic";else n instanceof THREE.ParticleBasicMaterial&&(K="particle_basic");if(K){var F=THREE.ShaderLib[K];n.uniforms=THREE.UniformsUtils.clone(F.uniforms);n.vertexShader=F.vertexShader;n.fragmentShader=F.fragmentShader}var T,
|
|
|
+G,I;T=I=F=0;for(G=C.length;T<G;T++){Q=C[T];Q instanceof THREE.DirectionalLight&&I++;Q instanceof THREE.PointLight&&F++}if(F+I<=4)C=I;else{C=Math.ceil(4*I/(F+I));F=4-C}Q={directional:C,point:F};I=50;if(w!==undefined&&w instanceof THREE.SkinnedMesh)I=w.bones.length;var L;a:{T=n.fragmentShader;G=n.vertexShader;F=n.uniforms;C=n.attributes;x={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:x,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,
|
|
|
+maxMorphTargets:this.maxMorphTargets,maxDirLights:Q.directional,maxPointLights:Q.point,maxBones:I};var Z;Q=[];if(K)Q.push(K);else{Q.push(T);Q.push(G)}for(Z in x){Q.push(Z);Q.push(x[Z])}K=Q.join();Z=0;for(Q=Da.length;Z<Q;Z++)if(Da[Z].code==K){L=Da[Z].program;break a}Z=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
|
|
|
+"",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":
|
|
|
+"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":"",x.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
e.attachShader(Z,la("fragment",prefix_fragment+T));e.attachShader(Z,la("vertex",prefix_vertex+G));e.linkProgram(Z);e.getProgramParameter(Z,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(Z,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");Z.uniforms={};Z.attributes={};var Y;T=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(Y in F)T.push(Y);
|
|
|
-Y=T;F=0;for(T=Y.length;F<T;F++){G=Y[F];Z.uniforms[G]=e.getUniformLocation(Z,G)}T=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<w.maxMorphTargets;Y++)T.push("morphTarget"+Y);for(L in C)T.push(L);L=T;Y=0;for(C=L.length;Y<C;Y++){w=L[Y];Z.attributes[w]=e.getAttribLocation(Z,w)}Da.push({program:Z,code:K});L=Z}n.program=L;L=n.program.attributes;e.enableVertexAttribArray(L.position);L.color>=0&&e.enableVertexAttribArray(L.color);L.normal>=
|
|
|
+Y=T;F=0;for(T=Y.length;F<T;F++){G=Y[F];Z.uniforms[G]=e.getUniformLocation(Z,G)}T=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<x.maxMorphTargets;Y++)T.push("morphTarget"+Y);for(L in C)T.push(L);L=T;Y=0;for(C=L.length;Y<C;Y++){x=L[Y];Z.attributes[x]=e.getAttribLocation(Z,x)}Da.push({program:Z,code:K});L=Z}n.program=L;L=n.program.attributes;e.enableVertexAttribArray(L.position);L.color>=0&&e.enableVertexAttribArray(L.color);L.normal>=
|
|
|
0&&e.enableVertexAttribArray(L.normal);L.tangent>=0&&e.enableVertexAttribArray(L.tangent);if(n.skinning&&L.skinVertexA>=0&&L.skinVertexB>=0&&L.skinIndex>=0&&L.skinWeight>=0){e.enableVertexAttribArray(L.skinVertexA);e.enableVertexAttribArray(L.skinVertexB);e.enableVertexAttribArray(L.skinIndex);e.enableVertexAttribArray(L.skinWeight)}for(y in n.attributes)L[y]>=0&&e.enableVertexAttribArray(L[y]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(L.morphTarget0>=0){e.enableVertexAttribArray(L.morphTarget0);
|
|
|
n.numSupportedMorphTargets++}if(L.morphTarget1>=0){e.enableVertexAttribArray(L.morphTarget1);n.numSupportedMorphTargets++}if(L.morphTarget2>=0){e.enableVertexAttribArray(L.morphTarget2);n.numSupportedMorphTargets++}if(L.morphTarget3>=0){e.enableVertexAttribArray(L.morphTarget3);n.numSupportedMorphTargets++}if(L.morphTarget4>=0){e.enableVertexAttribArray(L.morphTarget4);n.numSupportedMorphTargets++}if(L.morphTarget5>=0){e.enableVertexAttribArray(L.morphTarget5);n.numSupportedMorphTargets++}if(L.morphTarget6>=
|
|
|
-0){e.enableVertexAttribArray(L.morphTarget6);n.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.morphTarget7);n.numSupportedMorphTargets++}x.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(y=this.maxMorphTargets;n<y;n++)x.__webglMorphTargetInfluences[n]=0}};this.render=function(n,C,w,x){var y,Q,K,F,T,G,I,L,Z=n.lights,Y=n.fog;ha.data.vertices=0;ha.data.faces=0;C.matrixAutoUpdate&&C.update(undefined,!0);n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(Za);
|
|
|
-C.projectionMatrix.flattenToArray(Xa);Ja.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);va(w);(this.autoClear||x)&&this.clear();T=n.__webglObjects.length;for(x=0;x<T;x++){y=n.__webglObjects[x];I=y.object;if(I.visible)if(!(I instanceof THREE.Mesh)||m(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);H(I,C);t(y);y.render=!0;if(this.sortObjects){Ta.copy(I.position);Ja.multiplyVector3(Ta);y.z=Ta.z}}else y.render=!1;else y.render=!1}this.sortObjects&&n.__webglObjects.sort(z);
|
|
|
-G=n.__webglObjectsImmediate.length;for(x=0;x<G;x++){y=n.__webglObjectsImmediate[x];I=y.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);H(I,C);p(y)}}U(THREE.NormalBlending);for(x=0;x<T;x++){y=n.__webglObjects[x];if(y.render){I=y.object;L=y.buffer;K=y.opaque;h(I);for(y=0;y<K.count;y++){F=K.list[y];j(F.depthTest);f(C,Z,Y,F,L,I)}}}for(x=0;x<G;x++){y=n.__webglObjectsImmediate[x];I=y.object;if(I.visible){K=y.opaque;h(I);for(y=0;y<K.count;y++){F=K.list[y];j(F.depthTest);
|
|
|
-Q=c(C,Z,Y,F,I);I.render(function(ra){g(ra,Q,F.shading)})}}}for(x=0;x<T;x++){y=n.__webglObjects[x];if(y.render){I=y.object;L=y.buffer;K=y.transparent;h(I);for(y=0;y<K.count;y++){F=K.list[y];U(F.blending);j(F.depthTest);f(C,Z,Y,F,L,I)}}}for(x=0;x<G;x++){y=n.__webglObjectsImmediate[x];I=y.object;if(I.visible){K=y.transparent;h(I);for(y=0;y<K.count;y++){F=K.list[y];U(F.blending);j(F.depthTest);Q=c(C,Z,Y,F,I);I.render(function(ra){g(ra,Q,F.shading)})}}}n.__webglSprites.length&&A(n,C);stencil&&n.__webglShadowVolumes.length&&
|
|
|
-n.lights.length&&u(n);n.__webglLensFlares.length&&E(n,C);if(w&&w.minFilter!==THREE.NearestFilter&&w.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,w.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var C=n.__objectsAdded[0],w=n,x=void 0,y=void 0,Q=void 0;
|
|
|
-if(C._modelViewMatrix==undefined){C._modelViewMatrix=new THREE.Matrix4;C._normalMatrixArray=new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){y=C.geometry;y.geometryGroups==undefined&&W(y);for(x in y.geometryGroups){Q=y.geometryGroups[x];if(!Q.__webglVertexBuffer){var K=Q;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=e.createBuffer();K.__webglTangentBuffer=
|
|
|
+0){e.enableVertexAttribArray(L.morphTarget6);n.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.morphTarget7);n.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(y=this.maxMorphTargets;n<y;n++)w.__webglMorphTargetInfluences[n]=0}};this.render=function(n,C,x,w){var y,Q,K,F,T,G,I,L,Z=n.lights,Y=n.fog;ha.data.vertices=0;ha.data.faces=0;C.matrixAutoUpdate&&C.update(undefined,!0);n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(Za);
|
|
|
+C.projectionMatrix.flattenToArray(Xa);Ja.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);va(x);(this.autoClear||w)&&this.clear();T=n.__webglObjects.length;for(w=0;w<T;w++){y=n.__webglObjects[w];I=y.object;if(I.visible)if(!(I instanceof THREE.Mesh)||m(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);H(I,C);t(y);y.render=!0;if(this.sortObjects){Ta.copy(I.position);Ja.multiplyVector3(Ta);y.z=Ta.z}}else y.render=!1;else y.render=!1}this.sortObjects&&n.__webglObjects.sort(z);
|
|
|
+G=n.__webglObjectsImmediate.length;for(w=0;w<G;w++){y=n.__webglObjectsImmediate[w];I=y.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);H(I,C);p(y)}}U(THREE.NormalBlending);for(w=0;w<T;w++){y=n.__webglObjects[w];if(y.render){I=y.object;L=y.buffer;K=y.opaque;h(I);for(y=0;y<K.count;y++){F=K.list[y];j(F.depthTest);f(C,Z,Y,F,L,I)}}}for(w=0;w<G;w++){y=n.__webglObjectsImmediate[w];I=y.object;if(I.visible){K=y.opaque;h(I);for(y=0;y<K.count;y++){F=K.list[y];j(F.depthTest);
|
|
|
+Q=c(C,Z,Y,F,I);I.render(function(ra){g(ra,Q,F.shading)})}}}for(w=0;w<T;w++){y=n.__webglObjects[w];if(y.render){I=y.object;L=y.buffer;K=y.transparent;h(I);for(y=0;y<K.count;y++){F=K.list[y];U(F.blending);j(F.depthTest);f(C,Z,Y,F,L,I)}}}for(w=0;w<G;w++){y=n.__webglObjectsImmediate[w];I=y.object;if(I.visible){K=y.transparent;h(I);for(y=0;y<K.count;y++){F=K.list[y];U(F.blending);j(F.depthTest);Q=c(C,Z,Y,F,I);I.render(function(ra){g(ra,Q,F.shading)})}}}n.__webglSprites.length&&A(n,C);stencil&&n.__webglShadowVolumes.length&&
|
|
|
+n.lights.length&&u(n);n.__webglLensFlares.length&&E(n,C);if(x&&x.minFilter!==THREE.NearestFilter&&x.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,x.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var C=n.__objectsAdded[0],x=n,w=void 0,y=void 0,Q=void 0;
|
|
|
+if(C._modelViewMatrix==undefined){C._modelViewMatrix=new THREE.Matrix4;C._normalMatrixArray=new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){y=C.geometry;y.geometryGroups==undefined&&W(y);for(w in y.geometryGroups){Q=y.geometryGroups[w];if(!Q.__webglVertexBuffer){var K=Q;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=e.createBuffer();K.__webglTangentBuffer=
|
|
|
e.createBuffer();K.__webglColorBuffer=e.createBuffer();K.__webglUVBuffer=e.createBuffer();K.__webglUV2Buffer=e.createBuffer();K.__webglSkinVertexABuffer=e.createBuffer();K.__webglSkinVertexBBuffer=e.createBuffer();K.__webglSkinIndicesBuffer=e.createBuffer();K.__webglSkinWeightsBuffer=e.createBuffer();K.__webglFaceBuffer=e.createBuffer();K.__webglLineBuffer=e.createBuffer();if(K.numMorphTargets){var F=void 0,T=void 0;K.__webglMorphTargetsBuffers=[];F=0;for(T=K.numMorphTargets;F<T;F++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=
|
|
|
Q;F=C;var G=void 0,I=void 0,L=void 0;L=void 0;var Z=void 0,Y=void 0,ra=void 0,Ka=ra=T=0;I=void 0;L=void 0;var Ca=void 0;G=void 0;I=void 0;Z=F.geometry;Ca=Z.faces;Y=K.faces;G=0;for(I=Y.length;G<I;G++){L=Y[G];L=Ca[L];if(L instanceof THREE.Face3){T+=3;ra+=1;Ka+=3}else if(L instanceof THREE.Face4){T+=4;ra+=2;Ka+=4}}G=K;I=F;Ca=void 0;Y=void 0;var Ha=void 0,Ga=void 0;Ha=void 0;L=[];Ca=0;for(Y=I.materials.length;Ca<Y;Ca++){Ha=I.materials[Ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=G.materials.length;Ha<
|
|
|
l;Ha++)(Ga=G.materials[Ha])&&L.push(Ga)}else(Ga=Ha)&&L.push(Ga)}G=L;a:{I=void 0;Ca=void 0;Y=G.length;for(I=0;I<Y;I++){Ca=G[I];if(Ca.map||Ca.lightMap||Ca instanceof THREE.MeshShaderMaterial){I=!0;break a}}I=!1}a:{Ca=G;Y=void 0;L=void 0;Ha=Ca.length;for(Y=0;Y<Ha;Y++){L=Ca[Y];if(!(L instanceof THREE.MeshBasicMaterial&&!L.envMap||L instanceof THREE.MeshDepthMaterial)){Ca=L&&L.shading!=undefined&&L.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}Ca=!1}a:{Y=void 0;L=void 0;Ha=
|
|
|
G.length;for(Y=0;Y<Ha;Y++){L=G[Y];if(L.vertexColors){L=L.vertexColors;break a}}L=!1}K.__vertexArray=new Float32Array(T*3);if(Ca)K.__normalArray=new Float32Array(T*3);if(Z.hasTangents)K.__tangentArray=new Float32Array(T*4);if(L)K.__colorArray=new Float32Array(T*3);if(I){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)K.__uvArray=new Float32Array(T*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(T*2)}if(F.geometry.skinWeights.length&&F.geometry.skinIndices.length){K.__skinVertexAArray=
|
|
|
new Float32Array(T*4);K.__skinVertexBArray=new Float32Array(T*4);K.__skinIndexArray=new Float32Array(T*4);K.__skinWeightArray=new Float32Array(T*4)}K.__faceArray=new Uint16Array(ra*3+(F.geometry.edgeFaces?F.geometry.edgeFaces.length*6:0));K.__lineArray=new Uint16Array(Ka*2);if(K.numMorphTargets){K.__morphTargetsArrays=[];Z=0;for(Y=K.numMorphTargets;Z<Y;Z++)K.__morphTargetsArrays.push(new Float32Array(T*3))}K.__needsSmoothNormals=Ca==THREE.SmoothShading;K.__uvType=I;K.__vertexColorType=L;K.__normalType=
|
|
|
Ca;K.__webglFaceCount=ra*3+(F.geometry.edgeFaces?F.geometry.edgeFaces.length*6:0);K.__webglLineCount=Ka*2;Z=0;for(Y=G.length;Z<Y;Z++)if(G[Z].attributes){K.__webglCustomAttributes={};for(a in G[Z].attributes){I=G[Z].attributes[a];ra=1;if(I.type==="v2")ra=2;else if(I.type==="v3")ra=3;else if(I.type==="v4")ra=4;else I.type==="c"&&(ra=3);I.size=ra;I.needsUpdate=!0;I.array=new Float32Array(T*ra);I.buffer=e.createBuffer();K.__webglCustomAttributes[a]=I}}y.__dirtyVertices=!0;y.__dirtyMorphTargets=!0;y.__dirtyElements=
|
|
|
-!0;y.__dirtyUvs=!0;y.__dirtyNormals=!0;y.__dirtyTangents=!0;y.__dirtyColors=!0}C instanceof THREE.ShadowVolume?B(w.__webglShadowVolumes,Q,C):B(w.__webglObjects,Q,C)}}else if(C instanceof THREE.LensFlare)B(w.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){y=C.geometry;if(!y.__webglVertexBuffer){x=y;x.__webglVertexBuffer=e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=y;Q=x.vertices.length;x.__vertexArray=new Float32Array(Q*3);x.__colorArray=new Float32Array(Q*3);x.__webglVertexCount=
|
|
|
-Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(w.__webglObjects,y,C)}else if(C instanceof THREE.Line){y=C.geometry;if(!y.__webglVertexBuffer){x=y;x.__webglVertexBuffer=e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=y;Q=x.vertices.length;x.__vertexArray=new Float32Array(Q*3);x.__colorArray=new Float32Array(Q*3);x.__webglLineCount=Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(w.__webglObjects,y,C)}else if(C instanceof THREE.ParticleSystem){y=C.geometry;if(!y.__webglVertexBuffer){x=y;x.__webglVertexBuffer=
|
|
|
-e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=y;Q=x.vertices.length;x.__vertexArray=new Float32Array(Q*3);x.__colorArray=new Float32Array(Q*3);x.__sortArray=[];x.__webglParticleCount=Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(w.__webglObjects,y,C)}else if(THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes)w.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});else C instanceof THREE.Sprite&&w.__webglSprites.push(C);n.__objectsAdded.splice(0,
|
|
|
-1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];w=n;y=void 0;x=void 0;if(C instanceof THREE.Mesh)for(y=w.__webglObjects.length-1;y>=0;y--){x=w.__webglObjects[y].object;if(C==x){w.__webglObjects.splice(y,1);break}}else if(C instanceof THREE.Sprite)for(y=w.__webglSprites.length-1;y>=0;y--){x=w.__webglSprites[y];if(C==x){w.__webglSprites.splice(y,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(w=n.__webglObjects.length;C<w;C++)J(n.__webglObjects[C].object,n);C=0;for(w=n.__webglShadowVolumes.length;C<
|
|
|
-w;C++)J(n.__webglShadowVolumes[C].object,n);C=0;for(w=n.__webglLensFlares.length;C<w;C++)J(n.__webglLensFlares[C].object,n)};this.setFaceCulling=function(n,C){if(n){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
+!0;y.__dirtyUvs=!0;y.__dirtyNormals=!0;y.__dirtyTangents=!0;y.__dirtyColors=!0}C instanceof THREE.ShadowVolume?B(x.__webglShadowVolumes,Q,C):B(x.__webglObjects,Q,C)}}else if(C instanceof THREE.LensFlare)B(x.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){y=C.geometry;if(!y.__webglVertexBuffer){w=y;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=y;Q=w.vertices.length;w.__vertexArray=new Float32Array(Q*3);w.__colorArray=new Float32Array(Q*3);w.__webglVertexCount=
|
|
|
+Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(x.__webglObjects,y,C)}else if(C instanceof THREE.Line){y=C.geometry;if(!y.__webglVertexBuffer){w=y;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=y;Q=w.vertices.length;w.__vertexArray=new Float32Array(Q*3);w.__colorArray=new Float32Array(Q*3);w.__webglLineCount=Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(x.__webglObjects,y,C)}else if(C instanceof THREE.ParticleSystem){y=C.geometry;if(!y.__webglVertexBuffer){w=y;w.__webglVertexBuffer=
|
|
|
+e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=y;Q=w.vertices.length;w.__vertexArray=new Float32Array(Q*3);w.__colorArray=new Float32Array(Q*3);w.__sortArray=[];w.__webglParticleCount=Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(x.__webglObjects,y,C)}else if(THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes)x.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});else C instanceof THREE.Sprite&&x.__webglSprites.push(C);n.__objectsAdded.splice(0,
|
|
|
+1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];x=n;y=void 0;w=void 0;if(C instanceof THREE.Mesh)for(y=x.__webglObjects.length-1;y>=0;y--){w=x.__webglObjects[y].object;if(C==w){x.__webglObjects.splice(y,1);break}}else if(C instanceof THREE.Sprite)for(y=x.__webglSprites.length-1;y>=0;y--){w=x.__webglSprites[y];if(C==w){x.__webglSprites.splice(y,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(x=n.__webglObjects.length;C<x;C++)J(n.__webglObjects[C].object,n);C=0;for(x=n.__webglShadowVolumes.length;C<
|
|
|
+x;C++)J(n.__webglShadowVolumes[C].object,n);C=0;for(x=n.__webglLensFlares.length;C<x;C++)J(n.__webglLensFlares[C].object,n)};this.setFaceCulling=function(n,C){if(n){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBAFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==
|
|
|
undefined?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==undefined?c.stencilBuffer:!0};
|
|
|
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f<g;f++){b=c[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
@@ -445,8 +445,8 @@ j=b.edges[g+1];f.edges.push(new THREE.Edge(f.vertices[h],f.vertices[j],h,j))}}})
|
|
|
THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
|
|
|
d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){m==0&&(m=j.getResponseHeader("Content-Length"));h({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2),n=p(R,S+3),C=(n<<1&255|La>>7)-127;P|=(La&127)<<16|Ba<<8;if(P==0&&C==-127)return 0;return(1-2*(n>>7))*(1+P*Math.pow(2,-23))*Math.pow(2,C)}function k(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2);return(p(R,S+3)<<24)+(La<<16)+(Ba<<8)+P}function m(R,S){var P=p(R,S);return(p(R,S+1)<<8)+P}function o(R,S){var P=p(R,S);return P>127?P-256:P}function p(R,
|
|
|
-S){return R.charCodeAt(S)&255}function t(R){var S,P,Ba;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);R=m(b,R+la);THREE.BinaryLoader.prototype.f3(J,S,P,Ba,R)}function z(R){var S,P,Ba,La,n,C;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);La=m(b,R+la);n=k(b,R+pa);C=k(b,R+ga);R=k(b,R+ha);THREE.BinaryLoader.prototype.f3n(J,U,S,P,Ba,La,n,C,R)}function u(R){var S,P,Ba,La;S=k(b,R);P=k(b,R+e);Ba=k(b,R+oa);La=k(b,R+Da);R=m(b,R+Aa);THREE.BinaryLoader.prototype.f4(J,S,P,Ba,La,R)}function A(R){var S,P,Ba,La,n,C,w,x;S=k(b,R);P=k(b,R+e);
|
|
|
-Ba=k(b,R+oa);La=k(b,R+Da);n=m(b,R+Aa);C=k(b,R+ia);w=k(b,R+fa);x=k(b,R+wa);R=k(b,R+ta);THREE.BinaryLoader.prototype.f4n(J,U,S,P,Ba,La,n,C,w,x,R)}function E(R){var S,P;S=k(b,R);P=k(b,R+qa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[R*2],O[R*2+1])}function H(R){var S,P,Ba;S=k(b,R);P=k(b,R+ka);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[Ba*2],O[Ba*2+1],O[R*2],O[R*2+1])}var J=this,
|
|
|
+S){return R.charCodeAt(S)&255}function t(R){var S,P,Ba;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);R=m(b,R+la);THREE.BinaryLoader.prototype.f3(J,S,P,Ba,R)}function z(R){var S,P,Ba,La,n,C;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);La=m(b,R+la);n=k(b,R+pa);C=k(b,R+ga);R=k(b,R+ha);THREE.BinaryLoader.prototype.f3n(J,U,S,P,Ba,La,n,C,R)}function u(R){var S,P,Ba,La;S=k(b,R);P=k(b,R+e);Ba=k(b,R+oa);La=k(b,R+Da);R=m(b,R+Aa);THREE.BinaryLoader.prototype.f4(J,S,P,Ba,La,R)}function A(R){var S,P,Ba,La,n,C,x,w;S=k(b,R);P=k(b,R+e);
|
|
|
+Ba=k(b,R+oa);La=k(b,R+Da);n=m(b,R+Aa);C=k(b,R+ia);x=k(b,R+fa);w=k(b,R+wa);R=k(b,R+ta);THREE.BinaryLoader.prototype.f4n(J,U,S,P,Ba,La,n,C,x,w,R)}function E(R){var S,P;S=k(b,R);P=k(b,R+qa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[R*2],O[R*2+1])}function H(R){var S,P,Ba;S=k(b,R);P=k(b,R+ka);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[Ba*2],O[Ba*2+1],O[R*2],O[R*2+1])}var J=this,
|
|
|
W=0,B,U=[],O=[],M,va,la,pa,ga,ha,e,oa,Da,Aa,ia,fa,wa,ta,qa,ca,ka,ma,Fa,ja,da,Ja,Xa,Za,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(J,f,h);B={signature:b.substr(W,8),header_bytes:p(b,W+8),vertex_coordinate_bytes:p(b,W+9),normal_coordinate_bytes:p(b,W+10),uv_coordinate_bytes:p(b,W+11),vertex_index_bytes:p(b,W+12),normal_index_bytes:p(b,W+13),uv_index_bytes:p(b,W+14),material_index_bytes:p(b,W+15),nvertices:k(b,W+16),nnormals:k(b,W+16+4),nuvs:k(b,W+16+8),ntri_flat:k(b,W+16+12),
|
|
|
ntri_smooth:k(b,W+16+16),ntri_flat_uv:k(b,W+16+20),ntri_smooth_uv:k(b,W+16+24),nquad_flat:k(b,W+16+28),nquad_smooth:k(b,W+16+32),nquad_flat_uv:k(b,W+16+36),nquad_smooth_uv:k(b,W+16+40)};W+=B.header_bytes;M=B.vertex_index_bytes;va=B.vertex_index_bytes*2;la=B.vertex_index_bytes*3;pa=B.vertex_index_bytes*3+B.material_index_bytes;ga=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;ha=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;e=B.vertex_index_bytes;oa=B.vertex_index_bytes*
|
|
|
2;Da=B.vertex_index_bytes*3;Aa=B.vertex_index_bytes*4;ia=B.vertex_index_bytes*4+B.material_index_bytes;fa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;wa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;ta=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;qa=B.uv_index_bytes;ca=B.uv_index_bytes*2;ka=B.uv_index_bytes;ma=B.uv_index_bytes*2;Fa=B.uv_index_bytes*3;h=B.vertex_index_bytes*3+B.material_index_bytes;Ta=B.vertex_index_bytes*4+B.material_index_bytes;
|
|
@@ -506,13 +506,13 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
|
|
|
4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
|
|
|
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
|
|
|
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(b,d){this.point=b;this.normal=d};THREE.SphereCollider=function(b,d){this.center=b;this.radius=d;this.radiusSq=d*d};THREE.BoxCollider=function(b,d){this.min=b;this.max=d;this.dynamic=!0};
|
|
|
-THREE.MeshCollider=function(b,d,c,f){this.vertices=b;this.faces=d;this.normals=c;this.box=f;this.numFaces=this.faces.length};THREE.CollisionSystem=function(){this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;
|
|
|
+THREE.MeshCollider=function(b,d,c,f){this.vertices=b;this.faces=d;this.normals=c;this.box=f;this.numFaces=this.faces.length};THREE.CollisionSystem=function(){this.collisionNormal=null;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;
|
|
|
THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var d,c,f,g,h=0;d=0;for(c=this.colliders.length;d<c;d++){g=this.colliders[d];f=this.rayCast(b,g);if(f<Number.MAX_VALUE){g.distance=f;f>h?this.hits.push(g):this.hits.unshift(g);h=f}}return this.hits};
|
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(b){var d=this.rayCastAll(b);if(d.length==0)return null;for(var c=0;d[c]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,d[c]);if(f<Number.MAX_VALUE){d[c].distance=f;break}c++}if(c>d.length)return null;return d[c]};
|
|
|
THREE.CollisionSystem.prototype.rayCast=function(b,d){if(d instanceof THREE.PlaneCollider)return this.rayPlane(b,d);else if(d instanceof THREE.SphereCollider)return this.raySphere(b,d);else if(d instanceof THREE.BoxCollider)return this.rayBox(b,d);else if(d instanceof THREE.MeshCollider&&d.box)return this.rayBox(b,d.box)};
|
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(b,d){for(var c=this.makeRayLocal(b,d.mesh),f=Number.MAX_VALUE,g=0;g<d.numFaces/3;g++){var h=g*3;f=Math.min(f,this.rayTriangle(c,d.vertices[d.faces[h+0]],d.vertices[d.faces[h+1]],d.vertices[d.faces[h+2]],d.normals[d.faces[g]],f))}return f};
|
|
|
-THREE.CollisionSystem.prototype.rayTriangle=function(b,d,c,f,g,h){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;j.sub(c,d);k.sub(f,c);g.cross(j,k);k=g.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=g.dot(d)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*h))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);if(Math.abs(g.x)>Math.abs(g.y))if(Math.abs(g.x)>Math.abs(g.z)){b=k.y-d.y;g=c.y-d.y;h=f.y-d.y;
|
|
|
-k=k.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=k.x-d.x;g=c.x-d.x;h=f.x-d.x;k=k.y-d.y;c=c.y-d.y;f=f.y-d.y}else if(Math.abs(g.y)>Math.abs(g.z)){b=k.x-d.x;g=c.x-d.x;h=f.x-d.x;k=k.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=k.x-d.x;g=c.x-d.x;h=f.x-d.x;k=k.y-d.y;c=c.y-d.y;f=f.y-d.y}d=g*f-c*h;if(d==0)return Number.MAX_VALUE;d=1/d;f=(b*f-k*h)*d;if(!(f>=0))return Number.MAX_VALUE;d*=g*k-c*b;if(!(d>=0))return Number.MAX_VALUE;if(!(1-f-d>=0))return Number.MAX_VALUE;return j};
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(b,d){for(var c=this.makeRayLocal(b,d.mesh),f=Number.MAX_VALUE,g=0;g<d.numFaces/3;g++){var h=g*3;h=this.rayTriangle(c,d.vertices[d.faces[h+0]],d.vertices[d.faces[h+1]],d.vertices[d.faces[h+2]],d.normals[d.faces[g]],f);if(h<f){f=h;d.normal=this.collisionNormal}}return f};
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(b,d,c,f,g,h){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;j.sub(c,d);k.sub(f,c);g.cross(j,k);k=g.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=g.dot(d)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*h))return Number.MAX_VALUE;j/=k;var m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(j);m.addSelf(b.origin);if(Math.abs(g.x)>Math.abs(g.y))if(Math.abs(g.x)>Math.abs(g.z)){b=m.y-d.y;h=c.y-d.y;k=f.y-
|
|
|
+d.y;m=m.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=m.x-d.x;h=c.x-d.x;k=f.x-d.x;m=m.y-d.y;c=c.y-d.y;f=f.y-d.y}else if(Math.abs(g.y)>Math.abs(g.z)){b=m.x-d.x;h=c.x-d.x;k=f.x-d.x;m=m.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=m.x-d.x;h=c.x-d.x;k=f.x-d.x;m=m.y-d.y;c=c.y-d.y;f=f.y-d.y}d=h*f-c*k;if(d==0)return Number.MAX_VALUE;d=1/d;f=(b*f-m*k)*d;if(!(f>=0))return Number.MAX_VALUE;d*=h*m-c*b;if(!(d>=0))return Number.MAX_VALUE;if(!(1-f-d>=0))return Number.MAX_VALUE;this.collisionNormal=g;return j};
|
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(b,d){var c=new THREE.Ray(b.origin.clone(),b.direction.clone()),f=THREE.Matrix4.makeInvert(d.matrixWorld);f.multiplyVector3(c.origin);f.rotateAxis(c.direction);c.direction.normalize();return c};
|
|
|
THREE.CollisionSystem.prototype.rayBox=function(b,d){var c;c=d.dynamic&&d.mesh&&d.mesh.matrixWorld?this.makeRayLocal(b,d.mesh):new THREE.Ray(b.origin.clone(),b.direction.clone());var f=0,g=0,h=0,j=0,k=0,m=0,o=!0;if(c.origin.x<d.min.x){f=d.min.x-c.origin.x;f/=c.direction.x;o=!1;j=-1}else if(c.origin.x>d.max.x){f=d.max.x-c.origin.x;f/=c.direction.x;o=!1;j=1}if(c.origin.y<d.min.y){g=d.min.y-c.origin.y;g/=c.direction.y;o=!1;k=-1}else if(c.origin.y>d.max.y){g=d.max.y-c.origin.y;g/=c.direction.y;o=!1;k=
|
|
|
1}if(c.origin.z<d.min.z){h=d.min.z-c.origin.z;h/=c.direction.z;o=!1;m=-1}else if(c.origin.z>d.max.z){h=d.max.z-c.origin.z;h/=c.direction.z;o=!1;m=1}if(o)return-1;o=0;if(g>f){o=1;f=g}if(h>f){o=2;f=h}switch(o){case 0:k=c.origin.y+c.direction.y*f;if(k<d.min.y||k>d.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*f;if(c<d.min.z||c>d.max.z)return Number.MAX_VALUE;d.normal=new THREE.Vector3(j,0,0);break;case 1:j=c.origin.x+c.direction.x*f;if(j<d.min.x||j>d.max.x)return Number.MAX_VALUE;c=c.origin.z+
|