|
@@ -1,8 +1,8 @@
|
|
// Three.js r46dev - http://github.com/mrdoob/three.js
|
|
// Three.js r46dev - http://github.com/mrdoob/three.js
|
|
var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
|
|
var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
|
|
THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.0010*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
|
|
THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.0010*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
|
|
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var e,l,f;if(b===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),l=a*6-e,a=b*(1-c),f=b*(1-
|
|
|
|
-c*l),c=b*(1-c*(1-l)),e){case 1:this.r=f;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=f;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=f;break;case 6:case 0:this.r=b,this.g=c,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
|
|
|
|
|
|
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var e,k,f;if(b===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),k=a*6-e,a=b*(1-c),f=b*(1-
|
|
|
|
+c*k),c=b*(1-c*(1-k)),e){case 1:this.r=f;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=f;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=f;break;case 6:case 0:this.r=b,this.g=c,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
|
|
Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
|
|
Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
|
|
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
|
|
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
|
|
divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,a=this.y-a.y;return c*c+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
|
|
divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,a=this.y-a.y;return c*c+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
|
|
@@ -16,87 +16,87 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,e){this.x=
|
|
c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,e=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(e,this.intersectObject(a[c]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function c(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function b(a,b,c,u){e.copy(u).subSelf(b);
|
|
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,e=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(e,this.intersectObject(a[c]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function c(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function b(a,b,c,u){e.copy(u).subSelf(b);
|
|
-l.copy(c).subSelf(b);f.copy(a).subSelf(b);h=e.dot(e);k=e.dot(l);n=e.dot(f);t=l.dot(l);v=l.dot(f);p=1/(h*t-k*k);x=(t*n-k*v)*p;w=(h*v-k*n)*p;return x>=0&&w>=0&&x+w<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Vector3,h,k,n,t,v,p,x,w,z,u=[],B=0,y=a.children.length;B<y;B++)Array.prototype.push.apply(u,this.intersectObject(a.children[B]));if(a instanceof THREE.Particle){B=c(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.scale.x)return[];z={distance:B,point:a.position,
|
|
|
|
|
|
+k.copy(c).subSelf(b);f.copy(a).subSelf(b);h=e.dot(e);l=e.dot(k);n=e.dot(f);t=k.dot(k);v=k.dot(f);p=1/(h*t-l*l);x=(t*n-l*v)*p;w=(h*v-l*n)*p;return x>=0&&w>=0&&x+w<1}for(var e=new THREE.Vector3,k=new THREE.Vector3,f=new THREE.Vector3,h,l,n,t,v,p,x,w,z,u=[],B=0,y=a.children.length;B<y;B++)Array.prototype.push.apply(u,this.intersectObject(a.children[B]));if(a instanceof THREE.Particle){B=c(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.scale.x)return[];z={distance:B,point:a.position,
|
|
face:null,object:a};u.push(z)}else if(a instanceof THREE.Mesh){B=c(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return u;var F,C,H,L,R,D,O,K,N=a.geometry,J=N.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);B=0;for(y=N.faces.length;B<y;B++)if(z=N.faces[B],O=this.origin.clone(),K=this.direction.clone(),L=a.matrixWorld,F=L.multiplyVector3(z.centroid.clone()).subSelf(O),D=F.dot(K),
|
|
face:null,object:a};u.push(z)}else if(a instanceof THREE.Mesh){B=c(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return u;var F,C,H,L,R,D,O,K,N=a.geometry,J=N.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);B=0;for(y=N.faces.length;B<y;B++)if(z=N.faces[B],O=this.origin.clone(),K=this.direction.clone(),L=a.matrixWorld,F=L.multiplyVector3(z.centroid.clone()).subSelf(O),D=F.dot(K),
|
|
!(D<=0)&&(F=L.multiplyVector3(J[z.a].position.clone()),C=L.multiplyVector3(J[z.b].position.clone()),H=L.multiplyVector3(J[z.c].position.clone()),L=z instanceof THREE.Face4?L.multiplyVector3(J[z.d].position.clone()):null,R=a.matrixRotationWorld.multiplyVector3(z.normal.clone()),D=K.dot(R),a.doubleSided||(a.flipSided?D>0:D<0)))if(D=R.dot((new THREE.Vector3).sub(F,O))/D,O=O.addSelf(K.multiplyScalar(D)),z instanceof THREE.Face3)b(O,F,C,H)&&(z={distance:this.origin.distanceTo(O),point:O,face:z,object:a},
|
|
!(D<=0)&&(F=L.multiplyVector3(J[z.a].position.clone()),C=L.multiplyVector3(J[z.b].position.clone()),H=L.multiplyVector3(J[z.c].position.clone()),L=z instanceof THREE.Face4?L.multiplyVector3(J[z.d].position.clone()):null,R=a.matrixRotationWorld.multiplyVector3(z.normal.clone()),D=K.dot(R),a.doubleSided||(a.flipSided?D>0:D<0)))if(D=R.dot((new THREE.Vector3).sub(F,O))/D,O=O.addSelf(K.multiplyScalar(D)),z instanceof THREE.Face3)b(O,F,C,H)&&(z={distance:this.origin.distanceTo(O),point:O,face:z,object:a},
|
|
u.push(z));else if(z instanceof THREE.Face4&&(b(O,F,C,L)||b(O,C,H,L)))z={distance:this.origin.distanceTo(O),point:O,face:z,object:a},u.push(z)}return u}};
|
|
u.push(z));else if(z instanceof THREE.Face4&&(b(O,F,C,L)||b(O,C,H,L)))z={distance:this.origin.distanceTo(O),point:O,face:z,object:a},u.push(z)}return u}};
|
|
-THREE.Rectangle=function(){function a(){f=e-c;h=l-b}var c,b,e,l,f,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(f,h,v,p){k=!1;c=f;b=h;e=v;l=p;a()};this.addPoint=function(f,h){k?(k=!1,c=f,b=h,e=f,l=h):(c=c<f?c:f,b=b<h?b:h,e=e>f?e:f,l=l>h?l:h);a()};this.add3Points=
|
|
|
|
-function(f,h,v,p,x,w){k?(k=!1,c=f<v?f<x?f:x:v<x?v:x,b=h<p?h<w?h:w:p<w?p:w,e=f>v?f>x?f:x:v>x?v:x,l=h>p?h>w?h:w:p>w?p:w):(c=f<v?f<x?f<c?f:c:x<c?x:c:v<x?v<c?v:c:x<c?x:c,b=h<p?h<w?h<b?h:b:w<b?w:b:p<w?p<b?p:b:w<b?w:b,e=f>v?f>x?f>e?f:e:x>e?x:e:v>x?v>e?v:e:x>e?x:e,l=h>p?h>w?h>l?h:l:w>l?w:l:p>w?p>l?p:l:w>l?w:l);a()};this.addRectangle=function(f){k?(k=!1,c=f.getLeft(),b=f.getTop(),e=f.getRight(),l=f.getBottom()):(c=c<f.getLeft()?c:f.getLeft(),b=b<f.getTop()?b:f.getTop(),e=e>f.getRight()?e:f.getRight(),l=l>
|
|
|
|
-f.getBottom()?l:f.getBottom());a()};this.inflate=function(f){c-=f;b-=f;e+=f;l+=f;a()};this.minSelf=function(f){c=c>f.getLeft()?c:f.getLeft();b=b>f.getTop()?b:f.getTop();e=e<f.getRight()?e:f.getRight();l=l<f.getBottom()?l:f.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(l,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){k=!0;l=e=b=c=0;a()};this.isEmpty=function(){return k}};
|
|
|
|
-THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,e,l){return e+(a-c)*(l-e)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
|
|
|
|
|
|
+THREE.Rectangle=function(){function a(){f=e-c;h=k-b}var c,b,e,k,f,h,l=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return k};this.set=function(f,h,v,p){l=!1;c=f;b=h;e=v;k=p;a()};this.addPoint=function(f,h){l?(l=!1,c=f,b=h,e=f,k=h):(c=c<f?c:f,b=b<h?b:h,e=e>f?e:f,k=k>h?k:h);a()};this.add3Points=
|
|
|
|
+function(f,h,v,p,x,w){l?(l=!1,c=f<v?f<x?f:x:v<x?v:x,b=h<p?h<w?h:w:p<w?p:w,e=f>v?f>x?f:x:v>x?v:x,k=h>p?h>w?h:w:p>w?p:w):(c=f<v?f<x?f<c?f:c:x<c?x:c:v<x?v<c?v:c:x<c?x:c,b=h<p?h<w?h<b?h:b:w<b?w:b:p<w?p<b?p:b:w<b?w:b,e=f>v?f>x?f>e?f:e:x>e?x:e:v>x?v>e?v:e:x>e?x:e,k=h>p?h>w?h>k?h:k:w>k?w:k:p>w?p>k?p:k:w>k?w:k);a()};this.addRectangle=function(f){l?(l=!1,c=f.getLeft(),b=f.getTop(),e=f.getRight(),k=f.getBottom()):(c=c<f.getLeft()?c:f.getLeft(),b=b<f.getTop()?b:f.getTop(),e=e>f.getRight()?e:f.getRight(),k=k>
|
|
|
|
+f.getBottom()?k:f.getBottom());a()};this.inflate=function(f){c-=f;b-=f;e+=f;k+=f;a()};this.minSelf=function(f){c=c>f.getLeft()?c:f.getLeft();b=b>f.getTop()?b:f.getTop();e=e<f.getRight()?e:f.getRight();k=k<f.getBottom()?k:f.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(k,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){l=!0;k=e=b=c=0;a()};this.isEmpty=function(){return l}};
|
|
|
|
+THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,e,k){return e+(a-c)*(k-e)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
-THREE.Matrix4=function(a,c,b,e,l,f,h,k,n,t,v,p,x,w,z,u){this.set(a!==void 0?a:1,c||0,b||0,e||0,l||0,f!==void 0?f:1,h||0,k||0,n||0,t||0,v!==void 0?v:1,p||0,x||0,w||0,z||0,u!==void 0?u:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,l,f,h,k,n,t,v,p,x,w,z,u){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=l;this.n22=f;this.n23=h;this.n24=k;this.n31=n;this.n32=t;this.n33=v;this.n34=p;this.n41=x;this.n42=w;this.n43=z;this.n44=u;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
|
-c,b){var e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,c).normalize();if(f.length()===0)f.z=1;e.cross(b,f).normalize();e.length()===0&&(f.x+=1.0E-4,e.cross(b,f).normalize());l.cross(f,e).normalize();this.n11=e.x;this.n12=l.x;this.n13=f.x;this.n21=e.y;this.n22=l.y;this.n23=f.y;this.n31=e.z;this.n32=l.z;this.n33=f.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,l=a.n13,f=a.n14,h=a.n21,k=a.n22,n=a.n23,t=a.n24,v=a.n31,p=a.n32,x=a.n33,w=a.n34,z=a.n41,u=a.n42,B=a.n43,
|
|
|
|
-y=a.n44,F=c.n11,C=c.n12,H=c.n13,L=c.n14,R=c.n21,D=c.n22,O=c.n23,K=c.n24,N=c.n31,J=c.n32,M=c.n33,ea=c.n34,ja=c.n41,Z=c.n42,U=c.n43,o=c.n44;this.n11=b*F+e*R+l*N+f*ja;this.n12=b*C+e*D+l*J+f*Z;this.n13=b*H+e*O+l*M+f*U;this.n14=b*L+e*K+l*ea+f*o;this.n21=h*F+k*R+n*N+t*ja;this.n22=h*C+k*D+n*J+t*Z;this.n23=h*H+k*O+n*M+t*U;this.n24=h*L+k*K+n*ea+t*o;this.n31=v*F+p*R+x*N+w*ja;this.n32=v*C+p*D+x*J+w*Z;this.n33=v*H+p*O+x*M+w*U;this.n34=v*L+p*K+x*ea+w*o;this.n41=z*F+u*R+B*N+y*ja;this.n42=z*C+u*D+B*J+y*Z;this.n43=
|
|
|
|
|
|
+THREE.Matrix4=function(a,c,b,e,k,f,h,l,n,t,v,p,x,w,z,u){this.set(a!==void 0?a:1,c||0,b||0,e||0,k||0,f!==void 0?f:1,h||0,l||0,n||0,t||0,v!==void 0?v:1,p||0,x||0,w||0,z||0,u!==void 0?u:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,k,f,h,l,n,t,v,p,x,w,z,u){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=k;this.n22=f;this.n23=h;this.n24=l;this.n31=n;this.n32=t;this.n33=v;this.n34=p;this.n41=x;this.n42=w;this.n43=z;this.n44=u;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
|
+c,b){var e=THREE.Matrix4.__v1,k=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,c).normalize();if(f.length()===0)f.z=1;e.cross(b,f).normalize();e.length()===0&&(f.x+=1.0E-4,e.cross(b,f).normalize());k.cross(f,e).normalize();this.n11=e.x;this.n12=k.x;this.n13=f.x;this.n21=e.y;this.n22=k.y;this.n23=f.y;this.n31=e.z;this.n32=k.z;this.n33=f.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,k=a.n13,f=a.n14,h=a.n21,l=a.n22,n=a.n23,t=a.n24,v=a.n31,p=a.n32,x=a.n33,w=a.n34,z=a.n41,u=a.n42,B=a.n43,
|
|
|
|
+y=a.n44,F=c.n11,C=c.n12,H=c.n13,L=c.n14,R=c.n21,D=c.n22,O=c.n23,K=c.n24,N=c.n31,J=c.n32,M=c.n33,ea=c.n34,ja=c.n41,Z=c.n42,U=c.n43,o=c.n44;this.n11=b*F+e*R+k*N+f*ja;this.n12=b*C+e*D+k*J+f*Z;this.n13=b*H+e*O+k*M+f*U;this.n14=b*L+e*K+k*ea+f*o;this.n21=h*F+l*R+n*N+t*ja;this.n22=h*C+l*D+n*J+t*Z;this.n23=h*H+l*O+n*M+t*U;this.n24=h*L+l*K+n*ea+t*o;this.n31=v*F+p*R+x*N+w*ja;this.n32=v*C+p*D+x*J+w*Z;this.n33=v*H+p*O+x*M+w*U;this.n34=v*L+p*K+x*ea+w*o;this.n41=z*F+u*R+B*N+y*ja;this.n42=z*C+u*D+B*J+y*Z;this.n43=
|
|
z*H+u*O+B*M+y*U;this.n44=z*L+u*K+B*ea+y*o;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);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 this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=
|
|
z*H+u*O+B*M+y*U;this.n44=z*L+u*K+B*ea+y*o;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);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 this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=
|
|
-a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,l=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*l;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*l;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*l;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,l=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*l;a.y=
|
|
|
|
-this.n21*c+this.n22*b+this.n23*e+this.n24*l;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*l;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*l;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*
|
|
|
|
-a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,l=this.n21,f=this.n22,h=this.n23,k=this.n24,n=this.n31,t=this.n32,v=this.n33,p=this.n34,x=this.n41,w=this.n42,z=this.n43,u=this.n44;return e*h*t*x-b*k*t*x-e*f*v*x+c*k*v*x+b*f*p*x-c*h*p*x-e*h*n*w+b*k*n*w+e*l*v*w-a*k*v*w-b*l*p*w+a*h*p*w+e*f*n*z-c*k*n*z-e*l*t*z+a*k*t*z+c*l*p*z-a*f*p*z-b*f*n*u+c*h*n*u+b*l*t*u-a*h*t*u-
|
|
|
|
-c*l*v*u+a*f*v*u},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;
|
|
|
|
|
|
+a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,k=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*k;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*k;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*k;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,k=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*k;a.y=
|
|
|
|
+this.n21*c+this.n22*b+this.n23*e+this.n24*k;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*k;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*k;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*
|
|
|
|
+a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,k=this.n21,f=this.n22,h=this.n23,l=this.n24,n=this.n31,t=this.n32,v=this.n33,p=this.n34,x=this.n41,w=this.n42,z=this.n43,u=this.n44;return e*h*t*x-b*l*t*x-e*f*v*x+c*l*v*x+b*f*p*x-c*h*p*x-e*h*n*w+b*l*n*w+e*k*v*w-a*l*v*w-b*k*p*w+a*h*p*w+e*f*n*z-c*l*n*z-e*k*t*z+a*l*t*z+c*k*p*z-a*f*p*z-b*f*n*u+c*h*n*u+b*k*t*u-a*h*t*u-
|
|
|
|
+c*k*v*u+a*f*v*u},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;
|
|
a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},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(a){a[0]=
|
|
a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},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(a){a[0]=
|
|
this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=
|
|
this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=
|
|
this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,
|
|
this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,
|
|
-0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),l=1-b,f=a.x,h=a.y,k=a.z,n=l*f,t=l*h;this.set(n*f+b,n*h-e*k,n*k+e*h,0,n*h+e*k,t*h+b,t*k-e*f,0,n*k-e*h,t*k+e*f,l*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
|
|
|
|
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,e=a.n13,l=a.n14,f=a.n21,h=a.n22,k=a.n23,n=a.n24,t=a.n31,v=a.n32,p=a.n33,x=a.n34,w=a.n41,z=a.n42,u=a.n43,B=a.n44;this.n11=k*x*z-n*p*z+n*v*u-h*x*u-k*v*B+h*p*B;this.n12=l*p*z-e*x*z-l*v*u+b*x*u+e*v*B-b*p*B;this.n13=e*n*z-l*k*z+l*h*u-b*n*u-e*h*B+b*k*B;this.n14=l*k*v-e*n*v-l*h*p+b*n*p+e*h*x-b*k*x;this.n21=n*p*w-k*x*w-n*t*u+f*x*u+k*t*B-f*p*B;this.n22=e*x*w-l*p*w+
|
|
|
|
-l*t*u-c*x*u-e*t*B+c*p*B;this.n23=l*k*w-e*n*w-l*f*u+c*n*u+e*f*B-c*k*B;this.n24=e*n*t-l*k*t+l*f*p-c*n*p-e*f*x+c*k*x;this.n31=h*x*w-n*v*w+n*t*z-f*x*z-h*t*B+f*v*B;this.n32=l*v*w-b*x*w-l*t*z+c*x*z+b*t*B-c*v*B;this.n33=e*n*w-l*h*w+l*f*z-c*n*z-b*f*B+c*h*B;this.n34=l*h*t-b*n*t-l*f*v+c*n*v+b*f*x-c*h*x;this.n41=k*v*w-h*p*w-k*t*z+f*p*z+h*t*u-f*v*u;this.n42=b*p*w-e*v*w+e*t*z-c*p*z-b*t*u+c*v*u;this.n43=e*h*w-b*k*w-e*f*z+c*k*z+b*f*u-c*h*u;this.n44=b*k*t-e*h*t+e*f*v-c*k*v-b*f*p+c*h*p;this.multiplyScalar(1/a.determinant());
|
|
|
|
-return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,l=a.z,f=Math.cos(b),b=Math.sin(b),h=Math.cos(e),e=Math.sin(e),k=Math.cos(l),l=Math.sin(l);switch(c){case "YXZ":var n=h*k,t=h*l,v=e*k,p=e*l;this.n11=n+p*b;this.n12=v*b-t;this.n13=f*e;this.n21=f*l;this.n22=f*k;this.n23=-b;this.n31=t*b-v;this.n32=p+n*b;this.n33=f*h;break;case "ZXY":n=h*k;t=h*l;v=e*k;p=e*l;this.n11=n-p*b;this.n12=-f*l;this.n13=v+t*b;this.n21=t+v*b;this.n22=f*k;this.n23=p-n*b;this.n31=-f*e;this.n32=b;this.n33=f*h;break;case "ZYX":n=
|
|
|
|
-f*k;t=f*l;v=b*k;p=b*l;this.n11=h*k;this.n12=v*e-t;this.n13=n*e+p;this.n21=h*l;this.n22=p*e+n;this.n23=t*e-v;this.n31=-e;this.n32=b*h;this.n33=f*h;break;case "YZX":n=f*h;t=f*e;v=b*h;p=b*e;this.n11=h*k;this.n12=p-n*l;this.n13=v*l+t;this.n21=l;this.n22=f*k;this.n23=-b*k;this.n31=-e*k;this.n32=t*l+v;this.n33=n-p*l;break;case "XZY":n=f*h;t=f*e;v=b*h;p=b*e;this.n11=h*k;this.n12=-l;this.n13=e*k;this.n21=n*l+p;this.n22=f*k;this.n23=t*l-v;this.n31=v*l-t;this.n32=b*k;this.n33=p*l+n;break;default:n=f*k,t=f*
|
|
|
|
-l,v=b*k,p=b*l,this.n11=h*k,this.n12=-h*l,this.n13=e,this.n21=t+v*e,this.n22=n-p*e,this.n23=-b*h,this.n31=p-n*e,this.n32=v+t*e,this.n33=f*h}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,l=a.w,f=c+c,h=b+b,k=e+e,a=c*f,n=c*h;c*=k;var t=b*h;b*=k;e*=k;f*=l;h*=l;l*=k;this.n11=1-(t+e);this.n12=n-l;this.n13=c+h;this.n21=n+l;this.n22=1-(a+e);this.n23=b-f;this.n31=c-h;this.n32=b+f;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
|
|
|
|
-a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var e=THREE.Matrix4.__m1,l=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(c);l.setScale(b.x,b.y,b.z);this.multiply(e,l);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);l.set(this.n12,this.n22,this.n32);f.set(this.n13,
|
|
|
|
-this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=e.length();b.y=l.length();b.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=b.x;e.n21/=b.x;e.n31/=b.x;e.n12/=b.y;e.n22/=b.y;e.n32/=b.y;e.n13/=b.z;e.n23/=b.z;e.n33/=b.z;c.setFromRotationMatrix(e);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
|
|
|
|
|
|
+0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),k=1-b,f=a.x,h=a.y,l=a.z,n=k*f,t=k*h;this.set(n*f+b,n*h-e*l,n*l+e*h,0,n*h+e*l,t*h+b,t*l-e*f,0,n*l-e*h,t*l+e*f,k*l*l+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
|
|
|
|
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,e=a.n13,k=a.n14,f=a.n21,h=a.n22,l=a.n23,n=a.n24,t=a.n31,v=a.n32,p=a.n33,x=a.n34,w=a.n41,z=a.n42,u=a.n43,B=a.n44;this.n11=l*x*z-n*p*z+n*v*u-h*x*u-l*v*B+h*p*B;this.n12=k*p*z-e*x*z-k*v*u+b*x*u+e*v*B-b*p*B;this.n13=e*n*z-k*l*z+k*h*u-b*n*u-e*h*B+b*l*B;this.n14=k*l*v-e*n*v-k*h*p+b*n*p+e*h*x-b*l*x;this.n21=n*p*w-l*x*w-n*t*u+f*x*u+l*t*B-f*p*B;this.n22=e*x*w-k*p*w+
|
|
|
|
+k*t*u-c*x*u-e*t*B+c*p*B;this.n23=k*l*w-e*n*w-k*f*u+c*n*u+e*f*B-c*l*B;this.n24=e*n*t-k*l*t+k*f*p-c*n*p-e*f*x+c*l*x;this.n31=h*x*w-n*v*w+n*t*z-f*x*z-h*t*B+f*v*B;this.n32=k*v*w-b*x*w-k*t*z+c*x*z+b*t*B-c*v*B;this.n33=e*n*w-k*h*w+k*f*z-c*n*z-b*f*B+c*h*B;this.n34=k*h*t-b*n*t-k*f*v+c*n*v+b*f*x-c*h*x;this.n41=l*v*w-h*p*w-l*t*z+f*p*z+h*t*u-f*v*u;this.n42=b*p*w-e*v*w+e*t*z-c*p*z-b*t*u+c*v*u;this.n43=e*h*w-b*l*w-e*f*z+c*l*z+b*f*u-c*h*u;this.n44=b*l*t-e*h*t+e*f*v-c*l*v-b*f*p+c*h*p;this.multiplyScalar(1/a.determinant());
|
|
|
|
+return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,k=a.z,f=Math.cos(b),b=Math.sin(b),h=Math.cos(e),e=Math.sin(e),l=Math.cos(k),k=Math.sin(k);switch(c){case "YXZ":var n=h*l,t=h*k,v=e*l,p=e*k;this.n11=n+p*b;this.n12=v*b-t;this.n13=f*e;this.n21=f*k;this.n22=f*l;this.n23=-b;this.n31=t*b-v;this.n32=p+n*b;this.n33=f*h;break;case "ZXY":n=h*l;t=h*k;v=e*l;p=e*k;this.n11=n-p*b;this.n12=-f*k;this.n13=v+t*b;this.n21=t+v*b;this.n22=f*l;this.n23=p-n*b;this.n31=-f*e;this.n32=b;this.n33=f*h;break;case "ZYX":n=
|
|
|
|
+f*l;t=f*k;v=b*l;p=b*k;this.n11=h*l;this.n12=v*e-t;this.n13=n*e+p;this.n21=h*k;this.n22=p*e+n;this.n23=t*e-v;this.n31=-e;this.n32=b*h;this.n33=f*h;break;case "YZX":n=f*h;t=f*e;v=b*h;p=b*e;this.n11=h*l;this.n12=p-n*k;this.n13=v*k+t;this.n21=k;this.n22=f*l;this.n23=-b*l;this.n31=-e*l;this.n32=t*k+v;this.n33=n-p*k;break;case "XZY":n=f*h;t=f*e;v=b*h;p=b*e;this.n11=h*l;this.n12=-k;this.n13=e*l;this.n21=n*k+p;this.n22=f*l;this.n23=t*k-v;this.n31=v*k-t;this.n32=b*l;this.n33=p*k+n;break;default:n=f*l,t=f*
|
|
|
|
+k,v=b*l,p=b*k,this.n11=h*l,this.n12=-h*k,this.n13=e,this.n21=t+v*e,this.n22=n-p*e,this.n23=-b*h,this.n31=p-n*e,this.n32=v+t*e,this.n33=f*h}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,k=a.w,f=c+c,h=b+b,l=e+e,a=c*f,n=c*h;c*=l;var t=b*h;b*=l;e*=l;f*=k;h*=k;k*=l;this.n11=1-(t+e);this.n12=n-k;this.n13=c+h;this.n21=n+k;this.n22=1-(a+e);this.n23=b-f;this.n31=c-h;this.n32=b+f;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
|
|
|
|
+a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var e=THREE.Matrix4.__m1,k=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(c);k.setScale(b.x,b.y,b.z);this.multiply(e,k);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var e=THREE.Matrix4.__v1,k=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);k.set(this.n12,this.n22,this.n32);f.set(this.n13,
|
|
|
|
+this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=e.length();b.y=k.length();b.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=b.x;e.n21/=b.x;e.n31/=b.x;e.n12/=b.y;e.n22/=b.y;e.n32/=b.y;e.n13/=b.z;e.n23/=b.z;e.n33/=b.z;c.setFromRotationMatrix(e);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
|
|
return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),e=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
|
|
return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),e=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,l=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,v=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*h+a.n31*t;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*e;b[1]=a*l;b[2]=a*f;b[3]=a*h;b[4]=a*k;b[5]=a*n;b[6]=a*t;b[7]=a*v;b[8]=a*p;return c};
|
|
|
|
-THREE.Matrix4.makeFrustum=function(a,c,b,e,l,f){var h;h=new THREE.Matrix4;h.n11=2*l/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*l/(e-b);h.n23=(e+b)/(e-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(f+l)/(f-l);h.n34=-2*f*l/(f-l);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,e){var l,a=b*Math.tan(a*Math.PI/360);l=-a;return THREE.Matrix4.makeFrustum(l*c,a*c,l,a,b,e)};
|
|
|
|
-THREE.Matrix4.makeOrtho=function(a,c,b,e,l,f){var h,k,n,t;h=new THREE.Matrix4;k=c-a;n=b-e;t=f-l;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+a)/k);h.n21=0;h.n22=2/n;h.n23=0;h.n24=-((b+e)/n);h.n31=0;h.n32=0;h.n33=-2/t;h.n34=-((f+l)/t);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;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,k=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,l=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,v=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*h+a.n31*t;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*e;b[1]=a*k;b[2]=a*f;b[3]=a*h;b[4]=a*l;b[5]=a*n;b[6]=a*t;b[7]=a*v;b[8]=a*p;return c};
|
|
|
|
+THREE.Matrix4.makeFrustum=function(a,c,b,e,k,f){var h;h=new THREE.Matrix4;h.n11=2*k/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*k/(e-b);h.n23=(e+b)/(e-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(f+k)/(f-k);h.n34=-2*f*k/(f-k);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,e){var k,a=b*Math.tan(a*Math.PI/360);k=-a;return THREE.Matrix4.makeFrustum(k*c,a*c,k,a,b,e)};
|
|
|
|
+THREE.Matrix4.makeOrtho=function(a,c,b,e,k,f){var h,l,n,t;h=new THREE.Matrix4;l=c-a;n=b-e;t=f-k;h.n11=2/l;h.n12=0;h.n13=0;h.n14=-((c+a)/l);h.n21=0;h.n22=2/n;h.n23=0;h.n24=-((b+e)/n);h.n31=0;h.n32=0;h.n33=-2/t;h.n34=-((f+k)/t);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;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
|
|
THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
|
|
--1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,e,l;b=0;for(e=this.children.length;b<e;b++){l=this.children[b];if(l.name===a)return l;
|
|
|
|
-if(c&&(l=l.getChildByName(a,c),l!==void 0))return l}},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},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
|
|
|
|
|
|
+-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,e,k;b=0;for(e=this.children.length;b<e;b++){k=this.children[b];if(k.name===a)return k;
|
|
|
|
+if(c&&(k=k.getChildByName(a,c),k!==void 0))return k}},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},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
|
|
this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
-THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function c(){var a=t[n]=t[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,f=a.z+a.w,l=b.z+b.w,h=-a.z+a.w,k=-b.z+b.w;return f>=0&&l>=0&&h>=0&&k>=0?!0:f<0&&l<0||h<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-l)):l<0&&(e=Math.min(e,f/(f-l))),h<0?c=Math.max(c,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var l,f,h=[],k,n,t=[],
|
|
|
|
|
|
+THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function c(){var a=t[n]=t[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,f=a.z+a.w,k=b.z+b.w,h=-a.z+a.w,l=-b.z+b.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var k,f,h=[],l,n,t=[],
|
|
v,p,x=[],w,z=[],u,B,y=[],F,C,H=[],L={objects:[],sprites:[],lights:[],elements:[]},R=new THREE.Vector3,D=new THREE.Vector4,O=new THREE.Matrix4,K=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,M=new THREE.Vector4;this.computeFrustum=function(a){N[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);N[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);N[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
v,p,x=[],w,z=[],u,B,y=[],F,C,H=[],L={objects:[],sprites:[],lights:[],elements:[]},R=new THREE.Vector3,D=new THREE.Vector4,O=new THREE.Matrix4,K=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,M=new THREE.Vector4;this.computeFrustum=function(a){N[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);N[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);N[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
a.n23,a.n44+a.n24);N[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);N[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);N[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=N[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);O.multiply(b.projectionMatrix,b.matrixWorldInverse);O.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
a.n23,a.n44+a.n24);N[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);N[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);N[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=N[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);O.multiply(b.projectionMatrix,b.matrixWorldInverse);O.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
O.multiply(b.matrixWorld,b.projectionMatrixInverse);O.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,e){f=0;L.objects.length=0;L.sprites.length=0;L.lights.length=0;var h=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
|
|
O.multiply(b.matrixWorld,b.projectionMatrixInverse);O.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,e){f=0;L.objects.length=0;L.sprites.length=0;L.lights.length=0;var h=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
|
|
-f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),k=0;k<6;k++)if(c=N[k].x*e.n14+N[k].y*e.n24+N[k].z*e.n34+N[k].w,c<=f){c=!1;break a}c=!0}c?(O.multiplyVector3(R.copy(b.position)),l=a(),l.object=b,l.z=R.z,L.objects.push(l)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(O.multiplyVector3(R.copy(b.position)),l=a(),l.object=b,l.z=R.z,L.sprites.push(l)):b instanceof THREE.Light&&L.lights.push(b);c=0;for(e=b.children.length;c<e;c++)h(b.children[c])}};h(c);e&&
|
|
|
|
-L.objects.sort(b);return L};this.projectScene=function(a,f,l){var h=f.near,o=f.far,R,N,G,X,aa,na,la,ra,ia,da,S,fa,ha,I,Q,ka;C=B=w=p=0;L.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);O.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(O);L=this.projectGraph(a,!1);a=0;for(R=L.objects.length;a<R;a++)if(ia=L.objects[a].object,da=ia.matrixWorld,
|
|
|
|
-fa=ia.material,n=0,ia instanceof THREE.Mesh){S=ia.geometry;ha=ia.geometry.materials;X=S.vertices;I=S.faces;Q=S.faceVertexUvs;S=ia.matrixRotationWorld.extractRotation(da);N=0;for(G=X.length;N<G;N++)k=c(),k.positionWorld.copy(X[N].position),da.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),O.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>h&&k.positionScreen.z<o;X=0;for(N=I.length;X<
|
|
|
|
|
|
+f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),l=0;l<6;l++)if(c=N[l].x*e.n14+N[l].y*e.n24+N[l].z*e.n34+N[l].w,c<=f){c=!1;break a}c=!0}c?(O.multiplyVector3(R.copy(b.position)),k=a(),k.object=b,k.z=R.z,L.objects.push(k)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(O.multiplyVector3(R.copy(b.position)),k=a(),k.object=b,k.z=R.z,L.sprites.push(k)):b instanceof THREE.Light&&L.lights.push(b);c=0;for(e=b.children.length;c<e;c++)h(b.children[c])}};h(c);e&&
|
|
|
|
+L.objects.sort(b);return L};this.projectScene=function(a,f,k){var h=f.near,o=f.far,R,N,G,X,aa,na,la,ra,ia,da,S,fa,ha,I,Q,ka;C=B=w=p=0;L.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);O.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(O);L=this.projectGraph(a,!1);a=0;for(R=L.objects.length;a<R;a++)if(ia=L.objects[a].object,da=ia.matrixWorld,
|
|
|
|
+fa=ia.material,n=0,ia instanceof THREE.Mesh){S=ia.geometry;ha=ia.geometry.materials;X=S.vertices;I=S.faces;Q=S.faceVertexUvs;S=ia.matrixRotationWorld.extractRotation(da);N=0;for(G=X.length;N<G;N++)l=c(),l.positionWorld.copy(X[N].position),da.multiplyVector3(l.positionWorld),l.positionScreen.copy(l.positionWorld),O.multiplyVector4(l.positionScreen),l.positionScreen.x/=l.positionScreen.w,l.positionScreen.y/=l.positionScreen.w,l.visible=l.positionScreen.z>h&&l.positionScreen.z<o;X=0;for(N=I.length;X<
|
|
N;X++){G=I[X];if(G instanceof THREE.Face3)if(aa=t[G.a],na=t[G.b],la=t[G.c],aa.visible&&na.visible&&la.visible&&(ia.doubleSided||ia.flipSided!=(la.positionScreen.x-aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-(la.positionScreen.y-aa.positionScreen.y)*(na.positionScreen.x-aa.positionScreen.x)<0))ra=x[p]=x[p]||new THREE.RenderableFace3,p++,v=ra,v.v1.copy(aa),v.v2.copy(na),v.v3.copy(la);else continue;else if(G instanceof THREE.Face4)if(aa=t[G.a],na=t[G.b],la=t[G.c],ra=t[G.d],aa.visible&&
|
|
N;X++){G=I[X];if(G instanceof THREE.Face3)if(aa=t[G.a],na=t[G.b],la=t[G.c],aa.visible&&na.visible&&la.visible&&(ia.doubleSided||ia.flipSided!=(la.positionScreen.x-aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-(la.positionScreen.y-aa.positionScreen.y)*(na.positionScreen.x-aa.positionScreen.x)<0))ra=x[p]=x[p]||new THREE.RenderableFace3,p++,v=ra,v.v1.copy(aa),v.v2.copy(na),v.v3.copy(la);else continue;else if(G instanceof THREE.Face4)if(aa=t[G.a],na=t[G.b],la=t[G.c],ra=t[G.d],aa.visible&&
|
|
na.visible&&la.visible&&ra.visible&&(ia.doubleSided||ia.flipSided!=((ra.positionScreen.x-aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-(ra.positionScreen.y-aa.positionScreen.y)*(na.positionScreen.x-aa.positionScreen.x)<0||(na.positionScreen.x-la.positionScreen.x)*(ra.positionScreen.y-la.positionScreen.y)-(na.positionScreen.y-la.positionScreen.y)*(ra.positionScreen.x-la.positionScreen.x)<0)))ka=z[w]=z[w]||new THREE.RenderableFace4,w++,v=ka,v.v1.copy(aa),v.v2.copy(na),v.v3.copy(la),
|
|
na.visible&&la.visible&&ra.visible&&(ia.doubleSided||ia.flipSided!=((ra.positionScreen.x-aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-(ra.positionScreen.y-aa.positionScreen.y)*(na.positionScreen.x-aa.positionScreen.x)<0||(na.positionScreen.x-la.positionScreen.x)*(ra.positionScreen.y-la.positionScreen.y)-(na.positionScreen.y-la.positionScreen.y)*(ra.positionScreen.x-la.positionScreen.x)<0)))ka=z[w]=z[w]||new THREE.RenderableFace4,w++,v=ka,v.v1.copy(aa),v.v2.copy(na),v.v3.copy(la),
|
|
v.v4.copy(ra);else continue;v.normalWorld.copy(G.normal);S.multiplyVector3(v.normalWorld);v.centroidWorld.copy(G.centroid);da.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);O.multiplyVector3(v.centroidScreen);la=G.vertexNormals;aa=0;for(na=la.length;aa<na;aa++)ra=v.vertexNormalsWorld[aa],ra.copy(la[aa]),S.multiplyVector3(ra);aa=0;for(na=Q.length;aa<na;aa++)if(ka=Q[aa][X]){la=0;for(ra=ka.length;la<ra;la++)v.uvs[aa][la]=ka[la]}v.material=fa;v.faceMaterial=G.materialIndex!==
|
|
v.v4.copy(ra);else continue;v.normalWorld.copy(G.normal);S.multiplyVector3(v.normalWorld);v.centroidWorld.copy(G.centroid);da.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);O.multiplyVector3(v.centroidScreen);la=G.vertexNormals;aa=0;for(na=la.length;aa<na;aa++)ra=v.vertexNormalsWorld[aa],ra.copy(la[aa]),S.multiplyVector3(ra);aa=0;for(na=Q.length;aa<na;aa++)if(ka=Q[aa][X]){la=0;for(ra=ka.length;la<ra;la++)v.uvs[aa][la]=ka[la]}v.material=fa;v.faceMaterial=G.materialIndex!==
|
|
null?ha[G.materialIndex]:null;v.z=v.centroidScreen.z;L.elements.push(v)}}else if(ia instanceof THREE.Line){K.multiply(O,da);X=ia.geometry.vertices;aa=c();aa.positionScreen.copy(X[0].position);K.multiplyVector4(aa.positionScreen);N=1;for(G=X.length;N<G;N++)if(aa=c(),aa.positionScreen.copy(X[N].position),K.multiplyVector4(aa.positionScreen),na=t[n-2],J.copy(aa.positionScreen),M.copy(na.positionScreen),e(J,M))J.multiplyScalar(1/J.w),M.multiplyScalar(1/M.w),ia=y[B]=y[B]||new THREE.RenderableLine,B++,
|
|
null?ha[G.materialIndex]:null;v.z=v.centroidScreen.z;L.elements.push(v)}}else if(ia instanceof THREE.Line){K.multiply(O,da);X=ia.geometry.vertices;aa=c();aa.positionScreen.copy(X[0].position);K.multiplyVector4(aa.positionScreen);N=1;for(G=X.length;N<G;N++)if(aa=c(),aa.positionScreen.copy(X[N].position),K.multiplyVector4(aa.positionScreen),na=t[n-2],J.copy(aa.positionScreen),M.copy(na.positionScreen),e(J,M))J.multiplyScalar(1/J.w),M.multiplyScalar(1/M.w),ia=y[B]=y[B]||new THREE.RenderableLine,B++,
|
|
u=ia,u.v1.positionScreen.copy(J),u.v2.positionScreen.copy(M),u.z=Math.max(J.z,M.z),u.material=fa,L.elements.push(u)}a=0;for(R=L.sprites.length;a<R;a++)if(ia=L.sprites[a].object,da=ia.matrixWorld,ia instanceof THREE.Particle&&(D.set(da.n14,da.n24,da.n34,1),O.multiplyVector4(D),D.z/=D.w,D.z>0&&D.z<1))h=H[C]=H[C]||new THREE.RenderableParticle,C++,F=h,F.x=D.x/D.w,F.y=D.y/D.w,F.z=D.z,F.rotation=ia.rotation.z,F.scale.x=ia.scale.x*Math.abs(F.x-(D.x+f.projectionMatrix.n11)/(D.w+f.projectionMatrix.n14)),F.scale.y=
|
|
u=ia,u.v1.positionScreen.copy(J),u.v2.positionScreen.copy(M),u.z=Math.max(J.z,M.z),u.material=fa,L.elements.push(u)}a=0;for(R=L.sprites.length;a<R;a++)if(ia=L.sprites[a].object,da=ia.matrixWorld,ia instanceof THREE.Particle&&(D.set(da.n14,da.n24,da.n34,1),O.multiplyVector4(D),D.z/=D.w,D.z>0&&D.z<1))h=H[C]=H[C]||new THREE.RenderableParticle,C++,F=h,F.x=D.x/D.w,F.y=D.y/D.w,F.z=D.z,F.rotation=ia.rotation.z,F.scale.x=ia.scale.x*Math.abs(F.x-(D.x+f.projectionMatrix.n11)/(D.w+f.projectionMatrix.n14)),F.scale.y=
|
|
-ia.scale.y*Math.abs(F.y-(D.y+f.projectionMatrix.n22)/(D.w+f.projectionMatrix.n24)),F.material=ia.material,L.elements.push(F);l&&L.elements.sort(b);return L}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
|
|
|
|
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,e=a.y*c,l=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-l),l=Math.sin(-l),f=Math.cos(b),b=Math.sin(b),h=a*c,k=e*l;this.w=h*f-k*b;this.x=h*b+k*f;this.y=e*c*f+a*l*b;this.z=a*l*f-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
|
|
|
|
|
|
+ia.scale.y*Math.abs(F.y-(D.y+f.projectionMatrix.n22)/(D.w+f.projectionMatrix.n24)),F.material=ia.material,L.elements.push(F);k&&L.elements.sort(b);return L}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
|
|
|
|
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,e=a.y*c,k=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-k),k=Math.sin(-k),f=Math.cos(b),b=Math.sin(b),h=a*c,l=e*k;this.w=h*f-l*b;this.x=h*b+l*f;this.y=e*c*f+a*k*b;this.z=a*k*f-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
|
|
-this.x,b=this.y,e=this.z,l=this.w,f=a.x,h=a.y,k=a.z,a=a.w;this.x=c*a+l*f+b*k-e*h;this.y=b*a+l*h+e*f-c*k;this.z=e*a+l*k+c*h-b*f;this.w=l*a-c*f-b*h-e*k;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,l=a.z,f=this.x,h=this.y,k=this.z,n=this.w,t=n*b+h*l-k*e,v=n*e+k*b-f*l,p=n*l+f*e-h*b,b=-f*
|
|
|
|
-b-h*e-k*l;c.x=t*n+b*-f+v*-k-p*-h;c.y=v*n+b*-h+p*-f-t*-k;c.z=p*n+b*-k+t*-h-v*-f;return c}};
|
|
|
|
-THREE.Quaternion.slerp=function(a,c,b,e){var l=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;l<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,l=-l):b.copy(c);if(Math.abs(l)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var f=Math.acos(l),l=Math.sqrt(1-l*l);if(Math.abs(l)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*f)/l;e=Math.sin(e*f)/l;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
|
-THREE.Face3=function(a,c,b,e,l,f){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=l instanceof THREE.Color?l:new THREE.Color;this.vertexColors=l instanceof Array?l:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
|
|
|
|
-THREE.Face4=function(a,c,b,e,l,f,h){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=l instanceof THREE.Vector3?l:new THREE.Vector3;this.vertexNormals=l instanceof Array?l:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
|
|
|
|
|
|
+this.x,b=this.y,e=this.z,k=this.w,f=a.x,h=a.y,l=a.z,a=a.w;this.x=c*a+k*f+b*l-e*h;this.y=b*a+k*h+e*f-c*l;this.z=e*a+k*l+c*h-b*f;this.w=k*a-c*f-b*h-e*l;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,k=a.z,f=this.x,h=this.y,l=this.z,n=this.w,t=n*b+h*k-l*e,v=n*e+l*b-f*k,p=n*k+f*e-h*b,b=-f*
|
|
|
|
+b-h*e-l*k;c.x=t*n+b*-f+v*-l-p*-h;c.y=v*n+b*-h+p*-f-t*-l;c.z=p*n+b*-l+t*-h-v*-f;return c}};
|
|
|
|
+THREE.Quaternion.slerp=function(a,c,b,e){var k=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;k<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,k=-k):b.copy(c);if(Math.abs(k)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var f=Math.acos(k),k=Math.sqrt(1-k*k);if(Math.abs(k)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*f)/k;e=Math.sin(e*f)/k;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
|
+THREE.Face3=function(a,c,b,e,k,f){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
|
|
|
|
+THREE.Face4=function(a,c,b,e,k,f,h){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=k instanceof THREE.Vector3?k:new THREE.Vector3;this.vertexNormals=k instanceof Array?k:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
|
|
THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
|
|
THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
|
|
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var c=new THREE.Matrix4;c.extractRotation(a,new THREE.Vector3(1,1,1));for(var b=0,e=this.vertices.length;b<e;b++)a.multiplyVector3(this.vertices[b].position);b=0;for(e=this.faces.length;b<e;b++){var l=this.faces[b];c.multiplyVector3(l.normal);for(var f=0,h=l.vertexNormals.length;f<h;f++)c.multiplyVector3(l.vertexNormals[f]);a.multiplyVector3(l.centroid)}},computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<
|
|
|
|
|
|
+THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var c=new THREE.Matrix4;c.extractRotation(a,new THREE.Vector3(1,1,1));for(var b=0,e=this.vertices.length;b<e;b++)a.multiplyVector3(this.vertices[b].position);b=0;for(e=this.faces.length;b<e;b++){var k=this.faces[b];c.multiplyVector3(k.normal);for(var f=0,h=k.vertexNormals.length;f<h;f++)c.multiplyVector3(k.vertexNormals[f]);a.multiplyVector3(k.centroid)}},computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<
|
|
c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid.addSelf(this.vertices[b.a].position),b.centroid.addSelf(this.vertices[b.b].position),b.centroid.addSelf(this.vertices[b.c].position),b.centroid.divideScalar(3)):b instanceof THREE.Face4&&(b.centroid.addSelf(this.vertices[b.a].position),b.centroid.addSelf(this.vertices[b.b].position),b.centroid.addSelf(this.vertices[b.c].position),b.centroid.addSelf(this.vertices[b.d].position),b.centroid.divideScalar(4))},computeFaceNormals:function(a){var c,
|
|
c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid.addSelf(this.vertices[b.a].position),b.centroid.addSelf(this.vertices[b.b].position),b.centroid.addSelf(this.vertices[b.c].position),b.centroid.divideScalar(3)):b instanceof THREE.Face4&&(b.centroid.addSelf(this.vertices[b.a].position),b.centroid.addSelf(this.vertices[b.b].position),b.centroid.addSelf(this.vertices[b.c].position),b.centroid.addSelf(this.vertices[b.d].position),b.centroid.divideScalar(4))},computeFaceNormals:function(a){var c,
|
|
-b,e,l,f,h,k=new THREE.Vector3,n=new THREE.Vector3;e=0;for(l=this.faces.length;e<l;e++){f=this.faces[e];if(a&&f.vertexNormals.length){k.set(0,0,0);c=0;for(b=f.vertexNormals.length;c<b;c++)k.addSelf(f.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[f.a],b=this.vertices[f.b],h=this.vertices[f.c],k.sub(h.position,b.position),n.sub(c.position,b.position),k.crossSelf(n);k.isZero()||k.normalize();f.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
|
|
|
|
|
|
+b,e,k,f,h,l=new THREE.Vector3,n=new THREE.Vector3;e=0;for(k=this.faces.length;e<k;e++){f=this.faces[e];if(a&&f.vertexNormals.length){l.set(0,0,0);c=0;for(b=f.vertexNormals.length;c<b;c++)l.addSelf(f.vertexNormals[c]);l.divideScalar(3)}else c=this.vertices[f.a],b=this.vertices[f.b],h=this.vertices[f.c],l.sub(h.position,b.position),n.sub(c.position,b.position),l.crossSelf(n);l.isZero()||l.normalize();f.normal.copy(l)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
|
|
Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
|
|
Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
|
|
THREE.Face3?(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal),e[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(e[b.a]),b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(e[b.a]),
|
|
THREE.Face3?(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal),e[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(e[b.a]),b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(e[b.a]),
|
|
-b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,f,l,U){k=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;v=h[f];p=h[l];x=h[U];w=n.x-k.x;z=t.x-k.x;u=n.y-k.y;B=t.y-k.y;y=n.z-k.z;F=t.z-k.z;C=p.u-v.u;H=x.u-v.u;L=p.v-v.v;R=x.v-v.v;D=1/(C*R-H*L);J.set((R*w-L*z)*D,(R*u-L*B)*D,(R*y-L*F)*D);M.set((C*z-H*w)*D,(C*B-H*u)*D,(C*F-H*y)*D);K[b].addSelf(J);K[c].addSelf(J);K[e].addSelf(J);N[b].addSelf(M);
|
|
|
|
-N[c].addSelf(M);N[e].addSelf(M)}var c,b,e,l,f,h,k,n,t,v,p,x,w,z,u,B,y,F,C,H,L,R,D,O,K=[],N=[],J=new THREE.Vector3,M=new THREE.Vector3,ea=new THREE.Vector3,ja=new THREE.Vector3,Z=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)K[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)f=this.faces[c],h=this.faceVertexUvs[0][c],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var U=["a",
|
|
|
|
-"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){f=this.faces[c];for(e=0;e<f.vertexNormals.length;e++)Z.copy(f.vertexNormals[e]),l=f[U[e]],O=K[l],ea.copy(O),ea.subSelf(Z.multiplyScalar(Z.dot(O))).normalize(),ja.cross(f.vertexNormals[e],O),l=ja.dot(N[l]),l=l<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(ea.x,ea.y,ea.z,l)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
|
|
|
|
+b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,f,k,U){l=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;v=h[f];p=h[k];x=h[U];w=n.x-l.x;z=t.x-l.x;u=n.y-l.y;B=t.y-l.y;y=n.z-l.z;F=t.z-l.z;C=p.u-v.u;H=x.u-v.u;L=p.v-v.v;R=x.v-v.v;D=1/(C*R-H*L);J.set((R*w-L*z)*D,(R*u-L*B)*D,(R*y-L*F)*D);M.set((C*z-H*w)*D,(C*B-H*u)*D,(C*F-H*y)*D);K[b].addSelf(J);K[c].addSelf(J);K[e].addSelf(J);N[b].addSelf(M);
|
|
|
|
+N[c].addSelf(M);N[e].addSelf(M)}var c,b,e,k,f,h,l,n,t,v,p,x,w,z,u,B,y,F,C,H,L,R,D,O,K=[],N=[],J=new THREE.Vector3,M=new THREE.Vector3,ea=new THREE.Vector3,ja=new THREE.Vector3,Z=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)K[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)f=this.faces[c],h=this.faceVertexUvs[0][c],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var U=["a",
|
|
|
|
+"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){f=this.faces[c];for(e=0;e<f.vertexNormals.length;e++)Z.copy(f.vertexNormals[e]),k=f[U[e]],O=K[k],ea.copy(O),ea.subSelf(Z.multiplyScalar(Z.dot(O))).normalize(),ja.cross(f.vertexNormals[e],O),k=ja.dot(N[k]),k=k<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(ea.x,ea.y,ea.z,k)}this.hasTangents=!0},computeBoundingBox:function(){var a;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,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
-a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],e,l=Math.pow(10,4),f,h;f=0;for(h=this.vertices.length;f<h;f++)e=this.vertices[f].position,e=[Math.round(e.x*l),Math.round(e.y*l),Math.round(e.z*l)].join("_"),a[e]===void 0?(a[e]=f,c.push(this.vertices[f]),
|
|
|
|
|
|
+a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],e,k=Math.pow(10,4),f,h;f=0;for(h=this.vertices.length;f<h;f++)e=this.vertices[f].position,e=[Math.round(e.x*k),Math.round(e.y*k),Math.round(e.z*k)].join("_"),a[e]===void 0?(a[e]=f,c.push(this.vertices[f]),
|
|
b[f]=c.length-1):b[f]=b[a[e]];f=0;for(h=this.faces.length;f<h;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
|
|
b[f]=c.length-1):b[f]=b[a[e]];f=0;for(h=this.faces.length;f<h;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
|
|
-THREE.Spline=function(a){function c(a,b,c,e,f,l,h){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*h+(-3*(b-c)-2*a-e)*l+a*f+b}this.points=a;var b=[],e={x:0,y:0,z:0},l,f,h,k,n,t,v,p,x;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){l=(this.points.length-1)*a;f=Math.floor(l);h=l-f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>this.points.length-2?f:f+1;b[3]=f>this.points.length-3?f:f+2;t=this.points[b[0]];v=this.points[b[1]];
|
|
|
|
-p=this.points[b[2]];x=this.points[b[3]];k=h*h;n=h*k;e.x=c(t.x,v.x,p.x,x.x,h,k,n);e.y=c(t.y,v.y,p.y,x.y,h,k,n);e.z=c(t.z,v.z,p.z,x.z,h,k,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,f=new THREE.Vector3,l=new THREE.Vector3,h=[],k=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),l.copy(position),
|
|
|
|
-k+=l.distanceTo(f),f.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=k,e=b);h[h.length]=k;return{chunks:h,total:k}};this.reparametrizeByArcLength=function(a){var b,c,e,f,l,h,k=[],n=new THREE.Vector3,t=this.getLength();k.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=t.chunks[b]-t.chunks[b-1];h=Math.ceil(a*c/t.total);f=(b-1)/(this.points.length-1);l=b/(this.points.length-1);for(c=1;c<h-1;c++)e=f+c*(1/h)*(l-f),position=this.getPoint(e),k.push(n.copy(position).clone());
|
|
|
|
-k.push(n.copy(this.points[b]).clone())}this.points=k}};THREE.Edge=function(a,c,b,e){this.vertices=[a,c];this.vertexIndices=[b,e];this.faces=[];this.faceIndices=[]};
|
|
|
|
|
|
+THREE.Spline=function(a){function c(a,b,c,e,f,k,h){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*h+(-3*(b-c)-2*a-e)*k+a*f+b}this.points=a;var b=[],e={x:0,y:0,z:0},k,f,h,l,n,t,v,p,x;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){k=(this.points.length-1)*a;f=Math.floor(k);h=k-f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>this.points.length-2?f:f+1;b[3]=f>this.points.length-3?f:f+2;t=this.points[b[0]];v=this.points[b[1]];
|
|
|
|
+p=this.points[b[2]];x=this.points[b[3]];l=h*h;n=h*l;e.x=c(t.x,v.x,p.x,x.x,h,l,n);e.y=c(t.y,v.y,p.y,x.y,h,l,n);e.z=c(t.z,v.z,p.z,x.z,h,l,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,f=new THREE.Vector3,k=new THREE.Vector3,h=[],l=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),k.copy(position),
|
|
|
|
+l+=k.distanceTo(f),f.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=l,e=b);h[h.length]=l;return{chunks:h,total:l}};this.reparametrizeByArcLength=function(a){var b,c,e,f,k,h,l=[],n=new THREE.Vector3,t=this.getLength();l.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=t.chunks[b]-t.chunks[b-1];h=Math.ceil(a*c/t.total);f=(b-1)/(this.points.length-1);k=b/(this.points.length-1);for(c=1;c<h-1;c++)e=f+c*(1/h)*(k-f),position=this.getPoint(e),l.push(n.copy(position).clone());
|
|
|
|
+l.push(n.copy(this.points[b]).clone())}this.points=l}};THREE.Edge=function(a,c,b,e){this.vertices=[a,c];this.vertexIndices=[b,e];this.faces=[];this.faceIndices=[]};
|
|
THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
|
|
THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
|
|
-THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,e,l,f){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=e;this.near=l!==void 0?l:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
|
|
|
|
|
|
+THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,e,k,f){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=e;this.near=k!==void 0?k:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
|
|
THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,c,b,e){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=c!==void 0?c:1;this.near=b!==void 0?b:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
|
|
THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,c,b,e){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=c!==void 0?c:1;this.near=b!==void 0?b:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
|
|
-THREE.PerspectiveCamera.prototype.setLens=function(a,c){this.fov=2*Math.atan((c!==void 0?c:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,c,b,e,l,f){this.fullWidth=a;this.fullHeight=c;this.x=b;this.y=e;this.width=l;this.height=f;this.updateProjectionMatrix()};
|
|
|
|
|
|
+THREE.PerspectiveCamera.prototype.setLens=function(a,c){this.fov=2*Math.atan((c!==void 0?c:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,c,b,e,k,f){this.fullWidth=a;this.fullHeight=c;this.x=b;this.y=e;this.width=k;this.height=f;this.updateProjectionMatrix()};
|
|
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,b=-c,e=a*b,a=Math.abs(a*c-e),b=Math.abs(c-b);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*a/this.fullWidth,e+(this.x+this.width)*a/this.fullWidth,c-(this.y+this.height)*b/this.fullHeight,c-this.y*b/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
|
|
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,b=-c,e=a*b,a=Math.abs(a*c-e),b=Math.abs(c-b);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*a/this.fullWidth,e+(this.x+this.width)*a/this.fullWidth,c-(this.y+this.height)*b/this.fullHeight,c-this.y*b/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
|
|
this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
|
this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
|
THREE.DirectionalLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=b!==void 0?b:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=b!==void 0?b:0};THREE.PointLight.prototype=new THREE.Light;
|
|
THREE.DirectionalLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=b!==void 0?b:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=b!==void 0?b:0};THREE.PointLight.prototype=new THREE.Light;
|
|
@@ -120,22 +120,22 @@ THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this
|
|
THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};
|
|
THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};
|
|
THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
|
|
THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
|
|
void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
|
|
void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
|
|
-THREE.Texture=function(a,c,b,e,l,f){this.id=THREE.TextureCount++;this.image=a;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=b!==void 0?b:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=l!==void 0?l:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
|
|
|
|
+THREE.Texture=function(a,c,b,e,k,f){this.id=THREE.TextureCount++;this.image=a;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=b!==void 0?b:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=k!==void 0?k:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.DataTexture=function(a,c,b,e,l,f,h,k,n){THREE.Texture.call(this,null,l,f,h,k,n);this.image={data:a,width:c,height:b};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
|
|
|
|
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,c,b,e,k,f,h,l,n){THREE.Texture.call(this,null,k,f,h,l,n);this.image={data:a,width:c,height:b};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.material=c;this.sortParticles=!1};
|
|
THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.material=c;this.sortParticles=!1};
|
|
THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,b){THREE.Object3D.call(this);this.geometry=a;this.material=c;this.type=b!==void 0?b:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,b){THREE.Object3D.call(this);this.geometry=a;this.material=c;this.type=b!==void 0?b:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.material=c;if(c instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=c[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
|
|
THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.material=c;if(c instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=c[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
|
|
for(var b=0;b<this.geometry.morphTargets.length;b++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
for(var b=0;b<this.geometry.morphTargets.length;b++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
THREE.Bone.prototype.update=function(a,c){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var b,e=this.children.length;for(b=0;b<e;b++)this.children[b].update(this.skinMatrix,c)};
|
|
THREE.Bone.prototype.update=function(a,c){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var b,e=this.children.length;for(b=0;b<e;b++)this.children[b].update(this.skinMatrix,c)};
|
|
-THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,e,l,f,h,k;if(this.geometry.bones!==void 0){for(b=0;b<this.geometry.bones.length;b++)l=this.geometry.bones[b],f=l.pos,h=l.rotq,k=l.scl,e=this.addBone(),e.name=l.name,e.position.set(f[0],f[1],f[2]),e.quaternion.set(h[0],h[1],h[2],h[3]),e.useQuaternion=!0,k!==void 0?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1);for(b=0;b<this.bones.length;b++)l=this.geometry.bones[b],
|
|
|
|
-e=this.bones[b],l.parent===-1?this.add(e):this.bones[l.parent].add(e);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.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
|
|
|
|
+THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,e,k,f,h,l;if(this.geometry.bones!==void 0){for(b=0;b<this.geometry.bones.length;b++)k=this.geometry.bones[b],f=k.pos,h=k.rotq,l=k.scl,e=this.addBone(),e.name=k.name,e.position.set(f[0],f[1],f[2]),e.quaternion.set(h[0],h[1],h[2],h[3]),e.useQuaternion=!0,l!==void 0?e.scale.set(l[0],l[1],l[2]):e.scale.set(1,1,1);for(b=0;b<this.bones.length;b++)k=this.geometry.bones[b],
|
|
|
|
+e=this.bones[b],k.parent===-1?this.add(e):this.bones[k.parent].add(e);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.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1;for(var a=0,c=this.children.length;a<c;a++){var b=this.children[a];b instanceof THREE.Bone?b.update(this.identityMatrix,!1):b.updateMatrixWorld(!0)}c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(a=0;a<c;a++)ba[a].skinMatrix.flattenToArrayOffset(bm,
|
|
THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1;for(var a=0,c=this.children.length;a<c;a++){var b=this.children[a];b instanceof THREE.Bone?b.update(this.identityMatrix,!1):b.updateMatrixWorld(!0)}c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(a=0;a<c;a++)ba[a].skinMatrix.flattenToArrayOffset(bm,
|
|
a*16)};
|
|
a*16)};
|
|
-THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];var e=new THREE.Matrix4;e.getInverse(a.skinMatrix);c.push(e);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var b=this.geometry.vertices[a].position,l=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,e=
|
|
|
|
-new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[l].multiplyVector3(e));e=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[f].multiplyVector3(e));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=b,this.geometry.skinWeights[a].y+=b)}}};
|
|
|
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];var e=new THREE.Matrix4;e.getInverse(a.skinMatrix);c.push(e);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var b=this.geometry.vertices[a].position,k=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,e=
|
|
|
|
+new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[k].multiplyVector3(e));e=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[f].multiplyVector3(e));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=b,this.geometry.skinWeights[a].y+=b)}}};
|
|
THREE.MorphAnimMesh=function(a,c){THREE.Mesh.call(this,a,c);this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype=new THREE.Mesh;THREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh;
|
|
THREE.MorphAnimMesh=function(a,c){THREE.Mesh.call(this,a,c);this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype=new THREE.Mesh;THREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh;
|
|
THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var c=this.duration/(this.geometry.morphTargets.length-1);this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||this.time<0){this.direction*=-1;if(this.time>this.duration)this.time=this.duration,this.directionBackwards=!0;if(this.time<0)this.time=0,this.directionBackwards=!1}}else this.time%=this.duration;a=THREE.Math.clamp(Math.floor(this.time/c),0,this.geometry.morphTargets.length-1);if(a!=this.currentKeyframe)this.morphTargetInfluences[this.lastKeyframe]=
|
|
THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var c=this.duration/(this.geometry.morphTargets.length-1);this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||this.time<0){this.direction*=-1;if(this.time>this.duration)this.time=this.duration,this.directionBackwards=!0;if(this.time<0)this.time=0,this.directionBackwards=!1}}else this.time%=this.duration;a=THREE.Math.clamp(Math.floor(this.time/c),0,this.geometry.morphTargets.length-1);if(a!=this.currentKeyframe)this.morphTargetInfluences[this.lastKeyframe]=
|
|
0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a;c=this.time%c/c;this.directionBackwards&&(c=1-c);this.morphTargetInfluences[this.currentKeyframe]=c;this.morphTargetInfluences[this.lastKeyframe]=1-c};THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.material=c};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a;c=this.time%c/c;this.directionBackwards&&(c=1-c);this.morphTargetInfluences[this.currentKeyframe]=c;this.morphTargetInfluences[this.lastKeyframe]=1-c};THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.material=c};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
@@ -149,39 +149,39 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
|
|
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
|
|
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
|
|
THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,l,f;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;l=b/2;f=e/2};this.render=function(b,e){var n,t,v,p,x,w,z,u;a=c.projectScene(b,e);n=0;for(t=a.length;n<t;n++)if(x=a[n],x instanceof THREE.RenderableParticle){z=x.x*l+l;u=x.y*f+f;v=0;for(p=x.material.length;v<p;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=z+"px",w.style.top=u+"px"}}};
|
|
|
|
-THREE.CanvasRenderer=function(a){function c(a){if(F!=a)u.globalAlpha=F=a}function b(a){if(C!=a){switch(a){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation="darker"}C=a}}function e(a){if(H!=a)u.strokeStyle=H=a}function l(a){if(L!=a)u.fillStyle=L=a}var f=this,h,k,n,t=new THREE.Projector,a=a||{},v=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,k,f;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;k=b/2;f=e/2};this.render=function(b,e){var n,t,v,p,x,w,z,u;a=c.projectScene(b,e);n=0;for(t=a.length;n<t;n++)if(x=a[n],x instanceof THREE.RenderableParticle){z=x.x*k+k;u=x.y*f+f;v=0;for(p=x.material.length;v<p;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=z+"px",w.style.top=u+"px"}}};
|
|
|
|
+THREE.CanvasRenderer=function(a){function c(a){if(F!=a)u.globalAlpha=F=a}function b(a){if(C!=a){switch(a){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation="darker"}C=a}}function e(a){if(H!=a)u.strokeStyle=H=a}function k(a){if(L!=a)u.fillStyle=L=a}var f=this,h,l,n,t=new THREE.Projector,a=a||{},v=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
p,x,w,z,u=v.getContext("2d"),B=new THREE.Color(0),y=0,F=1,C=0,H=null,L=null,R=null,D=null,O=null,K,N,J,M,ea=new THREE.RenderableVertex,ja=new THREE.RenderableVertex,Z,U,o,P,pa,G,X,aa,na,la,ra,ia,da=new THREE.Color,S=new THREE.Color,fa=new THREE.Color,ha=new THREE.Color,I=new THREE.Color,Q=[],ka,ma,wa,sa,qa,Ea,ya,Aa,Ja,$,ca=new THREE.Rectangle,V=new THREE.Rectangle,W=new THREE.Rectangle,ga=!1,oa=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,Y=new THREE.Vector3,Ba,Ha,Fa,xa,Ca,T,a=16;Ba=document.createElement("canvas");
|
|
p,x,w,z,u=v.getContext("2d"),B=new THREE.Color(0),y=0,F=1,C=0,H=null,L=null,R=null,D=null,O=null,K,N,J,M,ea=new THREE.RenderableVertex,ja=new THREE.RenderableVertex,Z,U,o,P,pa,G,X,aa,na,la,ra,ia,da=new THREE.Color,S=new THREE.Color,fa=new THREE.Color,ha=new THREE.Color,I=new THREE.Color,Q=[],ka,ma,wa,sa,qa,Ea,ya,Aa,Ja,$,ca=new THREE.Rectangle,V=new THREE.Rectangle,W=new THREE.Rectangle,ga=!1,oa=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,Y=new THREE.Vector3,Ba,Ha,Fa,xa,Ca,T,a=16;Ba=document.createElement("canvas");
|
|
Ba.width=Ba.height=2;Ha=Ba.getContext("2d");Ha.fillStyle="rgba(0,0,0,1)";Ha.fillRect(0,0,2,2);Fa=Ha.getImageData(0,0,2,2);xa=Fa.data;Ca=document.createElement("canvas");Ca.width=Ca.height=a;T=Ca.getContext("2d");T.translate(-a/2,-a/2);T.scale(a,a);a--;this.domElement=v;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;x=b;w=Math.floor(p/2);z=Math.floor(x/2);v.width=p;v.height=x;ca.set(-w,-z,w,z);V.set(-w,-z,w,z);F=1;C=0;O=D=
|
|
Ba.width=Ba.height=2;Ha=Ba.getContext("2d");Ha.fillStyle="rgba(0,0,0,1)";Ha.fillRect(0,0,2,2);Fa=Ha.getImageData(0,0,2,2);xa=Fa.data;Ca=document.createElement("canvas");Ca.width=Ca.height=a;T=Ca.getContext("2d");T.translate(-a/2,-a/2);T.scale(a,a);a--;this.domElement=v;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;x=b;w=Math.floor(p/2);z=Math.floor(x/2);v.width=p;v.height=x;ca.set(-w,-z,w,z);V.set(-w,-z,w,z);F=1;C=0;O=D=
|
|
-R=L=H=null};this.setClearColor=function(a,b){B.copy(a);y=b;V.set(-w,-z,w,z)};this.setClearColorHex=function(a,b){B.setHex(a);y=b;V.set(-w,-z,w,z)};this.clear=function(){u.setTransform(1,0,0,-1,w,z);V.isEmpty()||(V.minSelf(ca),V.inflate(2),y<1&&u.clearRect(Math.floor(V.getX()),Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight())),y>0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*255)+","+y+")"),u.fillRect(Math.floor(V.getX()),
|
|
|
|
-Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight()))),V.empty())};this.render=function(a,v){function p(a){var b,c,e,f;oa.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(oa.r+=f.r,oa.g+=f.g,oa.b+=f.b):e instanceof THREE.DirectionalLight?(ta.r+=f.r,ta.g+=f.g,ta.b+=f.b):e instanceof THREE.PointLight&&(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b)}function x(a,b,c,e){var f,l,h,k,o,n;f=0;for(l=a.length;f<l;f++)h=a[f],k=h.color,
|
|
|
|
-h instanceof THREE.DirectionalLight?(o=h.matrixWorld.getPosition(),n=c.dot(o),n<=0||(n*=h.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)):h instanceof THREE.PointLight&&(o=h.matrixWorld.getPosition(),n=c.dot(Y.sub(o,b).normalize()),n<=0||(n*=h.distance==0?1:1-Math.min(b.distanceTo(o)/h.distance,1),n!=0&&(n*=h.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)))}function B(a,f,h){c(h.opacity);b(h.blending);var k,o,n,t,v,va;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)t=h.map.image,v=t.width>>1,va=t.height>>
|
|
|
|
-1,h=f.scale.x*w,n=f.scale.y*z,k=h*v,o=n*va,W.set(a.x-k,a.y-o,a.x+k,a.y+o),ca.intersects(W)&&(u.save(),u.translate(a.x,a.y),u.rotate(-f.rotation),u.scale(h,-n),u.translate(-v,-va),u.drawImage(t,0,0),u.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=f.scale.x*w,o=f.scale.y*z,W.set(a.x-k,a.y-o,a.x+k,a.y+o),ca.intersects(W)&&(e(h.color.getContextStyle()),l(h.color.getContextStyle()),u.save(),u.translate(a.x,a.y),u.rotate(-f.rotation),u.scale(k,o),h.program(u),u.restore()))}function y(a,
|
|
|
|
-f,l,h){c(h.opacity);b(h.blending);u.beginPath();u.moveTo(a.positionScreen.x,a.positionScreen.y);u.lineTo(f.positionScreen.x,f.positionScreen.y);u.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(R!=a)u.lineWidth=R=a;a=h.linecap;if(D!=a)u.lineCap=D=a;a=h.linejoin;if(O!=a)u.lineJoin=O=a;e(h.color.getContextStyle());u.stroke();W.inflate(h.linewidth*2)}}function C(a,e,h,l,k,t,w,p){f.info.render.vertices+=3;f.info.render.faces++;c(p.opacity);b(p.blending);Z=a.positionScreen.x;U=a.positionScreen.y;
|
|
|
|
-o=e.positionScreen.x;P=e.positionScreen.y;pa=h.positionScreen.x;G=h.positionScreen.y;Na(Z,U,o,P,pa,G);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(sa=w.uvs[0],Ra(Z,U,o,P,pa,G,sa[l].u,sa[l].v,sa[k].u,sa[k].v,sa[t].u,sa[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=v.matrixWorldInverse,Y.copy(w.vertexNormalsWorld[l]),qa=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,Ea=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,
|
|
|
|
-Y.copy(w.vertexNormalsWorld[k]),ya=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,Aa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,Y.copy(w.vertexNormalsWorld[t]),Ja=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,$=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,Ra(Z,U,o,P,pa,G,qa,Ea,ya,Aa,Ja,$,p.envMap)}else p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(sa=w.uvs[0],
|
|
|
|
-Ra(Z,U,o,P,pa,G,sa[l].u,sa[l].v,sa[k].u,sa[k].v,sa[t].u,sa[t].v,p.map)),b(THREE.SubtractiveBlending)),ga?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==3?(S.r=fa.r=ha.r=oa.r,S.g=fa.g=ha.g=oa.g,S.b=fa.b=ha.b=oa.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],S),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],fa),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],ha),S.r=Math.max(0,Math.min(p.color.r*S.r,1)),S.g=Math.max(0,Math.min(p.color.g*S.g,1)),S.b=Math.max(0,Math.min(p.color.b*
|
|
|
|
|
|
+R=L=H=null};this.setClearColor=function(a,b){B.copy(a);y=b;V.set(-w,-z,w,z)};this.setClearColorHex=function(a,b){B.setHex(a);y=b;V.set(-w,-z,w,z)};this.clear=function(){u.setTransform(1,0,0,-1,w,z);V.isEmpty()||(V.minSelf(ca),V.inflate(2),y<1&&u.clearRect(Math.floor(V.getX()),Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight())),y>0&&(b(THREE.NormalBlending),c(1),k("rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*255)+","+y+")"),u.fillRect(Math.floor(V.getX()),
|
|
|
|
+Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight()))),V.empty())};this.render=function(a,v){function p(a){var b,c,e,f;oa.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(oa.r+=f.r,oa.g+=f.g,oa.b+=f.b):e instanceof THREE.DirectionalLight?(ta.r+=f.r,ta.g+=f.g,ta.b+=f.b):e instanceof THREE.PointLight&&(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b)}function x(a,b,c,e){var f,k,h,l,o,n;f=0;for(k=a.length;f<k;f++)h=a[f],l=h.color,
|
|
|
|
+h instanceof THREE.DirectionalLight?(o=h.matrixWorld.getPosition(),n=c.dot(o),n<=0||(n*=h.intensity,e.r+=l.r*n,e.g+=l.g*n,e.b+=l.b*n)):h instanceof THREE.PointLight&&(o=h.matrixWorld.getPosition(),n=c.dot(Y.sub(o,b).normalize()),n<=0||(n*=h.distance==0?1:1-Math.min(b.distanceTo(o)/h.distance,1),n!=0&&(n*=h.intensity,e.r+=l.r*n,e.g+=l.g*n,e.b+=l.b*n)))}function B(a,f,h){c(h.opacity);b(h.blending);var l,o,n,t,v,va;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)t=h.map.image,v=t.width>>1,va=t.height>>
|
|
|
|
+1,h=f.scale.x*w,n=f.scale.y*z,l=h*v,o=n*va,W.set(a.x-l,a.y-o,a.x+l,a.y+o),ca.intersects(W)&&(u.save(),u.translate(a.x,a.y),u.rotate(-f.rotation),u.scale(h,-n),u.translate(-v,-va),u.drawImage(t,0,0),u.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(l=f.scale.x*w,o=f.scale.y*z,W.set(a.x-l,a.y-o,a.x+l,a.y+o),ca.intersects(W)&&(e(h.color.getContextStyle()),k(h.color.getContextStyle()),u.save(),u.translate(a.x,a.y),u.rotate(-f.rotation),u.scale(l,o),h.program(u),u.restore()))}function y(a,
|
|
|
|
+f,k,h){c(h.opacity);b(h.blending);u.beginPath();u.moveTo(a.positionScreen.x,a.positionScreen.y);u.lineTo(f.positionScreen.x,f.positionScreen.y);u.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(R!=a)u.lineWidth=R=a;a=h.linecap;if(D!=a)u.lineCap=D=a;a=h.linejoin;if(O!=a)u.lineJoin=O=a;e(h.color.getContextStyle());u.stroke();W.inflate(h.linewidth*2)}}function C(a,e,h,k,l,t,w,p){f.info.render.vertices+=3;f.info.render.faces++;c(p.opacity);b(p.blending);Z=a.positionScreen.x;U=a.positionScreen.y;
|
|
|
|
+o=e.positionScreen.x;P=e.positionScreen.y;pa=h.positionScreen.x;G=h.positionScreen.y;Na(Z,U,o,P,pa,G);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(sa=w.uvs[0],Ra(Z,U,o,P,pa,G,sa[k].u,sa[k].v,sa[l].u,sa[l].v,sa[t].u,sa[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=v.matrixWorldInverse,Y.copy(w.vertexNormalsWorld[k]),qa=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,Ea=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,
|
|
|
|
+Y.copy(w.vertexNormalsWorld[l]),ya=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,Aa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,Y.copy(w.vertexNormalsWorld[t]),Ja=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,$=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,Ra(Z,U,o,P,pa,G,qa,Ea,ya,Aa,Ja,$,p.envMap)}else p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(sa=w.uvs[0],
|
|
|
|
+Ra(Z,U,o,P,pa,G,sa[k].u,sa[k].v,sa[l].u,sa[l].v,sa[t].u,sa[t].v,p.map)),b(THREE.SubtractiveBlending)),ga?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==3?(S.r=fa.r=ha.r=oa.r,S.g=fa.g=ha.g=oa.g,S.b=fa.b=ha.b=oa.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],S),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],fa),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],ha),S.r=Math.max(0,Math.min(p.color.r*S.r,1)),S.g=Math.max(0,Math.min(p.color.g*S.g,1)),S.b=Math.max(0,Math.min(p.color.b*
|
|
S.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),ha.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(p.color.b*ha.b,1)),I.r=(fa.r+ha.r)*0.5,I.g=(fa.g+ha.g)*0.5,I.b=(fa.b+ha.b)*0.5,wa=Oa(S,fa,ha,I),L(Z,U,o,P,pa,G,0,0,1,0,0,1,wa)):(da.r=oa.r,da.g=oa.g,da.b=oa.b,x(n,w.centroidWorld,w.normalWorld,da),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,
|
|
S.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),ha.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(p.color.b*ha.b,1)),I.r=(fa.r+ha.r)*0.5,I.g=(fa.g+ha.g)*0.5,I.b=(fa.b+ha.b)*0.5,wa=Oa(S,fa,ha,I),L(Z,U,o,P,pa,G,0,0,1,0,0,1,wa)):(da.r=oa.r,da.g=oa.g,da.b=oa.b,x(n,w.centroidWorld,w.normalWorld,da),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,
|
|
Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(da)):p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshDepthMaterial)ka=v.near,ma=v.far,S.r=S.g=S.b=1-La(a.positionScreen.z,ka,ma),fa.r=fa.g=fa.b=1-La(e.positionScreen.z,ka,ma),ha.r=ha.g=ha.b=1-La(h.positionScreen.z,ka,ma),I.r=(fa.r+ha.r)*0.5,I.g=(fa.g+ha.g)*0.5,I.b=(fa.b+
|
|
Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(da)):p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshDepthMaterial)ka=v.near,ma=v.far,S.r=S.g=S.b=1-La(a.positionScreen.z,ka,ma),fa.r=fa.g=fa.b=1-La(e.positionScreen.z,ka,ma),ha.r=ha.g=ha.b=1-La(h.positionScreen.z,ka,ma),I.r=(fa.r+ha.r)*0.5,I.g=(fa.g+ha.g)*0.5,I.b=(fa.b+
|
|
-ha.b)*0.5,wa=Oa(S,fa,ha,I),L(Z,U,o,P,pa,G,0,0,1,0,0,1,wa);else if(p instanceof THREE.MeshNormalMaterial)da.r=Ma(w.normalWorld.x),da.g=Ma(w.normalWorld.y),da.b=Ma(w.normalWorld.z),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(da)}function F(a,e,h,l,k,t,w,p,u){f.info.render.vertices+=4;f.info.render.faces++;c(p.opacity);b(p.blending);if(p.map||p.envMap)C(a,e,l,0,1,3,w,p,u),C(k,h,t,1,2,3,w,p,u);else if(Z=a.positionScreen.x,U=a.positionScreen.y,o=e.positionScreen.x,
|
|
|
|
-P=e.positionScreen.y,pa=h.positionScreen.x,G=h.positionScreen.y,X=l.positionScreen.x,aa=l.positionScreen.y,na=k.positionScreen.x,la=k.positionScreen.y,ra=t.positionScreen.x,ia=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshLambertMaterial)ga?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==4?(S.r=fa.r=ha.r=I.r=oa.r,S.g=
|
|
|
|
|
|
+ha.b)*0.5,wa=Oa(S,fa,ha,I),L(Z,U,o,P,pa,G,0,0,1,0,0,1,wa);else if(p instanceof THREE.MeshNormalMaterial)da.r=Ma(w.normalWorld.x),da.g=Ma(w.normalWorld.y),da.b=Ma(w.normalWorld.z),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(da)}function F(a,e,h,k,l,t,w,p,u){f.info.render.vertices+=4;f.info.render.faces++;c(p.opacity);b(p.blending);if(p.map||p.envMap)C(a,e,k,0,1,3,w,p,u),C(l,h,t,1,2,3,w,p,u);else if(Z=a.positionScreen.x,U=a.positionScreen.y,o=e.positionScreen.x,
|
|
|
|
+P=e.positionScreen.y,pa=h.positionScreen.x,G=h.positionScreen.y,X=k.positionScreen.x,aa=k.positionScreen.y,na=l.positionScreen.x,la=l.positionScreen.y,ra=t.positionScreen.x,ia=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshLambertMaterial)ga?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==4?(S.r=fa.r=ha.r=I.r=oa.r,S.g=
|
|
fa.g=ha.g=I.g=oa.g,S.b=fa.b=ha.b=I.b=oa.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],S),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],fa),x(n,w.v4.positionWorld,w.vertexNormalsWorld[3],ha),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],I),S.r=Math.max(0,Math.min(p.color.r*S.r,1)),S.g=Math.max(0,Math.min(p.color.g*S.g,1)),S.b=Math.max(0,Math.min(p.color.b*S.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),
|
|
fa.g=ha.g=I.g=oa.g,S.b=fa.b=ha.b=I.b=oa.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],S),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],fa),x(n,w.v4.positionWorld,w.vertexNormalsWorld[3],ha),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],I),S.r=Math.max(0,Math.min(p.color.r*S.r,1)),S.g=Math.max(0,Math.min(p.color.g*S.g,1)),S.b=Math.max(0,Math.min(p.color.b*S.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),
|
|
ha.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(p.color.b*ha.b,1)),I.r=Math.max(0,Math.min(p.color.r*I.r,1)),I.g=Math.max(0,Math.min(p.color.g*I.g,1)),I.b=Math.max(0,Math.min(p.color.b*I.b,1)),wa=Oa(S,fa,ha,I),Na(Z,U,o,P,X,aa),L(Z,U,o,P,X,aa,0,0,1,0,0,1,wa),Na(na,la,pa,G,ra,ia),L(na,la,pa,G,ra,ia,1,0,1,1,0,1,wa)):(da.r=oa.r,da.g=oa.g,da.b=oa.b,x(n,w.centroidWorld,w.normalWorld,da),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,
|
|
ha.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(p.color.b*ha.b,1)),I.r=Math.max(0,Math.min(p.color.r*I.r,1)),I.g=Math.max(0,Math.min(p.color.g*I.g,1)),I.b=Math.max(0,Math.min(p.color.b*I.b,1)),wa=Oa(S,fa,ha,I),Na(Z,U,o,P,X,aa),L(Z,U,o,P,X,aa,0,0,1,0,0,1,wa),Na(na,la,pa,G,ra,ia),L(na,la,pa,G,ra,ia,1,0,1,1,0,1,wa)):(da.r=oa.r,da.g=oa.g,da.b=oa.b,x(n,w.centroidWorld,w.normalWorld,da),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,
|
|
Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(da)):(Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color));else if(p instanceof THREE.MeshNormalMaterial)da.r=Ma(w.normalWorld.x),da.g=Ma(w.normalWorld.y),da.b=Ma(w.normalWorld.z),Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):
|
|
Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(da)):(Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color));else if(p instanceof THREE.MeshNormalMaterial)da.r=Ma(w.normalWorld.x),da.g=Ma(w.normalWorld.y),da.b=Ma(w.normalWorld.z),Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):
|
|
-Da(da);else if(p instanceof THREE.MeshDepthMaterial)ka=v.near,ma=v.far,S.r=S.g=S.b=1-La(a.positionScreen.z,ka,ma),fa.r=fa.g=fa.b=1-La(e.positionScreen.z,ka,ma),ha.r=ha.g=ha.b=1-La(l.positionScreen.z,ka,ma),I.r=I.g=I.b=1-La(h.positionScreen.z,ka,ma),wa=Oa(S,fa,ha,I),Na(Z,U,o,P,X,aa),L(Z,U,o,P,X,aa,0,0,1,0,0,1,wa),Na(na,la,pa,G,ra,ia),L(na,la,pa,G,ra,ia,1,0,1,1,0,1,wa)}function Na(a,b,c,e,f,h){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(f,h);u.lineTo(a,b);u.closePath()}function Pa(a,b,c,e,f,
|
|
|
|
-h,l,k){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(f,h);u.lineTo(l,k);u.lineTo(a,b);u.closePath()}function H(a,b,c,f){if(R!=b)u.lineWidth=R=b;if(D!=c)u.lineCap=D=c;if(O!=f)u.lineJoin=O=f;e(a.getContextStyle());u.stroke();W.inflate(b*2)}function Da(a){l(a.getContextStyle());u.fill()}function Ra(a,b,c,e,f,h,k,o,n,p,t,w,v){if(v.image.width!=0){if(v.needsUpdate==!0||Q[v.id]==void 0){var va=v.wrapS==THREE.RepeatWrapping,x=v.wrapT==THREE.RepeatWrapping;Q[v.id]=u.createPattern(v.image,va&&x?"repeat":
|
|
|
|
-va&&!x?"repeat-x":!va&&x?"repeat-y":"no-repeat");v.needsUpdate=!1}l(Q[v.id]);var va=v.offset.x/v.repeat.x,x=v.offset.y/v.repeat.y,$=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,k=(k+va)*$,o=(o+x)*v,n=(n+va)*$,p=(p+x)*v,t=(t+va)*$,w=(w+x)*v;c-=a;e-=b;f-=a;h-=b;n-=k;p-=o;t-=k;w-=o;va=1/(n*w-t*p);v=(w*c-p*f)*va;p=(w*e-p*h)*va;c=(n*f-t*c)*va;e=(n*h-t*e)*va;a=a-v*k-c*o;b=b-p*k-e*o;u.save();u.transform(v,p,c,e,a,b);u.fill();u.restore()}}function L(a,b,c,e,f,h,l,k,o,n,p,t,w){var v,va;v=w.width-
|
|
|
|
-1;va=w.height-1;l*=v;k*=va;o*=v;n*=va;p*=v;t*=va;c-=a;e-=b;f-=a;h-=b;o-=l;n-=k;p-=l;t-=k;va=1/(o*t-p*n);v=(t*c-n*f)*va;n=(t*e-n*h)*va;c=(o*f-p*c)*va;e=(o*h-p*e)*va;a=a-v*l-c*k;b=b-n*l-e*k;u.save();u.transform(v,n,c,e,a,b);u.clip();u.drawImage(w,0,0);u.restore()}function Oa(a,b,c,e){var f=~~(a.r*255),h=~~(a.g*255),a=~~(a.b*255),l=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),o=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),p=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255);xa[0]=f<0?0:f>255?255:f;xa[1]=h<0?0:h>255?255:
|
|
|
|
-h;xa[2]=a<0?0:a>255?255:a;xa[4]=l<0?0:l>255?255:l;xa[5]=k<0?0:k>255?255:k;xa[6]=b<0?0:b>255?255:b;xa[8]=o<0?0:o>255?255:o;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]=e<0?0:e>255?255:e;Ha.putImageData(Fa,0,0);T.drawImage(Ba,0,0);return Ca}function La(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ma(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ka(a,b){var c=b.x-a.x,e=b.y-a.y,f=c*c+e*e;f!=0&&(f=1/Math.sqrt(f),c*=f,e*=f,b.x+=c,b.y+=e,a.x-=
|
|
|
|
-c,a.y-=e)}var Qa,Sa,za,Ia;this.autoClear?this.clear():u.setTransform(1,0,0,-1,w,z);f.info.render.vertices=0;f.info.render.faces=0;h=t.projectScene(a,v,this.sortElements);k=h.elements;n=h.lights;(ga=n.length>0)&&p(n);Qa=0;for(Sa=k.length;Qa<Sa;Qa++)if(za=k[Qa],Ia=za.material,Ia=Ia instanceof THREE.MeshFaceMaterial?za.faceMaterial:Ia,!(Ia==null||Ia.opacity==0)){W.empty();if(za instanceof THREE.RenderableParticle)K=za,K.x*=w,K.y*=z,B(K,za,Ia,a);else if(za instanceof THREE.RenderableLine)K=za.v1,N=za.v2,
|
|
|
|
|
|
+Da(da);else if(p instanceof THREE.MeshDepthMaterial)ka=v.near,ma=v.far,S.r=S.g=S.b=1-La(a.positionScreen.z,ka,ma),fa.r=fa.g=fa.b=1-La(e.positionScreen.z,ka,ma),ha.r=ha.g=ha.b=1-La(k.positionScreen.z,ka,ma),I.r=I.g=I.b=1-La(h.positionScreen.z,ka,ma),wa=Oa(S,fa,ha,I),Na(Z,U,o,P,X,aa),L(Z,U,o,P,X,aa,0,0,1,0,0,1,wa),Na(na,la,pa,G,ra,ia),L(na,la,pa,G,ra,ia,1,0,1,1,0,1,wa)}function Na(a,b,c,e,f,h){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(f,h);u.lineTo(a,b);u.closePath()}function Pa(a,b,c,e,f,
|
|
|
|
+h,k,l){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(f,h);u.lineTo(k,l);u.lineTo(a,b);u.closePath()}function H(a,b,c,f){if(R!=b)u.lineWidth=R=b;if(D!=c)u.lineCap=D=c;if(O!=f)u.lineJoin=O=f;e(a.getContextStyle());u.stroke();W.inflate(b*2)}function Da(a){k(a.getContextStyle());u.fill()}function Ra(a,b,c,e,f,h,l,o,n,p,t,w,v){if(v.image.width!=0){if(v.needsUpdate==!0||Q[v.id]==void 0){var va=v.wrapS==THREE.RepeatWrapping,x=v.wrapT==THREE.RepeatWrapping;Q[v.id]=u.createPattern(v.image,va&&x?"repeat":
|
|
|
|
+va&&!x?"repeat-x":!va&&x?"repeat-y":"no-repeat");v.needsUpdate=!1}k(Q[v.id]);var va=v.offset.x/v.repeat.x,x=v.offset.y/v.repeat.y,$=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,l=(l+va)*$,o=(o+x)*v,n=(n+va)*$,p=(p+x)*v,t=(t+va)*$,w=(w+x)*v;c-=a;e-=b;f-=a;h-=b;n-=l;p-=o;t-=l;w-=o;va=1/(n*w-t*p);v=(w*c-p*f)*va;p=(w*e-p*h)*va;c=(n*f-t*c)*va;e=(n*h-t*e)*va;a=a-v*l-c*o;b=b-p*l-e*o;u.save();u.transform(v,p,c,e,a,b);u.fill();u.restore()}}function L(a,b,c,e,f,h,k,l,o,n,p,t,w){var v,va;v=w.width-
|
|
|
|
+1;va=w.height-1;k*=v;l*=va;o*=v;n*=va;p*=v;t*=va;c-=a;e-=b;f-=a;h-=b;o-=k;n-=l;p-=k;t-=l;va=1/(o*t-p*n);v=(t*c-n*f)*va;n=(t*e-n*h)*va;c=(o*f-p*c)*va;e=(o*h-p*e)*va;a=a-v*k-c*l;b=b-n*k-e*l;u.save();u.transform(v,n,c,e,a,b);u.clip();u.drawImage(w,0,0);u.restore()}function Oa(a,b,c,e){var f=~~(a.r*255),h=~~(a.g*255),a=~~(a.b*255),k=~~(b.r*255),l=~~(b.g*255),b=~~(b.b*255),o=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),p=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255);xa[0]=f<0?0:f>255?255:f;xa[1]=h<0?0:h>255?255:
|
|
|
|
+h;xa[2]=a<0?0:a>255?255:a;xa[4]=k<0?0:k>255?255:k;xa[5]=l<0?0:l>255?255:l;xa[6]=b<0?0:b>255?255:b;xa[8]=o<0?0:o>255?255:o;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]=e<0?0:e>255?255:e;Ha.putImageData(Fa,0,0);T.drawImage(Ba,0,0);return Ca}function La(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ma(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ka(a,b){var c=b.x-a.x,e=b.y-a.y,f=c*c+e*e;f!=0&&(f=1/Math.sqrt(f),c*=f,e*=f,b.x+=c,b.y+=e,a.x-=
|
|
|
|
+c,a.y-=e)}var Qa,Sa,za,Ia;this.autoClear?this.clear():u.setTransform(1,0,0,-1,w,z);f.info.render.vertices=0;f.info.render.faces=0;h=t.projectScene(a,v,this.sortElements);l=h.elements;n=h.lights;(ga=n.length>0)&&p(n);Qa=0;for(Sa=l.length;Qa<Sa;Qa++)if(za=l[Qa],Ia=za.material,Ia=Ia instanceof THREE.MeshFaceMaterial?za.faceMaterial:Ia,!(Ia==null||Ia.opacity==0)){W.empty();if(za instanceof THREE.RenderableParticle)K=za,K.x*=w,K.y*=z,B(K,za,Ia,a);else if(za instanceof THREE.RenderableLine)K=za.v1,N=za.v2,
|
|
K.positionScreen.x*=w,K.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,W.addPoint(K.positionScreen.x,K.positionScreen.y),W.addPoint(N.positionScreen.x,N.positionScreen.y),ca.intersects(W)&&y(K,N,za,Ia,a);else if(za instanceof THREE.RenderableFace3)K=za.v1,N=za.v2,J=za.v3,K.positionScreen.x*=w,K.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,J.positionScreen.x*=w,J.positionScreen.y*=z,Ia.overdraw&&(Ka(K.positionScreen,N.positionScreen),Ka(N.positionScreen,J.positionScreen),
|
|
K.positionScreen.x*=w,K.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,W.addPoint(K.positionScreen.x,K.positionScreen.y),W.addPoint(N.positionScreen.x,N.positionScreen.y),ca.intersects(W)&&y(K,N,za,Ia,a);else if(za instanceof THREE.RenderableFace3)K=za.v1,N=za.v2,J=za.v3,K.positionScreen.x*=w,K.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,J.positionScreen.x*=w,J.positionScreen.y*=z,Ia.overdraw&&(Ka(K.positionScreen,N.positionScreen),Ka(N.positionScreen,J.positionScreen),
|
|
Ka(J.positionScreen,K.positionScreen)),W.add3Points(K.positionScreen.x,K.positionScreen.y,N.positionScreen.x,N.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ca.intersects(W)&&C(K,N,J,0,1,2,za,Ia,a);else if(za instanceof THREE.RenderableFace4)K=za.v1,N=za.v2,J=za.v3,M=za.v4,K.positionScreen.x*=w,K.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,J.positionScreen.x*=w,J.positionScreen.y*=z,M.positionScreen.x*=w,M.positionScreen.y*=z,ea.positionScreen.copy(N.positionScreen),
|
|
Ka(J.positionScreen,K.positionScreen)),W.add3Points(K.positionScreen.x,K.positionScreen.y,N.positionScreen.x,N.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ca.intersects(W)&&C(K,N,J,0,1,2,za,Ia,a);else if(za instanceof THREE.RenderableFace4)K=za.v1,N=za.v2,J=za.v3,M=za.v4,K.positionScreen.x*=w,K.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,J.positionScreen.x*=w,J.positionScreen.y*=z,M.positionScreen.x*=w,M.positionScreen.y*=z,ea.positionScreen.copy(N.positionScreen),
|
|
ja.positionScreen.copy(M.positionScreen),Ia.overdraw&&(Ka(K.positionScreen,N.positionScreen),Ka(N.positionScreen,M.positionScreen),Ka(M.positionScreen,K.positionScreen),Ka(J.positionScreen,ea.positionScreen),Ka(J.positionScreen,ja.positionScreen)),W.addPoint(K.positionScreen.x,K.positionScreen.y),W.addPoint(N.positionScreen.x,N.positionScreen.y),W.addPoint(J.positionScreen.x,J.positionScreen.y),W.addPoint(M.positionScreen.x,M.positionScreen.y),ca.intersects(W)&&F(K,N,J,M,ea,ja,za,Ia,a);V.addRectangle(W)}u.setTransform(1,
|
|
ja.positionScreen.copy(M.positionScreen),Ia.overdraw&&(Ka(K.positionScreen,N.positionScreen),Ka(N.positionScreen,M.positionScreen),Ka(M.positionScreen,K.positionScreen),Ka(J.positionScreen,ea.positionScreen),Ka(J.positionScreen,ja.positionScreen)),W.addPoint(K.positionScreen.x,K.positionScreen.y),W.addPoint(N.positionScreen.x,N.positionScreen.y),W.addPoint(J.positionScreen.x,J.positionScreen.y),W.addPoint(M.positionScreen.x,M.positionScreen.y),ca.intersects(W)&&F(K,N,J,M,ea,ja,za,Ia,a);V.addRectangle(W)}u.setTransform(1,
|
|
0,0,1,0,0)}};
|
|
0,0,1,0,0)}};
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,e){var f,h,l,k,n,p;f=0;for(h=a.length;f<h;f++)l=a[f],k=l.color,l instanceof THREE.DirectionalLight?(n=l.matrixWorld.getPosition(),p=c.dot(n),p<=0||(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)):l instanceof THREE.PointLight&&(n=l.matrixWorld.getPosition(),p=c.dot(K.sub(n,b).normalize()),p<=0||(p*=l.distance==0?1:1-Math.min(b.distanceTo(n)/l.distance,1),p!=0&&(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)))}function c(a){N[a]==null&&(N[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
-"path"),Z==0&&N[a].setAttribute("shape-rendering","crispEdges"));return N[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,l,f,h,k=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,v,p,x,w,z,u,B,y=new THREE.Rectangle,F=new THREE.Rectangle,C=!1,H=new THREE.Color,L=new THREE.Color,R=new THREE.Color,D=new THREE.Color,O,K=new THREE.Vector3,N=[],J=[],M,ea,ja,Z=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
|
-faces:0}};this.setQuality=function(a){switch(a){case "high":Z=1;break;case "low":Z=0}};this.setSize=function(a,b){t=a;v=b;p=t/2;x=v/2;n.setAttribute("viewBox",-p+" "+-x+" "+t+" "+v);n.setAttribute("width",t);n.setAttribute("height",v);y.set(-p,-x,p,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(t,o){var v,K,G,X;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(t,o,this.sortElements);f=l.elements;
|
|
|
|
-h=l.lights;ja=ea=0;if(C=h.length>0){L.setRGB(0,0,0);R.setRGB(0,0,0);D.setRGB(0,0,0);v=0;for(K=h.length;v<K;v++)X=h[v],G=X.color,X instanceof THREE.AmbientLight?(L.r+=G.r,L.g+=G.g,L.b+=G.b):X instanceof THREE.DirectionalLight?(R.r+=G.r,R.g+=G.g,R.b+=G.b):X instanceof THREE.PointLight&&(D.r+=G.r,D.g+=G.g,D.b+=G.b)}v=0;for(K=f.length;v<K;v++)if(G=f[v],X=G.material,X=X instanceof THREE.MeshFaceMaterial?G.faceMaterial:X,!(X==null||X.opacity==0))if(F.empty(),G instanceof THREE.RenderableParticle)w=G,w.x*=
|
|
|
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,e){var f,h,k,l,n,p;f=0;for(h=a.length;f<h;f++)k=a[f],l=k.color,k instanceof THREE.DirectionalLight?(n=k.matrixWorld.getPosition(),p=c.dot(n),p<=0||(p*=k.intensity,e.r+=l.r*p,e.g+=l.g*p,e.b+=l.b*p)):k instanceof THREE.PointLight&&(n=k.matrixWorld.getPosition(),p=c.dot(K.sub(n,b).normalize()),p<=0||(p*=k.distance==0?1:1-Math.min(b.distanceTo(n)/k.distance,1),p!=0&&(p*=k.intensity,e.r+=l.r*p,e.g+=l.g*p,e.b+=l.b*p)))}function c(a){N[a]==null&&(N[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
+"path"),Z==0&&N[a].setAttribute("shape-rendering","crispEdges"));return N[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,k,f,h,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,v,p,x,w,z,u,B,y=new THREE.Rectangle,F=new THREE.Rectangle,C=!1,H=new THREE.Color,L=new THREE.Color,R=new THREE.Color,D=new THREE.Color,O,K=new THREE.Vector3,N=[],J=[],M,ea,ja,Z=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
|
+faces:0}};this.setQuality=function(a){switch(a){case "high":Z=1;break;case "low":Z=0}};this.setSize=function(a,b){t=a;v=b;p=t/2;x=v/2;n.setAttribute("viewBox",-p+" "+-x+" "+t+" "+v);n.setAttribute("width",t);n.setAttribute("height",v);y.set(-p,-x,p,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(t,o){var v,K,G,X;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;k=l.projectScene(t,o,this.sortElements);f=k.elements;
|
|
|
|
+h=k.lights;ja=ea=0;if(C=h.length>0){L.setRGB(0,0,0);R.setRGB(0,0,0);D.setRGB(0,0,0);v=0;for(K=h.length;v<K;v++)X=h[v],G=X.color,X instanceof THREE.AmbientLight?(L.r+=G.r,L.g+=G.g,L.b+=G.b):X instanceof THREE.DirectionalLight?(R.r+=G.r,R.g+=G.g,R.b+=G.b):X instanceof THREE.PointLight&&(D.r+=G.r,D.g+=G.g,D.b+=G.b)}v=0;for(K=f.length;v<K;v++)if(G=f[v],X=G.material,X=X instanceof THREE.MeshFaceMaterial?G.faceMaterial:X,!(X==null||X.opacity==0))if(F.empty(),G instanceof THREE.RenderableParticle)w=G,w.x*=
|
|
p,w.y*=-x,m=0,ml=G.materials.length;else if(G instanceof THREE.RenderableLine){if(w=G.v1,z=G.v2,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),y.intersects(F)){G=w;var N=z,na=ja++;J[na]==null&&(J[na]=document.createElementNS("http://www.w3.org/2000/svg","line"),Z==0&&J[na].setAttribute("shape-rendering","crispEdges"));M=J[na];M.setAttribute("x1",G.positionScreen.x);
|
|
p,w.y*=-x,m=0,ml=G.materials.length;else if(G instanceof THREE.RenderableLine){if(w=G.v1,z=G.v2,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),y.intersects(F)){G=w;var N=z,na=ja++;J[na]==null&&(J[na]=document.createElementNS("http://www.w3.org/2000/svg","line"),Z==0&&J[na].setAttribute("shape-rendering","crispEdges"));M=J[na];M.setAttribute("x1",G.positionScreen.x);
|
|
M.setAttribute("y1",G.positionScreen.y);M.setAttribute("x2",N.positionScreen.x);M.setAttribute("y2",N.positionScreen.y);X instanceof THREE.LineBasicMaterial&&(M.setAttribute("style","fill: none; stroke: "+X.color.getContextStyle()+"; stroke-width: "+X.linewidth+"; stroke-opacity: "+X.opacity+"; stroke-linecap: "+X.linecap+"; stroke-linejoin: "+X.linejoin),n.appendChild(M))}}else if(G instanceof THREE.RenderableFace3){if(w=G.v1,z=G.v2,u=G.v3,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=
|
|
M.setAttribute("y1",G.positionScreen.y);M.setAttribute("x2",N.positionScreen.x);M.setAttribute("y2",N.positionScreen.y);X instanceof THREE.LineBasicMaterial&&(M.setAttribute("style","fill: none; stroke: "+X.color.getContextStyle()+"; stroke-width: "+X.linewidth+"; stroke-opacity: "+X.opacity+"; stroke-linecap: "+X.linecap+"; stroke-linejoin: "+X.linejoin),n.appendChild(M))}}else if(G instanceof THREE.RenderableFace3){if(w=G.v1,z=G.v2,u=G.v3,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=
|
|
p,z.positionScreen.y*=-x,u.positionScreen.x*=p,u.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(u.positionScreen.x,u.positionScreen.y),y.intersects(F)){var N=w,na=z,la=u;e.info.render.vertices+=3;e.info.render.faces++;M=c(ea++);M.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+na.positionScreen.x+" "+na.positionScreen.y+" L "+la.positionScreen.x+","+la.positionScreen.y+"z");X instanceof THREE.MeshBasicMaterial?
|
|
p,z.positionScreen.y*=-x,u.positionScreen.x*=p,u.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(u.positionScreen.x,u.positionScreen.y),y.intersects(F)){var N=w,na=z,la=u;e.info.render.vertices+=3;e.info.render.faces++;M=c(ea++);M.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+na.positionScreen.x+" "+na.positionScreen.y+" L "+la.positionScreen.x+","+la.positionScreen.y+"z");X instanceof THREE.MeshBasicMaterial?
|
|
@@ -204,7 +204,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu
|
|
default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
|
|
default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
|
|
shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
|
|
shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
|
|
shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
|
|
shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
|
|
-THREE.UniformsUtils={merge:function(a){var c,b,e,l={};for(c=0;c<a.length;c++)for(b in e=this.clone(a[c]),e)l[b]=e[b];return l},clone:function(a){var c,b,e,l={};for(c in a)for(b in l[c]={},a[c])e=a[c][b],l[c][b]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return l}};
|
|
|
|
|
|
+THREE.UniformsUtils={merge:function(a){var c,b,e,k={};for(c=0;c<a.length;c++)for(b in e=this.clone(a[c]),e)k[b]=e[b];return k},clone:function(a){var c,b,e,k={};for(c in a)for(b in k[c]={},a[c])e=a[c][b],k[c][b]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return k}};
|
|
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},flipEnvMap:{type:"f",value:-1},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",
|
|
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},flipEnvMap:{type:"f",value:-1},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: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)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
|
|
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)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
|
|
@@ -224,98 +224,97 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
|
|
THREE.ShaderChunk.shadowmap_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;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
|
|
THREE.ShaderChunk.shadowmap_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;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
|
|
THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
|
|
THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
-THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in e.attributes){originalAttribute=e.attributes[f];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(c*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=f,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;a.__webglCustomAttributesList.push(attribute)}}}function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,f,h,l=a.vertices,
|
|
|
|
-k=l.length,n=a.colors,p=n.length,t=a.__vertexArray,w=a.__colorArray,v=a.__sortArray,u=a.__dirtyVertices,x=a.__dirtyColors,$=a.__webglCustomAttributesList;if(c.sortParticles){qa.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=l[e].position,Aa.copy(f),qa.multiplyVector3(Aa),v[e]=[Aa.z,e];v.sort(function(a,b){return b[0]-a[0]});for(e=0;e<k;e++)f=l[v[e][1]].position,h=e*3,t[h]=f.x,t[h+1]=f.y,t[h+2]=f.z;for(e=0;e<p;e++)h=e*3,color=n[v[e][1]],w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if($){n=0;for(p=$.length;n<
|
|
|
|
-p;n++)if(k=$[n],k.boundTo===void 0||k.boundTo==="vertices"){h=0;f=k.value.length;for(e=0;e<f;e++)index=v[e][1],k.size===1?k.array[h]=k.value[index]:(l=k.value[index],k.size===2?(k.array[h]=l.x,k.array[h+1]=l.y):k.size===3?k.type==="c"?(k.array[h]=l.r,k.array[h+1]=l.g,k.array[h+2]=l.b):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z,k.array[h+3]=l.w)),h+=k.size}}}else{if(u)for(e=0;e<k;e++)f=l[e].position,h=e*3,t[h]=f.x,t[h+1]=f.y,t[h+2]=f.z;if(x)for(e=
|
|
|
|
-0;e<p;e++)color=n[e],h=e*3,w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if($){n=0;for(p=$.length;n<p;n++)if(k=$[n],k.__original.needsUpdate&&(k.boundTo===void 0||k.boundTo==="vertices")){f=k.value.length;for(e=h=0;e<f;e++)offset_custom=k.offset,k.size===1?k.array[h]=k.value[e]:(l=k.value[e],k.size===2?(k.array[h]=l.x,k.array[h+1]=l.y):k.size===3?k.type==="c"?(k.array[h]=l.r,k.array[h+1]=l.g,k.array[h+2]=l.b):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+
|
|
|
|
-2]=l.z,k.array[h+3]=l.w)),h+=k.size}}}if(u||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,t,b);if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,b);if($){n=0;for(p=$.length;n<p;n++)if(k=$[n],k.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,k.buffer),o.bufferData(o.ARRAY_BUFFER,k.array,b)}}function l(a,b,c,e,f){e.program||U.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=
|
|
|
|
-new Float32Array(U.maxMorphTargets);for(var h=0,l=U.maxMorphTargets;h<l;h++)f.__webglMorphTargetInfluences[h]=0}var k=!1,h=e.program,l=h.uniforms,n=e.uniforms;h!==pa&&(o.useProgram(h),pa=h,k=!0);if(e.id!==X)X=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,Ea);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
|
|
|
|
-e.lights){for(var p,t,w=0,v=0,u=0,x,z,B,V=Ja,ca=V.directional.colors,y=V.directional.positions,C=V.point.colors,F=V.point.positions,H=V.point.distances,W=0,I=0,c=p=B=0,k=b.length;c<k;c++)if(p=b[c],t=p.color,x=p.position,z=p.intensity,B=p.distance,p instanceof THREE.AmbientLight)U.gammaInput?(w+=t.r*t.r,v+=t.g*t.g,u+=t.b*t.b):(w+=t.r,v+=t.g,u+=t.b);else if(p instanceof THREE.DirectionalLight)B=W*3,U.gammaInput?(ca[B]=t.r*t.r*z*z,ca[B+1]=t.g*t.g*z*z,ca[B+2]=t.b*t.b*z*z):(ca[B]=t.r*z,ca[B+1]=t.g*z,ca[B+
|
|
|
|
-2]=t.b*z),y[B]=x.x,y[B+1]=x.y,y[B+2]=x.z,W+=1;else if(p instanceof THREE.SpotLight)B=W*3,U.gammaInput?(ca[B]=t.r*t.r*z*z,ca[B+1]=t.g*t.g*z*z,ca[B+2]=t.b*t.b*z*z):(ca[B]=t.r*z,ca[B+1]=t.g*z,ca[B+2]=t.b*z),t=1/x.length(),y[B]=x.x*t,y[B+1]=x.y*t,y[B+2]=x.z*t,W+=1;else if(p instanceof THREE.PointLight)p=I*3,U.gammaInput?(C[p]=t.r*t.r*z*z,C[p+1]=t.g*t.g*z*z,C[p+2]=t.b*t.b*z*z):(C[p]=t.r*z,C[p+1]=t.g*z,C[p+2]=t.b*z),F[p]=x.x,F[p+1]=x.y,F[p+2]=x.z,H[I]=B,I+=1;c=W*3;for(k=ca.length;c<k;c++)ca[c]=0;c=I*3;
|
|
|
|
-for(k=C.length;c<k;c++)C[c]=0;V.point.length=I;V.directional.length=W;V.ambient[0]=w;V.ambient[1]=v;V.ambient[2]=u;b=Ja;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof
|
|
|
|
-THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=e.opacity,U.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=
|
|
|
|
-e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=$.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,U.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):
|
|
|
|
-(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)U.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<Y.length;b++)n.shadowMatrix.value[b]=Y[b],n.shadowMap.texture[b]=U.shadowMap[b];
|
|
|
|
-n.shadowDarkness.value=U.shadowMapDarkness;n.shadowBias.value=U.shadowMapBias}b=e.uniformsList;n=0;for(c=b.length;n<c;n++)if(v=h.uniforms[b[n][1]])if(w=b[n][0],u=w.type,k=w.value,u==="i")o.uniform1i(v,k);else if(u==="f")o.uniform1f(v,k);else if(u==="v2")o.uniform2f(v,k.x,k.y);else if(u==="v3")o.uniform3f(v,k.x,k.y,k.z);else if(u==="v4")o.uniform4f(v,k.x,k.y,k.z,k.w);else if(u==="c")o.uniform3f(v,k.r,k.g,k.b);else if(u==="fv1")o.uniform1fv(v,k);else if(u==="fv")o.uniform3fv(v,k);else if(u==="v3v"){if(!w._array)w._array=
|
|
|
|
-new Float32Array(3*k.length);u=0;for(x=k.length;u<x;u++)V=u*3,w._array[V]=k[u].x,w._array[V+1]=k[u].y,w._array[V+2]=k[u].z;o.uniform3fv(v,w._array)}else if(u==="m4"){if(!w._array)w._array=new Float32Array(16);k.flattenToArray(w._array);o.uniformMatrix4fv(v,!1,w._array)}else if(u==="m4v"){if(!w._array)w._array=new Float32Array(16*k.length);u=0;for(x=k.length;u<x;u++)k[u].flattenToArrayOffset(w._array,u*16);o.uniformMatrix4fv(v,!1,w._array)}else if(u==="t"){if(o.uniform1i(v,k),v=w.texture)if(v.image instanceof
|
|
|
|
-Array&&v.image.length===6){if(w=v,w.image.length===6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+k);o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);for(k=0;k<6;k++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,w.image[k]);O(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else v instanceof
|
|
|
|
-THREE.WebGLRenderTargetCube?(w=v,o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):K(v,k)}else if(u==="tv"){if(!w._array){w._array=[];u=0;for(x=w.texture.length;u<x;u++)w._array[u]=k+u}o.uniform1iv(v,w._array);u=0;for(x=w.texture.length;u<x;u++)(v=w.texture[u])&&K(v,w._array[u])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&l.cameraPosition!==null&&o.uniform3f(l.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof
|
|
|
|
-THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&l.viewMatrix!==null&&o.uniformMatrix4fv(l.viewMatrix,!1,ya);e.skinning&&(o.uniformMatrix4fv(l.cameraInverseMatrix,!1,ya),o.uniformMatrix4fv(l.boneGlobalMatrices,!1,f.boneMatrices))}o.uniformMatrix4fv(l.modelViewMatrix,!1,f._modelViewMatrixArray);l.normalMatrix&&o.uniformMatrix3fv(l.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&
|
|
|
|
-l.objectMatrix!==null&&o.uniformMatrix4fv(l.objectMatrix,!1,f._objectMatrixArray);return h}function f(a,b,c,e,f,h){if(e.opacity!==0){var k,n,c=l(a,b,c,e,h),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==aa&&(aa=c,b=!0);if(!e.morphTargets&&a.position>=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=e.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),
|
|
|
|
-o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){k=0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;k<e.numSupportedMorphTargets&&k<p.length;)o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[k]]),o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[k]=n[p[k]],k++}else{var p=[],t=-1,
|
|
|
|
-w=0;n=h.morphTargetInfluences;var v,u=n.length;k=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);k<e.numSupportedMorphTargets;){for(v=0;v<u;v++)!p[v]&&n[v]>t&&(w=v,t=n[w]);o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[k]=t;p[w]=1;t=-1;k++}}e.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(e.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){k=
|
|
|
|
-0;for(n=f.__webglCustomAttributesList.length;k<n;k++)c=f.__webglCustomAttributesList[k],a[c.buffer.belongsToAttribute]>=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
-f.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):o.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));e.skinning&&a.skinVertexA>=0&&a.skinVertexB>=
|
|
|
|
-0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(e.wireframe?
|
|
|
|
-(o.lineWidth(e.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),o.drawElements(o.LINES,f.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),o.drawElements(o.TRIANGLES,f.__webglFaceCount,o.UNSIGNED_SHORT,0)),U.info.render.calls++,U.info.render.vertices+=f.__webglFaceCount,U.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(e.linewidth),o.drawArrays(h,
|
|
|
|
-0,f.__webglLineCount),U.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),U.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),U.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,
|
|
|
|
-o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,l,k,n,p,t,w,v,u=a.count*3;for(v=0;v<u;v+=9)c=a.normalArray,e=c[v],f=c[v+1],h=c[v+2],l=c[v+3],n=c[v+4],t=c[v+5],k=c[v+6],p=c[v+7],w=c[v+8],e=(e+l+k)/3,f=(f+n+p)/3,h=(h+t+w)/3,c[v]=e,c[v+1]=f,c[v+2]=h,c[v+3]=e,c[v+4]=f,c[v+5]=h,c[v+6]=e,c[v+7]=f,c[v+8]=h}o.bufferData(o.ARRAY_BUFFER,
|
|
|
|
-a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function k(a){if(la!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),la=a.doubleSided;if(ra!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ra=a.flipSided}function n(a){da!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),da=a)}function t(a){S!==a&&(o.depthMask(a),S=a)}function v(a,
|
|
|
|
-b,c){fa!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=a);if(a&&(ha!==b||I!==c))o.polygonOffset(b,c),ha=b,I=c}function p(a){sa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);sa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);sa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);sa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);sa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);sa[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);
|
|
|
|
-for(var b,a=0;a<6;a++)b=sa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function x(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=sa[e].x*b.n14+sa[e].y*b.n24+sa[e].z*b.n34+sa[e].w,a<=c)return!1;return!0}function w(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=
|
|
|
|
-c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function u(a,b){return b.z-a.z}function B(a){var b,c,e,t=0,w,v,u,$,z=a.lights;ua||(ua=new THREE.PerspectiveCamera(U.shadowCameraFov,U.shadowMapWidth/U.shadowMapHeight,U.shadowCameraNear,U.shadowCameraFar));b=0;for(c=z.length;b<c;b++)if(e=z[b],e instanceof THREE.SpotLight&&e.castShadow){X=
|
|
|
|
--1;U.shadowMap[t]||(U.shadowMap[t]=new THREE.WebGLRenderTarget(U.shadowMapWidth,U.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Y[t]||(Y[t]=new THREE.Matrix4);w=U.shadowMap[t];v=Y[t];ua.position.copy(e.position);ua.lookAt(e.target.position);ua.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ua));this.autoUpdateScene&&a.updateMatrixWorld();ua.matrixWorldInverse.getInverse(ua.matrixWorld);v.set(0.5,0,0,0.5,0,0.5,0,
|
|
|
|
-0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(ua.projectionMatrix);v.multiplySelf(ua.matrixWorldInverse);ua.matrixWorldInverse.flattenToArray(ya);ua.projectionMatrix.flattenToArray(Ea);qa.multiply(ua.projectionMatrix,ua.matrixWorldInverse);p(qa);J(w);o.clearColor(1,1,1,1);U.clear();o.clearColor(ga.r,ga.g,ga.b,oa);v=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(w=0;w<v;w++)u=a.__webglObjects[w],$=u.object,$.visible&&$.castShadow?!($ instanceof THREE.Mesh)||!$.frustumCulled||x($)?($.matrixWorld.flattenToArray($._objectMatrixArray),
|
|
|
|
-F($,ua,!1),u.render=!0):u.render=!1:u.render=!1;n(!0);D(THREE.NormalBlending);for(w=0;w<v;w++)if(u=a.__webglObjects[w],u.render)$=u.object,buffer=u.buffer,k($),u=$.customDepthMaterial?$.customDepthMaterial:$.geometry.morphTargets.length?Fa:Ha,f(ua,z,null,u,buffer,$);for(w=0;w<e;w++)u=a.__webglObjectsImmediate[w],$=u.object,$.visible&&$.castShadow&&($.matrixAutoUpdate&&$.matrixWorld.flattenToArray($._objectMatrixArray),aa=-1,F($,ua,!1),k($),program=l(ua,z,null,Ha,$),$.immediateRenderCallback?$.immediateRenderCallback(program,
|
|
|
|
-o,sa):$.render(function(a){h(a,program,Ha.shading)}));t++}}function y(a,b){var c,e,f;c=T.attributes;var h=T.uniforms,l=wa/ma,k,n=[],t=ma*0.5,w=wa*0.5,p=!0;o.useProgram(T.program);pa=T.program;aa=da=ia=-1;Ga||(o.enableVertexAttribArray(T.attributes.position),o.enableVertexAttribArray(T.attributes.uv),Ga=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,T.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,
|
|
|
|
-16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,T.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(u);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&
|
|
|
|
-f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,(f.position.x-t)/t,(w-f.position.y)/w,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/(f.scaleByViewport?wa:1),n[0]=k*l*f.scale.x,n[1]=k*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,
|
|
|
|
-f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),o.uniform1f(h.opacity,f.opacity),o.uniform3f(h.color,f.color.r,f.color.g,f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),D(f.blending),K(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(S)}function F(a,
|
|
|
|
-b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function C(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function H(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function L(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function R(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
|
-function D(a){if(a!==ia){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ia=a}}function O(a,b,c){(c.width&c.width-
|
|
|
|
-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Z(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Z(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Z(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Z(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,ja(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,ja(b.minFilter)))}function K(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
|
|
|
|
-!0,a.__webglTexture=o.createTexture(),U.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Z(a.format),a.image.width,a.image.height,0,Z(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);O(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function N(a,b){o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
|
-a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function J(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
|
-if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);O(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Z(a.format),a.width,a.height,0,Z(a.format),Z(a.type),
|
|
|
|
-null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,f,e.__webglTexture,0);N(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),O(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Z(a.format),a.width,a.height,0,Z(a.format),Z(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
|
-a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),N(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=ma,a=wa,e=Q,f=ka);b!==G&&(o.bindFramebuffer(o.FRAMEBUFFER,b),
|
|
|
|
-o.viewport(e,f,c,a),G=b)}function M(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function ea(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,
|
|
|
|
-o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function ja(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Z(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;
|
|
|
|
-case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;
|
|
|
|
-case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var U=this,o,P=[],pa=null,G=null,X=-1,aa=null,na=0,la=null,ra=null,ia=null,da=null,S=null,fa=null,ha=null,I=null,Q=0,ka=0,ma=0,wa=0,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,Ea=new Float32Array(16),
|
|
|
|
-ya=new Float32Array(16),Aa=new THREE.Vector4,Ja={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},$=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ca=a.stencil!==void 0?a.stencil:!0,V=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,W=a.antialias!==void 0?a.antialias:!1,ga=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),oa=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==
|
|
|
|
-void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=$;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=
|
|
|
|
-5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var ua,Y=[],a=THREE.ShaderLib.depthRGBA,Ba=THREE.UniformsUtils.clone(a.uniforms),Ha=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Ba}),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Ba,morphTargets:!0});Ha._shadowPass=!0;Fa._shadowPass=!0;try{if(!(o=$.getContext("experimental-webgl",
|
|
|
|
-{antialias:W,stencil:ca,preserveDrawingBuffer:V})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(xa){console.error(xa)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);
|
|
|
|
-o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ga.r,ga.g,ga.b,oa);this.context=o;var Ca=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,T={};T.vertices=new Float32Array(16);T.faces=new Uint16Array(6);ca=0;T.vertices[ca++]=-1;T.vertices[ca++]=-1;T.vertices[ca++]=0;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=-1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=0;T.vertices[ca++]=-1;T.vertices[ca++]=1;T.vertices[ca++]=
|
|
|
|
-0;ca=T.vertices[ca++]=0;T.faces[ca++]=0;T.faces[ca++]=1;T.faces[ca++]=2;T.faces[ca++]=0;T.faces[ca++]=2;T.faces[ca++]=3;T.vertexBuffer=o.createBuffer();T.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,T.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,T.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,T.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,T.faces,o.STATIC_DRAW);T.program=o.createProgram();o.attachShader(T.program,ea("fragment",THREE.ShaderLib.sprite.fragmentShader));
|
|
|
|
-o.attachShader(T.program,ea("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.position=o.getAttribLocation(T.program,"position");T.attributes.uv=o.getAttribLocation(T.program,"uv");T.uniforms.uvOffset=o.getUniformLocation(T.program,"uvOffset");T.uniforms.uvScale=o.getUniformLocation(T.program,"uvScale");T.uniforms.rotation=o.getUniformLocation(T.program,"rotation");T.uniforms.scale=o.getUniformLocation(T.program,"scale");T.uniforms.alignment=
|
|
|
|
-o.getUniformLocation(T.program,"alignment");T.uniforms.color=o.getUniformLocation(T.program,"color");T.uniforms.map=o.getUniformLocation(T.program,"map");T.uniforms.opacity=o.getUniformLocation(T.program,"opacity");T.uniforms.useScreenCoordinates=o.getUniformLocation(T.program,"useScreenCoordinates");T.uniforms.affectedByDistance=o.getUniformLocation(T.program,"affectedByDistance");T.uniforms.screenPosition=o.getUniformLocation(T.program,"screenPosition");T.uniforms.modelViewMatrix=o.getUniformLocation(T.program,
|
|
|
|
-"modelViewMatrix");T.uniforms.projectionMatrix=o.getUniformLocation(T.program,"projectionMatrix");var Ga=!1;this.setSize=function(a,b){$.width=a;$.height=b;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(a,b,c,e){Q=a;ka=b;ma=c;wa=e;o.viewport(Q,ka,ma,wa)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ga.setHex(a);oa=b;o.clearColor(ga.r,ga.g,ga.b,oa)};
|
|
|
|
-this.setClearColor=function(a,b){ga.copy(a);oa=b;o.clearColor(ga.r,ga.g,ga.b,oa)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return oa};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,
|
|
|
|
-delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);
|
|
|
|
-o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);U.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;
|
|
|
|
-else if(a instanceof THREE.ParticleSystem)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),U.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,l,k;a instanceof THREE.MeshDepthMaterial?k="depth":a instanceof THREE.MeshNormalMaterial?k="normal":a instanceof THREE.MeshBasicMaterial?k="basic":a instanceof THREE.MeshLambertMaterial?
|
|
|
|
-k="lambert":a instanceof THREE.MeshPhongMaterial?k="phong":a instanceof THREE.LineBasicMaterial?k="basic":a instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var t,w,p;t=p=n=0;for(w=b.length;t<w;t++)l=b[t],l instanceof THREE.SpotLight&&p++,l instanceof THREE.DirectionalLight&&p++,l instanceof THREE.PointLight&&n++;n+p<=ta?t=p:(t=Math.ceil(ta*p/
|
|
|
|
-(n+p)),n=ta-t);l={directional:t,point:n};n=p=0;for(t=b.length;n<t;n++)w=b[n],w instanceof THREE.SpotLight&&w.castShadow&&p++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var u;a:{t=a.fragmentShader;w=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:l.directional,
|
|
|
|
-maxPointLights:l.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},x,e=[];k?e.push(k):(e.push(t),e.push(w));for(x in c)e.push(x),e.push(c[x]);k=e.join();x=0;for(e=P.length;x<e;x++)if(P[x].code===k){u=P[x].program;break a}x=o.createProgram();e=[Ca?"#define VERTEX_TEXTURES":"",U.gammaInput?"#define GAMMA_INPUT":
|
|
|
|
-"",U.gammaOutput?"#define GAMMA_OUTPUT":"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#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.perPixel?"#define PHONG_PER_PIXEL":
|
|
|
|
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",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");
|
|
|
|
-l=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",U.gammaInput?"#define GAMMA_INPUT":"",U.gammaOutput?"#define GAMMA_OUTPUT":"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
|
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,ea("fragment",l+t));o.attachShader(x,
|
|
|
|
|
|
+THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in e.attributes){var h=e.attributes[f],k={},l;for(l in h)k[l]=h[l];if(!k.__webglInitialized||k.createUniqueBuffers){k.__webglInitialized=!0;var n=1;k.type==="v2"?n=2:k.type==="v3"?n=3:k.type==="v4"?n=4:k.type==="c"&&(n=3);k.size=n;k.array=new Float32Array(c*n);k.buffer=o.createBuffer();k.buffer.belongsToAttribute=
|
|
|
|
+f;h.needsUpdate=!0;k.__original=h}a.__webglCustomAttributesList.push(k)}}}function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,f,k,h=a.vertices,l=h.length,n=a.colors,p=n.length,t=a.__vertexArray,w=a.__colorArray,v=a.__sortArray,u=a.__dirtyVertices,x=a.__dirtyColors,$=a.__webglCustomAttributesList;if(c.sortParticles){qa.multiplySelf(c.matrixWorld);for(e=0;e<l;e++)f=
|
|
|
|
+h[e].position,Aa.copy(f),qa.multiplyVector3(Aa),v[e]=[Aa.z,e];v.sort(function(a,b){return b[0]-a[0]});for(e=0;e<l;e++)f=h[v[e][1]].position,k=e*3,t[k]=f.x,t[k+1]=f.y,t[k+2]=f.z;for(e=0;e<p;e++)k=e*3,color=n[v[e][1]],w[k]=color.r,w[k+1]=color.g,w[k+2]=color.b;if($){n=0;for(p=$.length;n<p;n++)if(l=$[n],l.boundTo===void 0||l.boundTo==="vertices"){k=0;f=l.value.length;for(e=0;e<f;e++)index=v[e][1],l.size===1?l.array[k]=l.value[index]:(h=l.value[index],l.size===2?(l.array[k]=h.x,l.array[k+1]=h.y):l.size===
|
|
|
|
+3?l.type==="c"?(l.array[k]=h.r,l.array[k+1]=h.g,l.array[k+2]=h.b):(l.array[k]=h.x,l.array[k+1]=h.y,l.array[k+2]=h.z):(l.array[k]=h.x,l.array[k+1]=h.y,l.array[k+2]=h.z,l.array[k+3]=h.w)),k+=l.size}}}else{if(u)for(e=0;e<l;e++)f=h[e].position,k=e*3,t[k]=f.x,t[k+1]=f.y,t[k+2]=f.z;if(x)for(e=0;e<p;e++)color=n[e],k=e*3,w[k]=color.r,w[k+1]=color.g,w[k+2]=color.b;if($){n=0;for(p=$.length;n<p;n++)if(l=$[n],l.__original.needsUpdate&&(l.boundTo===void 0||l.boundTo==="vertices")){f=l.value.length;for(e=k=0;e<
|
|
|
|
+f;e++)offset_custom=l.offset,l.size===1?l.array[k]=l.value[e]:(h=l.value[e],l.size===2?(l.array[k]=h.x,l.array[k+1]=h.y):l.size===3?l.type==="c"?(l.array[k]=h.r,l.array[k+1]=h.g,l.array[k+2]=h.b):(l.array[k]=h.x,l.array[k+1]=h.y,l.array[k+2]=h.z):(l.array[k]=h.x,l.array[k+1]=h.y,l.array[k+2]=h.z,l.array[k+3]=h.w)),k+=l.size}}}if(u||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,t,b);if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),
|
|
|
|
+o.bufferData(o.ARRAY_BUFFER,w,b);if($){n=0;for(p=$.length;n<p;n++)if(l=$[n],l.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,l.buffer),o.bufferData(o.ARRAY_BUFFER,l.array,b)}}function k(a,b,c,e,k){e.program||U.initMaterial(e,b,c,k);if(e.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(U.maxMorphTargets);for(var f=0,h=U.maxMorphTargets;f<h;f++)k.__webglMorphTargetInfluences[f]=0}var l=!1,f=e.program,h=f.uniforms,n=e.uniforms;f!==pa&&
|
|
|
|
+(o.useProgram(f),pa=f,l=!0);if(e.id!==X)X=e.id,l=!0;if(l){o.uniformMatrix4fv(h.projectionMatrix,!1,Ea);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var p,t,w=0,v=0,u=0,x,z,B,V=Ja,ca=V.directional.colors,y=V.directional.positions,C=V.point.colors,F=V.point.positions,H=V.point.distances,
|
|
|
|
+W=0,I=0,c=p=B=0,l=b.length;c<l;c++)if(p=b[c],t=p.color,x=p.position,z=p.intensity,B=p.distance,p instanceof THREE.AmbientLight)U.gammaInput?(w+=t.r*t.r,v+=t.g*t.g,u+=t.b*t.b):(w+=t.r,v+=t.g,u+=t.b);else if(p instanceof THREE.DirectionalLight)B=W*3,U.gammaInput?(ca[B]=t.r*t.r*z*z,ca[B+1]=t.g*t.g*z*z,ca[B+2]=t.b*t.b*z*z):(ca[B]=t.r*z,ca[B+1]=t.g*z,ca[B+2]=t.b*z),y[B]=x.x,y[B+1]=x.y,y[B+2]=x.z,W+=1;else if(p instanceof THREE.SpotLight)B=W*3,U.gammaInput?(ca[B]=t.r*t.r*z*z,ca[B+1]=t.g*t.g*z*z,ca[B+2]=
|
|
|
|
+t.b*t.b*z*z):(ca[B]=t.r*z,ca[B+1]=t.g*z,ca[B+2]=t.b*z),t=1/x.length(),y[B]=x.x*t,y[B+1]=x.y*t,y[B+2]=x.z*t,W+=1;else if(p instanceof THREE.PointLight)p=I*3,U.gammaInput?(C[p]=t.r*t.r*z*z,C[p+1]=t.g*t.g*z*z,C[p+2]=t.b*t.b*z*z):(C[p]=t.r*z,C[p+1]=t.g*z,C[p+2]=t.b*z),F[p]=x.x,F[p+1]=x.y,F[p+2]=x.z,H[I]=B,I+=1;c=W*3;for(l=ca.length;c<l;c++)ca[c]=0;c=I*3;for(l=C.length;c<l;c++)C[c]=0;V.point.length=I;V.directional.length=W;V.ambient[0]=w;V.ambient[1]=v;V.ambient[2]=u;b=Ja;n.enableLighting.value=b.directional.length+
|
|
|
|
+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=e.opacity,U.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=
|
|
|
|
+e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=
|
|
|
|
+e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=$.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,U.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)U.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):
|
|
|
|
+n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(k.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<Y.length;b++)n.shadowMatrix.value[b]=Y[b],n.shadowMap.texture[b]=U.shadowMap[b];n.shadowDarkness.value=U.shadowMapDarkness;n.shadowBias.value=U.shadowMapBias}b=e.uniformsList;n=0;for(c=b.length;n<c;n++)if(v=f.uniforms[b[n][1]])if(w=
|
|
|
|
+b[n][0],u=w.type,l=w.value,u==="i")o.uniform1i(v,l);else if(u==="f")o.uniform1f(v,l);else if(u==="v2")o.uniform2f(v,l.x,l.y);else if(u==="v3")o.uniform3f(v,l.x,l.y,l.z);else if(u==="v4")o.uniform4f(v,l.x,l.y,l.z,l.w);else if(u==="c")o.uniform3f(v,l.r,l.g,l.b);else if(u==="fv1")o.uniform1fv(v,l);else if(u==="fv")o.uniform3fv(v,l);else if(u==="v3v"){if(!w._array)w._array=new Float32Array(3*l.length);u=0;for(x=l.length;u<x;u++)V=u*3,w._array[V]=l[u].x,w._array[V+1]=l[u].y,w._array[V+2]=l[u].z;o.uniform3fv(v,
|
|
|
|
+w._array)}else if(u==="m4"){if(!w._array)w._array=new Float32Array(16);l.flattenToArray(w._array);o.uniformMatrix4fv(v,!1,w._array)}else if(u==="m4v"){if(!w._array)w._array=new Float32Array(16*l.length);u=0;for(x=l.length;u<x;u++)l[u].flattenToArrayOffset(w._array,u*16);o.uniformMatrix4fv(v,!1,w._array)}else if(u==="t"){if(o.uniform1i(v,l),v=w.texture)if(v.image instanceof Array&&v.image.length===6){if(w=v,w.image.length===6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=
|
|
|
|
+o.createTexture();o.activeTexture(o.TEXTURE0+l);o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);for(l=0;l<6;l++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,w.image[l]);O(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+l),o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else v instanceof THREE.WebGLRenderTargetCube?(w=v,o.activeTexture(o.TEXTURE0+l),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):K(v,l)}else if(u===
|
|
|
|
+"tv"){if(!w._array){w._array=[];u=0;for(x=w.texture.length;u<x;u++)w._array[u]=l+u}o.uniform1iv(v,w._array);u=0;for(x=w.texture.length;u<x;u++)(v=w.texture[u])&&K(v,w._array[u])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&h.cameraPosition!==null&&o.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&h.viewMatrix!==null&&
|
|
|
|
+o.uniformMatrix4fv(h.viewMatrix,!1,ya);e.skinning&&(o.uniformMatrix4fv(h.cameraInverseMatrix,!1,ya),o.uniformMatrix4fv(h.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(h.modelViewMatrix,!1,k._modelViewMatrixArray);h.normalMatrix&&o.uniformMatrix3fv(h.normalMatrix,!1,k._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||k.receiveShadow)&&h.objectMatrix!==null&&o.uniformMatrix4fv(h.objectMatrix,!1,k._objectMatrixArray);return f}function f(a,b,c,e,f,h){if(e.opacity!==
|
|
|
|
+0){var l,n,c=k(a,b,c,e,h),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==aa&&(aa=c,b=!0);if(!e.morphTargets&&a.position>=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=e.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),
|
|
|
|
+o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;l<e.numSupportedMorphTargets&&l<p.length;)o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[l]]),o.vertexAttribPointer(c["morphTarget"+l],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[l]=n[p[l]],l++}else{var p=[],t=-1,w=0;n=h.morphTargetInfluences;var v,u=n.length;l=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);l<e.numSupportedMorphTargets;){for(v=
|
|
|
|
+0;v<u;v++)!p[v]&&n[v]>t&&(w=v,t=n[w]);o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(c["morphTarget"+l],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=t;p[w]=1;t=-1;l++}}e.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(e.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){l=0;for(n=f.__webglCustomAttributesList.length;l<n;l++)c=f.__webglCustomAttributesList[l],a[c.buffer.belongsToAttribute]>=
|
|
|
|
+0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
+f.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):o.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));e.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,
|
|
|
|
+o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(e.wireframe?(o.lineWidth(e.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),o.drawElements(o.LINES,f.__webglLineCount,
|
|
|
|
+o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),o.drawElements(o.TRIANGLES,f.__webglFaceCount,o.UNSIGNED_SHORT,0)),U.info.render.calls++,U.info.render.vertices+=f.__webglFaceCount,U.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(e.linewidth),o.drawArrays(h,0,f.__webglLineCount),U.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),U.info.render.calls++):
|
|
|
|
+h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),U.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
+a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,k,l,n,p,t,w,v,u=a.count*3;for(v=0;v<u;v+=9)c=a.normalArray,e=c[v],f=c[v+1],h=c[v+2],k=c[v+3],n=c[v+4],t=c[v+5],l=c[v+6],p=c[v+7],w=c[v+8],e=(e+k+l)/3,f=(f+n+p)/3,h=(h+t+w)/3,c[v]=e,c[v+1]=f,c[v+2]=h,c[v+3]=e,c[v+4]=f,c[v+5]=h,c[v+6]=e,c[v+7]=f,c[v+8]=h}o.bufferData(o.ARRAY_BUFFER,a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
|
|
|
|
+0,a.count);a.count=0}function l(a){if(la!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),la=a.doubleSided;if(ra!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ra=a.flipSided}function n(a){da!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),da=a)}function t(a){S!==a&&(o.depthMask(a),S=a)}function v(a,b,c){fa!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=a);if(a&&(ha!==b||I!==c))o.polygonOffset(b,c),ha=b,I=c}function p(a){sa[0].set(a.n41-
|
|
|
|
+a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);sa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);sa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);sa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);sa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);sa[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=sa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function x(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
|
|
|
|
+Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=sa[e].x*b.n14+sa[e].y*b.n24+sa[e].z*b.n34+sa[e].w,a<=c)return!1;return!0}function w(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=
|
|
|
|
+b,a.opaque=null):(a.opaque=b,a.transparent=null)}function u(a,b){return b.z-a.z}function B(a){var b,c,e,t=0,w,v,u,$,z=a.lights;ua||(ua=new THREE.PerspectiveCamera(U.shadowCameraFov,U.shadowMapWidth/U.shadowMapHeight,U.shadowCameraNear,U.shadowCameraFar));b=0;for(c=z.length;b<c;b++)if(e=z[b],e instanceof THREE.SpotLight&&e.castShadow){X=-1;U.shadowMap[t]||(U.shadowMap[t]=new THREE.WebGLRenderTarget(U.shadowMapWidth,U.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
|
|
|
|
+Y[t]||(Y[t]=new THREE.Matrix4);w=U.shadowMap[t];v=Y[t];ua.position.copy(e.position);ua.lookAt(e.target.position);ua.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ua));this.autoUpdateScene&&a.updateMatrixWorld();ua.matrixWorldInverse.getInverse(ua.matrixWorld);v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(ua.projectionMatrix);v.multiplySelf(ua.matrixWorldInverse);ua.matrixWorldInverse.flattenToArray(ya);ua.projectionMatrix.flattenToArray(Ea);qa.multiply(ua.projectionMatrix,
|
|
|
|
+ua.matrixWorldInverse);p(qa);J(w);o.clearColor(1,1,1,1);U.clear();o.clearColor(ga.r,ga.g,ga.b,oa);v=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(w=0;w<v;w++)u=a.__webglObjects[w],$=u.object,$.visible&&$.castShadow?!($ instanceof THREE.Mesh)||!$.frustumCulled||x($)?($.matrixWorld.flattenToArray($._objectMatrixArray),F($,ua,!1),u.render=!0):u.render=!1:u.render=!1;n(!0);D(THREE.NormalBlending);for(w=0;w<v;w++)if(u=a.__webglObjects[w],u.render)$=u.object,buffer=u.buffer,l($),u=$.customDepthMaterial?
|
|
|
|
+$.customDepthMaterial:$.geometry.morphTargets.length?Fa:Ha,f(ua,z,null,u,buffer,$);for(w=0;w<e;w++)u=a.__webglObjectsImmediate[w],$=u.object,$.visible&&$.castShadow&&($.matrixAutoUpdate&&$.matrixWorld.flattenToArray($._objectMatrixArray),aa=-1,F($,ua,!1),l($),program=k(ua,z,null,Ha,$),$.immediateRenderCallback?$.immediateRenderCallback(program,o,sa):$.render(function(a){h(a,program,Ha.shading)}));t++}}function y(a,b){var c,e,f;c=T.attributes;var h=T.uniforms,k=wa/ma,l,n=[],t=ma*0.5,w=wa*0.5,p=!0;
|
|
|
|
+o.useProgram(T.program);pa=T.program;aa=da=ia=-1;Ga||(o.enableVertexAttribArray(T.attributes.position),o.enableVertexAttribArray(T.attributes.uv),Ga=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,T.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,T.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(h.map,0);c=
|
|
|
|
+0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(u);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,
|
|
|
|
+(f.position.x-t)/t,(w-f.position.y)/w,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?wa:1),n[0]=l*k*f.scale.x,n[1]=l*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),o.uniform1f(h.opacity,f.opacity),
|
|
|
|
+o.uniform3f(h.color,f.color.r,f.color.g,f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),D(f.blending),K(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(S)}function F(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
|
|
|
|
+function C(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function H(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function L(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function R(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function D(a){if(a!==ia){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,
|
|
|
|
+o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ia=a}}function O(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Z(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Z(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Z(b.magFilter)),o.texParameteri(a,
|
|
|
|
+o.TEXTURE_MIN_FILTER,Z(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,ja(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,ja(b.minFilter)))}function K(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=o.createTexture(),U.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?
|
|
|
|
+o.texImage2D(o.TEXTURE_2D,0,Z(a.format),a.image.width,a.image.height,0,Z(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);O(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function N(a,b){o.bindRenderbuffer(o.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
|
|
|
|
+o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function J(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();
|
|
|
|
+if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);O(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Z(a.format),a.width,a.height,0,Z(a.format),Z(a.type),null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,
|
|
|
|
+f,e.__webglTexture,0);N(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),O(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Z(a.format),a.width,a.height,0,Z(a.format),Z(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),
|
|
|
|
+N(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=ma,a=wa,e=Q,f=ka);b!==G&&(o.bindFramebuffer(o.FRAMEBUFFER,b),o.viewport(e,f,c,a),G=b)}function M(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),
|
|
|
|
+o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function ea(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function ja(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;
|
|
|
|
+default:return o.LINEAR}}function Z(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;
|
|
|
|
+case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}
|
|
|
|
+var U=this,o,P=[],pa=null,G=null,X=-1,aa=null,na=0,la=null,ra=null,ia=null,da=null,S=null,fa=null,ha=null,I=null,Q=0,ka=0,ma=0,wa=0,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,Ea=new Float32Array(16),ya=new Float32Array(16),Aa=new THREE.Vector4,Ja={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},$=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
+ca=a.stencil!==void 0?a.stencil:!0,V=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,W=a.antialias!==void 0?a.antialias:!1,ga=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),oa=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=$;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
|
|
|
|
+this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var ua,Y=[],a=THREE.ShaderLib.depthRGBA,Ba=THREE.UniformsUtils.clone(a.uniforms),Ha=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
|
|
|
|
+vertexShader:a.vertexShader,uniforms:Ba}),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Ba,morphTargets:!0});Ha._shadowPass=!0;Fa._shadowPass=!0;try{if(!(o=$.getContext("experimental-webgl",{antialias:W,stencil:ca,preserveDrawingBuffer:V})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(xa){console.error(xa)}o.clearColor(0,
|
|
|
|
+0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ga.r,ga.g,ga.b,oa);this.context=o;var Ca=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,T={};T.vertices=new Float32Array(16);T.faces=new Uint16Array(6);ca=0;T.vertices[ca++]=-1;T.vertices[ca++]=-1;T.vertices[ca++]=0;T.vertices[ca++]=1;T.vertices[ca++]=
|
|
|
|
+1;T.vertices[ca++]=-1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=0;T.vertices[ca++]=-1;T.vertices[ca++]=1;T.vertices[ca++]=0;ca=T.vertices[ca++]=0;T.faces[ca++]=0;T.faces[ca++]=1;T.faces[ca++]=2;T.faces[ca++]=0;T.faces[ca++]=2;T.faces[ca++]=3;T.vertexBuffer=o.createBuffer();T.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,T.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,T.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+T.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,T.faces,o.STATIC_DRAW);T.program=o.createProgram();o.attachShader(T.program,ea("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(T.program,ea("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.position=o.getAttribLocation(T.program,"position");T.attributes.uv=o.getAttribLocation(T.program,"uv");T.uniforms.uvOffset=o.getUniformLocation(T.program,"uvOffset");T.uniforms.uvScale=
|
|
|
|
+o.getUniformLocation(T.program,"uvScale");T.uniforms.rotation=o.getUniformLocation(T.program,"rotation");T.uniforms.scale=o.getUniformLocation(T.program,"scale");T.uniforms.alignment=o.getUniformLocation(T.program,"alignment");T.uniforms.color=o.getUniformLocation(T.program,"color");T.uniforms.map=o.getUniformLocation(T.program,"map");T.uniforms.opacity=o.getUniformLocation(T.program,"opacity");T.uniforms.useScreenCoordinates=o.getUniformLocation(T.program,"useScreenCoordinates");T.uniforms.affectedByDistance=
|
|
|
|
+o.getUniformLocation(T.program,"affectedByDistance");T.uniforms.screenPosition=o.getUniformLocation(T.program,"screenPosition");T.uniforms.modelViewMatrix=o.getUniformLocation(T.program,"modelViewMatrix");T.uniforms.projectionMatrix=o.getUniformLocation(T.program,"projectionMatrix");var Ga=!1;this.setSize=function(a,b){$.width=a;$.height=b;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(a,b,c,e){Q=a;ka=b;ma=c;wa=e;o.viewport(Q,ka,ma,wa)};this.setScissor=function(a,b,c,e){o.scissor(a,
|
|
|
|
+b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ga.setHex(a);oa=b;o.clearColor(ga.r,ga.g,ga.b,oa)};this.setClearColor=function(a,b){ga.copy(a);oa=b;o.clearColor(ga.r,ga.g,ga.b,oa)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return oa};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;
|
|
|
|
+o.clear(e)};this.getContext=function(){return o};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);
|
|
|
|
+o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);U.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),
|
|
|
|
+U.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),U.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,
|
|
|
|
+h,k,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var t,
|
|
|
|
+w,p;t=p=n=0;for(w=b.length;t<w;t++)k=b[t],k instanceof THREE.SpotLight&&p++,k instanceof THREE.DirectionalLight&&p++,k instanceof THREE.PointLight&&n++;n+p<=ta?t=p:(t=Math.ceil(ta*p/(n+p)),n=ta-t);k={directional:t,point:n};n=p=0;for(t=b.length;n<t;n++)w=b[n],w instanceof THREE.SpotLight&&w.castShadow&&p++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var u;a:{t=a.fragmentShader;w=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,
|
|
|
|
+vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:k.directional,maxPointLights:k.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},x,e=[];l?e.push(l):(e.push(t),e.push(w));for(x in c)e.push(x),
|
|
|
|
+e.push(c[x]);l=e.join();x=0;for(e=P.length;x<e;x++)if(P[x].code===l){u=P[x].program;break a}x=o.createProgram();e=[Ca?"#define VERTEX_TEXTURES":"",U.gammaInput?"#define GAMMA_INPUT":"",U.gammaOutput?"#define GAMMA_OUTPUT":"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#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.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",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");
|
|
|
|
+k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",U.gammaInput?"#define GAMMA_INPUT":"",U.gammaOutput?"#define GAMMA_OUTPUT":"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
|
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,ea("fragment",k+t));o.attachShader(x,
|
|
ea("vertex",e+w));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");x.uniforms={};x.attributes={};var $,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for($ in n)e.push($);$=e;e=0;for(n=$.length;e<n;e++)t=$[e],x.uniforms[t]=o.getUniformLocation(x,
|
|
ea("vertex",e+w));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");x.uniforms={};x.attributes={};var $,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for($ in n)e.push($);$=e;e=0;for(n=$.length;e<n;e++)t=$[e],x.uniforms[t]=o.getUniformLocation(x,
|
|
-t);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for($=0;$<c.maxMorphTargets;$++)e.push("morphTarget"+$);for(u in b)e.push(u);u=e;$=0;for(b=u.length;$<b;$++)c=u[$],x.attributes[c]=o.getAttribLocation(x,c);x.id=P.length;P.push({program:x,code:k});U.info.memory.programs=P.length;u=x}a.program=u;u=a.program.attributes;u.position>=0&&o.enableVertexAttribArray(u.position);u.color>=0&&o.enableVertexAttribArray(u.color);u.normal>=0&&o.enableVertexAttribArray(u.normal);
|
|
|
|
|
|
+t);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for($=0;$<c.maxMorphTargets;$++)e.push("morphTarget"+$);for(u in b)e.push(u);u=e;$=0;for(b=u.length;$<b;$++)c=u[$],x.attributes[c]=o.getAttribLocation(x,c);x.id=P.length;P.push({program:x,code:l});U.info.memory.programs=P.length;u=x}a.program=u;u=a.program.attributes;u.position>=0&&o.enableVertexAttribArray(u.position);u.color>=0&&o.enableVertexAttribArray(u.color);u.normal>=0&&o.enableVertexAttribArray(u.normal);
|
|
u.tangent>=0&&o.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(o.enableVertexAttribArray(u.skinVertexA),o.enableVertexAttribArray(u.skinVertexB),o.enableVertexAttribArray(u.skinIndex),o.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(h in a.attributes)u[h]!==void 0&&u[h]>=0&&o.enableVertexAttribArray(u[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)$="morphTarget"+h,u[$]>=0&&(o.enableVertexAttribArray(u[$]),
|
|
u.tangent>=0&&o.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(o.enableVertexAttribArray(u.skinVertexA),o.enableVertexAttribArray(u.skinVertexB),o.enableVertexAttribArray(u.skinIndex),o.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(h in a.attributes)u[h]!==void 0&&u[h]>=0&&o.enableVertexAttribArray(u[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)$="morphTarget"+h,u[$]>=0&&(o.enableVertexAttribArray(u[$]),
|
|
a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){J(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){B(a,b)};this.render=function(a,b,c,e){var $,V,ca,C,H,W,Da,I=a.lights,L=a.fog;X=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&B(a,b);U.info.render.calls=0;U.info.render.vertices=0;U.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){J(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){B(a,b)};this.render=function(a,b,c,e){var $,V,ca,C,H,W,Da,I=a.lights,L=a.fog;X=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&B(a,b);U.info.render.calls=0;U.info.render.vertices=0;U.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ya);b.projectionMatrix.flattenToArray(Ea);qa.multiply(b.projectionMatrix,b.matrixWorldInverse);p(qa);J(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);ca=a.__webglObjects.length;for(e=0;e<ca;e++)if(H=a.__webglObjects[e],W=H.object,W.visible)if(!(W instanceof THREE.Mesh)||!W.frustumCulled||x(W)){if(W.matrixWorld.flattenToArray(W._objectMatrixArray),
|
|
a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ya);b.projectionMatrix.flattenToArray(Ea);qa.multiply(b.projectionMatrix,b.matrixWorldInverse);p(qa);J(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);ca=a.__webglObjects.length;for(e=0;e<ca;e++)if(H=a.__webglObjects[e],W=H.object,W.visible)if(!(W instanceof THREE.Mesh)||!W.frustumCulled||x(W)){if(W.matrixWorld.flattenToArray(W._objectMatrixArray),
|
|
F(W,b,!0),z(H),H.render=!0,this.sortObjects)W.renderDepth?H.z=W.renderDepth:(Aa.copy(W.position),qa.multiplyVector3(Aa),H.z=Aa.z)}else H.render=!1;else H.render=!1;this.sortObjects&&a.__webglObjects.sort(u);C=a.__webglObjectsImmediate.length;for(e=0;e<C;e++)H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(W.matrixAutoUpdate&&W.matrixWorld.flattenToArray(W._objectMatrixArray),F(W,b,!0),w(H));if(a.overrideMaterial){n(a.overrideMaterial.depthTest);D(a.overrideMaterial.blending);for(e=0;e<ca;e++)if(H=
|
|
F(W,b,!0),z(H),H.render=!0,this.sortObjects)W.renderDepth?H.z=W.renderDepth:(Aa.copy(W.position),qa.multiplyVector3(Aa),H.z=Aa.z)}else H.render=!1;else H.render=!1;this.sortObjects&&a.__webglObjects.sort(u);C=a.__webglObjectsImmediate.length;for(e=0;e<C;e++)H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(W.matrixAutoUpdate&&W.matrixWorld.flattenToArray(W._objectMatrixArray),F(W,b,!0),w(H));if(a.overrideMaterial){n(a.overrideMaterial.depthTest);D(a.overrideMaterial.blending);for(e=0;e<ca;e++)if(H=
|
|
-a.__webglObjects[e],H.render)W=H.object,Da=H.buffer,k(W),f(b,I,L,a.overrideMaterial,Da,W);for(e=0;e<C;e++)H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(aa=-1,k(W),$=l(b,I,L,a.overrideMaterial,W),W.immediateRenderCallback?W.immediateRenderCallback($,o,sa):W.render(function(b){h(b,$,a.overrideMaterial.shading)}))}else{D(THREE.NormalBlending);for(e=ca-1;e>=0;e--)if(H=a.__webglObjects[e],H.render&&(W=H.object,Da=H.buffer,V=H.opaque))k(W),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,
|
|
|
|
-V.polygonOffsetUnits),f(b,I,L,V,Da,W);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(aa=-1,V=H.opaque))k(W),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),$=l(b,I,L,V,W),W.immediateRenderCallback?W.immediateRenderCallback($,o,sa):W.render(function(a){h(a,$,V.shading)});for(e=0;e<ca;e++)if(H=a.__webglObjects[e],H.render&&(W=H.object,Da=H.buffer,V=H.transparent))k(W),D(V.blending),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,
|
|
|
|
-V.polygonOffsetFactor,V.polygonOffsetUnits),f(b,I,L,V,Da,W);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(aa=-1,V=H.transparent))k(W),D(V.blending),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),$=l(b,I,L,V,W),W.immediateRenderCallback?W.immediateRenderCallback($,o,sa):W.render(function(a){h(a,$,V.shading)})}a.__webglSprites.length&&y(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&M(c)};this.initWebGLObjects=
|
|
|
|
-function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,l=void 0,k=void 0,n=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){k=f.geometry;if(k.geometryGroups===
|
|
|
|
-void 0){var n=k,t=void 0,p=void 0,w=void 0,v=void 0,u=void 0,x=void 0,$=void 0,z={},V=n.morphTargets.length;n.geometryGroups={};t=0;for(p=n.faces.length;t<p;t++)w=n.faces[t],v=w.materialIndex,x=v!==void 0?v:-1,z[x]===void 0&&(z[x]={hash:x,counter:0}),$=z[x].hash+"_"+z[x].counter,n.geometryGroups[$]===void 0&&(n.geometryGroups[$]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V}),u=w instanceof THREE.Face3?3:4,n.geometryGroups[$].vertices+u>65535&&(z[x].counter+=1,$=z[x].hash+"_"+
|
|
|
|
-z[x].counter,n.geometryGroups[$]===void 0&&(n.geometryGroups[$]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V})),w instanceof THREE.Face3?n.geometryGroups[$].faces3.push(t):n.geometryGroups[$].faces4.push(t),n.geometryGroups[$].vertices+=u;n.geometryGroupsList=[];t=void 0;for(t in n.geometryGroups)n.geometryGroups[t].id=na++,n.geometryGroupsList.push(n.geometryGroups[t])}for(l in k.geometryGroups)if(n=k.geometryGroups[l],!n.__webglVertexBuffer){t=n;t.__webglVertexBuffer=o.createBuffer();
|
|
|
|
|
|
+a.__webglObjects[e],H.render)W=H.object,Da=H.buffer,l(W),f(b,I,L,a.overrideMaterial,Da,W);for(e=0;e<C;e++)H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(aa=-1,l(W),$=k(b,I,L,a.overrideMaterial,W),W.immediateRenderCallback?W.immediateRenderCallback($,o,sa):W.render(function(b){h(b,$,a.overrideMaterial.shading)}))}else{D(THREE.NormalBlending);for(e=ca-1;e>=0;e--)if(H=a.__webglObjects[e],H.render&&(W=H.object,Da=H.buffer,V=H.opaque))l(W),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,
|
|
|
|
+V.polygonOffsetUnits),f(b,I,L,V,Da,W);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(aa=-1,V=H.opaque))l(W),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),$=k(b,I,L,V,W),W.immediateRenderCallback?W.immediateRenderCallback($,o,sa):W.render(function(a){h(a,$,V.shading)});for(e=0;e<ca;e++)if(H=a.__webglObjects[e],H.render&&(W=H.object,Da=H.buffer,V=H.transparent))l(W),D(V.blending),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,
|
|
|
|
+V.polygonOffsetFactor,V.polygonOffsetUnits),f(b,I,L,V,Da,W);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(aa=-1,V=H.transparent))l(W),D(V.blending),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),$=k(b,I,L,V,W),W.immediateRenderCallback?W.immediateRenderCallback($,o,sa):W.render(function(a){h(a,$,V.shading)})}a.__webglSprites.length&&y(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&M(c)};this.initWebGLObjects=
|
|
|
|
+function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,k=void 0,l=void 0,n=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){l=f.geometry;if(l.geometryGroups===
|
|
|
|
+void 0){var n=l,t=void 0,p=void 0,w=void 0,v=void 0,u=void 0,x=void 0,$=void 0,z={},V=n.morphTargets.length;n.geometryGroups={};t=0;for(p=n.faces.length;t<p;t++)w=n.faces[t],v=w.materialIndex,x=v!==void 0?v:-1,z[x]===void 0&&(z[x]={hash:x,counter:0}),$=z[x].hash+"_"+z[x].counter,n.geometryGroups[$]===void 0&&(n.geometryGroups[$]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V}),u=w instanceof THREE.Face3?3:4,n.geometryGroups[$].vertices+u>65535&&(z[x].counter+=1,$=z[x].hash+"_"+
|
|
|
|
+z[x].counter,n.geometryGroups[$]===void 0&&(n.geometryGroups[$]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V})),w instanceof THREE.Face3?n.geometryGroups[$].faces3.push(t):n.geometryGroups[$].faces4.push(t),n.geometryGroups[$].vertices+=u;n.geometryGroupsList=[];t=void 0;for(t in n.geometryGroups)n.geometryGroups[t].id=na++,n.geometryGroupsList.push(n.geometryGroups[t])}for(k in l.geometryGroups)if(n=l.geometryGroups[k],!n.__webglVertexBuffer){t=n;t.__webglVertexBuffer=o.createBuffer();
|
|
t.__webglNormalBuffer=o.createBuffer();t.__webglTangentBuffer=o.createBuffer();t.__webglColorBuffer=o.createBuffer();t.__webglUVBuffer=o.createBuffer();t.__webglUV2Buffer=o.createBuffer();t.__webglSkinVertexABuffer=o.createBuffer();t.__webglSkinVertexBBuffer=o.createBuffer();t.__webglSkinIndicesBuffer=o.createBuffer();t.__webglSkinWeightsBuffer=o.createBuffer();t.__webglFaceBuffer=o.createBuffer();t.__webglLineBuffer=o.createBuffer();if(t.numMorphTargets){w=p=void 0;t.__webglMorphTargetsBuffers=[];
|
|
t.__webglNormalBuffer=o.createBuffer();t.__webglTangentBuffer=o.createBuffer();t.__webglColorBuffer=o.createBuffer();t.__webglUVBuffer=o.createBuffer();t.__webglUV2Buffer=o.createBuffer();t.__webglSkinVertexABuffer=o.createBuffer();t.__webglSkinVertexBBuffer=o.createBuffer();t.__webglSkinIndicesBuffer=o.createBuffer();t.__webglSkinWeightsBuffer=o.createBuffer();t.__webglFaceBuffer=o.createBuffer();t.__webglLineBuffer=o.createBuffer();if(t.numMorphTargets){w=p=void 0;t.__webglMorphTargetsBuffers=[];
|
|
p=0;for(w=t.numMorphTargets;p<w;p++)t.__webglMorphTargetsBuffers.push(o.createBuffer())}U.info.memory.geometries++;v=f;u=v.geometry;p=n.faces3;x=n.faces4;t=p.length*3+x.length*4;w=p.length*1+x.length*2;x=p.length*3+x.length*4;p=b(v,n);$=p.map||p.lightMap||p instanceof THREE.ShaderMaterial?!0:!1;z=p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial?!1:p&&p.shading!==void 0&&p.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;V=p.vertexColors?p.vertexColors:
|
|
p=0;for(w=t.numMorphTargets;p<w;p++)t.__webglMorphTargetsBuffers.push(o.createBuffer())}U.info.memory.geometries++;v=f;u=v.geometry;p=n.faces3;x=n.faces4;t=p.length*3+x.length*4;w=p.length*1+x.length*2;x=p.length*3+x.length*4;p=b(v,n);$=p.map||p.lightMap||p instanceof THREE.ShaderMaterial?!0:!1;z=p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial?!1:p&&p.shading!==void 0&&p.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;V=p.vertexColors?p.vertexColors:
|
|
!1;n.__vertexArray=new Float32Array(t*3);if(z)n.__normalArray=new Float32Array(t*3);if(u.hasTangents)n.__tangentArray=new Float32Array(t*4);if(V)n.__colorArray=new Float32Array(t*3);if($){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)n.__uvArray=new Float32Array(t*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(t*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(t*4),n.__skinVertexBArray=new Float32Array(t*4),
|
|
!1;n.__vertexArray=new Float32Array(t*3);if(z)n.__normalArray=new Float32Array(t*3);if(u.hasTangents)n.__tangentArray=new Float32Array(t*4);if(V)n.__colorArray=new Float32Array(t*3);if($){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)n.__uvArray=new Float32Array(t*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(t*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(t*4),n.__skinVertexBArray=new Float32Array(t*4),
|
|
n.__skinIndexArray=new Float32Array(t*4),n.__skinWeightArray=new Float32Array(t*4);n.__faceArray=new Uint16Array(w*3);n.__lineArray=new Uint16Array(x*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];v=0;for(u=n.numMorphTargets;v<u;v++)n.__morphTargetsArrays.push(new Float32Array(t*3))}n.__needsSmoothNormals=z===THREE.SmoothShading;n.__uvType=$;n.__vertexColorType=V;n.__normalType=z;n.__webglFaceCount=w*3;n.__webglLineCount=x*2;if(p.attributes){if(n.__webglCustomAttributesList===void 0)n.__webglCustomAttributesList=
|
|
n.__skinIndexArray=new Float32Array(t*4),n.__skinWeightArray=new Float32Array(t*4);n.__faceArray=new Uint16Array(w*3);n.__lineArray=new Uint16Array(x*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];v=0;for(u=n.numMorphTargets;v<u;v++)n.__morphTargetsArrays.push(new Float32Array(t*3))}n.__needsSmoothNormals=z===THREE.SmoothShading;n.__uvType=$;n.__vertexColorType=V;n.__normalType=z;n.__webglFaceCount=w*3;n.__webglLineCount=x*2;if(p.attributes){if(n.__webglCustomAttributesList===void 0)n.__webglCustomAttributesList=
|
|
-[];w=void 0;for(w in p.attributes){var v=p.attributes[w],u={},B;for(B in v)u[B]=v[B];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,x=1,u.type==="v2"?x=2:u.type==="v3"?x=3:u.type==="v4"?x=4:u.type==="c"&&(x=3),u.size=x,u.array=new Float32Array(t*x),u.buffer=o.createBuffer(),u.buffer.belongsToAttribute=w,v.needsUpdate=!0,u.__original=v;n.__webglCustomAttributesList.push(u)}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=
|
|
|
|
-!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(k=f.geometry,!k.__webglVertexBuffer)n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,n=k,t=n.vertices.length,n.__vertexArray=new Float32Array(t*3),n.__colorArray=new Float32Array(t*3),n.__webglVertexCount=t,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.Line){if(k=f.geometry,!k.__webglVertexBuffer)n=k,n.__webglVertexBuffer=
|
|
|
|
-o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__webglLineCount=p,c(n,t),k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(k=f.geometry,!k.__webglVertexBuffer))n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),
|
|
|
|
-n.__colorArray=new Float32Array(p*3),n.__sortArray=[],n.__webglParticleCount=p,c(n,t),k.__dirtyVertices=!0,k.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(l in k=f.geometry,k.geometryGroups)n=k.geometryGroups[l],R(h.__webglObjects,n,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(k=f.geometry,R(h.__webglObjects,k,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?h.__webglObjectsImmediate.push({object:f,
|
|
|
|
-opaque:null,transparent:null}):f instanceof THREE.Sprite&&h.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];h=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)L(h.__webglObjects,f);else if(f instanceof THREE.Sprite){h=h.__webglSprites;l=f;for(k=h.length-1;k>=0;k--)h[k]===l&&h.splice(k,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&
|
|
|
|
-L(h.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(B=a.__webglObjects[f].object,l=B.geometry,k=w=p=void 0,B instanceof THREE.Mesh){n=0;for(t=l.geometryGroupsList.length;n<t;n++)if(p=l.geometryGroupsList[n],k=b(B,p),w=k.attributes&&C(k),l.__dirtyVertices||l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||w)if(w=o.DYNAMIC_DRAW,v=!l.dynamic,p.__inittedArrays){var ca=
|
|
|
|
|
|
+[];w=void 0;for(w in p.attributes){var v=p.attributes[w],u={},B;for(B in v)u[B]=v[B];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,x=1,u.type==="v2"?x=2:u.type==="v3"?x=3:u.type==="v4"?x=4:u.type==="c"&&(x=3),u.size=x,u.array=new Float32Array(t*x),u.buffer=o.createBuffer(),u.buffer.belongsToAttribute=w,v.needsUpdate=!0,u.__original=v;n.__webglCustomAttributesList.push(u)}}n.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=!0;l.__dirtyElements=!0;l.__dirtyUvs=
|
|
|
|
+!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(l=f.geometry,!l.__webglVertexBuffer)n=l,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,n=l,t=n.vertices.length,n.__vertexArray=new Float32Array(t*3),n.__colorArray=new Float32Array(t*3),n.__webglVertexCount=t,l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(f instanceof THREE.Line){if(l=f.geometry,!l.__webglVertexBuffer)n=l,n.__webglVertexBuffer=
|
|
|
|
+o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,n=l,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__webglLineCount=p,c(n,t),l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(l=f.geometry,!l.__webglVertexBuffer))n=l,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.geometries++,n=l,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),
|
|
|
|
+n.__colorArray=new Float32Array(p*3),n.__sortArray=[],n.__webglParticleCount=p,c(n,t),l.__dirtyVertices=!0,l.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(k in l=f.geometry,l.geometryGroups)n=l.geometryGroups[k],R(h.__webglObjects,n,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(l=f.geometry,R(h.__webglObjects,l,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?h.__webglObjectsImmediate.push({object:f,
|
|
|
|
+opaque:null,transparent:null}):f instanceof THREE.Sprite&&h.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];h=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)L(h.__webglObjects,f);else if(f instanceof THREE.Sprite){h=h.__webglSprites;k=f;for(l=h.length-1;l>=0;l--)h[l]===k&&h.splice(l,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&
|
|
|
|
+L(h.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(B=a.__webglObjects[f].object,k=B.geometry,l=w=p=void 0,B instanceof THREE.Mesh){n=0;for(t=k.geometryGroupsList.length;n<t;n++)if(p=k.geometryGroupsList[n],l=b(B,p),w=l.attributes&&C(l),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||w)if(w=o.DYNAMIC_DRAW,v=!k.dynamic,p.__inittedArrays){var ca=
|
|
x=u=void 0,y=void 0,W=void 0,F=void 0,I=void 0,oa=void 0,J=void 0,X=void 0,K=ca=F=J=void 0,D=void 0,Q=void 0,G=void 0,ga=void 0,M=void 0,N=y=void 0,O=y=J=void 0,ka=void 0,P=y=G=Q=D=ga=G=Q=D=ga=G=Q=D=ga=G=Q=D=I=void 0,ma=void 0,ta=F=void 0,T=ca=void 0,da=void 0,aa=void 0,Y=K=T=ma=0,ea=0,Z=P=ca=0,ia=I=M=0,E=0,S=0,ha=void 0,da=p.__vertexArray,ua=p.__uvArray,E=p.__uv2Array,ta=p.__normalArray,W=p.__tangentArray,N=p.__colorArray,O=p.__skinVertexAArray,ka=p.__skinVertexBArray,oa=p.__skinIndexArray,fa=p.__skinWeightArray,
|
|
x=u=void 0,y=void 0,W=void 0,F=void 0,I=void 0,oa=void 0,J=void 0,X=void 0,K=ca=F=J=void 0,D=void 0,Q=void 0,G=void 0,ga=void 0,M=void 0,N=y=void 0,O=y=J=void 0,ka=void 0,P=y=G=Q=D=ga=G=Q=D=ga=G=Q=D=ga=G=Q=D=I=void 0,ma=void 0,ta=F=void 0,T=ca=void 0,da=void 0,aa=void 0,Y=K=T=ma=0,ea=0,Z=P=ca=0,ia=I=M=0,E=0,S=0,ha=void 0,da=p.__vertexArray,ua=p.__uvArray,E=p.__uv2Array,ta=p.__normalArray,W=p.__tangentArray,N=p.__colorArray,O=p.__skinVertexAArray,ka=p.__skinVertexBArray,oa=p.__skinIndexArray,fa=p.__skinWeightArray,
|
|
la=p.__morphTargetsArrays,$=p.__webglCustomAttributesList,A=void 0,A=p.__faceArray,S=p.__lineArray,wa=p.__needsSmoothNormals,J=p.__vertexColorType,X=p.__uvType,F=p.__normalType,ja=B.geometry,ha=ja.__dirtyElements,pa=ja.__dirtyUvs,sa=ja.__dirtyNormals,ra=ja.__dirtyTangents,Ha=ja.__dirtyColors,aa=ja.__dirtyMorphTargets,Ba=ja.vertices,z=p.faces3,V=p.faces4,qa=ja.faces,Ea=ja.faceVertexUvs[0],Aa=ja.faceVertexUvs[1],xa=ja.skinVerticesA,Fa=ja.skinVerticesB,Ca=ja.skinIndices,ya=ja.skinWeights,Ga=ja.morphTargets;
|
|
la=p.__morphTargetsArrays,$=p.__webglCustomAttributesList,A=void 0,A=p.__faceArray,S=p.__lineArray,wa=p.__needsSmoothNormals,J=p.__vertexColorType,X=p.__uvType,F=p.__normalType,ja=B.geometry,ha=ja.__dirtyElements,pa=ja.__dirtyUvs,sa=ja.__dirtyNormals,ra=ja.__dirtyTangents,Ha=ja.__dirtyColors,aa=ja.__dirtyMorphTargets,Ba=ja.vertices,z=p.faces3,V=p.faces4,qa=ja.faces,Ea=ja.faceVertexUvs[0],Aa=ja.faceVertexUvs[1],xa=ja.skinVerticesA,Fa=ja.skinVerticesB,Ca=ja.skinIndices,ya=ja.skinWeights,Ga=ja.morphTargets;
|
|
if(ja.__dirtyVertices){u=0;for(x=z.length;u<x;u++)y=qa[z[u]],D=Ba[y.a].position,Q=Ba[y.b].position,G=Ba[y.c].position,da[T]=D.x,da[T+1]=D.y,da[T+2]=D.z,da[T+3]=Q.x,da[T+4]=Q.y,da[T+5]=Q.z,da[T+6]=G.x,da[T+7]=G.y,da[T+8]=G.z,T+=9;u=0;for(x=V.length;u<x;u++)y=qa[V[u]],D=Ba[y.a].position,Q=Ba[y.b].position,G=Ba[y.c].position,ga=Ba[y.d].position,da[T]=D.x,da[T+1]=D.y,da[T+2]=D.z,da[T+3]=Q.x,da[T+4]=Q.y,da[T+5]=Q.z,da[T+6]=G.x,da[T+7]=G.y,da[T+8]=G.z,da[T+9]=ga.x,da[T+10]=ga.y,da[T+11]=ga.z,T+=12;o.bindBuffer(o.ARRAY_BUFFER,
|
|
if(ja.__dirtyVertices){u=0;for(x=z.length;u<x;u++)y=qa[z[u]],D=Ba[y.a].position,Q=Ba[y.b].position,G=Ba[y.c].position,da[T]=D.x,da[T+1]=D.y,da[T+2]=D.z,da[T+3]=Q.x,da[T+4]=Q.y,da[T+5]=Q.z,da[T+6]=G.x,da[T+7]=G.y,da[T+8]=G.z,T+=9;u=0;for(x=V.length;u<x;u++)y=qa[V[u]],D=Ba[y.a].position,Q=Ba[y.b].position,G=Ba[y.c].position,ga=Ba[y.d].position,da[T]=D.x,da[T+1]=D.y,da[T+2]=D.z,da[T+3]=Q.x,da[T+4]=Q.y,da[T+5]=Q.z,da[T+6]=G.x,da[T+7]=G.y,da[T+8]=G.z,da[T+9]=ga.x,da[T+10]=ga.y,da[T+11]=ga.z,T+=12;o.bindBuffer(o.ARRAY_BUFFER,
|
|
@@ -343,12 +342,12 @@ E+=12,S+=4}}else if(A.size===4)if(A.boundTo===void 0||A.boundTo==="vertices"){u=
|
|
A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,A.array[E+12]=ga.x,A.array[E+13]=ga.y,A.array[E+14]=ga.z,A.array[E+15]=ga.w,E+=16}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ha=A.value[S],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+
|
|
A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,A.array[E+12]=ga.x,A.array[E+13]=ga.y,A.array[E+14]=ga.z,A.array[E+15]=ga.w,E+=16}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ha=A.value[S],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+
|
|
10]=G.z,A.array[E+11]=G.w,E+=12,S+=1;u=0;for(x=V.length;u<x;u++)ga=G=Q=D=ha=A.value[S],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,A.array[E+12]=ga.x,A.array[E+13]=ga.y,A.array[E+14]=ga.z,A.array[E+15]=ga.w,E+=16,S+=1}else if(A.boundTo==="faceVertices"){u=0;for(x=z.length;u<x;u++)D=A.value[S],Q=A.value[S+1],G=A.value[S+2],A.array[E]=D.x,A.array[E+
|
|
10]=G.z,A.array[E+11]=G.w,E+=12,S+=1;u=0;for(x=V.length;u<x;u++)ga=G=Q=D=ha=A.value[S],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,A.array[E+12]=ga.x,A.array[E+13]=ga.y,A.array[E+14]=ga.z,A.array[E+15]=ga.w,E+=16,S+=1}else if(A.boundTo==="faceVertices"){u=0;for(x=z.length;u<x;u++)D=A.value[S],Q=A.value[S+1],G=A.value[S+2],A.array[E]=D.x,A.array[E+
|
|
1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,E+=12,S+=3;u=0;for(x=V.length;u<x;u++)D=A.value[S],Q=A.value[S+1],G=A.value[S+2],ga=A.value[S+3],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,A.array[E+12]=ga.x,A.array[E+
|
|
1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,E+=12,S+=3;u=0;for(x=V.length;u<x;u++)D=A.value[S],Q=A.value[S+1],G=A.value[S+2],ga=A.value[S+3],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,A.array[E+12]=ga.x,A.array[E+
|
|
-13]=ga.y,A.array[E+14]=ga.z,A.array[E+15]=ga.w,E+=16,S+=4}o.bindBuffer(o.ARRAY_BUFFER,A.buffer);o.bufferData(o.ARRAY_BUFFER,A.array,w)}}v&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}l.__dirtyVertices=!1;l.__dirtyMorphTargets=!1;l.__dirtyElements=
|
|
|
|
-!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=!1;k.attributes&&H(k)}else if(B instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){k=l;B=o.DYNAMIC_DRAW;n=u=v=v=void 0;x=k.vertices;t=k.colors;$=x.length;p=t.length;z=k.__vertexArray;w=k.__colorArray;V=k.__dirtyColors;if(k.__dirtyVertices){for(v=0;v<$;v++)u=x[v].position,n=v*3,z[n]=u.x,z[n+1]=u.y,z[n+2]=u.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,B)}if(V){for(v=0;v<p;v++)color=
|
|
|
|
-t[v],n=v*3,w[n]=color.r,w[n+1]=color.g,w[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,w,B)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(B instanceof THREE.Line){k=b(B,p);w=k.attributes&&C(k);if(l.__dirtyVertices||l.__dirtyColors||w){B=l;n=o.DYNAMIC_DRAW;t=ma=x=qa=void 0;x=B.vertices;p=B.colors;$=x.length;w=p.length;z=B.__vertexArray;v=B.__colorArray;V=B.__dirtyColors;u=B.__webglCustomAttributesList;K=Z=ea=Y=ma=qa=void 0;if(B.__dirtyVertices){for(qa=
|
|
|
|
|
|
+13]=ga.y,A.array[E+14]=ga.z,A.array[E+15]=ga.w,E+=16,S+=4}o.bindBuffer(o.ARRAY_BUFFER,A.buffer);o.bufferData(o.ARRAY_BUFFER,A.array,w)}}v&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=
|
|
|
|
+!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;l.attributes&&H(l)}else if(B instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){l=k;B=o.DYNAMIC_DRAW;n=u=v=v=void 0;x=l.vertices;t=l.colors;$=x.length;p=t.length;z=l.__vertexArray;w=l.__colorArray;V=l.__dirtyColors;if(l.__dirtyVertices){for(v=0;v<$;v++)u=x[v].position,n=v*3,z[n]=u.x,z[n+1]=u.y,z[n+2]=u.z;o.bindBuffer(o.ARRAY_BUFFER,l.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,B)}if(V){for(v=0;v<p;v++)color=
|
|
|
|
+t[v],n=v*3,w[n]=color.r,w[n+1]=color.g,w[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,l.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,w,B)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(B instanceof THREE.Line){l=b(B,p);w=l.attributes&&C(l);if(k.__dirtyVertices||k.__dirtyColors||w){B=k;n=o.DYNAMIC_DRAW;t=ma=x=qa=void 0;x=B.vertices;p=B.colors;$=x.length;w=p.length;z=B.__vertexArray;v=B.__colorArray;V=B.__dirtyColors;u=B.__webglCustomAttributesList;K=Z=ea=Y=ma=qa=void 0;if(B.__dirtyVertices){for(qa=
|
|
0;qa<$;qa++)ma=x[qa].position,t=qa*3,z[t]=ma.x,z[t+1]=ma.y,z[t+2]=ma.z;o.bindBuffer(o.ARRAY_BUFFER,B.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,n)}if(V){for(x=0;x<w;x++)color=p[x],t=x*3,v[t]=color.r,v[t+1]=color.g,v[t+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,B.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,v,n)}if(u){qa=0;for(ma=u.length;qa<ma;qa++)if(K=u[qa],K.__original.needsUpdate&&(K.boundTo===void 0||K.boundTo==="vertices")){t=0;ea=K.value.length;for(Y=0;Y<ea;Y++)K.size===1?K.array[t]=
|
|
0;qa<$;qa++)ma=x[qa].position,t=qa*3,z[t]=ma.x,z[t+1]=ma.y,z[t+2]=ma.z;o.bindBuffer(o.ARRAY_BUFFER,B.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,n)}if(V){for(x=0;x<w;x++)color=p[x],t=x*3,v[t]=color.r,v[t+1]=color.g,v[t+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,B.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,v,n)}if(u){qa=0;for(ma=u.length;qa<ma;qa++)if(K=u[qa],K.__original.needsUpdate&&(K.boundTo===void 0||K.boundTo==="vertices")){t=0;ea=K.value.length;for(Y=0;Y<ea;Y++)K.size===1?K.array[t]=
|
|
-K.value[Y]:(Z=K.value[Y],K.size===2?(K.array[t]=Z.x,K.array[t+1]=Z.y):K.size===3?K.type==="c"?(K.array[t]=Z.r,K.array[t+1]=Z.g,K.array[t+2]=Z.b):(K.array[t]=Z.x,K.array[t+1]=Z.y,K.array[t+2]=Z.z):(K.array[t]=Z.x,K.array[t+1]=Z.y,K.array[t+2]=Z.z,K.array[t+3]=Z.w)),t+=K.size;o.bindBuffer(o.ARRAY_BUFFER,K.buffer);o.bufferData(o.ARRAY_BUFFER,K.array,n)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;k.attributes&&H(k)}else if(B instanceof THREE.ParticleSystem)k=b(B,p),w=k.attributes&&C(k),(l.__dirtyVertices||
|
|
|
|
-l.__dirtyColors||B.sortParticles||w)&&e(l,o.DYNAMIC_DRAW,B),l.__dirtyVertices=!1,l.__dirtyColors=!1,k.attributes&&H(k)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ca}};
|
|
|
|
|
|
+K.value[Y]:(Z=K.value[Y],K.size===2?(K.array[t]=Z.x,K.array[t+1]=Z.y):K.size===3?K.type==="c"?(K.array[t]=Z.r,K.array[t+1]=Z.g,K.array[t+2]=Z.b):(K.array[t]=Z.x,K.array[t+1]=Z.y,K.array[t+2]=Z.z):(K.array[t]=Z.x,K.array[t+1]=Z.y,K.array[t+2]=Z.z,K.array[t+3]=Z.w)),t+=K.size;o.bindBuffer(o.ARRAY_BUFFER,K.buffer);o.bufferData(o.ARRAY_BUFFER,K.array,n)}}}k.__dirtyVertices=!1;k.__dirtyColors=!1;l.attributes&&H(l)}else if(B instanceof THREE.ParticleSystem)l=b(B,p),w=l.attributes&&C(l),(k.__dirtyVertices||
|
|
|
|
+k.__dirtyColors||B.sortParticles||w)&&e(k,o.DYNAMIC_DRAW,B),k.__dirtyVertices=!1,k.__dirtyColors=!1,l.attributes&&H(l)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ca}};
|
|
THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
|
|
THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
|
|
THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
|
|
THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0};
|
|
@@ -356,21 +355,21 @@ THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRen
|
|
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.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
|
|
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.faceMaterial=this.material=null;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.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=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.faceMaterial=this.material=null;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.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
-THREE.ColorUtils={adjustHSV:function(a,c,b,e){var l=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,l);l.h=THREE.Math.clamp(l.h+c,0,1);l.s=THREE.Math.clamp(l.s+b,0,1);l.v=THREE.Math.clamp(l.v+e,0,1);a.setHSV(l.h,l.s,l.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,l=a.b,f=Math.max(Math.max(b,e),l),h=Math.min(Math.min(b,e),l);if(h===f)h=b=0;else{var k=f-h,h=k/f,b=b===f?(e-l)/k:e===f?2+(l-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=h;c.v=f;return c}};
|
|
|
|
|
|
+THREE.ColorUtils={adjustHSV:function(a,c,b,e){var k=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,k);k.h=THREE.Math.clamp(k.h+c,0,1);k.s=THREE.Math.clamp(k.s+b,0,1);k.v=THREE.Math.clamp(k.v+e,0,1);a.setHSV(k.h,k.s,k.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,k=a.b,f=Math.max(Math.max(b,e),k),h=Math.min(Math.min(b,e),k);if(h===f)h=b=0;else{var l=f-h,h=l/f,b=b===f?(e-k)/l:e===f?2+(k-b)/l:4+(b-e)/l;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=h;c.v=f;return c}};
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
-THREE.GeometryUtils={merge:function(a,c){for(var b,e,l=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,h=a.vertices,k=f.vertices,n=a.faces,t=f.faces,v=a.faceVertexUvs[0],p=f.faceVertexUvs[0],x={},w=0;w<a.materials.length;w++)x[a.materials[w].id]=w;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var w=0,z=k.length;w<z;w++){var u=new THREE.Vertex(k[w].position.clone());b&&b.multiplyVector3(u.position);h.push(u)}w=
|
|
|
|
-0;for(z=t.length;w<z;w++){var h=t[w],B,y,F=h.vertexNormals,C=h.vertexColors;h instanceof THREE.Face3?B=new THREE.Face3(h.a+l,h.b+l,h.c+l):h instanceof THREE.Face4&&(B=new THREE.Face4(h.a+l,h.b+l,h.c+l,h.d+l));B.normal.copy(h.normal);e&&e.multiplyVector3(B.normal);k=0;for(u=F.length;k<u;k++)y=F[k].clone(),e&&e.multiplyVector3(y),B.vertexNormals.push(y);B.color.copy(h.color);k=0;for(u=C.length;k<u;k++)y=C[k],B.vertexColors.push(y.clone());if(h.materialIndex!==void 0){k=f.materials[h.materialIndex];
|
|
|
|
-u=x[k.id];if(u===void 0)u=a.materials.length,a.materials.push(k);B.materialIndex=u}B.centroid.copy(h.centroid);b&&b.multiplyVector3(B.centroid);n.push(B)}w=0;for(z=p.length;w<z;w++){b=p[w];e=[];k=0;for(u=b.length;k<u;k++)e.push(new THREE.UV(b[k].u,b[k].v));v.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,l=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var h=new THREE.Vertex(e[a].position.clone());c.vertices.push(h)}a=0;
|
|
|
|
-for(b=l.length;a<b;a++){var k=l[a],n,t,v=k.vertexNormals,p=k.vertexColors;k instanceof THREE.Face3?n=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(n=new THREE.Face4(k.a,k.b,k.c,k.d));n.normal.copy(k.normal);e=0;for(h=v.length;e<h;e++)t=v[e],n.vertexNormals.push(t.clone());n.color.copy(k.color);e=0;for(h=p.length;e<h;e++)t=p[e],n.vertexColors.push(t.clone());n.materialIndex=k.materialIndex;n.centroid.copy(k.centroid);c.faces.push(n)}a=0;for(b=f.length;a<b;a++){l=f[a];n=[];e=0;for(h=l.length;e<
|
|
|
|
-h;e++)n.push(new THREE.UV(l[e].u,l[e].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(a,c,b){var e,l,f,h=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();l=THREE.GeometryUtils.random();e+l>1&&(e=1-e,l=1-l);f=1-e-l;h.copy(a);h.multiplyScalar(e);k.copy(c);k.multiplyScalar(l);h.addSelf(k);k.copy(b);k.multiplyScalar(f);h.addSelf(k);return h},randomPointInFace:function(a,c,b){var e,l,f;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,l=c.vertices[a.b].position,
|
|
|
|
-f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,l,f);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;l=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,h;b?a._area1&&a._area2?(b=a._area1,h=a._area2):(b=THREE.GeometryUtils.triangleArea(e,l,c),h=THREE.GeometryUtils.triangleArea(l,f,c),a._area1=b,a._area2=h):(b=THREE.GeometryUtils.triangleArea(e,l,c),h=THREE.GeometryUtils.triangleArea(l,f,c));return THREE.GeometryUtils.random()*(b+
|
|
|
|
-h)<b?THREE.GeometryUtils.randomPointInTriangle(e,l,c):THREE.GeometryUtils.randomPointInTriangle(l,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var f=c+Math.floor((e-c)/2);return t[f]>a?b(c,f-1):t[f]<a?b(f+1,e):f}return b(0,t.length-1)}var e,l,f=a.faces,h=a.vertices,k=f.length,n=0,t=[],v,p,x,w;for(l=0;l<k;l++){e=f[l];if(e instanceof THREE.Face3)v=h[e.a].position,p=h[e.b].position,x=h[e.c].position,e._area=THREE.GeometryUtils.triangleArea(v,p,x);else if(e instanceof
|
|
|
|
-THREE.Face4)v=h[e.a].position,p=h[e.b].position,x=h[e.c].position,w=h[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(v,p,w),e._area2=THREE.GeometryUtils.triangleArea(p,x,w),e._area=e._area1+e._area2;n+=e._area;t[l]=n}e=[];h={};for(l=0;l<c;l++)k=THREE.GeometryUtils.random()*n,k=b(k),e[l]=THREE.GeometryUtils.randomPointInFace(f[k],a,!0),h[k]?h[k]+=1:h[k]=1;return e},triangleArea:function(a,c,b){var e,l=THREE.GeometryUtils.__v1;l.sub(a,c);e=l.length();l.sub(a,b);a=l.length();l.sub(c,b);b=l.length();
|
|
|
|
|
|
+THREE.GeometryUtils={merge:function(a,c){for(var b,e,k=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,h=a.vertices,l=f.vertices,n=a.faces,t=f.faces,v=a.faceVertexUvs[0],p=f.faceVertexUvs[0],x={},w=0;w<a.materials.length;w++)x[a.materials[w].id]=w;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var w=0,z=l.length;w<z;w++){var u=new THREE.Vertex(l[w].position.clone());b&&b.multiplyVector3(u.position);h.push(u)}w=
|
|
|
|
+0;for(z=t.length;w<z;w++){var h=t[w],B,y,F=h.vertexNormals,C=h.vertexColors;h instanceof THREE.Face3?B=new THREE.Face3(h.a+k,h.b+k,h.c+k):h instanceof THREE.Face4&&(B=new THREE.Face4(h.a+k,h.b+k,h.c+k,h.d+k));B.normal.copy(h.normal);e&&e.multiplyVector3(B.normal);l=0;for(u=F.length;l<u;l++)y=F[l].clone(),e&&e.multiplyVector3(y),B.vertexNormals.push(y);B.color.copy(h.color);l=0;for(u=C.length;l<u;l++)y=C[l],B.vertexColors.push(y.clone());if(h.materialIndex!==void 0){l=f.materials[h.materialIndex];
|
|
|
|
+u=x[l.id];if(u===void 0)u=a.materials.length,a.materials.push(l);B.materialIndex=u}B.centroid.copy(h.centroid);b&&b.multiplyVector3(B.centroid);n.push(B)}w=0;for(z=p.length;w<z;w++){b=p[w];e=[];l=0;for(u=b.length;l<u;l++)e.push(new THREE.UV(b[l].u,b[l].v));v.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,k=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var h=new THREE.Vertex(e[a].position.clone());c.vertices.push(h)}a=0;
|
|
|
|
+for(b=k.length;a<b;a++){var l=k[a],n,t,v=l.vertexNormals,p=l.vertexColors;l instanceof THREE.Face3?n=new THREE.Face3(l.a,l.b,l.c):l instanceof THREE.Face4&&(n=new THREE.Face4(l.a,l.b,l.c,l.d));n.normal.copy(l.normal);e=0;for(h=v.length;e<h;e++)t=v[e],n.vertexNormals.push(t.clone());n.color.copy(l.color);e=0;for(h=p.length;e<h;e++)t=p[e],n.vertexColors.push(t.clone());n.materialIndex=l.materialIndex;n.centroid.copy(l.centroid);c.faces.push(n)}a=0;for(b=f.length;a<b;a++){k=f[a];n=[];e=0;for(h=k.length;e<
|
|
|
|
+h;e++)n.push(new THREE.UV(k[e].u,k[e].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(a,c,b){var e,k,f,h=new THREE.Vector3,l=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();k=THREE.GeometryUtils.random();e+k>1&&(e=1-e,k=1-k);f=1-e-k;h.copy(a);h.multiplyScalar(e);l.copy(c);l.multiplyScalar(k);h.addSelf(l);l.copy(b);l.multiplyScalar(f);h.addSelf(l);return h},randomPointInFace:function(a,c,b){var e,k,f;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,k=c.vertices[a.b].position,
|
|
|
|
+f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,k,f);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;k=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,h;b?a._area1&&a._area2?(b=a._area1,h=a._area2):(b=THREE.GeometryUtils.triangleArea(e,k,c),h=THREE.GeometryUtils.triangleArea(k,f,c),a._area1=b,a._area2=h):(b=THREE.GeometryUtils.triangleArea(e,k,c),h=THREE.GeometryUtils.triangleArea(k,f,c));return THREE.GeometryUtils.random()*(b+
|
|
|
|
+h)<b?THREE.GeometryUtils.randomPointInTriangle(e,k,c):THREE.GeometryUtils.randomPointInTriangle(k,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var f=c+Math.floor((e-c)/2);return t[f]>a?b(c,f-1):t[f]<a?b(f+1,e):f}return b(0,t.length-1)}var e,k,f=a.faces,h=a.vertices,l=f.length,n=0,t=[],v,p,x,w;for(k=0;k<l;k++){e=f[k];if(e instanceof THREE.Face3)v=h[e.a].position,p=h[e.b].position,x=h[e.c].position,e._area=THREE.GeometryUtils.triangleArea(v,p,x);else if(e instanceof
|
|
|
|
+THREE.Face4)v=h[e.a].position,p=h[e.b].position,x=h[e.c].position,w=h[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(v,p,w),e._area2=THREE.GeometryUtils.triangleArea(p,x,w),e._area=e._area1+e._area2;n+=e._area;t[k]=n}e=[];h={};for(k=0;k<c;k++)l=THREE.GeometryUtils.random()*n,l=b(l),e[k]=THREE.GeometryUtils.randomPointInFace(f[l],a,!0),h[l]?h[l]+=1:h[l]=1;return e},triangleArea:function(a,c,b){var e,k=THREE.GeometryUtils.__v1;k.sub(a,c);e=k.length();k.sub(a,b);a=k.length();k.sub(c,b);b=k.length();
|
|
c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
-THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,l=new THREE.Texture(e,c);e.onload=function(){l.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return l},loadTextureCube:function(a,c,b){var e,l=[],f=new THREE.Texture(l,c),c=l.loadCount=0;for(e=a.length;c<e;++c)l[c]=new Image,l[c].onload=function(){l.loadCount+=1;if(l.loadCount===6)f.needsUpdate=!0;b&&b(this)},l[c].crossOrigin="",l[c].src=a[c];return f},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
|
|
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,l=a.height,f=document.createElement("canvas");f.width=e;f.height=l;var h=f.getContext("2d");h.drawImage(a,0,0);for(var k=h.getImageData(0,0,e,l).data,n=h.createImageData(e,l),t=n.data,v=0;v<e;v++)for(var p=1;p<l;p++){var x=p-1<0?l-1:p-1,w=(p+1)%l,z=v-1<0?e-1:v-1,u=(v+1)%e,B=[],y=[0,0,k[(p*e+v)*4]/255*c];B.push([-1,0,k[(p*e+z)*4]/255*c]);B.push([-1,-1,k[(x*e+z)*4]/255*c]);B.push([0,-1,k[(x*e+v)*4]/255*c]);B.push([1,-1,k[(x*e+u)*4]/255*c]);
|
|
|
|
-B.push([1,0,k[(p*e+u)*4]/255*c]);B.push([1,1,k[(w*e+u)*4]/255*c]);B.push([0,1,k[(w*e+v)*4]/255*c]);B.push([-1,1,k[(w*e+z)*4]/255*c]);x=[];z=B.length;for(w=0;w<z;w++){var u=B[w],F=B[(w+1)%z],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]],F=[F[0]-y[0],F[1]-y[1],F[2]-y[2]];x.push(b([u[1]*F[2]-u[2]*F[1],u[2]*F[0]-u[0]*F[2],u[0]*F[1]-u[1]*F[0]]))}B=[0,0,0];for(w=0;w<x.length;w++)B[0]+=x[w][0],B[1]+=x[w][1],B[2]+=x[w][2];B[0]/=x.length;B[1]/=x.length;B[2]/=x.length;y=(p*e+v)*4;t[y]=(B[0]+1)/2*255|0;t[y+1]=(B[1]+0.5)*
|
|
|
|
-255|0;t[y+2]=B[2]*255|0;t[y+3]=255}h.putImageData(n,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,l=a.children.length;for(e=0;e<l;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,l=new THREE.Object3D;for(b=0;b<e;b++){var f=new THREE.Mesh(a,c[b]);l.add(f)}return l}};
|
|
|
|
|
|
+THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,k=new THREE.Texture(e,c);e.onload=function(){k.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return k},loadTextureCube:function(a,c,b){var e,k=[],f=new THREE.Texture(k,c),c=k.loadCount=0;for(e=a.length;c<e;++c)k[c]=new Image,k[c].onload=function(){k.loadCount+=1;if(k.loadCount===6)f.needsUpdate=!0;b&&b(this)},k[c].crossOrigin="",k[c].src=a[c];return f},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
|
|
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,k=a.height,f=document.createElement("canvas");f.width=e;f.height=k;var h=f.getContext("2d");h.drawImage(a,0,0);for(var l=h.getImageData(0,0,e,k).data,n=h.createImageData(e,k),t=n.data,v=0;v<e;v++)for(var p=1;p<k;p++){var x=p-1<0?k-1:p-1,w=(p+1)%k,z=v-1<0?e-1:v-1,u=(v+1)%e,B=[],y=[0,0,l[(p*e+v)*4]/255*c];B.push([-1,0,l[(p*e+z)*4]/255*c]);B.push([-1,-1,l[(x*e+z)*4]/255*c]);B.push([0,-1,l[(x*e+v)*4]/255*c]);B.push([1,-1,l[(x*e+u)*4]/255*c]);
|
|
|
|
+B.push([1,0,l[(p*e+u)*4]/255*c]);B.push([1,1,l[(w*e+u)*4]/255*c]);B.push([0,1,l[(w*e+v)*4]/255*c]);B.push([-1,1,l[(w*e+z)*4]/255*c]);x=[];z=B.length;for(w=0;w<z;w++){var u=B[w],F=B[(w+1)%z],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]],F=[F[0]-y[0],F[1]-y[1],F[2]-y[2]];x.push(b([u[1]*F[2]-u[2]*F[1],u[2]*F[0]-u[0]*F[2],u[0]*F[1]-u[1]*F[0]]))}B=[0,0,0];for(w=0;w<x.length;w++)B[0]+=x[w][0],B[1]+=x[w][1],B[2]+=x[w][2];B[0]/=x.length;B[1]/=x.length;B[2]/=x.length;y=(p*e+v)*4;t[y]=(B[0]+1)/2*255|0;t[y+1]=(B[1]+0.5)*
|
|
|
|
+255|0;t[y+2]=B[2]*255|0;t[y+3]=255}h.putImageData(n,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,k=a.children.length;for(e=0;e<k;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,k=new THREE.Object3D;for(b=0;b<e;b++){var f=new THREE.Mesh(a,c[b]);k.add(f)}return k}};
|
|
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}",
|
|
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}"},
|
|
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,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
|
|
@@ -380,74 +379,74 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\
|
|
THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
|
|
THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
|
|
THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};
|
|
THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};
|
|
-THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,e=this.getPoint(0),l,f=0;c.push(0);for(l=1;l<=a;l++)b=this.getPoint(l/a),f+=b.distanceTo(e),c.push(f),e=b;return this.cacheArcLengths=c};
|
|
|
|
-THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),e=0,l=b.length,f;f=c?c:a*b[l-1];time=Date.now();for(var h=0,k=l-1,n;h<=k;)if(e=Math.floor(h+(k-h)/2),n=b[e]-f,n<0)h=e+1;else if(n>0)k=e-1;else{k=e;break}e=k;if(b[e]==f)return e/(l-1);h=b[e];return b=(e+(f-h)/(b[e+1]-h))/(l-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
|
|
|
|
+THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,e=this.getPoint(0),k,f=0;c.push(0);for(k=1;k<=a;k++)b=this.getPoint(k/a),f+=b.distanceTo(e),c.push(f),e=b;return this.cacheArcLengths=c};
|
|
|
|
+THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),e=0,k=b.length,f;f=c?c:a*b[k-1];time=Date.now();for(var h=0,l=k-1,n;h<=l;)if(e=Math.floor(h+(l-h)/2),n=b[e]-f,n<0)h=e+1;else if(n>0)l=e-1;else{l=e;break}e=l;if(b[e]==f)return e/(k-1);h=b[e];return b=(e+(f-h)/(b[e+1]-h))/(k-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,e){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,e))};THREE.LineCurve.prototype=new THREE.Curve;
|
|
THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,e){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,e))};THREE.LineCurve.prototype=new THREE.Curve;
|
|
THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
|
|
THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
|
|
THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),c=new THREE.Vector2(e[2],e[3]),b=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
|
|
THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),c=new THREE.Vector2(e[2],e[3]),b=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
|
|
THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c};
|
|
THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c};
|
|
-THREE.CubicBezierCurve=function(a,c,b,e){if(!(c instanceof THREE.Vector2))var l=Array.prototype.slice.call(arguments),a=new THREE.Vector2(l[0],l[1]),c=new THREE.Vector2(l[2],l[3]),b=new THREE.Vector2(l[4],l[5]),e=new THREE.Vector2(l[6],l[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
|
|
|
|
|
|
+THREE.CubicBezierCurve=function(a,c,b,e){if(!(c instanceof THREE.Vector2))var k=Array.prototype.slice.call(arguments),a=new THREE.Vector2(k[0],k[1]),c=new THREE.Vector2(k[2],k[3]),b=new THREE.Vector2(k[4],k[5]),e=new THREE.Vector2(k[6],k[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
|
|
THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c};
|
|
THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c};
|
|
THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
|
|
THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
|
|
-THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],e=this.points,l;l=(e.length-1)*a;a=Math.floor(l);l-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,l);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,l);return c};THREE.ArcCurve=function(a,c,b,e,l,f){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=e;this.aEndAngle=l;this.aClockwise=f};
|
|
|
|
|
|
+THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],e=this.points,k;k=(e.length-1)*a;a=Math.floor(k);k-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,k);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,k);return c};THREE.ArcCurve=function(a,c,b,e,k,f){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=e;this.aEndAngle=k;this.aClockwise=f};
|
|
THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
|
|
THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
|
|
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,e){return 2*(1-a)*(b-c)+2*a*(e-b)},tangentCubicBezier:function(a,c,b,e,l){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*l},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,e,l){var a=(b-a)*0.5,e=(e-c)*0.5,f=l*l;return(2*c-2*b+a+e)*l*f+(-3*c+3*b-2*a-e)*f+a*l+c}};
|
|
|
|
|
|
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,e){return 2*(1-a)*(b-c)+2*a*(e-b)},tangentCubicBezier:function(a,c,b,e,k){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*k},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,e,k){var a=(b-a)*0.5,e=(e-c)*0.5,f=k*k;return(2*c-2*b+a+e)*k*f+(-3*c+3*b-2*a-e)*f+a*k+c}};
|
|
THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
|
|
THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
|
|
THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b){this.v0=a;this.v1=c;this.v2=b},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,b,a)});
|
|
THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b){this.v0=a;this.v1=c;this.v2=b},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,b,a)});
|
|
THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,e){this.v0=a;this.v1=c;this.v2=b;this.v3=e},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
|
|
THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,e){this.v0=a;this.v1=c;this.v2=b;this.v3=e},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
|
|
-THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],e=this.points,l;l=(e.length-1)*a;a=Math.floor(l);l-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,l);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,l);c.z=THREE.Curve.Utils.interpolate(e[b[0]].z,e[b[1]].z,e[b[2]].z,e[b[3]].z,l);return c});
|
|
|
|
|
|
+THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],e=this.points,k;k=(e.length-1)*a;a=Math.floor(k);k-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,k);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,k);c.z=THREE.Curve.Utils.interpolate(e[b[0]].z,e[b[1]].z,e[b[2]].z,e[b[3]].z,k);return c});
|
|
THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
|
|
THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
|
|
THREE.CurvePath.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.getCurveLengths(),a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
|
|
THREE.CurvePath.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.getCurveLengths(),a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,e=this.curves.length;for(b=0;b<e;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,e=this.curves.length;for(b=0;b<e;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,e,l;c=b=Number.NEGATIVE_INFINITY;e=l=Number.POSITIVE_INFINITY;var f,h,k,n;n=new THREE.Vector2;h=0;for(k=a.length;h<k;h++){f=a[h];if(f.x>c)c=f.x;else if(f.x<e)e=f.x;if(f.y>b)b=f.y;else if(f.y<b)l=f.y;n.addSelf(f.x,f.y)}return{minX:e,minY:l,maxX:c,maxY:b,centroid:n.divideScalar(k)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
|
|
|
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,e,k;c=b=Number.NEGATIVE_INFINITY;e=k=Number.POSITIVE_INFINITY;var f,h,l,n;n=new THREE.Vector2;h=0;for(l=a.length;h<l;h++){f=a[h];if(f.x>c)c=f.x;else if(f.x<e)e=f.x;if(f.y>b)b=f.y;else if(f.y<b)k=f.y;n.addSelf(f.x,f.y)}return{minX:e,minY:k,maxX:c,maxY:b,centroid:n.divideScalar(l)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
|
|
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
|
|
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
|
|
-THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),e,l;if(!c)c=this.bends;e=0;for(l=c.length;e<l;e++)b=this.getWrapPoints(b,c[e]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),e,l;if(!c)c=this.bends;e=0;for(l=c.length;e<l;e++)b=this.getWrapPoints(b,c[e]);return b};
|
|
|
|
-THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),e,l,f,h,k,n;e=0;for(l=a.length;e<l;e++)f=a[e],h=f.x,k=f.y,n=h/b.maxX,n=c.getUtoTmapping(n,h),h=c.getPoint(n),k=c.getNormalVector(n).multiplyScalar(k),f.x=h.x+k.x,f.y=h.y+k.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
|
|
|
|
+THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),e,k;if(!c)c=this.bends;e=0;for(k=c.length;e<k;e++)b=this.getWrapPoints(b,c[e]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),e,k;if(!c)c=this.bends;e=0;for(k=c.length;e<k;e++)b=this.getWrapPoints(b,c[e]);return b};
|
|
|
|
+THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),e,k,f,h,l,n;e=0;for(k=a.length;e<k;e++)f=a[e],h=f.x,l=f.y,n=h/b.maxX,n=c.getUtoTmapping(n,h),h=c.getPoint(n),l=c.getNormalVector(n).multiplyScalar(l),f.x=h.x+l.x,f.y=h.y+l.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
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(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
|
|
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(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
|
|
THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
|
|
THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
|
|
-THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var l=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:l})};
|
|
|
|
-THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,l,f){var h=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(l,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:h})};
|
|
|
|
|
|
+THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var k=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:k})};
|
|
|
|
+THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,k,f){var h=Array.prototype.slice.call(arguments),l=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(l[l.length-2],l[l.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(k,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:h})};
|
|
THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
|
|
THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
|
|
-THREE.Path.prototype.arc=function(a,c,b,e,l,f){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,l,f));this.actions.push({action:THREE.PathActions.ARC,args:h})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
|
|
|
|
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,l,f,h,k,n,t,v,p,x,w,z,u;e=0;for(l=this.actions.length;e<l;e++)switch(f=this.actions[e],h=f.action,f=f.args,h){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=f[2];n=f[3];p=f[0];x=f[1];b.length>0?(h=b[b.length-1],w=h.x,z=h.y):(h=this.actions[e-1].args,w=h[h.length-2],z=h[h.length-1]);for(h=1;h<=a;h++)u=h/a,f=THREE.Shape.Utils.b2(u,w,p,k),u=THREE.Shape.Utils.b2(u,z,x,
|
|
|
|
-n),b.push(new THREE.Vector2(f,u));break;case THREE.PathActions.BEZIER_CURVE_TO:k=f[4];n=f[5];p=f[0];x=f[1];t=f[2];v=f[3];b.length>0?(h=b[b.length-1],w=h.x,z=h.y):(h=this.actions[e-1].args,w=h[h.length-2],z=h[h.length-1]);for(h=1;h<=a;h++)u=h/a,f=THREE.Shape.Utils.b3(u,w,p,t,k),u=THREE.Shape.Utils.b3(u,z,x,v,n),b.push(new THREE.Vector2(f,u));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];u=a*f[0].length;h=h.concat(f[0]);f=new THREE.SplineCurve(h);
|
|
|
|
-for(h=1;h<=u;h++)b.push(f.getPointAt(h/u));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;k=f[0];n=f[1];t=f[2];p=f[3];u=f[4];x=!!f[5];v=h[h.length-2];w=h[h.length-1];h.length==0&&(v=w=0);z=u-p;var B=a*2;for(h=1;h<=B;h++)u=h/B,x||(u=1-u),u=p+u*z,f=v+k+t*Math.cos(u),u=w+n+t*Math.sin(u),b.push(new THREE.Vector2(f,u))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
|
|
|
|
-THREE.Path.prototype.nltransform=function(a,c,b,e,l,f){var h=this.getPoints(),k,n,t,v,p;k=0;for(n=h.length;k<n;k++)t=h[k],v=t.x,p=t.y,t.x=a*v+c*p+b,t.y=e*p+l*v+f;return h};
|
|
|
|
-THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,l,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],l=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,l);c.stroke();c.closePath();c.strokeStyle="red";e=
|
|
|
|
-this.getPoints();a=0;for(b=e.length;a<b;a++)l=e[a],c.beginPath(),c.arc(l.x,l.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
|
|
-THREE.Path.prototype.toShapes=function(){var a,c,b,e,l=[],f=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&f.actions.length!=0&&(l.push(f),f=new THREE.Path),f[b].apply(f,e);f.actions.length!=0&&l.push(f);if(l.length==0)return[];var h,f=[];if(THREE.Shape.Utils.isClockWise(l[0].getPoints())){a=0;for(c=l.length;a<c;a++)e=l[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(h&&f.push(h),h=new THREE.Shape,h.actions=e.actions,h.curves=
|
|
|
|
-e.curves):h.holes.push(e);f.push(h)}else{h=new THREE.Shape;a=0;for(c=l.length;a<c;a++)e=l[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(h.actions=e.actions,h.curves=e.curves,f.push(h),h=new THREE.Shape):h.holes.push(e)}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(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
|
|
|
|
+THREE.Path.prototype.arc=function(a,c,b,e,k,f){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,k,f));this.actions.push({action:THREE.PathActions.ARC,args:h})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
|
|
|
|
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,k,f,h,l,n,t,v,p,x,w,z,u;e=0;for(k=this.actions.length;e<k;e++)switch(f=this.actions[e],h=f.action,f=f.args,h){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:l=f[2];n=f[3];p=f[0];x=f[1];b.length>0?(h=b[b.length-1],w=h.x,z=h.y):(h=this.actions[e-1].args,w=h[h.length-2],z=h[h.length-1]);for(h=1;h<=a;h++)u=h/a,f=THREE.Shape.Utils.b2(u,w,p,l),u=THREE.Shape.Utils.b2(u,z,x,
|
|
|
|
+n),b.push(new THREE.Vector2(f,u));break;case THREE.PathActions.BEZIER_CURVE_TO:l=f[4];n=f[5];p=f[0];x=f[1];t=f[2];v=f[3];b.length>0?(h=b[b.length-1],w=h.x,z=h.y):(h=this.actions[e-1].args,w=h[h.length-2],z=h[h.length-1]);for(h=1;h<=a;h++)u=h/a,f=THREE.Shape.Utils.b3(u,w,p,t,l),u=THREE.Shape.Utils.b3(u,z,x,v,n),b.push(new THREE.Vector2(f,u));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];u=a*f[0].length;h=h.concat(f[0]);f=new THREE.SplineCurve(h);
|
|
|
|
+for(h=1;h<=u;h++)b.push(f.getPointAt(h/u));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;l=f[0];n=f[1];t=f[2];p=f[3];u=f[4];x=!!f[5];v=h[h.length-2];w=h[h.length-1];h.length==0&&(v=w=0);z=u-p;var B=a*2;for(h=1;h<=B;h++)u=h/B,x||(u=1-u),u=p+u*z,f=v+l+t*Math.cos(u),u=w+n+t*Math.sin(u),b.push(new THREE.Vector2(f,u))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
|
|
|
|
+THREE.Path.prototype.nltransform=function(a,c,b,e,k,f){var h=this.getPoints(),l,n,t,v,p;l=0;for(n=h.length;l<n;l++)t=h[l],v=t.x,p=t.y,t.x=a*v+c*p+b,t.y=e*p+k*v+f;return h};
|
|
|
|
+THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,k,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],k=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,k);c.stroke();c.closePath();c.strokeStyle="red";e=
|
|
|
|
+this.getPoints();a=0;for(b=e.length;a<b;a++)k=e[a],c.beginPath(),c.arc(k.x,k.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
|
|
+THREE.Path.prototype.toShapes=function(){var a,c,b,e,k=[],f=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&f.actions.length!=0&&(k.push(f),f=new THREE.Path),f[b].apply(f,e);f.actions.length!=0&&k.push(f);if(k.length==0)return[];var h,f=[];if(THREE.Shape.Utils.isClockWise(k[0].getPoints())){a=0;for(c=k.length;a<c;a++)e=k[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(h&&f.push(h),h=new THREE.Shape,h.actions=e.actions,h.curves=
|
|
|
|
+e.curves):h.holes.push(e);f.push(h)}else{h=new THREE.Shape;a=0;for(c=k.length;a<c;a++)e=k[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(h.actions=e.actions,h.curves=e.curves,f.push(h),h=new THREE.Shape):h.holes.push(e)}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(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),l,f,h,k,n,t,v,p,x,w,z=[];for(n=0;n<c.length;n++){t=c[n];Array.prototype.push.apply(e,t);f=Number.POSITIVE_INFINITY;for(l=0;l<t.length;l++){x=t[l];w=[];for(p=0;p<b.length;p++)v=b[p],v=x.distanceToSquared(v),w.push(v),v<f&&(f=v,h=l,k=p)}l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;var u=[t[h],b[k],b[l]];p=THREE.FontUtils.Triangulate.area(u);var B=[t[h],t[f],b[k]];x=THREE.FontUtils.Triangulate.area(B);w=k;v=h;k+=1;h+=-1;k<
|
|
|
|
-0&&(k+=b.length);k%=b.length;h<0&&(h+=t.length);h%=t.length;l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;u=[t[h],b[k],b[l]];u=THREE.FontUtils.Triangulate.area(u);B=[t[h],t[f],b[k]];B=THREE.FontUtils.Triangulate.area(B);p+x>u+B&&(k=w,h=v,k<0&&(k+=b.length),k%=b.length,h<0&&(h+=t.length),h%=t.length,l=k-1>=0?k-1:b.length-1,f=h-1>=0?h-1:t.length-1);p=b.slice(0,k);x=b.slice(k);w=t.slice(h);v=t.slice(0,h);f=[t[h],t[f],b[k]];z.push([t[h],b[k],b[l]]);z.push(f);b=p.concat(w).concat(v).concat(x)}return{shape:b,
|
|
|
|
-isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,l=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,h,k,n,t={};f=0;for(h=e.length;f<h;f++)n=e[f].x+":"+e[f].y,t[n]!==void 0&&console.log("Duplicate point",n),t[n]=f;f=0;for(h=b.length;f<h;f++){k=b[f];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=t[n],n!==void 0&&(k[e]=n)}f=0;for(h=l.length;f<h;f++){k=l[f];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=t[n],n!==void 0&&(k[e]=n)}return b.concat(l)},
|
|
|
|
-isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,l){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
|
|
|
|
-this.b3p3(a,l)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",l=c.weight!==void 0?c.weight:"normal",f=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=l;THREE.FontUtils.style=f};
|
|
|
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),k,f,h,l,n,t,v,p,x,w,z=[];for(n=0;n<c.length;n++){t=c[n];Array.prototype.push.apply(e,t);f=Number.POSITIVE_INFINITY;for(k=0;k<t.length;k++){x=t[k];w=[];for(p=0;p<b.length;p++)v=b[p],v=x.distanceToSquared(v),w.push(v),v<f&&(f=v,h=k,l=p)}k=l-1>=0?l-1:b.length-1;f=h-1>=0?h-1:t.length-1;var u=[t[h],b[l],b[k]];p=THREE.FontUtils.Triangulate.area(u);var B=[t[h],t[f],b[l]];x=THREE.FontUtils.Triangulate.area(B);w=l;v=h;l+=1;h+=-1;l<
|
|
|
|
+0&&(l+=b.length);l%=b.length;h<0&&(h+=t.length);h%=t.length;k=l-1>=0?l-1:b.length-1;f=h-1>=0?h-1:t.length-1;u=[t[h],b[l],b[k]];u=THREE.FontUtils.Triangulate.area(u);B=[t[h],t[f],b[l]];B=THREE.FontUtils.Triangulate.area(B);p+x>u+B&&(l=w,h=v,l<0&&(l+=b.length),l%=b.length,h<0&&(h+=t.length),h%=t.length,k=l-1>=0?l-1:b.length-1,f=h-1>=0?h-1:t.length-1);p=b.slice(0,l);x=b.slice(l);w=t.slice(h);v=t.slice(0,h);f=[t[h],t[f],b[l]];z.push([t[h],b[l],b[k]]);z.push(f);b=p.concat(w).concat(v).concat(x)}return{shape:b,
|
|
|
|
+isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,k=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,h,l,n,t={};f=0;for(h=e.length;f<h;f++)n=e[f].x+":"+e[f].y,t[n]!==void 0&&console.log("Duplicate point",n),t[n]=f;f=0;for(h=b.length;f<h;f++){l=b[f];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=t[n],n!==void 0&&(l[e]=n)}f=0;for(h=k.length;f<h;f++){l=k[f];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=t[n],n!==void 0&&(l[e]=n)}return b.concat(k)},
|
|
|
|
+isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,k){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
|
|
|
|
+this.b3p3(a,k)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",k=c.weight!==void 0?c.weight:"normal",f=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=k;THREE.FontUtils.style=f};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
|
|
THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
|
|
THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
|
|
-0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++){var t=a.hierarchy[b].keys[e].morphTargets[n];k[t]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var v=
|
|
|
|
-{};for(t in k){for(n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++)if(a.hierarchy[b].keys[e].morphTargets[n]===t){v[t]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(v[t]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=v}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
|
|
|
|
|
|
+0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var l=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(l[0],l[1],l[2],l[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){l={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++){var t=a.hierarchy[b].keys[e].morphTargets[n];l[t]=-1}a.hierarchy[b].usedMorphTargets=l;for(e=0;e<a.hierarchy[b].keys.length;e++){var v=
|
|
|
|
+{};for(t in l){for(n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++)if(a.hierarchy[b].keys[e].morphTargets[n]===t){v[t]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(v[t]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=v}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
|
|
2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
|
|
2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
|
|
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,l;for(b=0;b<e;b++){l=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)l.useQuaternion=!0;l.matrixAutoUpdate=!0;if(l.animationCache===void 0)l.animationCache={},l.animationCache.prevKey={pos:0,rot:0,scl:0},l.animationCache.nextKey={pos:0,rot:0,scl:0},l.animationCache.originalMatrix=l instanceof
|
|
|
|
-THREE.Bone?l.skinMatrix:l.matrix;var f=l.animationCache.prevKey;l=l.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];l.pos=this.getNextKeyWith("pos",b,1);l.rot=this.getNextKeyWith("rot",b,1);l.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
|
|
|
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,k;for(b=0;b<e;b++){k=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)k.useQuaternion=!0;k.matrixAutoUpdate=!0;if(k.animationCache===void 0)k.animationCache={},k.animationCache.prevKey={pos:0,rot:0,scl:0},k.animationCache.nextKey={pos:0,rot:0,scl:0},k.animationCache.originalMatrix=k instanceof
|
|
|
|
+THREE.Bone?k.skinMatrix:k.matrix;var f=k.animationCache.prevKey;k=k.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];k.pos=this.getNextKeyWith("pos",b,1);k.rot=this.getNextKeyWith("rot",b,1);k.scl=this.getNextKeyWith("scl",b,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.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 a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,l,f,h,k,n,t,v=this.data.JIT.hierarchy,p,x;this.currentTime+=a*this.timeScale;x=this.currentTime;p=this.currentTime%=this.data.length;t=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,z=this.hierarchy.length;w<z;w++)if(a=this.hierarchy[w],n=a.animationCache,this.JITCompile&&v[w][t]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=v[w][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
|
-!1):(a.matrix=v[w][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var u=0;u<3;u++){b=c[u];h=n.prevKey[b];k=n.nextKey[b];if(k.time<=x){if(p<x)if(this.loop){h=this.data.hierarchy[w].keys[0];for(k=this.getNextKeyWith(b,w,1);k.time<p;)h=k,k=this.getNextKeyWith(b,w,k.index+1)}else{this.stop();return}else{do h=k,k=this.getNextKeyWith(b,w,k.index+1);while(k.time<
|
|
|
|
-p)}n.prevKey[b]=h;n.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(p-h.time)/(k.time-h.time);l=h[b];f=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+w),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=l[0]+(f[0]-l[0])*e,b.y=l[1]+(f[1]-l[1])*e,b.z=l[2]+(f[2]-l[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
|
-this.getPrevKeyWith("pos",w,h.index-1).pos,this.points[1]=l,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",w,k.index+1).pos,e=e*0.33+0.33,l=this.interpolateCatmullRom(this.points,e),b.x=l[0],b.y=l[1],b.z=l[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
|
|
|
|
-"rot")THREE.Quaternion.slerp(l,f,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=l[0]+(f[0]-l[0])*e,b.y=l[1]+(f[1]-l[1])*e,b.z=l[2]+(f[2]-l[2])*e}}if(this.JITCompile&&v[0][t]===void 0){this.hierarchy[0].update(null,!0);for(w=0;w<this.hierarchy.length;w++)v[w][t]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
|
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],l,f,h,k,n,t;l=(a.length-1)*c;f=Math.floor(l);l-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];k=a[b[1]];n=a[b[2]];t=a[b[3]];b=l*l;h=l*b;e[0]=this.interpolate(f[0],k[0],n[0],t[0],l,b,h);e[1]=this.interpolate(f[1],k[1],n[1],t[1],l,b,h);e[2]=this.interpolate(f[2],k[2],n[2],t[2],l,b,h);return e};
|
|
|
|
-THREE.Animation.prototype.interpolate=function(a,c,b,e,l,f,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*f+a*l+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,k,f,h,l,n,t,v=this.data.JIT.hierarchy,p,x;this.currentTime+=a*this.timeScale;x=this.currentTime;p=this.currentTime%=this.data.length;t=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,z=this.hierarchy.length;w<z;w++)if(a=this.hierarchy[w],n=a.animationCache,this.JITCompile&&v[w][t]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=v[w][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
|
+!1):(a.matrix=v[w][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var u=0;u<3;u++){b=c[u];h=n.prevKey[b];l=n.nextKey[b];if(l.time<=x){if(p<x)if(this.loop){h=this.data.hierarchy[w].keys[0];for(l=this.getNextKeyWith(b,w,1);l.time<p;)h=l,l=this.getNextKeyWith(b,w,l.index+1)}else{this.stop();return}else{do h=l,l=this.getNextKeyWith(b,w,l.index+1);while(l.time<
|
|
|
|
+p)}n.prevKey[b]=h;n.nextKey[b]=l}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(p-h.time)/(l.time-h.time);k=h[b];f=l[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+w),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=k[0]+(f[0]-k[0])*e,b.y=k[1]+(f[1]-k[1])*e,b.z=k[2]+(f[2]-k[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
|
+this.getPrevKeyWith("pos",w,h.index-1).pos,this.points[1]=k,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",w,l.index+1).pos,e=e*0.33+0.33,k=this.interpolateCatmullRom(this.points,e),b.x=k[0],b.y=k[1],b.z=k[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
|
|
|
|
+"rot")THREE.Quaternion.slerp(k,f,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=k[0]+(f[0]-k[0])*e,b.y=k[1]+(f[1]-k[1])*e,b.z=k[2]+(f[2]-k[2])*e}}if(this.JITCompile&&v[0][t]===void 0){this.hierarchy[0].update(null,!0);for(w=0;w<this.hierarchy.length;w++)v[w][t]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
|
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],k,f,h,l,n,t;k=(a.length-1)*c;f=Math.floor(k);k-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];l=a[b[1]];n=a[b[2]];t=a[b[3]];b=k*k;h=k*b;e[0]=this.interpolate(f[0],l[0],n[0],t[0],k,b,h);e[1]=this.interpolate(f[1],l[1],n[1],t[1],k,b,h);e[2]=this.interpolate(f[2],l[2],n[2],t[2],k,b,h);return e};
|
|
|
|
+THREE.Animation.prototype.interpolate=function(a,c,b,e,k,f,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*f+a*k+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
|
|
THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
|
|
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
|
|
new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
|
|
new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
|
|
1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var c=this.renderTarget;c.activeCubeFace=0;a.render(b,this.cameraPX,c);c.activeCubeFace=1;a.render(b,this.cameraNX,c);c.activeCubeFace=2;a.render(b,this.cameraPY,c);c.activeCubeFace=3;a.render(b,
|
|
1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var c=this.renderTarget;c.activeCubeFace=0;a.render(b,this.cameraPX,c);c.activeCubeFace=1;a.render(b,this.cameraNX,c);c.activeCubeFace=2;a.render(b,this.cameraPY,c);c.activeCubeFace=3;a.render(b,
|
|
this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
|
|
this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
|
|
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,l,f,h){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,f,h);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,l);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
|
|
|
|
|
|
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,k,f,h){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,f,h);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,k);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
|
|
THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
|
|
THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
|
|
THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
|
|
THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
|
|
THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
|
|
THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
|
|
@@ -461,14 +460,14 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
|
|
(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
|
|
this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
|
|
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function l(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,l=b.getControlPointsArray(),k=b.getLength(),B=l.length,y=0;h=B-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:l[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:l[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<B-1;h++)y=e*k.chunks[h]/k.total,b.keys[h]={time:y,pos:l[h]};f.hierarchy[0]=
|
|
|
|
|
|
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function k(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,k=b.getControlPointsArray(),l=b.getLength(),B=k.length,y=0;h=B-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:k[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<B-1;h++)y=e*l.chunks[h]/l.total,b.keys[h]={time:y,pos:k[h]};f.hierarchy[0]=
|
|
b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;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,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
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,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
-this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var h=Math.PI*2,k=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);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)*k;this.theta=this.lon*k;a=this.phi%h;this.phi=a>=0?a:a+h;c=this.verticalAngleMap.srcRange;
|
|
|
|
|
|
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var h=Math.PI*2,l=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);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)*l;this.theta=this.lon*l;a=this.phi%h;this.phi=a>=0?a:a+h;c=this.verticalAngleMap.srcRange;
|
|
a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var e=a[1]-a[0];this.phi=b((c-a[0])/e)*e+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);e=a[1]-a[0];this.theta=b((c-a[0])/e)*e+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
|
|
a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var e=a[1]-a[0];this.phi=b((c-a[0])/e)*e+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);e=a[1]-a[0];this.theta=b((c-a[0])/e)*e+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
|
|
function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
-c=new THREE.CubeGeometry(10,10,20),h=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(h,b);a.position.set(0,10,0);this.animation=l(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=l(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
|
|
-this.debugPath,b=this.spline,c=f(b,10),h=f(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);h=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(h,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
|
|
|
|
|
|
+c=new THREE.CubeGeometry(10,10,20),h=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(h,b);a.position.set(0,10,0);this.animation=k(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=k(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
|
|
+this.debugPath,b=this.spline,c=f(b,10),h=f(b,10),l=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,l);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);h=new THREE.SphereGeometry(1,16,8);l=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(h,l),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
|
|
e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
|
|
e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
|
|
THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;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,
|
|
THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;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.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.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=
|
|
0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.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=
|
|
@@ -479,94 +478,94 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=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=-a+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.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=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=-a+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",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
|
|
-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",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Matrix4,h=!1,k=1,n=0,t=0,v=0,p=0,x=0,w=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
|
-this.rotateHorizontally(c*p);this.rotateVertically(c*x)}c=a*this.movementSpeed;this.object.translateZ(-c*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*t);this.object.translateY(c*v);h&&(this.roll+=this.rollSpeed*a*k);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();l.copy(this.forward);e.set(0,1,0);b.cross(e,
|
|
|
|
-l).normalize();e.cross(l,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=l.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=l.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=l.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
|
|
|
|
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,k=new THREE.Vector3,f=new THREE.Matrix4,h=!1,l=1,n=0,t=0,v=0,p=0,x=0,w=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
|
+this.rotateHorizontally(c*p);this.rotateVertically(c*x)}c=a*this.movementSpeed;this.object.translateZ(-c*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*t);this.object.translateY(c*v);h&&(this.roll+=this.rollSpeed*a*l);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();k.copy(this.forward);e.set(0,1,0);b.cross(e,
|
|
|
|
+k).normalize();e.cross(k,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=k.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=k.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=k.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-w)/window.innerWidth;x=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",
|
|
function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-w)/window.innerWidth;x=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",
|
|
-function(a){switch(a.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:h=!0;k=1;break;case 69:h=!0;k=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.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:h=!1;break;case 69:h=!1;break;case 82:v=0;break;case 70:v=0}},!1)};
|
|
|
|
|
|
+function(a){switch(a.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:h=!0;l=1;break;case 69:h=!0;l=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.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:h=!1;break;case 69:h=!1;break;case 82:v=0;break;case 70:v=0}},!1)};
|
|
THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
|
|
THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
|
|
-new THREE.Vector3(0,0,0);var l=!1,f=e.NONE,h=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector2,v=new THREE.Vector2,p=new THREE.Vector2,x=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
|
|
|
|
-b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);h.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(e.y);f.addSelf(b.object.up.clone().crossSelf(h).setLength(e.x));f.addSelf(h.setLength(e.z));return f};this.rotateCamera=function(){var a=Math.acos(k.dot(n)/k.length()/n.length());if(a){var c=(new THREE.Vector3).cross(k,n).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(h);
|
|
|
|
-e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?k=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(v.y-t.y)*b.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),b.staticMoving?t=v:t.y+=(v.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=x.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(h.length()*b.panSpeed);var c=h.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
|
|
|
|
|
|
+new THREE.Vector3(0,0,0);var k=!1,f=e.NONE,h=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector2,v=new THREE.Vector2,p=new THREE.Vector2,x=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
|
|
|
|
+b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);h.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(e.y);f.addSelf(b.object.up.clone().crossSelf(h).setLength(e.x));f.addSelf(h.setLength(e.z));return f};this.rotateCamera=function(){var a=Math.acos(l.dot(n)/l.length()/n.length());if(a){var c=(new THREE.Vector3).cross(l,n).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(h);
|
|
|
|
+e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?l=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(l))}};this.zoomCamera=function(){var a=1+(v.y-t.y)*b.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),b.staticMoving?t=v:t.y+=(v.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=x.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(h.length()*b.panSpeed);var c=h.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
|
|
b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=x:p.addSelf(a.sub(x,p).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),h.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,h.setLength(b.minDistance))};this.update=function(){h.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
|
|
b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=x:p.addSelf(a.sub(x,p).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),h.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,h.setLength(b.minDistance))};this.update=function(){h.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
|
|
-b.panCamera();b.object.position.add(b.target,h);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(l&&(k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),t=v=b.getMouseOnScreen(a.clientX,a.clientY),p=x=b.getMouseOnScreen(a.clientX,a.clientY),l=!1),f!==e.NONE&&(f===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?v=b.getMouseOnScreen(a.clientX,
|
|
|
|
-a.clientY):f===e.PAN&&!b.noPan&&(x=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===e.NONE))f=a.button,f===e.ROTATE?k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?t=v=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=x=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
|
|
-f=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===e.NONE){if(a.keyCode===b.keys[e.ROTATE])f=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)f=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)f=e.PAN;f!==e.NONE&&(l=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==e.NONE)f=e.NONE},!1)};
|
|
|
|
-THREE.CubeGeometry=function(a,c,b,e,l,f,h,k){function n(a,b,c,h,k,n,p,u){var v,w,x=e||1,y=l||1,z=k/2,o=n/2,B=t.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",y=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",x=f||1;var C=x+1,G=y+1;k/=x;var F=n/y;for(w=0;w<G;w++)for(n=0;n<C;n++){var aa=new THREE.Vector3;aa[a]=(n*k-z)*c;aa[b]=(w*F-o)*h;aa[v]=p;t.vertices.push(new THREE.Vertex(aa))}for(w=0;w<y;w++)for(n=0;n<x;n++)t.faces.push(new THREE.Face4(n+
|
|
|
|
-C*w+B,n+C*(w+1)+B,n+1+C*(w+1)+B,n+1+C*w+B,null,null,u)),t.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var t=this,v=a/2,p=c/2,x=b/2,w,z,u,B,y,F;if(h!==void 0){if(h instanceof Array)this.materials=h;else{this.materials=[];for(w=0;w<6;w++)this.materials.push(h)}w=0;B=1;z=2;y=3;u=4;F=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var C in k)this.sides[C]!=
|
|
|
|
-void 0&&(this.sides[C]=k[C]);this.sides.px&&n("z","y",-1,-1,b,c,v,w);this.sides.nx&&n("z","y",1,-1,b,c,-v,B);this.sides.py&&n("x","z",1,1,a,b,p,z);this.sides.ny&&n("x","z",1,-1,a,b,-p,y);this.sides.pz&&n("x","y",1,-1,a,c,x,u);this.sides.nz&&n("x","y",-1,-1,a,c,-x,F);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
|
-THREE.CylinderGeometry=function(a,c,b,e,l,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,h=b/2,e=e||8,l=l||1,k,n,t=[],v=[];for(n=0;n<=l;n++){var p=[],x=[],w=n/l,z=w*(c-a)+a;for(k=0;k<=e;k++){var u=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(u*Math.PI*2),-w*b+h,z*Math.cos(u*Math.PI*2))));p.push(this.vertices.length-1);x.push(new THREE.UV(u,w))}t.push(p);v.push(x)}for(n=0;n<l;n++)for(k=0;k<e;k++){var b=t[n][k],p=t[n+1][k],x=t[n+1][k+1],w=t[n][k+1],z=
|
|
|
|
-this.vertices[b].position.clone().setY(0).normalize(),u=this.vertices[p].position.clone().setY(0).normalize(),B=this.vertices[x].position.clone().setY(0).normalize(),y=this.vertices[w].position.clone().setY(0).normalize(),F=v[n][k].clone(),C=v[n+1][k].clone(),H=v[n+1][k+1].clone(),L=v[n][k+1].clone();this.faces.push(new THREE.Face4(b,p,x,w,[z,u,B,y]));this.faceVertexUvs[0].push([F,C,H,L])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,h,0)));for(k=0;k<e;k++)b=t[0][k],p=t[0][k+
|
|
|
|
-1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),B=new THREE.Vector3(0,1,0),F=v[0][k].clone(),C=v[0][k+1].clone(),H=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(b,p,x,[z,u,B])),this.faceVertexUvs[0].push([F,C,H])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-h,0)));for(k=0;k<e;k++)b=t[n][k+1],p=t[n][k],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),B=new THREE.Vector3(0,-1,0),F=v[n][k+1].clone(),C=v[n][k].clone(),
|
|
|
|
|
|
+b.panCamera();b.object.position.add(b.target,h);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(k&&(l=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),t=v=b.getMouseOnScreen(a.clientX,a.clientY),p=x=b.getMouseOnScreen(a.clientX,a.clientY),k=!1),f!==e.NONE&&(f===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?v=b.getMouseOnScreen(a.clientX,
|
|
|
|
+a.clientY):f===e.PAN&&!b.noPan&&(x=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===e.NONE))f=a.button,f===e.ROTATE?l=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?t=v=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=x=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
|
|
+f=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===e.NONE){if(a.keyCode===b.keys[e.ROTATE])f=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)f=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)f=e.PAN;f!==e.NONE&&(k=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==e.NONE)f=e.NONE},!1)};
|
|
|
|
+THREE.CubeGeometry=function(a,c,b,e,k,f,h,l){function n(a,b,c,h,l,n,p,u){var v,w,x=e||1,y=k||1,z=l/2,o=n/2,B=t.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",y=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",x=f||1;var C=x+1,G=y+1;l/=x;var F=n/y;for(w=0;w<G;w++)for(n=0;n<C;n++){var aa=new THREE.Vector3;aa[a]=(n*l-z)*c;aa[b]=(w*F-o)*h;aa[v]=p;t.vertices.push(new THREE.Vertex(aa))}for(w=0;w<y;w++)for(n=0;n<x;n++)t.faces.push(new THREE.Face4(n+
|
|
|
|
+C*w+B,n+C*(w+1)+B,n+1+C*(w+1)+B,n+1+C*w+B,null,null,u)),t.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var t=this,v=a/2,p=c/2,x=b/2,w,z,u,B,y,F;if(h!==void 0){if(h instanceof Array)this.materials=h;else{this.materials=[];for(w=0;w<6;w++)this.materials.push(h)}w=0;B=1;z=2;y=3;u=4;F=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var C in l)this.sides[C]!=
|
|
|
|
+void 0&&(this.sides[C]=l[C]);this.sides.px&&n("z","y",-1,-1,b,c,v,w);this.sides.nx&&n("z","y",1,-1,b,c,-v,B);this.sides.py&&n("x","z",1,1,a,b,p,z);this.sides.ny&&n("x","z",1,-1,a,b,-p,y);this.sides.pz&&n("x","y",1,-1,a,c,x,u);this.sides.nz&&n("x","y",-1,-1,a,c,-x,F);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
|
+THREE.CylinderGeometry=function(a,c,b,e,k,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,h=b/2,e=e||8,k=k||1,l,n,t=[],v=[];for(n=0;n<=k;n++){var p=[],x=[],w=n/k,z=w*(c-a)+a;for(l=0;l<=e;l++){var u=l/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(u*Math.PI*2),-w*b+h,z*Math.cos(u*Math.PI*2))));p.push(this.vertices.length-1);x.push(new THREE.UV(u,w))}t.push(p);v.push(x)}for(n=0;n<k;n++)for(l=0;l<e;l++){var b=t[n][l],p=t[n+1][l],x=t[n+1][l+1],w=t[n][l+1],z=
|
|
|
|
+this.vertices[b].position.clone().setY(0).normalize(),u=this.vertices[p].position.clone().setY(0).normalize(),B=this.vertices[x].position.clone().setY(0).normalize(),y=this.vertices[w].position.clone().setY(0).normalize(),F=v[n][l].clone(),C=v[n+1][l].clone(),H=v[n+1][l+1].clone(),L=v[n][l+1].clone();this.faces.push(new THREE.Face4(b,p,x,w,[z,u,B,y]));this.faceVertexUvs[0].push([F,C,H,L])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,h,0)));for(l=0;l<e;l++)b=t[0][l],p=t[0][l+
|
|
|
|
+1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),B=new THREE.Vector3(0,1,0),F=v[0][l].clone(),C=v[0][l+1].clone(),H=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(b,p,x,[z,u,B])),this.faceVertexUvs[0].push([F,C,H])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-h,0)));for(l=0;l<e;l++)b=t[n][l+1],p=t[n][l],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),B=new THREE.Vector3(0,-1,0),F=v[n][l+1].clone(),C=v[n][l].clone(),
|
|
H=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(b,p,x,[z,u,B])),this.faceVertexUvs[0].push([F,C,H])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
H=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(b,p,x,[z,u,B])),this.faceVertexUvs[0].push([F,C,H])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
-THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,l;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)l=a[b],this.addShape(l,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
|
|
|
+THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,k;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)k=a[b],this.addShape(k,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,k=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);k.set(f.y,-f.x);l.copy(a).addSelf(h);n.copy(a).addSelf(k);if(l.equals(n))return k.clone();
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,k=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);k.set(f.y,-f.x);l.copy(a).addSelf(h);n.copy(a).addSelf(k);if(l.equals(n))return k.clone();
|
|
-l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0&&(console.log("Either infinite or no solutions!"),k===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));k/=h;if(k<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function l(a){for(J=a.length;--J>=0;){na=J;la=J-1;la<0&&(la=a.length-
|
|
|
|
-1);for(var b=0,c=w+v*2,b=0;b<c;b++){var e=o*b,f=o*(b+1),h=ra+na+e,l=ra+na+f,p=h,e=ra+la+e,f=ra+la+f,t=l;p+=N;e+=N;f+=N;t+=N;K.faces.push(new THREE.Face4(p,e,f,t,null,null,H));H&&(p=b/c,e=(b+1)/c,f=k+n*2,h=(K.vertices[h].position.z+n)/f,l=(K.vertices[l].position.z+n)/f,K.faceVertexUvs[0].push([new THREE.UV(h,p),new THREE.UV(l,p),new THREE.UV(l,e),new THREE.UV(h,e)]))}}}function f(a,b,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function h(a,b,c){a+=N;b+=N;c+=N;K.faces.push(new THREE.Face3(a,
|
|
|
|
-b,c,null,null,C));if(C){var e=L.maxY,f=L.maxX,h=K.vertices[b].position.x,b=K.vertices[b].position.y,k=K.vertices[c].position.x,c=K.vertices[c].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[a].position.x/f,K.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:n-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
|
|
|
+l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0&&(console.log("Either infinite or no solutions!"),k===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));k/=h;if(k<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function k(a){for(J=a.length;--J>=0;){na=J;la=J-1;la<0&&(la=a.length-
|
|
|
|
+1);for(var b=0,c=w+v*2,b=0;b<c;b++){var e=o*b,f=o*(b+1),h=ra+na+e,k=ra+na+f,p=h,e=ra+la+e,f=ra+la+f,t=k;p+=N;e+=N;f+=N;t+=N;K.faces.push(new THREE.Face4(p,e,f,t,null,null,H));H&&(p=b/c,e=(b+1)/c,f=l+n*2,h=(K.vertices[h].position.z+n)/f,k=(K.vertices[k].position.z+n)/f,K.faceVertexUvs[0].push([new THREE.UV(h,p),new THREE.UV(k,p),new THREE.UV(k,e),new THREE.UV(h,e)]))}}}function f(a,b,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function h(a,b,c){a+=N;b+=N;c+=N;K.faces.push(new THREE.Face3(a,
|
|
|
|
+b,c,null,null,C));if(C){var e=L.maxY,f=L.maxX,h=K.vertices[b].position.x,b=K.vertices[b].position.y,k=K.vertices[c].position.x,c=K.vertices[c].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[a].position.x/f,K.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var l=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:n-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,z=c.bendPath,u=c.extrudePath,B,y=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,C=c.material,H=c.extrudeMaterial,L=this.shapebb;if(u)B=u.getPoints(x),w=B.length,y=!0,p=!1;p||(t=n=v=0);var R,D,O,K=this,N=this.vertices.length;z&&a.addWrapPath(z);x=F?a.extractAllSpacedPoints(x):a.extractAllPoints(x);z=x.shape;x=x.holes;if(u=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();D=0;for(O=x.length;D<O;D++)R=x[D],THREE.Shape.Utils.isClockWise(R)&&
|
|
!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,z=c.bendPath,u=c.extrudePath,B,y=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,C=c.material,H=c.extrudeMaterial,L=this.shapebb;if(u)B=u.getPoints(x),w=B.length,y=!0,p=!1;p||(t=n=v=0);var R,D,O,K=this,N=this.vertices.length;z&&a.addWrapPath(z);x=F?a.extractAllSpacedPoints(x):a.extractAllPoints(x);z=x.shape;x=x.holes;if(u=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();D=0;for(O=x.length;D<O;D++)R=x[D],THREE.Shape.Utils.isClockWise(R)&&
|
|
(x[D]=R.reverse());u=!1}u=THREE.Shape.Utils.triangulateShape(z,x);F=z;D=0;for(O=x.length;D<O;D++)R=x[D],z=z.concat(R);var J,M,ea,ja,Z,U,o=z.length,P=u.length,pa=[];J=0;M=F.length;na=M-1;for(la=J+1;J<M;J++,na++,la++)na===M&&(na=0),la===M&&(la=0),pa[J]=e(F[J],F[na],F[la]);var G=[],X,aa=pa.concat();D=0;for(O=x.length;D<O;D++){R=x[D];X=[];J=0;M=R.length;na=M-1;for(la=J+1;J<M;J++,na++,la++)na===M&&(na=0),la===M&&(la=0),X[J]=e(R[J],R[na],R[la]);G.push(X);aa=aa.concat(X)}for(ea=0;ea<v;ea++){ja=ea/v;Z=n*
|
|
(x[D]=R.reverse());u=!1}u=THREE.Shape.Utils.triangulateShape(z,x);F=z;D=0;for(O=x.length;D<O;D++)R=x[D],z=z.concat(R);var J,M,ea,ja,Z,U,o=z.length,P=u.length,pa=[];J=0;M=F.length;na=M-1;for(la=J+1;J<M;J++,na++,la++)na===M&&(na=0),la===M&&(la=0),pa[J]=e(F[J],F[na],F[la]);var G=[],X,aa=pa.concat();D=0;for(O=x.length;D<O;D++){R=x[D];X=[];J=0;M=R.length;na=M-1;for(la=J+1;J<M;J++,na++,la++)na===M&&(na=0),la===M&&(la=0),X[J]=e(R[J],R[na],R[la]);G.push(X);aa=aa.concat(X)}for(ea=0;ea<v;ea++){ja=ea/v;Z=n*
|
|
-(1-ja);ja=t*Math.sin(ja*Math.PI/2);J=0;for(M=F.length;J<M;J++)U=b(F[J],pa[J],ja),f(U.x,U.y,-Z);D=0;for(O=x.length;D<O;D++){R=x[D];X=G[D];J=0;for(M=R.length;J<M;J++)U=b(R[J],X[J],ja),f(U.x,U.y,-Z)}}ja=t;for(J=0;J<o;J++)U=p?b(z[J],aa[J],ja):z[J],y?f(U.x,U.y+B[0].y,B[0].x):f(U.x,U.y,0);for(ea=1;ea<=w;ea++)for(J=0;J<o;J++)U=p?b(z[J],aa[J],ja):z[J],y?f(U.x,U.y+B[ea-1].y,B[ea-1].x):f(U.x,U.y,k/w*ea);for(ea=v-1;ea>=0;ea--){ja=ea/v;Z=n*(1-ja);ja=t*Math.sin(ja*Math.PI/2);J=0;for(M=F.length;J<M;J++)U=b(F[J],
|
|
|
|
-pa[J],ja),f(U.x,U.y,k+Z);D=0;for(O=x.length;D<O;D++){R=x[D];X=G[D];J=0;for(M=R.length;J<M;J++)U=b(R[J],X[J],ja),y?f(U.x,U.y+B[w-1].y,B[w-1].x+Z):f(U.x,U.y,k+Z)}}if(p){p=o*0;for(J=0;J<P;J++)t=u[J],h(t[2]+p,t[1]+p,t[0]+p);p=o*(w+v*2);for(J=0;J<P;J++)t=u[J],h(t[0]+p,t[1]+p,t[2]+p)}else{for(J=0;J<P;J++)t=u[J],h(t[2],t[1],t[0]);for(J=0;J<P;J++)t=u[J],h(t[0]+o*w,t[1]+o*w,t[2]+o*w)}var na,la,ra=0;l(F);ra+=F.length;D=0;for(O=x.length;D<O;D++)R=x[D],l(R),ra+=R.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
|
|
|
+(1-ja);ja=t*Math.sin(ja*Math.PI/2);J=0;for(M=F.length;J<M;J++)U=b(F[J],pa[J],ja),f(U.x,U.y,-Z);D=0;for(O=x.length;D<O;D++){R=x[D];X=G[D];J=0;for(M=R.length;J<M;J++)U=b(R[J],X[J],ja),f(U.x,U.y,-Z)}}ja=t;for(J=0;J<o;J++)U=p?b(z[J],aa[J],ja):z[J],y?f(U.x,U.y+B[0].y,B[0].x):f(U.x,U.y,0);for(ea=1;ea<=w;ea++)for(J=0;J<o;J++)U=p?b(z[J],aa[J],ja):z[J],y?f(U.x,U.y+B[ea-1].y,B[ea-1].x):f(U.x,U.y,l/w*ea);for(ea=v-1;ea>=0;ea--){ja=ea/v;Z=n*(1-ja);ja=t*Math.sin(ja*Math.PI/2);J=0;for(M=F.length;J<M;J++)U=b(F[J],
|
|
|
|
+pa[J],ja),f(U.x,U.y,l+Z);D=0;for(O=x.length;D<O;D++){R=x[D];X=G[D];J=0;for(M=R.length;J<M;J++)U=b(R[J],X[J],ja),y?f(U.x,U.y+B[w-1].y,B[w-1].x+Z):f(U.x,U.y,l+Z)}}if(p){p=o*0;for(J=0;J<P;J++)t=u[J],h(t[2]+p,t[1]+p,t[0]+p);p=o*(w+v*2);for(J=0;J<P;J++)t=u[J],h(t[0]+p,t[1]+p,t[2]+p)}else{for(J=0;J<P;J++)t=u[J],h(t[2],t[1],t[0]);for(J=0;J<P;J++)t=u[J],h(t[0]+o*w,t[1]+o*w,t[2]+o*w)}var na,la,ra=0;k(F);ra+=F.length;D=0;for(O=x.length;D<O;D++)R=x[D],k(R),ra+=R.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
-THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return l.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=l.vertices[a].position,f=l.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var l=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
|
|
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var h=0;h<this.subdivisions;h++){var a=new THREE.Geometry,k;for(k in f.faces){var n=e(f.faces[k].a,f.faces[k].b),t=e(f.faces[k].b,f.faces[k].c),v=e(f.faces[k].c,f.faces[k].a);b(f.faces[k].a,n,v,a);b(f.faces[k].b,t,
|
|
|
|
-n,a);b(f.faces[k].c,v,t,a);b(n,t,v,a)}f.faces=a.faces}l.faces=f.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
|
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],l=[],f=[],h=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(k=0;k<b.length;k++)n<this.angle?(b[k]=h.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),l[k]=this.vertices.length-1):l=f;n==0&&(f=e);
|
|
|
|
-for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(l[k],l[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,k/a.length),new THREE.UV(1-n/this.angle,(k+1)/a.length),new THREE.UV(1-(n-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(n-c)/this.angle,k/a.length)]);e=l;l=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
|
-THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=h.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
|
|
|
|
-h.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),h.faceVertexUvs[0].push([f(a.uv,a.position,k),f(b.uv,b.position,k),f(c.uv,c.position,k)])):(k-=1,e(a,l(a,b),l(a,c),k),e(l(a,b),b,l(b,c),k),e(l(a,c),l(b,c),c,k),e(l(a,b),l(b,c),l(a,c),k))}function l(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function f(a,b,c){c<0&&a.u===
|
|
|
|
-1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,h=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var k=[],n=this.vertices;e(n[0],n[2],n[4],c);e(n[0],n[4],n[3],c);e(n[0],n[3],n[5],c);e(n[0],n[5],n[2],c);e(n[1],n[2],n[5],c);e(n[1],n[5],n[3],c);e(n[1],n[3],n[4],c);e(n[1],n[4],n[2],c);this.boundingSphere=
|
|
|
|
|
|
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return k.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=k.vertices[a].position,f=k.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var k=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
|
|
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var h=0;h<this.subdivisions;h++){var a=new THREE.Geometry,l;for(l in f.faces){var n=e(f.faces[l].a,f.faces[l].b),t=e(f.faces[l].b,f.faces[l].c),v=e(f.faces[l].c,f.faces[l].a);b(f.faces[l].a,n,v,a);b(f.faces[l].b,t,
|
|
|
|
+n,a);b(f.faces[l].c,v,t,a);b(n,t,v,a)}f.faces=a.faces}k.faces=f.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
|
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],k=[],f=[],h=(new THREE.Matrix4).setRotationZ(c),l=0;l<a.length;l++)this.vertices.push(new THREE.Vertex(a[l])),b[l]=a[l].clone(),e[l]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(l=0;l<b.length;l++)n<this.angle?(b[l]=h.multiplyVector3(b[l].clone()),this.vertices.push(new THREE.Vertex(b[l])),k[l]=this.vertices.length-1):k=f;n==0&&(f=e);
|
|
|
|
+for(l=0;l<e.length-1;l++)this.faces.push(new THREE.Face4(k[l],k[l+1],e[l+1],e[l])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,l/a.length),new THREE.UV(1-n/this.angle,(l+1)/a.length),new THREE.UV(1-(n-c)/this.angle,(l+1)/a.length),new THREE.UV(1-(n-c)/this.angle,l/a.length)]);e=k;k=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
|
+THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=h.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,l){l<1?(l=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),l.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),l.normal=l.centroid.clone().normalize(),
|
|
|
|
+h.faces.push(l),l=Math.atan2(l.centroid.z,-l.centroid.x),h.faceVertexUvs[0].push([f(a.uv,a.position,l),f(b.uv,b.position,l),f(c.uv,c.position,l)])):(l-=1,e(a,k(a,b),k(a,c),l),e(k(a,b),b,k(b,c),l),e(k(a,c),k(b,c),c,l),e(k(a,b),k(b,c),k(a,c),l))}function k(a,c){l[a.index]||(l[a.index]=[]);l[c.index]||(l[c.index]=[]);var e=l[a.index][c.index];e===void 0&&(l[a.index][c.index]=l[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function f(a,b,c){c<0&&a.u===
|
|
|
|
+1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,h=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var l=[],n=this.vertices;e(n[0],n[2],n[4],c);e(n[0],n[4],n[3],c);e(n[0],n[3],n[5],c);e(n[0],n[5],n[2],c);e(n[1],n[2],n[5],c);e(n[1],n[5],n[3],c);e(n[1],n[3],n[4],c);e(n[1],n[4],n[2],c);this.boundingSphere=
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
-THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var l,f=a/2,h=c/2,b=b||1,e=e||1,k=b+1,n=e+1;a/=b;var t=c/e;for(l=0;l<n;l++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(l*t-h),0)));for(l=0;l<e;l++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*l,c+k*(l+1),c+1+k*(l+1),c+1+k*l)),this.faceVertexUvs[0].push([new THREE.UV(c/b,l/e),new THREE.UV(c/b,(l+1)/e),new THREE.UV((c+1)/b,(l+1)/e),new THREE.UV((c+1)/b,l/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
|
|
+THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var k,f=a/2,h=c/2,b=b||1,e=e||1,l=b+1,n=e+1;a/=b;var t=c/e;for(k=0;k<n;k++)for(c=0;c<l;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(k*t-h),0)));for(k=0;k<e;k++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+l*k,c+l*(k+1),c+1+l*(k+1),c+1+l*k)),this.faceVertexUvs[0].push([new THREE.UV(c/b,k/e),new THREE.UV(c/b,(k+1)/e),new THREE.UV((c+1)/b,(k+1)/e),new THREE.UV((c+1)/b,k/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,l=Math.PI,f=Math.max(3,c||8),h=Math.max(2,b||6),c=[],b=0;b<h+1;b++){e=b/h;var k=a*Math.cos(e*l),n=a*Math.sin(e*l),t=[],v=0;for(e=0;e<f;e++){var p=2*e/f,x=n*Math.sin(p*l),p=n*Math.cos(p*l);(b==0||b==h)&&e>0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,x)))-1);t.push(v)}c.push(t)}for(var w,z,u,l=c.length,b=0;b<l;b++)if(f=c[b].length,b>0)for(e=0;e<f;e++){t=e==f-1;h=c[b][t?0:e+1];k=c[b][t?f-1:e];n=c[b-1][t?
|
|
|
|
-f-1:e];t=c[b-1][t?0:e+1];x=b/(l-1);w=(b-1)/(l-1);z=(e+1)/f;var p=e/f,v=new THREE.UV(1-z,x),x=new THREE.UV(1-p,x),p=new THREE.UV(1-p,w),B=new THREE.UV(1-z,w);b<c.length-1&&(w=this.vertices[h].position.clone(),z=this.vertices[k].position.clone(),u=this.vertices[n].position.clone(),w.normalize(),z.normalize(),u.normalize(),this.faces.push(new THREE.Face3(h,k,n,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([v,x,p]));b>1&&(w=
|
|
|
|
|
|
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,k=Math.PI,f=Math.max(3,c||8),h=Math.max(2,b||6),c=[],b=0;b<h+1;b++){e=b/h;var l=a*Math.cos(e*k),n=a*Math.sin(e*k),t=[],v=0;for(e=0;e<f;e++){var p=2*e/f,x=n*Math.sin(p*k),p=n*Math.cos(p*k);(b==0||b==h)&&e>0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,l,x)))-1);t.push(v)}c.push(t)}for(var w,z,u,k=c.length,b=0;b<k;b++)if(f=c[b].length,b>0)for(e=0;e<f;e++){t=e==f-1;h=c[b][t?0:e+1];l=c[b][t?f-1:e];n=c[b-1][t?
|
|
|
|
+f-1:e];t=c[b-1][t?0:e+1];x=b/(k-1);w=(b-1)/(k-1);z=(e+1)/f;var p=e/f,v=new THREE.UV(1-z,x),x=new THREE.UV(1-p,x),p=new THREE.UV(1-p,w),B=new THREE.UV(1-z,w);b<c.length-1&&(w=this.vertices[h].position.clone(),z=this.vertices[l].position.clone(),u=this.vertices[n].position.clone(),w.normalize(),z.normalize(),u.normalize(),this.faces.push(new THREE.Face3(h,l,n,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([v,x,p]));b>1&&(w=
|
|
this.vertices[h].position.clone(),z=this.vertices[n].position.clone(),u=this.vertices[t].position.clone(),w.normalize(),z.normalize(),u.normalize(),this.faces.push(new THREE.Face3(h,n,t,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([v,p,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
this.vertices[h].position.clone(),z=this.vertices[n].position.clone(),u=this.vertices[t].position.clone(),w.normalize(),z.normalize(),u.normalize(),this.faces.push(new THREE.Face3(h,n,t,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([v,p,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
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(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
|
|
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(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
|
|
-this.getFace(),b=this.size/c.resolution,e=0,l=String(a).split(""),f=l.length,h=[],a=0;a<f;a++){var k=new THREE.Path,k=this.extractGlyphPoints(l[a],c,b,e,k);e+=k.offset;h.push(k.path)}return{paths:h,offset:e/2}},extractGlyphPoints:function(a,c,b,e,l){var f=[],h,k,n,t,v,p,x,w,z,u,B=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));n=c.length;for(a=0;a<n;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;t=c[a++]*b;f.push(new THREE.Vector2(k,
|
|
|
|
-t));l.moveTo(k,t);break;case "l":k=c[a++]*b+e;t=c[a++]*b;f.push(new THREE.Vector2(k,t));l.lineTo(k,t);break;case "q":k=c[a++]*b+e;t=c[a++]*b;x=c[a++]*b+e;w=c[a++]*b;l.quadraticCurveTo(x,w,k,t);if(h=f[f.length-1]){v=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var y=h/divisions,F=THREE.Shape.Utils.b2(y,v,x,k),y=THREE.Shape.Utils.b2(y,p,w,t);f.push(new THREE.Vector2(F,y))}}break;case "b":if(k=c[a++]*b+e,t=c[a++]*b,x=c[a++]*b+e,w=c[a++]*-b,z=c[a++]*b+e,u=c[a++]*-b,l.bezierCurveTo(k,t,
|
|
|
|
-x,w,z,u),h=f[f.length-1]){v=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)y=h/divisions,F=THREE.Shape.Utils.b3(y,v,x,z,k),y=THREE.Shape.Utils.b3(y,p,w,u,t),f.push(new THREE.Vector2(F,y))}}}return{offset:B.ha*b,points:f,path:l}}}};
|
|
|
|
-(function(a){var c=function(a){for(var c=a.length,l=0,f=c-1,h=0;h<c;f=h++)l+=a[f].x*a[h].y-a[h].x*a[f].y;return l*0.5};a.Triangulate=function(a,e){var l=a.length;if(l<3)return null;var f=[],h=[],k=[],n,t,v;if(c(a)>0)for(t=0;t<l;t++)h[t]=t;else for(t=0;t<l;t++)h[t]=l-1-t;var p=2*l;for(t=l-1;l>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return f}n=t;l<=n&&(n=0);t=n+1;l<=t&&(t=0);v=t+1;l<=v&&(v=0);var x;a:{x=a;var w=n,z=t,u=v,B=l,y=h,F=void 0,C=void 0,H=void 0,
|
|
|
|
|
|
+this.getFace(),b=this.size/c.resolution,e=0,k=String(a).split(""),f=k.length,h=[],a=0;a<f;a++){var l=new THREE.Path,l=this.extractGlyphPoints(k[a],c,b,e,l);e+=l.offset;h.push(l.path)}return{paths:h,offset:e/2}},extractGlyphPoints:function(a,c,b,e,k){var f=[],h,l,n,t,v,p,x,w,z,u,B=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));n=c.length;for(a=0;a<n;)switch(l=c[a++],l){case "m":l=c[a++]*b+e;t=c[a++]*b;f.push(new THREE.Vector2(l,
|
|
|
|
+t));k.moveTo(l,t);break;case "l":l=c[a++]*b+e;t=c[a++]*b;f.push(new THREE.Vector2(l,t));k.lineTo(l,t);break;case "q":l=c[a++]*b+e;t=c[a++]*b;x=c[a++]*b+e;w=c[a++]*b;k.quadraticCurveTo(x,w,l,t);if(h=f[f.length-1]){v=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var y=h/divisions,F=THREE.Shape.Utils.b2(y,v,x,l),y=THREE.Shape.Utils.b2(y,p,w,t);f.push(new THREE.Vector2(F,y))}}break;case "b":if(l=c[a++]*b+e,t=c[a++]*b,x=c[a++]*b+e,w=c[a++]*-b,z=c[a++]*b+e,u=c[a++]*-b,k.bezierCurveTo(l,t,
|
|
|
|
+x,w,z,u),h=f[f.length-1]){v=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)y=h/divisions,F=THREE.Shape.Utils.b3(y,v,x,z,l),y=THREE.Shape.Utils.b3(y,p,w,u,t),f.push(new THREE.Vector2(F,y))}}}return{offset:B.ha*b,points:f,path:k}}}};
|
|
|
|
+(function(a){var c=function(a){for(var c=a.length,k=0,f=c-1,h=0;h<c;f=h++)k+=a[f].x*a[h].y-a[h].x*a[f].y;return k*0.5};a.Triangulate=function(a,e){var k=a.length;if(k<3)return null;var f=[],h=[],l=[],n,t,v;if(c(a)>0)for(t=0;t<k;t++)h[t]=t;else for(t=0;t<k;t++)h[t]=k-1-t;var p=2*k;for(t=k-1;k>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return f}n=t;k<=n&&(n=0);t=n+1;k<=t&&(t=0);v=t+1;k<=v&&(v=0);var x;a:{x=a;var w=n,z=t,u=v,B=k,y=h,F=void 0,C=void 0,H=void 0,
|
|
L=void 0,R=void 0,D=void 0,O=void 0,K=void 0,N=void 0,C=x[y[w]].x,H=x[y[w]].y,L=x[y[z]].x,R=x[y[z]].y,D=x[y[u]].x,O=x[y[u]].y;if(1.0E-10>(L-C)*(O-H)-(R-H)*(D-C))x=!1;else{for(F=0;F<B;F++)if(!(F==w||F==z||F==u)){var K=x[y[F]].x,N=x[y[F]].y,J=void 0,M=void 0,ea=void 0,ja=void 0,Z=void 0,U=void 0,o=void 0,P=void 0,pa=void 0,G=void 0,X=void 0,aa=void 0,J=ea=Z=void 0,J=D-L,M=O-R,ea=C-D,ja=H-O,Z=L-C,U=R-H,o=K-C,P=N-H,pa=K-L,G=N-R,X=K-D,aa=N-O,J=J*G-M*pa,Z=Z*P-U*o,ea=ea*aa-ja*X;if(J>=0&&ea>=0&&Z>=0){x=!1;
|
|
L=void 0,R=void 0,D=void 0,O=void 0,K=void 0,N=void 0,C=x[y[w]].x,H=x[y[w]].y,L=x[y[z]].x,R=x[y[z]].y,D=x[y[u]].x,O=x[y[u]].y;if(1.0E-10>(L-C)*(O-H)-(R-H)*(D-C))x=!1;else{for(F=0;F<B;F++)if(!(F==w||F==z||F==u)){var K=x[y[F]].x,N=x[y[F]].y,J=void 0,M=void 0,ea=void 0,ja=void 0,Z=void 0,U=void 0,o=void 0,P=void 0,pa=void 0,G=void 0,X=void 0,aa=void 0,J=ea=Z=void 0,J=D-L,M=O-R,ea=C-D,ja=H-O,Z=L-C,U=R-H,o=K-C,P=N-H,pa=K-L,G=N-R,X=K-D,aa=N-O,J=J*G-M*pa,Z=Z*P-U*o,ea=ea*aa-ja*X;if(J>=0&&ea>=0&&Z>=0){x=!1;
|
|
-break a}}x=!0}}if(x){f.push([a[h[n]],a[h[t]],a[h[v]]]);k.push([h[n],h[t],h[v]]);n=t;for(v=t+1;v<l;n++,v++)h[n]=h[v];l--;p=2*l}}if(e)return k;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
|
-THREE.TorusGeometry=function(a,c,b,e,l){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=l||Math.PI*2;l=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var f=e/this.segmentsT*this.arc,h=b/this.segmentsR*Math.PI*2;l.x=this.radius*Math.cos(f);l.y=this.radius*Math.sin(f);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(h))*Math.cos(f);k.y=(this.radius+this.tube*Math.cos(h))*Math.sin(f);k.z=
|
|
|
|
-this.tube*Math.sin(h);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(l).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var l=(this.segmentsT+1)*b+e-1,f=(this.segmentsT+1)*(b-1)+e-1,h=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,n=new THREE.Face4(l,f,h,k,[c[l],c[f],c[h],c[k]]);n.normal.addSelf(c[l]);n.normal.addSelf(c[f]);n.normal.addSelf(c[h]);n.normal.addSelf(c[k]);n.normal.normalize();this.faces.push(n);
|
|
|
|
-this.faceVertexUvs[0].push([a[l].clone(),a[f].clone(),a[h].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
|
-THREE.TorusKnotGeometry=function(a,c,b,e,l,f,h){function k(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=l||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
|
|
|
|
-this.segmentsT;++c){var n=a/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,l=k(n,h,this.q,this.p,this.radius,this.heightScale),n=k(n+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=n.x-l.x;b.y=n.y-l.y;b.z=n.z-l.z;e.x=n.x+l.x;e.y=n.y+l.y;e.z=n.z+l.z;f.cross(b,e);e.cross(f,b);f.normalize();e.normalize();n=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);l.x+=n*e.x+h*f.x;l.y+=n*e.y+h*f.y;l.z+=n*e.z+h*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(l.x,l.y,
|
|
|
|
-l.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,l=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][f],f=this.grid[a][f],h=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),v=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(l,b,e,f));this.faceVertexUvs[0].push([h,n,t,v])}this.computeCentroids();
|
|
|
|
|
|
+break a}}x=!0}}if(x){f.push([a[h[n]],a[h[t]],a[h[v]]]);l.push([h[n],h[t],h[v]]);n=t;for(v=t+1;v<k;n++,v++)h[n]=h[v];k--;p=2*k}}if(e)return l;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
|
+THREE.TorusGeometry=function(a,c,b,e,k){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=k||Math.PI*2;k=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var f=e/this.segmentsT*this.arc,h=b/this.segmentsR*Math.PI*2;k.x=this.radius*Math.cos(f);k.y=this.radius*Math.sin(f);var l=new THREE.Vector3;l.x=(this.radius+this.tube*Math.cos(h))*Math.cos(f);l.y=(this.radius+this.tube*Math.cos(h))*Math.sin(f);l.z=
|
|
|
|
+this.tube*Math.sin(h);this.vertices.push(new THREE.Vertex(l));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(l.clone().subSelf(k).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var k=(this.segmentsT+1)*b+e-1,f=(this.segmentsT+1)*(b-1)+e-1,h=(this.segmentsT+1)*(b-1)+e,l=(this.segmentsT+1)*b+e,n=new THREE.Face4(k,f,h,l,[c[k],c[f],c[h],c[l]]);n.normal.addSelf(c[k]);n.normal.addSelf(c[f]);n.normal.addSelf(c[h]);n.normal.addSelf(c[l]);n.normal.normalize();this.faces.push(n);
|
|
|
|
+this.faceVertexUvs[0].push([a[k].clone(),a[f].clone(),a[h].clone(),a[l].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
|
+THREE.TorusKnotGeometry=function(a,c,b,e,k,f,h){function l(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=k||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
|
|
|
|
+this.segmentsT;++c){var n=a/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,k=l(n,h,this.q,this.p,this.radius,this.heightScale),n=l(n+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=n.x-k.x;b.y=n.y-k.y;b.z=n.z-k.z;e.x=n.x+k.x;e.y=n.y+k.y;e.z=n.z+k.z;f.cross(b,e);e.cross(f,b);f.normalize();e.normalize();n=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);k.x+=n*e.x+h*f.x;k.y+=n*e.y+h*f.y;k.z+=n*e.z+h*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(k.x,k.y,
|
|
|
|
+k.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,k=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][f],f=this.grid[a][f],h=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),v=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(k,b,e,f));this.faceVertexUvs[0].push([h,n,t,v])}this.computeCentroids();
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,n){var p=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(h.useOldVertexColors){p.vertexColors=[];for(var t,u,w,v=0;v<4;v++){w=n[v];t=new THREE.Color;t.setRGB(0,0,0);for(var y=0;y<w.length;y++)u=k.vertexColors[w[y]-1],t.r+=u.r,t.g+=u.g,t.b+=u.b;t.r/=w.length;t.g/=w.length;t.b/=w.length;p.vertexColors[v]=t}}l.push(p);(!h.supportUVs||x.length!=0)&&f.push([x[a],x[b],x[c],x[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
|
-b)}var e=[],l=[],f=[],h=this,k=a.vertices,e=a.faces,n=k.concat(),t=[],v={},p={},x=[],w,z,u,B,y,F=a.faceVertexUvs[0];w=0;for(z=F.length;w<z;w++){u=0;for(B=F[w].length;u<B;u++)y=e[w]["abcd".charAt(u)],x[y]||(x[y]=F[w][u])}var C;w=0;for(z=e.length;w<z;w++)if(y=e[w],t.push(y.centroid),n.push(new THREE.Vertex(y.centroid)),h.supportUVs&&x.length!=0){C=new THREE.UV;if(y instanceof THREE.Face3)C.u=x[y.a].u+x[y.b].u+x[y.c].u,C.v=x[y.a].v+x[y.b].v+x[y.c].v,C.u/=3,C.v/=3;else if(y instanceof THREE.Face4)C.u=
|
|
|
|
-x[y.a].u+x[y.b].u+x[y.c].u+x[y.d].u,C.v=x[y.a].v+x[y.b].v+x[y.c].v+x[y.d].v,C.u/=4,C.v/=4;x.push(C)}z=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,k,l={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.a),c(l,k,e)):h instanceof THREE.Face4&&(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.d),c(l,k,e),k=b(h.d,h.a),c(l,k,e));return l}(a);var H=0,F=k.length,L,R,D={},O={},K=function(a,
|
|
|
|
-b){D[a]===void 0&&(D[a]=[]);D[a].push(b)},N=function(a,b){O[a]===void 0&&(O[a]={});O[a][b]=null};for(w in z){C=z[w];L=w.split("_");R=L[0];L=L[1];K(R,[R,L]);K(L,[R,L]);u=0;for(B=C.length;u<B;u++)y=C[u],N(R,y,w),N(L,y,w);C.length<2&&(p[w]=!0)}for(w in z)if(C=z[w],y=C[0],C=C[1],L=w.split("_"),R=L[0],L=L[1],B=new THREE.Vector3,p[w]?(B.addSelf(k[R].position),B.addSelf(k[L].position),B.multiplyScalar(0.5)):(B.addSelf(t[y]),B.addSelf(t[C]),B.addSelf(k[R].position),B.addSelf(k[L].position),B.multiplyScalar(0.25)),
|
|
|
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,l,n){var p=new THREE.Face4(a,b,c,e,null,l.color,l.material);if(h.useOldVertexColors){p.vertexColors=[];for(var t,u,w,v=0;v<4;v++){w=n[v];t=new THREE.Color;t.setRGB(0,0,0);for(var y=0;y<w.length;y++)u=l.vertexColors[w[y]-1],t.r+=u.r,t.g+=u.g,t.b+=u.b;t.r/=w.length;t.g/=w.length;t.b/=w.length;p.vertexColors[v]=t}}k.push(p);(!h.supportUVs||x.length!=0)&&f.push([x[a],x[b],x[c],x[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
|
+b)}var e=[],k=[],f=[],h=this,l=a.vertices,e=a.faces,n=l.concat(),t=[],v={},p={},x=[],w,z,u,B,y,F=a.faceVertexUvs[0];w=0;for(z=F.length;w<z;w++){u=0;for(B=F[w].length;u<B;u++)y=e[w]["abcd".charAt(u)],x[y]||(x[y]=F[w][u])}var C;w=0;for(z=e.length;w<z;w++)if(y=e[w],t.push(y.centroid),n.push(new THREE.Vertex(y.centroid)),h.supportUVs&&x.length!=0){C=new THREE.UV;if(y instanceof THREE.Face3)C.u=x[y.a].u+x[y.b].u+x[y.c].u,C.v=x[y.a].v+x[y.b].v+x[y.c].v,C.u/=3,C.v/=3;else if(y instanceof THREE.Face4)C.u=
|
|
|
|
+x[y.a].u+x[y.b].u+x[y.c].u+x[y.d].u,C.v=x[y.a].v+x[y.b].v+x[y.c].v+x[y.d].v,C.u/=4,C.v/=4;x.push(C)}z=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,k,l={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.a),c(l,k,e)):h instanceof THREE.Face4&&(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.d),c(l,k,e),k=b(h.d,h.a),c(l,k,e));return l}(a);var H=0,F=l.length,L,R,D={},O={},K=function(a,
|
|
|
|
+b){D[a]===void 0&&(D[a]=[]);D[a].push(b)},N=function(a,b){O[a]===void 0&&(O[a]={});O[a][b]=null};for(w in z){C=z[w];L=w.split("_");R=L[0];L=L[1];K(R,[R,L]);K(L,[R,L]);u=0;for(B=C.length;u<B;u++)y=C[u],N(R,y,w),N(L,y,w);C.length<2&&(p[w]=!0)}for(w in z)if(C=z[w],y=C[0],C=C[1],L=w.split("_"),R=L[0],L=L[1],B=new THREE.Vector3,p[w]?(B.addSelf(l[R].position),B.addSelf(l[L].position),B.multiplyScalar(0.5)):(B.addSelf(t[y]),B.addSelf(t[C]),B.addSelf(l[R].position),B.addSelf(l[L].position),B.multiplyScalar(0.25)),
|
|
v[w]=F+e.length+H,n.push(new THREE.Vertex(B)),H++,h.supportUVs&&x.length!=0)C=new THREE.UV,C.u=x[R].u+x[L].u,C.v=x[R].v+x[L].v,C.u/=2,C.v/=2,x.push(C);var J,M;L=["123","12","2","23"];B=["123","23","3","31"];var K=["123","31","1","12"],N=["1234","12","2","23"],ea=["1234","23","3","34"],ja=["1234","34","4","41"],Z=["1234","41","1","12"];w=0;for(z=t.length;w<z;w++)y=e[w],C=F+w,y instanceof THREE.Face3?(H=b(y.a,y.b),R=b(y.b,y.c),J=b(y.c,y.a),c(C,v[H],y.b,v[R],y,L),c(C,v[R],y.c,v[J],y,B),c(C,v[J],y.a,
|
|
v[w]=F+e.length+H,n.push(new THREE.Vertex(B)),H++,h.supportUVs&&x.length!=0)C=new THREE.UV,C.u=x[R].u+x[L].u,C.v=x[R].v+x[L].v,C.u/=2,C.v/=2,x.push(C);var J,M;L=["123","12","2","23"];B=["123","23","3","31"];var K=["123","31","1","12"],N=["1234","12","2","23"],ea=["1234","23","3","34"],ja=["1234","34","4","41"],Z=["1234","41","1","12"];w=0;for(z=t.length;w<z;w++)y=e[w],C=F+w,y instanceof THREE.Face3?(H=b(y.a,y.b),R=b(y.b,y.c),J=b(y.c,y.a),c(C,v[H],y.b,v[R],y,L),c(C,v[R],y.c,v[J],y,B),c(C,v[J],y.a,
|
|
-v[H],y,K)):y instanceof THREE.Face4?(H=b(y.a,y.b),R=b(y.b,y.c),J=b(y.c,y.d),M=b(y.d,y.a),c(C,v[H],y.b,v[R],y,N),c(C,v[R],y.c,v[J],y,ea),c(C,v[J],y.d,v[M],y,ja),c(C,v[M],y.a,v[H],y,Z)):console.log("face should be a face!",y);e=n;n=new THREE.Vector3;v=new THREE.Vector3;w=0;for(z=k.length;w<z;w++)if(D[w]!==void 0){n.set(0,0,0);v.set(0,0,0);y=new THREE.Vector3(0,0,0);C=0;for(u in O[w])n.addSelf(t[u]),C++;H=0;F=D[w].length;for(u=0;u<F;u++)p[b(D[w][u][0],D[w][u][1])]&&H++;if(H!=2){n.divideScalar(C);for(u=
|
|
|
|
-0;u<F;u++)C=D[w][u],C=k[C[0]].position.clone().addSelf(k[C[1]].position).divideScalar(2),v.addSelf(C);v.divideScalar(F);y.addSelf(k[w].position);y.multiplyScalar(F-3);y.addSelf(n);y.addSelf(v.multiplyScalar(2));y.divideScalar(F);e[w].position=y}}a.vertices=e;a.faces=l;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
|
|
|
+v[H],y,K)):y instanceof THREE.Face4?(H=b(y.a,y.b),R=b(y.b,y.c),J=b(y.c,y.d),M=b(y.d,y.a),c(C,v[H],y.b,v[R],y,N),c(C,v[R],y.c,v[J],y,ea),c(C,v[J],y.d,v[M],y,ja),c(C,v[M],y.a,v[H],y,Z)):console.log("face should be a face!",y);e=n;n=new THREE.Vector3;v=new THREE.Vector3;w=0;for(z=l.length;w<z;w++)if(D[w]!==void 0){n.set(0,0,0);v.set(0,0,0);y=new THREE.Vector3(0,0,0);C=0;for(u in O[w])n.addSelf(t[u]),C++;H=0;F=D[w].length;for(u=0;u<F;u++)p[b(D[w][u][0],D[w][u][1])]&&H++;if(H!=2){n.divideScalar(C);for(u=
|
|
|
|
+0;u<F;u++)C=D[w][u],C=l[C[0]].position.clone().addSelf(l[C[1]].position).divideScalar(2),v.addSelf(C);v.divideScalar(F);y.addSelf(l[w].position);y.multiplyScalar(F-3);y.addSelf(n);y.addSelf(v.multiplyScalar(2));y.divideScalar(F);e[w].position=y}}a.vertices=e;a.faces=k;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
-a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function l(a,b,f,h,k,l){var n=document.createElement("canvas");a[b]=new THREE.Texture(n);a[b].sourceFile=f;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
|
|
|
|
-if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}k&&a[b].offset.set(k[0],k[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[b].wrapS=h[l[0]];if(h[l[1]]!==void 0)a[b].wrapT=h[l[1]]}e(a[b],c+"/"+f)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h,k,n;k="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
|
|
|
|
|
|
+a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function k(a,b,f,h,k,l){var n=document.createElement("canvas");a[b]=new THREE.Texture(n);a[b].sourceFile=f;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
|
|
|
|
+if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}k&&a[b].offset.set(k[0],k[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[b].wrapS=h[l[0]];if(h[l[1]]!==void 0)a[b].wrapT=h[l[1]]}e(a[b],c+"/"+f)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h,l,n;l="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?l="MeshPhongMaterial":a.shading=="Basic"&&(l="MeshBasicMaterial"));
|
|
if(a.blending)if(a.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)h.transparent=a.transparent;if(a.depthTest!==void 0)h.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(a.vertexColors)h.vertexColors=THREE.VertexColors;if(a.colorDiffuse)h.color=f(a.colorDiffuse);
|
|
if(a.blending)if(a.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)h.transparent=a.transparent;if(a.depthTest!==void 0)h.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(a.vertexColors)h.vertexColors=THREE.VertexColors;if(a.colorDiffuse)h.color=f(a.colorDiffuse);
|
|
-else if(a.DbgColor)h.color=a.DbgColor;if(a.colorSpecular)h.specular=f(a.colorSpecular);if(a.colorAmbient)h.ambient=f(a.colorAmbient);if(a.transparency)h.opacity=a.transparency;if(a.specularCoef)h.shininess=a.specularCoef;a.mapDiffuse&&c&&l(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&l(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&l(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
|
|
-a.mapSpecular&&c&&l(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var t=THREE.ShaderUtils.lib.normal,v=THREE.UniformsUtils.clone(t.uniforms),p=h.color;k=h.specular;n=h.ambient;var x=h.shininess;v.tNormal.texture=h.normalMap;if(a.mapNormalFactor)v.uNormalScale.value=a.mapNormalFactor;if(h.map)v.tDiffuse.texture=h.map,v.enableDiffuse.value=!0;if(h.specularMap)v.tSpecular.texture=h.specularMap,v.enableSpecular.value=!0;if(h.lightMap)v.tAO.texture=
|
|
|
|
-h.lightMap,v.enableAO.value=!0;v.uDiffuseColor.value.setHex(p);v.uSpecularColor.value.setHex(k);v.uAmbientColor.value.setHex(n);v.uShininess.value=x;if(h.opacity)v.uOpacity.value=h.opacity;h=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:v,lights:!0,fog:!0})}else h=new THREE[k](h);return h}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
|
|
|
+else if(a.DbgColor)h.color=a.DbgColor;if(a.colorSpecular)h.specular=f(a.colorSpecular);if(a.colorAmbient)h.ambient=f(a.colorAmbient);if(a.transparency)h.opacity=a.transparency;if(a.specularCoef)h.shininess=a.specularCoef;a.mapDiffuse&&c&&k(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&k(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&k(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
|
|
+a.mapSpecular&&c&&k(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var t=THREE.ShaderUtils.lib.normal,v=THREE.UniformsUtils.clone(t.uniforms),p=h.color;l=h.specular;n=h.ambient;var x=h.shininess;v.tNormal.texture=h.normalMap;if(a.mapNormalFactor)v.uNormalScale.value=a.mapNormalFactor;if(h.map)v.tDiffuse.texture=h.map,v.enableDiffuse.value=!0;if(h.specularMap)v.tSpecular.texture=h.specularMap,v.enableSpecular.value=!0;if(h.lightMap)v.tAO.texture=
|
|
|
|
+h.lightMap,v.enableAO.value=!0;v.uDiffuseColor.value.setHex(p);v.uSpecularColor.value.setHex(l);v.uAmbientColor.value.setHex(n);v.uShininess.value=x;if(h.opacity)v.uOpacity.value=h.opacity;h=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:v,lights:!0,fog:!0})}else h=new THREE[l](h);return h}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
-THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var l=a,a=l.model,c=l.callback,b=l.texture_path,e=l.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),l=Date.now(),a=new Worker(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
|
|
|
|
-c,e,b,f)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(l)};
|
|
|
|
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,l,f){var h=new XMLHttpRequest,k=e+"/"+a,n=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,l,c):alert("Couldn't load ["+k+"] ["+h.status+"]"):h.readyState==3?f&&(n==0&&(n=h.getResponseHeader("Content-Length")),f({total:n,loaded:h.responseText.length})):h.readyState==2&&(n=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
|
|
|
+THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var k=a,a=k.model,c=k.callback,b=k.texture_path,e=k.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),k=Date.now(),a=new Worker(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
|
|
|
|
+c,e,b,f)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(k)};
|
|
|
|
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,k,f){var h=new XMLHttpRequest,l=e+"/"+a,n=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,k,c):alert("Couldn't load ["+l+"] ["+h.status+"]"):h.readyState==3?f&&(n==0&&(n=h.getResponseHeader("Content-Length")),f({total:n,loaded:h.responseText.length})):h.readyState==2&&(n=h.getResponseHeader("Content-Length"))};h.open("GET",l,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
h.setRequestHeader("Content-Type","text/plain");h.send(null)};
|
|
h.setRequestHeader("Content-Type","text/plain");h.send(null)};
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var l=function(b){function c(a,b){var e=v(a,b),f=v(a,b+1),h=v(a,b+2),k=v(a,b+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=v(a,b),e=v(a,b+1),f=v(a,b+2);return(v(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=v(a,b);return(v(a,b+1)<<8)+c}function t(a,b){var c=v(a,b);return c>127?c-256:c}function v(a,b){return a.charCodeAt(b)&255}function p(b){var c,
|
|
|
|
-e,f;c=k(a,b);e=k(a,b+R);f=k(a,b+D);b=l(a,b+O);y.faces.push(new THREE.Face3(c,e,f,null,null,b))}function x(b){var c,e,f,h,o,p,t;c=k(a,b);e=k(a,b+R);f=k(a,b+D);h=l(a,b+O);o=k(a,b+K);p=k(a,b+N);t=k(a,b+J);var b=H[p*3],u=H[p*3+1];p=H[p*3+2];var v=H[t*3],w=H[t*3+1];t=H[t*3+2];y.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,w,t)],null,h))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+M);f=k(a,b+ea);h=k(a,b+ja);b=l(a,b+Z);y.faces.push(new THREE.Face4(c,
|
|
|
|
-e,f,h,null,null,b))}function z(b){var c,e,f,h,p,t,u,v,w;c=k(a,b);e=k(a,b+M);f=k(a,b+ea);h=k(a,b+ja);p=l(a,b+Z);t=k(a,b+U);u=k(a,b+o);v=k(a,b+P);w=k(a,b+pa);var b=H[u*3],x=H[u*3+1];u=H[u*3+2];var $=H[v*3],z=H[v*3+1];v=H[v*3+2];var V=H[w*3],B=H[w*3+1];w=H[w*3+2];y.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(H[t*3],H[t*3+1],H[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3($,z,v),new THREE.Vector3(V,B,w)],null,p))}function u(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+X);b=L[c*2];h=L[c*2+
|
|
|
|
-1];c=L[e*2];var l=y.faceVertexUvs[0];e=L[e*2+1];var n=L[f*2];f=L[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(n,f));l.push(o)}function B(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+aa);f=k(a,b+na);h=k(a,b+la);b=L[c*2];l=L[c*2+1];c=L[e*2];n=L[e*2+1];e=L[f*2];var o=y.faceVertexUvs[0];f=L[f*2+1];var p=L[h*2];h=L[h*2+1];var t=[];t.push(new THREE.UV(b,l));t.push(new THREE.UV(c,n));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}var y=this,F=0,C,H=[],L=[],
|
|
|
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var k=function(b){function c(a,b){var e=v(a,b),f=v(a,b+1),h=v(a,b+2),k=v(a,b+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=v(a,b),e=v(a,b+1),f=v(a,b+2);return(v(a,b+3)<<24)+(f<<16)+(e<<8)+c}function n(a,b){var c=v(a,b);return(v(a,b+1)<<8)+c}function t(a,b){var c=v(a,b);return c>127?c-256:c}function v(a,b){return a.charCodeAt(b)&255}function p(b){var c,
|
|
|
|
+e,f;c=k(a,b);e=k(a,b+R);f=k(a,b+D);b=n(a,b+O);y.faces.push(new THREE.Face3(c,e,f,null,null,b))}function x(b){var c,e,f,h,o,p,t;c=k(a,b);e=k(a,b+R);f=k(a,b+D);h=n(a,b+O);o=k(a,b+K);p=k(a,b+N);t=k(a,b+J);var b=H[p*3],u=H[p*3+1];p=H[p*3+2];var v=H[t*3],w=H[t*3+1];t=H[t*3+2];y.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,w,t)],null,h))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+M);f=k(a,b+ea);h=k(a,b+ja);b=n(a,b+Z);y.faces.push(new THREE.Face4(c,
|
|
|
|
+e,f,h,null,null,b))}function z(b){var c,e,f,h,p,t,u,v,w;c=k(a,b);e=k(a,b+M);f=k(a,b+ea);h=k(a,b+ja);p=n(a,b+Z);t=k(a,b+U);u=k(a,b+o);v=k(a,b+P);w=k(a,b+pa);var b=H[u*3],x=H[u*3+1];u=H[u*3+2];var $=H[v*3],z=H[v*3+1];v=H[v*3+2];var V=H[w*3],B=H[w*3+1];w=H[w*3+2];y.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(H[t*3],H[t*3+1],H[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3($,z,v),new THREE.Vector3(V,B,w)],null,p))}function u(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+X);b=L[c*2];h=L[c*2+
|
|
|
|
+1];c=L[e*2];var n=y.faceVertexUvs[0];e=L[e*2+1];var o=L[f*2];f=L[f*2+1];var p=[];p.push(new THREE.UV(b,h));p.push(new THREE.UV(c,e));p.push(new THREE.UV(o,f));n.push(p)}function B(b){var c,e,f,h,n,o;c=k(a,b);e=k(a,b+aa);f=k(a,b+na);h=k(a,b+la);b=L[c*2];n=L[c*2+1];c=L[e*2];o=L[e*2+1];e=L[f*2];var p=y.faceVertexUvs[0];f=L[f*2+1];var t=L[h*2];h=L[h*2+1];var u=[];u.push(new THREE.UV(b,n));u.push(new THREE.UV(c,o));u.push(new THREE.UV(e,f));u.push(new THREE.UV(t,h));p.push(u)}var y=this,F=0,C,H=[],L=[],
|
|
R,D,O,K,N,J,M,ea,ja,Z,U,o,P,pa,G,X,aa,na,la,ra,ia,da,S,fa,ha;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);C={signature:a.substr(F,8),header_bytes:v(a,F+8),vertex_coordinate_bytes:v(a,F+9),normal_coordinate_bytes:v(a,F+10),uv_coordinate_bytes:v(a,F+11),vertex_index_bytes:v(a,F+12),normal_index_bytes:v(a,F+13),uv_index_bytes:v(a,F+14),material_index_bytes:v(a,F+15),nvertices:k(a,F+16),nnormals:k(a,F+16+4),nuvs:k(a,F+16+8),ntri_flat:k(a,F+16+12),ntri_smooth:k(a,F+16+16),ntri_flat_uv:k(a,
|
|
R,D,O,K,N,J,M,ea,ja,Z,U,o,P,pa,G,X,aa,na,la,ra,ia,da,S,fa,ha;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);C={signature:a.substr(F,8),header_bytes:v(a,F+8),vertex_coordinate_bytes:v(a,F+9),normal_coordinate_bytes:v(a,F+10),uv_coordinate_bytes:v(a,F+11),vertex_index_bytes:v(a,F+12),normal_index_bytes:v(a,F+13),uv_index_bytes:v(a,F+14),material_index_bytes:v(a,F+15),nvertices:k(a,F+16),nnormals:k(a,F+16+4),nuvs:k(a,F+16+8),ntri_flat:k(a,F+16+12),ntri_smooth:k(a,F+16+16),ntri_flat_uv:k(a,
|
|
F+16+20),ntri_smooth_uv:k(a,F+16+24),nquad_flat:k(a,F+16+28),nquad_smooth:k(a,F+16+32),nquad_flat_uv:k(a,F+16+36),nquad_smooth_uv:k(a,F+16+40)};F+=C.header_bytes;R=C.vertex_index_bytes;D=C.vertex_index_bytes*2;O=C.vertex_index_bytes*3;K=C.vertex_index_bytes*3+C.material_index_bytes;N=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;J=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;M=C.vertex_index_bytes;ea=C.vertex_index_bytes*2;ja=C.vertex_index_bytes*3;Z=C.vertex_index_bytes*
|
|
F+16+20),ntri_smooth_uv:k(a,F+16+24),nquad_flat:k(a,F+16+28),nquad_smooth:k(a,F+16+32),nquad_flat_uv:k(a,F+16+36),nquad_smooth_uv:k(a,F+16+40)};F+=C.header_bytes;R=C.vertex_index_bytes;D=C.vertex_index_bytes*2;O=C.vertex_index_bytes*3;K=C.vertex_index_bytes*3+C.material_index_bytes;N=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;J=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;M=C.vertex_index_bytes;ea=C.vertex_index_bytes*2;ja=C.vertex_index_bytes*3;Z=C.vertex_index_bytes*
|
|
4;U=C.vertex_index_bytes*4+C.material_index_bytes;o=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;P=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;pa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;G=C.uv_index_bytes;X=C.uv_index_bytes*2;aa=C.uv_index_bytes;na=C.uv_index_bytes*2;la=C.uv_index_bytes*3;b=C.vertex_index_bytes*3+C.material_index_bytes;ha=C.vertex_index_bytes*4+C.material_index_bytes;ra=C.ntri_flat*b;ia=C.ntri_smooth*(b+C.normal_index_bytes*
|
|
4;U=C.vertex_index_bytes*4+C.material_index_bytes;o=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;P=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;pa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;G=C.uv_index_bytes;X=C.uv_index_bytes*2;aa=C.uv_index_bytes;na=C.uv_index_bytes*2;la=C.uv_index_bytes*3;b=C.vertex_index_bytes*3+C.material_index_bytes;ha=C.vertex_index_bytes*4+C.material_index_bytes;ra=C.ntri_flat*b;ia=C.ntri_smooth*(b+C.normal_index_bytes*
|
|
@@ -574,24 +573,24 @@ F+16+20),ntri_smooth_uv:k(a,F+16+24),nquad_flat:k(a,F+16+28),nquad_smooth:k(a,F+
|
|
3,k=b+C.nnormals*h;b<k;b+=h)c=t(a,b),e=t(a,b+C.normal_coordinate_bytes),f=t(a,b+C.normal_coordinate_bytes*2),H.push(c/127,e/127,f/127);return C.nnormals*h}(F);F+=function(b){for(var e,f,k=C.uv_coordinate_bytes*2,l=b+C.nuvs*k;b<l;b+=k)e=c(a,b),f=c(a,b+C.uv_coordinate_bytes),L.push(e,f);return C.nuvs*k}(F);ra=F+ra;ia=ra+ia;da=ia+da;S=da+S;fa=S+fa;b=fa+b;ha=b+ha;(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes,e=c+C.uv_index_bytes*3,f=a+C.ntri_flat_uv*e;for(b=a;b<f;b+=e)p(b),u(b+c);
|
|
3,k=b+C.nnormals*h;b<k;b+=h)c=t(a,b),e=t(a,b+C.normal_coordinate_bytes),f=t(a,b+C.normal_coordinate_bytes*2),H.push(c/127,e/127,f/127);return C.nnormals*h}(F);F+=function(b){for(var e,f,k=C.uv_coordinate_bytes*2,l=b+C.nuvs*k;b<l;b+=k)e=c(a,b),f=c(a,b+C.uv_coordinate_bytes),L.push(e,f);return C.nuvs*k}(F);ra=F+ra;ia=ra+ia;da=ia+da;S=da+S;fa=S+fa;b=fa+b;ha=b+ha;(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes,e=c+C.uv_index_bytes*3,f=a+C.ntri_flat_uv*e;for(b=a;b<f;b+=e)p(b),u(b+c);
|
|
return f-a})(ia);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=c+C.uv_index_bytes*3,f=a+C.ntri_smooth_uv*e;for(b=a;b<f;b+=e)x(b),u(b+c);return f-a})(da);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes,e=c+C.uv_index_bytes*4,f=a+C.nquad_flat_uv*e;for(b=a;b<f;b+=e)w(b),B(b+c);return f-a})(b);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,e=c+C.uv_index_bytes*4,f=a+C.nquad_smooth_uv*e;for(b=a;b<
|
|
return f-a})(ia);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=c+C.uv_index_bytes*3,f=a+C.ntri_smooth_uv*e;for(b=a;b<f;b+=e)x(b),u(b+c);return f-a})(da);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes,e=c+C.uv_index_bytes*4,f=a+C.nquad_flat_uv*e;for(b=a;b<f;b+=e)w(b),B(b+c);return f-a})(b);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,e=c+C.uv_index_bytes*4,f=a+C.nquad_smooth_uv*e;for(b=a;b<
|
|
f;b+=e)z(b),B(b+c);return f-a})(ha);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes,e=a+C.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(F);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=a+C.ntri_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(ra);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes,e=a+C.nquad_flat*c;for(b=a;b<e;b+=c)w(b);return e-a})(S);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
|
|
f;b+=e)z(b),B(b+c);return f-a})(ha);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes,e=a+C.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(F);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=a+C.ntri_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(ra);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes,e=a+C.nquad_flat*c;for(b=a;b<e;b+=c)w(b);return e-a})(S);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
|
|
-4,e=a+C.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})(fa);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};l.prototype=new THREE.Geometry;l.prototype.constructor=l;c(new l(b))};
|
|
|
|
-THREE.ColladaLoader=function(){function a(a,e,l){ia=a;e=e||fa;l!==void 0&&(a=l.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");I=c("//dae:library_images/dae:image",h,"image");wa=c("//dae:library_materials/dae:material",O,"material");sa=c("//dae:library_effects/dae:effect",ea,"effect");ma=c("//dae:library_geometries/dae:geometry",B,"geometry");ka=c("//dae:library_controllers/dae:controller",k,"controller");Q=c("//dae:library_animations/dae:animation",Z,"animation");qa=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
|
|
+4,e=a+C.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})(fa);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k(b))};
|
|
|
|
+THREE.ColladaLoader=function(){function a(a,e,k){ia=a;e=e||fa;k!==void 0&&(a=k.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");I=c("//dae:library_images/dae:image",h,"image");wa=c("//dae:library_materials/dae:material",O,"material");sa=c("//dae:library_effects/dae:effect",ea,"effect");ma=c("//dae:library_geometries/dae:geometry",B,"geometry");ka=c("//dae:library_controllers/dae:controller",l,"controller");Q=c("//dae:library_animations/dae:animation",Z,"animation");qa=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
v,"visual_scene");ya=[];Aa=[];(a=ia.evaluate(".//dae:scene/dae:instance_visual_scene",ia,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=qa[a]):S=null;da=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)da.add(f(S.nodes[a]));b();for(var n in Q);n={scene:da,morphs:ya,skins:Aa,dae:{images:I,materials:wa,effects:sa,geometries:ma,controllers:ka,animations:Q,visualScenes:qa,scene:S}};e&&e(n);return n}function c(a,b,c){for(var a=ia.evaluate(a,ia,
|
|
v,"visual_scene");ya=[];Aa=[];(a=ia.evaluate(".//dae:scene/dae:instance_visual_scene",ia,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=qa[a]):S=null;da=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)da.add(f(S.nodes[a]));b();for(var n in Q);n={scene:da,morphs:ya,skins:Aa,dae:{images:I,materials:wa,effects:sa,geometries:ma,controllers:ka,animations:Q,visualScenes:qa,scene:S}};e&&e(n);return n}function c(a,b,c){for(var a=ia.evaluate(a,ia,
|
|
pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in Q)for(var f=Q[e],h=0;h<f.sampler.length;h++){var k=f.sampler[h];k.create();a=Math.min(a,k.startTime);b=Math.max(b,k.endTime);c=Math.max(c,k.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=
|
|
pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in Q)for(var f=Q[e],h=0;h<f.sampler.length;h++){var k=f.sampler[h];k.create();a=Math.min(a,k.startTime);b=Math.max(b,k.endTime);c=Math.max(c,k.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=
|
|
-a.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function l(a,c,f){var h=ka[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=b(),c=S.getChildById(c.skeleton[0],!0)||S.getChildBySid(c.skeleton[0],!0),l,n,o,p,t=new THREE.Vector3,
|
|
|
|
|
|
+a.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function k(a,c,f){var h=ka[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=b(),c=S.getChildById(c.skeleton[0],!0)||S.getChildBySid(c.skeleton[0],!0),l,n,o,p,t=new THREE.Vector3,
|
|
u;for(l=0;l<a.vertices.length;l++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(f=0;f<k.frames;f++){var v=[],w=[];for(l=0;l<a.vertices.length;l++)w.push(new THREE.Vertex(new THREE.Vector3));e(c,v,f);l=v;n=h.skin;for(p=0;p<l.length;p++)if(o=l[p],u=-1,o.type=="JOINT"){for(var x=0;x<n.joints.length;x++)if(o.sid==n.joints[x]){u=x;break}if(u>=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x<n.weights.length;x++)for(var y=
|
|
u;for(l=0;l<a.vertices.length;l++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(f=0;f<k.frames;f++){var v=[],w=[];for(l=0;l<a.vertices.length;l++)w.push(new THREE.Vertex(new THREE.Vector3));e(c,v,f);l=v;n=h.skin;for(p=0;p<l.length;p++)if(o=l[p],u=-1,o.type=="JOINT"){for(var x=0;x<n.joints.length;x++)if(o.sid==n.joints[x]){u=x;break}if(u>=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x<n.weights.length;x++)for(var y=
|
|
0;y<n.weights[x].length;y++){var z=n.weights[x][y];z.joint==u&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<v.length;l++)if(v[l].type=="JOINT")for(n=0;n<v[l].weights.length;n++)o=v[l].weights[n],p=o.index,o=o.weight,u=a.vertices[p],p=w[p],t.x=u.position.x,t.y=u.position.y,t.z=u.position.z,v[l].skinningMatrix.multiplyVector3(t),p.position.x+=t.x*o,p.position.y+=t.y*o,p.position.z+=t.z*o;a.morphTargets.push({name:"target_"+f,vertices:w})}}}function f(a){var b=
|
|
0;y<n.weights[x].length;y++){var z=n.weights[x][y];z.joint==u&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<v.length;l++)if(v[l].type=="JOINT")for(n=0;n<v[l].weights.length;n++)o=v[l].weights[n],p=o.index,o=o.weight,u=a.vertices[p],p=w[p],t.x=u.position.x,t.y=u.position.y,t.z=u.position.z,v[l].skinningMatrix.multiplyVector3(t),p.position.x+=t.x*o,p.position.y+=t.y*o,p.position.z+=t.z*o;a.morphTargets.push({name:"target_"+f,vertices:w})}}}function f(a){var b=
|
|
-new THREE.Object3D,c,e,h;for(h=0;h<a.controllers.length;h++){var k=ka[a.controllers[h].url];switch(k.type){case "skin":if(ma[k.skin.source]){var n=new u;n.url=k.skin.source;n.instance_material=a.controllers[h].instance_material;a.geometries.push(n);c=a.controllers[h]}else if(ka[k.skin.source]&&(e=k=ka[k.skin.source],k.morph&&ma[k.morph.source]))n=new u,n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n);break;case "morph":if(ma[k.morph.source])n=new u,
|
|
|
|
-n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n),e=a.controllers[h];console.log("ColladaLoader: Morph-controller partially supported.")}}for(h=0;h<a.geometries.length;h++){var k=a.geometries[h],n=k.instance_material,k=ma[k.url],o={},p=0,t;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(n)for(j=0;j<n.length;j++){t=n[j];var v=sa[wa[t.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;t=o[t.symbol]=
|
|
|
|
-v.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)p=k.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)l(k,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(k,n),n.skeleton=c.skeleton,n.skinController=ka[c.url],n.skinInstanceController=c,n.name="skin_"+Aa.length,Aa.push(n);else if(e!==void 0){o=k;p=e instanceof w?ka[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
|
|
|
|
-else{p=p.morph;for(v=0;v<p.targets.length;v++){var x=ma[p.targets[v]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:x.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(k,n);n.name="morph_"+ya.length;ya.push(n)}else n=new THREE.Mesh(k,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
|
-b.scale);for(h=0;h<a.nodes.length;h++)b.add(f(a.nodes[h],a));return b}function h(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function v(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
|
|
|
|
+new THREE.Object3D,c,e,h;for(h=0;h<a.controllers.length;h++){var l=ka[a.controllers[h].url];switch(l.type){case "skin":if(ma[l.skin.source]){var n=new u;n.url=l.skin.source;n.instance_material=a.controllers[h].instance_material;a.geometries.push(n);c=a.controllers[h]}else if(ka[l.skin.source]&&(e=l=ka[l.skin.source],l.morph&&ma[l.morph.source]))n=new u,n.url=l.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n);break;case "morph":if(ma[l.morph.source])n=new u,
|
|
|
|
+n.url=l.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n),e=a.controllers[h];console.log("ColladaLoader: Morph-controller partially supported.")}}for(h=0;h<a.geometries.length;h++){var l=a.geometries[h],n=l.instance_material,l=ma[l.url],o={},p=0,t;if(l&&l.mesh&&l.mesh.primitives){if(b.name.length==0)b.name=l.id;if(n)for(j=0;j<n.length;j++){t=n[j];var v=sa[wa[t.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;t=o[t.symbol]=
|
|
|
|
+v.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});l=l.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<l.faces.length;j++)p=l.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)k(l,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(l,n),n.skeleton=c.skeleton,n.skinController=ka[c.url],n.skinInstanceController=c,n.name="skin_"+Aa.length,Aa.push(n);else if(e!==void 0){o=l;p=e instanceof w?ka[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
|
|
|
|
+else{p=p.morph;for(v=0;v<p.targets.length;v++){var x=ma[p.targets[v]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:x.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(l,n);n.name="morph_"+ya.length;ya.push(n)}else n=new THREE.Mesh(l,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
|
+b.scale);for(h=0;h<a.nodes.length;h++)b.add(f(a.nodes[h],a));return b}function h(){this.init_from=this.id=""}function l(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function v(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function w(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function u(){this.url="";this.instance_material=[]}function B(){this.id="";this.mesh=null}function y(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function C(){this.material="";this.count=
|
|
[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function w(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function u(){this.url="";this.instance_material=[]}function B(){this.id="";this.mesh=null}function y(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function C(){this.material="";this.count=
|
|
0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function H(){this.source="";this.stride=this.count=0;this.params=[]}function L(){this.input={}}function R(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function O(){this.name=this.id="";this.instance_effect=null}function K(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function N(a,
|
|
0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function H(){this.source="";this.stride=this.count=0;this.params=[]}function L(){this.input={}}function R(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function O(){this.name=this.id="";this.instance_effect=null}function K(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function N(a,
|
|
b){this.type=a;this.effect=b;this.material=null}function J(a){this.effect=a;this.format=this.init_from=null}function M(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function ea(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function ja(){this.url=""}function Z(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function U(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
b){this.type=a;this.effect=b;this.material=null}function J(a){this.effect=a;this.format=this.init_from=null}function M(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function ea(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function ja(){this.url=""}function Z(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function U(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
this.dotSyntax=this.sid=null}function o(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function P(a){var b=a.getAttribute("id");if(ha[b]!=void 0)return ha[b];ha[b]=(new D(b)).parse(a);return ha[b]}function pa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function G(a){for(var a=aa(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function X(a){for(var a=aa(a),b=[],
|
|
this.dotSyntax=this.sid=null}function o(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function P(a){var b=a.getAttribute("id");if(ha[b]!=void 0)return ha[b];ha[b]=(new D(b)).parse(a);return ha[b]}function pa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function G(a){for(var a=aa(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function X(a){for(var a=aa(a),b=[],
|
|
c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function aa(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function na(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function la(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ra(a,b){var c="";c+=la(a.x,b)+",";c+=la(a.y,b)+",";c+=la(a.z,b);return c}var ia=null,da=null,
|
|
c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function aa(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function na(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function la(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ra(a,b){var c="";c+=la(a.x,b)+",";c+=la(a.y,b)+",";c+=la(a.z,b);return c}var ia=null,da=null,
|
|
-S,fa=null,ha={},I={},Q={},ka={},ma={},wa={},sa={},qa,Ea,ya,Aa,Ja=THREE.SmoothShading;h.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new t).parse(c);
|
|
|
|
|
|
+S,fa=null,ha={},I={},Q={},ka={},ma={},wa={},sa={},qa,Ea,ya,Aa,Ja=THREE.SmoothShading;h.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new t).parse(c);
|
|
this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new D).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],
|
|
this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new D).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],
|
|
a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new R).parse(e))}}return b};t.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];
|
|
a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new R).parse(e))}}return b};t.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];
|
|
if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=G(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new D).parse(h);b[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};t.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=
|
|
if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=G(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new D).parse(h);b[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};t.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=
|
|
@@ -629,18 +628,18 @@ this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.lengt
|
|
b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new R).parse(c))}}return this};
|
|
b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new R).parse(c))}}return this};
|
|
o.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
o.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
|
|
Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
|
|
-200))fa=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ja=a},applySkin:l,geometries:ma}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
-THREE.JSONLoader.prototype.load=function(a,c,b){var e,l=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){l.createModel(a.data,c,b);l.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,l=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,l,t,v,p,x,w,z,u,B,y,F,C,H=a.faces;p=a.vertices;var L=a.normals,R=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];t=0;for(v=p.length;t<v;)x=new THREE.Vertex,x.position.x=p[t++]*b,x.position.y=
|
|
|
|
-p[t++]*b,x.position.z=p[t++]*b,e.vertices.push(x);t=0;for(v=H.length;t<v;){b=H[t++];p=b&1;l=b&2;c=b&4;k=b&8;w=b&16;x=b&32;u=b&64;b&=128;p?(B=new THREE.Face4,B.a=H[t++],B.b=H[t++],B.c=H[t++],B.d=H[t++],p=4):(B=new THREE.Face3,B.a=H[t++],B.b=H[t++],B.c=H[t++],p=3);if(l)l=H[t++],B.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<D;c++)y=a.uvs[c],z=H[t++],C=y[z*2],z=y[z*2+1],e.faceUvs[c][l]=new THREE.UV(C,z);if(k)for(c=0;c<D;c++){y=a.uvs[c];F=[];for(k=0;k<p;k++)z=H[t++],C=y[z*2],z=y[z*2+1],F[k]=new THREE.UV(C,
|
|
|
|
-z);e.faceVertexUvs[c][l]=F}if(w)w=H[t++]*3,k=new THREE.Vector3,k.x=L[w++],k.y=L[w++],k.z=L[w],B.normal=k;if(x)for(c=0;c<p;c++)w=H[t++]*3,k=new THREE.Vector3,k.x=L[w++],k.y=L[w++],k.z=L[w],B.vertexNormals.push(k);if(u)x=H[t++],x=new THREE.Color(R[x]),B.color=x;if(b)for(c=0;c<p;c++)x=H[t++],x=new THREE.Color(R[x]),B.vertexColors.push(x);e.faces.push(B)}}})(l);(function(){var b,c,k,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)k=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(k,
|
|
|
|
-l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)k=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(k,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,k,l,t,v,p,x,w,z;c=0;for(k=a.morphTargets.length;c<k;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];w=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;l=0;for(t=z.length;l<t;l+=3)v=z[l]*b,p=z[l+1]*
|
|
|
|
-b,x=z[l+2]*b,w.push(new THREE.Vertex(new THREE.Vector3(v,p,x)))}}if(a.morphColors!==void 0){c=0;for(k=a.morphColors.length;c<k;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];t=e.morphColors[c].colors;v=a.morphColors[c].colors;b=0;for(l=v.length;b<l;b+=3)p=new THREE.Color(16755200),p.setRGB(v[b],v[b+1],v[b+2]),t.push(p)}}})(l);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
|
|
|
|
|
|
+200))fa=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ja=a},applySkin:k,geometries:ma}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
+THREE.JSONLoader.prototype.load=function(a,c,b){var e,k=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){k.createModel(a.data,c,b);k.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,k=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,n,t,v,p,x,w,z,u,B,y,F,C,H=a.faces;p=a.vertices;var L=a.normals,R=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];t=0;for(v=p.length;t<v;)x=new THREE.Vertex,x.position.x=p[t++]*b,x.position.y=
|
|
|
|
+p[t++]*b,x.position.z=p[t++]*b,e.vertices.push(x);t=0;for(v=H.length;t<v;){b=H[t++];p=b&1;n=b&2;c=b&4;k=b&8;w=b&16;x=b&32;u=b&64;b&=128;p?(B=new THREE.Face4,B.a=H[t++],B.b=H[t++],B.c=H[t++],B.d=H[t++],p=4):(B=new THREE.Face3,B.a=H[t++],B.b=H[t++],B.c=H[t++],p=3);if(n)n=H[t++],B.materialIndex=n;n=e.faces.length;if(c)for(c=0;c<D;c++)y=a.uvs[c],z=H[t++],C=y[z*2],z=y[z*2+1],e.faceUvs[c][n]=new THREE.UV(C,z);if(k)for(c=0;c<D;c++){y=a.uvs[c];F=[];for(k=0;k<p;k++)z=H[t++],C=y[z*2],z=y[z*2+1],F[k]=new THREE.UV(C,
|
|
|
|
+z);e.faceVertexUvs[c][n]=F}if(w)w=H[t++]*3,k=new THREE.Vector3,k.x=L[w++],k.y=L[w++],k.z=L[w],B.normal=k;if(x)for(c=0;c<p;c++)w=H[t++]*3,k=new THREE.Vector3,k.x=L[w++],k.y=L[w++],k.z=L[w],B.vertexNormals.push(k);if(u)x=H[t++],x=new THREE.Color(R[x]),B.color=x;if(b)for(c=0;c<p;c++)x=H[t++],x=new THREE.Color(R[x]),B.vertexColors.push(x);e.faces.push(B)}}})(k);(function(){var b,c,k,n;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)k=a.skinWeights[b],n=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(k,
|
|
|
|
+n,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)k=a.skinIndices[b],n=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(k,n,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,k,n,t,v,p,x,w,z;c=0;for(k=a.morphTargets.length;c<k;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];w=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;n=0;for(t=z.length;n<t;n+=3)v=z[n]*b,p=z[n+1]*
|
|
|
|
+b,x=z[n+2]*b,w.push(new THREE.Vertex(new THREE.Vector3(v,p,x)))}}if(a.morphColors!==void 0){c=0;for(k=a.morphColors.length;c<k;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];t=e.morphColors[c].colors;v=a.morphColors[c].colors;b=0;for(n=v.length;b<n;b+=3)p=new THREE.Color(16755200),p.setRGB(v[b],v[b+1],v[b+2]),t.push(p)}}})(k);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var l=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:l+"/"+a}function k(){for(w in M.objects)if(!P.objects[w])if(F=M.objects[w],F.geometry!==void 0){if(R=P.geometries[F.geometry]){var a=!1;for(G=0;G<F.materials.length;G++)N=P.materials[F.materials[G]],a=N instanceof THREE.ShaderMaterial;a&&R.computeTangents();C=F.position;r=F.rotation;q=F.quaternion;
|
|
|
|
|
|
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var k=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:k+"/"+a}function l(){for(w in M.objects)if(!P.objects[w])if(F=M.objects[w],F.geometry!==void 0){if(R=P.geometries[F.geometry]){var a=!1;for(G=0;G<F.materials.length;G++)N=P.materials[F.materials[G]],a=N instanceof THREE.ShaderMaterial;a&&R.computeTangents();C=F.position;r=F.rotation;q=F.quaternion;
|
|
s=F.scale;q=0;N.length==0&&(N=new THREE.MeshFaceMaterial);N.length>1&&(N=new THREE.MeshFaceMaterial);object=new THREE.Mesh(R,N);object.name=w;object.position.set(C[0],C[1],C[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=F.visible;P.scene.add(object);P.objects[w]=object;F.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(a));if(F.castsShadow)a=
|
|
s=F.scale;q=0;N.length==0&&(N=new THREE.MeshFaceMaterial);N.length>1&&(N=new THREE.MeshFaceMaterial);object=new THREE.Mesh(R,N);object.name=w;object.position.set(C[0],C[1],C[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=F.visible;P.scene.add(object);P.objects[w]=object;F.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(a));if(F.castsShadow)a=
|
|
new THREE.ShadowVolume(R),P.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(a={type:F.trigger,object:F},P.triggers[object.name]=a)}}else C=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(C[0],C[1],C[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=
|
|
new THREE.ShadowVolume(R),P.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(a={type:F.trigger,object:F},P.triggers[object.name]=a)}}else C=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(C[0],C[1],C[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=
|
|
-F.visible!==void 0?F.visible:!1,P.scene.add(object),P.objects[w]=object,P.empties[w]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(a={type:F.trigger,object:F},P.triggers[object.name]=a)}function n(a){return function(c){P.geometries[a]=c;k();ja-=1;b.onLoadComplete();v()}}function t(a){return function(b){P.geometries[a]=b}}function v(){b.callbackProgress({totalModels:U,totalTextures:o,loadedModels:U-ja,loadedTextures:o-Z},P);b.onLoadProgress();ja==0&&Z==0&&c(P)}var p,x,w,z,u,B,y,F,C,H,L,R,D,O,
|
|
|
|
|
|
+F.visible!==void 0?F.visible:!1,P.scene.add(object),P.objects[w]=object,P.empties[w]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(a={type:F.trigger,object:F},P.triggers[object.name]=a)}function n(a){return function(c){P.geometries[a]=c;l();ja-=1;b.onLoadComplete();v()}}function t(a){return function(b){P.geometries[a]=b}}function v(){b.callbackProgress({totalModels:U,totalTextures:o,loadedModels:U-ja,loadedTextures:o-Z},P);b.onLoadProgress();ja==0&&Z==0&&c(P)}var p,x,w,z,u,B,y,F,C,H,L,R,D,O,
|
|
K,N,J,M,ea,ja,Z,U,o,P;M=a.data;K=new THREE.BinaryLoader;ea=new THREE.JSONLoader;Z=ja=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(w in M.objects)if(F=M.objects[w],F.meshCollider){a=!0;break}if(a)P.scene.collisions=new THREE.CollisionSystem;if(M.transform){a=M.transform.position;H=M.transform.rotation;var pa=M.transform.scale;a&&P.scene.position.set(a[0],a[1],a[2]);H&&P.scene.rotation.set(H[0],H[1],H[2]);
|
|
K,N,J,M,ea,ja,Z,U,o,P;M=a.data;K=new THREE.BinaryLoader;ea=new THREE.JSONLoader;Z=ja=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(w in M.objects)if(F=M.objects[w],F.meshCollider){a=!0;break}if(a)P.scene.collisions=new THREE.CollisionSystem;if(M.transform){a=M.transform.position;H=M.transform.rotation;var pa=M.transform.scale;a&&P.scene.position.set(a[0],a[1],a[2]);H&&P.scene.rotation.set(H[0],H[1],H[2]);
|
|
pa&&P.scene.scale.set(pa[0],pa[1],pa[2]);(a||H||pa)&&P.scene.updateMatrix()}a=function(){Z-=1;v();b.onLoadComplete()};for(u in M.cameras)H=M.cameras[u],H.type=="perspective"?D=new THREE.PerspectiveCamera(H.fov,H.aspect,H.near,H.far):H.type=="ortho"&&(D=new THREE.OrthographicCamera(H.left,H.right,H.top,H.bottom,H.near,H.far)),C=H.position,H=H.target,D.position.set(C[0],C[1],C[2]),D.target=new THREE.Vector3(H[0],H[1],H[2]),P.cameras[u]=D;for(z in M.lights)u=M.lights[z],D=u.color!==void 0?u.color:16777215,
|
|
pa&&P.scene.scale.set(pa[0],pa[1],pa[2]);(a||H||pa)&&P.scene.updateMatrix()}a=function(){Z-=1;v();b.onLoadComplete()};for(u in M.cameras)H=M.cameras[u],H.type=="perspective"?D=new THREE.PerspectiveCamera(H.fov,H.aspect,H.near,H.far):H.type=="ortho"&&(D=new THREE.OrthographicCamera(H.left,H.right,H.top,H.bottom,H.near,H.far)),C=H.position,H=H.target,D.position.set(C[0],C[1],C[2]),D.target=new THREE.Vector3(H[0],H[1],H[2]),P.cameras[u]=D;for(z in M.lights)u=M.lights[z],D=u.color!==void 0?u.color:16777215,
|
|
H=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(C=u.direction,J=new THREE.DirectionalLight(D,H),J.position.set(C[0],C[1],C[2]),J.position.normalize()):u.type=="point"?(C=u.position,d=u.distance,J=new THREE.PointLight(D,H,d),J.position.set(C[0],C[1],C[2])):u.type=="ambient"&&(J=new THREE.AmbientLight(D)),P.scene.add(J),P.lights[z]=J;for(B in M.fogs)z=M.fogs[B],z.type=="linear"?O=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(O=new THREE.FogExp2(0,z.density)),H=z.color,O.color.setRGB(H[0],
|
|
H=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(C=u.direction,J=new THREE.DirectionalLight(D,H),J.position.set(C[0],C[1],C[2]),J.position.normalize()):u.type=="point"?(C=u.position,d=u.distance,J=new THREE.PointLight(D,H,d),J.position.set(C[0],C[1],C[2])):u.type=="ambient"&&(J=new THREE.AmbientLight(D)),P.scene.add(J),P.lights[z]=J;for(B in M.fogs)z=M.fogs[B],z.type=="linear"?O=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(O=new THREE.FogExp2(0,z.density)),H=z.color,O.color.setRGB(H[0],
|
|
@@ -651,28 +650,28 @@ void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){K=[];for(var G=
|
|
K.offset.set(p.offset[0],p.offset[1]);if(p.wrap){ea={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(ea[p.wrap[0]]!==void 0)K.wrapS=ea[p.wrap[0]];if(ea[p.wrap[1]]!==void 0)K.wrapT=ea[p.wrap[1]]}}P.textures[y]=K}for(x in M.materials){y=M.materials[x];for(L in y.parameters)if(L=="envMap"||L=="map"||L=="lightMap")y.parameters[L]=P.textures[y.parameters[L]];else if(L=="shading")y.parameters[L]=y.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")y.parameters[L]=
|
|
K.offset.set(p.offset[0],p.offset[1]);if(p.wrap){ea={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(ea[p.wrap[0]]!==void 0)K.wrapS=ea[p.wrap[0]];if(ea[p.wrap[1]]!==void 0)K.wrapT=ea[p.wrap[1]]}}P.textures[y]=K}for(x in M.materials){y=M.materials[x];for(L in y.parameters)if(L=="envMap"||L=="map"||L=="lightMap")y.parameters[L]=P.textures[y.parameters[L]];else if(L=="shading")y.parameters[L]=y.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")y.parameters[L]=
|
|
THREE[y.parameters[L]]?THREE[y.parameters[L]]:THREE.NormalBlending;else if(L=="combine")y.parameters[L]=y.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(y.parameters[L]=="face")y.parameters[L]=THREE.FaceColors;else if(y.parameters[L])y.parameters[L]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;if(y.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);
|
|
THREE[y.parameters[L]]?THREE[y.parameters[L]]:THREE.NormalBlending;else if(L=="combine")y.parameters[L]=y.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(y.parameters[L]=="face")y.parameters[L]=THREE.FaceColors;else if(y.parameters[L])y.parameters[L]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;if(y.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);
|
|
K=y.parameters.color;ea=y.parameters.specular;B=y.parameters.ambient;O=y.parameters.shininess;a.tNormal.texture=P.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=P.textures[y.parameters.specularMap],a.enableSpecular.value=!0;
|
|
K=y.parameters.color;ea=y.parameters.specular;B=y.parameters.ambient;O=y.parameters.shininess;a.tNormal.texture=P.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=P.textures[y.parameters.specularMap],a.enableSpecular.value=!0;
|
|
-a.uDiffuseColor.value.setHex(K);a.uSpecularColor.value.setHex(ea);a.uAmbientColor.value.setHex(B);a.uShininess.value=O;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);P.materials[x]=y}k();b.callbackSync(P);v()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
|
|
|
|
+a.uDiffuseColor.value.setHex(K);a.uSpecularColor.value.setHex(ea);a.uAmbientColor.value.setHex(B);a.uShininess.value=O;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);P.materials[x]=y}l();b.callbackSync(P);v()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
-THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,l=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,h=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
|
|
-c,l,f,h,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,l=0;l<8;l++){for(var f=0,h=0;h<c;++h){var k=a.charCodeAt(h+e);f+=k>>1^-(k&1);b[8*h+l]=f}e+=c}c=a.length-e;f=new Uint16Array(c);for(l=h=0;l<c;l++)k=a.charCodeAt(l+e),f[l]=h-k,k==0&&h++;return[b,f]};
|
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,l,f){var h=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var h=THREE.UTF8Loader.prototype.decompressMesh(a),t=[],v=[];(function(a,h,n){for(var t,u,v,y=a.length;n<y;n+=h)t=a[n],u=a[n+1],v=a[n+2],t=t/16383*b,u=u/16383*b,v=v/16383*b,t+=e,u+=l,v+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,v)))})(h[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,v.push(e,1-f)})(h[0],8,3);(function(a,
|
|
|
|
-b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,t.push(e,f,h)})(h[0],8,5);(function(a){var b,e,f,h,l,n,F,C,H,L=a.length;for(b=0;b<L;b+=3){e=a[b];f=a[b+1];h=a[b+2];l=c;C=e;H=f;n=h;F=e;var R=f,D=h,O=l.materials[0],K=t[R*3],N=t[R*3+1],R=t[R*3+2],J=t[D*3],M=t[D*3+1],D=t[D*3+2];F=new THREE.Vector3(t[F*3],t[F*3+1],t[F*3+2]);R=new THREE.Vector3(K,N,R);D=new THREE.Vector3(J,M,D);l.faces.push(new THREE.Face3(C,H,n,[F,R,D],null,O));l=v[e*2];e=v[e*2+
|
|
|
|
-1];n=v[f*2];F=v[f*2+1];C=v[h*2];H=v[h*2+1];h=c.faceVertexUvs[0];f=n;n=F;F=[];F.push(new THREE.UV(l,e));F.push(new THREE.UV(f,n));F.push(new THREE.UV(C,H));h.push(F)}})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)};
|
|
|
|
|
|
+THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,k=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,h=b.offsetY!==void 0?b.offsetY:0,l=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
|
|
+c,k,f,h,l):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,k=0;k<8;k++){for(var f=0,h=0;h<c;++h){var l=a.charCodeAt(h+e);f+=l>>1^-(l&1);b[8*h+k]=f}e+=c}c=a.length-e;f=new Uint16Array(c);for(k=h=0;k<c;k++)l=a.charCodeAt(k+e),f[k]=h-l,l==0&&h++;return[b,f]};
|
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,k,f){var h=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var h=THREE.UTF8Loader.prototype.decompressMesh(a),t=[],v=[];(function(a,h,n){for(var t,u,v,y=a.length;n<y;n+=h)t=a[n],u=a[n+1],v=a[n+2],t=t/16383*b,u=u/16383*b,v=v/16383*b,t+=e,u+=k,v+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,v)))})(h[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,v.push(e,1-f)})(h[0],8,3);(function(a,
|
|
|
|
+b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,t.push(e,f,h)})(h[0],8,5);(function(a){var b,e,f,h,k,n,F,C,H,L=a.length;for(b=0;b<L;b+=3){e=a[b];f=a[b+1];h=a[b+2];k=c;C=e;H=f;n=h;F=e;var R=f,D=h,O=k.materials[0],K=t[R*3],N=t[R*3+1],R=t[R*3+2],J=t[D*3],M=t[D*3+1],D=t[D*3+2];F=new THREE.Vector3(t[F*3],t[F*3+1],t[F*3+2]);R=new THREE.Vector3(K,N,R);D=new THREE.Vector3(J,M,D);k.faces.push(new THREE.Face3(C,H,n,[F,R,D],null,O));k=v[e*2];e=v[e*2+
|
|
|
|
+1];n=v[f*2];F=v[f*2+1];C=v[h*2];H=v[h*2+1];h=c.faceVertexUvs[0];f=n;n=F;F=[];F.push(new THREE.UV(k,e));F.push(new THREE.UV(f,n));F.push(new THREE.UV(C,H));h.push(F)}})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)};
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
|
|
b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;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=
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;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(a,c,l){return a+(c-a)*l};this.VIntX=function(a,c,l,f,h,k,n,t,v,p){h=(h-v)/(p-v);v=this.normal_cache;c[f]=k+h*this.delta;c[f+1]=n;c[f+2]=t;l[f]=this.lerp(v[a],v[a+3],h);l[f+1]=this.lerp(v[a+1],v[a+4],h);l[f+2]=this.lerp(v[a+2],v[a+5],h)};this.VIntY=function(a,c,l,f,h,k,n,t,v,p){h=(h-v)/(p-v);v=this.normal_cache;c[f]=k;c[f+1]=n+h*this.delta;c[f+
|
|
|
|
-2]=t;c=a+this.yd*3;l[f]=this.lerp(v[a],v[c],h);l[f+1]=this.lerp(v[a+1],v[c+1],h);l[f+2]=this.lerp(v[a+2],v[c+2],h)};this.VIntZ=function(a,c,l,f,h,k,n,t,v,p){h=(h-v)/(p-v);v=this.normal_cache;c[f]=k;c[f+1]=n;c[f+2]=t+h*this.delta;c=a+this.zd*3;l[f]=this.lerp(v[a],v[c],h);l[f+1]=this.lerp(v[a+1],v[c+1],h);l[f+2]=this.lerp(v[a+2],v[c+2],h)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
|
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,l,f,h,k){var n=f+1,t=f+this.yd,v=f+this.zd,p=n+this.yd,x=n+this.zd,w=f+this.yd+this.zd,z=n+this.yd+this.zd,u=0,B=this.field[f],y=this.field[n],F=this.field[t],C=this.field[p],H=this.field[v],L=this.field[x],R=this.field[w],D=this.field[z];B<h&&(u|=1);y<h&&(u|=2);F<h&&(u|=8);C<h&&(u|=4);H<h&&(u|=16);L<h&&(u|=32);R<h&&(u|=128);D<h&&(u|=64);var O=THREE.edgeTable[u];if(O===0)return 0;
|
|
|
|
-var K=this.delta,N=a+K,J=c+K,K=l+K;O&1&&(this.compNorm(f),this.compNorm(n),this.VIntX(f*3,this.vlist,this.nlist,0,h,a,c,l,B,y));O&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,h,N,c,l,y,C));O&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,h,a,J,l,F,C));O&8&&(this.compNorm(f),this.compNorm(t),this.VIntY(f*3,this.vlist,this.nlist,9,h,a,c,l,B,F));O&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,h,a,c,K,H,L));
|
|
|
|
-O&32&&(this.compNorm(x),this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,h,N,c,K,L,D));O&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,h,a,J,K,R,D));O&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,h,a,c,K,H,R));O&256&&(this.compNorm(f),this.compNorm(v),this.VIntZ(f*3,this.vlist,this.nlist,24,h,a,c,l,B,H));O&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,h,N,c,l,y,L));O&1024&&(this.compNorm(p),
|
|
|
|
-this.compNorm(z),this.VIntZ(p*3,this.vlist,this.nlist,30,h,N,J,l,C,D));O&2048&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*3,this.vlist,this.nlist,33,h,a,J,l,F,R));u<<=4;for(h=f=0;THREE.triTable[u+h]!=-1;)a=u+h,c=a+1,l=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[l],k),h+=3,f++;return f};this.posnormtriv=function(a,c,l,f,h,k){var n=this.count*3;this.positionArray[n]=a[l];this.positionArray[n+1]=a[l+1];this.positionArray[n+2]=a[l+2];this.positionArray[n+
|
|
|
|
-3]=a[f];this.positionArray[n+4]=a[f+1];this.positionArray[n+5]=a[f+2];this.positionArray[n+6]=a[h];this.positionArray[n+7]=a[h+1];this.positionArray[n+8]=a[h+2];this.normalArray[n]=c[l];this.normalArray[n+1]=c[l+1];this.normalArray[n+2]=c[l+2];this.normalArray[n+3]=c[f];this.normalArray[n+4]=c[f+1];this.normalArray[n+5]=c[f+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&&k(this)};this.begin=
|
|
|
|
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,l,f,h){var k=this.size*Math.sqrt(f/h),n=l*this.size,t=c*this.size,v=a*this.size,p=Math.floor(n-k);p<1&&(p=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var x=Math.floor(t-k);x<1&&(x=1);t=Math.floor(t+k);t>this.size-1&&(t=this.size-1);var w=Math.floor(v-k);w<1&&(w=1);k=Math.floor(v+k);
|
|
|
|
-k>this.size-1&&(k=this.size-1);for(var z,u,B,y,F,C;p<n;p++){v=this.size2*p;u=p/this.size-l;F=u*u;for(u=x;u<t;u++){B=v+this.size*u;z=u/this.size-c;C=z*z;for(z=w;z<k;z++)y=z/this.size-a,y=f/(1.0E-6+y*y+C+F)-h,y>0&&(this.field[B+z]+=y)}}};this.addPlaneX=function(a,c){var l,f,h,k,n,t=this.size,v=this.yd,p=this.zd,x=this.field,w=t*Math.sqrt(a/c);w>t&&(w=t);for(l=0;l<w;l++)if(f=l/t,f*=f,k=a/(1.0E-4+f)-c,k>0)for(f=0;f<t;f++){n=l+f*v;for(h=0;h<t;h++)x[p*h+n]+=k}};this.addPlaneY=function(a,c){var l,f,h,k,
|
|
|
|
-n,t,v=this.size,p=this.yd,x=this.zd,w=this.field,z=v*Math.sqrt(a/c);z>v&&(z=v);for(f=0;f<z;f++)if(l=f/v,l*=l,k=a/(1.0E-4+l)-c,k>0){n=f*p;for(l=0;l<v;l++){t=n+l;for(h=0;h<v;h++)w[x*h+t]+=k}}};this.addPlaneZ=function(a,c){var l,f,h,k,n,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(l=h/size,l*=l,k=a/(1.0E-4+l)-c,k>0){n=zd*h;for(f=0;f<size;f++){t=n+f*yd;for(l=0;l<size;l++)field[t+l]+=k}}};this.reset=function(){var a;for(a=
|
|
|
|
-0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,l,f,h,k,n,t,v,p,x=this.size-2;for(h=1;h<x;h++){p=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(f=1;f<x;f++){v=p+this.size*f;n=(f-this.halfsize)/this.halfsize;for(l=1;l<x;l++)k=(l-this.halfsize)/this.halfsize,c=v+l,this.polygonize(k,n,t,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,l=[];this.render(function(f){var h,k,n,t,v,p,x,w;for(h=0;h<f.count;h++)x=
|
|
|
|
-h*3,v=x+1,w=x+2,k=f.positionArray[x],n=f.positionArray[v],t=f.positionArray[w],p=new THREE.Vector3(k,n,t),k=f.normalArray[x],n=f.normalArray[v],t=f.normalArray[w],x=new THREE.Vector3(k,n,t),x.normalize(),v=new THREE.Vertex(p),c.vertices.push(v),l.push(x);nfaces=f.count/3;for(h=0;h<nfaces;h++)x=(a+h)*3,v=x+1,w=x+2,p=l[x],k=l[v],n=l[w],x=new THREE.Face3(x,v,w,[p,k,n]),c.faces.push(x);a+=nfaces;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
|
|
|
|
|
|
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,k){return a+(c-a)*k};this.VIntX=function(a,c,k,f,h,l,n,t,v,p){h=(h-v)/(p-v);v=this.normal_cache;c[f]=l+h*this.delta;c[f+1]=n;c[f+2]=t;k[f]=this.lerp(v[a],v[a+3],h);k[f+1]=this.lerp(v[a+1],v[a+4],h);k[f+2]=this.lerp(v[a+2],v[a+5],h)};this.VIntY=function(a,c,k,f,h,l,n,t,v,p){h=(h-v)/(p-v);v=this.normal_cache;c[f]=l;c[f+1]=n+h*this.delta;c[f+
|
|
|
|
+2]=t;c=a+this.yd*3;k[f]=this.lerp(v[a],v[c],h);k[f+1]=this.lerp(v[a+1],v[c+1],h);k[f+2]=this.lerp(v[a+2],v[c+2],h)};this.VIntZ=function(a,c,k,f,h,l,n,t,v,p){h=(h-v)/(p-v);v=this.normal_cache;c[f]=l;c[f+1]=n;c[f+2]=t+h*this.delta;c=a+this.zd*3;k[f]=this.lerp(v[a],v[c],h);k[f+1]=this.lerp(v[a+1],v[c+1],h);k[f+2]=this.lerp(v[a+2],v[c+2],h)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
|
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,k,f,h,l){var n=f+1,t=f+this.yd,v=f+this.zd,p=n+this.yd,x=n+this.zd,w=f+this.yd+this.zd,z=n+this.yd+this.zd,u=0,B=this.field[f],y=this.field[n],F=this.field[t],C=this.field[p],H=this.field[v],L=this.field[x],R=this.field[w],D=this.field[z];B<h&&(u|=1);y<h&&(u|=2);F<h&&(u|=8);C<h&&(u|=4);H<h&&(u|=16);L<h&&(u|=32);R<h&&(u|=128);D<h&&(u|=64);var O=THREE.edgeTable[u];if(O===0)return 0;
|
|
|
|
+var K=this.delta,N=a+K,J=c+K,K=k+K;O&1&&(this.compNorm(f),this.compNorm(n),this.VIntX(f*3,this.vlist,this.nlist,0,h,a,c,k,B,y));O&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,h,N,c,k,y,C));O&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,h,a,J,k,F,C));O&8&&(this.compNorm(f),this.compNorm(t),this.VIntY(f*3,this.vlist,this.nlist,9,h,a,c,k,B,F));O&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,h,a,c,K,H,L));
|
|
|
|
+O&32&&(this.compNorm(x),this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,h,N,c,K,L,D));O&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,h,a,J,K,R,D));O&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,h,a,c,K,H,R));O&256&&(this.compNorm(f),this.compNorm(v),this.VIntZ(f*3,this.vlist,this.nlist,24,h,a,c,k,B,H));O&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,h,N,c,k,y,L));O&1024&&(this.compNorm(p),
|
|
|
|
+this.compNorm(z),this.VIntZ(p*3,this.vlist,this.nlist,30,h,N,J,k,C,D));O&2048&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*3,this.vlist,this.nlist,33,h,a,J,k,F,R));u<<=4;for(h=f=0;THREE.triTable[u+h]!=-1;)a=u+h,c=a+1,k=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[k],l),h+=3,f++;return f};this.posnormtriv=function(a,c,k,f,h,l){var n=this.count*3;this.positionArray[n]=a[k];this.positionArray[n+1]=a[k+1];this.positionArray[n+2]=a[k+2];this.positionArray[n+
|
|
|
|
+3]=a[f];this.positionArray[n+4]=a[f+1];this.positionArray[n+5]=a[f+2];this.positionArray[n+6]=a[h];this.positionArray[n+7]=a[h+1];this.positionArray[n+8]=a[h+2];this.normalArray[n]=c[k];this.normalArray[n+1]=c[k+1];this.normalArray[n+2]=c[k+2];this.normalArray[n+3]=c[f];this.normalArray[n+4]=c[f+1];this.normalArray[n+5]=c[f+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&&l(this)};this.begin=
|
|
|
|
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,k,f,h){var l=this.size*Math.sqrt(f/h),n=k*this.size,t=c*this.size,v=a*this.size,p=Math.floor(n-l);p<1&&(p=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var x=Math.floor(t-l);x<1&&(x=1);t=Math.floor(t+l);t>this.size-1&&(t=this.size-1);var w=Math.floor(v-l);w<1&&(w=1);l=Math.floor(v+l);
|
|
|
|
+l>this.size-1&&(l=this.size-1);for(var z,u,B,y,F,C;p<n;p++){v=this.size2*p;u=p/this.size-k;F=u*u;for(u=x;u<t;u++){B=v+this.size*u;z=u/this.size-c;C=z*z;for(z=w;z<l;z++)y=z/this.size-a,y=f/(1.0E-6+y*y+C+F)-h,y>0&&(this.field[B+z]+=y)}}};this.addPlaneX=function(a,c){var k,f,h,l,n,t=this.size,v=this.yd,p=this.zd,x=this.field,w=t*Math.sqrt(a/c);w>t&&(w=t);for(k=0;k<w;k++)if(f=k/t,f*=f,l=a/(1.0E-4+f)-c,l>0)for(f=0;f<t;f++){n=k+f*v;for(h=0;h<t;h++)x[p*h+n]+=l}};this.addPlaneY=function(a,c){var k,f,h,l,
|
|
|
|
+n,t,v=this.size,p=this.yd,x=this.zd,w=this.field,z=v*Math.sqrt(a/c);z>v&&(z=v);for(f=0;f<z;f++)if(k=f/v,k*=k,l=a/(1.0E-4+k)-c,l>0){n=f*p;for(k=0;k<v;k++){t=n+k;for(h=0;h<v;h++)w[x*h+t]+=l}}};this.addPlaneZ=function(a,c){var k,f,h,l,n,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(k=h/size,k*=k,l=a/(1.0E-4+k)-c,l>0){n=zd*h;for(f=0;f<size;f++){t=n+f*yd;for(k=0;k<size;k++)field[t+k]+=l}}};this.reset=function(){var a;for(a=
|
|
|
|
+0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,k,f,h,l,n,t,v,p,x=this.size-2;for(h=1;h<x;h++){p=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(f=1;f<x;f++){v=p+this.size*f;n=(f-this.halfsize)/this.halfsize;for(k=1;k<x;k++)l=(k-this.halfsize)/this.halfsize,c=v+k,this.polygonize(l,n,t,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,k=[];this.render(function(f){var h,l,n,t,v,p,x,w;for(h=0;h<f.count;h++)x=
|
|
|
|
+h*3,v=x+1,w=x+2,l=f.positionArray[x],n=f.positionArray[v],t=f.positionArray[w],p=new THREE.Vector3(l,n,t),l=f.normalArray[x],n=f.normalArray[v],t=f.normalArray[w],x=new THREE.Vector3(l,n,t),x.normalize(),v=new THREE.Vertex(p),c.vertices.push(v),k.push(x);nfaces=f.count/3;for(h=0;h<nfaces;h++)x=(a+h)*3,v=x+1,w=x+2,p=k[x],l=k[v],n=k[w],x=new THREE.Face3(x,v,w,[p,l,n]),c.faces.push(x);a+=nfaces;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
|
|
THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
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,
|
|
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,
|
|
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,
|
|
@@ -699,23 +698,23 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
|
|
-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,
|
|
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
|
|
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
|
|
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
|
|
THREE.MeshCollider=function(a,c){this.mesh=a;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(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
|
|
THREE.MeshCollider=function(a,c){this.mesh=a;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(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
|
|
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,l,f=0;c=0;for(b=this.colliders.length;c<b;c++)if(l=this.colliders[c],e=this.rayCast(a,l),e<Number.MAX_VALUE)l.distance=e,e>f?this.hits.push(l):this.hits.unshift(l),f=e;return this.hits};
|
|
|
|
|
|
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,k,f=0;c=0;for(b=this.colliders.length;c<b;c++)if(k=this.colliders[c],e=this.rayCast(a,k),e<Number.MAX_VALUE)k.distance=e,e>f?this.hits.push(k):this.hits.unshift(k),f=e;return this.hits};
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
|
|
THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
|
|
THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,l,f=0;f<c.numFaces;f++){var h=c.mesh.geometry.faces[f],k=c.mesh.geometry.vertices[h.a].position,n=c.mesh.geometry.vertices[h.b].position,t=c.mesh.geometry.vertices[h.c].position,v=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(b,k,n,t,e,this.collisionNormal,c.mesh),h<e&&(e=h,l=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
|
-h instanceof THREE.Face4&&(h=this.rayTriangle(b,k,n,v,e,this.collisionNormal,c.mesh),h<e&&(e=h,l=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(b,n,t,v,e,this.collisionNormal,c.mesh),h<e&&(e=h,l=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:l}};
|
|
|
|
-THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,l,f,h){var k=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;f.set(0,0,0);k.sub(b,c);n.sub(e,b);f.cross(k,n);k=f.dot(a.direction);if(!(k<0))if(h.doubleSided||h.flipSided)f.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;h=f.dot(c)-f.dot(a.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=k*l))return Number.MAX_VALUE;h/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(h);k.addSelf(a.origin);Math.abs(f.x)>
|
|
|
|
-Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=k.y-c.y,f=b.y-c.y,l=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,f=b.x-c.x,l=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=k.x-c.x,f=b.x-c.x,l=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,f=b.x-c.x,l=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=f*e-b*l;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*l)*c;if(!(e>=0))return Number.MAX_VALUE;c*=f*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return h};
|
|
|
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,k,f=0;f<c.numFaces;f++){var h=c.mesh.geometry.faces[f],l=c.mesh.geometry.vertices[h.a].position,n=c.mesh.geometry.vertices[h.b].position,t=c.mesh.geometry.vertices[h.c].position,v=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(b,l,n,t,e,this.collisionNormal,c.mesh),h<e&&(e=h,k=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
|
+h instanceof THREE.Face4&&(h=this.rayTriangle(b,l,n,v,e,this.collisionNormal,c.mesh),h<e&&(e=h,k=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(b,n,t,v,e,this.collisionNormal,c.mesh),h<e&&(e=h,k=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:k}};
|
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,k,f,h){var l=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;f.set(0,0,0);l.sub(b,c);n.sub(e,b);f.cross(l,n);l=f.dot(a.direction);if(!(l<0))if(h.doubleSided||h.flipSided)f.multiplyScalar(-1),l*=-1;else return Number.MAX_VALUE;h=f.dot(c)-f.dot(a.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=l*k))return Number.MAX_VALUE;h/=l;l=THREE.CollisionSystem.__v3;l.copy(a.direction);l.multiplyScalar(h);l.addSelf(a.origin);Math.abs(f.x)>
|
|
|
|
+Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=l.y-c.y,f=b.y-c.y,k=e.y-c.y,l=l.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=l.x-c.x,f=b.x-c.x,k=e.x-c.x,l=l.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=l.x-c.x,f=b.x-c.x,k=e.x-c.x,l=l.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=l.x-c.x,f=b.x-c.x,k=e.x-c.x,l=l.y-c.y,b=b.y-c.y,e=e.y-c.y);c=f*e-b*k;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-l*k)*c;if(!(e>=0))return Number.MAX_VALUE;c*=f*l-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return h};
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
|
|
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,l=0,f=0,h=0,k=0,n=0,t=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,t=!1,h=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,t=!1,h=1);b.origin.y<c.min.y?(l=c.min.y-b.origin.y,l/=b.direction.y,t=!1,k=-1):b.origin.y>c.max.y&&(l=c.max.y-b.origin.y,l/=b.direction.y,
|
|
|
|
-t=!1,k=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,t=!1,n=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,t=!1,n=1);if(t)return-1;t=0;l>e&&(t=1,e=l);f>e&&(t=2,e=f);switch(t){case 0:k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=b.origin.x+b.direction.x*e;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
|
|
-e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:h=b.origin.x+b.direction.x*e;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
|
|
|
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,k=0,f=0,h=0,l=0,n=0,t=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,t=!1,h=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,t=!1,h=1);b.origin.y<c.min.y?(k=c.min.y-b.origin.y,k/=b.direction.y,t=!1,l=-1):b.origin.y>c.max.y&&(k=c.max.y-b.origin.y,k/=b.direction.y,
|
|
|
|
+t=!1,l=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,t=!1,n=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,t=!1,n=1);if(t)return-1;t=0;k>e&&(t=1,e=k);f>e&&(t=2,e=f);switch(t){case 0:l=b.origin.y+b.direction.y*e;if(l<c.min.y||l>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=b.origin.x+b.direction.x*e;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
|
|
+e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,l,0);break;case 2:h=b.origin.x+b.direction.x*e;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;l=b.origin.y+b.direction.y*e;if(l<c.min.y||l>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
|
|
THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,l=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,h=new THREE.Matrix4,k=new THREE.Matrix4,n,t,v,p;l.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),w=new THREE.WebGLRenderTarget(512,512,a),z=new THREE.PerspectiveCamera(53,
|
|
|
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,k=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,h=new THREE.Matrix4,l=new THREE.Matrix4,n,t,v,p;k.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),w=new THREE.WebGLRenderTarget(512,512,a),z=new THREE.PerspectiveCamera(53,
|
|
1,1,1E4);z.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:x},mapRight:{type:"t",value:1,texture:w}},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}"});
|
|
1,1,1E4);z.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:x},mapRight:{type:"t",value:1,texture:w}},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 u=new THREE.Scene;u.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));u.add(z);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;w.width=a;w.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||t!==b.near||v!==b.far||p!==b.fov){n=b.aspect;t=b.near;v=b.far;p=b.fov;var F=b.projectionMatrix.clone(),C=125/30*0.5,H=C*t/125,L=t*Math.tan(p*Math.PI/360),R;h.n14=C;k.n14=-C;C=-L*n+H;R=L*n+H;F.n11=2*t/(R-C);F.n13=(R+C)/(R-C);l.projectionMatrix.copy(F);C=-L*n-H;
|
|
|
|
-R=L*n-H;F.n11=2*t/(R-C);F.n13=(R+C)/(R-C);f.projectionMatrix.copy(F)}l.matrixWorld.copy(b.matrixWorld).multiplySelf(k);l.position.copy(b.position);l.near=b.near;l.far=b.far;e.call(c,a,l,x,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;e.call(c,a,f,w,!0);u.updateMatrixWorld();e.call(c,u,z)}};
|
|
|
|
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,l,f,h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);l=a/2;f=e};this.render=function(a,b){this.clear();h.fov=b.fov;h.aspect=0.5*b.aspect;h.near=b.near;h.far=
|
|
|
|
-b.far;h.updateProjectionMatrix();h.position.copy(b.position);h.target.copy(b.target);h.translateX(c.separation);h.lookAt(h.target);k.projectionMatrix=h.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,l,f);e.call(c,a,h);this.setViewport(l,0,l,f);e.call(c,a,k,!1)}};
|
|
|
|
|
|
+var u=new THREE.Scene;u.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));u.add(z);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;w.width=a;w.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||t!==b.near||v!==b.far||p!==b.fov){n=b.aspect;t=b.near;v=b.far;p=b.fov;var F=b.projectionMatrix.clone(),C=125/30*0.5,H=C*t/125,L=t*Math.tan(p*Math.PI/360),R;h.n14=C;l.n14=-C;C=-L*n+H;R=L*n+H;F.n11=2*t/(R-C);F.n13=(R+C)/(R-C);k.projectionMatrix.copy(F);C=-L*n-H;
|
|
|
|
+R=L*n-H;F.n11=2*t/(R-C);F.n13=(R+C)/(R-C);f.projectionMatrix.copy(F)}k.matrixWorld.copy(b.matrixWorld).multiplySelf(l);k.position.copy(b.position);k.near=b.near;k.far=b.far;e.call(c,a,k,x,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;e.call(c,a,f,w,!0);u.updateMatrixWorld();e.call(c,u,z)}};
|
|
|
|
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,k,f,h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);var l=new THREE.PerspectiveCamera;l.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);k=a/2;f=e};this.render=function(a,b){this.clear();h.fov=b.fov;h.aspect=0.5*b.aspect;h.near=b.near;h.far=
|
|
|
|
+b.far;h.updateProjectionMatrix();h.position.copy(b.position);h.target.copy(b.target);h.translateX(c.separation);h.lookAt(h.target);l.projectionMatrix=h.projectionMatrix;l.position.copy(b.position);l.target.copy(b.target);l.translateX(-c.separation);l.lookAt(l.target);this.setViewport(0,0,k,f);e.call(c,a,h);this.setViewport(k,0,k,f);e.call(c,a,l,!1)}};
|