diff --git a/build/Three.js b/build/Three.js index 6e2ac734..4c4e4be1 100644 --- a/build/Three.js +++ b/build/Three.js @@ -1,6 +1,6 @@ // Three.js r46dev - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime}; -THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.0010*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; +THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.001*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var d,g,e;if(b===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),g=a*6-d,a=b*(1-c),e=b*(1- c*g),c=b*(1-c*(1-g)),d){case 1:this.r=e;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=e;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=e;break;case 6:case 0:this.r=b,this.g=c,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+ Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; @@ -16,37 +16,37 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,d){this.x= c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,d=[];c=0;for(b=a.length;c=0&&m>=0&&r+m<1}for(var d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Vector3,f,h,i,k,l,n,r,m,s,p=[],o=0,t=a.children.length;oa.scale.x)return[];s={distance:o,point:a.position, -face:null,object:a};p.push(s)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o===null||o>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var v,q,A,D,E,u,x,H,w=a.geometry,C=w.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);o=0;for(t=w.faces.length;o0:u<0)))if(u=E.dot((new THREE.Vector3).sub(v,x))/u,x=x.addSelf(H.multiplyScalar(u)),s instanceof THREE.Face3)b(x,v,q,A)&&(s={distance:this.origin.distanceTo(x),point:x,face:s,object:a}, -p.push(s));else if(s instanceof THREE.Face4&&(b(x,v,q,D)||b(x,q,A,D)))s={distance:this.origin.distanceTo(x),point:x,face:s,object:a},p.push(s)}return p}}; -THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,l,n){h=!1;c=e;b=f;d=l;g=n;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=ce?d:e,g=g>f?g:f);a()};this.add3Points= -function(e,f,l,n,r,m){h?(h=!1,c=el?e>r?e:r:l>r?l:r,g=f>n?f>m?f:m:n>m?n:m):(c=el?e>r?e>d?e:d:r>d?r:d:l>r?l>d?l:d:r>d?r:d,g=f>n?f>m?f>g?f:g:m>g?m:g:n>m?n>g?n:g:m>g?m:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=ce.getRight()?d:e.getRight(),g=g> +g.copy(c).subSelf(b);e.copy(a).subSelf(b);f=d.dot(d);h=d.dot(g);i=d.dot(e);k=g.dot(g);l=g.dot(e);m=1/(f*k-h*h);q=(k*i-h*l)*m;n=(f*l-h*i)*m;return q>=0&&n>=0&&q+n<1}for(var d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Vector3,f,h,i,k,l,m,q,n,t,p=[],o=0,v=a.children.length;oa.scale.x)return[];t={distance:o,point:a.position, +face:null,object:a};p.push(t)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o===null||o>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var w,r,s,u,x,H,G,F,y=a.geometry,C=y.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);o=0;for(v=y.faces.length;o0:H<0)))if(H=x.dot((new THREE.Vector3).sub(w,G))/H,G=G.addSelf(F.multiplyScalar(H)),t instanceof THREE.Face3)b(G,w,r,s)&&(t={distance:this.origin.distanceTo(G),point:G,face:t,object:a}, +p.push(t));else if(t instanceof THREE.Face4&&(b(G,w,r,u)||b(G,r,s,u)))t={distance:this.origin.distanceTo(G),point:G,face:t,object:a},p.push(t)}return p}}; +THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,l,m){h=!1;c=e;b=f;d=l;g=m;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=ce?d:e,g=g>f?g:f);a()};this.add3Points= +function(e,f,l,m,q,n){h?(h=!1,c=el?e>q?e:q:l>q?l:q,g=f>m?f>n?f:n:m>n?m:n):(c=el?e>q?e>d?e:d:q>d?q:d:l>q?l>d?l:d:q>d?q:d,g=f>m?f>n?f>g?f:g:n>g?n:g:m>n?m>g?m:g:n>g?n:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=ce.getRight()?d:e.getRight(),g=g> e.getBottom()?g:e.getBottom());a()};this.inflate=function(e){c-=e;b-=e;d+=e;g+=e;a()};this.minSelf=function(e){c=c>e.getLeft()?c:e.getLeft();b=b>e.getTop()?b:e.getTop();d=d=0&&Math.min(g,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){h=!0;g=d=b=c=0;a()};this.isEmpty=function(){return h}}; THREE.Math={clamp:function(a,c,b){return ab?b:a},clampBottom:function(a,c){return a=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),df&&h.positionScreen.z0&&u.z<1))f=A[q]=A[q]||new THREE.RenderableParticle,q++,v=f,v.x=u.x/u.w,v.y=u.y/u.w,v.z=u.z,v.rotation=W.rotation.z,v.scale.x=W.scale.x*Math.abs(v.x-(u.x+e.projectionMatrix.n11)/(u.w+e.projectionMatrix.n14)),v.scale.y=W.scale.y*Math.abs(v.y-(u.y+e.projectionMatrix.n22)/(u.w+e.projectionMatrix.n24)),v.material=W.material,D.elements.push(v); -g&&D.elements.sort(b);return D}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)}; +l,m,q=[],n,t=[],p,o,v=[],w,r,s=[],u={objects:[],sprites:[],lights:[],elements:[]},x=new THREE.Vector3,H=new THREE.Vector4,G=new THREE.Matrix4,F=new THREE.Matrix4,y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,O=new THREE.Vector4;this.computeFrustum=function(a){y[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);y[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);y[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+ +a.n23,a.n44+a.n24);y[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);y[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);y[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=y[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix); +G.multiply(b.matrixWorld,b.projectionMatrixInverse);G.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;u.objects.length=0;u.sprites.length=0;u.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld, +e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=y[h].x*d.n14+y[h].y*d.n24+y[h].z*d.n34+y[h].w,c<=e){c=!1;break a}c=!0}c?(G.multiplyVector3(x.copy(b.position)),g=a(),g.object=b,g.z=x.z,u.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(G.multiplyVector3(x.copy(b.position)),g=a(),g.object=b,g.z=x.z,u.sprites.push(g)):b instanceof THREE.Light&&u.lights.push(b);c=0;for(d=b.children.length;cf&&h.positionScreen.z0&&H.z<1))f=s[r]=s[r]||new THREE.RenderableParticle,r++,w=f,w.x=H.x/H.w,w.y=H.y/H.w,w.z=H.z,w.rotation=X.rotation.z,w.scale.x=X.scale.x*Math.abs(w.x-(H.x+e.projectionMatrix.n11)/(H.w+e.projectionMatrix.n14)),w.scale.y=X.scale.y*Math.abs(w.y-(H.y+e.projectionMatrix.n22)/(H.w+e.projectionMatrix.n24)),w.material=X.material,u.elements.push(w); +g&&u.elements.sort(b);return u}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b); this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();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 a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c= -this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,k=i*b+f*g-h*d,l=i*d+h*b-e*g,n=i*g+e*d-f*b,b=-e* -b-f*d-h*g;c.x=k*i+b*-e+l*-h-n*-f;c.y=l*i+b*-f+n*-e-k*-h;c.z=n*i+b*-h+k*-f-l*-e;return c}}; -THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var e=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,k=i*b+f*g-h*d,l=i*d+h*b-e*g,m=i*g+e*d-f*b,b=-e* +b-f*d-h*g;c.x=k*i+b*-e+l*-h-m*-f;c.y=l*i+b*-f+m*-e-k*-h;c.z=m*i+b*-h+k*-f-l*-e;return c}}; +THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var e=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.001)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,c,b,d,g,e){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,c,b,d,g,e,f){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; @@ -83,14 +83,14 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid b,d,g,e,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, +b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];m=f[g];q=f[j];n=i.x-h.x;t=k.x-h.x;p=i.y-h.y;o=k.y-h.y;v=i.z-h.z;w=k.z-h.z;r=m.u-l.u;s=q.u-l.u;u=m.v-l.v;x=q.v-l.v;H=1/(r*x-s*u);C.set((x*n-u*t)*H,(x*p-u*o)*H,(x*v-u*w)*H);O.set((r*t-s*n)*H,(r*o-s*p)*H,(r*w-s*v)*H);F[b].addSelf(C);F[c].addSelf(C);F[d].addSelf(C);y[b].addSelf(O); +y[c].addSelf(O);y[d].addSelf(O)}var c,b,d,g,e,f,h,i,k,l,m,q,n,t,p,o,v,w,r,s,u,x,H,G,F=[],y=[],C=new THREE.Vector3,O=new THREE.Vector3,J=new THREE.Vector3,$=new THREE.Vector3,L=new THREE.Vector3;c=0;for(b=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;cthis.points.length-2?e:e+1;b[3]=e>this.points.length-3?e:e+2;k=this.points[b[0]];l=this.points[b[1]]; -n=this.points[b[2]];r=this.points[b[3]];h=f*f;i=f*h;d.x=c(k.x,l.x,n.x,r.x,f,h,i);d.y=c(k.y,l.y,n.y,r.y,f,h,i);d.z=c(k.z,l.z,n.z,r.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;athis.points.length-2?e:e+1;b[3]=e>this.points.length-3?e:e+2;k=this.points[b[0]];l=this.points[b[1]]; +m=this.points[b[2]];q=this.points[b[3]];h=f*f;i=f*h;d.x=c(k.x,l.x,m.x,q.x,f,h,i);d.y=c(k.y,l.y,m.y,q.y,f,h,i);d.z=c(k.z,l.z,m.z,q.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+t+")"),p.fillRect(Math.floor(fa.getX()), -Math.floor(fa.getY()),Math.floor(fa.getWidth()),Math.floor(fa.getHeight()))),fa.empty())};this.render=function(a,l){function n(a){var b,c,d,e;ma.setRGB(0,0,0);R.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=a.length;b>1,Z=k.height>> -1,f=e.scale.x*m,i=e.scale.y*s,j=f*l,h=i*Z,F.set(a.x-j,a.y-h,a.x+j,a.y+h),Y.intersects(F)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-l,-Z),p.drawImage(k,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*s,F.set(a.x-j,a.y-h,a.x+j,a.y+h),Y.intersects(F)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(j,h),f.program(p),p.restore()))}function q(a,e,g, -f){c(f.opacity);b(f.blending);p.beginPath();p.moveTo(a.positionScreen.x,a.positionScreen.y);p.lineTo(e.positionScreen.x,e.positionScreen.y);p.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(E!=a)p.lineWidth=E=a;a=f.linecap;if(u!=a)p.lineCap=u=a;a=f.linejoin;if(x!=a)p.lineJoin=x=a;d(f.color.getContextStyle());p.stroke();F.inflate(f.linewidth*2)}}function t(a,d,f,g,j,h,k,m){e.info.render.vertices+=3;e.info.render.faces++;c(m.opacity);b(m.blending);J=a.positionScreen.x;P=a.positionScreen.y; -ea=d.positionScreen.x;S=d.positionScreen.y;ca=f.positionScreen.x;y=f.positionScreen.y;Ca(J,P,ea,S,ca,y);if(m instanceof THREE.MeshBasicMaterial)if(m.map)m.map.mapping instanceof THREE.UVMapping&&(ka=k.uvs[0],D(J,P,ea,S,ca,y,ka[g].u,ka[g].v,ka[j].u,ka[j].v,ka[h].u,ka[h].v,m.map));else if(m.envMap){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,$.copy(k.vertexNormalsWorld[g]),ta=($.x*a.n11+$.y*a.n12+$.z*a.n13)*0.5+0.5,sa=-($.x*a.n21+$.y*a.n22+$.z*a.n23)*0.5+0.5, -$.copy(k.vertexNormalsWorld[j]),qa=($.x*a.n11+$.y*a.n12+$.z*a.n13)*0.5+0.5,na=-($.x*a.n21+$.y*a.n22+$.z*a.n23)*0.5+0.5,$.copy(k.vertexNormalsWorld[h]),oa=($.x*a.n11+$.y*a.n12+$.z*a.n13)*0.5+0.5,K=-($.x*a.n21+$.y*a.n22+$.z*a.n23)*0.5+0.5,D(J,P,ea,S,ca,y,ta,sa,qa,na,oa,K,m.envMap)}else m.wireframe?A(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):xa(m.color);else if(m instanceof THREE.MeshLambertMaterial)m.map&&!m.wireframe&&(m.map.mapping instanceof THREE.UVMapping&&(ka=k.uvs[0], -D(J,P,ea,S,ca,y,ka[g].u,ka[g].v,ka[j].u,ka[j].v,ka[h].u,ka[h].v,m.map)),b(THREE.SubtractiveBlending)),ga?!m.wireframe&&m.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(da.r=T.r=O.r=ma.r,da.g=T.g=O.g=ma.g,da.b=T.b=O.b=ma.b,r(i,k.v1.positionWorld,k.vertexNormalsWorld[0],da),r(i,k.v2.positionWorld,k.vertexNormalsWorld[1],T),r(i,k.v3.positionWorld,k.vertexNormalsWorld[2],O),da.r=Math.max(0,Math.min(m.color.r*da.r,1)),da.g=Math.max(0,Math.min(m.color.g*da.g,1)),da.b=Math.max(0,Math.min(m.color.b* -da.b,1)),T.r=Math.max(0,Math.min(m.color.r*T.r,1)),T.g=Math.max(0,Math.min(m.color.g*T.g,1)),T.b=Math.max(0,Math.min(m.color.b*T.b,1)),O.r=Math.max(0,Math.min(m.color.r*O.r,1)),O.g=Math.max(0,Math.min(m.color.g*O.g,1)),O.b=Math.max(0,Math.min(m.color.b*O.b,1)),U.r=(T.r+O.r)*0.5,U.g=(T.g+O.g)*0.5,U.b=(T.b+O.b)*0.5,ra=Ea(da,T,O,U),Aa(J,P,ea,S,ca,y,0,0,1,0,0,1,ra)):(V.r=ma.r,V.g=ma.g,V.b=ma.b,r(i,k.centroidWorld,k.normalWorld,V),V.r=Math.max(0,Math.min(m.color.r*V.r,1)),V.g=Math.max(0,Math.min(m.color.g* -V.g,1)),V.b=Math.max(0,Math.min(m.color.b*V.b,1)),m.wireframe?A(V,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):xa(V)):m.wireframe?A(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):xa(m.color);else if(m instanceof THREE.MeshDepthMaterial)X=l.near,ba=l.far,da.r=da.g=da.b=1-za(a.positionScreen.z,X,ba),T.r=T.g=T.b=1-za(d.positionScreen.z,X,ba),O.r=O.g=O.b=1-za(f.positionScreen.z,X,ba),U.r=(T.r+O.r)*0.5,U.g=(T.g+O.g)*0.5,U.b=(T.b+O.b)*0.5,ra=Ea(da,T,O,U),Aa(J,P,ea, -S,ca,y,0,0,1,0,0,1,ra);else if(m instanceof THREE.MeshNormalMaterial)V.r=Ba(k.normalWorld.x),V.g=Ba(k.normalWorld.y),V.b=Ba(k.normalWorld.z),m.wireframe?A(V,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):xa(V)}function v(a,d,f,g,h,m,k,Z,n){e.info.render.vertices+=4;e.info.render.faces++;c(Z.opacity);b(Z.blending);if(Z.map||Z.envMap)t(a,d,g,0,1,3,k,Z,n),t(h,f,m,1,2,3,k,Z,n);else if(J=a.positionScreen.x,P=a.positionScreen.y,ea=d.positionScreen.x,S=d.positionScreen.y,ca=f.positionScreen.x, -y=f.positionScreen.y,B=g.positionScreen.x,j=g.positionScreen.y,I=h.positionScreen.x,Q=h.positionScreen.y,ha=m.positionScreen.x,W=m.positionScreen.y,Z instanceof THREE.MeshBasicMaterial)Fa(J,P,ea,S,ca,y,B,j),Z.wireframe?A(Z.color,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):xa(Z.color);else if(Z instanceof THREE.MeshLambertMaterial)ga?!Z.wireframe&&Z.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4?(da.r=T.r=O.r=U.r=ma.r,da.g=T.g=O.g=U.g=ma.g,da.b=T.b=O.b=U.b=ma.b,r(i,k.v1.positionWorld, -k.vertexNormalsWorld[0],da),r(i,k.v2.positionWorld,k.vertexNormalsWorld[1],T),r(i,k.v4.positionWorld,k.vertexNormalsWorld[3],O),r(i,k.v3.positionWorld,k.vertexNormalsWorld[2],U),da.r=Math.max(0,Math.min(Z.color.r*da.r,1)),da.g=Math.max(0,Math.min(Z.color.g*da.g,1)),da.b=Math.max(0,Math.min(Z.color.b*da.b,1)),T.r=Math.max(0,Math.min(Z.color.r*T.r,1)),T.g=Math.max(0,Math.min(Z.color.g*T.g,1)),T.b=Math.max(0,Math.min(Z.color.b*T.b,1)),O.r=Math.max(0,Math.min(Z.color.r*O.r,1)),O.g=Math.max(0,Math.min(Z.color.g* -O.g,1)),O.b=Math.max(0,Math.min(Z.color.b*O.b,1)),U.r=Math.max(0,Math.min(Z.color.r*U.r,1)),U.g=Math.max(0,Math.min(Z.color.g*U.g,1)),U.b=Math.max(0,Math.min(Z.color.b*U.b,1)),ra=Ea(da,T,O,U),Ca(J,P,ea,S,B,j),Aa(J,P,ea,S,B,j,0,0,1,0,0,1,ra),Ca(I,Q,ca,y,ha,W),Aa(I,Q,ca,y,ha,W,1,0,1,1,0,1,ra)):(V.r=ma.r,V.g=ma.g,V.b=ma.b,r(i,k.centroidWorld,k.normalWorld,V),V.r=Math.max(0,Math.min(Z.color.r*V.r,1)),V.g=Math.max(0,Math.min(Z.color.g*V.g,1)),V.b=Math.max(0,Math.min(Z.color.b*V.b,1)),Fa(J,P,ea,S,ca,y, -B,j),Z.wireframe?A(V,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):xa(V)):(Fa(J,P,ea,S,ca,y,B,j),Z.wireframe?A(Z.color,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):xa(Z.color));else if(Z instanceof THREE.MeshNormalMaterial)V.r=Ba(k.normalWorld.x),V.g=Ba(k.normalWorld.y),V.b=Ba(k.normalWorld.z),Fa(J,P,ea,S,ca,y,B,j),Z.wireframe?A(V,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):xa(V);else if(Z instanceof THREE.MeshDepthMaterial)X=l.near,ba=l.far,da.r=da.g= -da.b=1-za(a.positionScreen.z,X,ba),T.r=T.g=T.b=1-za(d.positionScreen.z,X,ba),O.r=O.g=O.b=1-za(g.positionScreen.z,X,ba),U.r=U.g=U.b=1-za(f.positionScreen.z,X,ba),ra=Ea(da,T,O,U),Ca(J,P,ea,S,B,j),Aa(J,P,ea,S,B,j,0,0,1,0,0,1,ra),Ca(I,Q,ca,y,ha,W),Aa(I,Q,ca,y,ha,W,1,0,1,1,0,1,ra)}function Ca(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(a,b);p.closePath()}function Fa(a,b,c,d,e,f,g,j){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(g,j);p.lineTo(a,b);p.closePath()} -function A(a,b,c,e){if(E!=b)p.lineWidth=E=b;if(u!=c)p.lineCap=u=c;if(x!=e)p.lineJoin=x=e;d(a.getContextStyle());p.stroke();F.inflate(b*2)}function xa(a){g(a.getContextStyle());p.fill()}function D(a,b,c,d,e,f,j,h,i,m,k,Z,l){if(l.image.width!=0){if(l.needsUpdate==!0||ja[l.id]==void 0){var n=l.wrapS==THREE.RepeatWrapping,r=l.wrapT==THREE.RepeatWrapping;ja[l.id]=p.createPattern(l.image,n&&r?"repeat":n&&!r?"repeat-x":!n&&r?"repeat-y":"no-repeat");l.needsUpdate=!1}g(ja[l.id]);var n=l.offset.x/l.repeat.x, -r=l.offset.y/l.repeat.y,K=(l.image.width-1)*l.repeat.x,l=(l.image.height-1)*l.repeat.y,j=(j+n)*K,h=(h+r)*l,i=(i+n)*K,m=(m+r)*l,k=(k+n)*K,Z=(Z+r)*l;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;k-=j;Z-=h;n=1/(i*Z-k*m);l=(Z*c-m*e)*n;m=(Z*d-m*f)*n;c=(i*e-k*c)*n;d=(i*f-k*d)*n;a=a-l*j-c*h;b=b-m*j-d*h;p.save();p.transform(l,m,c,d,a,b);p.fill();p.restore()}}function Aa(a,b,c,d,e,f,g,j,h,i,m,k,Z){var l,n;l=Z.width-1;n=Z.height-1;g*=l;j*=n;h*=l;i*=n;m*=l;k*=n;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;m-=g;k-=j;n=1/(h*k-m*i);l=(k*c-i* -e)*n;i=(k*d-i*f)*n;c=(h*e-m*c)*n;d=(h*f-m*d)*n;a=a-l*g-c*j;b=b-i*g-d*j;p.save();p.transform(l,i,c,d,a,b);p.clip();p.drawImage(Z,0,0);p.restore()}function Ea(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);la[0]=e<0?0:e>255?255:e;la[1]=f<0?0:f>255?255:f;la[2]=a<0?0:a>255?255:a;la[4]=g<0?0:g>255?255:g;la[5]=j<0?0:j>255?255:j;la[6]=b<0?0:b>255?255:b;la[8]=h<0?0:h>255?255: -h;la[9]=i<0?0:i>255?255:i;la[10]=c<0?0:c>255?255:c;la[12]=m<0?0:m>255?255:m;la[13]=k<0?0:k>255?255:k;la[14]=d<0?0:d>255?255:d;L.putImageData(ia,0,0);Da.drawImage(wa,0,0);return Z}function za(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ba(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ya(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ga,Ha,pa,va;this.autoClear?this.clear():p.setTransform(1,0,0,-1,m,s);e.info.render.vertices=0;e.info.render.faces= -0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ga=i.length>0)&&n(i);Ga=0;for(Ha=h.length;Ga1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,n,r,m,s,p,o,t=new THREE.Rectangle,v=new THREE.Rectangle,q=!1,A=new THREE.Color,D=new THREE.Color,E=new THREE.Color,u=new THREE.Color,x,H=new THREE.Vector3,w=[],C=[],M,N,aa,J=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0, -faces:0}};this.setQuality=function(a){switch(a){case "high":J=1;break;case "low":J=0}};this.setSize=function(a,b){k=a;l=b;n=k/2;r=l/2;i.setAttribute("viewBox",-n+" "+-r+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);t.set(-n,-r,n,r)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var H,w,y,B;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);e=g.elements; -f=g.lights;aa=N=0;if(q=f.length>0){D.setRGB(0,0,0);E.setRGB(0,0,0);u.setRGB(0,0,0);H=0;for(w=f.length;H0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+v+")"),p.fillRect(Math.floor(Y.getX()), +Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight()))),Y.empty())};this.render=function(a,l){function m(a){var b,c,d,e;ka.setRGB(0,0,0);V.setRGB(0,0,0);T.setRGB(0,0,0);b=0;for(c=a.length;b>1,W=k.height>>1,f=e.scale.x* +n,i=e.scale.y*t,j=f*l,h=i*W,ba.set(a.x-j,a.y-h,a.x+j,a.y+h),D.intersects(ba)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-l,-W),p.drawImage(k,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*n,h=e.scale.y*t,ba.set(a.x-j,a.y-h,a.x+j,a.y+h),D.intersects(ba)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(j,h),f.program(p),p.restore()))}function r(a,e,g,f){c(f.opacity); +b(f.blending);p.beginPath();p.moveTo(a.positionScreen.x,a.positionScreen.y);p.lineTo(e.positionScreen.x,e.positionScreen.y);p.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(x!=a)p.lineWidth=x=a;a=f.linecap;if(H!=a)p.lineCap=H=a;a=f.linejoin;if(G!=a)p.lineJoin=G=a;d(f.color.getContextStyle());p.stroke();ba.inflate(f.linewidth*2)}}function v(a,d,f,g,j,h,k,n){e.info.render.vertices+=3;e.info.render.faces++;c(n.opacity);b(n.blending);L=a.positionScreen.x;P=a.positionScreen.y;da= +d.positionScreen.x;ja=d.positionScreen.y;R=f.positionScreen.x;z=f.positionScreen.y;s(L,P,da,ja,R,z);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ma=k.uvs[0],Ga(L,P,da,ja,R,z,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,aa.copy(k.vertexNormalsWorld[g]),sa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,ua=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+ +0.5,aa.copy(k.vertexNormalsWorld[j]),pa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,ra=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+0.5,aa.copy(k.vertexNormalsWorld[h]),wa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,S=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+0.5,Ga(L,P,da,ja,R,z,sa,ua,pa,ra,wa,S,n.envMap)}else n.wireframe?ya(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&& +(ma=k.uvs[0],Ga(L,P,da,ja,R,z,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,n.map)),b(THREE.SubtractiveBlending)),ia?!n.wireframe&&n.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(M.r=ea.r=U.r=ka.r,M.g=ea.g=U.g=ka.g,M.b=ea.b=U.b=ka.b,q(i,k.v1.positionWorld,k.vertexNormalsWorld[0],M),q(i,k.v2.positionWorld,k.vertexNormalsWorld[1],ea),q(i,k.v3.positionWorld,k.vertexNormalsWorld[2],U),M.r=Math.max(0,Math.min(n.color.r*M.r,1)),M.g=Math.max(0,Math.min(n.color.g*M.g,1)),M.b=Math.max(0, +Math.min(n.color.b*M.b,1)),ea.r=Math.max(0,Math.min(n.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(n.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(n.color.b*ea.b,1)),U.r=Math.max(0,Math.min(n.color.r*U.r,1)),U.g=Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),ca.r=(ea.r+U.r)*0.5,ca.g=(ea.g+U.g)*0.5,ca.b=(ea.b+U.b)*0.5,qa=Da(M,ea,U,ca),Ba(L,P,da,ja,R,z,0,0,1,0,0,1,qa)):(Q.r=ka.r,Q.g=ka.g,Q.b=ka.b,q(i,k.centroidWorld,k.normalWorld,Q),Q.r=Math.max(0,Math.min(n.color.r*Q.r,1)), +Q.g=Math.max(0,Math.min(n.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(n.color.b*Q.b,1)),n.wireframe?ya(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(Q)):n.wireframe?ya(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(n.color);else if(n instanceof THREE.MeshDepthMaterial)fa=l.near,la=l.far,M.r=M.g=M.b=1-Aa(a.positionScreen.z,fa,la),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,fa,la),U.r=U.g=U.b=1-Aa(f.positionScreen.z,fa,la),ca.r=(ea.r+U.r)*0.5,ca.g=(ea.g+U.g)*0.5,ca.b= +(ea.b+U.b)*0.5,qa=Da(M,ea,U,ca),Ba(L,P,da,ja,R,z,0,0,1,0,0,1,qa);else if(n instanceof THREE.MeshNormalMaterial)Q.r=Ca(k.normalWorld.x),Q.g=Ca(k.normalWorld.y),Q.b=Ca(k.normalWorld.z),n.wireframe?ya(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(Q)}function w(a,d,f,g,h,n,k,W,m){e.info.render.vertices+=4;e.info.render.faces++;c(W.opacity);b(W.blending);if(W.map||W.envMap)v(a,d,g,0,1,3,k,W,m),v(h,f,n,1,2,3,k,W,m);else if(L=a.positionScreen.x,P=a.positionScreen.y,da=d.positionScreen.x, +ja=d.positionScreen.y,R=f.positionScreen.x,z=f.positionScreen.y,B=g.positionScreen.x,I=g.positionScreen.y,j=h.positionScreen.x,N=h.positionScreen.y,ga=n.positionScreen.x,X=n.positionScreen.y,W instanceof THREE.MeshBasicMaterial)Ea(L,P,da,ja,R,z,B,I),W.wireframe?ya(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):u(W.color);else if(W instanceof THREE.MeshLambertMaterial)ia?!W.wireframe&&W.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4?(M.r=ea.r=U.r=ca.r=ka.r,M.g=ea.g= +U.g=ca.g=ka.g,M.b=ea.b=U.b=ca.b=ka.b,q(i,k.v1.positionWorld,k.vertexNormalsWorld[0],M),q(i,k.v2.positionWorld,k.vertexNormalsWorld[1],ea),q(i,k.v4.positionWorld,k.vertexNormalsWorld[3],U),q(i,k.v3.positionWorld,k.vertexNormalsWorld[2],ca),M.r=Math.max(0,Math.min(W.color.r*M.r,1)),M.g=Math.max(0,Math.min(W.color.g*M.g,1)),M.b=Math.max(0,Math.min(W.color.b*M.b,1)),ea.r=Math.max(0,Math.min(W.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(W.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(W.color.b*ea.b,1)),U.r= +Math.max(0,Math.min(W.color.r*U.r,1)),U.g=Math.max(0,Math.min(W.color.g*U.g,1)),U.b=Math.max(0,Math.min(W.color.b*U.b,1)),ca.r=Math.max(0,Math.min(W.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(W.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(W.color.b*ca.b,1)),qa=Da(M,ea,U,ca),s(L,P,da,ja,B,I),Ba(L,P,da,ja,B,I,0,0,1,0,0,1,qa),s(j,N,R,z,ga,X),Ba(j,N,R,z,ga,X,1,0,1,1,0,1,qa)):(Q.r=ka.r,Q.g=ka.g,Q.b=ka.b,q(i,k.centroidWorld,k.normalWorld,Q),Q.r=Math.max(0,Math.min(W.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(W.color.g* +Q.g,1)),Q.b=Math.max(0,Math.min(W.color.b*Q.b,1)),Ea(L,P,da,ja,R,z,B,I),W.wireframe?ya(Q,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):u(Q)):(Ea(L,P,da,ja,R,z,B,I),W.wireframe?ya(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):u(W.color));else if(W instanceof THREE.MeshNormalMaterial)Q.r=Ca(k.normalWorld.x),Q.g=Ca(k.normalWorld.y),Q.b=Ca(k.normalWorld.z),Ea(L,P,da,ja,R,z,B,I),W.wireframe?ya(Q,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):u(Q);else if(W instanceof +THREE.MeshDepthMaterial)fa=l.near,la=l.far,M.r=M.g=M.b=1-Aa(a.positionScreen.z,fa,la),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,fa,la),U.r=U.g=U.b=1-Aa(g.positionScreen.z,fa,la),ca.r=ca.g=ca.b=1-Aa(f.positionScreen.z,fa,la),qa=Da(M,ea,U,ca),s(L,P,da,ja,B,I),Ba(L,P,da,ja,B,I,0,0,1,0,0,1,qa),s(j,N,R,z,ga,X),Ba(j,N,R,z,ga,X,1,0,1,1,0,1,qa)}function s(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(a,b);p.closePath()}function Ea(a,b,c,d,e,f,g,j){p.beginPath();p.moveTo(a,b); +p.lineTo(c,d);p.lineTo(e,f);p.lineTo(g,j);p.lineTo(a,b);p.closePath()}function ya(a,b,c,e){if(x!=b)p.lineWidth=x=b;if(H!=c)p.lineCap=H=c;if(G!=e)p.lineJoin=G=e;d(a.getContextStyle());p.stroke();ba.inflate(b*2)}function u(a){g(a.getContextStyle());p.fill()}function Ga(a,b,c,d,e,f,j,h,i,n,k,W,l){if(l.image.width!=0){if(l.needsUpdate==!0||Z[l.id]==void 0){var m=l.wrapS==THREE.RepeatWrapping,q=l.wrapT==THREE.RepeatWrapping;Z[l.id]=p.createPattern(l.image,m&&q?"repeat":m&&!q?"repeat-x":!m&&q?"repeat-y": +"no-repeat");l.needsUpdate=!1}g(Z[l.id]);var m=l.offset.x/l.repeat.x,q=l.offset.y/l.repeat.y,S=(l.image.width-1)*l.repeat.x,l=(l.image.height-1)*l.repeat.y,j=(j+m)*S,h=(h+q)*l,i=(i+m)*S,n=(n+q)*l,k=(k+m)*S,W=(W+q)*l;c-=a;d-=b;e-=a;f-=b;i-=j;n-=h;k-=j;W-=h;m=1/(i*W-k*n);l=(W*c-n*e)*m;n=(W*d-n*f)*m;c=(i*e-k*c)*m;d=(i*f-k*d)*m;a=a-l*j-c*h;b=b-n*j-d*h;p.save();p.transform(l,n,c,d,a,b);p.fill();p.restore()}}function Ba(a,b,c,d,e,f,g,j,h,i,n,k,l){var W,m;W=l.width-1;m=l.height-1;g*=W;j*=m;h*=W;i*=m;n*= +W;k*=m;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;n-=g;k-=j;m=1/(h*k-n*i);W=(k*c-i*e)*m;i=(k*d-i*f)*m;c=(h*e-n*c)*m;d=(h*f-n*d)*m;a=a-W*g-c*j;b=b-i*g-d*j;p.save();p.transform(W,i,c,d,a,b);p.clip();p.drawImage(l,0,0);p.restore()}function Da(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),n=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);na[0]=e<0?0:e>255?255:e;na[1]=f<0?0:f>255?255:f;na[2]=a<0?0:a>255?255:a;na[4]=g<0?0:g>255?255: +g;na[5]=j<0?0:j>255?255:j;na[6]=b<0?0:b>255?255:b;na[8]=h<0?0:h>255?255:h;na[9]=i<0?0:i>255?255:i;na[10]=c<0?0:c>255?255:c;na[12]=n<0?0:n>255?255:n;na[13]=k<0?0:k>255?255:k;na[14]=d<0?0:d>255?255:d;xa.putImageData(K,0,0);W.drawImage(ha,0,0);return ta}function Aa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ca(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function za(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Fa,Ha,oa,va;this.autoClear?this.clear(): +p.setTransform(1,0,0,-1,n,t);e.info.render.vertices=0;e.info.render.faces=0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ia=i.length>0)&&m(i);Fa=0;for(Ha=h.length;Fa1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,m,q,n,t,p,o,v=new THREE.Rectangle,w=new THREE.Rectangle,r=!1,s=new THREE.Color,u=new THREE.Color,x=new THREE.Color,H=new THREE.Color,G,F=new THREE.Vector3,y=[],C=[],O,J,$,L=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0, +faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){k=a;l=b;m=k/2;q=l/2;i.setAttribute("viewBox",-m+" "+-q+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);v.set(-m,-q,m,q)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var F,y,z,B;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);e=g.elements; +f=g.lights;$=J=0;if(r=f.length>0){u.setRGB(0,0,0);x.setRGB(0,0,0);H.setRGB(0,0,0);F=0;for(y=f.length;F=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,m=i.length,k=a.__vertexArray,l=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,r=a.__dirtyColors,K=a.__webglCustomAttributesList;if(c.sortParticles){Y.multiplySelf(c.matrixWorld);for(d=0;d=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,n=i.length,k=a.__vertexArray,l=a.__colorArray,m=a.__sortArray,p=a.__dirtyVertices,q=a.__dirtyColors,S=a.__webglCustomAttributesList;if(c.sortParticles){Y.multiplySelf(c.matrixWorld);for(d=0;d=0)a&&(j.bindBuffer(j.ARRAY_BUFFER, +g+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(q||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(S){i=0;for(n=S.length;i=0)a&&(j.bindBuffer(j.ARRAY_BUFFER, e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;fm&&(k=l,m=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]= -m;i[k]=1;m=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color, +fn&&(k=l,n=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]= +n;i[k]=1;n=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color, 3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer), j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex, -4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ta&&(j.lineWidth(d),ta=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),B.info.render.calls++,B.info.render.vertices+= -e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ta&&(j.lineWidth(d),ta=d),j.drawArrays(g,0,e.__webglLineCount),B.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),B.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),B.info.render.calls++)}}function f(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43- -a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);K[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=K[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y, -a.scale.z)),d=0;d<6;d++)if(a=K[d].x*b.n14+K[d].y*b.n24+K[d].z*b.n34+K[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function k(a){var b,c,d,i,m,k,l,n,p=0,r=a.lights;R||(R=new THREE.PerspectiveCamera(B.shadowCameraFov,B.shadowMapWidth/B.shadowMapHeight,B.shadowCameraNear,B.shadowCameraFar));b=0;for(c=r.length;b=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||B.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(B.maxMorphTargets); -for(var g=0,f=B.maxMorphTargets;g=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||I.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets); +for(var g=0,f=I.maxMorphTargets;g0;this.getContext=function(){return j};this.supportsVertexTextures= -function(){return la};this.setSize=function(a,b){aa.width=a;aa.height=b;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(a,b,c,d){sa=a;qa=b;na=c;oa=d;j.viewport(sa,qa,na,oa)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){S.setHex(a);ca=b;j.clearColor(S.r,S.g,S.b,ca)};this.setClearColor=function(a,b){S.copy(a);ca=b;j.clearColor(S.r,S.g,S.b,ca)};this.getClearColor= -function(){return S};this.getClearAlpha=function(){return ca};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){C(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c= +var a=a||{},$=a.canvas!==void 0?a.canvas:document.createElement("canvas"),L=a.precision!==void 0?a.precision:"highp",P=a.antialias!==void 0?a.antialias:!1,da=a.stencil!==void 0?a.stencil:!0,ja=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,R=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),z=a.clearAlpha!==void 0?a.clearAlpha:0,B=a.maxLights!==void 0?a.maxLights:4;this.domElement=$;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil= +this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var I= +this,j,N=[],ga=null,X=null,Q=-1,M=null,ea=0,U=null,ca=null,Z=null,fa=null,la=null,qa=null,ma=null,sa=null,ua=null,pa=0,ra=0,wa=0,S=0,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Y=new THREE.Matrix4,ba=new Float32Array(16),ia=new Float32Array(16),ka=new THREE.Vector4,V={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},T,aa=[],ha,xa,K={},na=!1;j=function(){var a;try{if(!(a= +$.getContext("experimental-webgl",{antialias:P,stencil:da,preserveDrawingBuffer:ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND); +j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(R.r,R.g,R.b,z);(function(){K.vertices=new Float32Array(16);K.faces=new Uint16Array(6);var a=0;K.vertices[a++]=-1;K.vertices[a++]=-1;K.vertices[a++]=0;K.vertices[a++]=1;K.vertices[a++]=1;K.vertices[a++]=-1;K.vertices[a++]=1;K.vertices[a++]=1;K.vertices[a++]=1;K.vertices[a++]=1;K.vertices[a++]=1;K.vertices[a++]=0;K.vertices[a++]=-1;K.vertices[a++]=1;K.vertices[a++]=0;a=K.vertices[a++]=0;K.faces[a++]=0;K.faces[a++]= +1;K.faces[a++]=2;K.faces[a++]=0;K.faces[a++]=2;K.faces[a++]=3;K.vertexBuffer=j.createBuffer();K.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,K.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,K.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,K.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,K.faces,j.STATIC_DRAW);K.program=j.createProgram();j.attachShader(K.program,H("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(K.program,H("vertex",THREE.ShaderLib.sprite.vertexShader)); +j.linkProgram(K.program);K.attributes={};K.uniforms={};K.attributes.position=j.getAttribLocation(K.program,"position");K.attributes.uv=j.getAttribLocation(K.program,"uv");K.uniforms.uvOffset=j.getUniformLocation(K.program,"uvOffset");K.uniforms.uvScale=j.getUniformLocation(K.program,"uvScale");K.uniforms.rotation=j.getUniformLocation(K.program,"rotation");K.uniforms.scale=j.getUniformLocation(K.program,"scale");K.uniforms.alignment=j.getUniformLocation(K.program,"alignment");K.uniforms.color=j.getUniformLocation(K.program, +"color");K.uniforms.map=j.getUniformLocation(K.program,"map");K.uniforms.opacity=j.getUniformLocation(K.program,"opacity");K.uniforms.useScreenCoordinates=j.getUniformLocation(K.program,"useScreenCoordinates");K.uniforms.affectedByDistance=j.getUniformLocation(K.program,"affectedByDistance");K.uniforms.screenPosition=j.getUniformLocation(K.program,"screenPosition");K.uniforms.modelViewMatrix=j.getUniformLocation(K.program,"modelViewMatrix");K.uniforms.projectionMatrix=j.getUniformLocation(K.program, +"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ha=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});xa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});ha._shadowPass=!0;xa._shadowPass=!0})();this.context=j;var ta=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures= +function(){return ta};this.setSize=function(a,b){$.width=a;$.height=b;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(a,b,c,d){pa=a;ra=b;wa=c;S=d;j.viewport(pa,ra,wa,S)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){R.setHex(a);z=b;j.clearColor(R.r,R.g,R.b,z)};this.setClearColor=function(a,b){R.copy(a);z=b;j.clearColor(R.r,R.g,R.b,z)};this.getClearColor= +function(){return R};this.getClearAlpha=function(){return z};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){C(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c= a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d= -0,e=c.numMorphTargets;d=0)u=o.geometry.materials[u],u.transparent?(s.transparent=u,s.opaque=null):(s.opaque=u,s.transparent=null)}else if(u)u.transparent?(s.transparent=u,s.opaque=null):(s.opaque=u,s.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(ga.copy(m.position),Y.multiplyVector3(ga),g.z=ga.z)}this.sortObjects&&p.sort(i);p=a.__webglObjectsImmediate; -d=0;for(e=p.length;d65535&&(t[q].counter+=1,fa=t[q].hash+ -"_"+t[q].counter,i.geometryGroups[fa]===void 0&&(i.geometryGroups[fa]={faces3:[],faces4:[],materialIndex:K,vertices:0,numMorphTargets:Y})),n instanceof THREE.Face3?i.geometryGroups[fa].faces3.push(k):i.geometryGroups[fa].faces4.push(k),i.geometryGroups[fa].vertices+=o;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=da++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer= -j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){n=l=void 0;k.__webglMorphTargetsBuffers= -[];l=0;for(n=k.numMorphTargets;l0||o.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(o.faceUvs.length>1||o.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(K.geometry.skinWeights.length&&K.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k* -4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(n*3);i.__lineArray=new Uint16Array(q*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];K=0;for(o=i.numMorphTargets;K=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&& -p(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,X,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER, -Q,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,C,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,T,n))}if(wa&&ja){o=0;for(q=t.length;o0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,L,n))}if(ra&&H.hasTangents){o=0;for(q=t.length;o0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,V,n))}if(ha&&ta&&ma){o=0;for(q=t.length;o0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer), -j.bufferData(j.ARRAY_BUFFER,G,n))}if(ca){o=0;for(q=t.length;o=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal); -o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g=0&&(j.enableVertexAttribArray(o[K]), +0,e=c.numMorphTargets;d=0)B=D.geometry.materials[B],B.transparent?(o.transparent=B,o.opaque=null):(o.opaque=B,o.transparent=null)}else if(B)B.transparent?(o.transparent=B,o.opaque=null):(o.opaque=B,o.transparent=null);g.render=!0;if(this.sortObjects)n.renderDepth?g.z=n.renderDepth:(ka.copy(n.position),Y.multiplyVector3(ka),g.z=ka.z)}this.sortObjects&&p.sort(i);p=a.__webglObjectsImmediate; +d=0;for(e=p.length;d65535&&(r[D].counter+=1,Y=r[D].hash+"_"+r[D].counter,i.geometryGroups[Y]===void 0&&(i.geometryGroups[Y]= +{faces3:[],faces4:[],materialIndex:S,vertices:0,numMorphTargets:v})),m instanceof THREE.Face3?i.geometryGroups[Y].faces3.push(k):i.geometryGroups[Y].faces4.push(k),i.geometryGroups[Y].vertices+=o;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=ea++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer= +j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){m=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(m=k.numMorphTargets;l0||o.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(o.faceUvs.length>1||o.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(m*3); +i.__lineArray=new Uint16Array(D*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];S=0;for(o=i.numMorphTargets;S=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&p(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,K,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,N,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,C,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer), +j.bufferData(j.ARRAY_BUFFER,U,m))}if(xa&&ka){o=0;for(D=r.length;o0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,ia,m))}if(ja&&F.hasTangents){o=0;for(D=r.length;o0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,O,m))}if($&&ua&&H){o=0;for(D=r.length;o0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,E,m))}if(ga){o=0;for(D=r.length;o=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal); +o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g=0&&(j.enableVertexAttribArray(o[q]), a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}}; THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type: THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0}; @@ -349,19 +349,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null}; THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,e=Math.max(Math.max(b,d),g),f=Math.min(Math.min(b,d),g);if(f===e)f=b=0;else{var h=e-f,f=h/e,b=b===e?(d-g)/h:d===e?2+(g-b)/h:4+(b-d)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=e;return c}}; THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,e=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,h=e.vertices,i=a.faces,k=e.faces,l=a.faceVertexUvs[0],n=e.faceVertexUvs[0],r={},m=0;m1&&(d=1-d,g=1-g);e=1-d-g;f.copy(a);f.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);f.addSelf(h);h.copy(b);h.multiplyScalar(e);f.addSelf(h);return f},randomPointInFace:function(a,c,b){var d,g,e;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position, e=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,e);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;e=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c));return THREE.GeometryUtils.random()*(b+ -f)a?b(c,e-1):k[e]a?b(c,e-1):k[e]0?(f=b[b.length-1],m=f.x,s=f.y):(f=this.actions[d-1].args,m=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b2(p,m,n,h),p=THREE.Shape.Utils.b2(p,s,r, -i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];n=e[0];r=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],m=f.x,s=f.y):(f=this.actions[d-1].args,m=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b3(p,m,n,k,h),p=THREE.Shape.Utils.b3(p,s,r,l,i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];p=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f); -for(f=1;f<=p;f++)b.push(e.getPointAt(f/p));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];n=e[3];p=e[4];r=!!e[5];l=f[f.length-2];m=f[f.length-1];f.length==0&&(l=m=0);s=p-n;var o=a*2;for(f=1;f<=o;f++)p=f/o,r||(p=1-p),p=n+p*s,e=l+h+k*Math.cos(p),p=m+i+k*Math.sin(p),b.push(new THREE.Vector2(e,p))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)}; -THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,k,l,n;h=0;for(i=f.length;h0?(f=b[b.length-1],n=f.x,t=f.y):(f=this.actions[d-1].args,n=f[f.length-2],t=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b2(p,n,m,h),p=THREE.Shape.Utils.b2(p,t,q, +i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];m=e[0];q=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],n=f.x,t=f.y):(f=this.actions[d-1].args,n=f[f.length-2],t=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b3(p,n,m,k,h),p=THREE.Shape.Utils.b3(p,t,q,l,i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];p=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f); +for(f=1;f<=p;f++)b.push(e.getPointAt(f/p));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];m=e[3];p=e[4];q=!!e[5];l=f[f.length-2];n=f[f.length-1];f.length==0&&(l=n=0);t=p-m;var o=a*2;for(f=1;f<=o;f++)p=f/o,q||(p=1-p),p=m+p*t,e=l+h+k*Math.cos(p),p=n+i+k*Math.sin(p),b.push(new THREE.Vector2(e,p))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)}; +THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,k,l,m;h=0;for(i=f.length;h=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var p=[k[f],b[h],b[g]];n=THREE.FontUtils.Triangulate.area(p);var o=[k[f],k[e],b[h]];r=THREE.FontUtils.Triangulate.area(o);m=h;l=f;h+=1;f+=-1;h< -0&&(h+=b.length);h%=b.length;f<0&&(f+=k.length);f%=k.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;p=[k[f],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(p);o=[k[f],k[e],b[h]];o=THREE.FontUtils.Triangulate.area(o);n+r>p+o&&(h=m,f=l,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=k.length),f%=k.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:k.length-1);n=b.slice(0,h);r=b.slice(h);m=k.slice(f);l=k.slice(0,f);e=[k[f],k[e],b[h]];s.push([k[f],b[h],b[g]]);s.push(e);b=n.concat(m).concat(l).concat(r)}return{shape:b, -isolatedPts:s,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,k={};e=0;for(f=d.length;e=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var p=[k[f],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(p);var o=[k[f],k[e],b[h]];q=THREE.FontUtils.Triangulate.area(o);n=h;l=f;h+=1;f+=-1;h< +0&&(h+=b.length);h%=b.length;f<0&&(f+=k.length);f%=k.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;p=[k[f],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(p);o=[k[f],k[e],b[h]];o=THREE.FontUtils.Triangulate.area(o);m+q>p+o&&(h=n,f=l,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=k.length),f%=k.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:k.length-1);m=b.slice(0,h);q=b.slice(h);n=k.slice(f);l=k.slice(0,f);e=[k[f],k[e],b[h]];t.push([k[f],b[h],b[g]]);t.push(e);b=m.concat(n).concat(l).concat(q)}return{shape:b, +isolatedPts:t,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,k={};e=0;for(f=d.length;e1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b=== -"rot")THREE.Quaternion.slerp(g,e,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].update(null,!0);for(m=0;m1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",n,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b=== +"rot")THREE.Quaternion.slerp(g,e,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;na.length-2?e:e+1;b[3]=e>a.length-3?e:e+2;e=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;f=g*b;d[0]=this.interpolate(e[0],h[0],i[0],k[0],g,b,f);d[1]=this.interpolate(e[1],h[1],i[1],k[1],g,b,f);d[2]=this.interpolate(e[2],h[2],i[2],k[2],g,b,f);return d}; THREE.Animation.prototype.interpolate=function(a,c,b,d,g,e,f){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*f+(-3*(c-b)-2*a-d)*e+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]}; @@ -444,7 +444,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()}; THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1}; THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1}; -THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;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=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= +THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;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=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward= !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown= function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp= @@ -452,16 +452,16 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37: this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&& (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta); this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)}; -THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),o=g.length,t=0;f=o-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f=0?a:a+f;c=this.verticalAngleMap.srcRange; a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var d=a[1]-a[0];this.phi=b((c-a[0])/d)*d+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);d=a[1]-a[0];this.theta=b((c-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove= function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}), c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a= -this.debugPath,b=this.spline,f=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*l);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*l);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(b.object.position).subSelf(b.target);e=b.object.up.clone().setLength(d.y);e.addSelf(b.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(f); -d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(l.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?k=l:k.y+=(l.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=r.clone().subSelf(n);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y)); -b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?n=r:n.addSelf(a.sub(r,n).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()0&&(f.multiplyScalar(a),b.staticMoving?k=l:k.y+=(l.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=q.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y)); +b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?m=q:m.addSelf(a.sub(q,m).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;ha&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){I=C;Q=C-1;Q<0&&(Q=a.length-1);for(var b= -0,c=m+l*2,b=0;b=0;N--){aa=N/l;J=i*(1-aa);aa=k*Math.sin(aa*Math.PI/2);C=0;for(M=v.length;Ca&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){j=C;N=C-1;N<0&&(N=a.length-1);for(var b= +0,c=n+l*2,b=0;b=0;J--){$=J/l;L=i*(1-$);$=k*Math.sin($*Math.PI/2);C=0;for(O=w.length;C0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,h,r)))-1);k.push(l)}c.push(k)}for(var m,s,p,g=c.length,b=0;b0)for(d=0;d1&&(m= -this.vertices[f].position.clone(),s=this.vertices[i].position.clone(),p=this.vertices[k].position.clone(),m.normalize(),s.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,n,o]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,q)))-1);k.push(l)}c.push(k)}for(var n,t,p,g=c.length,b=0;b0)for(d=0;d1&&(n= +this.vertices[f].position.clone(),t=this.vertices[i].position.clone(),p=this.vertices[k].position.clone(),n.normalize(),t.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,m,o]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry; THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d= -0,g=String(a).split(""),e=g.length,f=[],a=0;a0)for(k=0;k2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);l=k+1;g<=l&&(l=0);var r;a:{r=a;var m=i,s=k,p=l,o=g,t=f,v=void 0,q=void 0,A=void 0, -D=void 0,E=void 0,u=void 0,x=void 0,H=void 0,w=void 0,q=r[t[m]].x,A=r[t[m]].y,D=r[t[s]].x,E=r[t[s]].y,u=r[t[p]].x,x=r[t[p]].y;if(1.0E-10>(D-q)*(x-A)-(E-A)*(u-q))r=!1;else{for(v=0;v=0&&N>=0&&J>=0){r=!1;break a}}r= -!0}}if(r){e.push([a[f[i]],a[f[k]],a[f[l]]]);h.push([f[i],f[k],f[l]]);i=k;for(l=k+1;l0)for(k=0;k2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);l=k+1;g<=l&&(l=0);var q;a:{q=a;var n=i,t=k,p=l,o=g,v=f,w=void 0,r=void 0,s=void 0, +u=void 0,x=void 0,H=void 0,G=void 0,F=void 0,y=void 0,r=q[v[n]].x,s=q[v[n]].y,u=q[v[t]].x,x=q[v[t]].y,H=q[v[p]].x,G=q[v[p]].y;if(1.0E-10>(u-r)*(G-s)-(x-s)*(H-r))q=!1;else{for(w=0;w=0&&J>=0&&L>=0){q=!1;break a}}q= +!0}}if(q){e.push([a[f[i]],a[f[k]],a[f[l]]]);h.push([f[i],f[k],f[l]]);i=k;for(l=k+1;l0;)this.smooth(a)}; -THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,l,m,o=0;o<4;o++){m=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var n=0;n>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=l(a,b),d=l(a,b+1),e=l(a,b+2);return(l(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=l(a,b);return(l(a,b+1)<<8)+c}function k(a,b){var c=l(a,b);return c>127?c-256:c}function l(a,b){return a.charCodeAt(b)&255}function n(b){var c, -d,e;c=g(a,b);d=g(a,b+E);e=g(a,b+u);b=i(a,b+x);t.faces.push(new THREE.Face3(c,d,e,null,null,b))}function r(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+E);e=g(a,b+u);f=i(a,b+x);j=g(a,b+H);k=g(a,b+w);l=g(a,b+C);var b=A[k*3],m=A[k*3+1];k=A[k*3+2];var n=A[l*3],o=A[l*3+1];l=A[l*3+2];t.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(A[j*3],A[j*3+1],A[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function m(b){var c,d,e,f;c=g(a,b);d=g(a,b+M);e=g(a,b+N);f=g(a,b+aa);b=i(a,b+J);t.faces.push(new THREE.Face4(c, -d,e,f,null,null,b))}function s(b){var c,d,e,f,j,k,l,m,n;c=g(a,b);d=g(a,b+M);e=g(a,b+N);f=g(a,b+aa);j=i(a,b+J);k=g(a,b+P);l=g(a,b+ea);m=g(a,b+S);n=g(a,b+ca);var b=A[l*3],o=A[l*3+1];l=A[l*3+2];var K=A[m*3],p=A[m*3+1];m=A[m*3+2];var q=A[n*3],r=A[n*3+1];n=A[n*3+2];t.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(A[k*3],A[k*3+1],A[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(K,p,m),new THREE.Vector3(q,r,n)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+y);e=g(a,b+B);b=D[c*2];f=D[c*2+ -1];c=D[d*2];var i=t.faceVertexUvs[0];d=D[d*2+1];var j=D[e*2];e=D[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function o(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+j);e=g(a,b+I);f=g(a,b+Q);b=D[c*2];i=D[c*2+1];c=D[d*2];k=D[d*2+1];d=D[e*2];var l=t.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,k));n.push(new THREE.UV(d,e));n.push(new THREE.UV(m,f));l.push(n)}var t=this,v=0,q,A=[],D=[],E, -u,x,H,w,C,M,N,aa,J,P,ea,S,ca,y,B,j,I,Q,ha,W,V,da,T,O;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(t,d,b);q={signature:a.substr(v,8),header_bytes:l(a,v+8),vertex_coordinate_bytes:l(a,v+9),normal_coordinate_bytes:l(a,v+10),uv_coordinate_bytes:l(a,v+11),vertex_index_bytes:l(a,v+12),normal_index_bytes:l(a,v+13),uv_index_bytes:l(a,v+14),material_index_bytes:l(a,v+15),nvertices:g(a,v+16),nnormals:g(a,v+16+4),nuvs:g(a,v+16+8),ntri_flat:g(a,v+16+12),ntri_smooth:g(a,v+16+16),ntri_flat_uv:g(a, -v+16+20),ntri_smooth_uv:g(a,v+16+24),nquad_flat:g(a,v+16+28),nquad_smooth:g(a,v+16+32),nquad_flat_uv:g(a,v+16+36),nquad_smooth_uv:g(a,v+16+40)};v+=q.header_bytes;E=q.vertex_index_bytes;u=q.vertex_index_bytes*2;x=q.vertex_index_bytes*3;H=q.vertex_index_bytes*3+q.material_index_bytes;w=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;C=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;M=q.vertex_index_bytes;N=q.vertex_index_bytes*2;aa=q.vertex_index_bytes*3;J=q.vertex_index_bytes* -4;P=q.vertex_index_bytes*4+q.material_index_bytes;ea=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;S=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;ca=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;y=q.uv_index_bytes;B=q.uv_index_bytes*2;j=q.uv_index_bytes;I=q.uv_index_bytes*2;Q=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;O=q.vertex_index_bytes*4+q.material_index_bytes;ha=q.ntri_flat*b;W=q.ntri_smooth*(b+q.normal_index_bytes* -3);V=q.ntri_flat_uv*(b+q.uv_index_bytes*3);da=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);T=q.nquad_flat*O;b=q.nquad_smooth*(O+q.normal_index_bytes*4);O=q.nquad_flat_uv*(O+q.uv_index_bytes*4);v+=function(b){for(var d,e,g,h=q.vertex_coordinate_bytes*3,i=b+q.nvertices*h;b=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p1){j=new THREE.MeshFaceMaterial;for(h=0;h1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation, -b.scale);for(f=0;f1?c[1].substr(0,b):"0";c[1].length=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift(); -for(d=0;db){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4? -g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};w.prototype.create=function(){var a= -{},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof H)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=U[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(sa+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color= -d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=oa;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var b=0;b=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("("); -a=e.shift();for(b=0;b>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=l(a,b),d=l(a,b+1),e=l(a,b+2);return(l(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=l(a,b);return(l(a,b+1)<<8)+c}function k(a,b){var c=l(a,b);return c>127?c-256:c}function l(a,b){return a.charCodeAt(b)&255}function m(b){var c, +d,e;c=g(a,b);d=g(a,b+x);e=g(a,b+H);b=i(a,b+G);v.faces.push(new THREE.Face3(c,d,e,null,null,b))}function q(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+x);e=g(a,b+H);f=i(a,b+G);j=g(a,b+F);k=g(a,b+y);l=g(a,b+C);var b=s[k*3],n=s[k*3+1];k=s[k*3+2];var m=s[l*3],o=s[l*3+1];l=s[l*3+2];v.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(b,n,k),new THREE.Vector3(m,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+O);e=g(a,b+J);f=g(a,b+$);b=i(a,b+L);v.faces.push(new THREE.Face4(c, +d,e,f,null,null,b))}function t(b){var c,d,e,f,j,k,l,n,m;c=g(a,b);d=g(a,b+O);e=g(a,b+J);f=g(a,b+$);j=i(a,b+L);k=g(a,b+P);l=g(a,b+da);n=g(a,b+ja);m=g(a,b+R);var b=s[l*3],o=s[l*3+1];l=s[l*3+2];var p=s[n*3],D=s[n*3+1];n=s[n*3+2];var q=s[m*3],r=s[m*3+1];m=s[m*3+2];v.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(s[k*3],s[k*3+1],s[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(p,D,n),new THREE.Vector3(q,r,m)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+z);e=g(a,b+B);b=u[c*2];f=u[c*2+ +1];c=u[d*2];var i=v.faceVertexUvs[0];d=u[d*2+1];var j=u[e*2];e=u[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function o(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+I);e=g(a,b+j);f=g(a,b+N);b=u[c*2];i=u[c*2+1];c=u[d*2];k=u[d*2+1];d=u[e*2];var l=v.faceVertexUvs[0];e=u[e*2+1];var n=u[f*2];f=u[f*2+1];var m=[];m.push(new THREE.UV(b,i));m.push(new THREE.UV(c,k));m.push(new THREE.UV(d,e));m.push(new THREE.UV(n,f));l.push(m)}var v=this,w=0,r,s=[],u=[],x, +H,G,F,y,C,O,J,$,L,P,da,ja,R,z,B,I,j,N,ga,X,Q,M,ea,U;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(v,d,b);r={signature:a.substr(w,8),header_bytes:l(a,w+8),vertex_coordinate_bytes:l(a,w+9),normal_coordinate_bytes:l(a,w+10),uv_coordinate_bytes:l(a,w+11),vertex_index_bytes:l(a,w+12),normal_index_bytes:l(a,w+13),uv_index_bytes:l(a,w+14),material_index_bytes:l(a,w+15),nvertices:g(a,w+16),nnormals:g(a,w+16+4),nuvs:g(a,w+16+8),ntri_flat:g(a,w+16+12),ntri_smooth:g(a,w+16+16),ntri_flat_uv:g(a, +w+16+20),ntri_smooth_uv:g(a,w+16+24),nquad_flat:g(a,w+16+28),nquad_smooth:g(a,w+16+32),nquad_flat_uv:g(a,w+16+36),nquad_smooth_uv:g(a,w+16+40)};w+=r.header_bytes;x=r.vertex_index_bytes;H=r.vertex_index_bytes*2;G=r.vertex_index_bytes*3;F=r.vertex_index_bytes*3+r.material_index_bytes;y=r.vertex_index_bytes*3+r.material_index_bytes+r.normal_index_bytes;C=r.vertex_index_bytes*3+r.material_index_bytes+r.normal_index_bytes*2;O=r.vertex_index_bytes;J=r.vertex_index_bytes*2;$=r.vertex_index_bytes*3;L=r.vertex_index_bytes* +4;P=r.vertex_index_bytes*4+r.material_index_bytes;da=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes;ja=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes*2;R=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes*3;z=r.uv_index_bytes;B=r.uv_index_bytes*2;I=r.uv_index_bytes;j=r.uv_index_bytes*2;N=r.uv_index_bytes*3;b=r.vertex_index_bytes*3+r.material_index_bytes;U=r.vertex_index_bytes*4+r.material_index_bytes;ga=r.ntri_flat*b;X=r.ntri_smooth*(b+r.normal_index_bytes* +3);Q=r.ntri_flat_uv*(b+r.uv_index_bytes*3);M=r.ntri_smooth_uv*(b+r.normal_index_bytes*3+r.uv_index_bytes*3);ea=r.nquad_flat*U;b=r.nquad_smooth*(U+r.normal_index_bytes*4);U=r.nquad_flat_uv*(U+r.uv_index_bytes*4);w+=function(b){for(var d,e,g,h=r.vertex_coordinate_bytes*3,i=b+r.nvertices*h;b=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p1){j=new THREE.MeshFaceMaterial;for(h=0;h1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f1?c[1].substr(0,b):"0";c[1].length=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;db){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};m.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};y.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof F)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ca[this.effect.surface.init_from]))a.map= +THREE.ImageUtils.loadTexture(ua+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=wa;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var b=0;b=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b1&&(aa=new THREE.MeshFaceMaterial);a=new THREE.Mesh(w,aa);a.name=m;a.position.set(D[0],D[1],D[2]);u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(E[0],E[1],E[2]);a.scale.set(x[0],x[1],x[2]);a.visible=v.visible;B.scene.add(a);B.objects[m]=a;if(v.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(v.castsShadow)b=new THREE.ShadowVolume(w),B.scene.add(b), -b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;v.trigger&&v.trigger.toLowerCase()!="none"&&(b={type:v.trigger,object:v},B.triggers[a.name]=b)}}else D=v.position,E=v.rotation,u=v.quaternion,x=v.scale,u=0,a=new THREE.Object3D,a.name=m,a.position.set(D[0],D[1],D[2]),u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(E[0],E[1],E[2]),a.scale.set(x[0],x[1],x[2]),a.visible=v.visible!==void 0?v.visible:!1,B.scene.add(a),B.objects[m]=a,B.empties[m]=a,v.trigger&&v.trigger.toLowerCase()!= -"none"&&(b={type:v.trigger,object:v},B.triggers[a.name]=b)}function i(a){return function(c){B.geometries[a]=c;h();ea-=1;b.onLoadComplete();l()}}function k(a){return function(b){B.geometries[a]=b}}function l(){b.callbackProgress({totalModels:ca,totalTextures:y,loadedModels:ca-ea,loadedTextures:y-S},B);b.onLoadProgress();ea==0&&S==0&&c(B)}var n,r,m,s,p,o,t,v,q,A,D,E,u,x,H,w,C,M,N,aa,J,P,ea,S,ca,y,B;J=a.data;N=new THREE.BinaryLoader;P=new THREE.JSONLoader;S=ea=0;B={scene:new THREE.Scene,geometries:{}, -materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(m in J.objects)if(v=J.objects[m],v.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(J.transform){a=J.transform.position;q=J.transform.rotation;var j=J.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);q&&B.scene.rotation.set(q[0],q[1],q[2]);j&&B.scene.scale.set(j[0],j[1],j[2]);(a||q||j)&&B.scene.updateMatrix()}a=function(){S-=1;l();b.onLoadComplete()};for(p in J.cameras)q= -J.cameras[p],q.type=="perspective"?C=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):q.type=="ortho"&&(C=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),D=q.position,q=q.target,C.position.set(D[0],D[1],D[2]),C.target=new THREE.Vector3(q[0],q[1],q[2]),B.cameras[p]=C;for(s in J.lights)q=J.lights[s],p=q.color!==void 0?q.color:16777215,C=q.intensity!==void 0?q.intensity:1,q.type=="directional"?(D=q.direction,A=new THREE.DirectionalLight(p,C),A.position.set(D[0],D[1], -D[2]),A.position.normalize()):q.type=="point"?(D=q.position,A=q.distance,A=new THREE.PointLight(p,C,A),A.position.set(D[0],D[1],D[2])):q.type=="ambient"&&(A=new THREE.AmbientLight(p)),B.scene.add(A),B.lights[s]=A;for(o in J.fogs)s=J.fogs[o],s.type=="linear"?M=new THREE.Fog(0,s.near,s.far):s.type=="exp2"&&(M=new THREE.FogExp2(0,s.density)),q=s.color,M.color.setRGB(q[0],q[1],q[2]),B.fogs[o]=M;if(B.cameras&&J.defaults.camera)B.currentCamera=B.cameras[J.defaults.camera];if(B.fogs&&J.defaults.fog)B.scene.fog= -B.fogs[J.defaults.fog];q=J.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(q[0],q[1],q[2]);B.bgColorAlpha=J.defaults.bgalpha;for(n in J.geometries)if(o=J.geometries[n],o.type=="bin_mesh"||o.type=="ascii_mesh")ea+=1,b.onLoadStart();ca=ea;for(n in J.geometries)o=J.geometries[n],o.type=="cube"?(w=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides),B.geometries[n]=w):o.type=="plane"?(w=new THREE.PlaneGeometry(o.width,o.height, -o.segmentsWidth,o.segmentsHeight),B.geometries[n]=w):o.type=="sphere"?(w=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight),B.geometries[n]=w):o.type=="cylinder"?(w=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs),B.geometries[n]=w):o.type=="torus"?(w=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT),B.geometries[n]=w):o.type=="icosahedron"?(w=new THREE.IcosahedronGeometry(o.subdivisions),B.geometries[n]=w):o.type=="bin_mesh"?N.load(d(o.url, -J.urlBaseType),i(n)):o.type=="ascii_mesh"?P.load(d(o.url,J.urlBaseType),i(n)):o.type=="embedded_mesh"&&(o=J.embeds[o.id])&&P.createModel(o,k(n),"");for(t in J.textures)if(n=J.textures[t],n.url instanceof Array){S+=n.url.length;for(N=0;N1&&($=new THREE.MeshFaceMaterial);a=new THREE.Mesh(y,$);a.name=n;a.position.set(u[0],u[1],u[2]);H?(a.quaternion.set(H[0],H[1],H[2],H[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]);a.scale.set(G[0],G[1],G[2]);a.visible=w.visible;B.scene.add(a);B.objects[n]=a;if(w.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(w.castsShadow)b=new THREE.ShadowVolume(y),B.scene.add(b),b.position= +a.position,b.rotation=a.rotation,b.scale=a.scale;w.trigger&&w.trigger.toLowerCase()!="none"&&(b={type:w.trigger,object:w},B.triggers[a.name]=b)}}else u=w.position,x=w.rotation,H=w.quaternion,G=w.scale,H=0,a=new THREE.Object3D,a.name=n,a.position.set(u[0],u[1],u[2]),H?(a.quaternion.set(H[0],H[1],H[2],H[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]),a.scale.set(G[0],G[1],G[2]),a.visible=w.visible!==void 0?w.visible:!1,B.scene.add(a),B.objects[n]=a,B.empties[n]=a,w.trigger&&w.trigger.toLowerCase()!= +"none"&&(b={type:w.trigger,object:w},B.triggers[a.name]=b)}function i(a){return function(c){B.geometries[a]=c;h();da-=1;b.onLoadComplete();l()}}function k(a){return function(b){B.geometries[a]=b}}function l(){b.callbackProgress({totalModels:R,totalTextures:z,loadedModels:R-da,loadedTextures:z-ja},B);b.onLoadProgress();da==0&&ja==0&&c(B)}var m,q,n,t,p,o,v,w,r,s,u,x,H,G,F,y,C,O,J,$,L,P,da,ja,R,z,B;L=a.data;J=new THREE.BinaryLoader;P=new THREE.JSONLoader;ja=da=0;B={scene:new THREE.Scene,geometries:{}, +materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in L.objects)if(w=L.objects[n],w.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(L.transform){a=L.transform.position;r=L.transform.rotation;var I=L.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);r&&B.scene.rotation.set(r[0],r[1],r[2]);I&&B.scene.scale.set(I[0],I[1],I[2]);(a||r||I)&&B.scene.updateMatrix()}a=function(){ja-=1;l();b.onLoadComplete()};for(p in L.cameras)r= +L.cameras[p],r.type=="perspective"?C=new THREE.PerspectiveCamera(r.fov,r.aspect,r.near,r.far):r.type=="ortho"&&(C=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),u=r.position,r=r.target,C.position.set(u[0],u[1],u[2]),C.target=new THREE.Vector3(r[0],r[1],r[2]),B.cameras[p]=C;for(t in L.lights)r=L.lights[t],p=r.color!==void 0?r.color:16777215,C=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(u=r.direction,s=new THREE.DirectionalLight(p,C),s.position.set(u[0],u[1], +u[2]),s.position.normalize()):r.type=="point"?(u=r.position,s=r.distance,s=new THREE.PointLight(p,C,s),s.position.set(u[0],u[1],u[2])):r.type=="ambient"&&(s=new THREE.AmbientLight(p)),B.scene.add(s),B.lights[t]=s;for(o in L.fogs)t=L.fogs[o],t.type=="linear"?O=new THREE.Fog(0,t.near,t.far):t.type=="exp2"&&(O=new THREE.FogExp2(0,t.density)),r=t.color,O.color.setRGB(r[0],r[1],r[2]),B.fogs[o]=O;if(B.cameras&&L.defaults.camera)B.currentCamera=B.cameras[L.defaults.camera];if(B.fogs&&L.defaults.fog)B.scene.fog= +B.fogs[L.defaults.fog];r=L.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(r[0],r[1],r[2]);B.bgColorAlpha=L.defaults.bgalpha;for(m in L.geometries)if(o=L.geometries[m],o.type=="bin_mesh"||o.type=="ascii_mesh")da+=1,b.onLoadStart();R=da;for(m in L.geometries)o=L.geometries[m],o.type=="cube"?(y=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides),B.geometries[m]=y):o.type=="plane"?(y=new THREE.PlaneGeometry(o.width,o.height, +o.segmentsWidth,o.segmentsHeight),B.geometries[m]=y):o.type=="sphere"?(y=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight),B.geometries[m]=y):o.type=="cylinder"?(y=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs),B.geometries[m]=y):o.type=="torus"?(y=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT),B.geometries[m]=y):o.type=="icosahedron"?(y=new THREE.IcosahedronGeometry(o.subdivisions),B.geometries[m]=y):o.type=="bin_mesh"?J.load(d(o.url, +L.urlBaseType),i(m)):o.type=="ascii_mesh"?P.load(d(o.url,L.urlBaseType),i(m)):o.type=="embedded_mesh"&&(o=L.embeds[o.id])&&P.createModel(o,k(m),"");for(v in L.textures)if(m=L.textures[v],m.url instanceof Array){ja+=m.url.length;for(J=0;J=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var e=0,f=0;f>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g=this.maxCount-3&&h(this)};this.begin= -function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;cthis.size-1&&(i=this.size-1);var r=Math.floor(k-h);r<1&&(r=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var m=Math.floor(l-h);m<1&&(m=1);h=Math.floor(l+h); -h>this.size-1&&(h=this.size-1);for(var s,p,o,t,v,q;n0&&(this.field[o+s]+=t)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,n=this.zd,r=this.field,m=k*Math.sqrt(a/c);m>k&&(m=k);for(g=0;g0)for(e=0;el&&(s=l);for(e=0;e0){i=e*n;for(g=0;gl&&(s=l);for(f=0;f0){i=r*f;for(e=0;ethis.size-1&&(i=this.size-1);var q=Math.floor(k-h);q<1&&(q=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(l-h);n<1&&(n=1);h=Math.floor(l+h); +h>this.size-1&&(h=this.size-1);for(var t,p,o,v,w,r;m0&&(this.field[o+t]+=v)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,m=this.zd,q=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g0)for(e=0;el&&(t=l);for(e=0;e0){i=e*m;for(g=0;gl&&(t=l);for(f=0;f0){i=q*f;for(e=0;ec.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c}; THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,n;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},r=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53, -1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:r},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}), -p=new THREE.Scene;p.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));p.add(s);this.setSize=function(a,d){b.call(c,a,d);r.width=a;r.height=d;m.width=a;m.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||l!==b.far||n!==b.fov){i=b.aspect;k=b.near;l=b.far;n=b.fov;var v=b.projectionMatrix.clone(),q=125/30*0.5,A=q*k/125,D=k*Math.tan(n*Math.PI/360),E;f.n14=q;h.n14=-q;q=-D*i+A;E=D*i+A;v.n11=2*k/(E-q);v.n13=(E+q)/(E-q);g.projectionMatrix.copy(v);q=-D*i-A;E=D*i-A;v.n11= -2*k/(E-q);v.n13=(E+q)/(E-q);e.projectionMatrix.copy(v)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,r,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,m,!0);p.updateMatrixWorld();d.call(c,p,s)}}; +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,m;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},q=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53, +1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:q},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}), +p=new THREE.Scene;p.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));p.add(t);this.setSize=function(a,d){b.call(c,a,d);q.width=a;q.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||l!==b.far||m!==b.fov){i=b.aspect;k=b.near;l=b.far;m=b.fov;var w=b.projectionMatrix.clone(),r=125/30*0.5,s=r*k/125,u=k*Math.tan(m*Math.PI/360),x;f.n14=r;h.n14=-r;r=-u*i+s;x=u*i+s;w.n11=2*k/(x-r);w.n13=(x+r)/(x-r);g.projectionMatrix.copy(w);r=-u*i-s;x=u*i-s;w.n11= +2*k/(x-r);w.n13=(x+r)/(x-r);e.projectionMatrix.copy(w)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,q,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,n,!0);p.updateMatrixWorld();d.call(c,p,t)}}; if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,e,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;e=d};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far= b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,e);d.call(c,a,f);this.setViewport(g,0,g,e);d.call(c,a,h,!1)}}; diff --git a/build/custom/ThreeCanvas.js b/build/custom/ThreeCanvas.js index f8ea26fa..de6f7973 100644 --- a/build/custom/ThreeCanvas.js +++ b/build/custom/ThreeCanvas.js @@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo this.normalize();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 a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,n=l*c+g*f-h*d,j=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e* c-g*d-h*f;b.x=n*l+c*-e+j*-h-i*-g;b.y=j*l+c*-g+i*-e-n*-h;b.z=i*l+c*-h+n*-g-j*-e;return b}}; -THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; diff --git a/build/custom/ThreeDOM.js b/build/custom/ThreeDOM.js index 414d844d..761a5e87 100644 --- a/build/custom/ThreeDOM.js +++ b/build/custom/ThreeDOM.js @@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo this.normalize();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 a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,j=this.w,k=j*c+g*e-h*d,i=j*d+h*c-f*e,l=j*e+f*d-g*c,c=-f* c-g*d-h*e;b.x=k*j+c*-f+i*-h-l*-g;b.y=i*j+c*-g+l*-f-k*-h;b.z=l*j+c*-h+k*-g-i*-f;return b}}; -THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index c456c9ca..378861b1 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -96,7 +96,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()}; THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1}; THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1}; -THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;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=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= +THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;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=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward= !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown= function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp= @@ -106,14 +106,14 @@ this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b) this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)}; THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,p=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:c,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g=0?a:a+e;d=this.verticalAngleMap.srcRange; a=this.verticalAngleMap.dstRange;d=THREE.Math.mapLinear(this.phi,d[0],d[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((d-a[0])/c)*c+a[0];d=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;d=THREE.Math.mapLinear(this.theta,d[0],d[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((d-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove= function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}), c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a= this.debugPath,b=this.spline,e=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index 7f888bc2..2a05ce61 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -14,31 +14,31 @@ Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z- b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b=0&&E>=0&&x+E<1}for(var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,i,h,o,p,j,r,x,E,H,M=[],C=0,oa=a.children.length;Ca.scale.x)return[];H={distance:C,point:a.position, -face:null,object:a};M.push(H)}else if(a instanceof THREE.Mesh){C=b(this.origin,this.direction,a.matrixWorld.getPosition());if(C===null||C>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return M;var X,P,ma,D,R,K,F,ia,I=a.geometry,V=I.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);C=0;for(oa=I.faces.length;C0:K<0)))if(K=R.dot((new THREE.Vector3).sub(X,F))/K,F=F.addSelf(ia.multiplyScalar(K)),H instanceof THREE.Face3)c(F,X,P,ma)&&(H={distance:this.origin.distanceTo(F),point:F,face:H,object:a}, -M.push(H));else if(H instanceof THREE.Face4&&(c(F,X,P,D)||c(F,P,ma,D)))H={distance:this.origin.distanceTo(F),point:F,face:H,object:a},M.push(H)}return M}}; +THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b=0&&F>=0&&x+F<1}for(var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,i,h,o,p,j,r,x,F,I,M=[],C=0,ma=a.children.length;Ca.scale.x)return[];I={distance:C,point:a.position, +face:null,object:a};M.push(I)}else if(a instanceof THREE.Mesh){C=b(this.origin,this.direction,a.matrixWorld.getPosition());if(C===null||C>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return M;var X,ea,la,D,R,L,G,ha,J=a.geometry,S=J.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);C=0;for(ma=J.faces.length;C0:L<0)))if(L=R.dot((new THREE.Vector3).sub(X,G))/L,G=G.addSelf(ha.multiplyScalar(L)),I instanceof THREE.Face3)c(G,X,ea,la)&&(I={distance:this.origin.distanceTo(G),point:G,face:I,object:a}, +M.push(I));else if(I instanceof THREE.Face4&&(c(G,X,ea,D)||c(G,ea,la,D)))I={distance:this.origin.distanceTo(G),point:G,face:I,object:a},M.push(I)}return M}}; THREE.Rectangle=function(){function a(){g=e-b;i=f-c}var b,c,e,f,g,i,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,i,j,r){h=!1;b=g;c=i;e=j;f=r;a()};this.addPoint=function(g,i){h?(h=!1,b=g,c=i,e=g,f=i):(b=bg?e:g,f=f>i?f:i);a()};this.add3Points= -function(g,i,j,r,x,E){h?(h=!1,b=gj?g>x?g:x:j>x?j:x,f=i>r?i>E?i:E:r>E?r:E):(b=gj?g>x?g>e?g:e:x>e?x:e:j>x?j>e?j:e:x>e?x:e,f=i>r?i>E?i>f?i:f:E>f?E:f:r>E?r>f?r:f:E>f?E:f);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),e=g.getRight(),f=g.getBottom()):(b=bg.getRight()?e:g.getRight(),f=f> +function(g,i,j,r,x,F){h?(h=!1,b=gj?g>x?g:x:j>x?j:x,f=i>r?i>F?i:F:r>F?r:F):(b=gj?g>x?g>e?g:e:x>e?x:e:j>x?j>e?j:e:x>e?x:e,f=i>r?i>F?i>f?i:f:F>f?F:f:r>F?r>f?r:f:F>f?F:f);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),e=g.getRight(),f=g.getBottom()):(b=bg.getRight()?e:g.getRight(),f=f> g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;e+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();e=e=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=e=c=b=0;a()};this.isEmpty=function(){return h}}; THREE.Math={clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a=0&&f>=0&&i>=0&&h>=0?!0:g<0&&f<0||i<0&&h<0?!1:(g<0?c=Math.max(c,g/(g-f)):f<0&&(e=Math.min(e,g/(g-f))),i<0?c=Math.max(c,i/(i-h)):h<0&&(e=Math.min(e,i/(i-h))),ei&&h.positionScreen.z0&&K.z<1))i=ma[P]=ma[P]||new THREE.RenderableParticle,P++,X=i,X.x=K.x/K.w,X.y=K.y/K.w,X.z=K.z,X.rotation=N.rotation.z,X.scale.x=N.scale.x*Math.abs(X.x-(K.x+g.projectionMatrix.n11)/(K.w+g.projectionMatrix.n14)),X.scale.y=N.scale.y*Math.abs(X.y-(K.y+ -g.projectionMatrix.n22)/(K.w+g.projectionMatrix.n24)),X.material=N.material,D.elements.push(X);f&&D.elements.sort(c);return D}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)}; +j,r,x=[],F,I=[],M,C,ma=[],X,ea,la=[],D={objects:[],sprites:[],lights:[],elements:[]},R=new THREE.Vector3,L=new THREE.Vector4,G=new THREE.Matrix4,ha=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Vector4,sa=new THREE.Vector4;this.computeFrustum=function(a){J[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);J[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);J[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+ +a.n23,a.n44+a.n24);J[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);J[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);J[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=J[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix); +G.multiply(b.matrixWorld,b.projectionMatrixInverse);G.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,e){g=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var i=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld, +g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=J[h].x*e.n14+J[h].y*e.n24+J[h].z*e.n34+J[h].w,c<=g){c=!1;break a}c=!0}c?(G.multiplyVector3(R.copy(b.position)),f=a(),f.object=b,f.z=R.z,D.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(G.multiplyVector3(R.copy(b.position)),f=a(),f.object=b,f.z=R.z,D.sprites.push(f)):b instanceof THREE.Light&&D.lights.push(b);c=0;for(e=b.children.length;ci&&h.positionScreen.z0&&L.z<1))i=la[ea]=la[ea]||new THREE.RenderableParticle,ea++,X=i,X.x=L.x/L.w,X.y=L.y/L.w,X.z=L.z,X.rotation=ga.rotation.z,X.scale.x=ga.scale.x*Math.abs(X.x-(L.x+g.projectionMatrix.n11)/(L.w+g.projectionMatrix.n14)),X.scale.y=ga.scale.y*Math.abs(X.y-(L.y+g.projectionMatrix.n22)/ +(L.w+g.projectionMatrix.n24)),X.material=ga.material,D.elements.push(X);f&&D.elements.sort(c);return D}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),i=a*b,h=e*f;this.w=i*g-h*c;this.x=i*c+h*g;this.y=e*b*g+a*f*c;this.z=a*f*g-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c); this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();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 a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= this.x,c=this.y,e=this.z,f=this.w,g=a.x,i=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-e*i;this.y=c*a+f*i+e*g-b*h;this.z=e*a+f*h+b*i-c*g;this.w=f*a-b*g-c*i-e*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,g=this.x,i=this.y,h=this.z,o=this.w,p=o*c+i*f-h*e,j=o*e+h*c-g*f,r=o*f+g*e-i*c,c=-g* c-i*e-h*f;b.x=p*o+c*-g+j*-h-r*-i;b.y=j*o+c*-i+r*-g-p*-h;b.z=r*o+c*-h+p*-i-j*-g;return b}}; -THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,e,f,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,e,f,g,i){this.a=a;this.b=b;this.c=c;this.d=e;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.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; @@ -82,9 +82,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid c,e,f,g,i,h=new THREE.Vector3,o=new THREE.Vector3;e=0;for(f=this.faces.length;e0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x], +c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,b,c,e,g,f,d){h=a.vertices[b].position;o=a.vertices[c].position;p=a.vertices[e].position;j=i[g];r=i[f];x=i[d];F=o.x-h.x;I=p.x-h.x;M=o.y-h.y;C=p.y-h.y;ma=o.z-h.z;X=p.z-h.z;ea=r.u-j.u;la=x.u-j.u;D=r.v-j.v;R=x.v-j.v;L=1/(ea*R-la*D);S.set((R*F-D*I)*L,(R*M-D*C)*L,(R*ma-D*X)*L);sa.set((ea*I-la*F)*L,(ea*C-la*M)*L,(ea*X-la*ma)*L);ha[b].addSelf(S);ha[c].addSelf(S);ha[e].addSelf(S); +J[b].addSelf(sa);J[c].addSelf(sa);J[e].addSelf(sa)}var b,c,e,f,g,i,h,o,p,j,r,x,F,I,M,C,ma,X,ea,la,D,R,L,G,ha=[],J=[],S=new THREE.Vector3,sa=new THREE.Vector3,ia=new THREE.Vector3,ka=new THREE.Vector3,ta=new THREE.Vector3;b=0;for(c=this.vertices.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x], y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z< this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,g,f,q,l=a.vertices;q=l.length;var i=a.colors,h=i.length,k=a.__vertexArray,m=a.__colorArray,j=a.__sortArray,y=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){za.multiplySelf(c.matrixWorld);for(e=0;e=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,g,f,q,l=a.vertices;q=l.length;var i=a.colors,h=i.length,k=a.__vertexArray,m=a.__colorArray,j=a.__sortArray,y=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){xa.multiplySelf(c.matrixWorld);for(e=0;e=0)a&&(d.bindBuffer(d.ARRAY_BUFFER, +3,f=(f+w+h)/3,g=(g+k+m)/3,c[j]=e,c[j+1]=f,c[j+2]=g,c[j+3]=e,c[j+4]=f,c[j+5]=g,c[j+6]=e,c[j+7]=f,c[j+8]=g}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,a.count);a.count=0}function g(a,b,c,e,f,g){if(e.opacity!==0){var i,l,c=C(a,b,c,e,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==pa&&(pa=c,a=!0);if(!e.morphTargets&&b.position>=0)a&&(d.bindBuffer(d.ARRAY_BUFFER, f.__webglVertexBuffer),d.vertexAttribPointer(b.position,3,d.FLOAT,!1,0,0));else if(g.morphTargetBase){c=e.program.attributes;g.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){i=0;var w=g.morphTargetForcedOrder;for(l=g.morphTargetInfluences;ih&&(k=m,h=l[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+i],3,d.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[i]= h;w[k]=1;h=-1;i++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){i=0;for(l=f.__webglCustomAttributesList.length;i=0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}b.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(b.color, 3,d.FLOAT,!1,0,0));b.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(b.normal,3,d.FLOAT,!1,0,0));b.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(b.tangent,4,d.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUVBuffer),d.vertexAttribPointer(b.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(b.uv)):d.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer), d.vertexAttribPointer(b.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(b.uv2)):d.disableVertexAttribArray(b.uv2));e.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(b.skinVertexA,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(b.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(b.skinIndex, -4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(b.skinWeight,4,d.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(e.wireframe?(e=e.wireframeLinewidth,e!==Ia&&(d.lineWidth(e),Ia=e),a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,d.UNSIGNED_SHORT,0)):(a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+= -f.__webglFaceCount,L.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,e=e.linewidth,e!==Ia&&(d.lineWidth(e),Ia=e),d.drawArrays(g,0,f.__webglLineCount),L.info.render.calls++):g instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),L.info.render.calls++):g instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),L.info.render.calls++)}}function i(a){qa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43- +4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(b.skinWeight,4,d.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(e.wireframe?(e=e.wireframeLinewidth,e!==Ha&&(d.lineWidth(e),Ha=e),a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,d.UNSIGNED_SHORT,0)):(a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+= +f.__webglFaceCount,E.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,e=e.linewidth,e!==Ha&&(d.lineWidth(e),Ha=e),d.drawArrays(g,0,f.__webglLineCount),E.info.render.calls++):g instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),E.info.render.calls++):g instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),E.info.render.calls++)}}function i(a){qa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43- a.n13,a.n44-a.n14);qa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);qa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);qa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);qa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);qa[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=qa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y, -a.scale.z)),c=0;c<6;c++)if(a=qa[c].x*b.n14+qa[c].y*b.n24+qa[c].z*b.n34+qa[c].w,a<=d)return!1;return!0}function o(a,b){return b.z-a.z}function p(a){var b,c,e,j,Ma,q,l,w,Ca=0,k=a.lights;ra||(ra=new THREE.PerspectiveCamera(L.shadowCameraFov,L.shadowMapWidth/L.shadowMapHeight,L.shadowCameraNear,L.shadowCameraFar));b=0;for(c=k.length;b=0;d--)a[d].object===b&&a.splice(d,1)}function C(a,b,c,e,f){e.program||L.initMaterial(e, -b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets);for(var g=0,i=L.maxMorphTargets;g=0;d--)a[d].object===b&&a.splice(d,1)}function C(a,b,c,e,f){e.program||E.initMaterial(e, +b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var g=0,i=E.maxMorphTargets;g0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Va};this.setSize=function(a,b){la.width=a;la.height=b;this.setViewport(0,0,la.width,la.height)};this.setViewport=function(a,b,c,e){Oa=a;Pa=b;Ha=c;Ea=e;d.viewport(Oa,Pa,Ha,Ea)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)}; -this.setClearColorHex=function(a,b){na.setHex(a);pa=b;d.clearColor(na.r,na.g,na.b,pa)};this.setClearColor=function(a,b){na.copy(a);pa=b;d.clearColor(na.r,na.g,na.b,pa)};this.getClearColor=function(){return na};this.getClearAlpha=function(){return pa};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.clearTarget=function(a,b,c,d){V(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit= +d.getUniformLocation(v.program,"screenPosition");v.uniforms.modelViewMatrix=d.getUniformLocation(v.program,"modelViewMatrix");v.uniforms.projectionMatrix=d.getUniformLocation(v.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});Ma=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0}); +Fa._shadowPass=!0;Ma._shadowPass=!0})();this.context=d;var Va=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Va};this.setSize=function(a,b){ka.width=a;ka.height=b;this.setViewport(0,0,ka.width,ka.height)};this.setViewport=function(a,b,c,e){Oa=a;Pa=b;Ga=c;Ca=e;d.viewport(Oa,Pa,Ga,Ca)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)}; +this.setClearColorHex=function(a,b){V.setHex(a);N=b;d.clearColor(V.r,V.g,V.b,N)};this.setClearColor=function(a,b){V.copy(a);N=b;d.clearColor(V.r,V.g,V.b,N)};this.getClearColor=function(){return V};this.getClearAlpha=function(){return N};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.clearTarget=function(a,b,c,d){S(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit= !1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];d.deleteBuffer(c.__webglVertexBuffer);d.deleteBuffer(c.__webglNormalBuffer);d.deleteBuffer(c.__webglTangentBuffer);d.deleteBuffer(c.__webglColorBuffer);d.deleteBuffer(c.__webglUVBuffer);d.deleteBuffer(c.__webglUV2Buffer);d.deleteBuffer(c.__webglSkinVertexABuffer);d.deleteBuffer(c.__webglSkinVertexBBuffer); -d.deleteBuffer(c.__webglSkinIndicesBuffer);d.deleteBuffer(c.__webglSkinWeightsBuffer);d.deleteBuffer(c.__webglFaceBuffer);d.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e=0)y=m.geometry.materials[y],y.transparent?(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null)}else if(y)y.transparent? -(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Da.copy(q.position),za.multiplyVector3(Da),g.z=Da.z)}this.sortObjects&&l.sort(o);l=a.__webglObjectsImmediate;e=0;for(f=l.length;e=0)y=m.geometry.materials[y],y.transparent?(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null)}else if(y)y.transparent? +(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Ba.copy(q.position),xa.multiplyVector3(Ba),g.z=Ba.z)}this.sortObjects&&l.sort(o);l=a.__webglObjectsImmediate;e=0;for(f=l.length;e65535&&(y[m].counter+=1,p=y[m].hash+"_"+y[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r})),w instanceof THREE.Face3?j.geometryGroups[p].faces3.push(q):j.geometryGroups[p].faces4.push(q), -j.geometryGroups[p].vertices+=k;j.geometryGroupsList=[];q=void 0;for(q in j.geometryGroups)j.geometryGroups[q].id=ua++,j.geometryGroupsList.push(j.geometryGroups[q])}for(i in h.geometryGroups)if(j=h.geometryGroups[i],!j.__webglVertexBuffer){q=j;q.__webglVertexBuffer=d.createBuffer();q.__webglNormalBuffer=d.createBuffer();q.__webglTangentBuffer=d.createBuffer();q.__webglColorBuffer=d.createBuffer();q.__webglUVBuffer=d.createBuffer();q.__webglUV2Buffer=d.createBuffer();q.__webglSkinVertexABuffer=d.createBuffer(); -q.__webglSkinVertexBBuffer=d.createBuffer();q.__webglSkinIndicesBuffer=d.createBuffer();q.__webglSkinWeightsBuffer=d.createBuffer();q.__webglFaceBuffer=d.createBuffer();q.__webglLineBuffer=d.createBuffer();if(q.numMorphTargets){w=l=void 0;q.__webglMorphTargetsBuffers=[];l=0;for(w=q.numMorphTargets;l0||k.faceVertexUvs.length> 0)j.__uvArray=new Float32Array(q*2);if(k.faceUvs.length>1||k.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(q*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(q*4),j.__skinVertexBArray=new Float32Array(q*4),j.__skinIndexArray=new Float32Array(q*4),j.__skinWeightArray=new Float32Array(q*4);j.__faceArray=new Uint16Array(w*3);j.__lineArray=new Uint16Array(m*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];o=0;for(k=j.numMorphTargets;o=0;h--)g[h]===i&&g.splice(h,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&M(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,T,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,U,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,F,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,fa,w))}if(sa&&R){k=0;for(m=y.length;k0&&(d.bindBuffer(d.ARRAY_BUFFER, -l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,$,w))}if(oa&&I.hasTangents){k=0;for(m=y.length;k0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,V,w))}if(ha&&ra&&X){k=0;for(m=y.length;k0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,t,w))}if(ia){k=0;for(m=y.length;k0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,T,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,U,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,G,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,fa,w))}if(sa&&R){k=0;for(m=y.length;k0&&(d.bindBuffer(d.ARRAY_BUFFER, +l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,$,w))}if(ma&&J.hasTangents){k=0;for(m=y.length;k0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,V,w))}if(ha&&ra&&X){k=0;for(m=y.length;k0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,t,w))}if(ia){k=0;for(m=y.length;k=0&&d.enableVertexAttribArray(p.position);p.color>=0&&d.enableVertexAttribArray(p.color);p.normal>=0&&d.enableVertexAttribArray(p.normal); +h=["#ifdef GL_ES","precision "+ta+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP": +"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(v,L("fragment",h+o));d.attachShader(v, +L("vertex",e+k));d.linkProgram(v);d.getProgramParameter(v,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(v,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");v.uniforms={};v.attributes={};var x,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in j)e.push(x);x=e;e=0;for(j=x.length;e=0&&d.enableVertexAttribArray(p.position);p.color>=0&&d.enableVertexAttribArray(p.color);p.normal>=0&&d.enableVertexAttribArray(p.normal); p.tangent>=0&&d.enableVertexAttribArray(p.tangent);a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(d.enableVertexAttribArray(p.skinVertexA),d.enableVertexAttribArray(p.skinVertexB),d.enableVertexAttribArray(p.skinIndex),d.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(g in a.attributes)p[g]!==void 0&&p[g]>=0&&d.enableVertexAttribArray(p[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g=0&&(d.enableVertexAttribArray(p[x]), a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)}}; THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type: diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 8af5a27f..da09b9ea 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -13,8 +13,9 @@ THREE.WebGLRenderer = function ( parameters ) { _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElement( 'canvas' ), - _stencil = parameters.stencil !== undefined ? parameters.stencil : true, + _precision = parameters.precision !== undefined ? parameters.precision : 'highp', _antialias = parameters.antialias !== undefined ? parameters.antialias : false, + _stencil = parameters.stencil !== undefined ? parameters.stencil : true, _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false, _clearColor = parameters.clearColor !== undefined ? new THREE.Color( parameters.clearColor ) : new THREE.Color( 0x000000 ), @@ -5277,7 +5278,7 @@ THREE.WebGLRenderer = function ( parameters ) { var prefix_fragment = [ "#ifdef GL_ES", - "precision highp float;", + "precision " + _precision + " float;", "#endif", "#define MAX_DIR_LIGHTS " + parameters.maxDirLights,