|
@@ -31,9 +31,10 @@ this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=
|
|
|
this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
|
|
|
b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0,
|
|
|
0,1);return this},setScale:function(b,d,c){this.set(b,0,0,0,0,d,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var c=Math.cos(d),f=Math.sin(d),g=
|
|
|
-1-c,h=b.x,j=b.y,k=b.z,m=g*h,o=g*j;this.set(m*h+c,m*j-f*k,m*k+f*j,0,m*j+f*k,o*j+c,o*k-f*h,0,m*k-f*j,o*k+f*h,g*k*k+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+d*h;this.n33=
|
|
|
-b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var m=d*j;d*=k;var o=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(o+f);this.n12=m-g;this.n13=d+j;this.n21=m+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},extractPosition:function(b){this.n14=
|
|
|
-b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
|
+1-c,h=b.x,j=b.y,k=b.z,m=g*h,o=g*j;this.set(m*h+c,m*j-f*k,m*k+f*j,0,m*j+f*k,o*j+c,o*k-f*h,0,m*k-f*j,o*k+f*h,g*k*k+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=
|
|
|
+new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+
|
|
|
+d*h;this.n33=b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var m=d*j;d*=k;var o=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(o+f);this.n12=m-g;this.n13=d+j;this.n21=m+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},
|
|
|
+extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
|
THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,t=b.n32,z=b.n33,u=b.n34,A=b.n41,E=b.n42,H=b.n43,J=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*u*E-o*z*E+o*t*H-k*u*H-m*t*J+k*z*J;d.n12=h*z*E-g*u*E-h*t*H+f*u*H+g*t*J-f*z*J;d.n13=g*o*E-h*m*E+h*k*H-f*o*H-g*k*J+f*m*J;d.n14=h*m*t-g*o*t-h*k*z+f*o*z+g*k*u-f*m*u;d.n21=o*z*A-m*u*A-o*p*H+j*u*H+m*p*J-j*z*J;d.n22=g*u*A-h*z*A+h*p*H-c*u*H-g*p*J+c*z*J;d.n23=h*m*A-g*o*A-h*j*H+c*o*H+g*j*J-c*m*J;
|
|
|
d.n24=g*o*p-h*m*p+h*j*z-c*o*z-g*j*u+c*m*u;d.n31=k*u*A-o*t*A+o*p*E-j*u*E-k*p*J+j*t*J;d.n32=h*t*A-f*u*A-h*p*E+c*u*E+f*p*J-c*t*J;d.n33=g*o*A-h*k*A+h*j*E-c*o*E-f*j*J+c*k*J;d.n34=h*k*p-f*o*p-h*j*t+c*o*t+f*j*u-c*k*u;d.n41=m*t*A-k*z*A-m*p*E+j*z*E+k*p*H-j*t*H;d.n42=f*z*A-g*t*A+g*p*E-c*z*E-f*p*H+c*t*H;d.n43=g*k*A-f*m*A-g*j*E+c*m*E+f*j*H-c*k*H;d.n44=f*m*p-g*k*p+g*j*t-c*m*t-f*j*z+c*k*z;d.multiplyScalar(1/b.determinant());return d};
|
|
|
THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*o;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*m;c[6]=b*o;c[7]=b*p;c[8]=b*t;return d};
|
|
@@ -49,7 +50,7 @@ THREE.Quaternion.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;thi
|
|
|
b.y*f;this.z=b.z*f;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},
|
|
|
multiplySelf:function(b){var d=this.x,c=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=d*b+g*h+c*k-f*j;this.y=c*b+g*j+f*h-d*k;this.z=f*b+g*k+d*j-c*h;this.w=g*b-d*h-c*j-f*k;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,o=m*c+j*g-k*f,p=
|
|
|
m*f+k*c-h*g,t=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=o*m+c*-h+p*-k-t*-j;d.y=p*m+c*-j+t*-h-o*-k;d.z=t*m+c*-k+o*-j-p*-h;return d}};
|
|
|
-THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
+THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(b,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
|
|
|
THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
@@ -71,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;
|
|
@@ -149,12 +150,12 @@ ca=b();ca.positionScreen.copy(wa[0].position);ua.multiplyVector4(ca.positionScre
|
|
|
THREE.Particle){N.set(da.position.x,da.position.y,da.position.z,1);O.multiplyVector4(N);N.z/=N.w;if(N.z>0&&N.z<1){Ja=B[W]=B[W]||new THREE.RenderableParticle;W++;J=Ja;J.x=N.x/N.w;J.y=N.y/N.w;J.z=N.z;J.rotation=da.rotation.z;J.scale.x=da.scale.x*Math.abs(J.x-(N.x+e.projectionMatrix.n11)/(N.w+e.projectionMatrix.n14));J.scale.y=da.scale.y*Math.abs(J.y-(N.y+e.projectionMatrix.n22)/(N.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,N,O,ua,la,pa=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ha,e,oa,Da,Aa,ka,fa,va,sa,wa,ca,ja,ma=new THREE.Color,Fa=new THREE.Color,ia=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,qa,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);qa=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,$,ta=V.lights;F.setRGB(0,
|
|
|
+1,E=0,H=null,J=null,W=null,B=null,U=null,N,O,ua,la,pa=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ha,e,oa,Da,Aa,ka,fa,va,sa,wa,ca,ja,ma=new THREE.Color,Fa=new THREE.Color,ia=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,qa,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);qa=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,$,ta=V.lights;F.setRGB(0,
|
|
|
0,0);T.setRGB(0,0,0);G.setRGB(0,0,0);V=0;for(na=ta.length;V<na;V++){ea=ta[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 ta,ra,ya,X,Ia=V.lights;V=0;for(ta=Ia.length;V<ta;V++){ra=Ia[V];ya=ra.color;if(ra instanceof THREE.DirectionalLight){X=ea.dot(ra.position);if(!(X<=0)){X*=ra.intensity;$.r+=ya.r*X;$.g+=
|
|
|
ya.g*X;$.b+=ya.b*X}}else if(ra instanceof THREE.PointLight){X=ea.dot(I.sub(ra.position,na).normalize());if(!(X<=0)){X*=ra.distance==0?1:1-Math.min(na.distanceTo(ra.position)/ra.distance,1);if(X!=0){X*=ra.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 $,ta,ra,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;ra=na.scale.y*p;$=ea*X;ta=ra*Ia;y.set(V.x-$,V.y-ta,V.x+$,V.y+
|
|
|
-ta);if(w.instersects(y)){t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale(ea,-ra);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ta=na.scale.y*p;y.set(V.x-$,V.y-ta,V.x+$,V.y+ta);if(w.instersects(y)){c(ea.color.__styleString);ra=ea.color.__styleString;if(J!=ra)t.fillStyle=J=ra;t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale($,ta);ea.program(t);t.restore()}}}function D(V,na,ea,$){b($.opacity);d($.blending);
|
|
|
+ta);if(x.instersects(y)){t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale(ea,-ra);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ta=na.scale.y*p;y.set(V.x-$,V.y-ta,V.x+$,V.y+ta);if(x.instersects(y)){c(ea.color.__styleString);ra=ea.color.__styleString;if(J!=ra)t.fillStyle=J=ra;t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale($,ta);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,$,ta,ra,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;ka=ea.positionScreen.y;ab(ha,e,oa,Da,Aa,ka);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,ka,X.map.image,R[$].u,R[$].v,R[ta].u,R[ta].v,R[ra].u,R[ra].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,ka,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
|
|
@@ -170,10 +171,10 @@ $);t.lineTo(ta,ra);t.lineTo(ya,X);t.lineTo(V,na);t.closePath()}function Oa(V,na,
|
|
|
Sa*ea)*db;$=(Ya*ra-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 ta=~~(V.r*255),ra=~~(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);qa[0]=ta<0?0:ta>255?255:ta;qa[1]=ra<0?0:ra>255?255:ra;qa[2]=V<0?0:V>255?255:V;qa[4]=ya<0?0:ya>255?255:ya;qa[5]=X<0?0:X>255?255:X;qa[6]=na<0?
|
|
|
0:na>255?255:na;qa[8]=Ia<0?0:Ia>255?255:Ia;qa[9]=Ya<0?0:Ya>255?255:Ya;qa[10]=ea<0?0:ea>255?255:ea;qa[12]=eb<0?0:eb>255?255:eb;qa[13]=Sa<0?0:Sa>255?255:Sa;qa[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,ta=1/Math.sqrt(ea*ea+$*$);ea*=ta;$*=ta;na.x+=ea;na.y+=$;V.x-=ea;V.y-=$}var bb,Va,M,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++){M=g[bb];y.empty();if(M instanceof THREE.RenderableParticle){N=M;N.x*=o;N.y*=p;Na=0;for(Ra=M.materials.length;Na<Ra;){Pa=M.materials[Na++];Pa.opacity!=0&&Ua(N,M,Pa,Ga)}}else if(M instanceof THREE.RenderableLine){N=M.v1;O=M.v2;N.positionScreen.x*=o;N.positionScreen.y*=p;O.positionScreen.x*=o;O.positionScreen.y*=p;y.addPoint(N.positionScreen.x,
|
|
|
-N.positionScreen.y);y.addPoint(O.positionScreen.x,O.positionScreen.y);if(w.instersects(y)){Na=0;for(Ra=M.materials.length;Na<Ra;){Pa=M.materials[Na++];Pa.opacity!=0&&D(N,O,M,Pa,Ga)}}}else if(M instanceof THREE.RenderableFace3){N=M.v1;O=M.v2;ua=M.v3;N.positionScreen.x*=o;N.positionScreen.y*=p;O.positionScreen.x*=o;O.positionScreen.y*=p;ua.positionScreen.x*=o;ua.positionScreen.y*=p;if(M.overdraw){Ma(N.positionScreen,O.positionScreen);Ma(O.positionScreen,ua.positionScreen);Ma(ua.positionScreen,N.positionScreen)}y.add3Points(N.positionScreen.x,
|
|
|
-N.positionScreen.y,O.positionScreen.x,O.positionScreen.y,ua.positionScreen.x,ua.positionScreen.y);if(w.instersects(y)){Na=0;for(Ra=M.meshMaterials.length;Na<Ra;){Pa=M.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=M.faceMaterials.length;ib<jb;)(Pa=M.faceMaterials[ib++])&&Pa.opacity!=0&&aa(N,O,ua,0,1,2,M,Pa,Ga)}else Pa.opacity!=0&&aa(N,O,ua,0,1,2,M,Pa,Ga)}}}else if(M instanceof THREE.RenderableFace4){N=M.v1;O=M.v2;ua=M.v3;la=M.v4;N.positionScreen.x*=o;N.positionScreen.y*=
|
|
|
+N.positionScreen.y);y.addPoint(O.positionScreen.x,O.positionScreen.y);if(x.instersects(y)){Na=0;for(Ra=M.materials.length;Na<Ra;){Pa=M.materials[Na++];Pa.opacity!=0&&D(N,O,M,Pa,Ga)}}}else if(M instanceof THREE.RenderableFace3){N=M.v1;O=M.v2;ua=M.v3;N.positionScreen.x*=o;N.positionScreen.y*=p;O.positionScreen.x*=o;O.positionScreen.y*=p;ua.positionScreen.x*=o;ua.positionScreen.y*=p;if(M.overdraw){Ma(N.positionScreen,O.positionScreen);Ma(O.positionScreen,ua.positionScreen);Ma(ua.positionScreen,N.positionScreen)}y.add3Points(N.positionScreen.x,
|
|
|
+N.positionScreen.y,O.positionScreen.x,O.positionScreen.y,ua.positionScreen.x,ua.positionScreen.y);if(x.instersects(y)){Na=0;for(Ra=M.meshMaterials.length;Na<Ra;){Pa=M.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=M.faceMaterials.length;ib<jb;)(Pa=M.faceMaterials[ib++])&&Pa.opacity!=0&&aa(N,O,ua,0,1,2,M,Pa,Ga)}else Pa.opacity!=0&&aa(N,O,ua,0,1,2,M,Pa,Ga)}}}else if(M instanceof THREE.RenderableFace4){N=M.v1;O=M.v2;ua=M.v3;la=M.v4;N.positionScreen.x*=o;N.positionScreen.y*=
|
|
|
p;O.positionScreen.x*=o;O.positionScreen.y*=p;ua.positionScreen.x*=o;ua.positionScreen.y*=p;la.positionScreen.x*=o;la.positionScreen.y*=p;pa.positionScreen.copy(O.positionScreen);ga.positionScreen.copy(la.positionScreen);if(M.overdraw){Ma(N.positionScreen,O.positionScreen);Ma(O.positionScreen,la.positionScreen);Ma(la.positionScreen,N.positionScreen);Ma(ua.positionScreen,pa.positionScreen);Ma(ua.positionScreen,ga.positionScreen)}y.addPoint(N.positionScreen.x,N.positionScreen.y);y.addPoint(O.positionScreen.x,
|
|
|
-O.positionScreen.y);y.addPoint(ua.positionScreen.x,ua.positionScreen.y);y.addPoint(la.positionScreen.x,la.positionScreen.y);if(w.instersects(y)){Na=0;for(Ra=M.meshMaterials.length;Na<Ra;){Pa=M.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=M.faceMaterials.length;ib<jb;)(Pa=M.faceMaterials[ib++])&&Pa.opacity!=0&&v(N,O,ua,la,pa,ga,M,Pa,Ga)}else Pa.opacity!=0&&v(N,O,ua,la,pa,ga,M,Pa,Ga)}}}x.addRectangle(y)}t.setTransform(1,0,0,1,0,0)}};
|
|
|
+O.positionScreen.y);y.addPoint(ua.positionScreen.x,ua.positionScreen.y);y.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(y)){Na=0;for(Ra=M.meshMaterials.length;Na<Ra;){Pa=M.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=M.faceMaterials.length;ib<jb;)(Pa=M.faceMaterials[ib++])&&Pa.opacity!=0&&v(N,O,ua,la,pa,ga,M,Pa,Ga)}else Pa.opacity!=0&&v(N,O,ua,la,pa,ga,M,Pa,Ga)}}}w.addRectangle(y)}t.setTransform(1,0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function b(fa,va,sa){var wa,ca,ja,ma;wa=0;for(ca=fa.lights.length;wa<ca;wa++){ja=fa.lights[wa];if(ja instanceof THREE.DirectionalLight){ma=va.normalWorld.dot(ja.position)*ja.intensity;if(ma>0){sa.r+=ja.color.r*ma;sa.g+=ja.color.g*ma;sa.b+=ja.color.b*ma}}else if(ja instanceof THREE.PointLight){ga.sub(ja.position,va.centroidWorld);ga.normalize();ma=va.normalWorld.dot(ga)*ja.intensity;if(ma>0){sa.r+=ja.color.r*ma;sa.g+=ja.color.g*ma;sa.b+=ja.color.b*ma}}}}function d(fa,va,
|
|
|
sa,wa,ca,ja){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+va.positionScreen.x+" "+va.positionScreen.y+" L "+sa.positionScreen.x+","+sa.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)U.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(B){N.r=O.r;N.g=O.g;N.b=O.b;b(ja,wa,N);U.r=ca.color.r*N.r;U.g=ca.color.g*N.g;U.b=ca.color.b*N.b;U.updateStyleString()}else U.__styleString=
|
|
|
ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){pa=1-ca.__2near/(ca.__farPlusNear-wa.z*ca.__farMinusNear);U.setRGB(pa,pa,pa)}else ca instanceof THREE.MeshNormalMaterial&&U.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.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",
|
|
@@ -218,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,qa=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(qa)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(qa||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,qa,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;qa=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]=qa.x;xa[Ca+1]=qa.y;xa[Ca+2]=qa.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]=qa.x;za[G+1]=qa.y;za[G+2]=qa.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,qa=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(qa)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(qa||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,qa,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;qa=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]=qa.x;xa[Ca+1]=qa.y;xa[Ca+2]=qa.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]=qa.x;za[G+1]=qa.y;za[G+2]=qa.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}N(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 O(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 O(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(va!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);va=n.doubleSided}if(sa!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);sa=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(va!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);va=n.doubleSided}if(sa!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);sa=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);wa="";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=ia/Fa,F,T=[],G=Fa*0.5,I=ia*0.5,L=!0;e.useProgram(_sprite.program);Aa=_sprite.program;wa="";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:ia);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);O(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=ia/Fa,I=Fa*0.5,L=ia*0.5,Z=16/ia,Y=[Z*G,Z],qa=[1,1,0],Ka=[1,1],Ca=P.uniforms;w=P.attributes;e.useProgram(P.program);Aa=P.program;wa="";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);qa[0]=T.x;qa[1]=T.y;qa[2]=T.z;Ka[0]=qa[0]*I+I;Ka[1]=qa[1]*
|
|
|
-L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ia){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,qa);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=qa[0];w.positionScreen.y=qa[1];w.positionScreen.z=qa[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.001&&F.scale>0.001){qa[0]=F.x;qa[1]=F.y;qa[2]=F.z;Z=F.size*F.scale/ia;Y[0]=Z*G;Y[1]=Z;e.uniform3fv(Ca.screenPosition,qa);e.uniform2fv(Ca.scale,Y);
|
|
|
-e.uniform1f(Ca.rotation,F.rotation);e.uniform1f(Ca.opacity,F.opacity);U(F.blending);O(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,qa=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,M=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,ta=x.__skinIndexArray,ra=x.__skinWeightArray,
|
|
|
-ya=x.__morphTargetsArrays,X=x.__webglCustomAttributes;v=void 0;var Ia=x.__faceArray,Ya=x.__lineArray,eb=x.__needsSmoothNormals;Ka=x.__vertexColorType;qa=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];ra[M]=D.x;ra[M+1]=D.y;ra[M+2]=D.z;ra[M+3]=D.w;ra[M+4]=aa.x;ra[M+5]=aa.y;ra[M+6]=aa.z;ra[M+7]=aa.w;ra[M+8]=v.x;ra[M+9]=v.y;ra[M+10]=v.z;ra[M+11]=v.w;
|
|
|
-D=qb[G.a];aa=qb[G.b];v=qb[G.c];ta[M]=D.x;ta[M+1]=D.y;ta[M+2]=D.z;ta[M+3]=D.w;ta[M+4]=aa.x;ta[M+5]=aa.y;ta[M+6]=aa.z;ta[M+7]=aa.w;ta[M+8]=v.x;ta[M+9]=v.y;ta[M+10]=v.z;ta[M+11]=v.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ea[M]=D.x;ea[M+1]=D.y;ea[M+2]=D.z;ea[M+3]=1;ea[M+4]=aa.x;ea[M+5]=aa.y;ea[M+6]=aa.z;ea[M+7]=1;ea[M+8]=v.x;ea[M+9]=v.y;ea[M+10]=v.z;ea[M+11]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];$[M]=D.x;$[M+1]=D.y;$[M+2]=D.z;$[M+3]=1;$[M+4]=aa.x;$[M+5]=aa.y;$[M+6]=aa.z;$[M+7]=1;$[M+8]=v.x;$[M+9]=v.y;$[M+10]=v.z;
|
|
|
-$[M+11]=1;M+=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&&qa)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&qa)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];ra[M]=D.x;ra[M+1]=D.y;
|
|
|
-ra[M+2]=D.z;ra[M+3]=D.w;ra[M+4]=aa.x;ra[M+5]=aa.y;ra[M+6]=aa.z;ra[M+7]=aa.w;ra[M+8]=v.x;ra[M+9]=v.y;ra[M+10]=v.z;ra[M+11]=v.w;ra[M+12]=ab.x;ra[M+13]=ab.y;ra[M+14]=ab.z;ra[M+15]=ab.w;D=qb[G.a];aa=qb[G.b];v=qb[G.c];ab=qb[G.d];ta[M]=D.x;ta[M+1]=D.y;ta[M+2]=D.z;ta[M+3]=D.w;ta[M+4]=aa.x;ta[M+5]=aa.y;ta[M+6]=aa.z;ta[M+7]=aa.w;ta[M+8]=v.x;ta[M+9]=v.y;ta[M+10]=v.z;ta[M+11]=v.w;ta[M+12]=ab.x;ta[M+13]=ab.y;ta[M+14]=ab.z;ta[M+15]=ab.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ab=ob[G.d];ea[M]=D.x;ea[M+1]=D.y;ea[M+2]=D.z;
|
|
|
-ea[M+3]=1;ea[M+4]=aa.x;ea[M+5]=aa.y;ea[M+6]=aa.z;ea[M+7]=1;ea[M+8]=v.x;ea[M+9]=v.y;ea[M+10]=v.z;ea[M+11]=1;ea[M+12]=ab.x;ea[M+13]=ab.y;ea[M+14]=ab.z;ea[M+15]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];G=pb[G.d];$[M]=D.x;$[M+1]=D.y;$[M+2]=D.z;$[M+3]=1;$[M+4]=aa.x;$[M+5]=aa.y;$[M+6]=aa.z;$[M+7]=1;$[M+8]=v.x;$[M+9]=v.y;$[M+10]=v.z;$[M+11]=1;$[M+12]=G.x;$[M+13]=G.y;$[M+14]=G.z;$[M+15]=1;M+=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&&qa)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&qa)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(M>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,ta,Q);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ra,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++){qa=Ka[F].position;y=F*3;Ha[y]=qa.x;Ha[y+1]=qa.y;Ha[y+2]=qa.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++){qa=Ka[F].position;y=F*3;Ha[y]=qa.x;Ha[y+1]=qa.y;Ha[y+2]=
|
|
|
-qa.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!=wa){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)}wa=n}}function N(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);wa="";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=ia/Fa,F,T=[],G=Fa*0.5,I=ia*0.5,L=!0;e.useProgram(_sprite.program);Aa=_sprite.program;wa="";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:ia);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);O(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=ia/Fa,I=Fa*0.5,L=ia*0.5,Z=16/ia,Y=[Z*G,Z],qa=[1,1,0],Ka=[1,1],Ca=P.uniforms;x=P.attributes;e.useProgram(P.program);Aa=P.program;wa="";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);qa[0]=T.x;qa[1]=T.y;qa[2]=T.z;Ka[0]=qa[0]*I+I;Ka[1]=qa[1]*L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ia){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,qa);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=qa[0];x.positionScreen.y=qa[1];x.positionScreen.z=qa[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){qa[0]=F.x;qa[1]=F.y;qa[2]=F.z;Z=F.size*
|
|
|
+F.scale/ia;Y[0]=Z*G;Y[1]=Z;e.uniform3fv(Ca.screenPosition,qa);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,F.rotation);e.uniform1f(Ca.opacity,F.opacity);U(F.blending);O(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,qa=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,M=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,ta=w.__skinIndexArray,ra=w.__skinWeightArray,ya=w.__morphTargetsArrays,X=w.__webglCustomAttributes;v=void 0;var Ia=w.__faceArray,Ya=w.__lineArray,eb=w.__needsSmoothNormals;Ka=w.__vertexColorType;qa=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];ra[M]=D.x;ra[M+1]=D.y;ra[M+2]=D.z;ra[M+
|
|
|
+3]=D.w;ra[M+4]=aa.x;ra[M+5]=aa.y;ra[M+6]=aa.z;ra[M+7]=aa.w;ra[M+8]=v.x;ra[M+9]=v.y;ra[M+10]=v.z;ra[M+11]=v.w;D=qb[G.a];aa=qb[G.b];v=qb[G.c];ta[M]=D.x;ta[M+1]=D.y;ta[M+2]=D.z;ta[M+3]=D.w;ta[M+4]=aa.x;ta[M+5]=aa.y;ta[M+6]=aa.z;ta[M+7]=aa.w;ta[M+8]=v.x;ta[M+9]=v.y;ta[M+10]=v.z;ta[M+11]=v.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ea[M]=D.x;ea[M+1]=D.y;ea[M+2]=D.z;ea[M+3]=1;ea[M+4]=aa.x;ea[M+5]=aa.y;ea[M+6]=aa.z;ea[M+7]=1;ea[M+8]=v.x;ea[M+9]=v.y;ea[M+10]=v.z;ea[M+11]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];$[M]=D.x;$[M+
|
|
|
+1]=D.y;$[M+2]=D.z;$[M+3]=1;$[M+4]=aa.x;$[M+5]=aa.y;$[M+6]=aa.z;$[M+7]=1;$[M+8]=v.x;$[M+9]=v.y;$[M+10]=v.z;$[M+11]=1;M+=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&&qa)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&qa)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];ra[M]=D.x;ra[M+1]=D.y;ra[M+2]=D.z;ra[M+3]=D.w;ra[M+4]=aa.x;ra[M+5]=aa.y;ra[M+6]=aa.z;ra[M+7]=aa.w;ra[M+8]=v.x;ra[M+9]=v.y;ra[M+10]=v.z;ra[M+11]=v.w;ra[M+12]=ab.x;ra[M+13]=ab.y;ra[M+14]=ab.z;ra[M+15]=ab.w;D=qb[G.a];aa=qb[G.b];v=qb[G.c];ab=qb[G.d];ta[M]=D.x;ta[M+1]=D.y;ta[M+2]=D.z;ta[M+3]=D.w;ta[M+4]=aa.x;ta[M+5]=aa.y;ta[M+6]=aa.z;ta[M+7]=aa.w;ta[M+8]=v.x;ta[M+9]=v.y;ta[M+10]=v.z;ta[M+11]=v.w;ta[M+12]=ab.x;ta[M+13]=ab.y;ta[M+14]=
|
|
|
+ab.z;ta[M+15]=ab.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ab=ob[G.d];ea[M]=D.x;ea[M+1]=D.y;ea[M+2]=D.z;ea[M+3]=1;ea[M+4]=aa.x;ea[M+5]=aa.y;ea[M+6]=aa.z;ea[M+7]=1;ea[M+8]=v.x;ea[M+9]=v.y;ea[M+10]=v.z;ea[M+11]=1;ea[M+12]=ab.x;ea[M+13]=ab.y;ea[M+14]=ab.z;ea[M+15]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];G=pb[G.d];$[M]=D.x;$[M+1]=D.y;$[M+2]=D.z;$[M+3]=1;$[M+4]=aa.x;$[M+5]=aa.y;$[M+6]=aa.z;$[M+7]=1;$[M+8]=v.x;$[M+9]=v.y;$[M+10]=v.z;$[M+11]=1;$[M+12]=G.x;$[M+13]=G.y;$[M+14]=G.z;$[M+15]=1;M+=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&&qa)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&qa)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(M>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,ta,Q);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
+ra,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++){qa=Ka[F].position;y=F*3;Ha[y]=qa.x;Ha[y+1]=qa.y;Ha[y+2]=qa.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++){qa=Ka[F].position;
|
|
|
+y=F*3;Ha[y]=qa.x;Ha[y+1]=qa.y;Ha[y+2]=qa.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!=wa){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)}wa=n}}function N(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 O(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}N(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 ua(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=ia}if(C!=ka){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ja,ma,w,n);ka=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=ia}if(C!=ka){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ja,ma,x,n);ka=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,ka=null,fa=!0,va=null,sa=null,wa=null,ca=null,ja=0,ma=0,Fa=0,ia=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,
|
|
@@ -304,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){ja=n;ma=C;Fa=w;ia=x;e.viewport(ja,ma,Fa,ia)};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){ja=n;ma=C;Fa=x;ia=w;e.viewport(ja,ma,Fa,ia)};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);ua(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(qa){g(qa,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(qa){g(qa,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);ua(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(qa){g(qa,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(qa){g(qa,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,qa=void 0,Ka=qa=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;qa+=1;Ka+=3}else if(L instanceof THREE.Face4){T+=4;qa+=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(qa*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=qa*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];qa=1;if(I.type==="v2")qa=2;else if(I.type==="v3")qa=3;else if(I.type==="v4")qa=4;else I.type==="c"&&(qa=3);I.size=qa;I.needsUpdate=!0;I.array=new Float32Array(T*qa);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)}}}};
|
|
@@ -373,7 +374,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
|
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
|
fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var d,c,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;c=Array(h);for(d=f=0;d<h;++d){c[d]=Math.exp(-((d-g)*(d-g))/(2*b*b));f+=c[d]}for(d=0;d<h;++d)c[d]/=f;return c}};
|
|
|
-THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=
|
|
|
+THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=
|
|
|
b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.noFly!==undefined)this.noFly=b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=
|
|
|
b.heightMax;if(b.constrainVertical!==undefined)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==undefined)this.verticalMin=b.verticalMin;if(b.verticalMax!==undefined)this.verticalMax=b.verticalMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=
|
|
|
window.innerHeight/2;this.onMouseDown=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(c){this.mouseX=c.clientX-this.windowHalfX;this.mouseY=c.clientY-this.windowHalfY};this.onKeyDown=
|
|
@@ -385,14 +386,14 @@ this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.o
|
|
|
THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
|
|
|
THREE.PathCamera=function(b){function d(o,p,t,z){var u={name:t,fps:0.6,length:z,hierarchy:[]},A,E=p.getControlPointsArray(),H=p.getLength(),J=E.length,W=0;A=J-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:E[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[A]={time:z,pos:E[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<J-1;A++){W=z*H.chunks[A]/H.total;p.keys[A]={time:W,pos:E[A]}}u.hierarchy[0]=p;THREE.AnimationHandler.add(u);return new THREE.Animation(o,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(o,p){var t,
|
|
|
z,u=new THREE.Geometry;for(t=0;t<o.points.length*p;t++){z=t/(o.points.length*p);z=o.getPoint(z);u.vertices[t]=new THREE.Vertex(new THREE.Vector3(z.x,z.y,z.z))}return u}function f(o,p){var t=c(p,10),z=c(p,10),u=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,u);particleObj=new THREE.ParticleSystem(z,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);z=new Sphere(1,
|
|
|
-16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){t=new THREE.Mesh(z,u);t.position.copy(p.points[i]);t.updateMatrix();o.addChild(t)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
|
|
|
+16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){t=new THREE.Mesh(z,u);t.position.copy(p.points[i]);t.updateMatrix();o.addChild(t)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
|
|
|
!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
|
|
|
if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=
|
|
|
this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(o,p,t){var z,u;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;z=this.phi%g;this.phi=z>=0?z:z+g;z=this.verticalAngleMap.srcRange;u=this.verticalAngleMap.dstRange;
|
|
|
this.phi=(this.phi-z[0])*(u[1]-u[0])/(z[1]-z[0])+u[0];z=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-z[0])*(u[1]-u[0])/(z[1]-z[0])+u[0];z=this.target.position;z.x=100*Math.sin(this.phi)*Math.cos(this.theta);z.y=100*Math.cos(this.phi);z.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,p,t)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
|
|
|
this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.Cube(10,10,20),m=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,j);b.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=
|
|
|
d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(o,p){return function(){p.apply(o,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
|
-THREE.FlyCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==undefined)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==undefined)this.dragToLook=b.dragToLook;if(b.autoForward!==undefined)this.autoForward=
|
|
|
+THREE.FlyCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==undefined)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==undefined)this.dragToLook=b.dragToLook;if(b.autoForward!==undefined)this.autoForward=
|
|
|
b.autoForward;if(b.domElement!==undefined)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=(new Date).getTime();this.tdiff=0;this.handleEvent=function(c){if(typeof this[c.type]=="function")this[c.type](c)};this.keydown=function(c){if(!c.altKey){switch(c.keyCode){case 16:this.movementSpeedMultiplier=
|
|
|
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
|
|
|
this.keyup=function(c){switch(c.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
|
|
@@ -416,7 +417,7 @@ f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.
|
|
|
THREE.Icosahedron=function(b){function d(t,z,u){var A=Math.sqrt(t*t+z*z+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/A,z/A,u/A)))-1}function c(t,z,u,A){A.faces.push(new THREE.Face3(t,z,u))}function f(t,z){var u=g.vertices[t].position,A=g.vertices[z].position;return d((u.x+A.x)/2,(u.y+A.y)/2,(u.z+A.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
|
|
|
1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var m=f(h.faces[k].a,h.faces[k].b),o=f(h.faces[k].b,h.faces[k].c),p=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,p,j);c(h.faces[k].b,o,m,j);c(h.faces[k].c,
|
|
|
p,o,j);c(m,o,p,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
|
|
|
-THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.001;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);
|
|
|
+THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.0010;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);
|
|
|
for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
|
|
|
THREE.Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,m=f+1;b/=c;var o=d/f;for(g=0;g<m;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*o-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
|
|
|
THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
|
|
@@ -444,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+O);Ba=k(b,R+ua);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+O);Ba=k(b,R+ua);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+ka);w=k(b,R+fa);x=k(b,R+va);R=k(b,R+sa);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+wa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],N[S*2],N[S*2+1],N[P*2],N[P*2+1],N[R*2],N[R*2+1])}function H(R){var S,P,Ba;S=k(b,R);P=k(b,R+ja);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0],N[S*2],N[S*2+1],N[P*2],N[P*2+1],N[Ba*2],N[Ba*2+1],N[R*2],N[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+O);Ba=k(b,R+ua);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+O);Ba=k(b,R+ua);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+ka);x=k(b,R+fa);w=k(b,R+va);R=k(b,R+sa);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+wa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],N[S*2],N[S*2+1],N[P*2],N[P*2+1],N[R*2],N[R*2+1])}function H(R){var S,P,Ba;S=k(b,R);P=k(b,R+ja);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0],N[S*2],N[S*2+1],N[P*2],N[P*2+1],N[Ba*2],N[Ba*2+1],N[R*2],N[R*2+1])}var J=this,
|
|
|
W=0,B,U=[],N=[],O,ua,la,pa,ga,ha,e,oa,Da,Aa,ka,fa,va,sa,wa,ca,ja,ma,Fa,ia,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;O=B.vertex_index_bytes;ua=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;ka=B.vertex_index_bytes*4+B.material_index_bytes;fa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;va=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;sa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;wa=B.uv_index_bytes;ca=B.uv_index_bytes*2;ja=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;
|