|
@@ -1,7 +1,7 @@
|
|
|
// Three.js r42 - http://github.com/mrdoob/three.js
|
|
|
var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
|
|
|
-THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,j,h,m,n;if(e==0)f=g=j=0;else switch(h=Math.floor(b*6),m=b*6-h,b=e*(1-c),n=e*(1-c*m),c=e*(1-c*(1-m)),h){case 1:f=n;g=e;j=b;break;case 2:f=b;g=e;j=c;break;case 3:f=b;g=n;j=e;break;case 4:f=c;g=b;j=e;break;case 5:f=e;g=b;j=n;break;case 6:case 0:f=e,g=c,j=b}this.setRGB(f,
|
|
|
-g,j)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
|
|
|
+THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,h,j,g,m,o;if(e==0)f=h=j=0;else switch(g=Math.floor(b*6),m=b*6-g,b=e*(1-c),o=e*(1-c*m),c=e*(1-c*(1-m)),g){case 1:f=o;h=e;j=b;break;case 2:f=b;h=e;j=c;break;case 3:f=b;h=o;j=e;break;case 4:f=c;h=b;j=e;break;case 5:f=e;h=b;j=o;break;case 6:case 0:f=e,h=c,j=b}this.setRGB(f,
|
|
|
+h,j)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
|
|
|
THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
|
|
|
(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
|
|
|
unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.set(b||0,c||0,e||0)};
|
|
@@ -14,73 +14,73 @@ THREE.Vector4.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w
|
|
|
b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
|
|
|
setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
|
|
|
-g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,j,h,m,n,p,o,t,u,v,x=b.geometry,
|
|
|
-w=x.vertices,y=[],f=0;for(g=x.faces.length;f<g;f++)if(j=x.faces[f],u=this.origin.clone(),v=this.direction.clone(),p=b.matrixWorld,h=p.multiplyVector3(w[j.a].position.clone()),m=p.multiplyVector3(w[j.b].position.clone()),n=p.multiplyVector3(w[j.c].position.clone()),p=j instanceof THREE.Face4?p.multiplyVector3(w[j.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),t=v.dot(o),b.doubleSided||(b.flipSided?t>0:t<0))if(o=o.dot((new THREE.Vector3).sub(h,u))/t,u=u.addSelf(v.multiplyScalar(o)),
|
|
|
-j instanceof THREE.Face3)e(u,h,m,n)&&(j={distance:this.origin.distanceTo(u),point:u,face:j,object:b},y.push(j));else if(j instanceof THREE.Face4&&(e(u,h,m,p)||e(u,m,n,p)))j={distance:this.origin.distanceTo(u),point:u,face:j,object:b},y.push(j);return y}else return[]}};
|
|
|
-THREE.Rectangle=function(){function b(){j=f-c;h=g-e}var c,e,f,g,j,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,o,t){m=!1;c=h;e=j;f=o;g=t;b()};this.addPoint=function(h,j){m?(m=!1,c=h,e=j,f=h,g=j):(c=c<h?c:h,e=e<j?e:j,f=f>h?f:h,g=g>j?g:j);b()};this.add3Points=
|
|
|
-function(h,j,o,t,u,v){m?(m=!1,c=h<o?h<u?h:u:o<u?o:u,e=j<t?j<v?j:v:t<v?t:v,f=h>o?h>u?h:u:o>u?o:u,g=j>t?j>v?j:v:t>v?t:v):(c=h<o?h<u?h<c?h:c:u<c?u:c:o<u?o<c?o:c:u<c?u:c,e=j<t?j<v?j<e?j:e:v<e?v:e:t<v?t<e?t:e:v<e?v:e,f=h>o?h>u?h>f?h:f:u>f?u:f:o>u?o>f?o:f:u>f?u:f,g=j>t?j>v?j>g?j:g:v>g?v:g:t>v?t>g?t:g:v>g?v:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
|
|
|
-h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
|
|
|
-THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,j,h,m,n,p,o,t,u,v,x,w){this.set(b||1,c||0,e||0,f||0,g||0,j||1,h||0,m||0,n||0,p||0,o||1,t||0,u||0,v||0,x||0,w||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={set:function(b,c,e,f,g,j,h,m,n,p,o,t,u,v,x,w){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=h;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=t;this.n41=u;this.n42=v;this.n43=x;this.n44=w;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1,
|
|
|
-g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
|
|
|
-f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
|
|
|
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,u=b.n33,v=b.n34,x=b.n41,w=b.n42,y=b.n43,C=b.n44,E=c.n11,B=c.n12,I=c.n13,F=c.n14,A=c.n21,P=c.n22,
|
|
|
-H=c.n23,G=c.n24,U=c.n31,V=c.n32,J=c.n33,Z=c.n34,K=c.n41,S=c.n42,k=c.n43,W=c.n44;this.n11=e*E+f*A+g*U+j*K;this.n12=e*B+f*P+g*V+j*S;this.n13=e*I+f*H+g*J+j*k;this.n14=e*F+f*G+g*Z+j*W;this.n21=h*E+m*A+n*U+p*K;this.n22=h*B+m*P+n*V+p*S;this.n23=h*I+m*H+n*J+p*k;this.n24=h*F+m*G+n*Z+p*W;this.n31=o*E+t*A+u*U+v*K;this.n32=o*B+t*P+u*V+v*S;this.n33=o*I+t*H+u*J+v*k;this.n34=o*F+t*G+u*Z+v*W;this.n41=x*E+w*A+y*U+C*K;this.n42=x*B+w*P+y*V+C*S;this.n43=x*I+w*H+y*J+C*k;this.n44=x*F+w*G+y*Z+C*W;return this},multiplyToArray:function(b,
|
|
|
+g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var h,j,g,m,o,p,n,t,v,u,w=b.geometry,
|
|
|
+A=w.vertices,y=[],f=0;for(h=w.faces.length;f<h;f++)if(j=w.faces[f],v=this.origin.clone(),u=this.direction.clone(),p=b.matrixWorld,g=p.multiplyVector3(A[j.a].position.clone()),m=p.multiplyVector3(A[j.b].position.clone()),o=p.multiplyVector3(A[j.c].position.clone()),p=j instanceof THREE.Face4?p.multiplyVector3(A[j.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),t=u.dot(n),b.doubleSided||(b.flipSided?t>0:t<0))if(n=n.dot((new THREE.Vector3).sub(g,v))/t,v=v.addSelf(u.multiplyScalar(n)),
|
|
|
+j instanceof THREE.Face3)e(v,g,m,o)&&(j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},y.push(j));else if(j instanceof THREE.Face4&&(e(v,g,m,p)||e(v,m,o,p)))j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},y.push(j);return y}else return[]}};
|
|
|
+THREE.Rectangle=function(){function b(){j=f-c;g=h-e}var c,e,f,h,j,g,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return g};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(g,j,n,t){m=!1;c=g;e=j;f=n;h=t;b()};this.addPoint=function(g,j){m?(m=!1,c=g,e=j,f=g,h=j):(c=c<g?c:g,e=e<j?e:j,f=f>g?f:g,h=h>j?h:j);b()};this.add3Points=
|
|
|
+function(g,j,n,t,v,u){m?(m=!1,c=g<n?g<v?g:v:n<v?n:v,e=j<t?j<u?j:u:t<u?t:u,f=g>n?g>v?g:v:n>v?n:v,h=j>t?j>u?j:u:t>u?t:u):(c=g<n?g<v?g<c?g:c:v<c?v:c:n<v?n<c?n:c:v<c?v:c,e=j<t?j<u?j<e?j:e:u<e?u:e:t<u?t<e?t:e:u<e?u:e,f=g>n?g>v?g>f?g:f:v>f?v:f:n>v?n>f?n:f:v>f?v:f,h=j>t?j>u?j>h?j:h:u>h?u:h:t>u?t>h?t:h:u>h?u:h);b()};this.addRectangle=function(g){m?(m=!1,c=g.getLeft(),e=g.getTop(),f=g.getRight(),h=g.getBottom()):(c=c<g.getLeft()?c:g.getLeft(),e=e<g.getTop()?e:g.getTop(),f=f>g.getRight()?f:g.getRight(),h=h>
|
|
|
+g.getBottom()?h:g.getBottom());b()};this.inflate=function(g){c-=g;e-=g;f+=g;h+=g;b()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();e=e>g.getTop()?e:g.getTop();f=f<g.getRight()?f:g.getRight();h=h<g.getBottom()?h:g.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;h=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
|
|
|
+THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,h,j,g,m,o,p,n,t,v,u,w,A){this.set(b||1,c||0,e||0,f||0,h||0,j||1,g||0,m||0,o||0,p||0,n||1,t||0,v||0,u||0,w||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={set:function(b,c,e,f,h,j,g,m,o,p,n,t,v,u,w,A){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=j;this.n23=g;this.n24=m;this.n31=o;this.n32=p;this.n33=n;this.n34=t;this.n41=v;this.n42=u;this.n43=w;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1,
|
|
|
+h=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());h.cross(j,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=j.x;this.n21=f.y;this.n22=h.y;this.n23=j.y;this.n31=f.z;this.n32=h.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;b.y=(this.n21*c+this.n22*e+this.n23*
|
|
|
+f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
|
|
|
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,j=b.n14,g=b.n21,m=b.n22,o=b.n23,p=b.n24,n=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,A=b.n42,y=b.n43,x=b.n44,I=c.n11,B=c.n12,E=c.n13,G=c.n14,H=c.n21,Q=c.n22,
|
|
|
+F=c.n23,C=c.n24,N=c.n31,W=c.n32,K=c.n33,X=c.n34,L=c.n41,U=c.n42,k=c.n43,Z=c.n44;this.n11=e*I+f*H+h*N+j*L;this.n12=e*B+f*Q+h*W+j*U;this.n13=e*E+f*F+h*K+j*k;this.n14=e*G+f*C+h*X+j*Z;this.n21=g*I+m*H+o*N+p*L;this.n22=g*B+m*Q+o*W+p*U;this.n23=g*E+m*F+o*K+p*k;this.n24=g*G+m*C+o*X+p*Z;this.n31=n*I+t*H+v*N+u*L;this.n32=n*B+t*Q+v*W+u*U;this.n33=n*E+t*F+v*K+u*k;this.n34=n*G+t*C+v*X+u*Z;this.n41=w*I+A*H+y*N+x*L;this.n42=w*B+A*Q+y*W+x*U;this.n43=w*E+A*F+y*K+x*k;this.n44=w*G+A*C+y*X+x*Z;return this},multiplyToArray:function(b,
|
|
|
c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=
|
|
|
-b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,h=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,t=this.n34,u=this.n41,v=this.n42,x=this.n43,w=this.n44;return f*h*p*u-e*m*p*u-f*j*o*u+c*m*o*u+e*j*t*u-c*h*t*u-f*h*n*v+e*m*n*v+f*g*o*v-b*m*o*v-e*g*t*v+b*h*t*v+f*j*n*x-c*m*n*x-f*g*p*x+b*m*p*x+c*g*t*x-b*j*t*x-e*j*n*w+c*h*n*w+e*g*p*w-b*h*p*w-c*g*o*w+b*j*o*w},transpose:function(){var b;b=this.n21;this.n21=
|
|
|
+b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,j=this.n22,g=this.n23,m=this.n24,o=this.n31,p=this.n32,n=this.n33,t=this.n34,v=this.n41,u=this.n42,w=this.n43,A=this.n44;return f*g*p*v-e*m*p*v-f*j*n*v+c*m*n*v+e*j*t*v-c*g*t*v-f*g*o*u+e*m*o*u+f*h*n*u-b*m*n*u-e*h*t*u+b*g*t*u+f*j*o*w-c*m*o*w-f*h*p*w+b*m*p*w+c*h*t*w-b*j*t*w-e*j*o*A+c*g*o*A+e*h*p*A-b*g*p*A-c*h*n*A+b*j*n*A},transpose:function(){var b;b=this.n21;this.n21=
|
|
|
this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=
|
|
|
this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=
|
|
|
this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,
|
|
|
c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,
|
|
|
-c){var e=Math.cos(c),f=Math.sin(c),g=1-e,j=b.x,h=b.y,m=b.z,n=g*j,p=g*h;this.set(n*j+e,n*h-f*m,n*m+f*h,0,n*h+f*m,p*h+e,p*m-f*j,0,n*m-f*h,p*m+f*j,g*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);
|
|
|
-return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var n=h*m,p=h*g,o=f*m,t=f*g;this.n11=n+t*e;this.n12=
|
|
|
-o*e-p;this.n13=j*f;this.n21=j*g;this.n22=j*m;this.n23=-e;this.n31=p*e-o;this.n32=t+n*e;this.n33=j*h;break;case "ZXY":n=h*m;p=h*g;o=f*m;t=f*g;this.n11=n-t*e;this.n12=-j*g;this.n13=o+p*e;this.n21=p+o*e;this.n22=j*m;this.n23=t-n*e;this.n31=-j*f;this.n32=e;this.n33=j*h;break;case "ZYX":n=j*m;p=j*g;o=e*m;t=e*g;this.n11=h*m;this.n12=o*f-p;this.n13=n*f+t;this.n21=h*g;this.n22=t*f+n;this.n23=p*f-o;this.n31=-f;this.n32=e*h;this.n33=j*h;break;case "YZX":n=j*h;p=j*f;o=e*h;t=e*f;this.n11=h*m;this.n12=t-n*g;this.n13=
|
|
|
-o*g+p;this.n21=g;this.n22=j*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+o;this.n33=n-t*g;break;case "XZY":n=j*h;p=j*f;o=e*h;t=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=n*g+t;this.n22=j*m;this.n23=p*g-o;this.n31=o*g-p;this.n32=e*m;this.n33=t*g+n;break;default:n=j*m,p=j*g,o=e*m,t=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=p+o*f,this.n22=n-t*f,this.n23=-e*h,this.n31=t-n*f,this.n32=o+p*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,j=c+c,
|
|
|
-h=e+e,m=f+f,b=c*j,n=c*h;c*=m;var p=e*h;e*=m;f*=m;j*=g;h*=g;g*=m;this.n11=1-(p+f);this.n12=n-g;this.n13=c+h;this.n21=n+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,
|
|
|
-c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
|
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,u=b.n33,v=b.n34,x=b.n41,w=b.n42,y=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*v*w-p*u*w+p*t*y-m*v*y-n*t*C+m*u*C;c.n12=j*u*w-g*v*w-j*t*y+f*v*y+g*t*C-f*u*C;c.n13=g*p*w-j*n*w+j*m*y-f*p*y-g*m*C+f*n*C;c.n14=j*n*t-g*p*t-j*m*u+f*p*u+g*m*v-f*n*v;c.n21=p*u*x-n*v*x-p*o*y+h*v*y+n*o*C-h*u*C;c.n22=g*v*x-j*u*x+j*o*y-e*v*y-g*o*C+e*u*C;c.n23=j*n*x-g*p*x-j*h*y+e*p*y+g*h*C-e*n*C;c.n24=
|
|
|
-g*p*o-j*n*o+j*h*u-e*p*u-g*h*v+e*n*v;c.n31=m*v*x-p*t*x+p*o*w-h*v*w-m*o*C+h*t*C;c.n32=j*t*x-f*v*x-j*o*w+e*v*w+f*o*C-e*t*C;c.n33=g*p*x-j*m*x+j*h*w-e*p*w-f*h*C+e*m*C;c.n34=j*m*o-f*p*o-j*h*t+e*p*t+f*h*v-e*m*v;c.n41=n*t*x-m*u*x-n*o*w+h*u*w+m*o*y-h*t*y;c.n42=f*u*x-g*t*x+g*o*w-e*u*w-f*o*y+e*t*y;c.n43=g*m*x-f*n*x-g*h*w+e*n*w+f*h*y-e*m*y;c.n44=f*n*o-g*m*o+g*h*t-e*n*t-f*h*u+e*m*u;c.multiplyScalar(1/b.determinant());return c};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*h;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*t;return c};
|
|
|
-THREE.Matrix4.makeFrustum=function(b,c,e,f,g,j){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(j+g)/(j-g);h.n34=-2*j*g/(j-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
|
|
|
-THREE.Matrix4.makeOrtho=function(b,c,e,f,g,j){var h,m,n,p;h=new THREE.Matrix4;m=c-b;n=e-f;p=j-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/n;h.n23=0;h.n24=-((e+f)/n);h.n31=0;h.n32=0;h.n33=-2/p;h.n34=-((j+g)/p);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
+c){var e=Math.cos(c),f=Math.sin(c),h=1-e,j=b.x,g=b.y,m=b.z,o=h*j,p=h*g;this.set(o*j+e,o*g-f*m,o*m+f*g,0,o*g+f*m,p*g+e,p*m-f*j,0,o*m-f*g,p*m+f*j,h*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);
|
|
|
+return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,h=b.z,j=Math.cos(e),e=Math.sin(e),g=Math.cos(f),f=Math.sin(f),m=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var o=g*m,p=g*h,n=f*m,t=f*h;this.n11=o+t*e;this.n12=
|
|
|
+n*e-p;this.n13=j*f;this.n21=j*h;this.n22=j*m;this.n23=-e;this.n31=p*e-n;this.n32=t+o*e;this.n33=j*g;break;case "ZXY":o=g*m;p=g*h;n=f*m;t=f*h;this.n11=o-t*e;this.n12=-j*h;this.n13=n+p*e;this.n21=p+n*e;this.n22=j*m;this.n23=t-o*e;this.n31=-j*f;this.n32=e;this.n33=j*g;break;case "ZYX":o=j*m;p=j*h;n=e*m;t=e*h;this.n11=g*m;this.n12=n*f-p;this.n13=o*f+t;this.n21=g*h;this.n22=t*f+o;this.n23=p*f-n;this.n31=-f;this.n32=e*g;this.n33=j*g;break;case "YZX":o=j*g;p=j*f;n=e*g;t=e*f;this.n11=g*m;this.n12=t-o*h;this.n13=
|
|
|
+n*h+p;this.n21=h;this.n22=j*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*h+n;this.n33=o-t*h;break;case "XZY":o=j*g;p=j*f;n=e*g;t=e*f;this.n11=g*m;this.n12=-h;this.n13=f*m;this.n21=o*h+t;this.n22=j*m;this.n23=p*h-n;this.n31=n*h-p;this.n32=e*m;this.n33=t*h+o;break;default:o=j*m,p=j*h,n=e*m,t=e*h,this.n11=g*m,this.n12=-g*h,this.n13=f,this.n21=p+n*f,this.n22=o-t*f,this.n23=-e*g,this.n31=t-o*f,this.n32=n+p*f,this.n33=j*g}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,h=b.w,j=c+c,
|
|
|
+g=e+e,m=f+f,b=c*j,o=c*g;c*=m;var p=e*g;e*=m;f*=m;j*=h;g*=h;h*=m;this.n11=1-(p+f);this.n12=o-h;this.n13=c+g;this.n21=o+h;this.n22=1-(b+f);this.n23=e-j;this.n31=c-g;this.n32=e+j;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,
|
|
|
+c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}};
|
|
|
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,j=b.n14,g=b.n21,m=b.n22,o=b.n23,p=b.n24,n=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,A=b.n42,y=b.n43,x=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*u*A-p*v*A+p*t*y-m*u*y-o*t*x+m*v*x;c.n12=j*v*A-h*u*A-j*t*y+f*u*y+h*t*x-f*v*x;c.n13=h*p*A-j*o*A+j*m*y-f*p*y-h*m*x+f*o*x;c.n14=j*o*t-h*p*t-j*m*v+f*p*v+h*m*u-f*o*u;c.n21=p*v*w-o*u*w-p*n*y+g*u*y+o*n*x-g*v*x;c.n22=h*u*w-j*v*w+j*n*y-e*u*y-h*n*x+e*v*x;c.n23=j*o*w-h*p*w-j*g*y+e*p*y+h*g*x-e*o*x;c.n24=
|
|
|
+h*p*n-j*o*n+j*g*v-e*p*v-h*g*u+e*o*u;c.n31=m*u*w-p*t*w+p*n*A-g*u*A-m*n*x+g*t*x;c.n32=j*t*w-f*u*w-j*n*A+e*u*A+f*n*x-e*t*x;c.n33=h*p*w-j*m*w+j*g*A-e*p*A-f*g*x+e*m*x;c.n34=j*m*n-f*p*n-j*g*t+e*p*t+f*g*u-e*m*u;c.n41=o*t*w-m*v*w-o*n*A+g*v*A+m*n*y-g*t*y;c.n42=f*v*w-h*t*w+h*n*A-e*v*A-f*n*y+e*t*y;c.n43=h*m*w-f*o*w-h*g*A+e*o*A+f*g*y-e*m*y;c.n44=f*o*n-h*m*n+h*g*t-e*o*t-f*g*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,g=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*g+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*j;e[3]=b*g;e[4]=b*m;e[5]=b*o;e[6]=b*p;e[7]=b*n;e[8]=b*t;return c};
|
|
|
+THREE.Matrix4.makeFrustum=function(b,c,e,f,h,j){var g;g=new THREE.Matrix4;g.n11=2*h/(c-b);g.n12=0;g.n13=(c+b)/(c-b);g.n14=0;g.n21=0;g.n22=2*h/(f-e);g.n23=(f+e)/(f-e);g.n24=0;g.n31=0;g.n32=0;g.n33=-(j+h)/(j-h);g.n34=-2*j*h/(j-h);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)};
|
|
|
+THREE.Matrix4.makeOrtho=function(b,c,e,f,h,j){var g,m,o,p;g=new THREE.Matrix4;m=c-b;o=e-f;p=j-h;g.n11=2/m;g.n12=0;g.n13=0;g.n14=-((c+b)/m);g.n21=0;g.n22=2/o;g.n23=0;g.n24=-((e+f)/o);g.n31=0;g.n32=0;g.n33=-2/p;g.n34=-((j+h)/p);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
|
|
|
this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
|
|
|
THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
|
|
|
--1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,g;e=0;for(f=this.children.length;e<f;e++){g=this.children[e];if(g.name===b)return g;if(c&&(g=g.getChildByName(b,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);
|
|
|
+-1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,h;e=0;for(f=this.children.length;e<f;e++){h=this.children[e];if(h.name===b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);
|
|
|
this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
|
|
|
this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
|
-THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),j=Math.cos(e),e=Math.sin(e),h=b*c,m=f*g;this.w=h*j-m*e;this.x=h*e+m*j;this.y=f*c*j+b*g*e;this.z=b*g*j-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
|
|
|
+THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),j=Math.cos(e),e=Math.sin(e),g=b*c,m=f*h;this.w=g*j-m*e;this.x=g*e+m*j;this.y=f*c*j+b*h*e;this.z=b*h*j-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
|
|
|
f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
|
|
|
-multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,j=b.x,h=b.y,m=b.z,b=b.w;this.x=c*b+g*j+e*m-f*h;this.y=e*b+g*h+f*j-c*m;this.z=f*b+g*m+c*h-e*j;this.w=g*b-c*j-e*h-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,j=this.x,h=this.y,m=this.z,n=this.w,p=n*e+h*g-m*f,o=
|
|
|
-n*f+m*e-j*g,t=n*g+j*f-h*e,e=-j*e-h*f-m*g;c.x=p*n+e*-j+o*-m-t*-h;c.y=o*n+e*-h+t*-j-p*-m;c.z=t*n+e*-m+p*-h-o*-j;return c}};
|
|
|
-THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
-THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=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.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
|
|
|
-THREE.Face4=function(b,c,e,f,g,j,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
|
+multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,h=this.w,j=b.x,g=b.y,m=b.z,b=b.w;this.x=c*b+h*j+e*m-f*g;this.y=e*b+h*g+f*j-c*m;this.z=f*b+h*m+c*g-e*j;this.w=h*b-c*j-e*g-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,j=this.x,g=this.y,m=this.z,o=this.w,p=o*e+g*h-m*f,n=
|
|
|
+o*f+m*e-j*h,t=o*h+j*f-g*e,e=-j*e-g*f-m*h;c.x=p*o+e*-j+n*-m-t*-g;c.y=n*o+e*-g+t*-j-p*-m;c.z=t*o+e*-m+p*-g-n*-j;return c}};
|
|
|
+THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*j)/g;f=Math.sin(f*j)/g;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
+THREE.Face3=function(b,c,e,f,h,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
|
|
|
+THREE.Face4=function(b,c,e,f,h,j,g){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
|
THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
|
|
|
-e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,j,h,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],h=this.vertices[j.c],m.sub(h.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
|
|
|
+e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,h,j,g,m=new THREE.Vector3,o=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],g=this.vertices[j.c],m.sub(g.position,e.position),o.sub(c.position,e.position),m.crossSelf(o);m.isZero()||
|
|
|
m.normalize();j.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
|
|
|
this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
|
|
|
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,g,k,j){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=h[g];t=h[k];u=h[j];v=n.x-m.x;x=p.x-m.x;w=n.y-m.y;y=p.y-m.y;C=n.z-m.z;E=p.z-m.z;B=t.u-o.u;I=u.u-o.u;F=t.v-o.v;A=u.v-o.v;P=1/(B*A-I*F);V.set((A*v-F*x)*
|
|
|
-P,(A*w-F*y)*P,(A*C-F*E)*P);J.set((B*x-I*v)*P,(B*y-I*w)*P,(B*E-I*C)*P);G[e].addSelf(V);G[c].addSelf(V);G[f].addSelf(V);U[e].addSelf(J);U[c].addSelf(J);U[f].addSelf(J)}var c,e,f,g,j,h,m,n,p,o,t,u,v,x,w,y,C,E,B,I,F,A,P,H,G=[],U=[],V=new THREE.Vector3,J=new THREE.Vector3,Z=new THREE.Vector3,K=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)G[c]=new THREE.Vector3,U[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],h=this.faceVertexUvs[0][c],j instanceof
|
|
|
-THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var k=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)S.copy(j.vertexNormals[f]),g=j[k[f]],H=G[g],Z.copy(H),Z.subSelf(S.multiplyScalar(S.dot(H))).normalize(),K.cross(j.vertexNormals[f],H),g=K.dot(U[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(Z.x,Z.y,Z.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
|
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,k,j,h){m=b.vertices[e].position;o=b.vertices[c].position;p=b.vertices[f].position;n=g[k];t=g[j];v=g[h];u=o.x-m.x;w=p.x-m.x;A=o.y-m.y;y=p.y-m.y;x=o.z-m.z;I=p.z-m.z;B=t.u-n.u;E=v.u-n.u;G=t.v-n.v;H=v.v-n.v;Q=1/(B*H-E*G);W.set((H*u-G*w)*
|
|
|
+Q,(H*A-G*y)*Q,(H*x-G*I)*Q);K.set((B*w-E*u)*Q,(B*y-E*A)*Q,(B*I-E*x)*Q);C[e].addSelf(W);C[c].addSelf(W);C[f].addSelf(W);N[e].addSelf(K);N[c].addSelf(K);N[f].addSelf(K)}var c,e,f,h,j,g,m,o,p,n,t,v,u,w,A,y,x,I,B,E,G,H,Q,F,C=[],N=[],W=new THREE.Vector3,K=new THREE.Vector3,X=new THREE.Vector3,L=new THREE.Vector3,U=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)C[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],g=this.faceVertexUvs[0][c],j instanceof
|
|
|
+THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var k=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)U.copy(j.vertexNormals[f]),h=j[k[f]],F=C[h],X.copy(F),X.subSelf(U.multiplyScalar(U.dot(F))).normalize(),L.cross(j.vertexNormals[f],F),h=L.dot(N[h]),h=h<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
|
if(this.vertices.length>0){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,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
|
|
|
else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
|
|
|
-void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,j,h,m={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.a,h.c),c(m,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),c(m,g,e),g=b(h.a,h.b),c(m,g,e),g=b(h.a,h.d),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.c,h.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];j=h.vertexIndices[1];
|
|
|
-h.faceIndices=m[b(g,j)].array;for(g=0;g<h.faceIndices.length;g++)j=h.faceIndices[g],h.faces.push(this.faces[j])}}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Spline=function(b){function c(b,e,c,f,h,g,j){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*j+(-3*(e-c)-2*b-f)*g+b*h+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,j,h,m,n,p,o,t,u;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;j=Math.floor(g);h=g-j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>this.points.length-2?j:j+1;e[3]=j>this.points.length-3?j:j+2;p=this.points[e[0]];o=this.points[e[1]];
|
|
|
-t=this.points[e[2]];u=this.points[e[3]];m=h*h;n=h*m;f.x=c(p.x,o.x,t.x,u.x,h,m,n);f.y=c(p.y,o.y,t.y,u.y,h,m,n);f.z=c(p.z,o.z,t.z,u.z,h,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,h=new THREE.Vector3,g=new THREE.Vector3,j=[],m=0;j[0]=0;b||(b=100);c=this.points.length*b;h.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),g.copy(position),
|
|
|
-m+=g.distanceTo(h),h.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(j[e]=m,f=e);j[j.length]=m;return{chunks:j,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,h,g,j,m=[],n=new THREE.Vector3,p=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=p.chunks[e]-p.chunks[e-1];j=Math.ceil(b*c/p.total);h=(e-1)/(this.points.length-1);g=e/(this.points.length-1);for(c=1;c<j-1;c++)f=h+c*(1/j)*(g-h),position=this.getPoint(f),m.push(n.copy(position).clone());
|
|
|
-m.push(n.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
|
|
|
+void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,j,g,m={};e=0;for(f=this.faces.length;e<f;e++)g=this.faces[e],g instanceof THREE.Face3?(h=b(g.a,g.b),c(m,h,e),h=b(g.b,g.c),c(m,h,e),h=b(g.a,g.c),c(m,h,e)):g instanceof THREE.Face4&&(h=b(g.b,g.d),c(m,h,e),h=b(g.a,g.b),c(m,h,e),h=b(g.a,g.d),c(m,h,e),h=b(g.b,g.c),c(m,h,e),h=b(g.c,g.d),c(m,h,e));e=0;for(f=this.edges.length;e<f;e++){g=this.edges[e];h=g.vertexIndices[0];j=g.vertexIndices[1];
|
|
|
+g.faceIndices=m[b(h,j)].array;for(h=0;h<g.faceIndices.length;h++)j=g.faceIndices[h],g.faces.push(this.faces[j])}}};THREE.GeometryIdCounter=0;
|
|
|
+THREE.Spline=function(b){function c(b,e,c,f,g,j,h){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*h+(-3*(e-c)-2*b-f)*j+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},h,j,g,m,o,p,n,t,v;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;j=Math.floor(h);g=h-j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>this.points.length-2?j:j+1;e[3]=j>this.points.length-3?j:j+2;p=this.points[e[0]];n=this.points[e[1]];
|
|
|
+t=this.points[e[2]];v=this.points[e[3]];m=g*g;o=g*m;f.x=c(p.x,n.x,t.x,v.x,g,m,o);f.y=c(p.y,n.y,t.y,v.y,g,m,o);f.z=c(p.z,n.z,t.z,v.z,g,m,o);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,j=new THREE.Vector3,h=[],m=0;h[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),j.copy(position),
|
|
|
+m+=j.distanceTo(g),g.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(h[e]=m,f=e);h[h.length]=m;return{chunks:h,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,g,j,h,m=[],o=new THREE.Vector3,p=this.getLength();m.push(o.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=p.chunks[e]-p.chunks[e-1];h=Math.ceil(b*c/p.total);g=(e-1)/(this.points.length-1);j=e/(this.points.length-1);for(c=1;c<h-1;c++)f=g+c*(1/h)*(j-g),position=this.getPoint(f),m.push(o.copy(position).clone());
|
|
|
+m.push(o.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,h){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
|
|
|
THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
|
|
|
THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
-THREE.Camera.prototype.setViewOffset=function(b,c,e,f,g,j){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=j;this.updateProjectionMatrix()};
|
|
|
+THREE.Camera.prototype.setViewOffset=function(b,c,e,f,h,j){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=h;this.height=j;this.updateProjectionMatrix()};
|
|
|
THREE.Camera.prototype.update=function(b,c,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
|
|
|
!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
|
THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=e||0};
|
|
|
THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(b,c,e,f){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=void 0;b!==void 0&&this.add(b,c,e,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.LensFlare.prototype.add=function(b,c,e,f){c===void 0&&(c=-1);e===void 0&&(e=0);if(f===void 0)f=THREE.BillboardBlending;e=Math.min(e,Math.max(0,e));this.lensFlares.push({texture:b,size:c,distance:e,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:f})};
|
|
|
-THREE.LensFlare.prototype.updateLensFlares=function(){var b,c=this.lensFlares.length,e,f=-this.positionScreen.x*2,g=-this.positionScreen.y*2;for(b=0;b<c;b++)e=this.lensFlares[b],e.x=this.positionScreen.x+f*e.distance,e.y=this.positionScreen.y+g*e.distance,e.wantedRotation=e.x*Math.PI*0.25,e.rotation+=(e.wantedRotation-e.rotation)*0.25};
|
|
|
+THREE.LensFlare.prototype.updateLensFlares=function(){var b,c=this.lensFlares.length,e,f=-this.positionScreen.x*2,h=-this.positionScreen.y*2;for(b=0;b<c;b++)e=this.lensFlares[b],e.x=this.positionScreen.x+f*e.distance,e.y=this.positionScreen.y+h*e.distance,e.wantedRotation=e.x*Math.PI*0.25,e.rotation+=(e.wantedRotation-e.rotation)*0.25};
|
|
|
THREE.Material=function(b){this.id=THREE.MaterialCounter.value++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:
|
|
|
0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
|
|
|
THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;
|
|
@@ -103,7 +103,7 @@ void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wiref
|
|
|
THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
|
|
|
THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
|
|
|
THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
|
|
|
-THREE.Texture=function(b,c,e,f,g,j){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=j!==void 0?j:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
|
+THREE.Texture=function(b,c,e,f,h,j){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=j!==void 0?j:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
|
THREE.Texture.prototype={clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;
|
|
|
THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
|
|
|
THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
|
|
@@ -111,25 +111,25 @@ THREE.Line.prototype.constructor=THREE.Line;
|
|
|
THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
|
|
|
e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
|
|
|
THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
|
|
|
+THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
|
|
|
c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
|
|
|
-THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,g,j,h,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],j=g.pos,h=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(j[0],j[1],j[2]),f.quaternion.set(h[0],h[1],h[2],h[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)g=this.geometry.bones[e],
|
|
|
-f=this.bones[e],g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
-THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
|
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,h,j,g,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)h=this.geometry.bones[e],j=h.pos,g=h.rotq,m=h.scl,f=this.addBone(),f.name=h.name,f.position.set(j[0],j[1],j[2]),f.quaternion.set(g[0],g[1],g[2],g[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)h=this.geometry.bones[e],
|
|
|
+f=this.bones[e],h.parent===-1?this.addChild(f):this.bones[h.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
+THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
|
c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
|
|
|
-THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,g=this.geometry.skinIndices[b].x,j=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
|
|
|
-e.y,e.z);this.geometry.skinVerticesA.push(c[g].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[j].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,j=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
|
|
|
+e.y,e.z);this.geometry.skinVerticesA.push(c[h].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[j].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
|
|
|
THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),e=0;e<this.LODs.length;e++)if(c<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
|
|
|
THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
|
|
|
this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
|
|
|
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,j,h,m,n,p,o,t,u,v,x=new THREE.Geometry;x.vertices=this.geometry.vertices;f=x.faces=this.geometry.faces;var w=x.egdes=this.geometry.edges,y=x.edgeFaces=[];g=0;var C=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],C.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
|
|
|
-e.normal;b=0;for(c=w.length;b<c;b++)m=w[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],j=m.faceIndices[1],h=m.vertexIndices[0],m=m.vertexIndices[1],e.a===h?(n="a",o=C[g]+0):e.b===h?(n="b",o=C[g]+1):e.c===h?(n="c",o=C[g]+2):e.d===h&&(n="d",o=C[g]+3),e.a===m?(n+="a",t=C[g]+0):e.b===m?(n+="b",t=C[g]+1):e.c===m?(n+="c",t=C[g]+2):e.d===m&&(n+="d",t=C[g]+3),f.a===h?(p="a",u=C[j]+0):f.b===h?(p="b",u=C[j]+1):f.c===h?(p="c",u=C[j]+2):f.d===h&&(p="d",u=C[j]+3),f.a===m?(p+="a",v=C[j]+0):f.b===m?(p+="b",v=C[j]+
|
|
|
-1):f.c===m?(p+="c",v=C[j]+2):f.d===m&&(p+="d",v=C[j]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?o>t&&(e=o,o=t,t=e):o<t&&(e=o,o=t,t=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?u>v&&(e=u,u=v,v=e):u<v&&(e=u,u=v,v=e),e=new THREE.Face4(o,t,u,v),e.normal.set(1,0,0),y.push(e);this.geometry=x}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,j=g.length,h,m,n,p,o,t=["a","b","c","d"];for(n=0;n<j;n++){m=c.length;h=g[n];h instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(h.normal);e.push(m);
|
|
|
-for(m=0;m<p;m++)o=b[h[t[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(j=0;j<g.length-1;j++){b=e[j];for(h=j+1;h<g.length;h++)m=e[h],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
|
|
|
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,j,h,m,n,p,o,t,u,v,x,w,y=0,C=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(x=0;x<f;x++){j=c[C[x]];m=b[j];for(w=0;w<g;w++)if(h=e[C[w]],n=b[h],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(y++,y===1&&(p=m,o=n,t=j,u=h,v=C[x]),y===2))return v+=C[x],v==="ad"||v==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[t,u,
|
|
|
-h,j],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[t,j,h,u],vertexTypes:[1,1,2,2],extrudable:!0}}};
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,h,j,g,m,o,p,n,t,v,u,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var A=w.egdes=this.geometry.edges,y=w.edgeFaces=[];h=0;var x=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],x.push(h),h+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
|
|
|
+e.normal;b=0;for(c=A.length;b<c;b++)m=A[b],e=m.faces[0],f=m.faces[1],h=m.faceIndices[0],j=m.faceIndices[1],g=m.vertexIndices[0],m=m.vertexIndices[1],e.a===g?(o="a",n=x[h]+0):e.b===g?(o="b",n=x[h]+1):e.c===g?(o="c",n=x[h]+2):e.d===g&&(o="d",n=x[h]+3),e.a===m?(o+="a",t=x[h]+0):e.b===m?(o+="b",t=x[h]+1):e.c===m?(o+="c",t=x[h]+2):e.d===m&&(o+="d",t=x[h]+3),f.a===g?(p="a",v=x[j]+0):f.b===g?(p="b",v=x[j]+1):f.c===g?(p="c",v=x[j]+2):f.d===g&&(p="d",v=x[j]+3),f.a===m?(p+="a",u=x[j]+0):f.b===m?(p+="b",u=x[j]+
|
|
|
+1):f.c===m?(p+="c",u=x[j]+2):f.d===m&&(p+="d",u=x[j]+3),o==="ac"||o==="ad"||o==="ca"||o==="da"?n>t&&(e=n,n=t,t=e):n<t&&(e=n,n=t,t=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(n,t,v,u),e.normal.set(1,0,0),y.push(e);this.geometry=w}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,h=b.faces,b=b.vertices,j=h.length,g,m,o,p,n,t=["a","b","c","d"];for(o=0;o<j;o++){m=c.length;g=h[o];g instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(g.normal);e.push(m);
|
|
|
+for(m=0;m<p;m++)n=b[g[t[m]]],c.push(new THREE.Vertex(n.position.clone()))}for(j=0;j<h.length-1;j++){b=e[j];for(g=j+1;g<h.length;g++)m=e[g],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
|
|
|
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,h,j,g,m,o,p,n,t,v,u,w,A,y=0,x=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){j=c[x[w]];m=b[j];for(A=0;A<h;A++)if(g=e[x[A]],o=b[g],Math.abs(m.position.x-o.position.x)<1.0E-4&&Math.abs(m.position.y-o.position.y)<1.0E-4&&Math.abs(m.position.z-o.position.z)<1.0E-4&&(y++,y===1&&(p=m,n=o,t=j,v=g,u=x[w]),y===2))return u+=x[w],u==="ad"||u==="ac"?{faces:[c,e],vertices:[p,n,o,m],indices:[t,v,
|
|
|
+g,j],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,o,n],indices:[t,j,g,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
|
|
|
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
|
|
|
this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
|
|
|
THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
|
|
@@ -138,56 +138,56 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
|
|
|
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
|
|
|
THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
|
|
|
THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
|
|
|
-THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,h=b.z+b.w,g=e.z+e.w,j=-b.z+b.w,m=-e.z+e.w;return h>=0&&g>=0&&j>=0&&m>=0?!0:h<0&&g<0||j<0&&m<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),j<0?c=Math.max(c,j/(j-m)):m<0&&(f=Math.min(f,j/(j-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,j=[],h,m,n=[],p,o,t=[],u,v=[],x,w,y=[],C,E,B=[],I=new THREE.Vector4,F=new THREE.Vector4,
|
|
|
-A=new THREE.Matrix4,P=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(b,e){A.multiply(e.projectionMatrix,e.matrixWorldInverse);A.multiplyVector3(b);return b};this.unprojectVector=function(b,e){A.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));A.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],m,n,k;g=0;n=
|
|
|
-b.objects;b=0;for(m=n.length;b<m;b++){k=n[b];var p;if(!(p=!k.visible))if(p=k instanceof THREE.Mesh){a:{p=void 0;for(var o=k.matrixWorld,t=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),u=0;u<6;u++)if(p=H[u].x*o.n14+H[u].y*o.n24+H[u].z*o.n34+H[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=j[g]=j[g]||new THREE.RenderableObject,g++,f=p,I.copy(k.position),A.multiplyVector3(I),f.object=k,f.z=I.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,j){var I=[],
|
|
|
-S=g.near,k=g.far,W,O,ga,fa,X,ea,ha,ka,pa,R,ia,aa,ma,ca,T,Y,na;E=w=u=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);A.multiply(g.projectionMatrix,g.matrixWorldInverse);H[0].set(A.n41-A.n11,A.n42-A.n12,A.n43-A.n13,A.n44-A.n14);H[1].set(A.n41+A.n11,A.n42+A.n12,A.n43+A.n13,A.n44+A.n14);H[2].set(A.n41+A.n21,A.n42+A.n22,A.n43+A.n23,A.n44+A.n24);H[3].set(A.n41-A.n21,A.n42-A.n22,A.n43-A.n23,A.n44-A.n24);H[4].set(A.n41-A.n31,A.n42-A.n32,A.n43-A.n33,A.n44-A.n34);H[5].set(A.n41+A.n31,A.n42+
|
|
|
-A.n32,A.n43+A.n33,A.n44+A.n34);for(W=0;W<6;W++)pa=H[W],pa.divideScalar(Math.sqrt(pa.x*pa.x+pa.y*pa.y+pa.z*pa.z));pa=this.projectObjects(f,g,!0);f=0;for(W=pa.length;f<W;f++)if(R=pa[f].object,R.visible)if(ia=R.matrixWorld,aa=R.matrixRotationWorld,ma=R.materials,ca=R.overdraw,m=0,R instanceof THREE.Mesh){T=R.geometry;fa=T.vertices;Y=T.faces;T=T.faceVertexUvs;O=0;for(ga=fa.length;O<ga;O++)h=b(),h.positionWorld.copy(fa[O].position),ia.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
|
|
|
-A.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>S&&h.positionScreen.z<k;fa=0;for(O=Y.length;fa<O;fa++){ga=Y[fa];if(ga instanceof THREE.Face3)if(X=n[ga.a],ea=n[ga.b],ha=n[ga.c],X.visible&&ea.visible&&ha.visible&&(R.doubleSided||R.flipSided!=(ha.positionScreen.x-X.positionScreen.x)*(ea.positionScreen.y-X.positionScreen.y)-(ha.positionScreen.y-X.positionScreen.y)*(ea.positionScreen.x-X.positionScreen.x)<0))ka=
|
|
|
-t[o]=t[o]||new THREE.RenderableFace3,o++,p=ka,p.v1.copy(X),p.v2.copy(ea),p.v3.copy(ha);else continue;else if(ga instanceof THREE.Face4)if(X=n[ga.a],ea=n[ga.b],ha=n[ga.c],ka=n[ga.d],X.visible&&ea.visible&&ha.visible&&ka.visible&&(R.doubleSided||R.flipSided!=((ka.positionScreen.x-X.positionScreen.x)*(ea.positionScreen.y-X.positionScreen.y)-(ka.positionScreen.y-X.positionScreen.y)*(ea.positionScreen.x-X.positionScreen.x)<0||(ea.positionScreen.x-ha.positionScreen.x)*(ka.positionScreen.y-ha.positionScreen.y)-
|
|
|
-(ea.positionScreen.y-ha.positionScreen.y)*(ka.positionScreen.x-ha.positionScreen.x)<0)))na=v[u]=v[u]||new THREE.RenderableFace4,u++,p=na,p.v1.copy(X),p.v2.copy(ea),p.v3.copy(ha),p.v4.copy(ka);else continue;p.normalWorld.copy(ga.normal);aa.multiplyVector3(p.normalWorld);p.centroidWorld.copy(ga.centroid);ia.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);A.multiplyVector3(p.centroidScreen);ha=ga.vertexNormals;X=0;for(ea=ha.length;X<ea;X++)ka=p.vertexNormalsWorld[X],ka.copy(ha[X]),
|
|
|
-aa.multiplyVector3(ka);X=0;for(ea=T.length;X<ea;X++)if(na=T[X][fa]){ha=0;for(ka=na.length;ha<ka;ha++)p.uvs[X][ha]=na[ha]}p.meshMaterials=ma;p.faceMaterials=ga.materials;p.overdraw=ca;p.z=p.centroidScreen.z;I.push(p)}}else if(R instanceof THREE.Line){P.multiply(A,ia);fa=R.geometry.vertices;X=b();X.positionScreen.copy(fa[0].position);P.multiplyVector4(X.positionScreen);O=1;for(ga=fa.length;O<ga;O++)if(X=b(),X.positionScreen.copy(fa[O].position),P.multiplyVector4(X.positionScreen),ea=n[m-2],G.copy(X.positionScreen),
|
|
|
-U.copy(ea.positionScreen),e(G,U))G.multiplyScalar(1/G.w),U.multiplyScalar(1/U.w),ia=y[w]=y[w]||new THREE.RenderableLine,w++,x=ia,x.v1.positionScreen.copy(G),x.v2.positionScreen.copy(U),x.z=Math.max(G.z,U.z),x.materials=R.materials,I.push(x)}else if(R instanceof THREE.Particle&&(F.set(R.matrixWorld.n14,R.matrixWorld.n24,R.matrixWorld.n34,1),A.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))ia=B[E]=B[E]||new THREE.RenderableParticle,E++,C=ia,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=R.rotation.z,C.scale.x=
|
|
|
-R.scale.x*Math.abs(C.x-(F.x+g.projectionMatrix.n11)/(F.w+g.projectionMatrix.n14)),C.scale.y=R.scale.y*Math.abs(C.y-(F.y+g.projectionMatrix.n22)/(F.w+g.projectionMatrix.n24)),C.materials=R.materials,I.push(C);j&&I.sort(c);return I}};
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var n,p,o,t,u,v,x,w;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(u=b[n],u instanceof THREE.RenderableParticle){x=u.x*g+g;w=u.y*j+j;o=0;for(t=u.material.length;o<t;o++)if(v=u.material[o],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=x+"px",v.style.top=w+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(C!=b)x.globalAlpha=C=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}E=b}}function f(b){if(B!=b.hex)B=b.hex,x.strokeStyle="#"+j(B.toString(16))}function g(b){if(I!=b.hex)I=b.hex,x.fillStyle="#"+j(I.toString(16))}function j(b){for(;b.length<6;)b="0"+b;return b}
|
|
|
-var h=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,t,u,v,x=p.getContext("2d"),w=new THREE.Color(0),y=0,C=1,E=0,B=null,I=null,F=null,A=null,P=null,H,G,U,V,J=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,K,S,k,W,O,ga,fa,X,ea,ha,ka,pa,R=new THREE.Color(0),ia=new THREE.Color(0),aa=new THREE.Color(0),ma=new THREE.Color(0),ca=new THREE.Color(0),T,Y,na,la,oa,wa,Aa,va,ya,Ma,sa=new THREE.Rectangle,ra=new THREE.Rectangle,qa=new THREE.Rectangle,
|
|
|
-Ba=!1,da=new THREE.Color,M=new THREE.Color,ua=new THREE.Color,Q=new THREE.Color,ja=new THREE.Vector3,$,Pa,Va,xa,Qa,Ra,b=16;$=document.createElement("canvas");$.width=$.height=2;Pa=$.getContext("2d");Pa.fillStyle="rgba(0,0,0,1)";Pa.fillRect(0,0,2,2);Va=Pa.getImageData(0,0,2,2);xa=Va.data;Qa=document.createElement("canvas");Qa.width=Qa.height=b;Ra=Qa.getContext("2d");Ra.translate(-b/2,-b/2);Ra.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
|
|
|
-faces:0};this.setSize=function(b,e){o=b;t=e;u=o/2;v=t/2;p.width=o;p.height=t;sa.set(-u,-v,u,v);ra.set(-u,-v,u,v);C=1;E=0;P=A=F=I=B=null};this.setClearColor=function(b,e){w=b;y=e;ra.set(-u,-v,u,v)};this.setClearColorHex=function(b,e){w.setHex(b);y=e;ra.set(-u,-v,u,v)};this.clear=function(){x.setTransform(1,0,0,-1,u,v);if(!ra.isEmpty())ra.inflate(1),ra.minSelf(sa),y==0?x.clearRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight()):(e(THREE.NormalBlending),c(1),I="rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*
|
|
|
-255)+","+Math.floor(w.b*255)+","+y+")",x.fillStyle=I,x.fillRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight())),ra.empty()};this.render=function(b,j){function p(b){var e,c,f,h=b.lights;M.setRGB(0,0,0);ua.setRGB(0,0,0);Q.setRGB(0,0,0);b=0;for(e=h.length;b<e;b++)c=h[b],f=c.color,c instanceof THREE.AmbientLight?(M.r+=f.r,M.g+=f.g,M.b+=f.b):c instanceof THREE.DirectionalLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.PointLight&&(Q.r+=f.r,Q.g+=f.g,Q.b+=f.b)}function o(b,e,c,f){var h,g,j,k,
|
|
|
-m=b.lights,b=0;for(h=m.length;b<h;b++)g=m[b],j=g.color,g instanceof THREE.DirectionalLight?(k=c.dot(g.position),k<=0||(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)):g instanceof THREE.PointLight&&(k=c.dot(ja.sub(g.position,e).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(e.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)))}function t(b,h,j){c(j.opacity);e(j.blending);var k,m,n,p,o,$;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)p=j.map.image,
|
|
|
-o=p.width>>1,$=p.height>>1,j=h.scale.x*u,n=h.scale.y*v,k=j*o,m=n*$,qa.set(b.x-k,b.y-m,b.x+k,b.y+m),sa.instersects(qa)&&(x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(j,-n),x.translate(-o,-$),x.drawImage(p,0,0),x.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*u,m=h.scale.y*v,qa.set(b.x-k,b.y-m,b.x+k,b.y+m),sa.instersects(qa)&&(f(j.color),g(j.color),x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(k,m),j.program(x),x.restore()))}function C(b,h,g,j){c(j.opacity);
|
|
|
-e(j.blending);x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(h.positionScreen.x,h.positionScreen.y);x.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(F!=b)x.lineWidth=F=b;b=j.linecap;if(A!=b)x.lineCap=A=b;b=j.linejoin;if(P!=b)x.lineJoin=P=b;f(j.color);x.stroke();qa.inflate(j.linewidth*2)}}function w(b,f,g,m,n,p,$,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);K=b.positionScreen.x;S=b.positionScreen.y;k=f.positionScreen.x;W=f.positionScreen.y;
|
|
|
-O=g.positionScreen.x;ga=g.positionScreen.y;B(K,S,k,W,O,ga);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(la=$.uvs[0],Ca(K,S,k,W,O,ga,t.map.image,la[m].u,la[m].v,la[n].u,la[n].v,la[p].u,la[p].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=j.matrixWorldInverse,ja.copy($.vertexNormalsWorld[0]),oa=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,wa=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,ja.copy($.vertexNormalsWorld[1]),
|
|
|
-Aa=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,va=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,ja.copy($.vertexNormalsWorld[2]),ya=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,Ma=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,Ca(K,S,k,W,O,ga,t.envMap.image,oa,wa,Aa,va,ya,Ma)}else t.wireframe?I(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(la=$.uvs[0],Ca(K,S,k,
|
|
|
-W,O,ga,t.map.image,la[m].u,la[m].v,la[n].u,la[n].v,la[p].u,la[p].v)),e(THREE.SubtractiveBlending)),Ba?!t.wireframe&&t.shading==THREE.SmoothShading&&$.vertexNormalsWorld.length==3?(ia.r=aa.r=ma.r=M.r,ia.g=aa.g=ma.g=M.g,ia.b=aa.b=ma.b=M.b,o(u,$.v1.positionWorld,$.vertexNormalsWorld[0],ia),o(u,$.v2.positionWorld,$.vertexNormalsWorld[1],aa),o(u,$.v3.positionWorld,$.vertexNormalsWorld[2],ma),ca.r=(aa.r+ma.r)*0.5,ca.g=(aa.g+ma.g)*0.5,ca.b=(aa.b+ma.b)*0.5,na=Sa(ia,aa,ma,ca),Ca(K,S,k,W,O,ga,na,0,0,1,0,0,
|
|
|
-1)):(da.r=M.r,da.g=M.g,da.b=M.b,o(u,$.centroidWorld,$.normalWorld,da),R.r=Math.max(0,Math.min(t.color.r*da.r,1)),R.g=Math.max(0,Math.min(t.color.g*da.g,1)),R.b=Math.max(0,Math.min(t.color.b*da.b,1)),R.updateHex(),t.wireframe?I(R,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(R)):t.wireframe?I(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshDepthMaterial)T=j.near,Y=j.far,ia.r=ia.g=ia.b=1-Ia(b.positionScreen.z,T,Y),aa.r=
|
|
|
-aa.g=aa.b=1-Ia(f.positionScreen.z,T,Y),ma.r=ma.g=ma.b=1-Ia(g.positionScreen.z,T,Y),ca.r=(aa.r+ma.r)*0.5,ca.g=(aa.g+ma.g)*0.5,ca.b=(aa.b+ma.b)*0.5,na=Sa(ia,aa,ma,ca),Ca(K,S,k,W,O,ga,na,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)R.r=Na($.normalWorld.x),R.g=Na($.normalWorld.y),R.b=Na($.normalWorld.z),R.updateHex(),t.wireframe?I(R,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(R)}function y(b,f,g,m,n,p,t,$,u){h.data.vertices+=4;h.data.faces++;c($.opacity);e($.blending);
|
|
|
-if($.map||$.envMap)w(b,f,m,0,1,3,t,$,u),w(n,g,p,1,2,3,t,$,u);else if(K=b.positionScreen.x,S=b.positionScreen.y,k=f.positionScreen.x,W=f.positionScreen.y,O=g.positionScreen.x,ga=g.positionScreen.y,fa=m.positionScreen.x,X=m.positionScreen.y,ea=n.positionScreen.x,ha=n.positionScreen.y,ka=p.positionScreen.x,pa=p.positionScreen.y,$ instanceof THREE.MeshBasicMaterial)E(K,S,k,W,O,ga,fa,X),$.wireframe?I($.color,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):Ea($.color);else if($ instanceof THREE.MeshLambertMaterial)Ba?
|
|
|
-!$.wireframe&&$.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(ia.r=aa.r=ma.r=ca.r=M.r,ia.g=aa.g=ma.g=ca.g=M.g,ia.b=aa.b=ma.b=ca.b=M.b,o(u,t.v1.positionWorld,t.vertexNormalsWorld[0],ia),o(u,t.v2.positionWorld,t.vertexNormalsWorld[1],aa),o(u,t.v4.positionWorld,t.vertexNormalsWorld[3],ma),o(u,t.v3.positionWorld,t.vertexNormalsWorld[2],ca),na=Sa(ia,aa,ma,ca),B(K,S,k,W,fa,X),Ca(K,S,k,W,fa,X,na,0,0,1,0,0,1),B(ea,ha,O,ga,ka,pa),Ca(ea,ha,O,ga,ka,pa,na,1,0,1,1,0,1)):(da.r=M.r,da.g=M.g,da.b=
|
|
|
-M.b,o(u,t.centroidWorld,t.normalWorld,da),R.r=Math.max(0,Math.min($.color.r*da.r,1)),R.g=Math.max(0,Math.min($.color.g*da.g,1)),R.b=Math.max(0,Math.min($.color.b*da.b,1)),R.updateHex(),E(K,S,k,W,O,ga,fa,X),$.wireframe?I(R,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):Ea(R)):(E(K,S,k,W,O,ga,fa,X),$.wireframe?I($.color,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):Ea($.color));else if($ instanceof THREE.MeshNormalMaterial)R.r=Na(t.normalWorld.x),R.g=Na(t.normalWorld.y),
|
|
|
-R.b=Na(t.normalWorld.z),R.updateHex(),E(K,S,k,W,O,ga,fa,X),$.wireframe?I(R,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):Ea(R);else if($ instanceof THREE.MeshDepthMaterial)T=j.near,Y=j.far,ia.r=ia.g=ia.b=1-Ia(b.positionScreen.z,T,Y),aa.r=aa.g=aa.b=1-Ia(f.positionScreen.z,T,Y),ma.r=ma.g=ma.b=1-Ia(m.positionScreen.z,T,Y),ca.r=ca.g=ca.b=1-Ia(g.positionScreen.z,T,Y),na=Sa(ia,aa,ma,ca),B(K,S,k,W,fa,X),Ca(K,S,k,W,fa,X,na,0,0,1,0,0,1),B(ea,ha,O,ga,ka,pa),Ca(ea,ha,O,ga,ka,pa,na,1,0,1,1,0,1)}
|
|
|
-function B(b,e,c,f,h,g){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(h,g);x.lineTo(b,e);x.closePath()}function E(b,e,c,f,h,g,j,k){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(h,g);x.lineTo(j,k);x.lineTo(b,e);x.closePath()}function I(b,e,c,h){if(F!=e)x.lineWidth=F=e;if(A!=c)x.lineCap=A=c;if(P!=h)x.lineJoin=P=h;f(b);x.stroke();qa.inflate(e*2)}function Ea(b){g(b);x.fill()}function Ca(b,e,c,f,h,g,j,k,m,n,p,$,t){var o,u;o=j.width-1;u=j.height-1;k*=o;m*=u;n*=o;p*=u;$*=o;t*=u;c-=b;f-=e;h-=b;
|
|
|
-g-=e;n-=k;p-=m;$-=k;t-=m;o=n*t-$*p;if(!((o<0?-o:o)<1))u=1/o,o=(t*c-p*h)*u,p=(t*f-p*g)*u,c=(n*h-$*c)*u,f=(n*g-$*f)*u,b=b-o*k-c*m,e=e-p*k-f*m,x.save(),x.transform(o,p,c,f,b,e),x.clip(),x.drawImage(j,0,0),x.restore()}function Sa(b,e,c,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);xa[0]=h<0?0:h>255?255:h;xa[1]=g<0?0:g>255?255:g;xa[2]=b<0?0:b>255?255:b;xa[4]=j<0?0:j>255?255:
|
|
|
-j;xa[5]=k<0?0:k>255?255:k;xa[6]=e<0?0:e>255?255:e;xa[8]=m<0?0:m>255?255:m;xa[9]=n<0?0:n>255?255:n;xa[10]=c<0?0:c>255?255:c;xa[12]=p<0?0:p>255?255:p;xa[13]=t<0?0:t>255?255:t;xa[14]=f<0?0:f>255?255:f;Pa.putImageData(Va,0,0);Ra.drawImage($,0,0);return Qa}function Ia(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Fa(b,e){var c=e.x-b.x,f=e.y-b.y,h=c*c+f*f;h!=0&&(h=1/Math.sqrt(h),c*=h,f*=h,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ta,D,L,z,Ga,Oa,Ua,ta;this.autoClear?
|
|
|
-this.clear():x.setTransform(1,0,0,-1,u,v);h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,j,this.sortElements);(Ba=b.lights.length>0)&&p(b);Ta=0;for(D=m.length;Ta<D;Ta++){L=m[Ta];qa.empty();if(L instanceof THREE.RenderableParticle){H=L;H.x*=u;H.y*=v;z=0;for(Ga=L.materials.length;z<Ga;)ta=L.materials[z++],ta.opacity!=0&&t(H,L,ta,b)}else if(L instanceof THREE.RenderableLine){if(H=L.v1,G=L.v2,H.positionScreen.x*=u,H.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=v,qa.addPoint(H.positionScreen.x,
|
|
|
-H.positionScreen.y),qa.addPoint(G.positionScreen.x,G.positionScreen.y),sa.instersects(qa)){z=0;for(Ga=L.materials.length;z<Ga;)ta=L.materials[z++],ta.opacity!=0&&C(H,G,L,ta,b)}}else if(L instanceof THREE.RenderableFace3){if(H=L.v1,G=L.v2,U=L.v3,H.positionScreen.x*=u,H.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,L.overdraw&&(Fa(H.positionScreen,G.positionScreen),Fa(G.positionScreen,U.positionScreen),Fa(U.positionScreen,H.positionScreen)),
|
|
|
-qa.add3Points(H.positionScreen.x,H.positionScreen.y,G.positionScreen.x,G.positionScreen.y,U.positionScreen.x,U.positionScreen.y),sa.instersects(qa)){z=0;for(Ga=L.meshMaterials.length;z<Ga;)if(ta=L.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=L.faceMaterials.length;Oa<Ua;)(ta=L.faceMaterials[Oa++])&&ta.opacity!=0&&w(H,G,U,0,1,2,L,ta,b)}else ta.opacity!=0&&w(H,G,U,0,1,2,L,ta,b)}}else if(L instanceof THREE.RenderableFace4&&(H=L.v1,G=L.v2,U=L.v3,V=L.v4,H.positionScreen.x*=u,H.positionScreen.y*=
|
|
|
-v,G.positionScreen.x*=u,G.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,V.positionScreen.x*=u,V.positionScreen.y*=v,J.positionScreen.copy(G.positionScreen),Z.positionScreen.copy(V.positionScreen),L.overdraw&&(Fa(H.positionScreen,G.positionScreen),Fa(G.positionScreen,V.positionScreen),Fa(V.positionScreen,H.positionScreen),Fa(U.positionScreen,J.positionScreen),Fa(U.positionScreen,Z.positionScreen)),qa.addPoint(H.positionScreen.x,H.positionScreen.y),qa.addPoint(G.positionScreen.x,G.positionScreen.y),
|
|
|
-qa.addPoint(U.positionScreen.x,U.positionScreen.y),qa.addPoint(V.positionScreen.x,V.positionScreen.y),sa.instersects(qa))){z=0;for(Ga=L.meshMaterials.length;z<Ga;)if(ta=L.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=L.faceMaterials.length;Oa<Ua;)(ta=L.faceMaterials[Oa++])&&ta.opacity!=0&&y(H,G,U,V,J,Z,L,ta,b)}else ta.opacity!=0&&y(H,G,U,V,J,Z,L,ta,b)}ra.addRectangle(qa)}x.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function b(b,e,c){var f,h,g,j;f=0;for(h=b.lights.length;f<h;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(j=e.normalWorld.dot(g.position)*g.intensity,j>0&&(c.r+=g.color.r*j,c.g+=g.color.g*j,c.b+=g.color.b*j)):g instanceof THREE.PointLight&&(V.sub(g.position,e.centroidWorld),V.normalize(),j=e.normalWorld.dot(V)*g.intensity,j>0&&(c.r+=g.color.r*j,c.g+=g.color.g*j,c.b+=g.color.b*j))}function c(e,c,k,m,n,t){h.data.vertices+=3;h.data.faces++;K=f(S++);K.setAttribute("d",
|
|
|
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?I?(A.r=P.r,A.g=P.g,A.b=P.b,b(t,m,A),F.r=Math.max(0,Math.min(n.color.r*A.r,1)),F.g=Math.max(0,Math.min(n.color.g*A.g,1)),F.b=Math.max(0,Math.min(n.color.b*A.b,1)),F.updateHex()):F.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(U=1-n.__2near/(n.__farPlusNear-
|
|
|
-m.z*n.__farMinusNear),F.setRGB(U,U,U)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?K.setAttribute("style","fill: none; stroke: #"+j(F.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):K.setAttribute("style","fill: #"+j(F.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(K)}function e(e,c,k,m,
|
|
|
-n,t,o){h.data.vertices+=4;h.data.faces++;K=f(S++);K.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?F.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?I?(A.r=P.r,A.g=P.g,A.b=P.b,b(o,n,A),F.r=Math.max(0,Math.min(t.color.r*A.r,1)),F.g=Math.max(0,Math.min(t.color.g*A.g,1)),F.b=Math.max(0,Math.min(t.color.b*
|
|
|
-A.b,1)),F.updateHex()):F.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(U=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),F.setRGB(U,U,U)):t instanceof THREE.MeshNormalMaterial&&F.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));t.wireframe?K.setAttribute("style","fill: none; stroke: #"+j(F.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):K.setAttribute("style",
|
|
|
-"fill: #"+j(F.hex.toString(16))+"; fill-opacity: "+t.opacity);p.appendChild(K)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),W==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function j(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,u,v,x,w,y,C,E=new THREE.Rectangle,B=new THREE.Rectangle,I=
|
|
|
-!1,F=new THREE.Color(16777215),A=new THREE.Color(16777215),P=new THREE.Color(0),H=new THREE.Color(0),G=new THREE.Color(0),U,V=new THREE.Vector3,J=[],Z=[],K,S,k,W=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":W=1;break;case "low":W=0}};this.setSize=function(b,e){o=b;t=e;u=o/2;v=t/2;p.setAttribute("viewBox",-u+" "+-v+" "+o+" "+t);p.setAttribute("width",o);p.setAttribute("height",t);E.set(-u,-v,
|
|
|
-u,v)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,t,o,A,F,U,R,J;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,f,this.sortElements);k=S=0;if(I=b.lights.length>0){R=b.lights;P.setRGB(0,0,0);H.setRGB(0,0,0);G.setRGB(0,0,0);g=0;for(t=R.length;g<t;g++)o=R[g],A=o.color,o instanceof THREE.AmbientLight?(P.r+=A.r,P.g+=A.g,P.b+=A.b):o instanceof THREE.DirectionalLight?(H.r+=A.r,H.g+=A.g,H.b+=A.b):o instanceof
|
|
|
-THREE.PointLight&&(G.r+=A.r,G.g+=A.g,G.b+=A.b)}g=0;for(t=m.length;g<t;g++)if(R=m[g],B.empty(),R instanceof THREE.RenderableParticle){x=R;x.x*=u;x.y*=-v;o=0;for(A=R.materials.length;o<A;)o++}else if(R instanceof THREE.RenderableLine){if(x=R.v1,w=R.v2,x.positionScreen.x*=u,x.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,B.addPoint(x.positionScreen.x,x.positionScreen.y),B.addPoint(w.positionScreen.x,w.positionScreen.y),E.instersects(B)){o=0;for(A=R.materials.length;o<A;)if((J=R.materials[o++])&&
|
|
|
-J.opacity!=0){F=x;U=w;var V=k++;Z[V]==null&&(Z[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),W==0&&Z[V].setAttribute("shape-rendering","crispEdges"));K=Z[V];K.setAttribute("x1",F.positionScreen.x);K.setAttribute("y1",F.positionScreen.y);K.setAttribute("x2",U.positionScreen.x);K.setAttribute("y2",U.positionScreen.y);J instanceof THREE.LineBasicMaterial&&(K.setAttribute("style","fill: none; stroke: ##"+j(J.color.hex.toString(16))+"; stroke-width: "+J.linewidth+"; stroke-opacity: "+
|
|
|
-J.opacity+"; stroke-linecap: "+J.linecap+"; stroke-linejoin: "+J.linejoin),p.appendChild(K))}}}else if(R instanceof THREE.RenderableFace3){if(x=R.v1,w=R.v2,y=R.v3,x.positionScreen.x*=u,x.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,y.positionScreen.x*=u,y.positionScreen.y*=-v,B.addPoint(x.positionScreen.x,x.positionScreen.y),B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(y.positionScreen.x,y.positionScreen.y),E.instersects(B)){o=0;for(A=R.meshMaterials.length;o<
|
|
|
-A;)if(J=R.meshMaterials[o++],J instanceof THREE.MeshFaceMaterial){F=0;for(U=R.faceMaterials.length;F<U;)(J=R.faceMaterials[F++])&&J.opacity!=0&&c(x,w,y,R,J,b)}else J&&J.opacity!=0&&c(x,w,y,R,J,b)}}else if(R instanceof THREE.RenderableFace4&&(x=R.v1,w=R.v2,y=R.v3,C=R.v4,x.positionScreen.x*=u,x.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,y.positionScreen.x*=u,y.positionScreen.y*=-v,C.positionScreen.x*=u,C.positionScreen.y*=-v,B.addPoint(x.positionScreen.x,x.positionScreen.y),B.addPoint(w.positionScreen.x,
|
|
|
-w.positionScreen.y),B.addPoint(y.positionScreen.x,y.positionScreen.y),B.addPoint(C.positionScreen.x,C.positionScreen.y),E.instersects(B))){o=0;for(A=R.meshMaterials.length;o<A;)if(J=R.meshMaterials[o++],J instanceof THREE.MeshFaceMaterial){F=0;for(U=R.faceMaterials.length;F<U;)(J=R.faceMaterials[F++])&&J.opacity!=0&&e(x,w,y,C,R,J,b)}else J&&J.opacity!=0&&e(x,w,y,C,R,J,b)}}};
|
|
|
+THREE.Projector=function(){function b(){var b=o[m]=o[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,k=e.z+e.w,j=-b.z+b.w,h=-e.z+e.w;return g>=0&&k>=0&&j>=0&&h>=0?!0:g<0&&k<0||j<0&&h<0?!1:(g<0?c=Math.max(c,g/(g-k)):k<0&&(f=Math.min(f,g/(g-k))),j<0?c=Math.max(c,j/(j-h)):h<0&&(f=Math.min(f,j/(j-h))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,j=[],g,m,o=[],p,n,t=[],v,u=[],w,A,y=[],x,I,B=[],E=new THREE.Vector4,G=new THREE.Vector4,
|
|
|
+H=new THREE.Matrix4,Q=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(b,e){H.multiply(e.projectionMatrix,e.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,e){H.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,g){var e=[],m,o,k;h=0;o=
|
|
|
+b.objects;b=0;for(m=o.length;b<m;b++){k=o[b];var p;if(!(p=!k.visible))if(p=k instanceof THREE.Mesh){a:{p=void 0;for(var t=k.matrixWorld,n=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),u=0;u<6;u++)if(p=F[u].x*t.n14+F[u].y*t.n24+F[u].z*t.n34+F[u].w,p<=n){p=!1;break a}p=!0}p=!p}if(!p)p=j[h]=j[h]||new THREE.RenderableObject,h++,f=p,E.copy(k.position),H.multiplyVector3(E),f.object=k,f.z=E.z,e.push(f)}g&&e.sort(c);return e};this.projectScene=function(f,j,h){var E=[],
|
|
|
+U=j.near,k=j.far,Z,P,aa,ea,Y,$,da,fa,pa,T,ha,ka,na,ga,J,V,ia;I=A=v=n=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);H.multiply(j.projectionMatrix,j.matrixWorldInverse);F[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);F[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);F[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);F[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);F[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-H.n34);F[5].set(H.n41+H.n31,H.n42+
|
|
|
+H.n32,H.n43+H.n33,H.n44+H.n34);for(Z=0;Z<6;Z++)pa=F[Z],pa.divideScalar(Math.sqrt(pa.x*pa.x+pa.y*pa.y+pa.z*pa.z));pa=this.projectObjects(f,j,!0);f=0;for(Z=pa.length;f<Z;f++)if(T=pa[f].object,T.visible)if(ha=T.matrixWorld,ka=T.matrixRotationWorld,na=T.materials,ga=T.overdraw,m=0,T instanceof THREE.Mesh){J=T.geometry;ea=J.vertices;V=J.faces;J=J.faceVertexUvs;P=0;for(aa=ea.length;P<aa;P++)g=b(),g.positionWorld.copy(ea[P].position),ha.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),
|
|
|
+H.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>U&&g.positionScreen.z<k;ea=0;for(P=V.length;ea<P;ea++){aa=V[ea];if(aa instanceof THREE.Face3)if(Y=o[aa.a],$=o[aa.b],da=o[aa.c],Y.visible&&$.visible&&da.visible&&(T.doubleSided||T.flipSided!=(da.positionScreen.x-Y.positionScreen.x)*($.positionScreen.y-Y.positionScreen.y)-(da.positionScreen.y-Y.positionScreen.y)*($.positionScreen.x-Y.positionScreen.x)<0))fa=
|
|
|
+t[n]=t[n]||new THREE.RenderableFace3,n++,p=fa,p.v1.copy(Y),p.v2.copy($),p.v3.copy(da);else continue;else if(aa instanceof THREE.Face4)if(Y=o[aa.a],$=o[aa.b],da=o[aa.c],fa=o[aa.d],Y.visible&&$.visible&&da.visible&&fa.visible&&(T.doubleSided||T.flipSided!=((fa.positionScreen.x-Y.positionScreen.x)*($.positionScreen.y-Y.positionScreen.y)-(fa.positionScreen.y-Y.positionScreen.y)*($.positionScreen.x-Y.positionScreen.x)<0||($.positionScreen.x-da.positionScreen.x)*(fa.positionScreen.y-da.positionScreen.y)-
|
|
|
+($.positionScreen.y-da.positionScreen.y)*(fa.positionScreen.x-da.positionScreen.x)<0)))ia=u[v]=u[v]||new THREE.RenderableFace4,v++,p=ia,p.v1.copy(Y),p.v2.copy($),p.v3.copy(da),p.v4.copy(fa);else continue;p.normalWorld.copy(aa.normal);ka.multiplyVector3(p.normalWorld);p.centroidWorld.copy(aa.centroid);ha.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);H.multiplyVector3(p.centroidScreen);da=aa.vertexNormals;Y=0;for($=da.length;Y<$;Y++)fa=p.vertexNormalsWorld[Y],fa.copy(da[Y]),
|
|
|
+ka.multiplyVector3(fa);Y=0;for($=J.length;Y<$;Y++)if(ia=J[Y][ea]){da=0;for(fa=ia.length;da<fa;da++)p.uvs[Y][da]=ia[da]}p.meshMaterials=na;p.faceMaterials=aa.materials;p.overdraw=ga;p.z=p.centroidScreen.z;E.push(p)}}else if(T instanceof THREE.Line){Q.multiply(H,ha);ea=T.geometry.vertices;Y=b();Y.positionScreen.copy(ea[0].position);Q.multiplyVector4(Y.positionScreen);P=1;for(aa=ea.length;P<aa;P++)if(Y=b(),Y.positionScreen.copy(ea[P].position),Q.multiplyVector4(Y.positionScreen),$=o[m-2],C.copy(Y.positionScreen),
|
|
|
+N.copy($.positionScreen),e(C,N))C.multiplyScalar(1/C.w),N.multiplyScalar(1/N.w),ha=y[A]=y[A]||new THREE.RenderableLine,A++,w=ha,w.v1.positionScreen.copy(C),w.v2.positionScreen.copy(N),w.z=Math.max(C.z,N.z),w.materials=T.materials,E.push(w)}else if(T instanceof THREE.Particle&&(G.set(T.matrixWorld.n14,T.matrixWorld.n24,T.matrixWorld.n34,1),H.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))ha=B[I]=B[I]||new THREE.RenderableParticle,I++,x=ha,x.x=G.x/G.w,x.y=G.y/G.w,x.z=G.z,x.rotation=T.rotation.z,x.scale.x=
|
|
|
+T.scale.x*Math.abs(x.x-(G.x+j.projectionMatrix.n11)/(G.w+j.projectionMatrix.n14)),x.scale.y=T.scale.y*Math.abs(x.y-(G.y+j.projectionMatrix.n22)/(G.w+j.projectionMatrix.n24)),x.materials=T.materials,E.push(x);h&&E.sort(c);return E}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;j=f/2};this.render=function(e,f){var o,p,n,t,v,u,w,A;b=c.projectScene(e,f);o=0;for(p=b.length;o<p;o++)if(v=b[o],v instanceof THREE.RenderableParticle){w=v.x*h+h;A=v.y*j+j;n=0;for(t=v.material.length;n<t;n++)if(u=v.material[n],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=w+"px",u.style.top=A+"px"}}};
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(x!=b)w.globalAlpha=x=b}function e(b){if(I!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}I=b}}function f(b){if(B!=b.hex)B=b.hex,w.strokeStyle="#"+j(B.toString(16))}function h(b){if(E!=b.hex)E=b.hex,w.fillStyle="#"+j(E.toString(16))}function j(b){for(;b.length<6;)b="0"+b;return b}
|
|
|
+var g=this,m=null,o=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),n,t,v,u,w=p.getContext("2d"),A=new THREE.Color(0),y=0,x=1,I=0,B=null,E=null,G=null,H=null,Q=null,F,C,N,W,K=new THREE.RenderableVertex,X=new THREE.RenderableVertex,L,U,k,Z,P,aa,ea,Y,$,da,fa,pa,T=new THREE.Color(0),ha=new THREE.Color(0),ka=new THREE.Color(0),na=new THREE.Color(0),ga=new THREE.Color(0),J,V,ia,ma,oa,wa,Aa,va,ya,Ma,sa=new THREE.Rectangle,ra=new THREE.Rectangle,qa=new THREE.Rectangle,
|
|
|
+Ba=!1,ca=new THREE.Color,S=new THREE.Color,ua=new THREE.Color,R=new THREE.Color,la=new THREE.Vector3,ja,Pa,Va,xa,Qa,Ra,b=16;ja=document.createElement("canvas");ja.width=ja.height=2;Pa=ja.getContext("2d");Pa.fillStyle="rgba(0,0,0,1)";Pa.fillRect(0,0,2,2);Va=Pa.getImageData(0,0,2,2);xa=Va.data;Qa=document.createElement("canvas");Qa.width=Qa.height=b;Ra=Qa.getContext("2d");Ra.translate(-b/2,-b/2);Ra.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
|
|
|
+faces:0};this.setSize=function(b,e){n=b;t=e;v=n/2;u=t/2;p.width=n;p.height=t;sa.set(-v,-u,v,u);ra.set(-v,-u,v,u);x=1;I=0;Q=H=G=E=B=null};this.setClearColor=function(b,e){A=b;y=e;ra.set(-v,-u,v,u)};this.setClearColorHex=function(b,e){A.setHex(b);y=e;ra.set(-v,-u,v,u)};this.clear=function(){w.setTransform(1,0,0,-1,v,u);if(!ra.isEmpty())ra.inflate(1),ra.minSelf(sa),y==0?w.clearRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight()):(e(THREE.NormalBlending),c(1),E="rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*
|
|
|
+255)+","+Math.floor(A.b*255)+","+y+")",w.fillStyle=E,w.fillRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight())),ra.empty()};this.render=function(b,j){function p(b){var e,c,f,g=b.lights;S.setRGB(0,0,0);ua.setRGB(0,0,0);R.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(S.r+=f.r,S.g+=f.g,S.b+=f.b):c instanceof THREE.DirectionalLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.PointLight&&(R.r+=f.r,R.g+=f.g,R.b+=f.b)}function t(b,e,c,f){var g,j,k,h,
|
|
|
+m=b.lights,b=0;for(g=m.length;b<g;b++)j=m[b],k=j.color,j instanceof THREE.DirectionalLight?(h=c.dot(j.position),h<=0||(h*=j.intensity,f.r+=k.r*h,f.g+=k.g*h,f.b+=k.b*h)):j instanceof THREE.PointLight&&(h=c.dot(la.sub(j.position,e).normalize()),h<=0||(h*=j.distance==0?1:1-Math.min(e.distanceTo(j.position)/j.distance,1),h!=0&&(h*=j.intensity,f.r+=k.r*h,f.g+=k.g*h,f.b+=k.b*h)))}function n(b,g,j){c(j.opacity);e(j.blending);var k,m,o,p,ja,t;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)p=j.map.image,
|
|
|
+ja=p.width>>1,t=p.height>>1,j=g.scale.x*v,o=g.scale.y*u,k=j*ja,m=o*t,qa.set(b.x-k,b.y-m,b.x+k,b.y+m),sa.instersects(qa)&&(w.save(),w.translate(b.x,b.y),w.rotate(-g.rotation),w.scale(j,-o),w.translate(-ja,-t),w.drawImage(p,0,0),w.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=g.scale.x*v,m=g.scale.y*u,qa.set(b.x-k,b.y-m,b.x+k,b.y+m),sa.instersects(qa)&&(f(j.color),h(j.color),w.save(),w.translate(b.x,b.y),w.rotate(-g.rotation),w.scale(k,m),j.program(w),w.restore()))}function x(b,g,j,
|
|
|
+k){c(k.opacity);e(k.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(g.positionScreen.x,g.positionScreen.y);w.closePath();if(k instanceof THREE.LineBasicMaterial){b=k.linewidth;if(G!=b)w.lineWidth=G=b;b=k.linecap;if(H!=b)w.lineCap=H=b;b=k.linejoin;if(Q!=b)w.lineJoin=Q=b;f(k.color);w.stroke();qa.inflate(k.linewidth*2)}}function y(b,f,h,m,o,p,ja,n,u){g.data.vertices+=3;g.data.faces++;c(n.opacity);e(n.blending);L=b.positionScreen.x;U=b.positionScreen.y;k=f.positionScreen.x;
|
|
|
+Z=f.positionScreen.y;P=h.positionScreen.x;aa=h.positionScreen.y;B(L,U,k,Z,P,aa);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ma=ja.uvs[0],Ca(L,U,k,Z,P,aa,n.map.image,ma[m].u,ma[m].v,ma[o].u,ma[o].v,ma[p].u,ma[p].v));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=j.matrixWorldInverse,la.copy(ja.vertexNormalsWorld[0]),oa=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,wa=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,la.copy(ja.vertexNormalsWorld[1]),
|
|
|
+Aa=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,va=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,la.copy(ja.vertexNormalsWorld[2]),ya=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,Ma=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,Ca(L,U,k,Z,P,aa,n.envMap.image,oa,wa,Aa,va,ya,Ma)}else n.wireframe?E(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ea(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(ma=ja.uvs[0],Ca(L,U,
|
|
|
+k,Z,P,aa,n.map.image,ma[m].u,ma[m].v,ma[o].u,ma[o].v,ma[p].u,ma[p].v)),e(THREE.SubtractiveBlending)),Ba?!n.wireframe&&n.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==3?(ha.r=ka.r=na.r=S.r,ha.g=ka.g=na.g=S.g,ha.b=ka.b=na.b=S.b,t(u,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ha),t(u,ja.v2.positionWorld,ja.vertexNormalsWorld[1],ka),t(u,ja.v3.positionWorld,ja.vertexNormalsWorld[2],na),ga.r=(ka.r+na.r)*0.5,ga.g=(ka.g+na.g)*0.5,ga.b=(ka.b+na.b)*0.5,ia=Sa(ha,ka,na,ga),Ca(L,U,k,Z,P,aa,ia,0,
|
|
|
+0,1,0,0,1)):(ca.r=S.r,ca.g=S.g,ca.b=S.b,t(u,ja.centroidWorld,ja.normalWorld,ca),T.r=Math.max(0,Math.min(n.color.r*ca.r,1)),T.g=Math.max(0,Math.min(n.color.g*ca.g,1)),T.b=Math.max(0,Math.min(n.color.b*ca.b,1)),T.updateHex(),n.wireframe?E(T,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ea(T)):n.wireframe?E(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ea(n.color);else if(n instanceof THREE.MeshDepthMaterial)J=j.near,V=j.far,ha.r=ha.g=ha.b=1-Ia(b.positionScreen.z,
|
|
|
+J,V),ka.r=ka.g=ka.b=1-Ia(f.positionScreen.z,J,V),na.r=na.g=na.b=1-Ia(h.positionScreen.z,J,V),ga.r=(ka.r+na.r)*0.5,ga.g=(ka.g+na.g)*0.5,ga.b=(ka.b+na.b)*0.5,ia=Sa(ha,ka,na,ga),Ca(L,U,k,Z,P,aa,ia,0,0,1,0,0,1);else if(n instanceof THREE.MeshNormalMaterial)T.r=Na(ja.normalWorld.x),T.g=Na(ja.normalWorld.y),T.b=Na(ja.normalWorld.z),T.updateHex(),n.wireframe?E(T,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ea(T)}function A(b,f,h,m,o,p,ja,n,u){g.data.vertices+=4;g.data.faces++;c(n.opacity);
|
|
|
+e(n.blending);if(n.map||n.envMap)y(b,f,m,0,1,3,ja,n,u),y(o,h,p,1,2,3,ja,n,u);else if(L=b.positionScreen.x,U=b.positionScreen.y,k=f.positionScreen.x,Z=f.positionScreen.y,P=h.positionScreen.x,aa=h.positionScreen.y,ea=m.positionScreen.x,Y=m.positionScreen.y,$=o.positionScreen.x,da=o.positionScreen.y,fa=p.positionScreen.x,pa=p.positionScreen.y,n instanceof THREE.MeshBasicMaterial)I(L,U,k,Z,P,aa,ea,Y),n.wireframe?E(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ea(n.color);else if(n instanceof
|
|
|
+THREE.MeshLambertMaterial)Ba?!n.wireframe&&n.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==4?(ha.r=ka.r=na.r=ga.r=S.r,ha.g=ka.g=na.g=ga.g=S.g,ha.b=ka.b=na.b=ga.b=S.b,t(u,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ha),t(u,ja.v2.positionWorld,ja.vertexNormalsWorld[1],ka),t(u,ja.v4.positionWorld,ja.vertexNormalsWorld[3],na),t(u,ja.v3.positionWorld,ja.vertexNormalsWorld[2],ga),ia=Sa(ha,ka,na,ga),B(L,U,k,Z,ea,Y),Ca(L,U,k,Z,ea,Y,ia,0,0,1,0,0,1),B($,da,P,aa,fa,pa),Ca($,da,P,aa,fa,pa,ia,1,
|
|
|
+0,1,1,0,1)):(ca.r=S.r,ca.g=S.g,ca.b=S.b,t(u,ja.centroidWorld,ja.normalWorld,ca),T.r=Math.max(0,Math.min(n.color.r*ca.r,1)),T.g=Math.max(0,Math.min(n.color.g*ca.g,1)),T.b=Math.max(0,Math.min(n.color.b*ca.b,1)),T.updateHex(),I(L,U,k,Z,P,aa,ea,Y),n.wireframe?E(T,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ea(T)):(I(L,U,k,Z,P,aa,ea,Y),n.wireframe?E(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ea(n.color));else if(n instanceof THREE.MeshNormalMaterial)T.r=Na(ja.normalWorld.x),
|
|
|
+T.g=Na(ja.normalWorld.y),T.b=Na(ja.normalWorld.z),T.updateHex(),I(L,U,k,Z,P,aa,ea,Y),n.wireframe?E(T,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ea(T);else if(n instanceof THREE.MeshDepthMaterial)J=j.near,V=j.far,ha.r=ha.g=ha.b=1-Ia(b.positionScreen.z,J,V),ka.r=ka.g=ka.b=1-Ia(f.positionScreen.z,J,V),na.r=na.g=na.b=1-Ia(m.positionScreen.z,J,V),ga.r=ga.g=ga.b=1-Ia(h.positionScreen.z,J,V),ia=Sa(ha,ka,na,ga),B(L,U,k,Z,ea,Y),Ca(L,U,k,Z,ea,Y,ia,0,0,1,0,0,1),B($,da,P,aa,fa,pa),Ca($,da,P,
|
|
|
+aa,fa,pa,ia,1,0,1,1,0,1)}function B(b,e,c,f,g,j){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(g,j);w.lineTo(b,e);w.closePath()}function I(b,e,c,f,g,j,k,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(g,j);w.lineTo(k,h);w.lineTo(b,e);w.closePath()}function E(b,e,c,g){if(G!=e)w.lineWidth=G=e;if(H!=c)w.lineCap=H=c;if(Q!=g)w.lineJoin=Q=g;f(b);w.stroke();qa.inflate(e*2)}function Ea(b){h(b);w.fill()}function Ca(b,e,c,f,g,j,k,h,m,o,ja,n,p){var t,u;t=k.width-1;u=k.height-1;h*=t;m*=u;o*=t;ja*=
|
|
|
+u;n*=t;p*=u;c-=b;f-=e;g-=b;j-=e;o-=h;ja-=m;n-=h;p-=m;t=o*p-n*ja;if(!((t<0?-t:t)<1))u=1/t,t=(p*c-ja*g)*u,ja=(p*f-ja*j)*u,c=(o*g-n*c)*u,f=(o*j-n*f)*u,b=b-t*h-c*m,e=e-ja*h-f*m,w.save(),w.transform(t,ja,c,f,b,e),w.clip(),w.drawImage(k,0,0),w.restore()}function Sa(b,e,c,f){var g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),h=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),p=~~(f.g*255),f=~~(f.b*255);xa[0]=g<0?0:g>255?255:g;xa[1]=j<0?0:j>255?255:j;xa[2]=b<0?0:
|
|
|
+b>255?255:b;xa[4]=k<0?0:k>255?255:k;xa[5]=h<0?0:h>255?255:h;xa[6]=e<0?0:e>255?255:e;xa[8]=m<0?0:m>255?255:m;xa[9]=o<0?0:o>255?255:o;xa[10]=c<0?0:c>255?255:c;xa[12]=n<0?0:n>255?255:n;xa[13]=p<0?0:p>255?255:p;xa[14]=f<0?0:f>255?255:f;Pa.putImageData(Va,0,0);Ra.drawImage(ja,0,0);return Qa}function Ia(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Fa(b,e){var c=e.x-b.x,f=e.y-b.y,g=c*c+f*f;g!=0&&(g=1/Math.sqrt(g),c*=g,f*=g,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}
|
|
|
+var Ta,D,M,z,Ga,Oa,Ua,ta;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,u);g.data.vertices=0;g.data.faces=0;m=o.projectScene(b,j,this.sortElements);(Ba=b.lights.length>0)&&p(b);Ta=0;for(D=m.length;Ta<D;Ta++){M=m[Ta];qa.empty();if(M instanceof THREE.RenderableParticle){F=M;F.x*=v;F.y*=u;z=0;for(Ga=M.materials.length;z<Ga;)ta=M.materials[z++],ta.opacity!=0&&n(F,M,ta,b)}else if(M instanceof THREE.RenderableLine){if(F=M.v1,C=M.v2,F.positionScreen.x*=v,F.positionScreen.y*=u,C.positionScreen.x*=
|
|
|
+v,C.positionScreen.y*=u,qa.addPoint(F.positionScreen.x,F.positionScreen.y),qa.addPoint(C.positionScreen.x,C.positionScreen.y),sa.instersects(qa)){z=0;for(Ga=M.materials.length;z<Ga;)ta=M.materials[z++],ta.opacity!=0&&x(F,C,M,ta,b)}}else if(M instanceof THREE.RenderableFace3){if(F=M.v1,C=M.v2,N=M.v3,F.positionScreen.x*=v,F.positionScreen.y*=u,C.positionScreen.x*=v,C.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=u,M.overdraw&&(Fa(F.positionScreen,C.positionScreen),Fa(C.positionScreen,
|
|
|
+N.positionScreen),Fa(N.positionScreen,F.positionScreen)),qa.add3Points(F.positionScreen.x,F.positionScreen.y,C.positionScreen.x,C.positionScreen.y,N.positionScreen.x,N.positionScreen.y),sa.instersects(qa)){z=0;for(Ga=M.meshMaterials.length;z<Ga;)if(ta=M.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=M.faceMaterials.length;Oa<Ua;)(ta=M.faceMaterials[Oa++])&&ta.opacity!=0&&y(F,C,N,0,1,2,M,ta,b)}else ta.opacity!=0&&y(F,C,N,0,1,2,M,ta,b)}}else if(M instanceof THREE.RenderableFace4&&
|
|
|
+(F=M.v1,C=M.v2,N=M.v3,W=M.v4,F.positionScreen.x*=v,F.positionScreen.y*=u,C.positionScreen.x*=v,C.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=u,W.positionScreen.x*=v,W.positionScreen.y*=u,K.positionScreen.copy(C.positionScreen),X.positionScreen.copy(W.positionScreen),M.overdraw&&(Fa(F.positionScreen,C.positionScreen),Fa(C.positionScreen,W.positionScreen),Fa(W.positionScreen,F.positionScreen),Fa(N.positionScreen,K.positionScreen),Fa(N.positionScreen,X.positionScreen)),qa.addPoint(F.positionScreen.x,
|
|
|
+F.positionScreen.y),qa.addPoint(C.positionScreen.x,C.positionScreen.y),qa.addPoint(N.positionScreen.x,N.positionScreen.y),qa.addPoint(W.positionScreen.x,W.positionScreen.y),sa.instersects(qa))){z=0;for(Ga=M.meshMaterials.length;z<Ga;)if(ta=M.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=M.faceMaterials.length;Oa<Ua;)(ta=M.faceMaterials[Oa++])&&ta.opacity!=0&&A(F,C,N,W,K,X,M,ta,b)}else ta.opacity!=0&&A(F,C,N,W,K,X,M,ta,b)}ra.addRectangle(qa)}w.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function b(b,e,c){var f,g,j,k;f=0;for(g=b.lights.length;f<g;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(k=e.normalWorld.dot(j.position)*j.intensity,k>0&&(c.r+=j.color.r*k,c.g+=j.color.g*k,c.b+=j.color.b*k)):j instanceof THREE.PointLight&&(W.sub(j.position,e.centroidWorld),W.normalize(),k=e.normalWorld.dot(W)*j.intensity,k>0&&(c.r+=j.color.r*k,c.g+=j.color.g*k,c.b+=j.color.b*k))}function c(e,c,k,m,o,n){g.data.vertices+=3;g.data.faces++;L=f(U++);L.setAttribute("d",
|
|
|
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?G.hex=o.color.hex:o instanceof THREE.MeshLambertMaterial?E?(H.r=Q.r,H.g=Q.g,H.b=Q.b,b(n,m,H),G.r=Math.max(0,Math.min(o.color.r*H.r,1)),G.g=Math.max(0,Math.min(o.color.g*H.g,1)),G.b=Math.max(0,Math.min(o.color.b*H.b,1)),G.updateHex()):G.hex=o.color.hex:o instanceof THREE.MeshDepthMaterial?(N=1-o.__2near/(o.__farPlusNear-
|
|
|
+m.z*o.__farMinusNear),G.setRGB(N,N,N)):o instanceof THREE.MeshNormalMaterial&&G.setRGB(h(m.normalWorld.x),h(m.normalWorld.y),h(m.normalWorld.z));o.wireframe?L.setAttribute("style","fill: none; stroke: #"+j(G.hex.toString(16))+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):L.setAttribute("style","fill: #"+j(G.hex.toString(16))+"; fill-opacity: "+o.opacity);p.appendChild(L)}function e(e,c,k,m,
|
|
|
+o,n,t){g.data.vertices+=4;g.data.faces++;L=f(U++);L.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?E?(H.r=Q.r,H.g=Q.g,H.b=Q.b,b(t,o,H),G.r=Math.max(0,Math.min(n.color.r*H.r,1)),G.g=Math.max(0,Math.min(n.color.g*H.g,1)),G.b=Math.max(0,Math.min(n.color.b*
|
|
|
+H.b,1)),G.updateHex()):G.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(N=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear),G.setRGB(N,N,N)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?L.setAttribute("style","fill: none; stroke: #"+j(G.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):L.setAttribute("style",
|
|
|
+"fill: #"+j(G.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(L)}function f(b){K[b]==null&&(K[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),Z==0&&K[b].setAttribute("shape-rendering","crispEdges"));return K[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function j(b){for(;b.length<6;)b="0"+b;return b}var g=this,m=null,o=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,t,v,u,w,A,y,x,I=new THREE.Rectangle,B=new THREE.Rectangle,E=
|
|
|
+!1,G=new THREE.Color(16777215),H=new THREE.Color(16777215),Q=new THREE.Color(0),F=new THREE.Color(0),C=new THREE.Color(0),N,W=new THREE.Vector3,K=[],X=[],L,U,k,Z=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":Z=1;break;case "low":Z=0}};this.setSize=function(b,e){n=b;t=e;v=n/2;u=t/2;p.setAttribute("viewBox",-v+" "+-u+" "+n+" "+t);p.setAttribute("width",n);p.setAttribute("height",t);I.set(-v,-u,
|
|
|
+v,u)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var h,n,t,G,H,N,T,K;this.autoClear&&this.clear();g.data.vertices=0;g.data.faces=0;m=o.projectScene(b,f,this.sortElements);k=U=0;if(E=b.lights.length>0){T=b.lights;Q.setRGB(0,0,0);F.setRGB(0,0,0);C.setRGB(0,0,0);h=0;for(n=T.length;h<n;h++)t=T[h],G=t.color,t instanceof THREE.AmbientLight?(Q.r+=G.r,Q.g+=G.g,Q.b+=G.b):t instanceof THREE.DirectionalLight?(F.r+=G.r,F.g+=G.g,F.b+=G.b):t instanceof
|
|
|
+THREE.PointLight&&(C.r+=G.r,C.g+=G.g,C.b+=G.b)}h=0;for(n=m.length;h<n;h++)if(T=m[h],B.empty(),T instanceof THREE.RenderableParticle){w=T;w.x*=v;w.y*=-u;t=0;for(G=T.materials.length;t<G;)t++}else if(T instanceof THREE.RenderableLine){if(w=T.v1,A=T.v2,w.positionScreen.x*=v,w.positionScreen.y*=-u,A.positionScreen.x*=v,A.positionScreen.y*=-u,B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(A.positionScreen.x,A.positionScreen.y),I.instersects(B)){t=0;for(G=T.materials.length;t<G;)if((K=T.materials[t++])&&
|
|
|
+K.opacity!=0){H=w;N=A;var W=k++;X[W]==null&&(X[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),Z==0&&X[W].setAttribute("shape-rendering","crispEdges"));L=X[W];L.setAttribute("x1",H.positionScreen.x);L.setAttribute("y1",H.positionScreen.y);L.setAttribute("x2",N.positionScreen.x);L.setAttribute("y2",N.positionScreen.y);K instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: ##"+j(K.color.hex.toString(16))+"; stroke-width: "+K.linewidth+"; stroke-opacity: "+
|
|
|
+K.opacity+"; stroke-linecap: "+K.linecap+"; stroke-linejoin: "+K.linejoin),p.appendChild(L))}}}else if(T instanceof THREE.RenderableFace3){if(w=T.v1,A=T.v2,y=T.v3,w.positionScreen.x*=v,w.positionScreen.y*=-u,A.positionScreen.x*=v,A.positionScreen.y*=-u,y.positionScreen.x*=v,y.positionScreen.y*=-u,B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(A.positionScreen.x,A.positionScreen.y),B.addPoint(y.positionScreen.x,y.positionScreen.y),I.instersects(B)){t=0;for(G=T.meshMaterials.length;t<
|
|
|
+G;)if(K=T.meshMaterials[t++],K instanceof THREE.MeshFaceMaterial){H=0;for(N=T.faceMaterials.length;H<N;)(K=T.faceMaterials[H++])&&K.opacity!=0&&c(w,A,y,T,K,b)}else K&&K.opacity!=0&&c(w,A,y,T,K,b)}}else if(T instanceof THREE.RenderableFace4&&(w=T.v1,A=T.v2,y=T.v3,x=T.v4,w.positionScreen.x*=v,w.positionScreen.y*=-u,A.positionScreen.x*=v,A.positionScreen.y*=-u,y.positionScreen.x*=v,y.positionScreen.y*=-u,x.positionScreen.x*=v,x.positionScreen.y*=-u,B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(A.positionScreen.x,
|
|
|
+A.positionScreen.y),B.addPoint(y.positionScreen.x,y.positionScreen.y),B.addPoint(x.positionScreen.x,x.positionScreen.y),I.instersects(B))){t=0;for(G=T.meshMaterials.length;t<G;)if(K=T.meshMaterials[t++],K instanceof THREE.MeshFaceMaterial){H=0;for(N=T.faceMaterials.length;H<N;)(K=T.faceMaterials[H++])&&K.opacity!=0&&e(w,A,y,x,T,K,b)}else K&&K.opacity!=0&&e(w,A,y,x,T,K,b)}}};
|
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
|
|
|
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -198,7 +198,7 @@ lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirec
|
|
|
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif",
|
|
|
morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
|
|
|
default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif"};
|
|
|
-THREE.UniformsUtils={merge:function(b){var c,e,f,g={};for(c=0;c<b.length;c++)for(e in f=this.clone(b[c]),f)g[e]=f[e];return g},clone:function(b){var c,e,f,g={};for(c in b)for(e in g[c]={},b[c])f=b[c][e],g[c][e]=f instanceof THREE.Color||f instanceof THREE.Vector2||f instanceof THREE.Vector3||f instanceof THREE.Vector4||f instanceof THREE.Matrix4||f instanceof THREE.Texture?f.clone():f instanceof Array?f.slice():f;return g}};
|
|
|
+THREE.UniformsUtils={merge:function(b){var c,e,f,h={};for(c=0;c<b.length;c++)for(e in f=this.clone(b[c]),f)h[e]=f[e];return h},clone:function(b){var c,e,f,h={};for(c in b)for(e in h[c]={},b[c])f=b[c][e],h[c][e]=f instanceof THREE.Color||f instanceof THREE.Vector2||f instanceof THREE.Vector3||f instanceof THREE.Vector4||f instanceof THREE.Matrix4||f instanceof THREE.Texture?f.clone():f instanceof Array?f.slice():f;return h}};
|
|
|
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",
|
|
|
value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
|
|
|
value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
|
|
@@ -219,138 +219,138 @@ THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderC
|
|
|
THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,
|
|
|
THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,
|
|
|
"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
|
-THREE.WebGLRenderer=function(b){function c(b,e,c){var f,h,g,j=b.vertices,m=j.length,n=b.colors,t=n.length,p=b.__vertexArray,o=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,x=b.__dirtyColors,w=b.__webglCustomAttributes,C,y;if(w)for(C in w)w[C].offset=0;if(c.sortParticles){na.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)h=j[f].position,wa.copy(h),na.multiplyVector3(wa),u[f]=[wa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)h=j[u[f][1]].position,g=f*3,p[g]=h.x,p[g+1]=h.y,p[g+2]=h.z;
|
|
|
-for(f=0;f<t;f++)g=f*3,color=n[u[f][1]],o[g]=color.r,o[g+1]=color.g,o[g+2]=color.b;if(w)for(C in w){f=w[C];n=f.value.length;for(g=0;g<n;g++){index=u[g][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[t]=y.x,f.array[t+1]=y.y):f.size===3?f.type==="c"?(f.array[t]=y.r,f.array[t+1]=y.g,f.array[t+2]=y.b):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z):(f.array[t]=
|
|
|
-y.x,f.array[t+1]=y.y,f.array[t+2]=y.z,f.array[t+3]=y.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)h=j[f].position,g=f*3,p[g]=h.x,p[g+1]=h.y,p[g+2]=h.z;if(x)for(f=0;f<t;f++)color=n[f],g=f*3,o[g]=color.r,o[g+1]=color.g,o[g+2]=color.b;if(w)for(C in w)if(f=w[C],f.__original.needsUpdate){n=f.value.length;for(g=0;g<n;g++){t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[g];f.size===2?(f.array[t]=
|
|
|
-y.x,f.array[t+1]=y.y):f.size===3?f.type==="c"?(f.array[t]=y.r,f.array[t+1]=y.g,f.array[t+2]=y.b):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z,f.array[t+3]=y.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,p,e);if(x||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,o,e);if(w)for(C in w)if(f=w[C],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
-f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||S.initMaterial(f,e,c,g);var h=f.program,j=h.uniforms,m=f.uniforms;h!=O&&(k.useProgram(h),O=h);k.uniformMatrix4fv(j.projectionMatrix,!1,la);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,
|
|
|
-m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var t,n,p=0,o=0,u=0,v,x,w,y,C=Aa,B=C.directional.colors,A=C.directional.positions,E=C.point.colors,F=C.point.positions,I=C.point.distances,T=0,D=0,c=n=y=0;for(t=e.length;c<t;c++)if(n=e[c],v=n.color,x=n.position,w=n.intensity,y=n.distance,n instanceof THREE.AmbientLight)p+=v.r,o+=v.g,u+=v.b;else if(n instanceof THREE.DirectionalLight)y=
|
|
|
-T*3,B[y]=v.r*w,B[y+1]=v.g*w,B[y+2]=v.b*w,A[y]=x.x,A[y+1]=x.y,A[y+2]=x.z,T+=1;else if(n instanceof THREE.PointLight)n=D*3,E[n]=v.r*w,E[n+1]=v.g*w,E[n+2]=v.b*w,F[n]=x.x,F[n+1]=x.y,F[n+2]=x.z,I[D]=y,D+=1;for(c=T*3;c<B.length;c++)B[c]=0;for(c=D*3;c<E.length;c++)E[c]=0;C.point.length=D;C.directional.length=T;C.ambient[0]=p;C.ambient[1]=o;C.ambient[2]=u;c=Aa;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;
|
|
|
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,g,j,h=b.vertices,m=h.length,o=b.colors,n=o.length,p=b.__vertexArray,t=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors,x=b.__webglCustomAttributes,y,A;if(x)for(y in x)x[y].offset=0;if(c.sortParticles){ia.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=h[f].position,wa.copy(g),ia.multiplyVector3(wa),u[f]=[wa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=h[u[f][1]].position,j=f*3,p[j]=g.x,p[j+1]=g.y,p[j+2]=g.z;
|
|
|
+for(f=0;f<n;f++)j=f*3,color=o[u[f][1]],t[j]=color.r,t[j+1]=color.g,t[j+2]=color.b;if(x)for(y in x){f=x[y];o=f.value.length;for(j=0;j<o;j++){index=u[j][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[index];f.size===2?(f.array[n]=A.x,f.array[n+1]=A.y):f.size===3?f.type==="c"?(f.array[n]=A.r,f.array[n+1]=A.g,f.array[n+2]=A.b):(f.array[n]=A.x,f.array[n+1]=A.y,f.array[n+2]=A.z):(f.array[n]=
|
|
|
+A.x,f.array[n+1]=A.y,f.array[n+2]=A.z,f.array[n+3]=A.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)g=h[f].position,j=f*3,p[j]=g.x,p[j+1]=g.y,p[j+2]=g.z;if(w)for(f=0;f<n;f++)color=o[f],j=f*3,t[j]=color.r,t[j+1]=color.g,t[j+2]=color.b;if(x)for(y in x)if(f=x[y],f.__original.needsUpdate){o=f.value.length;for(j=0;j<o;j++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[j]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[j];f.size===2?(f.array[n]=
|
|
|
+A.x,f.array[n+1]=A.y):f.size===3?f.type==="c"?(f.array[n]=A.r,f.array[n+1]=A.g,f.array[n+2]=A.b):(f.array[n]=A.x,f.array[n+1]=A.y,f.array[n+2]=A.z):(f.array[n]=A.x,f.array[n+1]=A.y,f.array[n+2]=A.z,f.array[n+3]=A.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,p,e);if(w||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,t,e);if(x)for(y in x)if(f=x[y],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
+f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,j){f.program||U.initMaterial(f,e,c,j);var g=f.program,h=g.uniforms,m=f.uniforms;g!=P&&(k.useProgram(g),P=g);k.uniformMatrix4fv(h.projectionMatrix,!1,ma);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,
|
|
|
+m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,o,p=0,t=0,u=0,v,w,x,y,A=Aa,B=A.directional.colors,G=A.directional.positions,F=A.point.colors,I=A.point.positions,H=A.point.distances,J=0,D=0,c=o=y=0;for(n=e.length;c<n;c++)if(o=e[c],v=o.color,w=o.position,x=o.intensity,y=o.distance,o instanceof THREE.AmbientLight)p+=v.r,t+=v.g,u+=v.b;else if(o instanceof THREE.DirectionalLight)y=
|
|
|
+J*3,B[y]=v.r*x,B[y+1]=v.g*x,B[y+2]=v.b*x,G[y]=w.x,G[y+1]=w.y,G[y+2]=w.z,J+=1;else if(o instanceof THREE.PointLight)o=D*3,F[o]=v.r*x,F[o+1]=v.g*x,F[o+2]=v.b*x,I[o]=w.x,I[o+1]=w.y,I[o+2]=w.z,H[D]=y,D+=1;for(c=J*3;c<B.length;c++)B[c]=0;for(c=D*3;c<F.length;c++)F[c]=0;A.point.length=D;A.directional.length=J;A.ambient[0]=p;A.ambient[1]=t;A.ambient[2]=u;c=Aa;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;
|
|
|
m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=
|
|
|
f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=va.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=
|
|
|
-f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var L in m)if(o=h.uniforms[L])if(t=m[L],p=t.type,c=t.value,p=="i")k.uniform1i(o,c);else if(p=="f")k.uniform1f(o,c);else if(p=="fv1")k.uniform1fv(o,c);else if(p=="fv")k.uniform3fv(o,c);else if(p=="v2")k.uniform2f(o,c.x,c.y);else if(p=="v3")k.uniform3f(o,
|
|
|
-c.x,c.y,c.z);else if(p=="v4")k.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="m4"){if(!t._array)t._array=new Float32Array(16);c.flattenToArray(t._array);k.uniformMatrix4fv(o,!1,t._array)}else if(p=="c")k.uniform3f(o,c.r,c.g,c.b);else if(p=="t"&&(k.uniform1i(o,c),t=t.texture))if(t.image instanceof Array&&t.image.length==6){if(t.image.length==6){if(t.needsUpdate){if(t.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,t.image.__webglTextureCube);for(p=0;p<6;++p)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,
|
|
|
-0,0,0,k.RGBA,k.UNSIGNED_BYTE,t.image[p])}else{t.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,t.image.__webglTextureCube);for(p=0;p<6;++p)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,t.image[p]);t.__webglInit=!0}G(k.TEXTURE_CUBE_MAP,t,t.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);t.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,t.image.__webglTextureCube)}}else U(t,c);k.uniformMatrix4fv(j.modelViewMatrix,
|
|
|
-!1,g._modelViewMatrixArray);k.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&k.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&j.objectMatrix!==null&&k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof
|
|
|
-THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&k.uniformMatrix4fv(j.viewMatrix,!1,oa);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,k.uniform3fv(j.directionalLightDirection,b),k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(j.viewMatrix,!1,oa);f.skinning&&(k.uniformMatrix4fv(j.cameraInverseMatrix,!1,oa),k.uniformMatrix4fv(j.boneGlobalMatrices,!1,g.boneMatrices));
|
|
|
-return h}function f(b,c,f,g,h,j){if(g.opacity!=0){var m,b=e(b,c,f,g,j).attributes;if(!g.morphTargets&&b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else if(j.morphTargetBase){c=g.program.attributes;j.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(c.position,
|
|
|
-3,k.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,t=j.morphTargetForcedOrder,n=j.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<t.length;)k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=n[t[f]],f++;else{var t=[],p=-1,o=0,n=j.morphTargetInfluences,u,v=n.length,f=0;for(j.morphTargetBase!==-1&&(t[j.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(u=0;u<v;u++)!t[u]&&
|
|
|
-n[u]>p&&(o=u,p=n[o]);k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=p;t[o]=1;p=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(g.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[m],c.size,
|
|
|
-k.FLOAT,!1,0,0));b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):
|
|
|
-k.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,
|
|
|
-4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));j instanceof THREE.Mesh?(g.wireframe?(k.lineWidth(g.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),k.drawElements(k.LINES,h.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.drawElements(k.TRIANGLES,
|
|
|
-h.__webglFaceCount,k.UNSIGNED_SHORT,0)),S.data.vertices+=h.__webglFaceCount,S.data.faces+=h.__webglFaceCount/3,S.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(j,0,h.__webglLineCount),S.data.drawCalls++):j instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,h.__webglParticleCount),S.data.drawCalls++):j instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,h.__webglVertexCount),S.data.drawCalls++)}}function g(b,
|
|
|
-e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=k.createBuffer();b.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,j,m,t,n,p,o,u,v=b.count*3;for(u=
|
|
|
-0;u<v;u+=9)c=b.normalArray,f=c[u],h=c[u+1],g=c[u+2],j=c[u+3],t=c[u+4],p=c[u+5],m=c[u+6],n=c[u+7],o=c[u+8],f=(f+j+m)/3,h=(h+t+n)/3,g=(g+p+o)/3,c[u]=f,c[u+1]=h,c[u+2]=g,c[u+3]=f,c[u+4]=h,c[u+5]=g,c[u+6]=f,c[u+7]=h,c[u+8]=g}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function j(b){if(X!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):
|
|
|
-k.enable(k.CULL_FACE),X=b.doubleSided;if(ea!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),ea=b.flipSided}function h(b){ka!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),ka=b)}function m(b,e,c){pa!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),pa=b);if(b&&(R!=e||ia!=c))k.polygonOffset(e,c),R=e,ia=c}function n(b){Y[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Y[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);Y[2].set(b.n41+b.n21,b.n42+
|
|
|
-b.n22,b.n43+b.n23,b.n44+b.n24);Y[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Y[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);Y[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=Y[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=Y[f].x*e.n14+Y[f].y*e.n24+Y[f].z*e.n34+Y[f].w,b<=c)return!1;return!0}function o(b,
|
|
|
-e){b.list[b.count]=e;b.count+=1}function t(b){var e,c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function u(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,
|
|
|
-h))}function v(b,e){return e.z-b.z}function x(b){k.enable(k.POLYGON_OFFSET_FILL);k.polygonOffset(0.1,1);k.enable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(!1);k.colorMask(!1,!1,!1,!1);k.stencilFunc(k.ALWAYS,1,255);k.stencilOpSeparate(k.BACK,k.KEEP,k.INCR,k.KEEP);k.stencilOpSeparate(k.FRONT,k.KEEP,k.DECR,k.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],j,m,t,n,p,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;
|
|
|
-g[1]=-f.position.y;g[2]=-f.position.z;for(p=0;p<o;p++)f=b.__webglShadowVolumes[p].object,j=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||S.initMaterial(m,h,void 0,f),m=m.program,t=m.uniforms,n=m.attributes,O!==m&&(k.useProgram(m),O=m,k.uniformMatrix4fv(t.projectionMatrix,!1,la),k.uniformMatrix4fv(t.viewMatrix,!1,oa),k.uniform3fv(t.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(t.objectMatrix,!1,f._objectMatrixArray),k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
-j.__webglVertexBuffer),k.vertexAttribPointer(n.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.vertexAttribPointer(n.normal,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0)}k.disable(k.POLYGON_OFFSET_FILL);k.colorMask(!0,!0,!0,!0);k.stencilFunc(k.NOTEQUAL,0,255);k.stencilOp(k.KEEP,
|
|
|
-k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);ka=ha=-1;O=da.program;k.useProgram(da.program);k.uniformMatrix4fv(da.projectionLocation,!1,la);k.uniform1f(da.darknessLocation,da.darkness);k.bindBuffer(k.ARRAY_BUFFER,da.vertexBuffer);k.vertexAttribPointer(da.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(da.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,da.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.disable(k.STENCIL_TEST);
|
|
|
-k.enable(k.DEPTH_TEST);k.depthMask(fa)}function w(b,e){var c,f,h;c=Q.attributes;var g=Q.uniforms,j=T/ca,m,t=[],n=ca*0.5,p=T*0.5,o=!0;k.useProgram(Q.program);O=Q.program;ka=ha=-1;ja||(k.enableVertexAttribArray(Q.attributes.position),k.enableVertexAttribArray(Q.attributes.uv),ja=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);k.vertexAttribPointer(c.position,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
|
|
|
-Q.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,la);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(v);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?
|
|
|
-(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(h.position.x-n)/n,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):(k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?T:1),t[0]=m*j*h.scale.x,t[1]=m*h.scale.y,k.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),k.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),k.uniform2f(g.alignment,
|
|
|
-h.alignment.x,h.alignment.y),k.uniform1f(g.opacity,h.opacity),k.uniform1f(g.rotation,h.rotation),k.uniform2fv(g.scale,t),h.mergeWith3D&&!o?(k.enable(k.DEPTH_TEST),o=!0):!h.mergeWith3D&&o&&(k.disable(k.DEPTH_TEST),o=!1),H(h.blending),U(h.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function y(b,e){var c,f,h=b.__webglLensFlares.length,g,j,m,t=new THREE.Vector3,n=T/ca,p=ca*0.5,o=T*0.5,u=16/T,v=[u*n,u],x=[1,1,0],w=[1,1],y=M.uniforms;
|
|
|
-c=M.attributes;k.useProgram(M.program);O=M.program;ka=ha=-1;ua||(k.enableVertexAttribArray(M.attributes.vertex),k.enableVertexAttribArray(M.attributes.uv),ua=!0);k.uniform1i(y.occlusionMap,0);k.uniform1i(y.map,1);k.bindBuffer(k.ARRAY_BUFFER,M.vertexBuffer);k.vertexAttribPointer(c.vertex,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,M.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,M.occlusionTexture);
|
|
|
-k.activeTexture(k.TEXTURE1);for(f=0;f<h;f++)if(c=b.__webglLensFlares[f].object,t.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(t),e.projectionMatrix.multiplyVector3(t),x[0]=t.x,x[1]=t.y,x[2]=t.z,w[0]=x[0]*p+p,w[1]=x[1]*o+o,M.hasVertexTexture||w[0]>0&&w[0]<ca&&w[1]>0&&w[1]<T){k.bindTexture(k.TEXTURE_2D,M.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,w[0]-8,w[1]-8,16,16,0);k.uniform1i(y.renderType,0);k.uniform2fv(y.scale,v);k.uniform3fv(y.screenPosition,
|
|
|
-x);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,M.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,w[0]-8,w[1]-8,16,16,0);k.uniform1i(y.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,M.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=x[0];c.positionScreen.y=x[1];c.positionScreen.z=x[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();k.uniform1i(y.renderType,
|
|
|
-2);k.enable(k.BLEND);g=0;for(j=c.lensFlares.length;g<j;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,x[2]=m.z,u=m.size*m.scale/T,v[0]=u*n,v[1]=u,k.uniform3fv(y.screenPosition,x),k.uniform2fv(y.scale,v),k.uniform1f(y.rotation,m.rotation),k.uniform1f(y.opacity,m.opacity),H(m.blending),U(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function C(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
|
|
|
-b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function E(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function B(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function I(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;
|
|
|
-for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=E(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var j=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var t=void 0,n=void 0,p=void 0,o=void 0,u=p=void 0,v=void 0,x=void 0,w=void 0,y=void 0,C=void 0,A=void 0,F=void 0,I=void 0,T=void 0,Y=void 0,H=void 0,G=void 0,D=o=w=o=x=v=void 0,L=void 0,z=L=D=v=void 0,J=void 0,O=z=L=D=p=p=u=w=o=z=L=D=J=z=L=D=J=z=L=D=void 0,K=
|
|
|
-0,M=0,U=0,R=0,P=0,na=0,X=0,S=0,Q=0,N=0,la=0,L=D=0,V=g.__vertexArray,ga=g.__uvArray,da=g.__uv2Array,fa=g.__normalArray,W=g.__tangentArray,Z=g.__colorArray,ea=g.__skinVertexAArray,oa=g.__skinVertexBArray,aa=g.__skinIndexArray,ca=g.__skinWeightArray,ma=g.__morphTargetsArrays,ia=g.__webglCustomAttributes,z=void 0,ha=g.__faceArray,ka=g.__lineArray,pa=g.__needsSmoothNormals,C=g.__vertexColorType,y=g.__uvType,A=g.__normalType,ja=j.geometry,wa=ja.__dirtyVertices,ra=ja.__dirtyElements,qa=ja.__dirtyUvs,sa=
|
|
|
-ja.__dirtyNormals,Aa=ja.__dirtyTangents,va=ja.__dirtyColors,ya=ja.__dirtyMorphTargets,ua=ja.vertices,Ba=g.faces,Ma=ja.faces,Wa=ja.faceVertexUvs[0],Xa=ja.faceVertexUvs[1],Ja=ja.skinVerticesA,Ka=ja.skinVerticesB,La=ja.skinIndices,Da=ja.skinWeights,Ha=j instanceof THREE.ShadowVolume?ja.edgeFaces:void 0,za=ja.morphTargets;if(ia)for(O in ia)ia[O].offset=0,ia[O].offsetSrc=0;t=0;for(n=Ba.length;t<n;t++)if(p=Ba[t],o=Ma[p],Wa&&(F=Wa[p]),Xa&&(I=Xa[p]),p=o.vertexNormals,u=o.normal,v=o.vertexColors,x=o.color,
|
|
|
-w=o.vertexTangents,o instanceof THREE.Face3){if(wa)T=ua[o.a].position,Y=ua[o.b].position,H=ua[o.c].position,V[M]=T.x,V[M+1]=T.y,V[M+2]=T.z,V[M+3]=Y.x,V[M+4]=Y.y,V[M+5]=Y.z,V[M+6]=H.x,V[M+7]=H.y,V[M+8]=H.z,M+=9;if(ia)for(O in ia)if(z=ia[O],z.__original.needsUpdate)D=z.offset,L=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[D+0]=z.value[o.a],z.array[D+1]=z.value[o.b],z.array[D+2]=z.value[o.c]):z.boundTo==="faces"?(z.array[D+0]=z.value[L],z.array[D+1]=z.value[L],z.array[D+
|
|
|
-2]=z.value[L],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[D+0]=z.value[L+0],z.array[D+1]=z.value[L+1],z.array[D+2]=z.value[L+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(T=z.value[o.a],Y=z.value[o.b],H=z.value[o.c]):z.boundTo==="faces"?(T=z.value[L],Y=z.value[L],H=z.value[L],z.offsetSrc++):z.boundTo==="faceVertices"&&(T=z.value[L+0],Y=z.value[L+1],H=z.value[L+2],z.offsetSrc+=3),z.size===2?(z.array[D+0]=T.x,z.array[D+1]=T.y,z.array[D+2]=Y.x,z.array[D+3]=Y.y,
|
|
|
-z.array[D+4]=H.x,z.array[D+5]=H.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[D+0]=T.r,z.array[D+1]=T.g,z.array[D+2]=T.b,z.array[D+3]=Y.r,z.array[D+4]=Y.g,z.array[D+5]=Y.b,z.array[D+6]=H.r,z.array[D+7]=H.g,z.array[D+8]=H.b):(z.array[D+0]=T.x,z.array[D+1]=T.y,z.array[D+2]=T.z,z.array[D+3]=Y.x,z.array[D+4]=Y.y,z.array[D+5]=Y.z,z.array[D+6]=H.x,z.array[D+7]=H.y,z.array[D+8]=H.z),z.offset+=9):(z.array[D+0]=T.x,z.array[D+1]=T.y,z.array[D+2]=T.z,z.array[D+3]=T.w,z.array[D+4]=Y.x,z.array[D+5]=Y.y,z.array[D+
|
|
|
-6]=Y.z,z.array[D+7]=Y.w,z.array[D+8]=H.x,z.array[D+9]=H.y,z.array[D+10]=H.z,z.array[D+11]=H.w,z.offset+=12));if(ya){D=0;for(L=za.length;D<L;D++)T=za[D].vertices[o.a].position,Y=za[D].vertices[o.b].position,H=za[D].vertices[o.c].position,z=ma[D],z[la+0]=T.x,z[la+1]=T.y,z[la+2]=T.z,z[la+3]=Y.x,z[la+4]=Y.y,z[la+5]=Y.z,z[la+6]=H.x,z[la+7]=H.y,z[la+8]=H.z;la+=9}if(Da.length)D=Da[o.a],L=Da[o.b],z=Da[o.c],ca[N]=D.x,ca[N+1]=D.y,ca[N+2]=D.z,ca[N+3]=D.w,ca[N+4]=L.x,ca[N+5]=L.y,ca[N+6]=L.z,ca[N+7]=L.w,ca[N+
|
|
|
-8]=z.x,ca[N+9]=z.y,ca[N+10]=z.z,ca[N+11]=z.w,D=La[o.a],L=La[o.b],z=La[o.c],aa[N]=D.x,aa[N+1]=D.y,aa[N+2]=D.z,aa[N+3]=D.w,aa[N+4]=L.x,aa[N+5]=L.y,aa[N+6]=L.z,aa[N+7]=L.w,aa[N+8]=z.x,aa[N+9]=z.y,aa[N+10]=z.z,aa[N+11]=z.w,D=Ja[o.a],L=Ja[o.b],z=Ja[o.c],ea[N]=D.x,ea[N+1]=D.y,ea[N+2]=D.z,ea[N+3]=1,ea[N+4]=L.x,ea[N+5]=L.y,ea[N+6]=L.z,ea[N+7]=1,ea[N+8]=z.x,ea[N+9]=z.y,ea[N+10]=z.z,ea[N+11]=1,D=Ka[o.a],L=Ka[o.b],z=Ka[o.c],oa[N]=D.x,oa[N+1]=D.y,oa[N+2]=D.z,oa[N+3]=1,oa[N+4]=L.x,oa[N+5]=L.y,oa[N+6]=L.z,oa[N+
|
|
|
-7]=1,oa[N+8]=z.x,oa[N+9]=z.y,oa[N+10]=z.z,oa[N+11]=1,N+=12;if(va&&C)v.length==3&&C==THREE.VertexColors?(o=v[0],D=v[1],L=v[2]):L=D=o=x,Z[Q]=o.r,Z[Q+1]=o.g,Z[Q+2]=o.b,Z[Q+3]=D.r,Z[Q+4]=D.g,Z[Q+5]=D.b,Z[Q+6]=L.r,Z[Q+7]=L.g,Z[Q+8]=L.b,Q+=9;if(Aa&&ja.hasTangents)v=w[0],x=w[1],o=w[2],W[X]=v.x,W[X+1]=v.y,W[X+2]=v.z,W[X+3]=v.w,W[X+4]=x.x,W[X+5]=x.y,W[X+6]=x.z,W[X+7]=x.w,W[X+8]=o.x,W[X+9]=o.y,W[X+10]=o.z,W[X+11]=o.w,X+=12;if(sa&&A)if(p.length==3&&pa)for(w=0;w<3;w++)u=p[w],fa[na]=u.x,fa[na+1]=u.y,fa[na+2]=
|
|
|
-u.z,na+=3;else for(w=0;w<3;w++)fa[na]=u.x,fa[na+1]=u.y,fa[na+2]=u.z,na+=3;if(qa&&F!==void 0&&y)for(w=0;w<3;w++)p=F[w],ga[U]=p.u,ga[U+1]=p.v,U+=2;if(qa&&I!==void 0&&y)for(w=0;w<3;w++)p=I[w],da[R]=p.u,da[R+1]=p.v,R+=2;ra&&(ha[P]=K,ha[P+1]=K+1,ha[P+2]=K+2,P+=3,ka[S]=K,ka[S+1]=K+1,ka[S+2]=K,ka[S+3]=K+2,ka[S+4]=K+1,ka[S+5]=K+2,S+=6,K+=3)}else if(o instanceof THREE.Face4){if(wa)T=ua[o.a].position,Y=ua[o.b].position,H=ua[o.c].position,G=ua[o.d].position,V[M]=T.x,V[M+1]=T.y,V[M+2]=T.z,V[M+3]=Y.x,V[M+4]=Y.y,
|
|
|
-V[M+5]=Y.z,V[M+6]=H.x,V[M+7]=H.y,V[M+8]=H.z,V[M+9]=G.x,V[M+10]=G.y,V[M+11]=G.z,M+=12;if(ia)for(O in ia)if(z=ia[O],z.__original.needsUpdate)D=z.offset,L=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[D+0]=z.value[o.a],z.array[D+1]=z.value[o.b],z.array[D+2]=z.value[o.c],z.array[D+3]=z.value[o.d]):z.boundTo==="faces"?(z.array[D+0]=z.value[L],z.array[D+1]=z.value[L],z.array[D+2]=z.value[L],z.array[D+3]=z.value[L],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[D+0]=z.value[L+
|
|
|
-0],z.array[D+1]=z.value[L+1],z.array[D+2]=z.value[L+2],z.array[D+3]=z.value[L+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(T=z.value[o.a],Y=z.value[o.b],H=z.value[o.c],G=z.value[o.d]):z.boundTo==="faces"?(T=z.value[L],Y=z.value[L],H=z.value[L],G=z.value[L],z.offsetSrc++):z.boundTo==="faceVertices"&&(T=z.value[L+0],Y=z.value[L+1],H=z.value[L+2],G=z.value[L+3],z.offsetSrc+=4),z.size===2?(z.array[D+0]=T.x,z.array[D+1]=T.y,z.array[D+2]=Y.x,z.array[D+3]=Y.y,z.array[D+4]=
|
|
|
-H.x,z.array[D+5]=H.y,z.array[D+6]=G.x,z.array[D+7]=G.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[D+0]=T.r,z.array[D+1]=T.g,z.array[D+2]=T.b,z.array[D+3]=Y.r,z.array[D+4]=Y.g,z.array[D+5]=Y.b,z.array[D+6]=H.r,z.array[D+7]=H.g,z.array[D+8]=H.b,z.array[D+9]=G.r,z.array[D+10]=G.g,z.array[D+11]=G.b):(z.array[D+0]=T.x,z.array[D+1]=T.y,z.array[D+2]=T.z,z.array[D+3]=Y.x,z.array[D+4]=Y.y,z.array[D+5]=Y.z,z.array[D+6]=H.x,z.array[D+7]=H.y,z.array[D+8]=H.z,z.array[D+9]=G.x,z.array[D+10]=G.y,z.array[D+11]=
|
|
|
-G.z),z.offset+=12):(z.array[D+0]=T.x,z.array[D+1]=T.y,z.array[D+2]=T.z,z.array[D+3]=T.w,z.array[D+4]=Y.x,z.array[D+5]=Y.y,z.array[D+6]=Y.z,z.array[D+7]=Y.w,z.array[D+8]=H.x,z.array[D+9]=H.y,z.array[D+10]=H.z,z.array[D+11]=H.w,z.array[D+12]=G.x,z.array[D+13]=G.y,z.array[D+14]=G.z,z.array[D+15]=G.w,z.offset+=16));if(ya){D=0;for(L=za.length;D<L;D++)T=za[D].vertices[o.a].position,Y=za[D].vertices[o.b].position,H=za[D].vertices[o.c].position,G=za[D].vertices[o.d].position,z=ma[D],z[la+0]=T.x,z[la+1]=T.y,
|
|
|
-z[la+2]=T.z,z[la+3]=Y.x,z[la+4]=Y.y,z[la+5]=Y.z,z[la+6]=H.x,z[la+7]=H.y,z[la+8]=H.z,z[la+9]=G.x,z[la+10]=G.y,z[la+11]=G.z;la+=12}if(Da.length)D=Da[o.a],L=Da[o.b],z=Da[o.c],J=Da[o.d],ca[N]=D.x,ca[N+1]=D.y,ca[N+2]=D.z,ca[N+3]=D.w,ca[N+4]=L.x,ca[N+5]=L.y,ca[N+6]=L.z,ca[N+7]=L.w,ca[N+8]=z.x,ca[N+9]=z.y,ca[N+10]=z.z,ca[N+11]=z.w,ca[N+12]=J.x,ca[N+13]=J.y,ca[N+14]=J.z,ca[N+15]=J.w,D=La[o.a],L=La[o.b],z=La[o.c],J=La[o.d],aa[N]=D.x,aa[N+1]=D.y,aa[N+2]=D.z,aa[N+3]=D.w,aa[N+4]=L.x,aa[N+5]=L.y,aa[N+6]=L.z,aa[N+
|
|
|
-7]=L.w,aa[N+8]=z.x,aa[N+9]=z.y,aa[N+10]=z.z,aa[N+11]=z.w,aa[N+12]=J.x,aa[N+13]=J.y,aa[N+14]=J.z,aa[N+15]=J.w,D=Ja[o.a],L=Ja[o.b],z=Ja[o.c],J=Ja[o.d],ea[N]=D.x,ea[N+1]=D.y,ea[N+2]=D.z,ea[N+3]=1,ea[N+4]=L.x,ea[N+5]=L.y,ea[N+6]=L.z,ea[N+7]=1,ea[N+8]=z.x,ea[N+9]=z.y,ea[N+10]=z.z,ea[N+11]=1,ea[N+12]=J.x,ea[N+13]=J.y,ea[N+14]=J.z,ea[N+15]=1,D=Ka[o.a],L=Ka[o.b],z=Ka[o.c],o=Ka[o.d],oa[N]=D.x,oa[N+1]=D.y,oa[N+2]=D.z,oa[N+3]=1,oa[N+4]=L.x,oa[N+5]=L.y,oa[N+6]=L.z,oa[N+7]=1,oa[N+8]=z.x,oa[N+9]=z.y,oa[N+10]=z.z,
|
|
|
-oa[N+11]=1,oa[N+12]=o.x,oa[N+13]=o.y,oa[N+14]=o.z,oa[N+15]=1,N+=16;if(va&&C)v.length==4&&C==THREE.VertexColors?(o=v[0],D=v[1],L=v[2],v=v[3]):v=L=D=o=x,Z[Q]=o.r,Z[Q+1]=o.g,Z[Q+2]=o.b,Z[Q+3]=D.r,Z[Q+4]=D.g,Z[Q+5]=D.b,Z[Q+6]=L.r,Z[Q+7]=L.g,Z[Q+8]=L.b,Z[Q+9]=v.r,Z[Q+10]=v.g,Z[Q+11]=v.b,Q+=12;if(Aa&&ja.hasTangents)v=w[0],x=w[1],o=w[2],w=w[3],W[X]=v.x,W[X+1]=v.y,W[X+2]=v.z,W[X+3]=v.w,W[X+4]=x.x,W[X+5]=x.y,W[X+6]=x.z,W[X+7]=x.w,W[X+8]=o.x,W[X+9]=o.y,W[X+10]=o.z,W[X+11]=o.w,W[X+12]=w.x,W[X+13]=w.y,W[X+14]=
|
|
|
-w.z,W[X+15]=w.w,X+=16;if(sa&&A)if(p.length==4&&pa)for(w=0;w<4;w++)u=p[w],fa[na]=u.x,fa[na+1]=u.y,fa[na+2]=u.z,na+=3;else for(w=0;w<4;w++)fa[na]=u.x,fa[na+1]=u.y,fa[na+2]=u.z,na+=3;if(qa&&F!==void 0&&y)for(w=0;w<4;w++)p=F[w],ga[U]=p.u,ga[U+1]=p.v,U+=2;if(qa&&I!==void 0&&y)for(w=0;w<4;w++)p=I[w],da[R]=p.u,da[R+1]=p.v,R+=2;ra&&(ha[P]=K,ha[P+1]=K+1,ha[P+2]=K+3,ha[P+3]=K+1,ha[P+4]=K+2,ha[P+5]=K+3,P+=6,ka[S]=K,ka[S+1]=K+1,ka[S+2]=K,ka[S+3]=K+3,ka[S+4]=K+1,ka[S+5]=K+2,ka[S+6]=K+2,ka[S+7]=K+3,S+=8,K+=4)}if(Ha){t=
|
|
|
-0;for(n=Ha.length;t<n;t++)ha[P]=Ha[t].a,ha[P+1]=Ha[t].b,ha[P+2]=Ha[t].c,ha[P+3]=Ha[t].a,ha[P+4]=Ha[t].c,ha[P+5]=Ha[t].d,P+=6}wa&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,V,m));if(ia)for(O in ia)z=ia[O],z.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,z.buffer),k.bufferData(k.ARRAY_BUFFER,z.array,m));if(ya){D=0;for(L=za.length;D<L;D++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[D]),k.bufferData(k.ARRAY_BUFFER,ma[D],m)}va&&Q>0&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
-g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,Z,m));sa&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m));Aa&&ja.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,W,m));qa&&U>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,ga,m));qa&&R>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,da,m));ra&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),
|
|
|
-k.bufferData(k.ELEMENT_ARRAY_BUFFER,ha,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ka,m));N>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,ea,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,oa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,aa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,
|
|
|
-ca,m));j.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;B(h)}else if(b instanceof THREE.Ribbon){f=
|
|
|
-b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;y=b.vertices;g=b.colors;C=y.length;j=g.length;A=b.__vertexArray;m=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(t=0;t<C;t++)n=y[t].position,h=t*3,A[h]=n.x,A[h+1]=n.y,A[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,A,e)}if(F){for(t=0;t<j;t++)color=g[t],h=t*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
|
|
|
-m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;y=b.vertices;g=b.colors;C=y.length;j=g.length;A=b.__vertexArray;m=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(t=0;t<C;t++)n=y[t].position,h=t*3,A[h]=n.x,A[h+1]=n.y,A[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,A,e)}if(F){for(t=0;t<j;t++)color=g[t],h=t*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;
|
|
|
-k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,g=E(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,B(f)}function F(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function A(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);
|
|
|
-return h.join("_")}var c,f,h,g,j,k,m,t,o={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),t=o[m].hash+"_"+o[m].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:k,vertices:0,numMorphTargets:n}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+j>65535&&(o[m].counter+=1,t=o[m].hash+"_"+o[m].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]=
|
|
|
-{faces:[],materials:k,vertices:0,numMorphTargets:n})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=j}function P(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(b){if(b!=ha){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);
|
|
|
-k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}ha=b}}function G(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,K(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,K(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,K(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,K(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,
|
|
|
-k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,Z(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,Z(e.minFilter)))}function U(b,e){if(b.needsUpdate)b.__webglInit?(k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image)):(b.__webglTexture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image),b.__webglInit=
|
|
|
-!0),G(k.TEXTURE_2D,b,b.image),k.bindTexture(k.TEXTURE_2D,null),b.needsUpdate=!1;k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function V(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,
|
|
|
-K(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,K(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,K(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,K(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,K(b.format),b.width,b.height,0,K(b.format),K(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&
|
|
|
-!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,
|
|
|
-null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=ca,b=T);e!=ga&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(aa,ma,c,b),ga=e)}function J(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function Z(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;
|
|
|
-default:return k.LINEAR}}function K(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;
|
|
|
+f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var E in m)if(t=g.uniforms[E])if(n=m[E],p=n.type,c=n.value,p=="i")k.uniform1i(t,c);else if(p=="f")k.uniform1f(t,c);else if(p=="fv1")k.uniform1fv(t,c);else if(p=="fv")k.uniform3fv(t,c);else if(p=="v2")k.uniform2f(t,c.x,c.y);else if(p=="v3")k.uniform3f(t,
|
|
|
+c.x,c.y,c.z);else if(p=="v4")k.uniform4f(t,c.x,c.y,c.z,c.w);else if(p=="m4"){if(!n._array)n._array=new Float32Array(16);c.flattenToArray(n._array);k.uniformMatrix4fv(t,!1,n._array)}else if(p=="c")k.uniform3f(t,c.r,c.g,c.b);else if(p=="t"&&(k.uniform1i(t,c),n=n.texture))if(n.image instanceof Array&&n.image.length==6){if(n.image.length==6){if(n.needsUpdate){if(n.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(p=0;p<6;++p)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,
|
|
|
+0,0,0,k.RGBA,k.UNSIGNED_BYTE,n.image[p])}else{n.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(p=0;p<6;++p)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[p]);n.__webglInit=!0}C(k.TEXTURE_CUBE_MAP,n,n.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else N(n,c);k.uniformMatrix4fv(h.modelViewMatrix,
|
|
|
+!1,j._modelViewMatrixArray);k.uniformMatrix3fv(h.normalMatrix,!1,j._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&h.cameraPosition!==null&&k.uniform3f(h.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&h.objectMatrix!==null&&k.uniformMatrix4fv(h.objectMatrix,!1,j._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof
|
|
|
+THREE.MeshShaderMaterial||f.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,!1,oa);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,k.uniform3fv(h.directionalLightDirection,b),k.uniformMatrix4fv(h.objectMatrix,!1,j._objectMatrixArray),k.uniformMatrix4fv(h.viewMatrix,!1,oa);f.skinning&&(k.uniformMatrix4fv(h.cameraInverseMatrix,!1,oa),k.uniformMatrix4fv(h.boneGlobalMatrices,!1,j.boneMatrices));
|
|
|
+return g}function f(b,c,f,j,g,h){if(j.opacity!=0){var m,b=e(b,c,f,j,h).attributes;if(!j.morphTargets&&b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else if(h.morphTargetBase){c=j.program.attributes;h.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[h.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.vertexAttribPointer(c.position,
|
|
|
+3,k.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length)for(var f=0,n=h.morphTargetForcedOrder,o=h.morphTargetInfluences;f<j.numSupportedMorphTargets&&f<n.length;)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[n[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[f]=o[n[f]],f++;else{var n=[],p=-1,t=0,o=h.morphTargetInfluences,u,v=o.length,f=0;for(h.morphTargetBase!==-1&&(n[h.morphTargetBase]=!0);f<j.numSupportedMorphTargets;){for(u=0;u<v;u++)!n[u]&&
|
|
|
+o[u]>p&&(t=u,p=o[t]);k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[t]);k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[f]=p;n[t]=1;p=-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(j.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(m in g.__webglCustomAttributes)b[m]>=0&&(c=g.__webglCustomAttributes[m],k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[m],c.size,
|
|
|
+k.FLOAT,!1,0,0));b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):
|
|
|
+k.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,
|
|
|
+4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));h instanceof THREE.Mesh?(j.wireframe?(k.lineWidth(j.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.drawElements(k.LINES,g.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.drawElements(k.TRIANGLES,
|
|
|
+g.__webglFaceCount,k.UNSIGNED_SHORT,0)),U.data.vertices+=g.__webglFaceCount,U.data.faces+=g.__webglFaceCount/3,U.data.drawCalls++):h instanceof THREE.Line?(h=h.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(j.linewidth),k.drawArrays(h,0,g.__webglLineCount),U.data.drawCalls++):h instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,g.__webglParticleCount),U.data.drawCalls++):h instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,g.__webglVertexCount),U.data.drawCalls++)}}function h(b,
|
|
|
+e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=k.createBuffer();b.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,g,j,h,m,n,o,p,t,u,v=b.count*3;for(u=
|
|
|
+0;u<v;u+=9)c=b.normalArray,f=c[u],g=c[u+1],j=c[u+2],h=c[u+3],n=c[u+4],p=c[u+5],m=c[u+6],o=c[u+7],t=c[u+8],f=(f+h+m)/3,g=(g+n+o)/3,j=(j+p+t)/3,c[u]=f,c[u+1]=g,c[u+2]=j,c[u+3]=f,c[u+4]=g,c[u+5]=j,c[u+6]=f,c[u+7]=g,c[u+8]=j}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function j(b){if(Y!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):
|
|
|
+k.enable(k.CULL_FACE),Y=b.doubleSided;if($!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),$=b.flipSided}function g(b){fa!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),fa=b)}function m(b,e,c){pa!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),pa=b);if(b&&(T!=e||ha!=c))k.polygonOffset(e,c),T=e,ha=c}function o(b){V[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);V[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);V[2].set(b.n41+b.n21,b.n42+
|
|
|
+b.n22,b.n43+b.n23,b.n44+b.n24);V[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);V[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);V[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=V[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=V[f].x*e.n14+V[f].y*e.n24+V[f].z*e.n34+V[f].w,b<=c)return!1;return!0}function n(b,
|
|
|
+e){b.list[b.count]=e;b.count+=1}function t(b){var e,c,f=b.object,g=b.opaque,j=b.transparent;j.count=0;b=g.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?n(j,c):n(g,c)}function v(b){var e,c,f,g,j=b.object,h=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=j.materials.length;b<f;b++)if(e=j.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=h.materials.length;e<c;e++)(g=h.materials[e])&&(g.transparent?n(m,g):n(k,g))}else(g=e)&&(g.transparent?n(m,g):n(k,
|
|
|
+g))}function u(b,e){return e.z-b.z}function w(b){k.enable(k.POLYGON_OFFSET_FILL);k.polygonOffset(0.1,1);k.enable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(!1);k.colorMask(!1,!1,!1,!1);k.stencilFunc(k.ALWAYS,1,255);k.stencilOpSeparate(k.BACK,k.KEEP,k.INCR,k.KEEP);k.stencilOpSeparate(k.FRONT,k.KEEP,k.DECR,k.KEEP);var e,c=b.lights.length,f,g=b.lights,j=[],h,m,n,o,p,t=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){j[0]=-f.position.x;
|
|
|
+j[1]=-f.position.y;j[2]=-f.position.z;for(p=0;p<t;p++)f=b.__webglShadowVolumes[p].object,h=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||U.initMaterial(m,g,void 0,f),m=m.program,n=m.uniforms,o=m.attributes,P!==m&&(k.useProgram(m),P=m,k.uniformMatrix4fv(n.projectionMatrix,!1,ma),k.uniformMatrix4fv(n.viewMatrix,!1,oa),k.uniform3fv(n.directionalLightDirection,j)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
+h.__webglVertexBuffer),k.vertexAttribPointer(o.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglNormalBuffer),k.vertexAttribPointer(o.normal,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,h.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,h.__webglFaceCount,k.UNSIGNED_SHORT,0)}k.disable(k.POLYGON_OFFSET_FILL);k.colorMask(!0,!0,!0,!0);k.stencilFunc(k.NOTEQUAL,0,255);k.stencilOp(k.KEEP,
|
|
|
+k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);fa=da=-1;P=ca.program;k.useProgram(ca.program);k.uniformMatrix4fv(ca.projectionLocation,!1,ma);k.uniform1f(ca.darknessLocation,ca.darkness);k.bindBuffer(k.ARRAY_BUFFER,ca.vertexBuffer);k.vertexAttribPointer(ca.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(ca.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.disable(k.STENCIL_TEST);
|
|
|
+k.enable(k.DEPTH_TEST);k.depthMask(ea)}function A(b,e){var c,f,g;c=R.attributes;var j=R.uniforms,h=J/ga,m,n=[],o=ga*0.5,p=J*0.5,t=!0;k.useProgram(R.program);P=R.program;fa=da=-1;la||(k.enableVertexAttribArray(R.attributes.position),k.enableVertexAttribArray(R.attributes.uv),la=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,R.vertexBuffer);k.vertexAttribPointer(c.position,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
|
|
|
+R.elementBuffer);k.uniformMatrix4fv(j.projectionMatrix,!1,ma);k.activeTexture(k.TEXTURE0);k.uniform1i(j.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?
|
|
|
+(k.uniform1i(j.useScreenCoordinates,1),k.uniform3f(j.screenPosition,(g.position.x-o)/o,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(k.uniform1i(j.useScreenCoordinates,0),k.uniform1i(j.affectedByDistance,g.affectedByDistance?1:0),k.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray)),m=g.map.image.width/(g.scaleByViewport?J:1),n[0]=m*h*g.scale.x,n[1]=m*g.scale.y,k.uniform2f(j.uvScale,g.uvScale.x,g.uvScale.y),k.uniform2f(j.uvOffset,g.uvOffset.x,g.uvOffset.y),k.uniform2f(j.alignment,
|
|
|
+g.alignment.x,g.alignment.y),k.uniform1f(j.opacity,g.opacity),k.uniform1f(j.rotation,g.rotation),k.uniform2fv(j.scale,n),g.mergeWith3D&&!t?(k.enable(k.DEPTH_TEST),t=!0):!g.mergeWith3D&&t&&(k.disable(k.DEPTH_TEST),t=!1),F(g.blending),N(g.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(ea)}function y(b,e){var c,f,g=b.__webglLensFlares.length,j,h,m,n=new THREE.Vector3,o=J/ga,p=ga*0.5,t=J*0.5,u=16/J,v=[u*o,u],w=[1,1,0],x=[1,1],y=S.uniforms;
|
|
|
+c=S.attributes;k.useProgram(S.program);P=S.program;fa=da=-1;ua||(k.enableVertexAttribArray(S.attributes.vertex),k.enableVertexAttribArray(S.attributes.uv),ua=!0);k.uniform1i(y.occlusionMap,0);k.uniform1i(y.map,1);k.bindBuffer(k.ARRAY_BUFFER,S.vertexBuffer);k.vertexAttribPointer(c.vertex,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,S.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,S.occlusionTexture);
|
|
|
+k.activeTexture(k.TEXTURE1);for(f=0;f<g;f++)if(c=b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),w[0]=n.x,w[1]=n.y,w[2]=n.z,x[0]=w[0]*p+p,x[1]=w[1]*t+t,S.hasVertexTexture||x[0]>0&&x[0]<ga&&x[1]>0&&x[1]<J){k.bindTexture(k.TEXTURE_2D,S.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,x[0]-8,x[1]-8,16,16,0);k.uniform1i(y.renderType,0);k.uniform2fv(y.scale,v);k.uniform3fv(y.screenPosition,
|
|
|
+w);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,S.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,x[0]-8,x[1]-8,16,16,0);k.uniform1i(y.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,S.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=w[0];c.positionScreen.y=w[1];c.positionScreen.z=w[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();k.uniform1i(y.renderType,
|
|
|
+2);k.enable(k.BLEND);j=0;for(h=c.lensFlares.length;j<h;j++)if(m=c.lensFlares[j],m.opacity>0.0010&&m.scale>0.0010)w[0]=m.x,w[1]=m.y,w[2]=m.z,u=m.size*m.scale/J,v[0]=u*o,v[1]=u,k.uniform3fv(y.screenPosition,w),k.uniform2fv(y.scale,v),k.uniform1f(y.rotation,m.rotation),k.uniform1f(y.opacity,m.opacity),F(m.blending),N(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(ea)}function x(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
|
|
|
+b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function I(b){var e,c,f,g;g=b.__materials;b=0;for(c=g.length;b<c;b++)if(f=g[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function B(b){var e,c,f,g;g=b.__materials;b=0;for(c=g.length;b<c;b++)if(f=g[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function E(b){var e,f,g,j;if(b instanceof THREE.Mesh){f=b.geometry;
|
|
|
+for(e in f.geometryGroups)if(g=f.geometryGroups[e],j=I(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||j){j=g;var h=b,m=k.DYNAMIC_DRAW;if(j.__inittedArrays){var n=void 0,o=void 0,p=void 0,t=void 0,u=p=void 0,v=void 0,w=void 0,x=void 0,y=void 0,A=void 0,F=void 0,G=void 0,H=void 0,J=void 0,E=void 0,C=void 0,V=void 0,D=t=x=t=w=v=void 0,M=void 0,z=M=D=v=void 0,K=void 0,P=z=M=D=p=p=u=x=t=z=M=D=K=z=M=D=K=z=M=D=void 0,N=
|
|
|
+0,L=0,T=0,S=0,Q=0,Y=0,ia=0,U=0,R=0,O=0,ma=0,M=D=0,W=j.__vertexArray,ca=j.__uvArray,ea=j.__uv2Array,aa=j.__normalArray,X=j.__tangentArray,Z=j.__colorArray,da=j.__skinVertexAArray,fa=j.__skinVertexBArray,$=j.__skinIndexArray,oa=j.__skinWeightArray,pa=j.__morphTargetsArrays,ka=j.__webglCustomAttributes,z=void 0,ha=j.__faceArray,ga=j.__lineArray,na=j.__needsSmoothNormals,A=j.__vertexColorType,y=j.__uvType,F=j.__normalType,la=h.geometry,wa=la.__dirtyVertices,ra=la.__dirtyElements,qa=la.__dirtyUvs,sa=la.__dirtyNormals,
|
|
|
+Aa=la.__dirtyTangents,va=la.__dirtyColors,ya=la.__dirtyMorphTargets,ua=la.vertices,Ba=j.faces,Ma=la.faces,Wa=la.faceVertexUvs[0],Xa=la.faceVertexUvs[1],Ja=la.skinVerticesA,Ka=la.skinVerticesB,La=la.skinIndices,Da=la.skinWeights,Ha=h instanceof THREE.ShadowVolume?la.edgeFaces:void 0,za=la.morphTargets;if(ka)for(P in ka)ka[P].offset=0,ka[P].offsetSrc=0;n=0;for(o=Ba.length;n<o;n++)if(p=Ba[n],t=Ma[p],Wa&&(G=Wa[p]),Xa&&(H=Xa[p]),p=t.vertexNormals,u=t.normal,v=t.vertexColors,w=t.color,x=t.vertexTangents,
|
|
|
+t instanceof THREE.Face3){if(wa)J=ua[t.a].position,E=ua[t.b].position,C=ua[t.c].position,W[L]=J.x,W[L+1]=J.y,W[L+2]=J.z,W[L+3]=E.x,W[L+4]=E.y,W[L+5]=E.z,W[L+6]=C.x,W[L+7]=C.y,W[L+8]=C.z,L+=9;if(ka)for(P in ka)if(z=ka[P],z.__original.needsUpdate)D=z.offset,M=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[D+0]=z.value[t.a],z.array[D+1]=z.value[t.b],z.array[D+2]=z.value[t.c]):z.boundTo==="faces"?(z.array[D+0]=z.value[M],z.array[D+1]=z.value[M],z.array[D+2]=z.value[M],z.offsetSrc++):
|
|
|
+z.boundTo==="faceVertices"&&(z.array[D+0]=z.value[M+0],z.array[D+1]=z.value[M+1],z.array[D+2]=z.value[M+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(J=z.value[t.a],E=z.value[t.b],C=z.value[t.c]):z.boundTo==="faces"?(J=z.value[M],E=z.value[M],C=z.value[M],z.offsetSrc++):z.boundTo==="faceVertices"&&(J=z.value[M+0],E=z.value[M+1],C=z.value[M+2],z.offsetSrc+=3),z.size===2?(z.array[D+0]=J.x,z.array[D+1]=J.y,z.array[D+2]=E.x,z.array[D+3]=E.y,z.array[D+4]=C.x,z.array[D+5]=
|
|
|
+C.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[D+0]=J.r,z.array[D+1]=J.g,z.array[D+2]=J.b,z.array[D+3]=E.r,z.array[D+4]=E.g,z.array[D+5]=E.b,z.array[D+6]=C.r,z.array[D+7]=C.g,z.array[D+8]=C.b):(z.array[D+0]=J.x,z.array[D+1]=J.y,z.array[D+2]=J.z,z.array[D+3]=E.x,z.array[D+4]=E.y,z.array[D+5]=E.z,z.array[D+6]=C.x,z.array[D+7]=C.y,z.array[D+8]=C.z),z.offset+=9):(z.array[D+0]=J.x,z.array[D+1]=J.y,z.array[D+2]=J.z,z.array[D+3]=J.w,z.array[D+4]=E.x,z.array[D+5]=E.y,z.array[D+6]=E.z,z.array[D+7]=E.w,
|
|
|
+z.array[D+8]=C.x,z.array[D+9]=C.y,z.array[D+10]=C.z,z.array[D+11]=C.w,z.offset+=12));if(ya){D=0;for(M=za.length;D<M;D++)J=za[D].vertices[t.a].position,E=za[D].vertices[t.b].position,C=za[D].vertices[t.c].position,z=pa[D],z[ma+0]=J.x,z[ma+1]=J.y,z[ma+2]=J.z,z[ma+3]=E.x,z[ma+4]=E.y,z[ma+5]=E.z,z[ma+6]=C.x,z[ma+7]=C.y,z[ma+8]=C.z;ma+=9}if(Da.length)D=Da[t.a],M=Da[t.b],z=Da[t.c],oa[O]=D.x,oa[O+1]=D.y,oa[O+2]=D.z,oa[O+3]=D.w,oa[O+4]=M.x,oa[O+5]=M.y,oa[O+6]=M.z,oa[O+7]=M.w,oa[O+8]=z.x,oa[O+9]=z.y,oa[O+
|
|
|
+10]=z.z,oa[O+11]=z.w,D=La[t.a],M=La[t.b],z=La[t.c],$[O]=D.x,$[O+1]=D.y,$[O+2]=D.z,$[O+3]=D.w,$[O+4]=M.x,$[O+5]=M.y,$[O+6]=M.z,$[O+7]=M.w,$[O+8]=z.x,$[O+9]=z.y,$[O+10]=z.z,$[O+11]=z.w,D=Ja[t.a],M=Ja[t.b],z=Ja[t.c],da[O]=D.x,da[O+1]=D.y,da[O+2]=D.z,da[O+3]=1,da[O+4]=M.x,da[O+5]=M.y,da[O+6]=M.z,da[O+7]=1,da[O+8]=z.x,da[O+9]=z.y,da[O+10]=z.z,da[O+11]=1,D=Ka[t.a],M=Ka[t.b],z=Ka[t.c],fa[O]=D.x,fa[O+1]=D.y,fa[O+2]=D.z,fa[O+3]=1,fa[O+4]=M.x,fa[O+5]=M.y,fa[O+6]=M.z,fa[O+7]=1,fa[O+8]=z.x,fa[O+9]=z.y,fa[O+10]=
|
|
|
+z.z,fa[O+11]=1,O+=12;if(va&&A)v.length==3&&A==THREE.VertexColors?(t=v[0],D=v[1],M=v[2]):M=D=t=w,Z[R]=t.r,Z[R+1]=t.g,Z[R+2]=t.b,Z[R+3]=D.r,Z[R+4]=D.g,Z[R+5]=D.b,Z[R+6]=M.r,Z[R+7]=M.g,Z[R+8]=M.b,R+=9;if(Aa&&la.hasTangents)v=x[0],w=x[1],t=x[2],X[ia]=v.x,X[ia+1]=v.y,X[ia+2]=v.z,X[ia+3]=v.w,X[ia+4]=w.x,X[ia+5]=w.y,X[ia+6]=w.z,X[ia+7]=w.w,X[ia+8]=t.x,X[ia+9]=t.y,X[ia+10]=t.z,X[ia+11]=t.w,ia+=12;if(sa&&F)if(p.length==3&&na)for(x=0;x<3;x++)u=p[x],aa[Y]=u.x,aa[Y+1]=u.y,aa[Y+2]=u.z,Y+=3;else for(x=0;x<3;x++)aa[Y]=
|
|
|
+u.x,aa[Y+1]=u.y,aa[Y+2]=u.z,Y+=3;if(qa&&G!==void 0&&y)for(x=0;x<3;x++)p=G[x],ca[T]=p.u,ca[T+1]=p.v,T+=2;if(qa&&H!==void 0&&y)for(x=0;x<3;x++)p=H[x],ea[S]=p.u,ea[S+1]=p.v,S+=2;ra&&(ha[Q]=N,ha[Q+1]=N+1,ha[Q+2]=N+2,Q+=3,ga[U]=N,ga[U+1]=N+1,ga[U+2]=N,ga[U+3]=N+2,ga[U+4]=N+1,ga[U+5]=N+2,U+=6,N+=3)}else if(t instanceof THREE.Face4){if(wa)J=ua[t.a].position,E=ua[t.b].position,C=ua[t.c].position,V=ua[t.d].position,W[L]=J.x,W[L+1]=J.y,W[L+2]=J.z,W[L+3]=E.x,W[L+4]=E.y,W[L+5]=E.z,W[L+6]=C.x,W[L+7]=C.y,W[L+8]=
|
|
|
+C.z,W[L+9]=V.x,W[L+10]=V.y,W[L+11]=V.z,L+=12;if(ka)for(P in ka)if(z=ka[P],z.__original.needsUpdate)D=z.offset,M=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[D+0]=z.value[t.a],z.array[D+1]=z.value[t.b],z.array[D+2]=z.value[t.c],z.array[D+3]=z.value[t.d]):z.boundTo==="faces"?(z.array[D+0]=z.value[M],z.array[D+1]=z.value[M],z.array[D+2]=z.value[M],z.array[D+3]=z.value[M],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[D+0]=z.value[M+0],z.array[D+1]=z.value[M+1],z.array[D+
|
|
|
+2]=z.value[M+2],z.array[D+3]=z.value[M+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(J=z.value[t.a],E=z.value[t.b],C=z.value[t.c],V=z.value[t.d]):z.boundTo==="faces"?(J=z.value[M],E=z.value[M],C=z.value[M],V=z.value[M],z.offsetSrc++):z.boundTo==="faceVertices"&&(J=z.value[M+0],E=z.value[M+1],C=z.value[M+2],V=z.value[M+3],z.offsetSrc+=4),z.size===2?(z.array[D+0]=J.x,z.array[D+1]=J.y,z.array[D+2]=E.x,z.array[D+3]=E.y,z.array[D+4]=C.x,z.array[D+5]=C.y,z.array[D+6]=V.x,
|
|
|
+z.array[D+7]=V.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[D+0]=J.r,z.array[D+1]=J.g,z.array[D+2]=J.b,z.array[D+3]=E.r,z.array[D+4]=E.g,z.array[D+5]=E.b,z.array[D+6]=C.r,z.array[D+7]=C.g,z.array[D+8]=C.b,z.array[D+9]=V.r,z.array[D+10]=V.g,z.array[D+11]=V.b):(z.array[D+0]=J.x,z.array[D+1]=J.y,z.array[D+2]=J.z,z.array[D+3]=E.x,z.array[D+4]=E.y,z.array[D+5]=E.z,z.array[D+6]=C.x,z.array[D+7]=C.y,z.array[D+8]=C.z,z.array[D+9]=V.x,z.array[D+10]=V.y,z.array[D+11]=V.z),z.offset+=12):(z.array[D+0]=J.x,
|
|
|
+z.array[D+1]=J.y,z.array[D+2]=J.z,z.array[D+3]=J.w,z.array[D+4]=E.x,z.array[D+5]=E.y,z.array[D+6]=E.z,z.array[D+7]=E.w,z.array[D+8]=C.x,z.array[D+9]=C.y,z.array[D+10]=C.z,z.array[D+11]=C.w,z.array[D+12]=V.x,z.array[D+13]=V.y,z.array[D+14]=V.z,z.array[D+15]=V.w,z.offset+=16));if(ya){D=0;for(M=za.length;D<M;D++)J=za[D].vertices[t.a].position,E=za[D].vertices[t.b].position,C=za[D].vertices[t.c].position,V=za[D].vertices[t.d].position,z=pa[D],z[ma+0]=J.x,z[ma+1]=J.y,z[ma+2]=J.z,z[ma+3]=E.x,z[ma+4]=E.y,
|
|
|
+z[ma+5]=E.z,z[ma+6]=C.x,z[ma+7]=C.y,z[ma+8]=C.z,z[ma+9]=V.x,z[ma+10]=V.y,z[ma+11]=V.z;ma+=12}if(Da.length)D=Da[t.a],M=Da[t.b],z=Da[t.c],K=Da[t.d],oa[O]=D.x,oa[O+1]=D.y,oa[O+2]=D.z,oa[O+3]=D.w,oa[O+4]=M.x,oa[O+5]=M.y,oa[O+6]=M.z,oa[O+7]=M.w,oa[O+8]=z.x,oa[O+9]=z.y,oa[O+10]=z.z,oa[O+11]=z.w,oa[O+12]=K.x,oa[O+13]=K.y,oa[O+14]=K.z,oa[O+15]=K.w,D=La[t.a],M=La[t.b],z=La[t.c],K=La[t.d],$[O]=D.x,$[O+1]=D.y,$[O+2]=D.z,$[O+3]=D.w,$[O+4]=M.x,$[O+5]=M.y,$[O+6]=M.z,$[O+7]=M.w,$[O+8]=z.x,$[O+9]=z.y,$[O+10]=z.z,
|
|
|
+$[O+11]=z.w,$[O+12]=K.x,$[O+13]=K.y,$[O+14]=K.z,$[O+15]=K.w,D=Ja[t.a],M=Ja[t.b],z=Ja[t.c],K=Ja[t.d],da[O]=D.x,da[O+1]=D.y,da[O+2]=D.z,da[O+3]=1,da[O+4]=M.x,da[O+5]=M.y,da[O+6]=M.z,da[O+7]=1,da[O+8]=z.x,da[O+9]=z.y,da[O+10]=z.z,da[O+11]=1,da[O+12]=K.x,da[O+13]=K.y,da[O+14]=K.z,da[O+15]=1,D=Ka[t.a],M=Ka[t.b],z=Ka[t.c],t=Ka[t.d],fa[O]=D.x,fa[O+1]=D.y,fa[O+2]=D.z,fa[O+3]=1,fa[O+4]=M.x,fa[O+5]=M.y,fa[O+6]=M.z,fa[O+7]=1,fa[O+8]=z.x,fa[O+9]=z.y,fa[O+10]=z.z,fa[O+11]=1,fa[O+12]=t.x,fa[O+13]=t.y,fa[O+14]=
|
|
|
+t.z,fa[O+15]=1,O+=16;if(va&&A)v.length==4&&A==THREE.VertexColors?(t=v[0],D=v[1],M=v[2],v=v[3]):v=M=D=t=w,Z[R]=t.r,Z[R+1]=t.g,Z[R+2]=t.b,Z[R+3]=D.r,Z[R+4]=D.g,Z[R+5]=D.b,Z[R+6]=M.r,Z[R+7]=M.g,Z[R+8]=M.b,Z[R+9]=v.r,Z[R+10]=v.g,Z[R+11]=v.b,R+=12;if(Aa&&la.hasTangents)v=x[0],w=x[1],t=x[2],x=x[3],X[ia]=v.x,X[ia+1]=v.y,X[ia+2]=v.z,X[ia+3]=v.w,X[ia+4]=w.x,X[ia+5]=w.y,X[ia+6]=w.z,X[ia+7]=w.w,X[ia+8]=t.x,X[ia+9]=t.y,X[ia+10]=t.z,X[ia+11]=t.w,X[ia+12]=x.x,X[ia+13]=x.y,X[ia+14]=x.z,X[ia+15]=x.w,ia+=16;if(sa&&
|
|
|
+F)if(p.length==4&&na)for(x=0;x<4;x++)u=p[x],aa[Y]=u.x,aa[Y+1]=u.y,aa[Y+2]=u.z,Y+=3;else for(x=0;x<4;x++)aa[Y]=u.x,aa[Y+1]=u.y,aa[Y+2]=u.z,Y+=3;if(qa&&G!==void 0&&y)for(x=0;x<4;x++)p=G[x],ca[T]=p.u,ca[T+1]=p.v,T+=2;if(qa&&H!==void 0&&y)for(x=0;x<4;x++)p=H[x],ea[S]=p.u,ea[S+1]=p.v,S+=2;ra&&(ha[Q]=N,ha[Q+1]=N+1,ha[Q+2]=N+3,ha[Q+3]=N+1,ha[Q+4]=N+2,ha[Q+5]=N+3,Q+=6,ga[U]=N,ga[U+1]=N+1,ga[U+2]=N,ga[U+3]=N+3,ga[U+4]=N+1,ga[U+5]=N+2,ga[U+6]=N+2,ga[U+7]=N+3,U+=8,N+=4)}if(Ha){n=0;for(o=Ha.length;n<o;n++)ha[Q]=
|
|
|
+Ha[n].a,ha[Q+1]=Ha[n].b,ha[Q+2]=Ha[n].c,ha[Q+3]=Ha[n].a,ha[Q+4]=Ha[n].c,ha[Q+5]=Ha[n].d,Q+=6}wa&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,W,m));if(ka)for(P in ka)z=ka[P],z.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,z.buffer),k.bufferData(k.ARRAY_BUFFER,z.array,m));if(ya){D=0;for(M=za.length;D<M;D++)k.bindBuffer(k.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[D]),k.bufferData(k.ARRAY_BUFFER,pa[D],m)}va&&R>0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglColorBuffer),
|
|
|
+k.bufferData(k.ARRAY_BUFFER,Z,m));sa&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,aa,m));Aa&&la.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,X,m));qa&&T>0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m));qa&&S>0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ea,m));ra&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,
|
|
|
+ha,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ga,m));O>0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,da,m),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,$,m),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,oa,m));h.dynamic||(delete j.__inittedArrays,
|
|
|
+delete j.__colorArray,delete j.__normalArray,delete j.__tangentArray,delete j.__uvArray,delete j.__uv2Array,delete j.__faceArray,delete j.__vertexArray,delete j.__lineArray,delete j.__skinVertexAArray,delete j.__skinVertexBArray,delete j.__skinIndexArray,delete j.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;B(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||
|
|
|
+f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;y=b.vertices;j=b.colors;A=y.length;h=j.length;F=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<A;n++)o=y[n].position,g=n*3,F[g]=o.x,F[g+1]=o.y,F[g+2]=o.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,F,e)}if(G){for(n=0;n<h;n++)color=j[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=
|
|
|
+!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;y=b.vertices;j=b.colors;A=y.length;h=j.length;F=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<A;n++)o=y[n].position,g=n*3,F[g]=o.x,F[g+1]=o.y,F[g+2]=o.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,F,e)}if(G){for(n=0;n<h;n++)color=j[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);
|
|
|
+k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,j=I(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||j)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,B(f)}function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function H(b){function e(b){var g=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,f,g,j,h,k,m,n,t={},o=b.morphTargets!==
|
|
|
+void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(j=b.faces.length;g<j;g++)h=b.faces[g],k=h.materials,m=e(k),t[m]==void 0&&(t[m]={hash:m,counter:0}),n=t[m].hash+"_"+t[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+h>65535&&(t[m].counter+=1,n=t[m].hash+"_"+t[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:o})),
|
|
|
+b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=h}function Q(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(b){if(b!=da){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,
|
|
|
+k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}da=b}}function C(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,L(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,L(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,L(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,L(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,
|
|
|
+k.TEXTURE_MAG_FILTER,X(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,X(e.minFilter)))}function N(b,e){if(b.needsUpdate)b.__webglInit?(k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image)):(b.__webglTexture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image),b.__webglInit=!0),C(k.TEXTURE_2D,b,b.image),k.bindTexture(k.TEXTURE_2D,null),b.needsUpdate=!1;k.activeTexture(k.TEXTURE0+
|
|
|
+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function W(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,L(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,L(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,
|
|
|
+L(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,L(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,L(b.format),b.width,b.height,0,L(b.format),L(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,
|
|
|
+k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,
|
|
|
+c=ga,b=J);e!=aa&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ka,na,c,b),aa=e)}function K(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function X(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;
|
|
|
+default:return k.LINEAR}}function L(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;
|
|
|
case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}
|
|
|
-var S=this,k,W=[],O=null,ga=null,fa=!0,X=null,ea=null,ha=null,ka=null,pa=null,R=null,ia=null,aa=0,ma=0,ca=0,T=0,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],na=new THREE.Matrix4,la=new Float32Array(16),oa=new Float32Array(16),wa=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
+var U=this,k,Z=[],P=null,aa=null,ea=!0,Y=null,$=null,da=null,fa=null,pa=null,T=null,ha=null,ka=0,na=0,ga=0,J=0,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ia=new THREE.Matrix4,ma=new Float32Array(16),oa=new Float32Array(16),wa=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
ya=b.stencil!==void 0?b.stencil:!0,Ma=b.antialias!==void 0?b.antialias:!1,sa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ra=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;try{if(!(k=va.getContext("experimental-webgl",{antialias:Ma,stencil:ya})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+
|
|
|
-" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(qa){console.error(qa)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(sa.r,sa.g,sa.b,ra);this.context=k;var Ba=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ya){var da={};da.vertices=new Float32Array(12);
|
|
|
-da.faces=new Uint16Array(6);da.darkness=0.5;da.vertices[0]=-20;da.vertices[1]=-20;da.vertices[2]=-1;da.vertices[3]=20;da.vertices[4]=-20;da.vertices[5]=-1;da.vertices[6]=20;da.vertices[7]=20;da.vertices[8]=-1;da.vertices[9]=-20;da.vertices[10]=20;da.vertices[11]=-1;da.faces[0]=0;da.faces[1]=1;da.faces[2]=2;da.faces[3]=0;da.faces[4]=2;da.faces[5]=3;da.vertexBuffer=k.createBuffer();da.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,da.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,da.vertices,
|
|
|
-k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,da.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,da.faces,k.STATIC_DRAW);da.program=k.createProgram();k.attachShader(da.program,J("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(da.program,J("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(da.program);da.vertexLocation=k.getAttribLocation(da.program,"position");da.projectionLocation=k.getUniformLocation(da.program,"projectionMatrix");da.darknessLocation=
|
|
|
-k.getUniformLocation(da.program,"darkness")}var M={};M.vertices=new Float32Array(16);M.faces=new Uint16Array(6);b=0;M.vertices[b++]=-1;M.vertices[b++]=-1;M.vertices[b++]=0;M.vertices[b++]=0;M.vertices[b++]=1;M.vertices[b++]=-1;M.vertices[b++]=1;M.vertices[b++]=0;M.vertices[b++]=1;M.vertices[b++]=1;M.vertices[b++]=1;M.vertices[b++]=1;M.vertices[b++]=-1;M.vertices[b++]=1;M.vertices[b++]=0;M.vertices[b++]=1;b=0;M.faces[b++]=0;M.faces[b++]=1;M.faces[b++]=2;M.faces[b++]=0;M.faces[b++]=2;M.faces[b++]=3;
|
|
|
-M.vertexBuffer=k.createBuffer();M.elementBuffer=k.createBuffer();M.tempTexture=k.createTexture();M.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,M.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,M.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,M.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,M.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,M.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,
|
|
|
-k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,M.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);
|
|
|
-k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(M.hasVertexTexture=!1,M.program=k.createProgram(),k.attachShader(M.program,J("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(M.program,J("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(M.hasVertexTexture=!0,M.program=k.createProgram(),k.attachShader(M.program,J("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(M.program,J("vertex",
|
|
|
-THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(M.program);M.attributes={};M.uniforms={};M.attributes.vertex=k.getAttribLocation(M.program,"position");M.attributes.uv=k.getAttribLocation(M.program,"UV");M.uniforms.renderType=k.getUniformLocation(M.program,"renderType");M.uniforms.map=k.getUniformLocation(M.program,"map");M.uniforms.occlusionMap=k.getUniformLocation(M.program,"occlusionMap");M.uniforms.opacity=k.getUniformLocation(M.program,"opacity");M.uniforms.scale=k.getUniformLocation(M.program,
|
|
|
-"scale");M.uniforms.rotation=k.getUniformLocation(M.program,"rotation");M.uniforms.screenPosition=k.getUniformLocation(M.program,"screenPosition");var ua=!1,Q={};Q.vertices=new Float32Array(16);Q.faces=new Uint16Array(6);b=0;Q.vertices[b++]=-1;Q.vertices[b++]=-1;Q.vertices[b++]=0;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=0;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=0;b=
|
|
|
-Q.vertices[b++]=0;Q.faces[b++]=0;Q.faces[b++]=1;Q.faces[b++]=2;Q.faces[b++]=0;Q.faces[b++]=2;Q.faces[b++]=3;Q.vertexBuffer=k.createBuffer();Q.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,Q.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Q.faces,k.STATIC_DRAW);Q.program=k.createProgram();k.attachShader(Q.program,J("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(Q.program,
|
|
|
-J("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.position=k.getAttribLocation(Q.program,"position");Q.attributes.uv=k.getAttribLocation(Q.program,"uv");Q.uniforms.uvOffset=k.getUniformLocation(Q.program,"uvOffset");Q.uniforms.uvScale=k.getUniformLocation(Q.program,"uvScale");Q.uniforms.rotation=k.getUniformLocation(Q.program,"rotation");Q.uniforms.scale=k.getUniformLocation(Q.program,"scale");Q.uniforms.alignment=k.getUniformLocation(Q.program,
|
|
|
-"alignment");Q.uniforms.map=k.getUniformLocation(Q.program,"map");Q.uniforms.opacity=k.getUniformLocation(Q.program,"opacity");Q.uniforms.useScreenCoordinates=k.getUniformLocation(Q.program,"useScreenCoordinates");Q.uniforms.affectedByDistance=k.getUniformLocation(Q.program,"affectedByDistance");Q.uniforms.screenPosition=k.getUniformLocation(Q.program,"screenPosition");Q.uniforms.modelViewMatrix=k.getUniformLocation(Q.program,"modelViewMatrix");Q.uniforms.projectionMatrix=k.getUniformLocation(Q.program,
|
|
|
-"projectionMatrix");var ja=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){aa=b;ma=e;ca=c;T=f;k.viewport(aa,ma,ca,T)};this.setScissor=function(b,e,c,f){k.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){fa=b;k.depthMask(b)};this.setClearColorHex=function(b,e){sa.setHex(b);ra=e;k.clearColor(sa.r,sa.g,sa.b,ra)};this.setClearColor=
|
|
|
-function(b,e){sa.copy(b);ra=e;k.clearColor(sa.r,sa.g,sa.b,ra)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){da.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,e,c,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":
|
|
|
-b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var m=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var t,o,n;t=n=m=0;for(o=e.length;t<o;t++)g=e[t],g instanceof THREE.DirectionalLight&&n++,g instanceof THREE.PointLight&&m++;m+n<=4?e=n:(e=Math.ceil(4*
|
|
|
-n/(m+n)),m=4-e);g={directional:e,point:m};n=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)n=f.bones.length;var p;a:{t=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:n},u;g=[];j?g.push(j):(g.push(t),g.push(o));for(u in c)g.push(u),
|
|
|
-g.push(c[u]);j=g.join();u=0;for(g=W.length;u<g;u++)if(W[u].code==j){p=W[u].program;break a}u=k.createProgram();g=[Ba?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":
|
|
|
+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(qa){console.error(qa)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(sa.r,sa.g,sa.b,ra);this.context=k;var Ba=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ya){var ca={};ca.vertices=new Float32Array(12);
|
|
|
+ca.faces=new Uint16Array(6);ca.darkness=0.5;ca.vertices[0]=-20;ca.vertices[1]=-20;ca.vertices[2]=-1;ca.vertices[3]=20;ca.vertices[4]=-20;ca.vertices[5]=-1;ca.vertices[6]=20;ca.vertices[7]=20;ca.vertices[8]=-1;ca.vertices[9]=-20;ca.vertices[10]=20;ca.vertices[11]=-1;ca.faces[0]=0;ca.faces[1]=1;ca.faces[2]=2;ca.faces[3]=0;ca.faces[4]=2;ca.faces[5]=3;ca.vertexBuffer=k.createBuffer();ca.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,ca.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,ca.vertices,
|
|
|
+k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ca.faces,k.STATIC_DRAW);ca.program=k.createProgram();k.attachShader(ca.program,K("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(ca.program,K("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(ca.program);ca.vertexLocation=k.getAttribLocation(ca.program,"position");ca.projectionLocation=k.getUniformLocation(ca.program,"projectionMatrix");ca.darknessLocation=
|
|
|
+k.getUniformLocation(ca.program,"darkness")}var S={};S.vertices=new Float32Array(16);S.faces=new Uint16Array(6);b=0;S.vertices[b++]=-1;S.vertices[b++]=-1;S.vertices[b++]=0;S.vertices[b++]=0;S.vertices[b++]=1;S.vertices[b++]=-1;S.vertices[b++]=1;S.vertices[b++]=0;S.vertices[b++]=1;S.vertices[b++]=1;S.vertices[b++]=1;S.vertices[b++]=1;S.vertices[b++]=-1;S.vertices[b++]=1;S.vertices[b++]=0;S.vertices[b++]=1;b=0;S.faces[b++]=0;S.faces[b++]=1;S.faces[b++]=2;S.faces[b++]=0;S.faces[b++]=2;S.faces[b++]=3;
|
|
|
+S.vertexBuffer=k.createBuffer();S.elementBuffer=k.createBuffer();S.tempTexture=k.createTexture();S.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,S.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,S.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,S.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,S.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,S.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,
|
|
|
+k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,S.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);
|
|
|
+k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(S.hasVertexTexture=!1,S.program=k.createProgram(),k.attachShader(S.program,K("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(S.program,K("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(S.hasVertexTexture=!0,S.program=k.createProgram(),k.attachShader(S.program,K("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(S.program,K("vertex",
|
|
|
+THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(S.program);S.attributes={};S.uniforms={};S.attributes.vertex=k.getAttribLocation(S.program,"position");S.attributes.uv=k.getAttribLocation(S.program,"UV");S.uniforms.renderType=k.getUniformLocation(S.program,"renderType");S.uniforms.map=k.getUniformLocation(S.program,"map");S.uniforms.occlusionMap=k.getUniformLocation(S.program,"occlusionMap");S.uniforms.opacity=k.getUniformLocation(S.program,"opacity");S.uniforms.scale=k.getUniformLocation(S.program,
|
|
|
+"scale");S.uniforms.rotation=k.getUniformLocation(S.program,"rotation");S.uniforms.screenPosition=k.getUniformLocation(S.program,"screenPosition");var ua=!1,R={};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);b=0;R.vertices[b++]=-1;R.vertices[b++]=-1;R.vertices[b++]=0;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=-1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=0;R.vertices[b++]=-1;R.vertices[b++]=1;R.vertices[b++]=0;b=
|
|
|
+R.vertices[b++]=0;R.faces[b++]=0;R.faces[b++]=1;R.faces[b++]=2;R.faces[b++]=0;R.faces[b++]=2;R.faces[b++]=3;R.vertexBuffer=k.createBuffer();R.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,R.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,R.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,R.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,R.faces,k.STATIC_DRAW);R.program=k.createProgram();k.attachShader(R.program,K("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(R.program,
|
|
|
+K("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(R.program);R.attributes={};R.uniforms={};R.attributes.position=k.getAttribLocation(R.program,"position");R.attributes.uv=k.getAttribLocation(R.program,"uv");R.uniforms.uvOffset=k.getUniformLocation(R.program,"uvOffset");R.uniforms.uvScale=k.getUniformLocation(R.program,"uvScale");R.uniforms.rotation=k.getUniformLocation(R.program,"rotation");R.uniforms.scale=k.getUniformLocation(R.program,"scale");R.uniforms.alignment=k.getUniformLocation(R.program,
|
|
|
+"alignment");R.uniforms.map=k.getUniformLocation(R.program,"map");R.uniforms.opacity=k.getUniformLocation(R.program,"opacity");R.uniforms.useScreenCoordinates=k.getUniformLocation(R.program,"useScreenCoordinates");R.uniforms.affectedByDistance=k.getUniformLocation(R.program,"affectedByDistance");R.uniforms.screenPosition=k.getUniformLocation(R.program,"screenPosition");R.uniforms.modelViewMatrix=k.getUniformLocation(R.program,"modelViewMatrix");R.uniforms.projectionMatrix=k.getUniformLocation(R.program,
|
|
|
+"projectionMatrix");var la=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){ka=b;na=e;ga=c;J=f;k.viewport(ka,na,ga,J)};this.setScissor=function(b,e,c,f){k.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ea=b;k.depthMask(b)};this.setClearColorHex=function(b,e){sa.setHex(b);ra=e;k.clearColor(sa.r,sa.g,sa.b,ra)};this.setClearColor=
|
|
|
+function(b,e){sa.copy(b);ra=e;k.clearColor(sa.r,sa.g,sa.b,ra)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){ca.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,e,c,f){var g,j,h;b instanceof THREE.MeshDepthMaterial?h="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?h="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?h="normal":b instanceof THREE.MeshBasicMaterial?h="basic":
|
|
|
+b instanceof THREE.MeshLambertMaterial?h="lambert":b instanceof THREE.MeshPhongMaterial?h="phong":b instanceof THREE.LineBasicMaterial?h="basic":b instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var m=THREE.ShaderLib[h];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,t,o;n=o=m=0;for(t=e.length;n<t;n++)j=e[n],j instanceof THREE.DirectionalLight&&o++,j instanceof THREE.PointLight&&m++;m+o<=4?e=o:(e=Math.ceil(4*
|
|
|
+o/(m+o)),m=4-e);j={directional:e,point:m};o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var p;a:{n=b.fragmentShader;t=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:o},u;j=[];h?j.push(h):(j.push(n),j.push(t));for(u in c)j.push(u),
|
|
|
+j.push(c[u]);h=j.join();u=0;for(j=Z.length;u<j;u++)if(Z[u].code==h){p=Z[u].program;break a}u=k.createProgram();j=[Ba?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":
|
|
|
"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-n=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",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":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(u,J("fragment",n+t));k.attachShader(u,J("vertex",g+o));k.linkProgram(u);
|
|
|
-k.getProgramParameter(u,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(u,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");u.uniforms={};u.attributes={};var v;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)t.push(v);v=t;m=0;for(t=v.length;m<t;m++)o=v[m],u.uniforms[o]=k.getUniformLocation(u,o);t=["position","normal",
|
|
|
-"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)t.push("morphTarget"+v);for(p in e)t.push(p);p=t;v=0;for(e=p.length;v<e;v++)c=p[v],u.attributes[c]=k.getAttribLocation(u,c);W.push({program:u,code:j});p=u}b.program=p;p=b.program.attributes;p.position>=0&&k.enableVertexAttribArray(p.position);p.color>=0&&k.enableVertexAttribArray(p.color);p.normal>=0&&k.enableVertexAttribArray(p.normal);p.tangent>=0&&k.enableVertexAttribArray(p.tangent);
|
|
|
-b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(k.enableVertexAttribArray(p.skinVertexA),k.enableVertexAttribArray(p.skinVertexB),k.enableVertexAttribArray(p.skinIndex),k.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&k.enableVertexAttribArray(p[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(k.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(k.enableVertexAttribArray(p.morphTarget1),
|
|
|
+o=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",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":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(u,K("fragment",o+n));k.attachShader(u,K("vertex",j+t));k.linkProgram(u);
|
|
|
+k.getProgramParameter(u,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(u,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");u.uniforms={};u.attributes={};var v;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)n.push(v);v=n;m=0;for(n=v.length;m<n;m++)t=v[m],u.uniforms[t]=k.getUniformLocation(u,t);n=["position","normal",
|
|
|
+"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)n.push("morphTarget"+v);for(p in e)n.push(p);p=n;v=0;for(e=p.length;v<e;v++)c=p[v],u.attributes[c]=k.getAttribLocation(u,c);Z.push({program:u,code:h});p=u}b.program=p;p=b.program.attributes;p.position>=0&&k.enableVertexAttribArray(p.position);p.color>=0&&k.enableVertexAttribArray(p.color);p.normal>=0&&k.enableVertexAttribArray(p.normal);p.tangent>=0&&k.enableVertexAttribArray(p.tangent);
|
|
|
+b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(k.enableVertexAttribArray(p.skinVertexA),k.enableVertexAttribArray(p.skinVertexB),k.enableVertexAttribArray(p.skinIndex),k.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&k.enableVertexAttribArray(p[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(k.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(k.enableVertexAttribArray(p.morphTarget1),
|
|
|
b.numSupportedMorphTargets++);p.morphTarget2>=0&&(k.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(k.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(k.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(k.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>=0&&(k.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=
|
|
|
-0&&(k.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b<h;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,B){var A,T,F,E,I,Y,G,J,K=b.lights,M=b.fog;S.data.vertices=0;S.data.faces=0;S.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(oa);c.projectionMatrix.flattenToArray(la);na.multiply(c.projectionMatrix,
|
|
|
-c.matrixWorldInverse);n(na);this.initWebGLObjects(b);V(o);(this.autoClear||B)&&this.clear();I=b.__webglObjects.length;for(B=0;B<I;B++)if(A=b.__webglObjects[B],G=A.object,G.visible)if(!(G instanceof THREE.Mesh)||p(G)){if(G.matrixWorld.flattenToArray(G._objectMatrixArray),C(G,c),u(A),A.render=!0,this.sortObjects)A.object.renderDepth?A.z=A.object.renderDepth:(wa.copy(G.position),na.multiplyVector3(wa),A.z=wa.z)}else A.render=!1;else A.render=!1;this.sortObjects&&b.__webglObjects.sort(v);Y=b.__webglObjectsImmediate.length;
|
|
|
-for(B=0;B<Y;B++)A=b.__webglObjectsImmediate[B],G=A.object,G.visible&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),C(G,c),t(A));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);H(b.overrideMaterial.blending);for(B=0;B<I;B++)if(A=b.__webglObjects[B],A.render)G=A.object,J=A.buffer,j(G),f(c,K,M,b.overrideMaterial,J,G);for(B=0;B<Y;B++)A=b.__webglObjectsImmediate[B],G=A.object,G.visible&&(j(G),T=e(c,K,M,b.overrideMaterial,G),G.render(function(e){g(e,T,b.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);
|
|
|
-for(B=0;B<I;B++)if(A=b.__webglObjects[B],A.render){G=A.object;J=A.buffer;F=A.opaque;j(G);for(A=0;A<F.count;A++)E=F.list[A],h(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,K,M,E,J,G)}for(B=0;B<Y;B++)if(A=b.__webglObjectsImmediate[B],G=A.object,G.visible){F=A.opaque;j(G);for(A=0;A<F.count;A++)E=F.list[A],h(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),T=e(c,K,M,E,G),G.render(function(b){g(b,T,E.shading)})}for(B=0;B<I;B++)if(A=b.__webglObjects[B],
|
|
|
-A.render){G=A.object;J=A.buffer;F=A.transparent;j(G);for(A=0;A<F.count;A++)E=F.list[A],H(E.blending),h(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,K,M,E,J,G)}for(B=0;B<Y;B++)if(A=b.__webglObjectsImmediate[B],G=A.object,G.visible){F=A.transparent;j(G);for(A=0;A<F.count;A++)E=F.list[A],H(E.blending),h(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),T=e(c,K,M,E,G),G.render(function(b){g(b,T,E.shading)})}}b.__webglSprites.length&&w(b,c);ya&&
|
|
|
-b.__webglShadowVolumes.length&&b.lights.length&&x(b);b.__webglLensFlares.length&&y(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
|
-c=b,f=void 0,h=void 0,g=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups==void 0&&A(h),h.geometryGroups){g=h.geometryGroups[f];if(!g.__webglVertexBuffer){var j=g;j.__webglVertexBuffer=k.createBuffer();j.__webglNormalBuffer=k.createBuffer();
|
|
|
-j.__webglTangentBuffer=k.createBuffer();j.__webglColorBuffer=k.createBuffer();j.__webglUVBuffer=k.createBuffer();j.__webglUV2Buffer=k.createBuffer();j.__webglSkinVertexABuffer=k.createBuffer();j.__webglSkinVertexBBuffer=k.createBuffer();j.__webglSkinIndicesBuffer=k.createBuffer();j.__webglSkinWeightsBuffer=k.createBuffer();j.__webglFaceBuffer=k.createBuffer();j.__webglLineBuffer=k.createBuffer();if(j.numMorphTargets){var m=void 0,t=void 0;j.__webglMorphTargetsBuffers=[];m=0;for(t=j.numMorphTargets;m<
|
|
|
-t;m++)j.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var j=g,m=e,o=void 0,p=void 0,n=void 0,u=n=void 0,v=void 0,x=void 0,w=x=t=0,y=n=p=void 0,C=y=p=o=void 0,n=void 0,u=m.geometry,v=u.faces,y=j.faces,o=0,p=y.length;o<p;o++)n=y[o],n=v[n],n instanceof THREE.Face3?(t+=3,x+=1,w+=3):n instanceof THREE.Face4&&(t+=4,x+=2,w+=4);for(var o=j,p=m,B=y=v=void 0,T=void 0,B=void 0,n=[],v=0,y=p.materials.length;v<y;v++)if(B=p.materials[v],B instanceof THREE.MeshFaceMaterial){B=0;for(l=o.materials.length;B<
|
|
|
-l;B++)(T=o.materials[B])&&n.push(T)}else(T=B)&&n.push(T);o=n;j.__materials=o;a:{v=p=void 0;y=o.length;for(p=0;p<y;p++)if(v=o[p],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{y=v=void 0;n=o.length;for(v=0;v<n;v++)if(y=o[v],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{n=v=void 0;B=o.length;for(v=0;v<B;v++)if(n=o[v],
|
|
|
-n.vertexColors){n=n.vertexColors;break a}n=!1}j.__vertexArray=new Float32Array(t*3);if(y)j.__normalArray=new Float32Array(t*3);if(u.hasTangents)j.__tangentArray=new Float32Array(t*4);if(n)j.__colorArray=new Float32Array(t*3);if(p){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(t*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(t*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(t*4),
|
|
|
-j.__skinVertexBArray=new Float32Array(t*4),j.__skinIndexArray=new Float32Array(t*4),j.__skinWeightArray=new Float32Array(t*4);j.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(w*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(v=j.numMorphTargets;u<v;u++)j.__morphTargetsArrays.push(new Float32Array(t*3))}j.__needsSmoothNormals=y==THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=n;j.__normalType=y;j.__webglFaceCount=
|
|
|
-x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);j.__webglLineCount=w*2;u=0;for(v=o.length;u<v;u++)if(p=o[u],p.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in p.attributes){n=p.attributes[a];y={};for(C in n)y[C]=n[C];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,x=1,y.type==="v2"?x=2:y.type==="v3"?x=3:y.type==="v4"?x=4:y.type==="c"&&(x=3),y.size=x,y.array=new Float32Array(t*x),y.buffer=k.createBuffer(),y.buffer.belongsToAttribute=
|
|
|
-a,n.needsUpdate=!0,y.__original=n;j.__webglCustomAttributes[a]=y}}j.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}e instanceof THREE.ShadowVolume?P(c.__webglShadowVolumes,g,e):P(c.__webglObjects,g,e)}else if(e instanceof THREE.LensFlare)P(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=k.createBuffer(),
|
|
|
-f.__webglColorBuffer=k.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglVertexCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;P(c.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglLineCount=g,h.__dirtyVertices=
|
|
|
-!0,h.__dirtyColors=!0;P(c.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;if(!h.__webglVertexBuffer){f=h;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=h;g=e;j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__colorArray=new Float32Array(j*3);f.__sortArray=[];f.__webglParticleCount=j;f.__materials=g.materials;C=t=m=void 0;m=0;for(t=g.materials.length;m<t;m++)if(C=g.materials[m],C.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes=
|
|
|
-{};for(a in C.attributes){originalAttribute=C.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(j*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=
|
|
|
-a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}P(c.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof
|
|
|
-THREE.ShadowVolume)F(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)F(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==c&&e.splice(h,1)}else c instanceof THREE.LensFlare?F(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&F(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)I(b.__webglObjects[e].object,
|
|
|
-b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)I(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)I(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Ba}};
|
|
|
+0&&(k.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,n,B){var J,E,G,C,I,H,V,K,N=b.lights,L=b.fog;U.data.vertices=0;U.data.faces=0;U.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(oa);c.projectionMatrix.flattenToArray(ma);ia.multiply(c.projectionMatrix,
|
|
|
+c.matrixWorldInverse);o(ia);this.initWebGLObjects(b);W(n);(this.autoClear||B)&&this.clear();I=b.__webglObjects.length;for(B=0;B<I;B++)if(J=b.__webglObjects[B],V=J.object,V.visible)if(!(V instanceof THREE.Mesh)||p(V)){if(V.matrixWorld.flattenToArray(V._objectMatrixArray),x(V,c),v(J),J.render=!0,this.sortObjects)J.object.renderDepth?J.z=J.object.renderDepth:(wa.copy(V.position),ia.multiplyVector3(wa),J.z=wa.z)}else J.render=!1;else J.render=!1;this.sortObjects&&b.__webglObjects.sort(u);H=b.__webglObjectsImmediate.length;
|
|
|
+for(B=0;B<H;B++)J=b.__webglObjectsImmediate[B],V=J.object,V.visible&&(V.matrixAutoUpdate&&V.matrixWorld.flattenToArray(V._objectMatrixArray),x(V,c),t(J));if(b.overrideMaterial){g(b.overrideMaterial.depthTest);F(b.overrideMaterial.blending);for(B=0;B<I;B++)if(J=b.__webglObjects[B],J.render)V=J.object,K=J.buffer,j(V),f(c,N,L,b.overrideMaterial,K,V);for(B=0;B<H;B++)J=b.__webglObjectsImmediate[B],V=J.object,V.visible&&(j(V),E=e(c,N,L,b.overrideMaterial,V),V.render(function(e){h(e,E,b.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);
|
|
|
+for(B=0;B<I;B++)if(J=b.__webglObjects[B],J.render){V=J.object;K=J.buffer;G=J.opaque;j(V);for(J=0;J<G.count;J++)C=G.list[J],g(C.depthTest),m(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,N,L,C,K,V)}for(B=0;B<H;B++)if(J=b.__webglObjectsImmediate[B],V=J.object,V.visible){G=J.opaque;j(V);for(J=0;J<G.count;J++)C=G.list[J],g(C.depthTest),m(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),E=e(c,N,L,C,V),V.render(function(b){h(b,E,C.shading)})}for(B=0;B<I;B++)if(J=b.__webglObjects[B],
|
|
|
+J.render){V=J.object;K=J.buffer;G=J.transparent;j(V);for(J=0;J<G.count;J++)C=G.list[J],F(C.blending),g(C.depthTest),m(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,N,L,C,K,V)}for(B=0;B<H;B++)if(J=b.__webglObjectsImmediate[B],V=J.object,V.visible){G=J.transparent;j(V);for(J=0;J<G.count;J++)C=G.list[J],F(C.blending),g(C.depthTest),m(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),E=e(c,N,L,C,V),V.render(function(b){h(b,E,C.shading)})}}b.__webglSprites.length&&A(b,c);ya&&
|
|
|
+b.__webglShadowVolumes.length&&b.lights.length&&w(b);b.__webglLensFlares.length&&y(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,n.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
|
+c=b,f=void 0,g=void 0,j=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&H(g),g.geometryGroups){j=g.geometryGroups[f];if(!j.__webglVertexBuffer){var h=j;h.__webglVertexBuffer=k.createBuffer();h.__webglNormalBuffer=k.createBuffer();
|
|
|
+h.__webglTangentBuffer=k.createBuffer();h.__webglColorBuffer=k.createBuffer();h.__webglUVBuffer=k.createBuffer();h.__webglUV2Buffer=k.createBuffer();h.__webglSkinVertexABuffer=k.createBuffer();h.__webglSkinVertexBBuffer=k.createBuffer();h.__webglSkinIndicesBuffer=k.createBuffer();h.__webglSkinWeightsBuffer=k.createBuffer();h.__webglFaceBuffer=k.createBuffer();h.__webglLineBuffer=k.createBuffer();if(h.numMorphTargets){var m=void 0,n=void 0;h.__webglMorphTargetsBuffers=[];m=0;for(n=h.numMorphTargets;m<
|
|
|
+n;m++)h.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var h=j,m=e,p=void 0,t=void 0,o=void 0,u=o=void 0,v=void 0,x=void 0,w=x=n=0,y=o=t=void 0,A=y=t=p=void 0,o=void 0,u=m.geometry,v=u.faces,y=h.faces,p=0,t=y.length;p<t;p++)o=y[p],o=v[o],o instanceof THREE.Face3?(n+=3,x+=1,w+=3):o instanceof THREE.Face4&&(n+=4,x+=2,w+=4);for(var p=h,t=m,J=y=v=void 0,B=void 0,J=void 0,o=[],v=0,y=t.materials.length;v<y;v++)if(J=t.materials[v],J instanceof THREE.MeshFaceMaterial){J=0;for(l=p.materials.length;J<
|
|
|
+l;J++)(B=p.materials[J])&&o.push(B)}else(B=J)&&o.push(B);p=o;h.__materials=p;a:{v=t=void 0;y=p.length;for(t=0;t<y;t++)if(v=p[t],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){t=!0;break a}t=!1}a:{y=v=void 0;o=p.length;for(v=0;v<o;v++)if(y=p[v],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{o=v=void 0;J=p.length;for(v=0;v<J;v++)if(o=p[v],
|
|
|
+o.vertexColors){o=o.vertexColors;break a}o=!1}h.__vertexArray=new Float32Array(n*3);if(y)h.__normalArray=new Float32Array(n*3);if(u.hasTangents)h.__tangentArray=new Float32Array(n*4);if(o)h.__colorArray=new Float32Array(n*3);if(t){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)h.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)h.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)h.__skinVertexAArray=new Float32Array(n*4),
|
|
|
+h.__skinVertexBArray=new Float32Array(n*4),h.__skinIndexArray=new Float32Array(n*4),h.__skinWeightArray=new Float32Array(n*4);h.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));h.__lineArray=new Uint16Array(w*2);if(h.numMorphTargets){h.__morphTargetsArrays=[];u=0;for(v=h.numMorphTargets;u<v;u++)h.__morphTargetsArrays.push(new Float32Array(n*3))}h.__needsSmoothNormals=y==THREE.SmoothShading;h.__uvType=t;h.__vertexColorType=o;h.__normalType=y;h.__webglFaceCount=
|
|
|
+x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);h.__webglLineCount=w*2;u=0;for(v=p.length;u<v;u++)if(t=p[u],t.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in t.attributes){o=t.attributes[a];y={};for(A in o)y[A]=o[A];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,x=1,y.type==="v2"?x=2:y.type==="v3"?x=3:y.type==="v4"?x=4:y.type==="c"&&(x=3),y.size=x,y.array=new Float32Array(n*x),y.buffer=k.createBuffer(),y.buffer.belongsToAttribute=
|
|
|
+a,o.needsUpdate=!0,y.__original=o;h.__webglCustomAttributes[a]=y}}h.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?Q(c.__webglShadowVolumes,j,e):Q(c.__webglObjects,j,e)}else if(e instanceof THREE.LensFlare)Q(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),
|
|
|
+f.__webglColorBuffer=k.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglVertexCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglLineCount=j,g.__dirtyVertices=
|
|
|
+!0,g.__dirtyColors=!0;Q(c.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=g;j=e;h=f.vertices.length;f.__vertexArray=new Float32Array(h*3);f.__colorArray=new Float32Array(h*3);f.__sortArray=[];f.__webglParticleCount=h;f.__materials=j.materials;A=n=m=void 0;m=0;for(n=j.materials.length;m<n;m++)if(A=j.materials[m],A.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes=
|
|
|
+{};for(a in A.attributes){originalAttribute=A.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(h*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=
|
|
|
+a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}Q(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof
|
|
|
+THREE.ShadowVolume)G(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)G(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof THREE.LensFlare?G(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&G(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)E(b.__webglObjects[e].object,
|
|
|
+b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)E(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)E(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Ba}};
|
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
|
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
|
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
|
|
|
-THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,j=Math.max(Math.max(e,f),g),h=Math.min(Math.min(e,f),g);if(h==j)h=e=0;else{var m=j-h,h=m/j,e=e==j?(f-g)/m:f==j?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=j;return c},
|
|
|
+THREE.ColorUtils={adjustHSV:function(b,c,e,f){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,h);h.h=THREE.ColorUtils.clamp(h.h+c,0,1);h.s=THREE.ColorUtils.clamp(h.s+e,0,1);h.v=THREE.ColorUtils.clamp(h.v+f,0,1);b.setHSV(h.h,h.s,h.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,h=b.b,j=Math.max(Math.max(e,f),h),g=Math.min(Math.min(e,f),h);if(g==j)g=e=0;else{var m=j-g,g=m/j,e=e==j?(f-h)/m:f==j?2+(h-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=g;c.v=j;return c},
|
|
|
clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,j=b.vertices,h=g.vertices,m=b.faces,n=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,t=h.length;o<t;o++){var u=new THREE.Vertex(h[o].position.clone());e&&c.matrix.multiplyVector3(u.position);j.push(u)}o=0;for(t=n.length;o<t;o++){var h=n[o],v,x,w=h.vertexNormals,u=h.vertexColors;h instanceof THREE.Face3?v=new THREE.Face3(h.a+f,h.b+f,h.c+
|
|
|
-f):h instanceof THREE.Face4&&(v=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));v.normal.copy(h.normal);e=0;for(j=w.length;e<j;e++)x=w[e],v.vertexNormals.push(x.clone());v.color.copy(h.color);e=0;for(j=u.length;e<j;e++)x=u[e],v.vertexColors.push(x.clone());v.materials=h.materials.slice();v.centroid.copy(h.centroid);m.push(v)}o=0;for(t=g.length;o<t;o++){f=g[o];m=[];e=0;for(j=f.length;e<j;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,g=b.faces,
|
|
|
-j=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var h=new THREE.Vertex(f[b].position.clone());c.vertices.push(h)}b=0;for(e=g.length;b<e;b++){var m=g[b],n,p,o=m.vertexNormals,t=m.vertexColors;m instanceof THREE.Face3?n=new THREE.Face3(m.a,m.b,m.c):m instanceof THREE.Face4&&(n=new THREE.Face4(m.a,m.b,m.c,m.d));n.normal.copy(m.normal);f=0;for(h=o.length;f<h;f++)p=o[f],n.vertexNormals.push(p.clone());n.color.copy(m.color);f=0;for(h=t.length;f<h;f++)p=t[f],n.vertexColors.push(p.clone());n.materials=m.materials.slice();
|
|
|
-n.centroid.copy(m.centroid);c.faces.push(n)}b=0;for(e=j.length;b<e;b++){g=j[b];n=[];f=0;for(h=g.length;f<h;f++)n.push(new THREE.UV(g[f].u,g[f].v));c.faceVertexUvs[0].push(n)}return c}};
|
|
|
-THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],j=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)j.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return j}};
|
|
|
-THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
|
|
|
+THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,h=e?c.geometry:c,j=b.vertices,g=h.vertices,m=b.faces,o=h.faces,p=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,t=g.length;n<t;n++){var v=new THREE.Vertex(g[n].position.clone());e&&c.matrix.multiplyVector3(v.position);j.push(v)}n=0;for(t=o.length;n<t;n++){var g=o[n],u,w,A=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?u=new THREE.Face3(g.a+f,g.b+f,g.c+
|
|
|
+f):g instanceof THREE.Face4&&(u=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));u.normal.copy(g.normal);e=0;for(j=A.length;e<j;e++)w=A[e],u.vertexNormals.push(w.clone());u.color.copy(g.color);e=0;for(j=v.length;e<j;e++)w=v[e],u.vertexColors.push(w.clone());u.materials=g.materials.slice();u.centroid.copy(g.centroid);m.push(u)}n=0;for(t=h.length;n<t;n++){f=h[n];m=[];e=0;for(j=f.length;e<j;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,
|
|
|
+j=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var g=new THREE.Vertex(f[b].position.clone());c.vertices.push(g)}b=0;for(e=h.length;b<e;b++){var m=h[b],o,p,n=m.vertexNormals,t=m.vertexColors;m instanceof THREE.Face3?o=new THREE.Face3(m.a,m.b,m.c):m instanceof THREE.Face4&&(o=new THREE.Face4(m.a,m.b,m.c,m.d));o.normal.copy(m.normal);f=0;for(g=n.length;f<g;f++)p=n[f],o.vertexNormals.push(p.clone());o.color.copy(m.color);f=0;for(g=t.length;f<g;f++)p=t[f],o.vertexColors.push(p.clone());o.materials=m.materials.slice();
|
|
|
+o.centroid.copy(m.centroid);c.faces.push(o)}b=0;for(e=j.length;b<e;b++){h=j[b];o=[];f=0;for(g=h.length;f<g;f++)o.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(o)}return c}};
|
|
|
+THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,h=new THREE.Texture(f,c);f.onload=function(){h.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return h},loadTextureCube:function(b,c,e){var f,h=[],j=new THREE.Texture(h,c),c=h.loadCount=0;for(f=b.length;c<f;++c)h[c]=new Image,h[c].onload=function(){h.loadCount+=1;if(h.loadCount==6)j.needsUpdate=!0;e&&e(this)},h[c].crossOrigin="",h[c].src=b[c];return j}};
|
|
|
+THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,h=b.children.length;for(f=0;f<h;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
|
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
|
|
|
value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30},uOpacity:{type:"f",value:1}}]),fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;",
|
|
@@ -360,23 +360,23 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
|
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
|
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,j=2*Math.ceil(b*3)+1;j>25&&(j=25);g=(j-1)*0.5;e=Array(j);for(c=f=0;c<j;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<j;++c)e[c]/=f;return e}};
|
|
|
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,h,j=2*Math.ceil(b*3)+1;j>25&&(j=25);h=(j-1)*0.5;e=Array(j);for(c=f=0;c<j;++c)e[c]=Math.exp(-((c-h)*(c-h))/(2*b*b)),f+=e[c];for(c=0;c<j;++c)e[c]/=f;return e}};
|
|
|
THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
|
|
|
-0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++){var p=b.hierarchy[e].keys[f].morphTargets[n];m[p]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var o=
|
|
|
-{};for(p in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===p){o[p]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(o[p]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=o}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
|
|
|
+0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++){var p=b.hierarchy[e].keys[f].morphTargets[o];m[p]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var n=
|
|
|
+{};for(p in m){for(o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++)if(b.hierarchy[e].keys[f].morphTargets[o]===p){n[p]=b.hierarchy[e].keys[f].morphTargetsInfluences[o];break}o===b.hierarchy[e].keys[f].morphTargets.length&&(n[p]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=n}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
|
|
|
b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
|
|
|
2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
-THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
|
|
|
-THREE.Bone?g.skinMatrix:g.matrix;var j=g.animationCache.prevKey;g=g.animationCache.nextKey;j.pos=this.data.hierarchy[e].keys[0];j.rot=this.data.hierarchy[e].keys[0];j.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
+THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,h;for(e=0;e<f;e++){h=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)h.useQuaternion=!0;h.matrixAutoUpdate=!0;if(h.animationCache===void 0)h.animationCache={},h.animationCache.prevKey={pos:0,rot:0,scl:0},h.animationCache.nextKey={pos:0,rot:0,scl:0},h.animationCache.originalMatrix=h instanceof
|
|
|
+THREE.Bone?h.skinMatrix:h.matrix;var j=h.animationCache.prevKey;h=h.animationCache.nextKey;j.pos=this.data.hierarchy[e].keys[0];j.rot=this.data.hierarchy[e].keys[0];j.scl=this.data.hierarchy[e].keys[0];h.pos=this.getNextKeyWith("pos",e,1);h.rot=this.getNextKeyWith("rot",e,1);h.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
|
|
|
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,j,h,m,n,p,o=this.data.JIT.hierarchy,t,u;this.currentTime+=b*this.timeScale;u=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,x=this.hierarchy.length;v<x;v++)if(b=this.hierarchy[v],n=b.animationCache,this.JITCompile&&o[v][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[v][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
-!1):(b.matrix=o[v][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var w=0;w<3;w++){e=c[w];h=n.prevKey[e];m=n.nextKey[e];if(m.time<=u){if(t<u)if(this.loop){h=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<t;)h=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do h=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
|
|
|
-t)}n.prevKey[e]=h;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-h.time)/(m.time-h.time);g=h[e];j=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
-this.getPrevKeyWith("pos",v,h.index-1).pos,this.points[1]=g,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
|
|
|
-"rot")THREE.Quaternion.slerp(g,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)o[v][p]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,j,h,m,n,p;g=(b.length-1)*c;j=Math.floor(g);g-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(j[0],m[0],n[0],p[0],g,e,h);f[1]=this.interpolate(j[1],m[1],n[1],p[1],g,e,h);f[2]=this.interpolate(j[2],m[2],n[2],p[2],g,e,h);return f};
|
|
|
-THREE.Animation.prototype.interpolate=function(b,c,e,f,g,j,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*j+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
|
|
|
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,j,g,m,o,p,n=this.data.JIT.hierarchy,t,v;this.currentTime+=b*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,w=this.hierarchy.length;u<w;u++)if(b=this.hierarchy[u],o=b.animationCache,this.JITCompile&&n[u][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=n[u][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
+!1):(b.matrix=n[u][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var A=0;A<3;A++){e=c[A];g=o.prevKey[e];m=o.nextKey[e];if(m.time<=v){if(t<v)if(this.loop){g=this.data.hierarchy[u].keys[0];for(m=this.getNextKeyWith(e,u,1);m.time<t;)g=m,m=this.getNextKeyWith(e,u,m.index+1)}else{this.stop();return}else{do g=m,m=this.getNextKeyWith(e,u,m.index+1);while(m.time<
|
|
|
+t)}o.prevKey[e]=g;o.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-g.time)/(m.time-g.time);h=g[e];j=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(j[0]-h[0])*f,e.y=h[1]+(j[1]-h[1])*f,e.z=h[2]+(j[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",u,g.index-1).pos,this.points[1]=h,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",u,m.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
|
|
|
+"rot")THREE.Quaternion.slerp(h,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(j[0]-h[0])*f,e.y=h[1]+(j[1]-h[1])*f,e.z=h[2]+(j[2]-h[2])*f}}if(this.JITCompile&&n[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][p]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,j,g,m,o,p;h=(b.length-1)*c;j=Math.floor(h);h-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];m=b[e[1]];o=b[e[2]];p=b[e[3]];e=h*h;g=h*e;f[0]=this.interpolate(j[0],m[0],o[0],p[0],h,e,g);f[1]=this.interpolate(j[1],m[1],o[1],p[1],h,e,g);f[2]=this.interpolate(j[2],m[2],o[2],p[2],h,e,g);return f};
|
|
|
+THREE.Animation.prototype.interpolate=function(b,c,e,f,h,j,g){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*g+(-3*(c-e)-2*b-f)*j+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
|
|
|
THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
|
|
|
b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
|
|
@@ -384,182 +384,181 @@ void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this
|
|
|
b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.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(b){switch(b.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=!1;break;case 70:this.moveDown=!1}};this.update=
|
|
|
function(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.translateZ(c);this.moveLeft&&this.translateX(-c);
|
|
|
-this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown&&this.translateY(-c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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 b=this.target.position,g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=
|
|
|
-this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",
|
|
|
+this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown&&this.translateY(-c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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 b=this.target.position,h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=
|
|
|
+this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",
|
|
|
function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;
|
|
|
THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
|
|
|
-THREE.PathCamera=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},g,j=e.getControlPointsArray(),m=e.getLength(),n=j.length,E=0;g=n-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[g]={time:f,pos:j[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<n-1;g++)E=f*m.chunks[g]/m.total,e.keys[g]={time:E,pos:j[g]};h.hierarchy[0]=e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
|
|
|
-f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
|
|
|
-16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
|
|
|
+THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},j,h=e.getControlPointsArray(),m=e.getLength(),o=h.length,I=0;j=o-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[j]={time:f,pos:h[j],rot:[0,0,0,1],scl:[1,1,1]};for(j=1;j<o-1;j++)I=f*m.chunks[j]/m.total,e.keys[j]={time:I,pos:h[j]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
|
|
|
+f,g=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),g.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),j=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,j);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);g=new THREE.SphereGeometry(1,
|
|
|
+16,8);j=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,j),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
|
|
|
this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
|
|
|
void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
|
|
|
-window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,j=Math.PI/180;this.update=function(b,e,c){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*j;this.theta=this.lon*j;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var m=h[1]-h[0];this.phi=
|
|
|
-TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/m)*m+h[0];f=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;m=h[1]-h[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/m)*m+h[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX=
|
|
|
-b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),n=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(n,h);b.position.set(0,10,0);this.animation=
|
|
|
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var h=Math.PI*2,j=Math.PI/180;this.update=function(b,e,c){var f,g;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*j;this.theta=this.lon*j;f=this.phi%h;this.phi=f>=0?f:f+h;f=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var m=g[1]-g[0];this.phi=
|
|
|
+TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g[0])/m)*m+g[0];f=this.horizontalAngleMap.srcRange;g=this.horizontalAngleMap.dstRange;m=g[1]-g[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g[0])/m)*m+g[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX=
|
|
|
+b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),g=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),o=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(o,g);b.position.set(0,10,0);this.animation=
|
|
|
c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),
|
|
|
!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
|
THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
|
|
|
b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
|
|
|
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
|
|
|
this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
|
|
|
-case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,j=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
|
|
|
+case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),h=c.size[0]/2,j=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-h)/h;this.moveState.pitchDown=(b.clientY-
|
|
|
c.offset[1]-j)/j;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*
|
|
|
this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
|
|
|
this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
|
|
|
document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
|
|
|
this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
-THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,t=0,u=0,v=0,x=0,w=window.innerWidth/2,y=window.innerHeight/2;this.update=
|
|
|
-function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*t);this.translateY(b*u);n&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
|
|
|
-else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);j.set(0,1,0);g.cross(j,h).normalize();j.cross(h,g).normalize();this.matrix.n11=g.x;this.matrix.n12=j.x;this.matrix.n13=h.x;this.matrix.n21=g.y;this.matrix.n22=j.y;this.matrix.n23=h.y;this.matrix.n31=g.z;this.matrix.n32=j.z;this.matrix.n33=h.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
|
|
|
+THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,j=new THREE.Vector3,g=new THREE.Vector3,m=new THREE.Matrix4,o=!1,p=1,n=0,t=0,v=0,u=0,w=0,A=window.innerWidth/2,y=window.innerHeight/2;this.update=
|
|
|
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*t);this.translateY(b*v);o&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
|
|
|
+else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);j.set(0,1,0);h.cross(j,g).normalize();j.cross(g,h).normalize();this.matrix.n11=h.x;this.matrix.n12=j.x;this.matrix.n13=g.x;this.matrix.n21=h.y;this.matrix.n22=j.y;this.matrix.n23=g.y;this.matrix.n31=h.z;this.matrix.n32=j.z;this.matrix.n33=g.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
|
|
|
this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
|
|
|
-this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){j.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);j.multiplyScalar(b);this.forward.addSelf(j);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
-function(b){v=(b.clientX-w)/window.innerWidth;x=(b.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:t=-1;break;
|
|
|
-case 40:case 83:o=-1;break;case 39:case 68:t=1;break;case 81:n=!0;p=1;break;case 69:n=!0;p=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:t=0;break;case 40:case 83:o=0;break;case 39:case 68:t=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:u=0;break;case 70:u=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
|
+this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){h.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);h.multiplyScalar(b);this.forward.subSelf(h);this.forward.normalize()};this.rotateVertically=function(b){j.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);j.multiplyScalar(b);this.forward.addSelf(j);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
+function(b){u=(b.clientX-A)/window.innerWidth;w=(b.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:t=-1;break;
|
|
|
+case 40:case 83:n=-1;break;case 39:case 68:t=1;break;case 81:o=!0;p=1;break;case 69:o=!0;p=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:t=0;break;case 40:case 83:n=0;break;case 39:case 68:t=0;break;case 81:o=!1;break;case 69:o=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
THREE.TrackballCamera=function(b){function c(b,e){return function(){e.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
|
|
|
-!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-
|
|
|
-this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-e)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(g).setLength(c.x));f.addSelf(g.setLength(c.z));return f};
|
|
|
-this.rotateCamera=function(){var b=Math.acos(j.dot(h)/j.length()/h.length());if(b){var e=(new THREE.Vector3).cross(j,h).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(g);c.multiplyVector3(this.up);c.multiplyVector3(h);this.staticMoving?j=h:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(j))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};
|
|
|
-this.panCamera=function(){var b=o.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var e=g.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?p=o:p.addSelf(b.sub(o,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
|
|
|
-g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,e,c){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,e,c)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
-c(this,function(b){e&&(j=h=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),p=o=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
|
|
|
-b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?j=h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
|
|
|
+!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,h=new THREE.Vector3,j=new THREE.Vector3,g=new THREE.Vector3,m=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-
|
|
|
+this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-e)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);h=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(h).setLength(c.x));f.addSelf(h.setLength(c.z));return f};
|
|
|
+this.rotateCamera=function(){var b=Math.acos(j.dot(g)/j.length()/g.length());if(b){var e=(new THREE.Vector3).cross(j,g).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(h);c.multiplyVector3(this.up);c.multiplyVector3(g);this.staticMoving?j=g:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(j))}};this.zoomCamera=function(){var b=1+(o.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b),this.staticMoving?m=o:m.y+=(o.y-m.y)*this.dynamicDampingFactor)};
|
|
|
+this.panCamera=function(){var b=n.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var e=h.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?p=n:p.addSelf(b.sub(n,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
|
|
|
+h.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,h.setLength(this.minDistance))};this.update=function(b,e,c){h=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,h);this.checkDistances();this.supr.update.call(this,b,e,c)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
+c(this,function(b){e&&(j=g=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=o=this.getMouseOnScreen(b.clientX,b.clientY),p=n=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?g=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?o=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(n=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
|
|
|
+b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?j=g=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=o=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=n=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
|
|
|
this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPoint(c/b));return e};
|
|
|
-THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e};THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheLengths&&this.cacheLengths.length==b)return this.cacheLengths;var c=[],e,f=this.getPoint(0),g,j=0;for(g=1;g<=b;g++)e=this.getPoint(g/b),j+=e.distanceTo(f),c.push(j),f=e;return this.cacheLengths=c};
|
|
|
-THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,g=e.length,j;for(j=c?c:b*e[g-1];f<g;){if(e[f]>j)break;f++}return f/g};THREE.LineCurve=function(b,c,e,f){this.x1=b;this.y1=c;this.x2=e;this.y2=f};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){return new THREE.Vector2(this.x1+(this.x2-this.x1)*b,this.y1+(this.y2-this.y1)*b)};
|
|
|
-THREE.QuadraticBezierCurve=function(b,c,e,f,g,j){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=j};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b2(b,this.x0,this.x1,this.x2);b=THREE.FontUtils.b2(b,this.y0,this.y1,this.y2);return new THREE.Vector2(c,b)};
|
|
|
-THREE.QuadraticBezierCurve.prototype.getNormalVector=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.x0,this.x1,this.x2);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.y0,this.y1,this.y2);return(new THREE.Vector2(-b,c)).unit()};THREE.CubicBezierCurve=function(b,c,e,f,g,j,h,m){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=j;this.x3=h;this.y3=m};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
|
|
|
-THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b3(b,this.x0,this.x1,this.x2,this.x3);b=THREE.FontUtils.b3(b,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(c,b)};THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
|
|
|
-THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,g;g=(f.length-1)*b;b=Math.floor(g);g-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,g);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,g);return c};THREE.ArcCurve=function(b,c,e,f,g,j){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=g;this.aClockwise=j};
|
|
|
+THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e};THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheLengths&&this.cacheLengths.length==b)return this.cacheLengths;var c=[],e,f=this.getPoint(0),h,j=0;for(h=1;h<=b;h++)e=this.getPoint(h/b),j+=e.distanceTo(f),c.push(j),f=e;return this.cacheLengths=c};
|
|
|
+THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,h=e.length,j;for(j=c?c:b*e[h-1];f<h;){if(e[f]>j)break;f++}return f/h};THREE.LineCurve=function(b,c,e,f){this.x1=b;this.y1=c;this.x2=e;this.y2=f};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){return new THREE.Vector2(this.x1+(this.x2-this.x1)*b,this.y1+(this.y2-this.y1)*b)};
|
|
|
+THREE.QuadraticBezierCurve=function(b,c,e,f,h,j){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=h;this.y2=j};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b2(b,this.x0,this.x1,this.x2);b=THREE.Shape.Utils.b2(b,this.y0,this.y1,this.y2);return new THREE.Vector2(c,b)};
|
|
|
+THREE.QuadraticBezierCurve.prototype.getNormalVector=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.x0,this.x1,this.x2);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.y0,this.y1,this.y2);return(new THREE.Vector2(-b,c)).unit()};THREE.CubicBezierCurve=function(b,c,e,f,h,j,g,m){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=h;this.y2=j;this.x3=g;this.y3=m};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
|
|
|
+THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b3(b,this.x0,this.x1,this.x2,this.x3);b=THREE.Shape.Utils.b3(b,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(c,b)};THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
|
|
|
+THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,h;h=(f.length-1)*b;b=Math.floor(h);h-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,h);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,h);return c};THREE.ArcCurve=function(b,c,e,f,h,j){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=h;this.aClockwise=j};
|
|
|
THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(b=1-b);b=this.aStartAngle+b*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(b),this.aY+this.aRadius*Math.sin(b))};
|
|
|
-THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentSpline:function(){},interpolate:function(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,j=g*g;return(2*c-2*e+b+f)*g*j+(-3*c+3*e-2*b-f)*j+b*g+c}};THREE.Path=function(b){this.actions=[];this.curves=[];b&&this.fromPoints(b)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};
|
|
|
-THREE.Path.prototype.fromPoints=function(b){this.moveTo(b[0].x,b[0].y);var c,e=b.length;for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};
|
|
|
+THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentSpline:function(){},interpolate:function(b,c,e,f,h){var b=(e-b)*0.5,f=(f-c)*0.5,j=h*h;return(2*c-2*e+b+f)*h*j+(-3*c+3*e-2*b-f)*j+b*h+c}};THREE.Curve.create=function(b,c){b.prototype=new THREE.Curve;b.prototype.constructor=b;b.prototype.getPoint=c;return b};
|
|
|
+THREE.LineCurve3=THREE.Curve.create(function(b,c,e,f,h,j){this.x1=b;this.y1=c;this.z1=e;this.x2=f;this.y2=h;this.z2=j},function(b){return new THREE.Vector3(this.x1+(this.x2-this.x1)*b,this.y1+(this.y2-this.y1)*b,this.z1+(this.z2-this.z1)*b)});
|
|
|
+THREE.QuadraticBezierCurve3=THREE.Curve.create(function(b,c,e,f,h,j,g,m,o){this.x0=b;this.y0=c;this.z0=e;this.x1=f;this.y1=h;this.z1=j;this.x2=g;this.y2=m;this.z2=o},function(b){var c,e;c=THREE.Shape.Utils.b2(b,this.x0,this.x1,this.x2);e=THREE.Shape.Utils.b2(b,this.y0,this.y1,this.y2);b=THREE.Shape.Utils.b2(b,this.z0,this.z1,this.z2);return new THREE.Vector2(c,e,b)});THREE.Path=function(b){this.actions=[];this.curves=[];b&&this.fromPoints(b)};
|
|
|
+THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(b){this.moveTo(b[0].x,b[0].y);var c,e=b.length;for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};
|
|
|
THREE.Path.prototype.lineTo=function(b,c){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.LineCurve(f[f.length-2],f[f.length-1],b,c);this.curves.push(f);this.actions.push({action:THREE.PathActions.LINE_TO,args:e,curve:f})};
|
|
|
-THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var g=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args,j=new THREE.QuadraticBezierCurve(j[j.length-2],j[j.length-1],b,c,e,f);this.curves.push(j);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g,curve:j})};
|
|
|
-THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,g,j){var h=Array.prototype.slice.call(arguments),m=this.actions[this.actions.length-1].args,m=new THREE.CubicBezierCurve(m[m.length-2],m[m.length-1],b,c,e,f,g,j);this.curves.push(m);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:h,curve:m})};
|
|
|
+THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var h=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args,j=new THREE.QuadraticBezierCurve(j[j.length-2],j[j.length-1],b,c,e,f);this.curves.push(j);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:h,curve:j})};
|
|
|
+THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,h,j){var g=Array.prototype.slice.call(arguments),m=this.actions[this.actions.length-1].args,m=new THREE.CubicBezierCurve(m[m.length-2],m[m.length-1],b,c,e,f,h,j);this.curves.push(m);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g,curve:m})};
|
|
|
THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])],e=e.concat(b),e=new THREE.SplineCurve(e);this.curves.push(e);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c,curve:e})};
|
|
|
-THREE.Path.prototype.arc=function(b,c,e,f,g,j){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,j));this.actions.push({action:THREE.PathActions.ARC,args:h})};THREE.Path.prototype.getSpacedPoints=function(b,c){b||(b=40);for(var e=[],f=0;f<b;f++)e.push(this.getPoint(f/b));c&&e.push(e[0]);return e};
|
|
|
-THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,g,j,h,m,n,p,o,t,u,v,x,w;f=0;for(g=this.actions.length;f<g;f++)switch(j=this.actions[f],h=j.action,j=j.args,h){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(j[0],j[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=j[2];n=j[3];t=j[0];u=j[1];e.length>0?(h=e[e.length-1],v=h.x,x=h.y):(h=this.actions[f-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=b;h++)w=h/b,j=THREE.FontUtils.b2(w,v,t,m),w=THREE.FontUtils.b2(w,x,u,n),
|
|
|
-e.push(new THREE.Vector2(j,w));break;case THREE.PathActions.BEZIER_CURVE_TO:m=j[4];n=j[5];t=j[0];u=j[1];p=j[2];o=j[3];e.length>0?(h=e[e.length-1],v=h.x,x=h.y):(h=this.actions[f-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=b;h++)w=h/b,j=THREE.FontUtils.b3(w,v,t,p,m),w=THREE.FontUtils.b3(w,x,u,o,n),e.push(new THREE.Vector2(j,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[f-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=b*j[0].length;h=h.concat(j[0]);j=new THREE.SplineCurve(h);
|
|
|
-for(h=1;h<=w;h++)e.push(j.getPointAt(h/w));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;m=j[0];n=j[1];p=j[2];t=j[3];w=j[4];u=!!j[5];o=h[h.length-2];v=h[h.length-1];h.length==0&&(o=v=0);x=w-t;var y=b*2;for(h=1;h<=y;h++)w=h/y,u||(w=1-w),w=t+w*x,j=o+m+p*Math.cos(w),w=v+n+p*Math.sin(w),e.push(new THREE.Vector2(j,w))}c&&e.push(e[0]);return e};
|
|
|
-THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var j,h,m;h=0;for(m=b.length;h<m;h++){j=b[h];if(j.x>c)c=j.x;else if(j.x<f)f=j.x;if(j.y>e)e=j.y;else if(j.y<e)g=j.y}return{minX:f,minY:g,maxX:c,maxY:e}};THREE.Path.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.sums,b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};
|
|
|
+THREE.Path.prototype.arc=function(b,c,e,f,h,j){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,h,j));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(b,c){b||(b=40);for(var e=[],f=0;f<b;f++)e.push(this.getPoint(f/b));c&&e.push(e[0]);return e};
|
|
|
+THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,j,g,m,o,p,n,t,v,u,w,A;f=0;for(h=this.actions.length;f<h;f++)switch(j=this.actions[f],g=j.action,j=j.args,g){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(j[0],j[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=j[2];o=j[3];t=j[0];v=j[1];e.length>0?(g=e[e.length-1],u=g.x,w=g.y):(g=this.actions[f-1].args,u=g[g.length-2],w=g[g.length-1]);for(g=1;g<=b;g++)A=g/b,j=THREE.Shape.Utils.b2(A,u,t,m),A=THREE.Shape.Utils.b2(A,w,v,
|
|
|
+o),e.push(new THREE.Vector2(j,A));break;case THREE.PathActions.BEZIER_CURVE_TO:m=j[4];o=j[5];t=j[0];v=j[1];p=j[2];n=j[3];e.length>0?(g=e[e.length-1],u=g.x,w=g.y):(g=this.actions[f-1].args,u=g[g.length-2],w=g[g.length-1]);for(g=1;g<=b;g++)A=g/b,j=THREE.Shape.Utils.b3(A,u,t,p,m),A=THREE.Shape.Utils.b3(A,w,v,n,o),e.push(new THREE.Vector2(j,A));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[f-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];A=b*j[0].length;g=g.concat(j[0]);j=new THREE.SplineCurve(g);
|
|
|
+for(g=1;g<=A;g++)e.push(j.getPointAt(g/A));break;case THREE.PathActions.ARC:g=this.actions[f-1].args;m=j[0];o=j[1];p=j[2];t=j[3];A=j[4];v=!!j[5];n=g[g.length-2];u=g[g.length-1];g.length==0&&(n=u=0);w=A-t;var y=b*2;for(g=1;g<=y;g++)A=g/y,v||(A=1-A),A=t+A*w,j=n+m+p*Math.cos(A),A=u+o+p*Math.sin(A),e.push(new THREE.Vector2(j,A))}c&&e.push(e[0]);return e};
|
|
|
+THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,h;c=e=Number.NEGATIVE_INFINITY;f=h=Number.POSITIVE_INFINITY;var j,g,m;g=0;for(m=b.length;g<m;g++){j=b[g];if(j.x>c)c=j.x;else if(j.x<f)f=j.x;if(j.y>e)e=j.y;else if(j.y<e)h=j.y}return{minX:f,minY:h,maxX:c,maxY:e}};THREE.Path.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.sums,b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};
|
|
|
THREE.Path.prototype.getLength=function(){var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);this.sums=b;return c};THREE.Path.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};THREE.Path.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};
|
|
|
THREE.Path.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};
|
|
|
-THREE.Path.prototype.transform=function(b){b=new THREE.Path;b.moveTo(0,0);b.quadraticCurveTo(100,20,140,80);console.log(b.cacheArcLengths());var c=this.getMinAndMax(),e=this.getPoints(),f,g,j,h,m,n;f=0;for(g=e.length;f<g;f++)j=e[f],h=j.x,m=j.y,n=h/c.maxX,h=b.getPoint(n),m=b.getNormalVector(n).multiplyScalar(m),j.x=h.x+m.x,j.y=h.y+m.y;return e};
|
|
|
-THREE.Path.prototype.nltransform=function(b,c,e,f,g,j){var h=this.getPoints(),m,n,p,o,t;m=0;for(n=h.length;m<n;m++)p=h[m],o=p.x,t=p.y,p.x=b*o+c*t+e,p.y=f*t+g*o+j;return h};
|
|
|
-THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=this.transform(0.866,
|
|
|
--0.866,0,0.5,0.5,-50);b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};THREE.Shape.prototype.getPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getPoints();return e};
|
|
|
-THREE.Shape.prototype.getSpacedPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getSpacedPoints();return e};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,j,h,m,n,p,o,t,u,v,x=[];for(n=0;n<c.length;n++){p=c[n];f=f.concat(p);j=Number.POSITIVE_INFINITY;for(g=0;g<p.length;g++){u=p[g];v=[];for(t=0;t<e.length;t++)o=e[t],o=u.distanceTo(o),v.push(o),o<j&&(j=o,h=g,m=t)}g=m-1>=0?m-1:e.length-1;j=h-1>=0?h-1:p.length-1;var w=[p[h],e[m],e[g]];t=THREE.FontUtils.Triangulate.area(w);var y=[p[h],p[j],e[m]];u=THREE.FontUtils.Triangulate.area(y);v=m;o=h;m+=1;h+=-1;m<0&&(m+=e.length);m%=e.length;
|
|
|
-h<0&&(h+=p.length);h%=p.length;g=m-1>=0?m-1:e.length-1;j=h-1>=0?h-1:p.length-1;w=[p[h],e[m],e[g]];w=THREE.FontUtils.Triangulate.area(w);y=[p[h],p[j],e[m]];y=THREE.FontUtils.Triangulate.area(y);t+u>w+y&&(m=v,h=o,m<0&&(m+=e.length),m%=e.length,h<0&&(h+=p.length),h%=p.length,g=m-1>=0?m-1:e.length-1,j=h-1>=0?h-1:p.length-1);t=e.slice(0,m);u=e.slice(m);v=p.slice(h);o=p.slice(0,h);j=[p[h],p[j],e[m]];x.push([p[h],e[m],e[g]]);x.push(j);e=t.concat(v).concat(o).concat(u)}return{shape:e,isolatedPts:x,allpoints:f}},
|
|
|
-triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,h,m,n;for(j=0;j<e.length;j++){n=e[j];for(h=0;h<3;h++)for(m=0;m<f.length;m++)f[m].equals(n[h])&&(n[h]=m)}for(j=0;j<g.length;j++){n=g[j];for(h=0;h<3;h++)for(m=0;m<f.length;m++)f[m].equals(n[h])&&(n[h]=m)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0}};
|
|
|
-THREE.CubeGeometry=function(b,c,e,f,g,j,h,m,n){function p(b,e,c,h,m,n,p,t){var u,v,w=f||1,x=g||1,J=m/2,Z=n/2,K=o.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")u="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")u="y",x=j||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")u="x",w=j||1;var S=w+1,k=x+1;m/=w;var W=n/x;for(v=0;v<k;v++)for(n=0;n<S;n++){var O=new THREE.Vector3;O[b]=(n*m-J)*c;O[e]=(v*W-Z)*h;O[u]=p;o.vertices.push(new THREE.Vertex(O))}for(v=0;v<x;v++)for(n=0;n<w;n++)o.faces.push(new THREE.Face4(n+S*v+
|
|
|
-K,n+S*(v+1)+K,n+1+S*(v+1)+K,n+1+S*v+K,null,null,t)),o.faceVertexUvs[0].push([new THREE.UV(n/w,v/x),new THREE.UV(n/w,(v+1)/x),new THREE.UV((n+1)/w,(v+1)/x),new THREE.UV((n+1)/w,v/x)])}THREE.Geometry.call(this);var o=this,t=b/2,u=c/2,v=e/2,m=m?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var w in n)this.sides[w]!=void 0&&(this.sides[w]=
|
|
|
-n[w]);this.sides.px&&p("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,u,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-u,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],e=[],c=0,f=o.vertices.length;c<f;c++){for(var h=o.vertices[c],g=!1,j=0,m=b.length;j<m;j++){var n=b[j];if(h.position.x==n.position.x&&
|
|
|
-h.position.y==n.position.y&&h.position.z==n.position.z){e[c]=j;g=!0;break}}if(!g)e[c]=b.length,b.push(new THREE.Vertex(h.position.clone()))}c=0;for(f=o.faces.length;c<f;c++)h=o.faces[c],h.a=e[h.a],h.b=e[h.b],h.c=e[h.c],h.d=e[h.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,e,c){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}THREE.Geometry.call(this);var m=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)h(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)h(Math.sin(p*n/b)*e,Math.cos(p*n/b)*e,o);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){h(0,0,-o-(j||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){h(0,0,o+
|
|
|
-(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],j=this.vertices[e.b],o=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/p,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
|
|
|
-f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
-THREE.ExtrudeGeometry=function(b,c){function e(b,e,c,f){b=b.clone().subSelf(e);c/=b.length();return b.multiplyScalar(f?1+c:1-c).addSelf(e)}function f(b){for(A=b.length;--A>=0;){k=A;W=A-1;W<0&&(W=b.length-1);for(var e=0,e=0;e<t+o*2;e++){var c=S*e,f=S*(e+1);E.faces.push(new THREE.Face4(O+k+c,O+W+c,O+W+f,O+k+f))}}}function g(b,e,c){E.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function j(b,e,c){E.faces.push(new THREE.Face3(b,e,c))}var h=c.amount!==void 0?c.amount:100,m=c.bevelThickness!==
|
|
|
-void 0?c.bevelThickness:8,n=c.bevelSize!==void 0?c.bevelSize:m,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.bevelSegments!==void 0?c.bevelSegments:3;p||(o=0);var t=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:null,v,x=!1;if(u)v=u.getPoints(),t=v.length,x=!0;THREE.Geometry.call(this);var w,y,C,E=this,u=b.extractAllPoints(),B=u.shape,u=u.holes,I=!THREE.Shape.Utils.isClockWise(B);if(I){B=B.reverse();y=0;for(C=u.length;y<C;y++)w=u[y],THREE.Shape.Utils.isClockWise(w)&&(u[y]=w.reverse());I=!1}var I=
|
|
|
-THREE.Shape.Utils.triangulateShape(B,u),F=B;y=0;for(C=u.length;y<C;y++)w=u[y],B=B.concat(w);var A,P,H=new THREE.Vector2;A=0;for(P=F.length;A<P;A++)H.addSelf(F[A]);var G=H.divideScalar(F.length),U=[];y=0;for(C=u.length;y<C;y++){H=new THREE.Vector2;w=u[y];A=0;for(P=w.length;A<P;A++)H.addSelf(w[A]);U[y]=H.divideScalar(w.length)}var V,J,Z,K,S=B.length,H=I.length;for(V=o;V>0;V--){w=V/o;Z=m*w;J=n*(1-Math.sin((1-w)*Math.PI/2));A=0;for(P=F.length;A<P;A++)K=e(F[A],G,J,!1),g(K.x,K.y,-Z);y=0;for(C=u.length;y<
|
|
|
-C;y++){w=u[y];A=0;for(P=w.length;A<P;A++)K=e(w[A],U[y],J,!0),g(K.x,K.y,-Z)}}for(A=0;A<S;A++)K=B[A],x?g(K.x,K.y+v[0].y,v[0].x):g(K.x,K.y,0);for(w=1;w<=t;w++)for(A=0;A<S;A++)K=B[A],x?g(K.x,K.y+v[w-1].y,v[w-1].x):g(K.x,K.y,h/t*w);for(V=1;V<=o;V++){w=V/o;Z=m*w;J=n*(1-Math.sin((1-w)*Math.PI/2));A=0;for(P=F.length;A<P;A++)K=e(F[A],G,J,!1),g(K.x,K.y,h+Z);y=0;for(C=u.length;y<C;y++){w=u[y];A=0;for(P=w.length;A<P;A++)K=e(w[A],U[y],J,!0),x?g(K.x,K.y+v[t-1].y,v[t-1].x+Z):g(K.x,K.y,h+Z)}}if(p){m=S*0;for(A=0;A<
|
|
|
-H;A++)h=I[A],j(h[2]+m,h[1]+m,h[0]+m);m=S*(t+o*2);for(A=0;A<H;A++)h=I[A],j(h[0]+m,h[1]+m,h[2]+m)}else{for(A=0;A<H;A++)h=I[A],j(h[2],h[1],h[0]);for(A=0;A<H;A++)h=I[A],j(h[0]+S*t,h[1]+S*t,h[2]+S*t)}var k,W,O=0;f(F);O+=F.length;y=0;for(C=u.length;y<C;y++)w=u[y],f(w),O+=w.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
-THREE.IcosahedronGeometry=function(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,j=new THREE.Geometry,h;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
|
--b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(b=0;b<this.subdivisions;b++){h=new THREE.Geometry;for(var m in j.faces){var n=f(j.faces[m].a,j.faces[m].b),p=f(j.faces[m].b,j.faces[m].c),o=f(j.faces[m].c,j.faces[m].a);e(j.faces[m].a,n,o,h);e(j.faces[m].b,p,n,h);
|
|
|
-e(j.faces[m].c,o,p,h);e(n,p,o,h)}j.faces=h.faces}g.faces=j.faces;delete j;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],j=[],h=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=h.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=j;n==0&&(j=f);
|
|
|
-for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,m/b.length),new THREE.UV(1-n/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
-THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,j=b/2,h=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var p=c/f;for(g=0;g<n;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(g*p-h),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
+THREE.Path.prototype.transform=function(b){b=new THREE.Path;b.moveTo(0,0);b.quadraticCurveTo(100,20,140,80);console.log(b.cacheArcLengths());var c=this.getMinAndMax(),e=this.getPoints(),f,h,j,g,m,o;f=0;for(h=e.length;f<h;f++)j=e[f],g=j.x,m=j.y,o=g/c.maxX,g=b.getPoint(o),m=b.getNormalVector(o).multiplyScalar(m),j.x=g.x+m.x,j.y=g.y+m.y;return e};
|
|
|
+THREE.Path.prototype.nltransform=function(b,c,e,f,h,j){var g=this.getPoints(),m,o,p,n,t;m=0;for(o=g.length;m<o;m++)p=g[m],n=p.x,t=p.y,p.x=b*n+c*t+e,p.y=f*t+h*n+j;return g};
|
|
|
+THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,h,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],h=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,h);c.stroke();c.closePath();c.strokeStyle="red";f=this.getPoints();
|
|
|
+b=0;for(e=f.length;b<e;b++)h=f[b],c.beginPath(),c.arc(h.x,h.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
|
+THREE.Path.prototype.toShapes=function(){var b,c,e,f,h=[],j=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&j.actions.length!=0&&(h.push(j),j=new THREE.Path),j[e].apply(j,f);j.actions.length!=0&&h.push(j);if(h.length==0)return[];var g;f=[];if(THREE.Shape.Utils.isClockWise(h[0].getPoints())){b=0;for(c=h.length;b<c;b++)j=h[b],THREE.Shape.Utils.isClockWise(j.getPoints())?(g&&f.push(g),g=new THREE.Shape,g.actions=j.actions,g.curves=
|
|
|
+j.curves):g.holes.push(j);f.push(g)}else{g=new THREE.Shape;b=0;for(c=h.length;b<c;b++)j=h[b],THREE.Shape.Utils.isClockWise(j.getPoints())?(g.actions=j.actions,g.curves=j.curves,f.push(g),g=new THREE.Shape):g.holes.push(j)}return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
|
|
|
+THREE.Shape.prototype.getPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getPoints();return e};THREE.Shape.prototype.getSpacedPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getSpacedPoints();return e};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
|
|
|
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,j,g,m,o,p,n,t,v,u,w=[];for(o=0;o<c.length;o++){p=c[o];f=f.concat(p);j=Number.POSITIVE_INFINITY;for(h=0;h<p.length;h++){v=p[h];u=[];for(t=0;t<e.length;t++)n=e[t],n=v.distanceTo(n),u.push(n),n<j&&(j=n,g=h,m=t)}h=m-1>=0?m-1:e.length-1;j=g-1>=0?g-1:p.length-1;var A=[p[g],e[m],e[h]];t=THREE.FontUtils.Triangulate.area(A);var y=[p[g],p[j],e[m]];v=THREE.FontUtils.Triangulate.area(y);u=m;n=g;m+=1;g+=-1;m<0&&(m+=e.length);m%=e.length;
|
|
|
+g<0&&(g+=p.length);g%=p.length;h=m-1>=0?m-1:e.length-1;j=g-1>=0?g-1:p.length-1;A=[p[g],e[m],e[h]];A=THREE.FontUtils.Triangulate.area(A);y=[p[g],p[j],e[m]];y=THREE.FontUtils.Triangulate.area(y);t+v>A+y&&(m=u,g=n,m<0&&(m+=e.length),m%=e.length,g<0&&(g+=p.length),g%=p.length,h=m-1>=0?m-1:e.length-1,j=g-1>=0?g-1:p.length-1);t=e.slice(0,m);v=e.slice(m);u=p.slice(g);n=p.slice(0,g);j=[p[g],p[j],e[m]];w.push([p[g],e[m],e[h]]);w.push(j);e=t.concat(u).concat(n).concat(v)}return{shape:e,isolatedPts:w,allpoints:f}},
|
|
|
+triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,g,m,o;for(j=0;j<e.length;j++){o=e[j];for(g=0;g<3;g++)for(m=0;m<f.length;m++)f[m].equals(o[g])&&(o[g]=m)}for(j=0;j<h.length;j++){o=h[j];for(g=0;g<3;g++)for(m=0;m<f.length;m++)f[m].equals(o[g])&&(o[g]=m)}return e.concat(h)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*
|
|
|
+(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,h){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,h)}};THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.set(b)};
|
|
|
+THREE.TextPath.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",h=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;THREE.FontUtils.weight=h;THREE.FontUtils.style=j};
|
|
|
+THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
|
|
|
+THREE.CubeGeometry=function(b,c,e,f,h,j,g,m,o){function p(b,e,c,g,m,o,p,t){var u,v,w=f||1,A=h||1,K=m/2,X=o/2,L=n.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")u="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")u="y",A=j||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")u="x",w=j||1;var U=w+1,k=A+1;m/=w;var Z=o/A;for(v=0;v<k;v++)for(o=0;o<U;o++){var P=new THREE.Vector3;P[b]=(o*m-K)*c;P[e]=(v*Z-X)*g;P[u]=p;n.vertices.push(new THREE.Vertex(P))}for(v=0;v<A;v++)for(o=0;o<w;o++)n.faces.push(new THREE.Face4(o+U*v+
|
|
|
+L,o+U*(v+1)+L,o+1+U*(v+1)+L,o+1+U*v+L,null,null,t)),n.faceVertexUvs[0].push([new THREE.UV(o/w,v/A),new THREE.UV(o/w,(v+1)/A),new THREE.UV((o+1)/w,(v+1)/A),new THREE.UV((o+1)/w,v/A)])}THREE.Geometry.call(this);var n=this,t=b/2,v=c/2,u=e/2,m=m?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(o!=void 0)for(var A in o)this.sides[A]!=void 0&&(this.sides[A]=
|
|
|
+o[A]);this.sides.px&&p("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,u,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],e=[],c=0,f=n.vertices.length;c<f;c++){for(var g=n.vertices[c],j=!1,h=0,m=b.length;h<m;h++){var o=b[h];if(g.position.x==o.position.x&&
|
|
|
+g.position.y==o.position.y&&g.position.z==o.position.z){e[c]=h;j=!0;break}}if(!j)e[c]=b.length,b.push(new THREE.Vertex(g.position.clone()))}c=0;for(f=n.faces.length;c<f;c++)g=n.faces[c],g.a=e[g.a],g.b=e[g.b],g.c=e[g.c],g.d=e[g.d];n.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
+THREE.CylinderGeometry=function(b,c,e,f,h,j){function g(b,e,c){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}THREE.Geometry.call(this);var m=this,o,p=Math.PI*2,n=f/2;for(o=0;o<b;o++)g(Math.sin(p*o/b)*c,Math.cos(p*o/b)*c,-n);for(o=0;o<b;o++)g(Math.sin(p*o/b)*e,Math.cos(p*o/b)*e,n);for(o=0;o<b;o++)m.faces.push(new THREE.Face4(o,o+b,b+(o+1)%b,(o+1)%b));if(e>0){g(0,0,-n-(j||0));for(o=b;o<b+b/2;o++)m.faces.push(new THREE.Face4(2*b,(2*o-2*b)%b,(2*o-2*b+1)%b,(2*o-2*b+2)%b))}if(c>0){g(0,0,n+
|
|
|
+(h||0));for(o=b+b/2;o<2*b;o++)m.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b))}o=0;for(b=this.faces.length;o<b;o++){var c=[],e=this.faces[o],h=this.vertices[e.a],j=this.vertices[e.b],n=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/p,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/p,0.5+n.position.z/
|
|
|
+f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);for(var b=b instanceof Array?b:[b],e=0,f=b.length,h;e<f;e++)h=b[e],this.addShape(h,c)}};
|
|
|
+THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
+THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,e,c){return b.clone().addSelf(e.clone().multiplyScalar(c))}function f(b,e,c){e=Math.atan2(e.y-b.y,e.x-b.x);b=Math.atan2(c.y-b.y,c.x-b.x);e>b&&(b+=Math.PI*2);anglec=(e+b)/2;return(new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec))).normalize()}function h(b){for(F=b.length;--F>=0;){ea=F;Y=F-1;Y<0&&(Y=b.length-1);for(var e=0,e=0;e<v+t*2;e++){var c=U*e,f=U*(e+1),g=$+ea+c,c=$+Y+c,j=$+Y+f,f=$+ea+f;g+=E;c+=E;j+=E;f+=E;B.faces.push(new THREE.Face4(g,
|
|
|
+c,j,f))}}}function j(b,e,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function g(b,e,c){b+=E;e+=E;c+=E;B.faces.push(new THREE.Face3(b,e,c))}var m=c.amount!==void 0?c.amount:100,o=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:o-2,n=c.bevelEnabled!==void 0?c.bevelEnabled:!0,t=c.bevelSegments!==void 0?c.bevelSegments:3;n||(t=0);var v=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:null,w,A=!1;if(u)w=u.getPoints(),v=w.length,A=!0;var y,x,I,B=this,
|
|
|
+E=this.vertices.length,u=b.extractAllPoints(),G=u.shape,u=u.holes,H=!THREE.Shape.Utils.isClockWise(G);if(H){G=G.reverse();x=0;for(I=u.length;x<I;x++)y=u[x],THREE.Shape.Utils.isClockWise(y)&&(u[x]=y.reverse());H=!1}var H=THREE.Shape.Utils.triangulateShape(G,u),Q=G;x=0;for(I=u.length;x<I;x++)y=u[x],G=G.concat(y);var F,C,N=new THREE.Vector2;F=0;for(C=Q.length;F<C;F++)N.addSelf(Q[F]);N.divideScalar(Q.length);x=0;for(I=u.length;x<I;x++){N=new THREE.Vector2;y=u[x];F=0;for(C=y.length;F<C;F++)N.addSelf(y[F]);
|
|
|
+N.divideScalar(y.length)}var W,K,X,L,U=G.length,N=H.length,k=[];F=0;C=Q.length;ea=C-1;for(Y=F+1;F<C;F++,ea++,Y++)ea==C&&(ea=0),Y==C&&(Y=0),k[F]=f(Q[F],Q[ea],Q[Y]);var Z=[],P,aa=k.concat();x=0;for(I=u.length;x<I;x++){y=u[x];P=[];F=0;C=y.length;ea=C-1;for(Y=F+1;F<C;F++,ea++,Y++)ea==C&&(ea=0),Y==C&&(Y=0),P[F]=f(y[F],y[ea],y[Y]);Z.push(P);aa=aa.concat(P)}for(W=0;W<t;W++){y=W/t;X=o*(1-y);K=p*Math.sin(y*Math.PI/2);F=0;for(C=Q.length;F<C;F++)L=e(Q[F],k[F],K),j(L.x,L.y,-X);x=0;for(I=u.length;x<I;x++){y=u[x];
|
|
|
+P=Z[x];F=0;for(C=y.length;F<C;F++)L=e(y[F],P[F],K),j(L.x,L.y,-X)}}K=p;for(F=0;F<U;F++)L=e(G[F],aa[F],K),A?j(L.x,L.y+w[0].y,w[0].x):j(L.x,L.y,0);for(y=1;y<=v;y++)for(F=0;F<U;F++)L=e(G[F],aa[F],K),A?j(L.x,L.y+w[y-1].y,w[y-1].x):j(L.x,L.y,m/v*y);for(W=t-1;W>=0;W--){y=W/t;X=o*(1-y);K=p*Math.sin(y*Math.PI/2);F=0;for(C=Q.length;F<C;F++)L=e(Q[F],k[F],K),j(L.x,L.y,m+X);x=0;for(I=u.length;x<I;x++){y=u[x];P=Z[x];F=0;for(C=y.length;F<C;F++)L=e(y[F],P[F],K),A?j(L.x,L.y+w[v-1].y,w[v-1].x+X):j(L.x,L.y,m+X)}}if(n){o=
|
|
|
+U*0;for(F=0;F<N;F++)m=H[F],g(m[2]+o,m[1]+o,m[0]+o);o=U*(v+t*2);for(F=0;F<N;F++)m=H[F],g(m[0]+o,m[1]+o,m[2]+o)}else{for(F=0;F<N;F++)m=H[F],g(m[2],m[1],m[0]);for(F=0;F<N;F++)m=H[F],g(m[0]+U*v,m[1]+U*v,m[2]+U*v)}var ea,Y,$=0;h(Q);$+=Q.length;x=0;for(I=u.length;x<I;x++)y=u[x],h(y),$+=y.length;this.computeCentroids();this.computeFaceNormals()};
|
|
|
+THREE.IcosahedronGeometry=function(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=h.vertices[b].position,g=h.vertices[e].position;return c((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2)}var h=this,j=new THREE.Geometry,g;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
|
+-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(b=0;b<this.subdivisions;b++){g=new THREE.Geometry;for(var m in j.faces){var o=f(j.faces[m].a,j.faces[m].b),p=f(j.faces[m].b,j.faces[m].c),n=f(j.faces[m].c,j.faces[m].a);e(j.faces[m].a,o,n,g);e(j.faces[m].b,p,o,g);
|
|
|
+e(j.faces[m].c,n,p,g);e(o,p,n,g)}j.faces=g.faces}h.faces=j.faces;delete j;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],j=[],g=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var o=0;o<=this.angle+0.0010;o+=c){for(m=0;m<e.length;m++)o<this.angle?(e[m]=g.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),h[m]=this.vertices.length-1):h=j;o==0&&(j=f);
|
|
|
+for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(h[m],h[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-o/this.angle,m/b.length),new THREE.UV(1-o/this.angle,(m+1)/b.length),new THREE.UV(1-(o-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(o-c)/this.angle,m/b.length)]);f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
+THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var h,j=b/2,g=c/2,e=e||1,f=f||1,m=e+1,o=f+1;b/=e;var p=c/f;for(h=0;h<o;h++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(h*p-g),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*h,c+m*(h+1),c+1+m*(h+1),c+1+m*h)),this.faceVertexUvs[0].push([new THREE.UV(c/e,h/f),new THREE.UV(c/e,(h+1)/f),new THREE.UV((c+1)/e,(h+1)/f),new THREE.UV((c+1)/e,h/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
-THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,j=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e<h+1;e++){f=e/h;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<j;f++){var t=2*f/j,u=n*Math.sin(t*g),t=n*Math.cos(t*g);(e==0||e==h)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,u)))-1);p.push(o)}c.push(p)}for(var v,x,w,g=c.length,e=0;e<g;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){p=f==j-1;h=c[e][p?0:f+1];m=c[e][p?j-1:f];n=c[e-1][p?
|
|
|
-j-1:f];p=c[e-1][p?0:f+1];u=e/(g-1);v=(e-1)/(g-1);x=(f+1)/j;var t=f/j,o=new THREE.UV(1-x,u),u=new THREE.UV(1-t,u),t=new THREE.UV(1-t,v),y=new THREE.UV(1-x,v);e<c.length-1&&(v=this.vertices[h].position.clone(),x=this.vertices[m].position.clone(),w=this.vertices[n].position.clone(),v.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,m,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([o,u,t]));e>1&&(v=
|
|
|
-this.vertices[h].position.clone(),x=this.vertices[n].position.clone(),w=this.vertices[p].position.clone(),v.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([o,t,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
-THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
-THREE.TextGeometry.prototype.set=function(b,c){function e(b,e,c){x.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){x.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,j=c.curveSegments!==void 0?c.curveSegments:4,h=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",p=c.bevelThickness!==void 0?c.bevelThickness:10,o=c.bevelSize!==void 0?c.bevelSize:8,t=c.bevelEnabled!==
|
|
|
-void 0?c.bevelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=j;THREE.FontUtils.face=h;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bevelSize=o;var m=THREE.FontUtils.drawText(b),j=m.points,u=m.faces,h=m.contour,v=m.bevel,x=this;x.vertices=[];x.faces=[];for(var w,n=j.length,y=u.length,o=v.length,m=0;m<n;m++)w=j[m],e(w.x,w.y,0);for(m=0;m<n;m++)w=j[m],e(w.x,w.y,g);if(t){for(m=0;m<o;m++)w=v[m],e(w.x,w.y,p);for(m=0;m<o;m++)w=v[m],e(w.x,w.y,g-p)}for(m=
|
|
|
-0;m<y;m++)g=u[m],x.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<y;m++)g=u[m],x.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var C;if(t)for(m=v.length;--m>0;){if(C){if(C.equals(h[m])){C=null;continue}}else C=h[m];p=n*2+m;u=p-1;f(p,u,u+o,p+o);for(t=0;t<n;t++)if(j[t].equals(h[m]))break;for(g=0;g<n;g++)if(j[g].equals(h[m-1]))break;f(t,g,u,p);f(p+o,u+o,g+n,t+n)}else for(m=h.length;--m>0;){if(C){if(C.equals(h[m])){C=null;continue}}else C=h[m];for(t=0;t<n;t++)if(j[t].equals(h[m]))break;for(g=
|
|
|
-0;g<n;g++)if(j[g].equals(h[m-1]))break;f(t,g,g+n,t+n)}this.computeCentroids();this.computeFaceNormals()};
|
|
|
-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(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
|
|
|
-{points:b,faces:[]};for(var e,f,g,j,h,m=[],n=0;n<c.length;n++){h=c[n];j=[];for(e=0;e<h.length;e++)f=h[e],j.push(f.x+","+f.y);var p;e=j.slice(1).indexOf(j[0]);var o=this.Triangulate.area(h.slice(0,e+1))<0;f=[];for(e=-1;e<j.length;){p=e+1;e=j[p];e=j.slice(p+1).indexOf(e)+p;if(e<=p)break;var t=h.slice(p,e+1);o?this.Triangulate.area(t)<0?(p>0&&m.push({shape:g,holes:f}),g=t,f=[]):f.push(t):this.Triangulate.area(t)<0?(m.push({shape:t,holes:f}),f=[]):f.push(t);e++}o&&m.push({shape:g,holes:f})}var u,v,x,
|
|
|
-w,y,C;j=[];for(h=0;h<m.length;h++){n=m[h];g=n.shape;f=n.holes;for(p=0;p<f.length;p++){o=f[p];x=Number.POSITIVE_INFINITY;for(t=0;t<o.length;t++){y=o[t];for(e=0;e<g.length;e++)w=g[e],w=y.distanceTo(w),w<x&&(x=w,u=t,v=e)}e=v-1>=0?v-1:g.length-1;var t=u-1>=0?u-1:o.length-1,E=[];E.push(o[u]);E.push(g[v]);E.push(g[e]);x=this.Triangulate.area(E);var B=[];B.push(o[u]);B.push(o[t]);B.push(g[v]);y=this.Triangulate.area(B);w=v;C=u;v+=1;u+=-1;v<0&&(v+=g.length);v%=g.length;u<0&&(u+=o.length);u%=g.length;e=v-
|
|
|
-1>=0?v-1:g.length-1;t=u-1>=0?u-1:o.length-1;E=[];E.push(o[u]);E.push(g[v]);E.push(g[e]);E=this.Triangulate.area(E);B=[];B.push(o[u]);B.push(o[t]);B.push(g[v]);B=this.Triangulate.area(B);x+y>E+B&&(v=w,u=C,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=o.length),u%=g.length,e=v-1>=0?v-1:g.length-1,t=u-1>=0?u-1:o.length-1);x=g.slice(0,v);y=g.slice(v);w=o.slice(u);C=o.slice(0,u);j.push(o[u]);j.push(g[v]);j.push(g[e]);j.push(o[u]);j.push(o[t]);j.push(g[v]);g=x.concat(w).concat(C).concat(y)}n.shape=g}u=[];v=[];
|
|
|
-for(h=p=0;h<m.length;h++){n=m[h];g=n.shape;u=u.concat(g);o=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<o.length;f++)n=o[f],n[0]+=p,n[1]+=p,n[2]+=p;v=v.concat(o);p+=g.length}var I;for(f=0;f<j.length/3;f++){n=[];for(m=0;m<3;m++){h=!1;for(g=0;g<u.length&&!h;g++)I=f*3+m,u[g].equals(j[I])&&(n.push(g),h=!0);h||(u.push(j[I]),n.push(u.length-1),console.log("not found"))}v.push(n)}return{points:u,faces:v}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),j=this.size/g.resolution,h=0;f=String(b).split("");
|
|
|
-for(var m=f.length,n=new THREE.Path,b=0;b<m;b++){var p=this.extractGlyphPoints(f[b],g,j,h,n);h+=p.offset;c.push(p.points);e=e.concat(p.points)}console.log(n);b=h/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];j=[];f=[];for(var h=[],m=new THREE.Vector2,o,b=e.length;--b>=0;){if(o){if(o.equals(e[b])){o=null;n=this.Triangulate.area(f)>0;h.push(n);j.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else o=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=
|
|
|
-0;--b>=0;)n=e[b],m=j[f],n=n.clone().subSelf(m),p=this.bevelSize/n.length(),h[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bevel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*
|
|
|
-(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f,g){var j=[],h,m,n,p,o,t,u,v,x,w,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));n=c.length;for(b=0;b<n;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,p));g.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,
|
|
|
-p));g.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;u=c[b++]*e+f;v=c[b++]*e;g.quadraticCurveTo(u,v,m,p);if(h=j[j.length-1]){o=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var C=h/divisions,E=THREE.FontUtils.b2(C,o,u,m),C=THREE.FontUtils.b2(C,t,v,p);j.push(new THREE.Vector2(E,C))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,u=c[b++]*e+f,v=c[b++]*-e,x=c[b++]*e+f,w=c[b++]*-e,g.bezierCurveTo(m,p,u,v,x,w),h=j[j.length-1]){o=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)C=
|
|
|
-h/divisions,E=THREE.FontUtils.b3(C,o,u,x,m),C=THREE.FontUtils.b3(C,t,v,w,p),j.push(new THREE.Vector2(E,C))}}}return{offset:y.ha*e,points:j,path:g}}}};
|
|
|
-(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<g;p++)h[p]=p;else for(p=0;p<g;p++)h[p]=g-1-p;var t=2*g;for(p=g-1;g>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}n=p;g<=n&&(n=0);p=n+1;g<=p&&(p=0);o=p+1;g<=o&&(o=0);var u;a:{u=b;var v=n,x=p,w=o,y=g,C=h,E=void 0,B=void 0,I=void 0,
|
|
|
-F=void 0,A=void 0,P=void 0,H=void 0,G=void 0,U=void 0,B=u[C[v]].x,I=u[C[v]].y,F=u[C[x]].x,A=u[C[x]].y,P=u[C[w]].x,H=u[C[w]].y;if(1.0E-10>(F-B)*(H-I)-(A-I)*(P-B))u=!1;else{for(E=0;E<y;E++)if(!(E==v||E==x||E==w)){var G=u[C[E]].x,U=u[C[E]].y,V=void 0,J=void 0,Z=void 0,K=void 0,S=void 0,k=void 0,W=void 0,O=void 0,ga=void 0,fa=void 0,X=void 0,ea=void 0,V=Z=S=void 0,V=P-F,J=H-A,Z=B-P,K=I-H,S=F-B,k=A-I,W=G-B,O=U-I,ga=G-F,fa=U-A,X=G-P,ea=U-H,V=V*fa-J*ga,S=S*O-k*W,Z=Z*ea-K*X;if(V>=0&&Z>=0&&S>=0){u=!1;break a}}u=
|
|
|
-!0}}if(u){j.push([b[h[n]],b[h[p]],b[h[o]]]);m.push([h[n],h[p],h[o]]);n=p;for(o=p+1;o<g;n++,o++)h[n]=h[o];g--;t=2*g}}if(f)return m;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
-THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
|
|
|
-1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,j=Math.max(3,c||8),g=Math.max(2,e||6),c=[],e=0;e<g+1;e++){f=e/g;var m=b*Math.cos(f*h),o=b*Math.sin(f*h),p=[],n=0;for(f=0;f<j;f++){var t=2*f/j,v=o*Math.sin(t*h),t=o*Math.cos(t*h);(e==0||e==g)&&f>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,v)))-1);p.push(n)}c.push(p)}for(var u,w,A,h=c.length,e=0;e<h;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){p=f==j-1;g=c[e][p?0:f+1];m=c[e][p?j-1:f];o=c[e-1][p?
|
|
|
+j-1:f];p=c[e-1][p?0:f+1];v=e/(h-1);u=(e-1)/(h-1);w=(f+1)/j;var t=f/j,n=new THREE.UV(1-w,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,u),y=new THREE.UV(1-w,u);e<c.length-1&&(u=this.vertices[g].position.clone(),w=this.vertices[m].position.clone(),A=this.vertices[o].position.clone(),u.normalize(),w.normalize(),A.normalize(),this.faces.push(new THREE.Face3(g,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([n,v,t]));e>1&&(u=
|
|
|
+this.vertices[g].position.clone(),w=this.vertices[o].position.clone(),A=this.vertices[p].position.clone(),u.normalize(),w.normalize(),A.normalize(),this.faces.push(new THREE.Face3(g,o,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([n,t,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();THREE.ExtrudeGeometry.call(this,e,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]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){var c,
|
|
|
+e=this.getFace(),f=this.size/e.resolution,h=0,j=String(b).split(""),g=j.length,b=[];for(c=0;c<g;c++){var m=new THREE.Path,m=this.extractGlyphPoints(j[c],e,f,h,m);h+=m.offset;b.push(m.path)}e=h/2;f=this.extractPoints([],[]);f.paths=b;f.offset=e;return f},extractGlyphPoints:function(b,c,e,f,h){var j=[],g,m,o,p,n,t,v,u,w,A,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));o=c.length;for(b=0;b<o;)switch(m=c[b++],m){case "m":m=c[b++]*
|
|
|
+e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,p));h.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,p));h.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;h.quadraticCurveTo(v,u,m,p);if(g=j[j.length-1]){n=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var x=g/divisions,I=THREE.Shape.Utils.b2(x,n,v,m),x=THREE.Shape.Utils.b2(x,t,u,p);j.push(new THREE.Vector2(I,x))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,w=
|
|
|
+c[b++]*e+f,A=c[b++]*-e,h.bezierCurveTo(m,p,v,u,w,A),g=j[j.length-1]){n=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)x=g/divisions,I=THREE.Shape.Utils.b3(x,n,v,w,m),x=THREE.Shape.Utils.b3(x,t,u,A,p),j.push(new THREE.Vector2(I,x))}}}return{offset:y.ha*e,points:j,path:h}}}};
|
|
|
+(function(b){var c=function(b){for(var c=b.length,h=0,j=c-1,g=0;g<c;j=g++)h+=b[j].x*b[g].y-b[g].x*b[j].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var j=[],g=[],m=[],o,p,n;if(c(b)>0)for(p=0;p<h;p++)g[p]=p;else for(p=0;p<h;p++)g[p]=h-1-p;var t=2*h;for(p=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}o=p;h<=o&&(o=0);p=o+1;h<=p&&(p=0);n=p+1;h<=n&&(n=0);var v;a:{v=b;var u=o,w=p,A=n,y=h,x=g,I=void 0,B=void 0,E=void 0,
|
|
|
+G=void 0,H=void 0,Q=void 0,F=void 0,C=void 0,N=void 0,B=v[x[u]].x,E=v[x[u]].y,G=v[x[w]].x,H=v[x[w]].y,Q=v[x[A]].x,F=v[x[A]].y;if(1.0E-10>(G-B)*(F-E)-(H-E)*(Q-B))v=!1;else{for(I=0;I<y;I++)if(!(I==u||I==w||I==A)){var C=v[x[I]].x,N=v[x[I]].y,W=void 0,K=void 0,X=void 0,L=void 0,U=void 0,k=void 0,Z=void 0,P=void 0,aa=void 0,ea=void 0,Y=void 0,$=void 0,W=X=U=void 0,W=Q-G,K=F-H,X=B-Q,L=E-F,U=G-B,k=H-E,Z=C-B,P=N-E,aa=C-G,ea=N-H,Y=C-Q,$=N-F,W=W*ea-K*aa,U=U*P-k*Z,X=X*$-L*Y;if(W>=0&&X>=0&&U>=0){v=!1;break a}}v=
|
|
|
+!0}}if(v){j.push([b[g[o]],b[g[p]],b[g[n]]]);m.push([g[o],g[p],g[n]]);o=p;for(n=p+1;n<h;o++,n++)g[o]=g[n];h--;t=2*h}}if(f)return m;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,h=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(h))*Math.cos(f),(this.radius+this.tube*Math.cos(h))*Math.sin(f),this.tube*Math.sin(h))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
|
|
|
+1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,h=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,g=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,h,j,g));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[g][0],b[g][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
-THREE.TorusKnotGeometry=function(b,c,e,f,g,j,h){function m(b,e,c,f,h,g){e=c/f*b;c=Math.cos(e);return new THREE.Vector3(h*(2+c)*0.5*Math.cos(b),h*(2+c)*Math.sin(b)*0.5,g*h*Math.sin(e)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=j||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
-this.segmentsT;++c){var n=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=m(n,h,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=n.x-g.x;e.y=n.y-g.y;e.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();n=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=n*f.x+h*j.x;g.y+=n*f.y+h*j.y;g.z+=n*f.z+h*j.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
-g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,j=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,j));this.faceVertexUvs[0].push([h,n,p,o])}this.computeCentroids();
|
|
|
+THREE.TorusKnotGeometry=function(b,c,e,f,h,j,g){function m(b,c,e,f,g,j){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,j*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=h||2;this.q=j||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
+this.segmentsT;++c){var o=b/this.segmentsR*2*this.p*Math.PI,g=c/this.segmentsT*2*Math.PI,h=m(o,g,this.q,this.p,this.radius,this.heightScale),o=m(o+0.01,g,this.q,this.p,this.radius,this.heightScale);e.x=o.x-h.x;e.y=o.y-h.y;e.z=o.z-h.z;f.x=o.x+h.x;f.y=o.y+h.y;f.z=o.z+h.z;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();o=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);h.x+=o*f.x+g*j.x;h.y+=o*f.y+g*j.y;h.z+=o*f.z+g*j.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,
|
|
|
+h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,j=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],g=new THREE.UV(b/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,j));this.faceVertexUvs[0].push([g,o,p,n])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
|
|
|
this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
|
|
|
-new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,j,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
|
|
|
-1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(m){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[m[0]]!==void 0)b[e].wrapS=g[m[0]];if(g[m[1]]!==void 0)b[e].wrapT=g[m[1]]}f(b[e],c+"/"+h)}function j(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,m,n;m="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
|
|
|
-if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.colorDiffuse)h.color=j(b.colorDiffuse);
|
|
|
-else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=j(b.colorSpecular);if(b.colorAmbient)h.ambient=j(b.colorAmbient);if(b.transparency)h.opacity=b.transparency;if(b.specularCoef)h.shininess=b.specularCoef;b.mapDiffuse&&c&&g(h,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(h,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(h,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
|
|
|
-b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(p.uniforms),t=h.color;m=h.specular;n=h.ambient;var u=h.shininess;o.tNormal.texture=h.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(h.map)o.tDiffuse.texture=h.map,o.enableDiffuse.value=!0;if(h.specularMap)o.tSpecular.texture=h.specularMap,o.enableSpecular.value=!0;if(h.lightMap)o.tAO.texture=
|
|
|
-h.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(t);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=u;if(h.opacity)o.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:o,lights:!0,fog:!0})}else h=new THREE[m](h);return h}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
|
|
|
-THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,g,n,p,o,t,u,v,x,w,y,C,E,B,I=b.faces;t=b.vertices;var F=b.normals,A=b.colors,P=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&P++;for(c=0;c<P;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];p=0;for(o=t.length;p<o;)u=new THREE.Vertex,u.position.x=t[p++]*e,u.position.y=
|
|
|
-t[p++]*e,u.position.z=t[p++]*e,f.vertices.push(u);p=0;for(o=I.length;p<o;){e=I[p++];t=e&1;n=e&2;c=e&4;g=e&8;v=e&16;u=e&32;w=e&64;e&=128;t?(y=new THREE.Face4,y.a=I[p++],y.b=I[p++],y.c=I[p++],y.d=I[p++],t=4):(y=new THREE.Face3,y.a=I[p++],y.b=I[p++],y.c=I[p++],t=3);if(n)n=I[p++],y.materials=f.materials[n];n=f.faces.length;if(c)for(c=0;c<P;c++)C=b.uvs[c],x=I[p++],B=C[x*2],x=C[x*2+1],f.faceUvs[c][n]=new THREE.UV(B,x);if(g)for(c=0;c<P;c++){C=b.uvs[c];E=[];for(g=0;g<t;g++)x=I[p++],B=C[x*2],x=C[x*2+1],E[g]=
|
|
|
-new THREE.UV(B,x);f.faceVertexUvs[c][n]=E}if(v)v=I[p++]*3,g=new THREE.Vector3,g.x=F[v++],g.y=F[v++],g.z=F[v],y.normal=g;if(u)for(c=0;c<t;c++)v=I[p++]*3,g=new THREE.Vector3,g.x=F[v++],g.y=F[v++],g.z=F[v],y.vertexNormals.push(g);if(w)u=I[p++],u=new THREE.Color(A[u]),y.color=u;if(e)for(c=0;c<t;c++)u=I[p++],u=new THREE.Color(A[u]),y.vertexColors.push(u);f.faces.push(y)}}})(g);(function(){var e,c,g,n;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)g=b.skinWeights[e],n=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
-n,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)g=b.skinIndices[e],n=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,g,n,p,o,t,u,v,x;c=0;for(g=b.morphTargets.length;c<g;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];v=f.morphTargets[c].vertices;x=b.morphTargets[c].vertices;n=0;for(p=x.length;n<p;n+=3)o=x[n]*e,t=x[n+1]*
|
|
|
-e,u=x[n+2]*e,v.push(new THREE.Vertex(new THREE.Vector3(o,t,u)))}}if(b.morphColors!==void 0){c=0;for(g=b.morphColors.length;c<g;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];p=f.morphColors[c].colors;o=b.morphColors[c].colors;e=0;for(n=o.length;e<n;e+=3)t=new THREE.Color(16755200),t.setRGB(o[e],o[e+1],o[e+2]),p.push(t)}}})(g);(function(){if(b.edges!==void 0){var e,c,g;for(e=0;e<b.edges.length;e+=2)c=b.edges[e],g=b.edges[e+1],f.edges.push(new THREE.Edge(f.vertices[c],
|
|
|
-f.vertices[g],c,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
-THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
|
-c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){var h=new XMLHttpRequest,m=f+"/"+b,n=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+h.status+"]"):h.readyState==3?j&&(n==0&&(n=h.getResponseHeader("Content-Length")),j({total:n,loaded:h.responseText.length})):h.readyState==2&&(n=h.getResponseHeader("Content-Length"))};h.open("GET",m,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
-h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(e){function c(b,e){var f=o(b,e),g=o(b,e+1),h=o(b,e+2),j=o(b,e+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,e){var c=o(b,e),f=o(b,e+1),h=o(b,e+2);return(o(b,e+3)<<24)+(h<<16)+(f<<8)+c}function n(b,e){var c=o(b,e);return(o(b,e+1)<<8)+c}function p(b,e){var c=o(b,e);return c>127?c-256:c}function o(b,
|
|
|
-e){return b.charCodeAt(e)&255}function t(e){var c,f,h;c=g(b,e);f=g(b,e+A);h=g(b,e+P);e=n(b,e+H);THREE.BinaryLoader.prototype.f3(C,c,f,h,e)}function u(e){var c,f,h,j,k,p;c=g(b,e);f=g(b,e+A);h=g(b,e+P);j=n(b,e+H);k=g(b,e+G);p=g(b,e+U);e=g(b,e+V);THREE.BinaryLoader.prototype.f3n(C,I,c,f,h,j,k,p,e)}function v(e){var c,f,h,j;c=g(b,e);f=g(b,e+J);h=g(b,e+Z);j=g(b,e+K);e=n(b,e+S);THREE.BinaryLoader.prototype.f4(C,c,f,h,j,e)}function x(e){var c,f,h,j,p,o,t,u;c=g(b,e);f=g(b,e+J);h=g(b,e+Z);j=g(b,e+K);p=n(b,
|
|
|
-e+S);o=g(b,e+k);t=g(b,e+W);u=g(b,e+O);e=g(b,e+ga);THREE.BinaryLoader.prototype.f4n(C,I,c,f,h,j,p,o,t,u,e)}function w(e){var c,f;c=g(b,e);f=g(b,e+fa);e=g(b,e+X);THREE.BinaryLoader.prototype.uv3(C.faceVertexUvs[0],F[c*2],F[c*2+1],F[f*2],F[f*2+1],F[e*2],F[e*2+1])}function y(e){var c,f,h;c=g(b,e);f=g(b,e+ea);h=g(b,e+ha);e=g(b,e+ka);THREE.BinaryLoader.prototype.uv4(C.faceVertexUvs[0],F[c*2],F[c*2+1],F[f*2],F[f*2+1],F[h*2],F[h*2+1],F[e*2],F[e*2+1])}var C=this,E=0,B,I=[],F=[],A,P,H,G,U,V,J,Z,K,S,k,W,O,ga,
|
|
|
-fa,X,ea,ha,ka,pa,R,ia,aa,ma,ca;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,e);B={signature:b.substr(E,8),header_bytes:o(b,E+8),vertex_coordinate_bytes:o(b,E+9),normal_coordinate_bytes:o(b,E+10),uv_coordinate_bytes:o(b,E+11),vertex_index_bytes:o(b,E+12),normal_index_bytes:o(b,E+13),uv_index_bytes:o(b,E+14),material_index_bytes:o(b,E+15),nvertices:g(b,E+16),nnormals:g(b,E+16+4),nuvs:g(b,E+16+8),ntri_flat:g(b,E+16+12),ntri_smooth:g(b,E+16+16),ntri_flat_uv:g(b,E+16+20),ntri_smooth_uv:g(b,
|
|
|
-E+16+24),nquad_flat:g(b,E+16+28),nquad_smooth:g(b,E+16+32),nquad_flat_uv:g(b,E+16+36),nquad_smooth_uv:g(b,E+16+40)};E+=B.header_bytes;A=B.vertex_index_bytes;P=B.vertex_index_bytes*2;H=B.vertex_index_bytes*3;G=B.vertex_index_bytes*3+B.material_index_bytes;U=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;V=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;J=B.vertex_index_bytes;Z=B.vertex_index_bytes*2;K=B.vertex_index_bytes*3;S=B.vertex_index_bytes*4;k=B.vertex_index_bytes*
|
|
|
-4+B.material_index_bytes;W=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;O=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;ga=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;fa=B.uv_index_bytes;X=B.uv_index_bytes*2;ea=B.uv_index_bytes;ha=B.uv_index_bytes*2;ka=B.uv_index_bytes*3;e=B.vertex_index_bytes*3+B.material_index_bytes;ca=B.vertex_index_bytes*4+B.material_index_bytes;pa=B.ntri_flat*e;R=B.ntri_smooth*(e+B.normal_index_bytes*3);ia=
|
|
|
-B.ntri_flat_uv*(e+B.uv_index_bytes*3);aa=B.ntri_smooth_uv*(e+B.normal_index_bytes*3+B.uv_index_bytes*3);ma=B.nquad_flat*ca;e=B.nquad_smooth*(ca+B.normal_index_bytes*4);ca=B.nquad_flat_uv*(ca+B.uv_index_bytes*4);E+=function(e){for(var f,g,j,k=B.vertex_coordinate_bytes*3,m=e+B.nvertices*k;e<m;e+=k)f=c(b,e),g=c(b,e+B.vertex_coordinate_bytes),j=c(b,e+B.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(C,f,g,j);return B.nvertices*k}(E);E+=function(e){for(var c,f,g,h=B.normal_coordinate_bytes*3,
|
|
|
-j=e+B.nnormals*h;e<j;e+=h)c=p(b,e),f=p(b,e+B.normal_coordinate_bytes),g=p(b,e+B.normal_coordinate_bytes*2),I.push(c/127,f/127,g/127);return B.nnormals*h}(E);E+=function(e){for(var f,g,j=B.uv_coordinate_bytes*2,k=e+B.nuvs*j;e<k;e+=j)f=c(b,e),g=c(b,e+B.uv_coordinate_bytes),F.push(f,g);return B.nuvs*j}(E);pa=E+pa;R=pa+R;ia=R+ia;aa=ia+aa;ma=aa+ma;e=ma+e;ca=e+ca;(function(b){var e,c=B.vertex_index_bytes*3+B.material_index_bytes,f=c+B.uv_index_bytes*3,g=b+B.ntri_flat_uv*f;for(e=b;e<g;e+=f)t(e),w(e+c);return g-
|
|
|
-b})(R);(function(b){var e,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=c+B.uv_index_bytes*3,g=b+B.ntri_smooth_uv*f;for(e=b;e<g;e+=f)u(e),w(e+c);return g-b})(ia);(function(b){var e,c=B.vertex_index_bytes*4+B.material_index_bytes,f=c+B.uv_index_bytes*4,g=b+B.nquad_flat_uv*f;for(e=b;e<g;e+=f)v(e),y(e+c);return g-b})(e);(function(b){var e,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=c+B.uv_index_bytes*4,g=b+B.nquad_smooth_uv*f;for(e=b;e<g;e+=f)x(e),
|
|
|
-y(e+c);return g-b})(ca);(function(b){var e,c=B.vertex_index_bytes*3+B.material_index_bytes,f=b+B.ntri_flat*c;for(e=b;e<f;e+=c)t(e);return f-b})(E);(function(b){var e,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=b+B.ntri_smooth*c;for(e=b;e<f;e+=c)u(e);return f-b})(pa);(function(b){var e,c=B.vertex_index_bytes*4+B.material_index_bytes,f=b+B.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})(aa);(function(b){var e,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
|
|
|
-4,f=b+B.nquad_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(ma);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},
|
|
|
-f3n:function(b,c,e,f,g,j,h,m,n){var j=b.materials[j],p=c[m*3],o=c[m*3+1],m=c[m*3+2],t=c[n*3],u=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(t,u,n)],null,j))},f4n:function(b,c,e,f,g,j,h,m,n,p,o){var h=b.materials[h],t=c[n*3],u=c[n*3+1],n=c[n*3+2],v=c[p*3],x=c[p*3+1],p=c[p*3+2],w=c[o*3],y=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,
|
|
|
-u,n),new THREE.Vector3(v,x,p),new THREE.Vector3(w,y,o)],null,h))},uv3:function(b,c,e,f,g,j,h){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(j,h));b.push(m)},uv4:function(b,c,e,f,g,j,h,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(j,h));p.push(new THREE.UV(m,n));b.push(p)}};
|
|
|
+new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function h(b,e,g,j,h,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=g;if(j){b[e].repeat.set(j[0],j[1]);if(j[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(j[1]!=
|
|
|
+1)b[e].wrapT=THREE.RepeatWrapping}h&&b[e].offset.set(h[0],h[1]);if(m){j={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(j[m[0]]!==void 0)b[e].wrapS=j[m[0]];if(j[m[1]]!==void 0)b[e].wrapT=j[m[1]]}f(b[e],c+"/"+g)}function j(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var g,m,o;m="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
|
|
|
+if(b.blending)if(b.blending=="Additive")g.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")g.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")g.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)g.transparent=b.transparent;if(b.depthTest!==void 0)g.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")g.vertexColors=THREE.FaceColors;else if(b.vertexColors)g.vertexColors=THREE.VertexColors;if(b.colorDiffuse)g.color=j(b.colorDiffuse);
|
|
|
+else if(b.DbgColor)g.color=b.DbgColor;if(b.colorSpecular)g.specular=j(b.colorSpecular);if(b.colorAmbient)g.ambient=j(b.colorAmbient);if(b.transparency)g.opacity=b.transparency;if(b.specularCoef)g.shininess=b.specularCoef;b.mapDiffuse&&c&&h(g,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&h(g,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&h(g,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
|
|
|
+b.mapSpecular&&c&&h(g,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(p.uniforms),t=g.color;m=g.specular;o=g.ambient;var v=g.shininess;n.tNormal.texture=g.normalMap;if(b.mapNormalFactor)n.uNormalScale.value=b.mapNormalFactor;if(g.map)n.tDiffuse.texture=g.map,n.enableDiffuse.value=!0;if(g.specularMap)n.tSpecular.texture=g.specularMap,n.enableSpecular.value=!0;if(g.lightMap)n.tAO.texture=
|
|
|
+g.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(t);n.uSpecularColor.value.setHex(m);n.uAmbientColor.value.setHex(o);n.uShininess.value=v;if(g.opacity)n.uOpacity.value=g.opacity;g=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:n,lights:!0,fog:!0})}else g=new THREE[m](g);return g}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
|
|
|
+THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,o,p,n,t,v,u,w,A,y,x,I,B,E=b.faces;t=b.vertices;var G=b.normals,H=b.colors,Q=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&Q++;for(c=0;c<Q;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];p=0;for(n=t.length;p<n;)v=new THREE.Vertex,v.position.x=t[p++]*e,v.position.y=
|
|
|
+t[p++]*e,v.position.z=t[p++]*e,f.vertices.push(v);p=0;for(n=E.length;p<n;){e=E[p++];t=e&1;o=e&2;c=e&4;h=e&8;u=e&16;v=e&32;A=e&64;e&=128;t?(y=new THREE.Face4,y.a=E[p++],y.b=E[p++],y.c=E[p++],y.d=E[p++],t=4):(y=new THREE.Face3,y.a=E[p++],y.b=E[p++],y.c=E[p++],t=3);if(o)o=E[p++],y.materials=f.materials[o];o=f.faces.length;if(c)for(c=0;c<Q;c++)x=b.uvs[c],w=E[p++],B=x[w*2],w=x[w*2+1],f.faceUvs[c][o]=new THREE.UV(B,w);if(h)for(c=0;c<Q;c++){x=b.uvs[c];I=[];for(h=0;h<t;h++)w=E[p++],B=x[w*2],w=x[w*2+1],I[h]=
|
|
|
+new THREE.UV(B,w);f.faceVertexUvs[c][o]=I}if(u)u=E[p++]*3,h=new THREE.Vector3,h.x=G[u++],h.y=G[u++],h.z=G[u],y.normal=h;if(v)for(c=0;c<t;c++)u=E[p++]*3,h=new THREE.Vector3,h.x=G[u++],h.y=G[u++],h.z=G[u],y.vertexNormals.push(h);if(A)v=E[p++],v=new THREE.Color(H[v]),y.color=v;if(e)for(c=0;c<t;c++)v=E[p++],v=new THREE.Color(H[v]),y.vertexColors.push(v);f.faces.push(y)}}})(h);(function(){var c,e,h,o;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],o=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
|
|
|
+o,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],o=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,o,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,o,p,n,t,v,u,w;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];u=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;o=0;for(p=w.length;o<p;o+=3)n=w[o]*c,t=w[o+1]*
|
|
|
+c,v=w[o+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(n,t,v)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;n=b.morphColors[e].colors;c=0;for(o=n.length;c<o;c+=3)t=new THREE.Color(16755200),t.setRGB(n[c],n[c+1],n[c+2]),p.push(t)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
|
|
|
+f.vertices[h],e,h))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
+THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),h=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,h,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
|
+c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,h,j){var g=new XMLHttpRequest,m=f+"/"+b,o=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,e,h,c):alert("Couldn't load ["+m+"] ["+g.status+"]"):g.readyState==3?j&&(o==0&&(o=g.getResponseHeader("Content-Length")),j({total:o,loaded:g.responseText.length})):g.readyState==2&&(o=g.getResponseHeader("Content-Length"))};g.open("GET",m,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
+g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(b,c,e,f){var h=function(c){function e(b,c){var f=n(b,c),g=n(b,c+1),h=n(b,c+2),j=n(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function h(b,c){var e=n(b,c),f=n(b,c+1),g=n(b,c+2);return(n(b,c+3)<<24)+(g<<16)+(f<<8)+e}function o(b,c){var e=n(b,c);return(n(b,c+1)<<8)+e}function p(b,c){var e=n(b,c);return e>127?e-256:e}function n(b,
|
|
|
+c){return b.charCodeAt(c)&255}function t(c){var e,f,g;e=h(b,c);f=h(b,c+H);g=h(b,c+Q);c=o(b,c+F);THREE.BinaryLoader.prototype.f3(x,e,f,g,c)}function v(c){var e,f,g,j,k,n;e=h(b,c);f=h(b,c+H);g=h(b,c+Q);j=o(b,c+F);k=h(b,c+C);n=h(b,c+N);c=h(b,c+W);THREE.BinaryLoader.prototype.f3n(x,E,e,f,g,j,k,n,c)}function u(c){var e,f,g,j;e=h(b,c);f=h(b,c+K);g=h(b,c+X);j=h(b,c+L);c=o(b,c+U);THREE.BinaryLoader.prototype.f4(x,e,f,g,j,c)}function w(c){var e,f,g,j,n,p,t,u;e=h(b,c);f=h(b,c+K);g=h(b,c+X);j=h(b,c+L);n=o(b,
|
|
|
+c+U);p=h(b,c+k);t=h(b,c+Z);u=h(b,c+P);c=h(b,c+aa);THREE.BinaryLoader.prototype.f4n(x,E,e,f,g,j,n,p,t,u,c)}function A(c){var e,f;e=h(b,c);f=h(b,c+ea);c=h(b,c+Y);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function y(c){var e,f,g;e=h(b,c);f=h(b,c+$);g=h(b,c+da);c=h(b,c+fa);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[g*2],G[g*2+1],G[c*2],G[c*2+1])}var x=this,I=0,B,E=[],G=[],H,Q,F,C,N,W,K,X,L,U,k,Z,P,aa,
|
|
|
+ea,Y,$,da,fa,pa,T,ha,ka,na,ga;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,f,c);B={signature:b.substr(I,8),header_bytes:n(b,I+8),vertex_coordinate_bytes:n(b,I+9),normal_coordinate_bytes:n(b,I+10),uv_coordinate_bytes:n(b,I+11),vertex_index_bytes:n(b,I+12),normal_index_bytes:n(b,I+13),uv_index_bytes:n(b,I+14),material_index_bytes:n(b,I+15),nvertices:h(b,I+16),nnormals:h(b,I+16+4),nuvs:h(b,I+16+8),ntri_flat:h(b,I+16+12),ntri_smooth:h(b,I+16+16),ntri_flat_uv:h(b,I+16+20),ntri_smooth_uv:h(b,
|
|
|
+I+16+24),nquad_flat:h(b,I+16+28),nquad_smooth:h(b,I+16+32),nquad_flat_uv:h(b,I+16+36),nquad_smooth_uv:h(b,I+16+40)};I+=B.header_bytes;H=B.vertex_index_bytes;Q=B.vertex_index_bytes*2;F=B.vertex_index_bytes*3;C=B.vertex_index_bytes*3+B.material_index_bytes;N=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;W=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;K=B.vertex_index_bytes;X=B.vertex_index_bytes*2;L=B.vertex_index_bytes*3;U=B.vertex_index_bytes*4;k=B.vertex_index_bytes*
|
|
|
+4+B.material_index_bytes;Z=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;P=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;aa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;ea=B.uv_index_bytes;Y=B.uv_index_bytes*2;$=B.uv_index_bytes;da=B.uv_index_bytes*2;fa=B.uv_index_bytes*3;c=B.vertex_index_bytes*3+B.material_index_bytes;ga=B.vertex_index_bytes*4+B.material_index_bytes;pa=B.ntri_flat*c;T=B.ntri_smooth*(c+B.normal_index_bytes*3);ha=
|
|
|
+B.ntri_flat_uv*(c+B.uv_index_bytes*3);ka=B.ntri_smooth_uv*(c+B.normal_index_bytes*3+B.uv_index_bytes*3);na=B.nquad_flat*ga;c=B.nquad_smooth*(ga+B.normal_index_bytes*4);ga=B.nquad_flat_uv*(ga+B.uv_index_bytes*4);I+=function(c){for(var f,h,j,k=B.vertex_coordinate_bytes*3,m=c+B.nvertices*k;c<m;c+=k)f=e(b,c),h=e(b,c+B.vertex_coordinate_bytes),j=e(b,c+B.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,f,h,j);return B.nvertices*k}(I);I+=function(c){for(var e,f,g,h=B.normal_coordinate_bytes*3,
|
|
|
+j=c+B.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+B.normal_coordinate_bytes),g=p(b,c+B.normal_coordinate_bytes*2),E.push(e/127,f/127,g/127);return B.nnormals*h}(I);I+=function(c){for(var f,h,j=B.uv_coordinate_bytes*2,k=c+B.nuvs*j;c<k;c+=j)f=e(b,c),h=e(b,c+B.uv_coordinate_bytes),G.push(f,h);return B.nuvs*j}(I);pa=I+pa;T=pa+T;ha=T+ha;ka=ha+ka;na=ka+na;c=na+c;ga=c+ga;(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=e+B.uv_index_bytes*3,g=b+B.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),A(c+e);return g-
|
|
|
+b})(T);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=e+B.uv_index_bytes*3,g=b+B.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),A(c+e);return g-b})(ha);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=e+B.uv_index_bytes*4,g=b+B.nquad_flat_uv*f;for(c=b;c<g;c+=f)u(c),y(c+e);return g-b})(c);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=e+B.uv_index_bytes*4,g=b+B.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),
|
|
|
+y(c+e);return g-b})(ga);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=b+B.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(I);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=b+B.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(pa);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=b+B.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(ka);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
|
|
|
+4,f=b+B.nquad_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})(na);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,h){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[h]))},f4:function(b,c,e,f,h,j){b.faces.push(new THREE.Face4(c,e,f,h,null,null,b.materials[j]))},
|
|
|
+f3n:function(b,c,e,f,h,j,g,m,o){var j=b.materials[j],p=c[m*3],n=c[m*3+1],m=c[m*3+2],t=c[o*3],v=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(p,n,m),new THREE.Vector3(t,v,o)],null,j))},f4n:function(b,c,e,f,h,j,g,m,o,p,n){var g=b.materials[g],t=c[o*3],v=c[o*3+1],o=c[o*3+2],u=c[p*3],w=c[p*3+1],p=c[p*3+2],A=c[n*3],y=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face4(e,f,h,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,
|
|
|
+v,o),new THREE.Vector3(u,w,p),new THREE.Vector3(A,y,n)],null,g))},uv3:function(b,c,e,f,h,j,g){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,h));m.push(new THREE.UV(j,g));b.push(m)},uv4:function(b,c,e,f,h,j,g,m,o){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,h));p.push(new THREE.UV(j,g));p.push(new THREE.UV(m,o));b.push(p)}};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:g+"/"+b}function m(){for(v in J.objects)if(!O.objects[v])if(E=J.objects[v],E.geometry!==void 0){if(A=O.geometries[E.geometry]){var b=!1;U=[];for(fa=0;fa<E.materials.length;fa++)U[fa]=O.materials[E.materials[fa]],b=U[fa]instanceof THREE.MeshShaderMaterial;b&&A.computeTangents();B=E.position;r=
|
|
|
-E.rotation;q=E.quaternion;s=E.scale;q=0;U.length==0&&(U[0]=new THREE.MeshFaceMaterial);U.length>1&&(U=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(A,U);object.name=v;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;O.scene.addObject(object);O.objects[v]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),O.scene.collisions.colliders.push(b));
|
|
|
-if(E.castsShadow)b=new THREE.ShadowVolume(A),O.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},O.triggers[object.name]=b)}}else B=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
-s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,O.scene.addObject(object),O.objects[v]=object,O.empties[v]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},O.triggers[object.name]=b)}function n(b){return function(c){O.geometries[b]=c;m();K-=1;e.onLoadComplete();o()}}function p(b){return function(e){O.geometries[b]=e}}function o(){e.callbackProgress({totalModels:k,totalTextures:W,loadedModels:k-K,loadedTextures:W-S},O);e.onLoadProgress();K==0&&S==0&&c(O)}var t,
|
|
|
-u,v,x,w,y,C,E,B,I,F,A,P,H,G,U,V,J,Z,K,S,k,W,O;J=b.data;G=new THREE.BinaryLoader;Z=new THREE.JSONLoader;S=K=0;O={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in J.objects)if(E=J.objects[v],E.meshCollider){b=!0;break}if(b)O.scene.collisions=new THREE.CollisionSystem;if(J.transform){b=J.transform.position;I=J.transform.rotation;var ga=J.transform.scale;b&&O.scene.position.set(b[0],b[1],b[2]);I&&O.scene.rotation.set(I[0],
|
|
|
-I[1],I[2]);ga&&O.scene.scale.set(ga[0],ga[1],ga[2]);(b||I||ga)&&O.scene.updateMatrix()}b=function(){S-=1;o();e.onLoadComplete()};for(w in J.cameras){I=J.cameras[w];if(I.type=="perspective")P=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")P=new THREE.Camera,P.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);B=I.position;I=I.target;P.position.set(B[0],B[1],B[2]);P.target.position.set(I[0],I[1],I[2]);O.cameras[w]=P}for(x in J.lights)w=J.lights[x],
|
|
|
-P=w.color!==void 0?w.color:16777215,I=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(B=w.direction,V=new THREE.DirectionalLight(P,I),V.position.set(B[0],B[1],B[2]),V.position.normalize()):w.type=="point"?(B=w.position,d=w.distance,V=new THREE.PointLight(P,I,d),V.position.set(B[0],B[1],B[2])):w.type=="ambient"&&(V=new THREE.AmbientLight(P)),O.scene.addLight(V),O.lights[x]=V;for(y in J.fogs)x=J.fogs[y],x.type=="linear"?H=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(H=new THREE.FogExp2(0,
|
|
|
-x.density)),I=x.color,H.color.setRGB(I[0],I[1],I[2]),O.fogs[y]=H;if(O.cameras&&J.defaults.camera)O.currentCamera=O.cameras[J.defaults.camera];if(O.fogs&&J.defaults.fog)O.scene.fog=O.fogs[J.defaults.fog];I=J.defaults.bgcolor;O.bgColor=new THREE.Color;O.bgColor.setRGB(I[0],I[1],I[2]);O.bgColorAlpha=J.defaults.bgalpha;for(t in J.geometries)if(y=J.geometries[t],y.type=="bin_mesh"||y.type=="ascii_mesh")K+=1,e.onLoadStart();k=K;for(t in J.geometries)y=J.geometries[t],y.type=="cube"?(A=new THREE.CubeGeometry(y.width,
|
|
|
-y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),O.geometries[t]=A):y.type=="plane"?(A=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),O.geometries[t]=A):y.type=="sphere"?(A=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),O.geometries[t]=A):y.type=="cylinder"?(A=new THREE.CylinderGeometry(y.numSegs,y.topRad,y.botRad,y.height,y.topOffset,y.botOffset),O.geometries[t]=A):y.type=="torus"?(A=new THREE.TorusGeometry(y.radius,
|
|
|
-y.tube,y.segmentsR,y.segmentsT),O.geometries[t]=A):y.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(y.subdivisions),O.geometries[t]=A):y.type=="bin_mesh"?G.load({model:f(y.url,J.urlBaseType),callback:n(t)}):y.type=="ascii_mesh"?Z.load({model:f(y.url,J.urlBaseType),callback:n(t)}):y.type=="embedded_mesh"&&(y=J.embeds[y.id])&&Z.createModel(y,p(t),"");for(C in J.textures)if(t=J.textures[C],t.url instanceof Array){S+=t.url.length;for(G=0;G<t.url.length;G++)e.onLoadStart()}else S+=1,e.onLoadStart();
|
|
|
-W=S;for(C in J.textures){t=J.textures[C];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){G=[];for(var fa=0;fa<t.url.length;fa++)G[fa]=f(t.url[fa],J.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,t.mapping,b)}else{G=THREE.ImageUtils.loadTexture(f(t.url,J.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)G.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)G.magFilter=THREE[t.magFilter];if(t.repeat){G.repeat.set(t.repeat[0],t.repeat[1]);
|
|
|
-if(t.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}t.offset&&G.offset.set(t.offset[0],t.offset[1]);if(t.wrap){Z={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Z[t.wrap[0]]!==void 0)G.wrapS=Z[t.wrap[0]];if(Z[t.wrap[1]]!==void 0)G.wrapT=Z[t.wrap[1]]}}O.textures[C]=G}for(u in J.materials){C=J.materials[u];for(F in C.parameters)if(F=="envMap"||F=="map"||F=="lightMap")C.parameters[F]=O.textures[C.parameters[F]];else if(F=="shading")C.parameters[F]=
|
|
|
-C.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")C.parameters[F]=THREE[C.parameters[F]]?THREE[C.parameters[F]]:THREE.NormalBlending;else if(F=="combine")C.parameters[F]=C.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(C.parameters[F]=="face")C.parameters[F]=THREE.FaceColors;else if(C.parameters[F])C.parameters[F]=THREE.VertexColors;if(C.parameters.opacity!==void 0&&C.parameters.opacity<1)C.parameters.transparent=
|
|
|
-!0;if(C.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);G=C.parameters.color;Z=C.parameters.specular;y=C.parameters.ambient;H=C.parameters.shininess;b.tNormal.texture=O.textures[C.parameters.normalMap];if(C.parameters.normalMapFactor)b.uNormalScale.value=C.parameters.normalMapFactor;if(C.parameters.map)b.tDiffuse.texture=C.parameters.map,b.enableDiffuse.value=!0;if(C.parameters.lightMap)b.tAO.texture=C.parameters.lightMap,b.enableAO.value=!0;if(C.parameters.specularMap)b.tSpecular.texture=
|
|
|
-O.textures[C.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(G);b.uSpecularColor.value.setHex(Z);b.uAmbientColor.value.setHex(y);b.uShininess.value=H;if(C.parameters.opacity)b.uOpacity.value=C.parameters.opacity;C=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else C=new THREE[C.type](C.parameters);O.materials[u]=C}m();e.callbackSync(O)}}};
|
|
|
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function m(){for(u in K.objects)if(!P.objects[u])if(I=K.objects[u],I.geometry!==void 0){if(H=P.geometries[I.geometry]){var b=!1;N=[];for(ea=0;ea<I.materials.length;ea++)N[ea]=P.materials[I.materials[ea]],b=N[ea]instanceof THREE.MeshShaderMaterial;b&&H.computeTangents();B=I.position;r=
|
|
|
+I.rotation;q=I.quaternion;s=I.scale;q=0;N.length==0&&(N[0]=new THREE.MeshFaceMaterial);N.length>1&&(N=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(H,N);object.name=u;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=I.visible;P.scene.addObject(object);P.objects[u]=object;I.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(b));
|
|
|
+if(I.castsShadow)b=new THREE.ShadowVolume(H),P.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},P.triggers[object.name]=b)}}else B=I.position,r=I.rotation,q=I.quaternion,s=I.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
+s[1],s[2]),object.visible=I.visible!==void 0?I.visible:!1,P.scene.addObject(object),P.objects[u]=object,P.empties[u]=object,I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},P.triggers[object.name]=b)}function o(b){return function(c){P.geometries[b]=c;m();L-=1;e.onLoadComplete();n()}}function p(b){return function(c){P.geometries[b]=c}}function n(){e.callbackProgress({totalModels:k,totalTextures:Z,loadedModels:k-L,loadedTextures:Z-U},P);e.onLoadProgress();L==0&&U==0&&c(P)}var t,
|
|
|
+v,u,w,A,y,x,I,B,E,G,H,Q,F,C,N,W,K,X,L,U,k,Z,P;K=b.data;C=new THREE.BinaryLoader;X=new THREE.JSONLoader;U=L=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in K.objects)if(I=K.objects[u],I.meshCollider){b=!0;break}if(b)P.scene.collisions=new THREE.CollisionSystem;if(K.transform){b=K.transform.position;E=K.transform.rotation;var aa=K.transform.scale;b&&P.scene.position.set(b[0],b[1],b[2]);E&&P.scene.rotation.set(E[0],
|
|
|
+E[1],E[2]);aa&&P.scene.scale.set(aa[0],aa[1],aa[2]);(b||E||aa)&&P.scene.updateMatrix()}b=function(){U-=1;n();e.onLoadComplete()};for(A in K.cameras){E=K.cameras[A];if(E.type=="perspective")Q=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")Q=new THREE.Camera,Q.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);B=E.position;E=E.target;Q.position.set(B[0],B[1],B[2]);Q.target.position.set(E[0],E[1],E[2]);P.cameras[A]=Q}for(w in K.lights)A=K.lights[w],
|
|
|
+Q=A.color!==void 0?A.color:16777215,E=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(B=A.direction,W=new THREE.DirectionalLight(Q,E),W.position.set(B[0],B[1],B[2]),W.position.normalize()):A.type=="point"?(B=A.position,d=A.distance,W=new THREE.PointLight(Q,E,d),W.position.set(B[0],B[1],B[2])):A.type=="ambient"&&(W=new THREE.AmbientLight(Q)),P.scene.addLight(W),P.lights[w]=W;for(y in K.fogs)w=K.fogs[y],w.type=="linear"?F=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(F=new THREE.FogExp2(0,
|
|
|
+w.density)),E=w.color,F.color.setRGB(E[0],E[1],E[2]),P.fogs[y]=F;if(P.cameras&&K.defaults.camera)P.currentCamera=P.cameras[K.defaults.camera];if(P.fogs&&K.defaults.fog)P.scene.fog=P.fogs[K.defaults.fog];E=K.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(E[0],E[1],E[2]);P.bgColorAlpha=K.defaults.bgalpha;for(t in K.geometries)if(y=K.geometries[t],y.type=="bin_mesh"||y.type=="ascii_mesh")L+=1,e.onLoadStart();k=L;for(t in K.geometries)y=K.geometries[t],y.type=="cube"?(H=new THREE.CubeGeometry(y.width,
|
|
|
+y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),P.geometries[t]=H):y.type=="plane"?(H=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),P.geometries[t]=H):y.type=="sphere"?(H=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),P.geometries[t]=H):y.type=="cylinder"?(H=new THREE.CylinderGeometry(y.numSegs,y.topRad,y.botRad,y.height,y.topOffset,y.botOffset),P.geometries[t]=H):y.type=="torus"?(H=new THREE.TorusGeometry(y.radius,
|
|
|
+y.tube,y.segmentsR,y.segmentsT),P.geometries[t]=H):y.type=="icosahedron"?(H=new THREE.IcosahedronGeometry(y.subdivisions),P.geometries[t]=H):y.type=="bin_mesh"?C.load({model:f(y.url,K.urlBaseType),callback:o(t)}):y.type=="ascii_mesh"?X.load({model:f(y.url,K.urlBaseType),callback:o(t)}):y.type=="embedded_mesh"&&(y=K.embeds[y.id])&&X.createModel(y,p(t),"");for(x in K.textures)if(t=K.textures[x],t.url instanceof Array){U+=t.url.length;for(C=0;C<t.url.length;C++)e.onLoadStart()}else U+=1,e.onLoadStart();
|
|
|
+Z=U;for(x in K.textures){t=K.textures[x];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){C=[];for(var ea=0;ea<t.url.length;ea++)C[ea]=f(t.url[ea],K.urlBaseType);C=THREE.ImageUtils.loadTextureCube(C,t.mapping,b)}else{C=THREE.ImageUtils.loadTexture(f(t.url,K.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)C.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)C.magFilter=THREE[t.magFilter];if(t.repeat){C.repeat.set(t.repeat[0],t.repeat[1]);
|
|
|
+if(t.repeat[0]!=1)C.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)C.wrapT=THREE.RepeatWrapping}t.offset&&C.offset.set(t.offset[0],t.offset[1]);if(t.wrap){X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(X[t.wrap[0]]!==void 0)C.wrapS=X[t.wrap[0]];if(X[t.wrap[1]]!==void 0)C.wrapT=X[t.wrap[1]]}}P.textures[x]=C}for(v in K.materials){x=K.materials[v];for(G in x.parameters)if(G=="envMap"||G=="map"||G=="lightMap")x.parameters[G]=P.textures[x.parameters[G]];else if(G=="shading")x.parameters[G]=
|
|
|
+x.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")x.parameters[G]=THREE[x.parameters[G]]?THREE[x.parameters[G]]:THREE.NormalBlending;else if(G=="combine")x.parameters[G]=x.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G=="vertexColors")if(x.parameters[G]=="face")x.parameters[G]=THREE.FaceColors;else if(x.parameters[G])x.parameters[G]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=
|
|
|
+!0;if(x.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);C=x.parameters.color;X=x.parameters.specular;y=x.parameters.ambient;F=x.parameters.shininess;b.tNormal.texture=P.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)b.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map)b.tDiffuse.texture=x.parameters.map,b.enableDiffuse.value=!0;if(x.parameters.lightMap)b.tAO.texture=x.parameters.lightMap,b.enableAO.value=!0;if(x.parameters.specularMap)b.tSpecular.texture=
|
|
|
+P.textures[x.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(C);b.uSpecularColor.value.setHex(X);b.uAmbientColor.value.setHex(y);b.uShininess.value=F;if(x.parameters.opacity)b.uOpacity.value=x.parameters.opacity;x=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else x=new THREE[x.type](x.parameters);P.materials[v]=x}m();e.callbackSync(P)}}};
|
|
|
THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
|
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,j,h,m,n,p,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[j]=m+h*this.delta;c[j+1]=n;c[j+2]=p;g[j]=this.lerp(o[b],o[b+3],h);g[j+1]=this.lerp(o[b+1],o[b+4],h);g[j+2]=this.lerp(o[b+2],o[b+5],h)};this.VIntY=function(b,c,g,j,h,m,n,p,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[j]=m;c[j+1]=n+h*this.delta;c[j+
|
|
|
-2]=p;c=b+this.yd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.VIntZ=function(b,c,g,j,h,m,n,p,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[j]=m;c[j+1]=n;c[j+2]=p+h*this.delta;c=b+this.zd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
|
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,j,h,m){var n=j+1,p=j+this.yd,o=j+this.zd,t=n+this.yd,u=n+this.zd,v=j+this.yd+this.zd,x=n+this.yd+this.zd,w=0,y=this.field[j],C=this.field[n],E=this.field[p],B=this.field[t],I=this.field[o],F=this.field[u],A=this.field[v],P=this.field[x];y<h&&(w|=1);C<h&&(w|=2);E<h&&(w|=8);B<h&&(w|=4);I<h&&(w|=16);F<h&&(w|=32);A<h&&(w|=128);P<h&&(w|=64);var H=THREE.edgeTable[w];if(H==0)return 0;var G=this.delta,
|
|
|
-U=b+G,V=c+G,G=g+G;H&1&&(this.compNorm(j),this.compNorm(n),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,y,C));H&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,h,U,c,g,C,B));H&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,h,b,V,g,E,B));H&8&&(this.compNorm(j),this.compNorm(p),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,y,E));H&16&&(this.compNorm(o),this.compNorm(u),this.VIntX(o*3,this.vlist,this.nlist,12,h,b,c,G,I,F));H&32&&(this.compNorm(u),
|
|
|
-this.compNorm(x),this.VIntY(u*3,this.vlist,this.nlist,15,h,U,c,G,F,P));H&64&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,18,h,b,V,G,A,P));H&128&&(this.compNorm(o),this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,21,h,b,c,G,I,A));H&256&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,y,I));H&512&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*3,this.vlist,this.nlist,27,h,U,c,g,C,F));H&1024&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*
|
|
|
-3,this.vlist,this.nlist,30,h,U,V,g,B,P));H&2048&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,33,h,b,V,g,E,A));w<<=4;for(h=j=0;THREE.triTable[w+h]!=-1;)b=w+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[j];this.positionArray[n+
|
|
|
-4]=b[j+1];this.positionArray[n+5]=b[j+2];this.positionArray[n+6]=b[h];this.positionArray[n+7]=b[h+1];this.positionArray[n+8]=b[h+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[j];this.normalArray[n+4]=c[j+1];this.normalArray[n+5]=c[j+2];this.normalArray[n+6]=c[h];this.normalArray[n+7]=c[h+1];this.normalArray[n+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
|
|
|
-this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,j,h){var m=this.size*Math.sqrt(j/h),n=g*this.size,p=c*this.size,o=b*this.size,t=Math.floor(n-m);t<1&&(t=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var u=Math.floor(p-m);u<1&&(u=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var v=Math.floor(o-m);v<1&&(v=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
|
|
|
-1);for(var x,w,y,C,E,B;t<n;t++){o=this.size2*t;w=t/this.size-g;E=w*w;for(w=u;w<p;w++){y=o+this.size*w;x=w/this.size-c;B=x*x;for(x=v;x<m;x++)C=x/this.size-b,C=j/(1.0E-6+C*C+B+E)-h,C>0&&(this.field[y+x]+=C)}}};this.addPlaneX=function(b,c){var g,j,h,m,n,p=this.size,o=this.yd,t=this.zd,u=this.field,v=p*Math.sqrt(b/c);v>p&&(v=p);for(g=0;g<v;g++)if(j=g/p,j*=j,m=b/(1.0E-4+j)-c,m>0)for(j=0;j<p;j++){n=g+j*o;for(h=0;h<p;h++)u[t*h+n]+=m}};this.addPlaneY=function(b,c){var g,j,h,m,n,p,o=this.size,t=this.yd,u=
|
|
|
-this.zd,v=this.field,x=o*Math.sqrt(b/c);x>o&&(x=o);for(j=0;j<x;j++)if(g=j/o,g*=g,m=b/(1.0E-4+g)-c,m>0){n=j*t;for(g=0;g<o;g++){p=n+g;for(h=0;h<o;h++)v[u*h+p]+=m}}};this.addPlaneZ=function(b,c){var g,j,h,m,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*h;for(j=0;j<size;j++){p=n+j*yd;for(g=0;g<size;g++)field[p+g]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
|
|
|
-3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,j,h,m,n,p,o,t,u=this.size-2;for(h=1;h<u;h++){t=this.size2*h;p=(h-this.halfsize)/this.halfsize;for(j=1;j<u;j++){o=t+this.size*j;n=(j-this.halfsize)/this.halfsize;for(g=1;g<u;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,n,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(j){var h,m,n,p,o,t,u,v;for(h=0;h<j.count;h++)u=h*3,o=u+1,v=u+2,m=j.positionArray[u],
|
|
|
-n=j.positionArray[o],p=j.positionArray[v],t=new THREE.Vector3(m,n,p),m=j.normalArray[u],n=j.normalArray[o],p=j.normalArray[v],u=new THREE.Vector3(m,n,p),u.normalize(),o=new THREE.Vertex(t),c.vertices.push(o),g.push(u);nfaces=j.count/3;for(h=0;h<nfaces;h++)u=(b+h)*3,o=u+1,v=u+2,t=g[u],m=g[o],n=g[v],u=new THREE.Face3(u,o,v,[t,m,n]),c.faces.push(u);b+=nfaces;j.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,j,g,m,o,p,n,t){g=(g-n)/(t-n);n=this.normal_cache;c[j]=m+g*this.delta;c[j+1]=o;c[j+2]=p;h[j]=this.lerp(n[b],n[b+3],g);h[j+1]=this.lerp(n[b+1],n[b+4],g);h[j+2]=this.lerp(n[b+2],n[b+5],g)};this.VIntY=function(b,c,h,j,g,m,o,p,n,t){g=(g-n)/(t-n);n=this.normal_cache;c[j]=m;c[j+1]=o+g*this.delta;c[j+
|
|
|
+2]=p;c=b+this.yd*3;h[j]=this.lerp(n[b],n[c],g);h[j+1]=this.lerp(n[b+1],n[c+1],g);h[j+2]=this.lerp(n[b+2],n[c+2],g)};this.VIntZ=function(b,c,h,j,g,m,o,p,n,t){g=(g-n)/(t-n);n=this.normal_cache;c[j]=m;c[j+1]=o;c[j+2]=p+g*this.delta;c=b+this.zd*3;h[j]=this.lerp(n[b],n[c],g);h[j+1]=this.lerp(n[b+1],n[c+1],g);h[j+2]=this.lerp(n[b+2],n[c+2],g)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
|
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,j,g,m){var o=j+1,p=j+this.yd,n=j+this.zd,t=o+this.yd,v=o+this.zd,u=j+this.yd+this.zd,w=o+this.yd+this.zd,A=0,y=this.field[j],x=this.field[o],I=this.field[p],B=this.field[t],E=this.field[n],G=this.field[v],H=this.field[u],Q=this.field[w];y<g&&(A|=1);x<g&&(A|=2);I<g&&(A|=8);B<g&&(A|=4);E<g&&(A|=16);G<g&&(A|=32);H<g&&(A|=128);Q<g&&(A|=64);var F=THREE.edgeTable[A];if(F==0)return 0;var C=this.delta,
|
|
|
+N=b+C,W=c+C,C=h+C;F&1&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,0,g,b,c,h,y,x));F&2&&(this.compNorm(o),this.compNorm(t),this.VIntY(o*3,this.vlist,this.nlist,3,g,N,c,h,x,B));F&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,g,b,W,h,I,B));F&8&&(this.compNorm(j),this.compNorm(p),this.VIntY(j*3,this.vlist,this.nlist,9,g,b,c,h,y,I));F&16&&(this.compNorm(n),this.compNorm(v),this.VIntX(n*3,this.vlist,this.nlist,12,g,b,c,C,E,G));F&32&&(this.compNorm(v),
|
|
|
+this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,g,N,c,C,G,Q));F&64&&(this.compNorm(u),this.compNorm(w),this.VIntX(u*3,this.vlist,this.nlist,18,g,b,W,C,H,Q));F&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,g,b,c,C,E,H));F&256&&(this.compNorm(j),this.compNorm(n),this.VIntZ(j*3,this.vlist,this.nlist,24,g,b,c,h,y,E));F&512&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*3,this.vlist,this.nlist,27,g,N,c,h,x,G));F&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
|
|
|
+3,this.vlist,this.nlist,30,g,N,W,h,B,Q));F&2048&&(this.compNorm(p),this.compNorm(u),this.VIntZ(p*3,this.vlist,this.nlist,33,g,b,W,h,I,H));A<<=4;for(g=j=0;THREE.triTable[A+g]!=-1;)b=A+g,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],m),g+=3,j++;return j};this.posnormtriv=function(b,c,h,j,g,m){var o=this.count*3;this.positionArray[o]=b[h];this.positionArray[o+1]=b[h+1];this.positionArray[o+2]=b[h+2];this.positionArray[o+3]=b[j];this.positionArray[o+
|
|
|
+4]=b[j+1];this.positionArray[o+5]=b[j+2];this.positionArray[o+6]=b[g];this.positionArray[o+7]=b[g+1];this.positionArray[o+8]=b[g+2];this.normalArray[o]=c[h];this.normalArray[o+1]=c[h+1];this.normalArray[o+2]=c[h+2];this.normalArray[o+3]=c[j];this.normalArray[o+4]=c[j+1];this.normalArray[o+5]=c[j+2];this.normalArray[o+6]=c[g];this.normalArray[o+7]=c[g+1];this.normalArray[o+8]=c[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
|
|
|
+this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,j,g){var m=this.size*Math.sqrt(j/g),o=h*this.size,p=c*this.size,n=b*this.size,t=Math.floor(o-m);t<1&&(t=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var v=Math.floor(p-m);v<1&&(v=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var u=Math.floor(n-m);u<1&&(u=1);m=Math.floor(n+m);m>this.size-1&&(m=this.size-
|
|
|
+1);for(var w,A,y,x,I,B;t<o;t++){n=this.size2*t;A=t/this.size-h;I=A*A;for(A=v;A<p;A++){y=n+this.size*A;w=A/this.size-c;B=w*w;for(w=u;w<m;w++)x=w/this.size-b,x=j/(1.0E-6+x*x+B+I)-g,x>0&&(this.field[y+w]+=x)}}};this.addPlaneX=function(b,c){var h,j,g,m,o,p=this.size,n=this.yd,t=this.zd,v=this.field,u=p*Math.sqrt(b/c);u>p&&(u=p);for(h=0;h<u;h++)if(j=h/p,j*=j,m=b/(1.0E-4+j)-c,m>0)for(j=0;j<p;j++){o=h+j*n;for(g=0;g<p;g++)v[t*g+o]+=m}};this.addPlaneY=function(b,c){var h,j,g,m,o,p,n=this.size,t=this.yd,v=
|
|
|
+this.zd,u=this.field,w=n*Math.sqrt(b/c);w>n&&(w=n);for(j=0;j<w;j++)if(h=j/n,h*=h,m=b/(1.0E-4+h)-c,m>0){o=j*t;for(h=0;h<n;h++){p=o+h;for(g=0;g<n;g++)u[v*g+p]+=m}}};this.addPlaneZ=function(b,c){var h,j,g,m,o,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(g=0;g<dist;g++)if(h=g/size,h*=h,m=b/(1.0E-4+h)-c,m>0){o=zd*g;for(j=0;j<size;j++){p=o+j*yd;for(h=0;h<size;h++)field[p+h]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
|
|
|
+3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,h,j,g,m,o,p,n,t,v=this.size-2;for(g=1;g<v;g++){t=this.size2*g;p=(g-this.halfsize)/this.halfsize;for(j=1;j<v;j++){n=t+this.size*j;o=(j-this.halfsize)/this.halfsize;for(h=1;h<v;h++)m=(h-this.halfsize)/this.halfsize,c=n+h,this.polygonize(m,o,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(j){var g,m,o,p,n,t,v,u;for(g=0;g<j.count;g++)v=g*3,n=v+1,u=v+2,m=j.positionArray[v],
|
|
|
+o=j.positionArray[n],p=j.positionArray[u],t=new THREE.Vector3(m,o,p),m=j.normalArray[v],o=j.normalArray[n],p=j.normalArray[u],v=new THREE.Vector3(m,o,p),v.normalize(),n=new THREE.Vertex(t),c.vertices.push(n),h.push(v);nfaces=j.count/3;for(g=0;g<nfaces;g++)v=(b+g)*3,n=v+1,u=v+2,t=h[v],m=h[n],o=h[u],v=new THREE.Face3(v,n,u,[t,m,o]),c.faces.push(v);b+=nfaces;j.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
@@ -584,27 +583,27 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
|
|
|
4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
|
|
|
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
|
|
|
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
|
|
|
-THREE.Trident=function(b){function c(c){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,b.length/20,b.length/5),new THREE.MeshBasicMaterial({color:c}))}function e(b,c){var e=new THREE.Geometry;e.vertices=[new THREE.Vertex,new THREE.Vertex(b)];return new THREE.Line(e,new THREE.LineBasicMaterial({color:c}))}THREE.Object3D.call(this);var f=Math.PI/2,g,b=b||THREE.Trident.defaultParams;if(b!==THREE.Trident.defaultParams)for(g in THREE.Trident.defaultParams)b.hasOwnProperty(g)||(b[g]=THREE.Trident.defaultParams[g]);
|
|
|
-this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(e(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(e(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(e(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)g=c(b.xAxisColor),g.rotation.y=-f,g.position.x=b.length,this.addChild(g),g=c(b.yAxisColor),g.rotation.x=f,g.position.y=b.length,this.addChild(g),g=c(b.zAxisColor),g.rotation.y=Math.PI,g.position.z=b.length,this.addChild(g)};
|
|
|
+THREE.Trident=function(b){function c(c){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,b.length/20,b.length/5),new THREE.MeshBasicMaterial({color:c}))}function e(b,c){var e=new THREE.Geometry;e.vertices=[new THREE.Vertex,new THREE.Vertex(b)];return new THREE.Line(e,new THREE.LineBasicMaterial({color:c}))}THREE.Object3D.call(this);var f=Math.PI/2,h,b=b||THREE.Trident.defaultParams;if(b!==THREE.Trident.defaultParams)for(h in THREE.Trident.defaultParams)b.hasOwnProperty(h)||(b[h]=THREE.Trident.defaultParams[h]);
|
|
|
+this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(e(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(e(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(e(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)h=c(b.xAxisColor),h.rotation.y=-f,h.position.x=b.length,this.addChild(h),h=c(b.yAxisColor),h.rotation.x=f,h.position.y=b.length,this.addChild(h),h=c(b.zAxisColor),h.rotation.y=Math.PI,h.position.z=b.length,this.addChild(h)};
|
|
|
THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
|
|
|
THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
|
|
|
-THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,j=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>j?this.hits.push(g):this.hits.unshift(g),j=f;return this.hits};
|
|
|
+THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,h,j=0;c=0;for(e=this.colliders.length;c<e;c++)if(h=this.colliders[c],f=this.rayCast(b,h),f<Number.MAX_VALUE)h.distance=f,f>j?this.hits.push(h):this.hits.unshift(h),j=f;return this.hits};
|
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
|
|
|
THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
|
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,j=0;j<c.numFaces;j++){var h=c.mesh.geometry.faces[j],m=c.mesh.geometry.vertices[h.a].position,n=c.mesh.geometry.vertices[h.b].position,p=c.mesh.geometry.vertices[h.c].position,o=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(e,m,n,p,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
-h instanceof THREE.Face4&&(h=this.rayTriangle(e,m,n,o,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(e,n,p,o,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
|
|
|
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,j,h){var m=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;j.set(0,0,0);m.sub(e,c);n.sub(f,e);j.cross(m,n);m=j.dot(b.direction);if(!(m<0))if(h.doubleSided||h.flipSided)j.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;h=j.dot(c)-j.dot(b.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=m*g))return Number.MAX_VALUE;h/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(h);m.addSelf(b.origin);Math.abs(j.x)>
|
|
|
-Math.abs(j.y)?Math.abs(j.x)>Math.abs(j.z)?(b=m.y-c.y,j=e.y-c.y,g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(j.y)>Math.abs(j.z)?(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=j*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=j*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h};
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,j=0;j<c.numFaces;j++){var g=c.mesh.geometry.faces[j],m=c.mesh.geometry.vertices[g.a].position,o=c.mesh.geometry.vertices[g.b].position,p=c.mesh.geometry.vertices[g.c].position,n=g instanceof THREE.Face4?c.mesh.geometry.vertices[g.d].position:null;g instanceof THREE.Face3?(g=this.rayTriangle(e,m,o,p,f,this.collisionNormal,c.mesh),g<f&&(f=g,h=j,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
+g instanceof THREE.Face4&&(g=this.rayTriangle(e,m,o,n,f,this.collisionNormal,c.mesh),g<f&&(f=g,h=j,c.normal.copy(this.collisionNormal),c.normal.normalize()),g=this.rayTriangle(e,o,p,n,f,this.collisionNormal,c.mesh),g<f&&(f=g,h=j,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:h}};
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,h,j,g){var m=THREE.CollisionSystem.__v1,o=THREE.CollisionSystem.__v2;j.set(0,0,0);m.sub(e,c);o.sub(f,e);j.cross(m,o);m=j.dot(b.direction);if(!(m<0))if(g.doubleSided||g.flipSided)j.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;g=j.dot(c)-j.dot(b.origin);if(!(g<=0))return Number.MAX_VALUE;if(!(g>=m*h))return Number.MAX_VALUE;g/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(g);m.addSelf(b.origin);Math.abs(j.x)>
|
|
|
+Math.abs(j.y)?Math.abs(j.x)>Math.abs(j.z)?(b=m.y-c.y,j=e.y-c.y,h=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,h=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(j.y)>Math.abs(j.z)?(b=m.x-c.x,j=e.x-c.x,h=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,h=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=j*f-e*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=j*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return g};
|
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
|
|
|
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,j=0,h=0,m=0,n=0,p=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,p=!1,h=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,h=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,p=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
|
|
|
-p=!1,m=1);e.origin.z<c.min.z?(j=c.min.z-e.origin.z,j/=e.direction.z,p=!1,n=-1):e.origin.z>c.max.z&&(j=c.max.z-e.origin.z,j/=e.direction.z,p=!1,n=1);if(p)return-1;p=0;g>f&&(p=1,f=g);j>f&&(p=2,f=j);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
|
|
|
-f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,j=0,g=0,m=0,o=0,p=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,p=!1,g=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,g=1);e.origin.y<c.min.y?(h=c.min.y-e.origin.y,h/=e.direction.y,p=!1,m=-1):e.origin.y>c.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y,
|
|
|
+p=!1,m=1);e.origin.z<c.min.z?(j=c.min.z-e.origin.z,j/=e.direction.z,p=!1,o=-1):e.origin.z>c.max.z&&(j=c.max.z-e.origin.z,j/=e.direction.z,p=!1,o=1);if(p)return-1;p=0;h>f&&(p=1,f=h);j>f&&(p=2,f=j);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(g,0,0);break;case 1:g=e.origin.x+e.direction.x*f;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
|
|
|
+f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:g=e.origin.x+e.direction.x*f;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,o)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
|
|
|
THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);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(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=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]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
|
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
|
|
|
-2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:u}},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}"});
|
|
|
-var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;u.width=b;u.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||p!==e.near||o!==e.fov){n=e.aspect;p=e.near;o=e.fov;var C=e.projectionMatrix.clone(),E=125/30*0.5,B=E*p/125,I=p*Math.tan(o*Math.PI/360),F;h.n14=E;m.n14=-E;E=-I*n+B;F=I*n+B;C.n11=2*p/(F-E);C.n13=(F+E)/(F-E);g.projectionMatrix=C.clone();E=-I*n-B;F=I*n-B;C.n11=2*p/(F-E);
|
|
|
-C.n13=(F+E)/(F-E);j.projectionMatrix=C.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,t,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=p;j.far=e.far;f.call(c,b,j,u,!0);f.call(c,x,v)}};
|
|
|
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,j,h=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;j=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;
|
|
|
-h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,h);this.setViewport(g,0,g,j);f.call(c,b,m,!1)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,j=new THREE.Camera,g=new THREE.Matrix4,m=new THREE.Matrix4,o,p,n;h.useTarget=j.useTarget=!1;h.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
|
|
|
+2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:v}},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}"});
|
|
|
+var w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(o!==e.aspect||p!==e.near||n!==e.fov){o=e.aspect;p=e.near;n=e.fov;var x=e.projectionMatrix.clone(),I=125/30*0.5,B=I*p/125,E=p*Math.tan(n*Math.PI/360),G;g.n14=I;m.n14=-I;I=-E*o+B;G=E*o+B;x.n11=2*p/(G-I);x.n13=(G+I)/(G-I);h.projectionMatrix=x.clone();I=-E*o-B;G=E*o-B;x.n11=2*p/(G-I);
|
|
|
+x.n13=(G+I)/(G-I);j.projectionMatrix=x.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(m);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,t,!0);j.matrix=e.matrixWorld.clone().multiplySelf(g);j.update(null,!0);j.position.copy(e.position);j.near=p;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,w,u)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,j,g=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;j=f};this.render=function(b,e){this.clear();g.fov=e.fov;g.aspect=0.5*e.aspect;g.near=e.near;g.far=e.far;
|
|
|
+g.updateProjectionMatrix();g.position.copy(e.position);g.target.position.copy(e.target.position);g.translateX(c.separation);m.projectionMatrix=g.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,h,j);f.call(c,b,g);this.setViewport(h,0,h,j);f.call(c,b,m,!1)}};
|