|
@@ -4,46 +4,43 @@ THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this
|
|
|
setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+
|
|
|
this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
|
|
|
THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
|
|
|
-this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};
|
|
|
-THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},set x(d){this.that.x=d;this.isDirty=!0},set y(d){this.that.y=d;this.isDirty=!0},set z(d){this.that.z=d;this.isDirty=!0}};this.api.__proto__=THREE.Vector3.prototype;return this.api};
|
|
|
-THREE.Vector3.prototype={set:function(a,b,c){var d=this.that;d.x=a;d.y=b;d.z=c;this.isDirty=!0;return this},copy:function(a){var b=this.that;b.x=a.x;b.y=a.y;b.z=a.z;this.isDirty=!0;return this},add:function(a,b){var c=this.that;c.x=a.x+b.x;c.y=a.y+b.y;c.z=a.z+b.z;this.isDirty=!0;return this},addSelf:function(a){var b=this.that;b.x+=a.x;b.y+=a.y;b.z+=a.z;this.isDirty=!0;return this},addScalar:function(a){var b=this.that;b.x+=a;b.y+=a;b.z+=a;this.isDirty=!0;return this},sub:function(a,b){var c=this.that;
|
|
|
-c.x=a.x-b.x;c.y=a.y-b.y;c.z=a.z-b.z;this.isDirty=!0;return this},subSelf:function(a){var b=this.that;b.x-=a.x;b.y-=a.y;b.z-=a.z;this.isDirty=!0;return this},cross:function(a,b){var c=this.that;c.x=a.y*b.z-a.z*b.y;c.y=a.z*b.x-a.x*b.z;c.z=a.x*b.y-a.y*b.x;this.isDirty=!0;return this},crossSelf:function(a){var b=this.that,c=b.x,d=b.y,f=b.z;b.x=d*a.z-f*a.y;b.y=f*a.x-c*a.z;b.z=c*a.y-d*a.x;this.isDirty=!0;return this},multiply:function(a,b){var c=this.that;c.x=a.x*b.x;c.y=a.y*b.y;c.z=a.z*b.z;this.isDirty=
|
|
|
-!0;return this},multiplySelf:function(a){var b=this.that;b.x*=a.x;b.y*=a.y;b.z*=a.z;this.isDirty=!0;return this},multiplyScalar:function(a){var b=this.that;b.x*=a;b.y*=a;b.z*=a;this.isDirty=!0;return this},divideSelf:function(a){var b=this.that;b.x/=a.x;b.y/=a.y;b.z/=a.z;this.isDirty=!0;return this},divideScalar:function(a){var b=this.that;b.x/=a;b.y/=a;b.z/=a;this.isDirty=!0;return this},dot:function(a){var b=this.that;return b.x*a.x+b.y*a.y+b.z*a.z},distanceTo:function(a){var b=this.that,c=b.x-
|
|
|
-a.x,d=b.y-a.y;a=b.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var b=this.that,c=b.x-a.x,d=b.y-a.y;a=b.z-a.z;return c*c+d*d+a*a},length:function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z)},lengthSq:function(){var a=this.that;return a.x*a.x+a.y*a.y+a.z*a.z},lengthManhattan:function(){var a=this.that;return a.x+a.y+a.z},negate:function(){var a=this.that;a.x=-this.x;a.y=-this.y;a.z=-this.z;this.isDirty=!0;return this},normalize:function(){var a=this.that;a=Math.sqrt(a.x*
|
|
|
-a.x+a.y*a.y+a.z*a.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);this.isDirty=!0;return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){var a=this.that;return Math.abs(a.x)<1.0E-4&&Math.abs(a.y)<1.0E-4&&Math.abs(a.z)<1.0E-4},clone:function(){var a=this.that;return new THREE.Vector3(a.x,a.y,a.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
|
|
|
-THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==undefined?d:1};
|
|
|
+this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
|
|
|
+THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
|
|
|
+cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
|
|
|
+a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+c*c+a*a)},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+
|
|
|
+this.y+this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+
|
|
|
+this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d||1};
|
|
|
THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
|
|
|
return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
|
THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(C,o,e,t){t=t.clone().subSelf(o);e=e.clone().subSelf(o);var N=C.clone().subSelf(o);C=t.dot(t);o=t.dot(e);t=t.dot(N);var Q=e.dot(e);e=e.dot(N);N=1/(C*Q-o*o);Q=(Q*t-o*e)*N;C=(C*e-o*t)*N;return Q>0&&C>0&&Q+C<1}var c,d,f,g,h,k,j,m,n,w,
|
|
|
-u,q=a.geometry,x=q.vertices,z=[];c=0;for(d=q.faces.length;c<d;c++){f=q.faces[c];w=this.origin.clone();u=this.direction.clone();g=a.matrix.multiplyVector3(x[f.a].position.clone());h=a.matrix.multiplyVector3(x[f.b].position.clone());k=a.matrix.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?a.matrix.multiplyVector3(x[f.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(f.normal.clone());n=u.dot(m);if(n<0){m=m.dot((new THREE.Vector3).sub(g,w))/n;w=w.addSelf(u.multiplyScalar(m));
|
|
|
-if(f instanceof THREE.Face3){if(b(w,g,h,k)){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};z.push(f)}}else if(f instanceof THREE.Face4&&(b(w,g,h,j)||b(w,h,k,j))){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};z.push(f)}}}return z}};
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(F,u,e,q){q=q.clone().subSelf(u);e=e.clone().subSelf(u);var O=F.clone().subSelf(u);F=q.dot(q);u=q.dot(e);q=q.dot(O);var R=e.dot(e);e=e.dot(O);O=1/(F*R-u*u);R=(R*q-u*e)*O;F=(F*e-u*q)*O;return R>0&&F>0&&R+F<1}var c,d,f,g,h,k,j,m,n,w,
|
|
|
+t,p=a.geometry,x=p.vertices,z=[];c=0;for(d=p.faces.length;c<d;c++){f=p.faces[c];w=this.origin.clone();t=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.rotationMatrix);g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(f.normal.clone());n=t.dot(m);if(n<0){m=m.dot((new THREE.Vector3).sub(g,
|
|
|
+w))/n;w=w.addSelf(t.multiplyScalar(m));if(f instanceof THREE.Face3){if(b(w,g,h,k)){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};z.push(f)}}else if(f instanceof THREE.Face4&&(b(w,g,h,j)||b(w,h,k,j))){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};z.push(f)}}}return z}};
|
|
|
THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,n,w){k=!1;b=j;c=m;d=n;f=w;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
|
|
|
-this.add3Points=function(j,m,n,w,u,q){if(k){k=!1;b=j<n?j<u?j:u:n<u?n:u;c=m<w?m<q?m:q:w<q?w:q;d=j>n?j>u?j:u:n>u?n:u;f=m>w?m>q?m:q:w>q?w:q}else{b=j<n?j<u?j<b?j:b:u<b?u:b:n<u?n<b?n:b:u<b?u:b;c=m<w?m<q?m<c?m:c:q<c?q:c:w<q?w<c?w:c:q<c?q:c;d=j>n?j>u?j>d?j:d:u>d?u:d:n>u?n>d?n:d:u>d?u:d;f=m>w?m>q?m>f?m:f:q>f?q:f:w>q?w>f?w:f:q>f?q:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
|
|
|
+this.add3Points=function(j,m,n,w,t,p){if(k){k=!1;b=j<n?j<t?j:t:n<t?n:t;c=m<w?m<p?m:p:w<p?w:p;d=j>n?j>t?j:t:n>t?n:t;f=m>w?m>p?m:p:w>p?w:p}else{b=j<n?j<t?j<b?j:b:t<b?t:b:n<t?n<b?n:b:t<b?t:b;c=m<w?m<p?m<c?m:c:p<c?p:c:w<p?w<c?w:c:p<c?p:c;d=j>n?j>t?j>d?j:d:t>d?t:d:n>t?n>d?n:d:t>d?t:d;f=m>w?m>p?m>f?m:f:p>f?p:f:w>p?w>f?w:f:p>f?p:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
|
|
|
d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;d+=j;f+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();d=d<j.getRight()?d:j.getRight();f=f<j.getBottom()?f:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(b,j.getLeft())>=0&&Math.min(f,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=!0;f=d=c=b=0;a()};this.isEmpty=function(){return k};this.toString=function(){return"THREE.Rectangle ( left: "+
|
|
|
b+", right: "+d+", top: "+c+", bottom: "+f+", width: "+g+", height: "+h+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
|
-THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,n,w,u,q,x,z){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=d||0;this.n21=f||0;this.n22=g||1;this.n23=h||0;this.n24=k||0;this.n31=j||0;this.n32=m||0;this.n33=n||1;this.n34=w||0;this.n41=u||0;this.n42=q||0;this.n43=x||0;this.n44=z||1;this.flat=Array(16);this.m33=new THREE.Matrix3;if(typeof Float32Array!=="undefined"){var C=this;this.float32Array=new Float32Array(16);this.float32Array3x3=new Float32Array(9);this.flatten32=function(){var o=C.float32Array;
|
|
|
-o[0]=C.n11;o[1]=C.n21;o[2]=C.n31;o[3]=C.n41;o[4]=C.n12;o[5]=C.n22;o[6]=C.n32;o[7]=C.n42;o[8]=C.n13;o[9]=C.n23;o[10]=C.n33;o[11]=C.n43;o[12]=C.n14;o[13]=C.n24;o[14]=C.n34;o[15]=C.n44;return o};this.flatten323x3=function(){var o=C.float32Array3x3;o[0]=C.n11;o[1]=C.n21;o[2]=C.n31;o[3]=C.n12;o[4]=C.n22;o[5]=C.n32;o[6]=C.n13;o[7]=C.n23;o[8]=C.n33;return o}}};
|
|
|
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,d,f,g,h,k,j,m,n,w,u,q,x,z){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=n;this.n34=w;this.n41=u;this.n42=q;this.n43=x;this.n44=z;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
|
+THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,n,w,t,p,x,z){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=d||0;this.n21=f||0;this.n22=g||1;this.n23=h||0;this.n24=k||0;this.n31=j||0;this.n32=m||0;this.n33=n||1;this.n34=w||0;this.n41=t||0;this.n42=p||0;this.n43=x||0;this.n44=z||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,d,f,g,h,k,j,m,n,w,t,p,x,z){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=n;this.n34=w;this.n41=t;this.n42=p;this.n43=x;this.n44=z;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
|
a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a);
|
|
|
this.n31=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
|
|
|
a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*
|
|
|
-a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,u=a.n33,q=a.n34,x=a.n41,z=a.n42,C=a.n43,o=a.n44,e=b.n11,t=b.n12,N=b.n13,Q=b.n14,ea=b.n21,L=b.n22,G=b.n23,Y=b.n24,T=b.n31,da=b.n32,Z=b.n33,H=b.n34,aa=b.n41,na=b.n42,ba=b.n43,l=b.n44;this.n11=c*e+d*ea+f*T+g*aa;this.n12=c*t+d*L+f*da+g*na;this.n13=c*N+d*G+f*Z+g*ba;this.n14=c*Q+d*Y+f*H+g*l;this.n21=h*e+k*ea+j*T+m*aa;this.n22=h*t+k*L+j*da+m*na;
|
|
|
-this.n23=h*N+k*G+j*Z+m*ba;this.n24=h*Q+k*Y+j*H+m*l;this.n31=n*e+w*ea+u*T+q*aa;this.n32=n*t+w*L+u*da+q*na;this.n33=n*N+w*G+u*Z+q*ba;this.n34=n*Q+w*Y+u*H+q*l;this.n41=x*e+z*ea+C*T+o*aa;this.n42=x*t+z*L+C*da+o*na;this.n43=x*N+z*G+C*Z+o*ba;this.n44=x*Q+z*Y+C*H+o*l;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,n=a.n24,w=a.n31,u=a.n32,q=a.n33,x=a.n34,z=a.n41,C=a.n42,o=a.n43;a=a.n44;var e=b.n11,t=b.n12,N=b.n13,Q=b.n14,ea=b.n21,L=b.n22,G=b.n23,Y=
|
|
|
-b.n24,T=b.n31,da=b.n32,Z=b.n33,H=b.n34,aa=b.n41,na=b.n42,ba=b.n43;b=b.n44;this.n11=d*e+f*ea+g*T+h*aa;this.n12=d*t+f*L+g*da+h*na;this.n13=d*N+f*G+g*Z+h*ba;this.n14=d*Q+f*Y+g*H+h*b;this.n21=k*e+j*ea+m*T+n*aa;this.n22=k*t+j*L+m*da+n*na;this.n23=k*N+j*G+m*Z+n*ba;this.n24=k*Q+j*Y+m*H+n*b;this.n31=w*e+u*ea+q*T+x*aa;this.n32=w*t+u*L+q*da+x*na;this.n33=w*N+u*G+q*Z+x*ba;this.n34=w*Q+u*Y+q*H+x*b;this.n41=z*e+C*ea+o*T+a*aa;this.n42=z*t+C*L+o*da+a*na;this.n43=z*N+C*G+o*Z+a*ba;this.n44=z*Q+C*Y+o*H+a*b;c[0]=this.n11;
|
|
|
-c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,n=this.n32,w=this.n33,u=this.n34,q=this.n41,x=this.n42,z=this.n43,C=this.n44,o=a.n11,e=a.n21,t=a.n31,N=a.n41,Q=a.n12,ea=a.n22,L=a.n32,G=a.n42,Y=
|
|
|
-a.n13,T=a.n23,da=a.n33,Z=a.n43,H=a.n14,aa=a.n24,na=a.n34;a=a.n44;this.n11=b*o+c*e+d*t+f*N;this.n12=b*Q+c*ea+d*L+f*G;this.n13=b*Y+c*T+d*da+f*Z;this.n14=b*H+c*aa+d*na+f*a;this.n21=g*o+h*e+k*t+j*N;this.n22=g*Q+h*ea+k*L+j*G;this.n23=g*Y+h*T+k*da+j*Z;this.n24=g*H+h*aa+k*na+j*a;this.n31=m*o+n*e+w*t+u*N;this.n32=m*Q+n*ea+w*L+u*G;this.n33=m*Y+n*T+w*da+u*Z;this.n34=m*H+n*aa+w*na+u*a;this.n41=q*o+x*e+z*t+C*N;this.n42=q*Q+x*ea+z*L+C*G;this.n43=q*Y+x*T+z*da+C*Z;this.n44=q*H+x*aa+z*na+C*a;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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,n=this.n33,w=this.n34,u=this.n41,q=this.n42,x=this.n43,z=this.n44;return d*h*m*u-c*k*m*u-d*g*n*u+b*k*n*u+c*g*w*u-b*h*w*u-d*h*j*q+c*k*j*q+d*f*n*q-a*k*n*q-c*f*w*q+a*h*w*q+
|
|
|
+a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,t=a.n33,p=a.n34,x=a.n41,z=a.n42,F=a.n43,u=a.n44,e=b.n11,q=b.n12,O=b.n13,R=b.n14,ea=b.n21,L=b.n22,I=b.n23,Y=b.n24,V=b.n31,ca=b.n32,da=b.n33,G=b.n34,$=b.n41,na=b.n42,aa=b.n43,l=b.n44;this.n11=c*e+d*ea+f*V+g*$;this.n12=c*q+d*L+f*ca+g*na;this.n13=c*O+d*I+f*da+g*aa;this.n14=c*R+d*Y+f*G+g*l;this.n21=h*e+k*ea+j*V+m*$;this.n22=h*q+k*L+j*ca+m*na;
|
|
|
+this.n23=h*O+k*I+j*da+m*aa;this.n24=h*R+k*Y+j*G+m*l;this.n31=n*e+w*ea+t*V+p*$;this.n32=n*q+w*L+t*ca+p*na;this.n33=n*O+w*I+t*da+p*aa;this.n34=n*R+w*Y+t*G+p*l;this.n41=x*e+z*ea+F*V+u*$;this.n42=x*q+z*L+F*ca+u*na;this.n43=x*O+z*I+F*da+u*aa;this.n44=x*R+z*Y+F*G+u*l;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,n=a.n24,w=a.n31,t=a.n32,p=a.n33,x=a.n34,z=a.n41,F=a.n42,u=a.n43;a=a.n44;var e=b.n11,q=b.n12,O=b.n13,R=b.n14,ea=b.n21,L=b.n22,I=b.n23,Y=
|
|
|
+b.n24,V=b.n31,ca=b.n32,da=b.n33,G=b.n34,$=b.n41,na=b.n42,aa=b.n43;b=b.n44;this.n11=d*e+f*ea+g*V+h*$;this.n12=d*q+f*L+g*ca+h*na;this.n13=d*O+f*I+g*da+h*aa;this.n14=d*R+f*Y+g*G+h*b;this.n21=k*e+j*ea+m*V+n*$;this.n22=k*q+j*L+m*ca+n*na;this.n23=k*O+j*I+m*da+n*aa;this.n24=k*R+j*Y+m*G+n*b;this.n31=w*e+t*ea+p*V+x*$;this.n32=w*q+t*L+p*ca+x*na;this.n33=w*O+t*I+p*da+x*aa;this.n34=w*R+t*Y+p*G+x*b;this.n41=z*e+F*ea+u*V+a*$;this.n42=z*q+F*L+u*ca+a*na;this.n43=z*O+F*I+u*da+a*aa;this.n44=z*R+F*Y+u*G+a*b;c[0]=this.n11;
|
|
|
+c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,n=this.n32,w=this.n33,t=this.n34,p=this.n41,x=this.n42,z=this.n43,F=this.n44,u=a.n11,e=a.n21,q=a.n31,O=a.n41,R=a.n12,ea=a.n22,L=a.n32,I=a.n42,Y=
|
|
|
+a.n13,V=a.n23,ca=a.n33,da=a.n43,G=a.n14,$=a.n24,na=a.n34;a=a.n44;this.n11=b*u+c*e+d*q+f*O;this.n12=b*R+c*ea+d*L+f*I;this.n13=b*Y+c*V+d*ca+f*da;this.n14=b*G+c*$+d*na+f*a;this.n21=g*u+h*e+k*q+j*O;this.n22=g*R+h*ea+k*L+j*I;this.n23=g*Y+h*V+k*ca+j*da;this.n24=g*G+h*$+k*na+j*a;this.n31=m*u+n*e+w*q+t*O;this.n32=m*R+n*ea+w*L+t*I;this.n33=m*Y+n*V+w*ca+t*da;this.n34=m*G+n*$+w*na+t*a;this.n41=p*u+x*e+z*q+F*O;this.n42=p*R+x*ea+z*L+F*I;this.n43=p*Y+x*V+z*ca+F*da;this.n44=p*G+x*$+z*na+F*a;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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,n=this.n33,w=this.n34,t=this.n41,p=this.n42,x=this.n43,z=this.n44;return d*h*m*t-c*k*m*t-d*g*n*t+b*k*n*t+c*g*w*t-b*h*w*t-d*h*j*p+c*k*j*p+d*f*n*p-a*k*n*p-c*f*w*p+a*h*w*p+
|
|
|
d*g*j*x-b*k*j*x-d*f*m*x+a*k*m*x+b*f*w*x-a*g*w*x-c*g*j*z+b*h*j*z+c*f*m*z-a*h*m*z-b*f*n*z+a*g*n*z},transpose:function(){function a(b,c,d){var f=b[c];b[c]=b[d];b[d]=f}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},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,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);
|
|
|
return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,k=a.z,j=f*
|
|
|
g,m=f*h;this.set(j*g+c,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+c,m*k-d*g,0,j*k-d*h,m*k+d*g,f*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(b);b=Math.sin(b);var h=a*d,k=c*d;this.n11=a*f;this.n12=c*b-h*g;this.n13=h*b+c*g;this.n21=d;this.n22=f*g;this.n23=-f*b;this.n31=-c*f;this.n32=k*g+a*b;this.n33=-k*b+a*g},setRotationFromQuaternion:function(a){var b=
|
|
|
-a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+
|
|
|
-this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};
|
|
|
-THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
|
|
|
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,u=a.n33,q=a.n34,x=a.n41,z=a.n42,C=a.n43,o=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*q*z-m*u*z+m*w*C-k*q*C-j*w*o+k*u*o;b.n12=g*u*z-f*q*z-g*w*C+d*q*C+f*w*o-d*u*o;b.n13=f*m*z-g*j*z+g*k*C-d*m*C-f*k*o+d*j*o;b.n14=g*j*w-f*m*w-g*k*u+d*m*u+f*k*q-d*j*q;b.n21=m*u*x-j*q*x-m*n*C+h*q*C+j*n*o-h*u*o;b.n22=f*q*x-g*u*x+g*n*C-c*q*C-f*n*o+c*u*o;b.n23=g*j*x-f*m*x-g*h*C+c*m*C+f*h*o-c*j*o;
|
|
|
-b.n24=f*m*n-g*j*n+g*h*u-c*m*u-f*h*q+c*j*q;b.n31=k*q*x-m*w*x+m*n*z-h*q*z-k*n*o+h*w*o;b.n32=g*w*x-d*q*x-g*n*z+c*q*z+d*n*o-c*w*o;b.n33=f*m*x-g*k*x+g*h*z-c*m*z-d*h*o+c*k*o;b.n34=g*k*n-d*m*n-g*h*w+c*m*w+d*h*q-c*k*q;b.n41=j*w*x-k*u*x-j*n*z+h*u*z+k*n*C-h*w*C;b.n42=d*u*x-f*w*x+f*n*z-c*u*z-d*n*C+c*w*C;b.n43=f*k*x-d*j*x-f*h*z+c*j*z+d*h*C-c*k*C;b.n44=d*j*n-f*k*n+f*h*w-c*j*w-d*h*u+c*k*u;b.multiplyScalar(1/a.determinant());return b};
|
|
|
+a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;
|
|
|
+a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};
|
|
|
+THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
|
|
|
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,t=a.n33,p=a.n34,x=a.n41,z=a.n42,F=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*p*z-m*t*z+m*w*F-k*p*F-j*w*u+k*t*u;b.n12=g*t*z-f*p*z-g*w*F+d*p*F+f*w*u-d*t*u;b.n13=f*m*z-g*j*z+g*k*F-d*m*F-f*k*u+d*j*u;b.n14=g*j*w-f*m*w-g*k*t+d*m*t+f*k*p-d*j*p;b.n21=m*t*x-j*p*x-m*n*F+h*p*F+j*n*u-h*t*u;b.n22=f*p*x-g*t*x+g*n*F-c*p*F-f*n*u+c*t*u;b.n23=g*j*x-f*m*x-g*h*F+c*m*F+f*h*u-c*j*u;
|
|
|
+b.n24=f*m*n-g*j*n+g*h*t-c*m*t-f*h*p+c*j*p;b.n31=k*p*x-m*w*x+m*n*z-h*p*z-k*n*u+h*w*u;b.n32=g*w*x-d*p*x-g*n*z+c*p*z+d*n*u-c*w*u;b.n33=f*m*x-g*k*x+g*h*z-c*m*z-d*h*u+c*k*u;b.n34=g*k*n-d*m*n-g*h*w+c*m*w+d*h*p-c*k*p;b.n41=j*w*x-k*t*x-j*n*z+h*t*z+k*n*F-h*w*F;b.n42=d*t*x-f*w*x+f*n*z-c*t*z-d*n*F+c*w*F;b.n43=f*k*x-d*j*x-f*h*z+c*j*z+d*h*F-c*k*F;b.n44=d*j*n-f*k*n+f*h*w-c*j*w-d*h*t+c*k*t;b.multiplyScalar(1/a.determinant());return b};
|
|
|
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=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,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*n;c[8]=a*w;return b};
|
|
|
THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
|
|
|
THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
@@ -62,31 +59,29 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
|
|
|
c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)k.addSelf(g.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,
|
|
|
c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
|
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
|
|
|
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(H,aa,na,ba,l,B,y){g=H.vertices[aa].position;h=H.vertices[na].position;k=H.vertices[ba].position;j=f[l];m=f[B];n=f[y];w=h.x-g.x;u=k.x-g.x;q=h.y-g.y;x=k.y-
|
|
|
-g.y;z=h.z-g.z;C=k.z-g.z;o=m.u-j.u;e=n.u-j.u;t=m.v-j.v;N=n.v-j.v;Q=1/(o*N-e*t);G.set((N*w-t*u)*Q,(N*q-t*x)*Q,(N*z-t*C)*Q);Y.set((o*u-e*w)*Q,(o*x-e*q)*Q,(o*C-e*z)*Q);ea[aa].addSelf(G);ea[na].addSelf(G);ea[ba].addSelf(G);L[aa].addSelf(Y);L[na].addSelf(Y);L[ba].addSelf(Y)}var b,c,d,f,g,h,k,j,m,n,w,u,q,x,z,C,o,e,t,N,Q,ea=[],L=[],G=new THREE.Vector3,Y=new THREE.Vector3,T=new THREE.Vector3,da=new THREE.Vector3,Z=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){ea[b]=new THREE.Vector3;L[b]=new THREE.Vector3}b=
|
|
|
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(G,$,na,aa,l,A,y){g=G.vertices[$].position;h=G.vertices[na].position;k=G.vertices[aa].position;j=f[l];m=f[A];n=f[y];w=h.x-g.x;t=k.x-g.x;p=h.y-g.y;x=k.y-
|
|
|
+g.y;z=h.z-g.z;F=k.z-g.z;u=m.u-j.u;e=n.u-j.u;q=m.v-j.v;O=n.v-j.v;R=1/(u*O-e*q);I.set((O*w-q*t)*R,(O*p-q*x)*R,(O*z-q*F)*R);Y.set((u*t-e*w)*R,(u*x-e*p)*R,(u*F-e*z)*R);ea[$].addSelf(I);ea[na].addSelf(I);ea[aa].addSelf(I);L[$].addSelf(Y);L[na].addSelf(Y);L[aa].addSelf(Y)}var b,c,d,f,g,h,k,j,m,n,w,t,p,x,z,F,u,e,q,O,R,ea=[],L=[],I=new THREE.Vector3,Y=new THREE.Vector3,V=new THREE.Vector3,ca=new THREE.Vector3,da=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){ea[b]=new THREE.Vector3;L[b]=new THREE.Vector3}b=
|
|
|
0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
|
|
|
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){Z.copy(this.vertices[b].normal);d=ea[b];T.copy(d);T.subSelf(Z.multiplyScalar(Z.dot(d))).normalize();da.cross(this.vertices[b].normal,d);d=da.dot(L[b]);d=d<0?-1:1;this.vertices[b].tangent.set(T.x,T.y,T.z,d)}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],
|
|
|
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){da.copy(this.vertices[b].normal);d=ea[b];V.copy(d);V.subSelf(da.multiplyScalar(da.dot(d))).normalize();ca.cross(this.vertices[b].normal,d);d=ca.dot(L[b]);d=d<0?-1:1;this.vertices[b].tangent.set(V.x,V.y,V.z,d)}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 b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];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=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(n){var w=[];b=0;for(c=n.length;b<c;b++)n[b]==undefined?w.push("undefined"):w.push(n[b].toString());return w.join("_")}var b,c,d,f,g,h,k,j,m={};d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];
|
|
|
+this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(n){var w=[];b=0;for(c=n.length;b<c;b++)n[b]==undefined?w.push("undefined"):w.push(n[b].id);return w.join("_")}var b,c,d,f,g,h,k,j,m={};d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];
|
|
|
h=g.materials;k=a(h);m[k]==undefined&&(m[k]={hash:k,counter:0});j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0});g=g instanceof THREE.Face3?3:4;if(this.geometryChunks[j].vertices+g>65535){m[k].counter+=1;j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0})}this.geometryChunks[j].faces.push(d);this.geometryChunks[j].vertices+=g}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
|
this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1};
|
|
|
-THREE.Object3D.prototype.update=function(a,b,c,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c,d)}};
|
|
|
-THREE.Object3D.prototype.updateMatrix=function(){var a=!1;if(this.position.isDirty){this.localMatrix.setPosition(this.position);this.position.isDirty=!1;a=!0}if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1;this.rotation.isDirty=!1;if(this.scale.isDirty||this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.scale.isDirty=!1;this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
|
|
|
-this.scale.z))}a=!0}}else if(this.rotation.isDirty){this.localMatrix.setRotationFromEuler(this.rotation);this.rotation.isDirty=!1;if(this.scale.isDirty||this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.scale.isDirty=!1;this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}a=!0}if(this.scale.isDirty){this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
|
|
|
-this.localMatrix.scale(this.scale);this.scale.isDirty=!1;this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));a=!0}return a};THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(){var a=this.children.indexOf(child);if(a!==-1){this.children.splice(a,1);child.parent=undefined}};THREE.Object3DCounter={value:0};
|
|
|
-THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
|
|
|
-THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
|
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.normalMatrix=THREE.Matrix4.makeInvert3x3(this.globalMatrix).transpose();this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Mesh.prototype.update=function(a,b,c,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;this.normalMatrix=THREE.Matrix4.makeInvert3x3(this.globalMatrix).transpose()}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c,d);d&&c&&(c.frustumContains(this)?d.addToRenderList(this):d.removeFromRenderList(this))}else d.removeFromRenderList(this)};
|
|
|
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix=
|
|
|
+new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}};
|
|
|
+THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1}}else this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
|
|
|
+THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
+THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
+THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.normalMatrix=THREE.Matrix4.makeInvert3x3(this.globalMatrix).transpose();this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;
|
|
|
+THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
|
+THREE.Mesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;this.normalMatrix=THREE.Matrix4.makeInvert3x3(this.globalMatrix).transpose()}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)}};
|
|
|
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Bone.prototype.update=function(a,b,c,d){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(a=0;a<this.children.length;a++)this.children[a]instanceof THREE.Bone?this.children[a].update(this.skinMatrix,b,c,d):this.children[a].update(this.globalMatrix,
|
|
|
-!0,c,d)}else for(a=0;a<this.children.length;a++)this.children[a].update(this.skinMatrix,b,c,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];if(this.geometry.bones!==undefined){for(var c=0;c<this.geometry.bones.length;c++){var d=this.addBone();d.name=this.geometry.bones[c].name;d.position.x=this.geometry.bones[c].pos[0];d.position.y=this.geometry.bones[c].pos[1];d.position.z=this.geometry.bones[c].pos[2];d.quaternion.x=this.geometry.bones[c].rotq[0];d.quaternion.y=this.geometry.bones[c].rotq[1];d.quaternion.z=
|
|
|
-this.geometry.bones[c].rotq[2];d.quaternion.w=this.geometry.bones[c].rotq[3];d.scale.x=this.geometry.bones[c].scl!==undefined?this.geometry.bones[c].scl[0]:1;d.scale.y=this.geometry.bones[c].scl!==undefined?this.geometry.bones[c].scl[1]:1;d.scale.z=this.geometry.bones[c].scl!==undefined?this.geometry.bones[c].scl[2]:1}for(c=0;c<this.bones.length;c++)this.geometry.bones[c].parent===-1?this.addChild(this.bones[c]):this.bones[this.geometry.bones[c].parent].addChild(this.bones[c]);this.boneMatrices=new Float32Array(16*
|
|
|
-this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
-THREE.SkinnedMesh.prototype.update=function(a,b,c,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;this.normalMatrix=THREE.Matrix4.makeInvert3x3(this.globalMatrix).transpose()}for(a=0;a<this.children.length;a++)this.children[a]instanceof THREE.Bone?this.children[a].update(this.identityMatrix,!1,c,d):this.children[a].update(this.globalMatrix,
|
|
|
-b,c,d);d&&c&&(c.frustumContains(this)?d.addToRenderList(this):d.removeFromRenderList(this))}else d.removeFromRenderList(this)};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
|
+THREE.Bone.prototype.update=function(a,b,c){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.globalMatrix,!0,c)}}else for(d=
|
|
|
+0;d<f;d++)this.children[d].update(this.skinMatrix,b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,h,k;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){f=this.geometry.bones[c];g=f.pos;h=f.rotq;k=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);k!==undefined?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){f=this.geometry.bones[c];d=this.bones[c];
|
|
|
+f.parent===-1?this.addChild(d):this.bones[f.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
+THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;this.normalMatrix=THREE.Matrix4.makeInvert3x3(this.globalMatrix).transpose()}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.globalMatrix,b,
|
|
|
+c)}}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
|
THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
|
|
|
d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
|
|
|
THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
|
|
@@ -95,167 +90,168 @@ THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.sta
|
|
|
THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
|
|
|
this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
|
|
|
THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.0010-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.0010-j;j=(new Date).getTime()*0.0010-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var n=0,w=this.hierarchy.length;n<w;n++){g=this.hierarchy[n];if(k[n][h]!==
|
|
|
-undefined){g.skinMatrix=k[n][h];g.autoUpdateMatrix=!1;g.matrixNeedsToUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,n*16)}else for(var u=0;u<3;u++){c=a[u];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[n].keys[0];f=this.getNextKeyWith(c,n,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,n,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.autoUpdateMatrix=!0;g.matrixNeedsToUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];
|
|
|
+undefined){g.skinMatrix=k[n][h];g.autoUpdateMatrix=!1;g.matrixNeedsToUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,n*16)}else for(var t=0;t<3;t++){c=a[t];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[n].keys[0];f=this.getNextKeyWith(c,n,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,n,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.autoUpdateMatrix=!0;g.matrixNeedsToUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];
|
|
|
f=f[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(n=0;n<this.hierarchy.length;n++)k[n][h]=this.hierarchy[n].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
|
|
|
THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
-THREE.Camera=function(a,b,c,d,f,g){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=g||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
+THREE.Camera=function(a,b,c,d,f,g){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=g||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
|
|
|
+this.target.position.addSelf(this.tmpVec)};this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
|
|
|
-THREE.Camera.prototype.update=function(a,b,c,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;
|
|
|
-THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d,renderer)};
|
|
|
+THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
|
|
|
+this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
|
|
|
THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,d=a.globalMatrix.n34,f=this.inverseMatrix,g=a.boundRadius*a.boundRadiusScale,h=f.n31*b+f.n32*c+f.n33*d+f.n34;if(h-g>-this.zNear)return!1;if(h+g<-this.zFar)return!1;h-=g;var k=this.projectionMatrix,j=1/(k.n43*h),m=j*this.screenCenterX,n=(f.n11*b+f.n12*c+f.n13*d+f.n14)*k.n11*m;g=k.n11*g*m;if(n+g<-this.screenCenterX)return!1;if(n-g>this.screenCenterX)return!1;b=(f.n21*b+f.n22*c+f.n23*d+f.n24)*k.n22*j*this.screenCenterY;
|
|
|
if(b+g<-this.screenCenterY)return!1;if(b-g>this.screenCenterY)return!1;a.screenPosition.set(n,b,h,g);return!0};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,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
|
|
|
-THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;
|
|
|
-THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
|
|
+THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0};
|
|
|
+THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
|
|
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
|
|
-THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.LineBasicMaterialCounter={value:0};
|
|
|
-THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
|
|
+THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
|
|
|
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
|
|
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
|
undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+
|
|
|
-"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
|
|
|
-THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;
|
|
|
-if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
|
|
|
-if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=
|
|
|
-a.skinning}};
|
|
|
-THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+
|
|
|
-this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
|
|
|
-THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
|
|
+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
|
|
+undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
|
+undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
+THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+
|
|
|
+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/> )"}};
|
|
|
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
|
|
this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map;
|
|
|
if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
|
|
|
if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+
|
|
|
-this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
|
|
|
-THREE.MeshDepthMaterial=function(a){this.id=THREE.MeshDepthMaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
-undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshDepthMaterialCounter={value:0};
|
|
|
-THREE.MeshNormalMaterial=function(a){this.id=THREE.MeshNormalMaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
-undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshNormalMaterialCounter={value:0};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
|
|
|
-THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=
|
|
|
+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
+THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
+undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};
|
|
|
+THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
+undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
|
|
|
+THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=
|
|
|
a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
|
|
|
undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
-THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
|
|
|
-THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;
|
|
|
-if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.ParticleBasicMaterialCounter={value:0};
|
|
|
-THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
|
|
|
-THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b,c,d,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=g!==undefined?g:THREE.LinearMipMapLinearFilter};
|
|
|
+THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
+THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==
|
|
|
+undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
|
|
|
+THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
|
|
+THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
|
|
|
+THREE.Texture=function(a,b,c,d,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=g!==undefined?g:THREE.LinearMipMapLinearFilter};
|
|
|
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
|
|
|
THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
|
THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
|
|
|
var Uniforms={clone:function(a){var b,c,d,f={};for(b in a){f[b]={};for(c in a[b]){d=a[b][c];f[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return f},merge:function(a){var b,c,d,f={};for(b=0;b<a.length;b++){d=this.clone(a[b]);for(c in d)f[c]=d[c]}return f}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
|
THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
|
|
|
THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
|
|
|
-THREE.Scene.prototype.removeChildRecurse=function(){if(object instanceof THREE.Light){var a=this.lights.indexOf(object);a===-1&&this.lights.splice(a,1)}else if(!(object instanceof THREE.Camera)){a=this.objects.indexOf(object);a===-1&&this.objects.splice(a,1)}for(a=0;a<object.children.length;a++)this.removeChildRecurse(object.children[a])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
|
|
|
-THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
-THREE.Projector=function(){function a(L,G){return G.z-L.z}function b(L,G){var Y=0,T=1,da=L.z+L.w,Z=G.z+G.w,H=-L.z+L.w,aa=-G.z+G.w;if(da>=0&&Z>=0&&H>=0&&aa>=0)return!0;else if(da<0&&Z<0||H<0&&aa<0)return!1;else{if(da<0)Y=Math.max(Y,da/(da-Z));else Z<0&&(T=Math.min(T,da/(da-Z)));if(H<0)Y=Math.max(Y,H/(H-aa));else aa<0&&(T=Math.min(T,H/(H-aa)));if(T<Y)return!1;else{L.lerpSelf(G,Y);G.lerpSelf(L,1-T);return!0}}}var c,d,f=[],g,h,k,j=[],m,n,w=[],u,q,x=[],z=new THREE.Vector4,C=new THREE.Vector4,o=new THREE.Matrix4,
|
|
|
-e=new THREE.Matrix4,t=[],N=new THREE.Vector4,Q=new THREE.Vector4,ea;this.projectObjects=function(L,G,Y){var T=[],da,Z;d=0;o.multiply(G.projectionMatrix,G.matrix);t[0]=new THREE.Vector4(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);t[1]=new THREE.Vector4(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);t[2]=new THREE.Vector4(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);t[3]=new THREE.Vector4(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);t[4]=new THREE.Vector4(o.n41-o.n31,o.n42-o.n32,o.n43-
|
|
|
-o.n33,o.n44-o.n34);t[5]=new THREE.Vector4(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);G=0;for(da=t.length;G<da;G++){Z=t[G];Z.divideScalar(Math.sqrt(Z.x*Z.x+Z.y*Z.y+Z.z*Z.z))}da=L.objects;L=0;for(G=da.length;L<G;L++){Z=da[L];var H;if(!(H=!Z.visible))if(H=Z instanceof THREE.Mesh){a:{H=void 0;for(var aa=Z.position,na=-Z.geometry.boundingSphere.radius*Math.max(Z.scale.x,Math.max(Z.scale.y,Z.scale.z)),ba=0;ba<6;ba++){H=t[ba].x*aa.x+t[ba].y*aa.y+t[ba].z*aa.z+t[ba].w;if(H<=na){H=!1;break a}}H=!0}H=
|
|
|
-!H}if(!H){c=f[d]=f[d]||new THREE.RenderableObject;z.copy(Z.position);o.multiplyVector3(z);c.object=Z;c.z=z.z;T.push(c);d++}}Y&&T.sort(a);return T};this.projectScene=function(L,G,Y){var T=[],da=G.near,Z=G.far,H,aa,na,ba,l,B,y,v,p,D,F,J,U,A,R,O;k=n=q=0;G.autoUpdateMatrix&&G.updateMatrix();o.multiply(G.projectionMatrix,G.matrix);B=this.projectObjects(L,G,!0);L=0;for(H=B.length;L<H;L++){y=B[L].object;if(y.visible){y.autoUpdateMatrix&&y.updateMatrix();v=y.matrix;p=y.rotationMatrix;D=y.materials;F=y.overdraw;
|
|
|
-if(y instanceof THREE.Mesh){J=y.geometry;U=J.vertices;aa=0;for(na=U.length;aa<na;aa++){A=U[aa];A.positionWorld.copy(A.position);v.multiplyVector3(A.positionWorld);ba=A.positionScreen;ba.copy(A.positionWorld);o.multiplyVector4(ba);ba.x/=ba.w;ba.y/=ba.w;A.__visible=ba.z>da&&ba.z<Z}J=J.faces;aa=0;for(na=J.length;aa<na;aa++){A=J[aa];if(A instanceof THREE.Face3){ba=U[A.a];l=U[A.b];R=U[A.c];if(ba.__visible&&l.__visible&&R.__visible&&(y.doubleSided||y.flipSided!=(R.positionScreen.x-ba.positionScreen.x)*
|
|
|
-(l.positionScreen.y-ba.positionScreen.y)-(R.positionScreen.y-ba.positionScreen.y)*(l.positionScreen.x-ba.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);g.v2.positionWorld.copy(l.positionWorld);g.v3.positionWorld.copy(R.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(l.positionScreen);g.v3.positionScreen.copy(R.positionScreen);g.normalWorld.copy(A.normal);p.multiplyVector3(g.normalWorld);g.centroidWorld.copy(A.centroid);
|
|
|
-v.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);o.multiplyVector3(g.centroidScreen);R=A.vertexNormals;ea=g.vertexNormalsWorld;ba=0;for(l=R.length;ba<l;ba++){O=ea[ba]=ea[ba]||new THREE.Vector3;O.copy(R[ba]);p.multiplyVector3(O)}g.z=g.centroidScreen.z;g.meshMaterials=D;g.faceMaterials=A.materials;g.overdraw=F;if(y.geometry.uvs[aa]){g.uvs[0]=y.geometry.uvs[aa][0];g.uvs[1]=y.geometry.uvs[aa][1];g.uvs[2]=y.geometry.uvs[aa][2]}T.push(g);k++}}else if(A instanceof THREE.Face4){ba=
|
|
|
-U[A.a];l=U[A.b];R=U[A.c];O=U[A.d];if(ba.__visible&&l.__visible&&R.__visible&&O.__visible&&(y.doubleSided||y.flipSided!=((O.positionScreen.x-ba.positionScreen.x)*(l.positionScreen.y-ba.positionScreen.y)-(O.positionScreen.y-ba.positionScreen.y)*(l.positionScreen.x-ba.positionScreen.x)<0||(l.positionScreen.x-R.positionScreen.x)*(O.positionScreen.y-R.positionScreen.y)-(l.positionScreen.y-R.positionScreen.y)*(O.positionScreen.x-R.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);
|
|
|
-g.v2.positionWorld.copy(l.positionWorld);g.v3.positionWorld.copy(O.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(l.positionScreen);g.v3.positionScreen.copy(O.positionScreen);g.normalWorld.copy(A.normal);p.multiplyVector3(g.normalWorld);g.centroidWorld.copy(A.centroid);v.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);o.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=D;g.faceMaterials=A.materials;g.overdraw=F;if(y.geometry.uvs[aa]){g.uvs[0]=
|
|
|
-y.geometry.uvs[aa][0];g.uvs[1]=y.geometry.uvs[aa][1];g.uvs[2]=y.geometry.uvs[aa][3]}T.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(l.positionWorld);h.v2.positionWorld.copy(R.positionWorld);h.v3.positionWorld.copy(O.positionWorld);h.v1.positionScreen.copy(l.positionScreen);h.v2.positionScreen.copy(R.positionScreen);h.v3.positionScreen.copy(O.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);
|
|
|
-h.z=h.centroidScreen.z;h.meshMaterials=D;h.faceMaterials=A.materials;h.overdraw=F;if(y.geometry.uvs[aa]){h.uvs[0]=y.geometry.uvs[aa][1];h.uvs[1]=y.geometry.uvs[aa][2];h.uvs[2]=y.geometry.uvs[aa][3]}T.push(h);k++}}}}else if(y instanceof THREE.Line){e.multiply(o,v);U=y.geometry.vertices;A=U[0];A.positionScreen.copy(A.position);e.multiplyVector4(A.positionScreen);aa=1;for(na=U.length;aa<na;aa++){ba=U[aa];ba.positionScreen.copy(ba.position);e.multiplyVector4(ba.positionScreen);l=U[aa-1];N.copy(ba.positionScreen);
|
|
|
-Q.copy(l.positionScreen);if(b(N,Q)){N.multiplyScalar(1/N.w);Q.multiplyScalar(1/Q.w);m=w[n]=w[n]||new THREE.RenderableLine;m.v1.positionScreen.copy(N);m.v2.positionScreen.copy(Q);m.z=Math.max(N.z,Q.z);m.materials=y.materials;T.push(m);n++}}}else if(y instanceof THREE.Particle){C.set(y.position.x,y.position.y,y.position.z,1);o.multiplyVector4(C);C.z/=C.w;if(C.z>0&&C.z<1){u=x[q]=x[q]||new THREE.RenderableParticle;u.x=C.x/C.w;u.y=C.y/C.w;u.z=C.z;u.rotation=y.rotation.z;u.scale.x=y.scale.x*Math.abs(u.x-
|
|
|
-(C.x+G.projectionMatrix.n11)/(C.w+G.projectionMatrix.n14));u.scale.y=y.scale.y*Math.abs(u.y-(C.y+G.projectionMatrix.n22)/(C.w+G.projectionMatrix.n24));u.materials=y.materials;T.push(u);q++}}}}Y&&T.sort(a);return T};this.unprojectVector=function(L,G){var Y=THREE.Matrix4.makeInvert(G.matrix);Y.multiplySelf(THREE.Matrix4.makeInvert(G.projectionMatrix));Y.multiplyVector3(L);return L}};
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,n,w,u,q,x,z;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){u=a[j];if(u instanceof THREE.RenderableParticle){x=u.x*f+f;z=u.y*g+g;n=0;for(w=u.material.length;n<w;n++){q=u.material[n];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=x+"px";q.style.top=z+"px"}}}}}};
|
|
|
-THREE.CanvasRenderer=function(){function a(W){if(u!=W)m.globalAlpha=u=W}function b(W){if(q!=W){switch(W){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=W}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),n=new THREE.Color(0),w=0,u=1,q=0,x=null,z=null,C=1,o,e,t,N,Q,ea,L,G,Y,T=new THREE.Color,
|
|
|
-da=new THREE.Color,Z=new THREE.Color,H=new THREE.Color,aa=new THREE.Color,na,ba,l,B,y,v,p,D,F,J=new THREE.Rectangle,U=new THREE.Rectangle,A=new THREE.Rectangle,R=!1,O=new THREE.Color,ga=new THREE.Color,ma=new THREE.Color,E=new THREE.Color,P=Math.PI*2,I=new THREE.Vector3,V,ca,ta,M,Ba,xa,Ea=16;V=document.createElement("canvas");V.width=V.height=2;ca=V.getContext("2d");ca.fillStyle="rgba(0,0,0,1)";ca.fillRect(0,0,2,2);ta=ca.getImageData(0,0,2,2);M=ta.data;Ba=document.createElement("canvas");Ba.width=
|
|
|
-Ba.height=Ea;xa=Ba.getContext("2d");xa.translate(-Ea/2,-Ea/2);xa.scale(Ea,Ea);Ea--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(W,$){g=W;h=$;k=g/2;j=h/2;f.width=g;f.height=h;J.set(-k,-j,k,j);u=1;q=0;z=x=null;C=1};this.setClearColor=function(W,$){n=W;w=$;U.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(W,$){n.setHex(W);w=$;U.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=function(){m.setTransform(1,
|
|
|
-0,0,-1,k,j);if(!U.isEmpty()){U.inflate(1);U.minSelf(J);if(n.hex==0&&w==0)m.clearRect(U.getX(),U.getY(),U.getWidth(),U.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+w+")";m.fillRect(U.getX(),U.getY(),U.getWidth(),U.getHeight())}U.empty()}};this.render=function(W,$){function fa(S){var ka,ia,X,ha=S.lights;ga.setRGB(0,0,0);ma.setRGB(0,0,0);E.setRGB(0,0,0);S=0;for(ka=ha.length;S<ka;S++){ia=ha[S];X=ia.color;if(ia instanceof
|
|
|
-THREE.AmbientLight){ga.r+=X.r;ga.g+=X.g;ga.b+=X.b}else if(ia instanceof THREE.DirectionalLight){ma.r+=X.r;ma.g+=X.g;ma.b+=X.b}else if(ia instanceof THREE.PointLight){E.r+=X.r;E.g+=X.g;E.b+=X.b}}}function oa(S,ka,ia,X){var ha,la,ya,Fa,Ha=S.lights;S=0;for(ha=Ha.length;S<ha;S++){la=Ha[S];ya=la.color;Fa=la.intensity;if(la instanceof THREE.DirectionalLight){la=ia.dot(la.position)*Fa;if(la>0){X.r+=ya.r*la;X.g+=ya.g*la;X.b+=ya.b*la}}else if(la instanceof THREE.PointLight){I.sub(la.position,ka);I.normalize();
|
|
|
-la=ia.dot(I)*Fa;if(la>0){X.r+=ya.r*la;X.g+=ya.g*la;X.b+=ya.b*la}}}}function Ia(S,ka,ia){if(ia.opacity!=0){a(ia.opacity);b(ia.blending);var X,ha,la,ya,Fa,Ha;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map&&ia.map.image.loaded){ya=ia.map.image;Fa=ya.width>>1;Ha=ya.height>>1;ha=ka.scale.x*k;la=ka.scale.y*j;ia=ha*Fa;X=la*Ha;A.set(S.x-ia,S.y-X,S.x+ia,S.y+X);if(J.instersects(A)){m.save();m.translate(S.x,S.y);m.rotate(-ka.rotation);m.scale(ha,-la);m.translate(-Fa,-Ha);m.drawImage(ya,0,0);m.restore()}}}else if(ia instanceof
|
|
|
-THREE.ParticleCircleMaterial){if(R){O.r=ga.r+ma.r+E.r;O.g=ga.g+ma.g+E.g;O.b=ga.b+ma.b+E.b;T.r=ia.color.r*O.r;T.g=ia.color.g*O.g;T.b=ia.color.b*O.b;T.updateStyleString()}else T.__styleString=ia.color.__styleString;ia=ka.scale.x*k;X=ka.scale.y*j;A.set(S.x-ia,S.y-X,S.x+ia,S.y+X);if(J.instersects(A)){ha=T.__styleString;if(z!=ha)m.fillStyle=z=ha;m.save();m.translate(S.x,S.y);m.rotate(-ka.rotation);m.scale(ia,X);m.beginPath();m.arc(0,0,1,0,P,!0);m.closePath();m.fill();m.restore()}}}}function wa(S,ka,ia,
|
|
|
-X){if(X.opacity!=0){a(X.opacity);b(X.blending);m.beginPath();m.moveTo(S.positionScreen.x,S.positionScreen.y);m.lineTo(ka.positionScreen.x,ka.positionScreen.y);m.closePath();if(X instanceof THREE.LineBasicMaterial){T.__styleString=X.color.__styleString;S=X.linewidth;if(C!=S)m.lineWidth=C=S;S=T.__styleString;if(x!=S)m.strokeStyle=x=S;m.stroke();A.inflate(X.linewidth*2)}}}function K(S,ka,ia,X,ha,la){if(ha.opacity!=0){a(ha.opacity);b(ha.blending);N=S.positionScreen.x;Q=S.positionScreen.y;ea=ka.positionScreen.x;
|
|
|
-L=ka.positionScreen.y;G=ia.positionScreen.x;Y=ia.positionScreen.y;m.beginPath();m.moveTo(N,Q);m.lineTo(ea,L);m.lineTo(G,Y);m.lineTo(N,Q);m.closePath();if(ha instanceof THREE.MeshBasicMaterial)if(ha.map)ha.map.image.loaded&&ha.map.mapping instanceof THREE.UVMapping&&Na(N,Q,ea,L,G,Y,ha.map.image,X.uvs[0].u,X.uvs[0].v,X.uvs[1].u,X.uvs[1].v,X.uvs[2].u,X.uvs[2].v);else if(ha.env_map){if(ha.env_map.image.loaded&&ha.env_map.mapping instanceof THREE.SphericalReflectionMapping){S=$.matrix;I.copy(X.vertexNormalsWorld[0]);
|
|
|
-B=(I.x*S.n11+I.y*S.n12+I.z*S.n13)*0.5+0.5;y=-(I.x*S.n21+I.y*S.n22+I.z*S.n23)*0.5+0.5;I.copy(X.vertexNormalsWorld[1]);v=(I.x*S.n11+I.y*S.n12+I.z*S.n13)*0.5+0.5;p=-(I.x*S.n21+I.y*S.n22+I.z*S.n23)*0.5+0.5;I.copy(X.vertexNormalsWorld[2]);D=(I.x*S.n11+I.y*S.n12+I.z*S.n13)*0.5+0.5;F=-(I.x*S.n21+I.y*S.n22+I.z*S.n23)*0.5+0.5;Na(N,Q,ea,L,G,Y,ha.env_map.image,B,y,v,p,D,F)}}else ha.wireframe?ua(ha.color.__styleString,ha.wireframe_linewidth):Pa(ha.color.__styleString);else if(ha instanceof THREE.MeshLambertMaterial){if(ha.map&&
|
|
|
-!ha.wireframe){ha.map.mapping instanceof THREE.UVMapping&&Na(N,Q,ea,L,G,Y,ha.map.image,X.uvs[0].u,X.uvs[0].v,X.uvs[1].u,X.uvs[1].v,X.uvs[2].u,X.uvs[2].v);b(THREE.SubtractiveBlending)}if(R)if(!ha.wireframe&&ha.shading==THREE.SmoothShading&&X.vertexNormalsWorld.length==3){da.r=Z.r=H.r=ga.r;da.g=Z.g=H.g=ga.g;da.b=Z.b=H.b=ga.b;oa(la,X.v1.positionWorld,X.vertexNormalsWorld[0],da);oa(la,X.v2.positionWorld,X.vertexNormalsWorld[1],Z);oa(la,X.v3.positionWorld,X.vertexNormalsWorld[2],H);aa.r=(Z.r+H.r)*0.5;
|
|
|
-aa.g=(Z.g+H.g)*0.5;aa.b=(Z.b+H.b)*0.5;l=La(da,Z,H,aa);Na(N,Q,ea,L,G,Y,l,0,0,1,0,0,1)}else{O.r=ga.r;O.g=ga.g;O.b=ga.b;oa(la,X.centroidWorld,X.normalWorld,O);T.r=ha.color.r*O.r;T.g=ha.color.g*O.g;T.b=ha.color.b*O.b;T.updateStyleString();ha.wireframe?ua(T.__styleString,ha.wireframe_linewidth):Pa(T.__styleString)}else ha.wireframe?ua(ha.color.__styleString,ha.wireframe_linewidth):Pa(ha.color.__styleString)}else if(ha instanceof THREE.MeshDepthMaterial){na=$.near;ba=$.far;da.r=da.g=da.b=1-qa(S.positionScreen.z,
|
|
|
-na,ba);Z.r=Z.g=Z.b=1-qa(ka.positionScreen.z,na,ba);H.r=H.g=H.b=1-qa(ia.positionScreen.z,na,ba);aa.r=(Z.r+H.r)*0.5;aa.g=(Z.g+H.g)*0.5;aa.b=(Z.b+H.b)*0.5;l=La(da,Z,H,aa);Na(N,Q,ea,L,G,Y,l,0,0,1,0,0,1)}else if(ha instanceof THREE.MeshNormalMaterial){T.r=va(X.normalWorld.x);T.g=va(X.normalWorld.y);T.b=va(X.normalWorld.z);T.updateStyleString();ha.wireframe?ua(T.__styleString,ha.wireframe_linewidth):Pa(T.__styleString)}}}function ua(S,ka){if(x!=S)m.strokeStyle=x=S;if(C!=ka)m.lineWidth=C=ka;m.stroke();A.inflate(ka*
|
|
|
-2)}function Pa(S){if(z!=S)m.fillStyle=z=S;m.fill()}function Na(S,ka,ia,X,ha,la,ya,Fa,Ha,Oa,za,Ka,Ma){var Ja,Ga;Ja=ya.width-1;Ga=ya.height-1;Fa*=Ja;Ha*=Ga;Oa*=Ja;za*=Ga;Ka*=Ja;Ma*=Ga;ia-=S;X-=ka;ha-=S;la-=ka;Oa-=Fa;za-=Ha;Ka-=Fa;Ma-=Ha;Ja=Oa*Ma-Ka*za;if(Ja!=0){Ga=1/Ja;Ja=(Ma*ia-za*ha)*Ga;za=(Ma*X-za*la)*Ga;ia=(Oa*ha-Ka*ia)*Ga;X=(Oa*la-Ka*X)*Ga;S=S-Ja*Fa-ia*Ha;ka=ka-za*Fa-X*Ha;m.save();m.transform(Ja,za,ia,X,S,ka);m.clip();m.drawImage(ya,0,0);m.restore()}}function La(S,ka,ia,X){var ha=~~(S.r*255),la=
|
|
|
-~~(S.g*255);S=~~(S.b*255);var ya=~~(ka.r*255),Fa=~~(ka.g*255);ka=~~(ka.b*255);var Ha=~~(ia.r*255),Oa=~~(ia.g*255);ia=~~(ia.b*255);var za=~~(X.r*255),Ka=~~(X.g*255);X=~~(X.b*255);M[0]=ha<0?0:ha>255?255:ha;M[1]=la<0?0:la>255?255:la;M[2]=S<0?0:S>255?255:S;M[4]=ya<0?0:ya>255?255:ya;M[5]=Fa<0?0:Fa>255?255:Fa;M[6]=ka<0?0:ka>255?255:ka;M[8]=Ha<0?0:Ha>255?255:Ha;M[9]=Oa<0?0:Oa>255?255:Oa;M[10]=ia<0?0:ia>255?255:ia;M[12]=za<0?0:za>255?255:za;M[13]=Ka<0?0:Ka>255?255:Ka;M[14]=X<0?0:X>255?255:X;ca.putImageData(ta,
|
|
|
-0,0);xa.drawImage(V,0,0);return Ba}function qa(S,ka,ia){S=(S-ka)/(ia-ka);return S*S*(3-2*S)}function va(S){S=(S+1)*0.5;return S<0?0:S>1?1:S}function ra(S,ka){var ia=ka.x-S.x,X=ka.y-S.y,ha=1/Math.sqrt(ia*ia+X*X);ia*=ha;X*=ha;ka.x+=ia;ka.y+=X;S.x-=ia;S.y-=X}var pa,sa,ja,Ca,Aa,Ra,Da,Qa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(W,$,this.sortElements);(R=W.lights.length>0)&&fa(W);pa=0;for(sa=c.length;pa<sa;pa++){ja=c[pa];A.empty();if(ja instanceof THREE.RenderableParticle){o=
|
|
|
-ja;o.x*=k;o.y*=j;Ca=0;for(Aa=ja.materials.length;Ca<Aa;Ca++)Ia(o,ja,ja.materials[Ca],W)}else if(ja instanceof THREE.RenderableLine){o=ja.v1;e=ja.v2;o.positionScreen.x*=k;o.positionScreen.y*=j;e.positionScreen.x*=k;e.positionScreen.y*=j;A.addPoint(o.positionScreen.x,o.positionScreen.y);A.addPoint(e.positionScreen.x,e.positionScreen.y);if(J.instersects(A)){Ca=0;for(Aa=ja.materials.length;Ca<Aa;)wa(o,e,ja,ja.materials[Ca++],W)}}else if(ja instanceof THREE.RenderableFace3){o=ja.v1;e=ja.v2;t=ja.v3;o.positionScreen.x*=
|
|
|
-k;o.positionScreen.y*=j;e.positionScreen.x*=k;e.positionScreen.y*=j;t.positionScreen.x*=k;t.positionScreen.y*=j;if(ja.overdraw){ra(o.positionScreen,e.positionScreen);ra(e.positionScreen,t.positionScreen);ra(t.positionScreen,o.positionScreen)}A.add3Points(o.positionScreen.x,o.positionScreen.y,e.positionScreen.x,e.positionScreen.y,t.positionScreen.x,t.positionScreen.y);if(J.instersects(A)){Ca=0;for(Aa=ja.meshMaterials.length;Ca<Aa;){Qa=ja.meshMaterials[Ca++];if(Qa instanceof THREE.MeshFaceMaterial){Ra=
|
|
|
-0;for(Da=ja.faceMaterials.length;Ra<Da;)(Qa=ja.faceMaterials[Ra++])&&K(o,e,t,ja,Qa,W)}else K(o,e,t,ja,Qa,W)}}}U.addRectangle(A)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(B,y,v){var p,D,F,J;p=0;for(D=B.lights.length;p<D;p++){F=B.lights[p];if(F instanceof THREE.DirectionalLight){J=y.normalWorld.dot(F.position)*F.intensity;if(J>0){v.r+=F.color.r*J;v.g+=F.color.g*J;v.b+=F.color.b*J}}else if(F instanceof THREE.PointLight){Y.sub(F.position,y.centroidWorld);Y.normalize();J=y.normalWorld.dot(Y)*F.intensity;if(J>0){v.r+=F.color.r*J;v.g+=F.color.g*J;v.b+=F.color.b*J}}}}function b(B,y,v,p,D,F){H=d(aa++);H.setAttribute("d","M "+B.positionScreen.x+
|
|
|
-" "+B.positionScreen.y+" L "+y.positionScreen.x+" "+y.positionScreen.y+" L "+v.positionScreen.x+","+v.positionScreen.y+"z");if(D instanceof THREE.MeshBasicMaterial)t.__styleString=D.color.__styleString;else if(D instanceof THREE.MeshLambertMaterial)if(e){N.r=Q.r;N.g=Q.g;N.b=Q.b;a(F,p,N);t.r=D.color.r*N.r;t.g=D.color.g*N.g;t.b=D.color.b*N.b;t.updateStyleString()}else t.__styleString=D.color.__styleString;else if(D instanceof THREE.MeshDepthMaterial){G=1-D.__2near/(D.__farPlusNear-p.z*D.__farMinusNear);
|
|
|
-t.setRGB(G,G,G)}else D instanceof THREE.MeshNormalMaterial&&t.setRGB(f(p.normalWorld.x),f(p.normalWorld.y),f(p.normalWorld.z));D.wireframe?H.setAttribute("style","fill: none; stroke: "+t.__styleString+"; stroke-width: "+D.wireframe_linewidth+"; stroke-opacity: "+D.opacity+"; stroke-linecap: "+D.wireframe_linecap+"; stroke-linejoin: "+D.wireframe_linejoin):H.setAttribute("style","fill: "+t.__styleString+"; fill-opacity: "+D.opacity);k.appendChild(H)}function c(B,y,v,p,D,F,J){H=d(aa++);H.setAttribute("d",
|
|
|
-"M "+B.positionScreen.x+" "+B.positionScreen.y+" L "+y.positionScreen.x+" "+y.positionScreen.y+" L "+v.positionScreen.x+","+v.positionScreen.y+" L "+p.positionScreen.x+","+p.positionScreen.y+"z");if(F instanceof THREE.MeshBasicMaterial)t.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshLambertMaterial)if(e){N.r=Q.r;N.g=Q.g;N.b=Q.b;a(J,D,N);t.r=F.color.r*N.r;t.g=F.color.g*N.g;t.b=F.color.b*N.b;t.updateStyleString()}else t.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshDepthMaterial){G=
|
|
|
-1-F.__2near/(F.__farPlusNear-D.z*F.__farMinusNear);t.setRGB(G,G,G)}else F instanceof THREE.MeshNormalMaterial&&t.setRGB(f(D.normalWorld.x),f(D.normalWorld.y),f(D.normalWorld.z));F.wireframe?H.setAttribute("style","fill: none; stroke: "+t.__styleString+"; stroke-width: "+F.wireframe_linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframe_linecap+"; stroke-linejoin: "+F.wireframe_linejoin):H.setAttribute("style","fill: "+t.__styleString+"; fill-opacity: "+F.opacity);k.appendChild(H)}
|
|
|
-function d(B){if(T[B]==null){T[B]=document.createElementNS("http://www.w3.org/2000/svg","path");l==0&&T[B].setAttribute("shape-rendering","crispEdges")}return T[B]}function f(B){return B<0?Math.min((1+B)*0.5,0.5):0.5+Math.min(B*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,n,w,u,q,x,z,C=new THREE.Rectangle,o=new THREE.Rectangle,e=!1,t=new THREE.Color(16777215),N=new THREE.Color(16777215),Q=new THREE.Color(0),ea=new THREE.Color(0),L=new THREE.Color(0),
|
|
|
-G,Y=new THREE.Vector3,T=[],da=[],Z=[],H,aa,na,ba,l=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(B){switch(B){case "high":l=1;break;case "low":l=0}};this.setSize=function(B,y){j=B;m=y;n=j/2;w=m/2;k.setAttribute("viewBox",-n+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);C.set(-n,-w,n,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(B,y){var v,p,D,F,J,U,A,R;
|
|
|
-this.autoClear&&this.clear();g=h.projectScene(B,y,this.sortElements);ba=na=aa=0;if(e=B.lights.length>0){A=B.lights;Q.setRGB(0,0,0);ea.setRGB(0,0,0);L.setRGB(0,0,0);v=0;for(p=A.length;v<p;v++){D=A[v];F=D.color;if(D instanceof THREE.AmbientLight){Q.r+=F.r;Q.g+=F.g;Q.b+=F.b}else if(D instanceof THREE.DirectionalLight){ea.r+=F.r;ea.g+=F.g;ea.b+=F.b}else if(D instanceof THREE.PointLight){L.r+=F.r;L.g+=F.g;L.b+=F.b}}}v=0;for(p=g.length;v<p;v++){A=g[v];o.empty();if(A instanceof THREE.RenderableParticle){u=
|
|
|
-A;u.x*=n;u.y*=-w;D=0;for(F=A.materials.length;D<F;D++)if(R=A.materials[D]){J=u;U=A;var O=na++;if(da[O]==null){da[O]=document.createElementNS("http://www.w3.org/2000/svg","circle");l==0&&da[O].setAttribute("shape-rendering","crispEdges")}H=da[O];H.setAttribute("cx",J.x);H.setAttribute("cy",J.y);H.setAttribute("r",U.scale.x*n);if(R instanceof THREE.ParticleCircleMaterial){if(e){N.r=Q.r+ea.r+L.r;N.g=Q.g+ea.g+L.g;N.b=Q.b+ea.b+L.b;t.r=R.color.r*N.r;t.g=R.color.g*N.g;t.b=R.color.b*N.b;t.updateStyleString()}else t=
|
|
|
-R.color;H.setAttribute("style","fill: "+t.__styleString)}k.appendChild(H)}}else if(A instanceof THREE.RenderableLine){u=A.v1;q=A.v2;u.positionScreen.x*=n;u.positionScreen.y*=-w;q.positionScreen.x*=n;q.positionScreen.y*=-w;o.addPoint(u.positionScreen.x,u.positionScreen.y);o.addPoint(q.positionScreen.x,q.positionScreen.y);if(C.instersects(o)){D=0;for(F=A.materials.length;D<F;)if(R=A.materials[D++]){J=u;U=q;O=ba++;if(Z[O]==null){Z[O]=document.createElementNS("http://www.w3.org/2000/svg","line");l==0&&
|
|
|
-Z[O].setAttribute("shape-rendering","crispEdges")}H=Z[O];H.setAttribute("x1",J.positionScreen.x);H.setAttribute("y1",J.positionScreen.y);H.setAttribute("x2",U.positionScreen.x);H.setAttribute("y2",U.positionScreen.y);if(R instanceof THREE.LineBasicMaterial){t.__styleString=R.color.__styleString;H.setAttribute("style","fill: none; stroke: "+t.__styleString+"; stroke-width: "+R.linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.linecap+"; stroke-linejoin: "+R.linejoin);k.appendChild(H)}}}}else if(A instanceof
|
|
|
-THREE.RenderableFace3){u=A.v1;q=A.v2;x=A.v3;u.positionScreen.x*=n;u.positionScreen.y*=-w;q.positionScreen.x*=n;q.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;o.addPoint(u.positionScreen.x,u.positionScreen.y);o.addPoint(q.positionScreen.x,q.positionScreen.y);o.addPoint(x.positionScreen.x,x.positionScreen.y);if(C.instersects(o)){D=0;for(F=A.meshMaterials.length;D<F;){R=A.meshMaterials[D++];if(R instanceof THREE.MeshFaceMaterial){J=0;for(U=A.faceMaterials.length;J<U;)(R=A.faceMaterials[J++])&&
|
|
|
-b(u,q,x,A,R,B)}else R&&b(u,q,x,A,R,B)}}}else if(A instanceof THREE.RenderableFace4){u=A.v1;q=A.v2;x=A.v3;z=A.v4;u.positionScreen.x*=n;u.positionScreen.y*=-w;q.positionScreen.x*=n;q.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;z.positionScreen.x*=n;z.positionScreen.y*=-w;o.addPoint(u.positionScreen.x,u.positionScreen.y);o.addPoint(q.positionScreen.x,q.positionScreen.y);o.addPoint(x.positionScreen.x,x.positionScreen.y);o.addPoint(z.positionScreen.x,z.positionScreen.y);if(C.instersects(o)){D=
|
|
|
-0;for(F=A.meshMaterials.length;D<F;){R=A.meshMaterials[D++];if(R instanceof THREE.MeshFaceMaterial){J=0;for(U=A.faceMaterials.length;J<U;)(R=A.faceMaterials[J++])&&c(u,q,x,z,A,R,B)}else R&&c(u,q,x,z,A,R,B)}}}}}};
|
|
|
-THREE.WebGLRenderer=function(a){function b(l,B,y){var v,p,D,F=l.vertices,J=F.length,U=l.colors,A=U.length,R=l.__vertexArray,O=l.__colorArray,ga=l.__sortArray,ma=l.__dirtyVertices,E=l.__dirtyColors;if(y.sortParticles){Y.multiplySelf(y.globalMatrix);for(v=0;v<J;v++){p=F[v].position;H.copy(p);Y.multiplyVector3(H);ga[v]=[H.z,v]}ga.sort(function(P,I){return I[0]-P[0]});for(v=0;v<J;v++){p=F[ga[v][1]].position;D=v*3;R[D]=p.x;R[D+1]=p.y;R[D+2]=p.z}for(v=0;v<A;v++){D=v*3;color=U[ga[v][1]];O[D]=color.r;O[D+
|
|
|
-1]=color.g;O[D+2]=color.b}}else{if(ma)for(v=0;v<J;v++){p=F[v].position;D=v*3;R[D]=p.x;R[D+1]=p.y;R[D+2]=p.z}if(E)for(v=0;v<A;v++){color=U[v];D=v*3;O[D]=color.r;O[D+1]=color.g;O[D+2]=color.b}}if(ma||y.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,R,B)}if(E||y.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,O,B)}}function c(l,B){l.fragment_shader=B.fragment_shader;l.vertex_shader=B.vertex_shader;l.uniforms=
|
|
|
-Uniforms.clone(B.uniforms)}function d(l,B){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(B.attributes.position);e.vertexAttribPointer(B.attributes.position,3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
-l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(B.attributes.normal);e.vertexAttribPointer(B.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function f(l){if(Q!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);Q=l.doubleSided}if(ea!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ea=l.flipSided}}function g(l){G[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);G[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+
|
|
|
-l.n14);G[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);G[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);G[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);G[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var B;for(l=0;l<5;l++){B=G[l];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}}function h(l){for(var B=l.globalMatrix,y=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),v=0;v<6;v++){l=G[v].x*B.n14+G[v].y*B.n24+G[v].z*B.n34+G[v].w;
|
|
|
-if(l<=y)return!1}return!0}function k(l,B){l.list[l.count]=B;l.count+=1}function j(l){var B,y,v=l.object,p=l.opaque,D=l.transparent;D.count=0;l=p.count=0;for(B=v.materials.length;l<B;l++){y=v.materials[l];y.opacity&&y.opacity<1||y.blending!=THREE.NormalBlending?k(D,y):k(p,y)}}function m(l){var B,y,v,p,D=l.object,F=l.buffer,J=l.opaque,U=l.transparent;U.count=0;l=J.count=0;for(v=D.materials.length;l<v;l++){B=D.materials[l];if(B instanceof THREE.MeshFaceMaterial){B=0;for(y=F.materials.length;B<y;B++)(p=
|
|
|
-F.materials[B])&&(p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?k(U,p):k(J,p))}else{p=B;p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?k(U,p):k(J,p)}}}function n(l,B){return B.z-l.z}function w(l,B,y,v,p){if(B[y]==undefined){l.push({buffer:v,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}});B[y]=1}}function u(l,B){l._modelViewMatrix.multiplyToArray(B.globalMatrix,l.globalMatrix,l._modelViewMatrixArray);l._normalMatrix=THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}
|
|
|
-function q(l){if(l!=L){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}L=l}}function x(l,B){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();
|
|
|
-l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,C(l.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,C(l.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,C(l.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,C(l.min_filter));e.texImage2D(e.TEXTURE_2D,0,C(l.format),
|
|
|
-l.width,l.height,0,C(l.format),C(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var y,v,p;if(l){y=l.__webGLFramebuffer;v=l.width;p=l.height}else{y=null;v=o.width;p=o.height}if(y!=N){e.bindFramebuffer(e.FRAMEBUFFER,
|
|
|
-y);e.viewport(0,0,v,p);B&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);N=y}}function z(l,B){var y;if(l=="fragment")y=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(y=e.createShader(e.VERTEX_SHADER));e.shaderSource(y,B);e.compileShader(y);if(!e.getShaderParameter(y,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(y));return null}return y}function C(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;
|
|
|
+THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;
|
|
|
+THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
+THREE.Projector=function(){function a(L,I){return I.z-L.z}function b(L,I){var Y=0,V=1,ca=L.z+L.w,da=I.z+I.w,G=-L.z+L.w,$=-I.z+I.w;if(ca>=0&&da>=0&&G>=0&&$>=0)return!0;else if(ca<0&&da<0||G<0&&$<0)return!1;else{if(ca<0)Y=Math.max(Y,ca/(ca-da));else da<0&&(V=Math.min(V,ca/(ca-da)));if(G<0)Y=Math.max(Y,G/(G-$));else $<0&&(V=Math.min(V,G/(G-$)));if(V<Y)return!1;else{L.lerpSelf(I,Y);I.lerpSelf(L,1-V);return!0}}}var c,d,f=[],g,h,k,j=[],m,n,w=[],t,p,x=[],z=new THREE.Vector4,F=new THREE.Vector4,u=new THREE.Matrix4,
|
|
|
+e=new THREE.Matrix4,q=[],O=new THREE.Vector4,R=new THREE.Vector4,ea;this.projectObjects=function(L,I,Y){I=[];var V,ca,da;d=0;ca=L.objects;L=0;for(V=ca.length;L<V;L++){da=ca[L];var G;if(!(G=!da.visible))if(G=da instanceof THREE.Mesh){a:{G=void 0;for(var $=da.globalMatrix,na=-da.geometry.boundingSphere.radius*Math.max(da.scale.x,Math.max(da.scale.y,da.scale.z)),aa=0;aa<6;aa++){G=q[aa].x*$.n14+q[aa].y*$.n24+q[aa].z*$.n34+q[aa].w;if(G<=na){G=!1;break a}}G=!0}G=!G}if(!G){c=f[d]=f[d]||new THREE.RenderableObject;
|
|
|
+z.copy(da.position);u.multiplyVector3(z);c.object=da;c.z=z.z;I.push(c);d++}}Y&&I.sort(a);return I};this.projectScene=function(L,I,Y){var V=[],ca=I.near,da=I.far,G,$,na,aa,l,A,y,v,o,B,E,H,T,D,J,P;k=n=p=0;I.autoUpdateMatrix&&I.update();u.multiply(I.projectionMatrix,I.globalMatrix);q[0]=new THREE.Vector4(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);q[1]=new THREE.Vector4(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);q[2]=new THREE.Vector4(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);q[3]=
|
|
|
+new THREE.Vector4(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);q[4]=new THREE.Vector4(u.n41-u.n31,u.n42-u.n32,u.n43-u.n33,u.n44-u.n34);q[5]=new THREE.Vector4(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);G=0;for(A=q.length;G<A;G++){y=q[G];y.divideScalar(Math.sqrt(y.x*y.x+y.y*y.y+y.z*y.z))}L.update(undefined,!1,I);A=this.projectObjects(L,I,!0);L=0;for(G=A.length;L<G;L++){y=A[L].object;y.autoUpdateMatrix&&y.updateMatrix();v=y.globalMatrix;v.extractRotationMatrix(y.rotationMatrix);E=y.rotationMatrix;
|
|
|
+o=y.materials;B=y.overdraw;if(y instanceof THREE.Mesh){H=y.geometry;T=H.vertices;$=0;for(na=T.length;$<na;$++){D=T[$];D.positionWorld.copy(D.position);v.multiplyVector3(D.positionWorld);aa=D.positionScreen;aa.copy(D.positionWorld);u.multiplyVector4(aa);aa.x/=aa.w;aa.y/=aa.w;D.__visible=aa.z>ca&&aa.z<da}H=H.faces;$=0;for(na=H.length;$<na;$++){D=H[$];if(D instanceof THREE.Face3){aa=T[D.a];l=T[D.b];J=T[D.c];if(aa.__visible&&l.__visible&&J.__visible&&(y.doubleSided||y.flipSided!=(J.positionScreen.x-aa.positionScreen.x)*
|
|
|
+(l.positionScreen.y-aa.positionScreen.y)-(J.positionScreen.y-aa.positionScreen.y)*(l.positionScreen.x-aa.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(aa.positionWorld);g.v2.positionWorld.copy(l.positionWorld);g.v3.positionWorld.copy(J.positionWorld);g.v1.positionScreen.copy(aa.positionScreen);g.v2.positionScreen.copy(l.positionScreen);g.v3.positionScreen.copy(J.positionScreen);g.normalWorld.copy(D.normal);E.multiplyVector3(g.normalWorld);g.centroidWorld.copy(D.centroid);
|
|
|
+v.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);u.multiplyVector3(g.centroidScreen);J=D.vertexNormals;ea=g.vertexNormalsWorld;aa=0;for(l=J.length;aa<l;aa++){P=ea[aa]=ea[aa]||new THREE.Vector3;P.copy(J[aa]);E.multiplyVector3(P)}g.z=g.centroidScreen.z;g.meshMaterials=o;g.faceMaterials=D.materials;g.overdraw=B;if(y.geometry.uvs[$]){g.uvs[0]=y.geometry.uvs[$][0];g.uvs[1]=y.geometry.uvs[$][1];g.uvs[2]=y.geometry.uvs[$][2]}V.push(g);k++}}else if(D instanceof THREE.Face4){aa=T[D.a];
|
|
|
+l=T[D.b];J=T[D.c];P=T[D.d];if(aa.__visible&&l.__visible&&J.__visible&&P.__visible&&(y.doubleSided||y.flipSided!=((P.positionScreen.x-aa.positionScreen.x)*(l.positionScreen.y-aa.positionScreen.y)-(P.positionScreen.y-aa.positionScreen.y)*(l.positionScreen.x-aa.positionScreen.x)<0||(l.positionScreen.x-J.positionScreen.x)*(P.positionScreen.y-J.positionScreen.y)-(l.positionScreen.y-J.positionScreen.y)*(P.positionScreen.x-J.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(aa.positionWorld);
|
|
|
+g.v2.positionWorld.copy(l.positionWorld);g.v3.positionWorld.copy(P.positionWorld);g.v1.positionScreen.copy(aa.positionScreen);g.v2.positionScreen.copy(l.positionScreen);g.v3.positionScreen.copy(P.positionScreen);g.normalWorld.copy(D.normal);E.multiplyVector3(g.normalWorld);g.centroidWorld.copy(D.centroid);v.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);u.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=o;g.faceMaterials=D.materials;g.overdraw=B;if(y.geometry.uvs[$]){g.uvs[0]=
|
|
|
+y.geometry.uvs[$][0];g.uvs[1]=y.geometry.uvs[$][1];g.uvs[2]=y.geometry.uvs[$][3]}V.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(l.positionWorld);h.v2.positionWorld.copy(J.positionWorld);h.v3.positionWorld.copy(P.positionWorld);h.v1.positionScreen.copy(l.positionScreen);h.v2.positionScreen.copy(J.positionScreen);h.v3.positionScreen.copy(P.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=
|
|
|
+h.centroidScreen.z;h.meshMaterials=o;h.faceMaterials=D.materials;h.overdraw=B;if(y.geometry.uvs[$]){h.uvs[0]=y.geometry.uvs[$][1];h.uvs[1]=y.geometry.uvs[$][2];h.uvs[2]=y.geometry.uvs[$][3]}V.push(h);k++}}}}else if(y instanceof THREE.Line){e.multiply(u,v);T=y.geometry.vertices;D=T[0];D.positionScreen.copy(D.position);e.multiplyVector4(D.positionScreen);$=1;for(na=T.length;$<na;$++){aa=T[$];aa.positionScreen.copy(aa.position);e.multiplyVector4(aa.positionScreen);l=T[$-1];O.copy(aa.positionScreen);
|
|
|
+R.copy(l.positionScreen);if(b(O,R)){O.multiplyScalar(1/O.w);R.multiplyScalar(1/R.w);m=w[n]=w[n]||new THREE.RenderableLine;m.v1.positionScreen.copy(O);m.v2.positionScreen.copy(R);m.z=Math.max(O.z,R.z);m.materials=y.materials;V.push(m);n++}}}else if(y instanceof THREE.Particle){F.set(y.position.x,y.position.y,y.position.z,1);u.multiplyVector4(F);F.z/=F.w;if(F.z>0&&F.z<1){t=x[p]=x[p]||new THREE.RenderableParticle;t.x=F.x/F.w;t.y=F.y/F.w;t.z=F.z;t.rotation=y.rotation.z;t.scale.x=y.scale.x*Math.abs(t.x-
|
|
|
+(F.x+I.projectionMatrix.n11)/(F.w+I.projectionMatrix.n14));t.scale.y=y.scale.y*Math.abs(t.y-(F.y+I.projectionMatrix.n22)/(F.w+I.projectionMatrix.n24));t.materials=y.materials;V.push(t);p++}}}Y&&V.sort(a);return V};this.unprojectVector=function(L,I){var Y=THREE.Matrix4.makeInvert(I.globalMatrix);Y.multiplySelf(THREE.Matrix4.makeInvert(I.projectionMatrix));Y.multiplyVector3(L);return L}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,n,w,t,p,x,z;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){t=a[j];if(t instanceof THREE.RenderableParticle){x=t.x*f+f;z=t.y*g+g;n=0;for(w=t.material.length;n<w;n++){p=t.material[n];if(p instanceof THREE.ParticleDOMMaterial){p=p.domElement;p.style.left=x+"px";p.style.top=z+"px"}}}}}};
|
|
|
+THREE.CanvasRenderer=function(){function a(W){if(t!=W)m.globalAlpha=t=W}function b(W){if(p!=W){switch(W){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}p=W}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),n=new THREE.Color(0),w=0,t=1,p=0,x=null,z=null,F=1,u,e,q,O,R,ea,L,I,Y,V=new THREE.Color,
|
|
|
+ca=new THREE.Color,da=new THREE.Color,G=new THREE.Color,$=new THREE.Color,na,aa,l,A,y,v,o,B,E,H=new THREE.Rectangle,T=new THREE.Rectangle,D=new THREE.Rectangle,J=!1,P=new THREE.Color,ga=new THREE.Color,la=new THREE.Color,C=new THREE.Color,Q=Math.PI*2,K=new THREE.Vector3,U,ba,ta,N,Ba,xa,Ea=16;U=document.createElement("canvas");U.width=U.height=2;ba=U.getContext("2d");ba.fillStyle="rgba(0,0,0,1)";ba.fillRect(0,0,2,2);ta=ba.getImageData(0,0,2,2);N=ta.data;Ba=document.createElement("canvas");Ba.width=
|
|
|
+Ba.height=Ea;xa=Ba.getContext("2d");xa.translate(-Ea/2,-Ea/2);xa.scale(Ea,Ea);Ea--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(W,Z){g=W;h=Z;k=g/2;j=h/2;f.width=g;f.height=h;H.set(-k,-j,k,j);t=1;p=0;z=x=null;F=1};this.setClearColor=function(W,Z){n=W;w=Z;T.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(W,Z){n.setHex(W);w=Z;T.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=function(){m.setTransform(1,
|
|
|
+0,0,-1,k,j);if(!T.isEmpty()){T.inflate(1);T.minSelf(H);if(n.hex==0&&w==0)m.clearRect(T.getX(),T.getY(),T.getWidth(),T.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+w+")";m.fillRect(T.getX(),T.getY(),T.getWidth(),T.getHeight())}T.empty()}};this.render=function(W,Z){function fa(S){var ka,ia,X,ha=S.lights;ga.setRGB(0,0,0);la.setRGB(0,0,0);C.setRGB(0,0,0);S=0;for(ka=ha.length;S<ka;S++){ia=ha[S];X=ia.color;if(ia instanceof
|
|
|
+THREE.AmbientLight){ga.r+=X.r;ga.g+=X.g;ga.b+=X.b}else if(ia instanceof THREE.DirectionalLight){la.r+=X.r;la.g+=X.g;la.b+=X.b}else if(ia instanceof THREE.PointLight){C.r+=X.r;C.g+=X.g;C.b+=X.b}}}function oa(S,ka,ia,X){var ha,ma,ya,Fa,Ha=S.lights;S=0;for(ha=Ha.length;S<ha;S++){ma=Ha[S];ya=ma.color;Fa=ma.intensity;if(ma instanceof THREE.DirectionalLight){ma=ia.dot(ma.position)*Fa;if(ma>0){X.r+=ya.r*ma;X.g+=ya.g*ma;X.b+=ya.b*ma}}else if(ma instanceof THREE.PointLight){K.sub(ma.position,ka);K.normalize();
|
|
|
+ma=ia.dot(K)*Fa;if(ma>0){X.r+=ya.r*ma;X.g+=ya.g*ma;X.b+=ya.b*ma}}}}function Ia(S,ka,ia){if(ia.opacity!=0){a(ia.opacity);b(ia.blending);var X,ha,ma,ya,Fa,Ha;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map&&ia.map.image.loaded){ya=ia.map.image;Fa=ya.width>>1;Ha=ya.height>>1;ha=ka.scale.x*k;ma=ka.scale.y*j;ia=ha*Fa;X=ma*Ha;D.set(S.x-ia,S.y-X,S.x+ia,S.y+X);if(H.instersects(D)){m.save();m.translate(S.x,S.y);m.rotate(-ka.rotation);m.scale(ha,-ma);m.translate(-Fa,-Ha);m.drawImage(ya,0,0);m.restore()}}}else if(ia instanceof
|
|
|
+THREE.ParticleCircleMaterial){if(J){P.r=ga.r+la.r+C.r;P.g=ga.g+la.g+C.g;P.b=ga.b+la.b+C.b;V.r=ia.color.r*P.r;V.g=ia.color.g*P.g;V.b=ia.color.b*P.b;V.updateStyleString()}else V.__styleString=ia.color.__styleString;ia=ka.scale.x*k;X=ka.scale.y*j;D.set(S.x-ia,S.y-X,S.x+ia,S.y+X);if(H.instersects(D)){ha=V.__styleString;if(z!=ha)m.fillStyle=z=ha;m.save();m.translate(S.x,S.y);m.rotate(-ka.rotation);m.scale(ia,X);m.beginPath();m.arc(0,0,1,0,Q,!0);m.closePath();m.fill();m.restore()}}}}function wa(S,ka,ia,
|
|
|
+X){if(X.opacity!=0){a(X.opacity);b(X.blending);m.beginPath();m.moveTo(S.positionScreen.x,S.positionScreen.y);m.lineTo(ka.positionScreen.x,ka.positionScreen.y);m.closePath();if(X instanceof THREE.LineBasicMaterial){V.__styleString=X.color.__styleString;S=X.linewidth;if(F!=S)m.lineWidth=F=S;S=V.__styleString;if(x!=S)m.strokeStyle=x=S;m.stroke();D.inflate(X.linewidth*2)}}}function M(S,ka,ia,X,ha,ma){if(ha.opacity!=0){a(ha.opacity);b(ha.blending);O=S.positionScreen.x;R=S.positionScreen.y;ea=ka.positionScreen.x;
|
|
|
+L=ka.positionScreen.y;I=ia.positionScreen.x;Y=ia.positionScreen.y;m.beginPath();m.moveTo(O,R);m.lineTo(ea,L);m.lineTo(I,Y);m.lineTo(O,R);m.closePath();if(ha instanceof THREE.MeshBasicMaterial)if(ha.map)ha.map.image.loaded&&ha.map.mapping instanceof THREE.UVMapping&&Na(O,R,ea,L,I,Y,ha.map.image,X.uvs[0].u,X.uvs[0].v,X.uvs[1].u,X.uvs[1].v,X.uvs[2].u,X.uvs[2].v);else if(ha.env_map){if(ha.env_map.image.loaded&&ha.env_map.mapping instanceof THREE.SphericalReflectionMapping){S=Z.globalMatrix;K.copy(X.vertexNormalsWorld[0]);
|
|
|
+A=(K.x*S.n11+K.y*S.n12+K.z*S.n13)*0.5+0.5;y=-(K.x*S.n21+K.y*S.n22+K.z*S.n23)*0.5+0.5;K.copy(X.vertexNormalsWorld[1]);v=(K.x*S.n11+K.y*S.n12+K.z*S.n13)*0.5+0.5;o=-(K.x*S.n21+K.y*S.n22+K.z*S.n23)*0.5+0.5;K.copy(X.vertexNormalsWorld[2]);B=(K.x*S.n11+K.y*S.n12+K.z*S.n13)*0.5+0.5;E=-(K.x*S.n21+K.y*S.n22+K.z*S.n23)*0.5+0.5;Na(O,R,ea,L,I,Y,ha.env_map.image,A,y,v,o,B,E)}}else ha.wireframe?ua(ha.color.__styleString,ha.wireframe_linewidth):Pa(ha.color.__styleString);else if(ha instanceof THREE.MeshLambertMaterial){if(ha.map&&
|
|
|
+!ha.wireframe){ha.map.mapping instanceof THREE.UVMapping&&Na(O,R,ea,L,I,Y,ha.map.image,X.uvs[0].u,X.uvs[0].v,X.uvs[1].u,X.uvs[1].v,X.uvs[2].u,X.uvs[2].v);b(THREE.SubtractiveBlending)}if(J)if(!ha.wireframe&&ha.shading==THREE.SmoothShading&&X.vertexNormalsWorld.length==3){ca.r=da.r=G.r=ga.r;ca.g=da.g=G.g=ga.g;ca.b=da.b=G.b=ga.b;oa(ma,X.v1.positionWorld,X.vertexNormalsWorld[0],ca);oa(ma,X.v2.positionWorld,X.vertexNormalsWorld[1],da);oa(ma,X.v3.positionWorld,X.vertexNormalsWorld[2],G);$.r=(da.r+G.r)*
|
|
|
+0.5;$.g=(da.g+G.g)*0.5;$.b=(da.b+G.b)*0.5;l=La(ca,da,G,$);Na(O,R,ea,L,I,Y,l,0,0,1,0,0,1)}else{P.r=ga.r;P.g=ga.g;P.b=ga.b;oa(ma,X.centroidWorld,X.normalWorld,P);V.r=ha.color.r*P.r;V.g=ha.color.g*P.g;V.b=ha.color.b*P.b;V.updateStyleString();ha.wireframe?ua(V.__styleString,ha.wireframe_linewidth):Pa(V.__styleString)}else ha.wireframe?ua(ha.color.__styleString,ha.wireframe_linewidth):Pa(ha.color.__styleString)}else if(ha instanceof THREE.MeshDepthMaterial){na=Z.near;aa=Z.far;ca.r=ca.g=ca.b=1-qa(S.positionScreen.z,
|
|
|
+na,aa);da.r=da.g=da.b=1-qa(ka.positionScreen.z,na,aa);G.r=G.g=G.b=1-qa(ia.positionScreen.z,na,aa);$.r=(da.r+G.r)*0.5;$.g=(da.g+G.g)*0.5;$.b=(da.b+G.b)*0.5;l=La(ca,da,G,$);Na(O,R,ea,L,I,Y,l,0,0,1,0,0,1)}else if(ha instanceof THREE.MeshNormalMaterial){V.r=va(X.normalWorld.x);V.g=va(X.normalWorld.y);V.b=va(X.normalWorld.z);V.updateStyleString();ha.wireframe?ua(V.__styleString,ha.wireframe_linewidth):Pa(V.__styleString)}}}function ua(S,ka){if(x!=S)m.strokeStyle=x=S;if(F!=ka)m.lineWidth=F=ka;m.stroke();
|
|
|
+D.inflate(ka*2)}function Pa(S){if(z!=S)m.fillStyle=z=S;m.fill()}function Na(S,ka,ia,X,ha,ma,ya,Fa,Ha,Oa,za,Ka,Ma){var Ja,Ga;Ja=ya.width-1;Ga=ya.height-1;Fa*=Ja;Ha*=Ga;Oa*=Ja;za*=Ga;Ka*=Ja;Ma*=Ga;ia-=S;X-=ka;ha-=S;ma-=ka;Oa-=Fa;za-=Ha;Ka-=Fa;Ma-=Ha;Ja=Oa*Ma-Ka*za;if(Ja!=0){Ga=1/Ja;Ja=(Ma*ia-za*ha)*Ga;za=(Ma*X-za*ma)*Ga;ia=(Oa*ha-Ka*ia)*Ga;X=(Oa*ma-Ka*X)*Ga;S=S-Ja*Fa-ia*Ha;ka=ka-za*Fa-X*Ha;m.save();m.transform(Ja,za,ia,X,S,ka);m.clip();m.drawImage(ya,0,0);m.restore()}}function La(S,ka,ia,X){var ha=
|
|
|
+~~(S.r*255),ma=~~(S.g*255);S=~~(S.b*255);var ya=~~(ka.r*255),Fa=~~(ka.g*255);ka=~~(ka.b*255);var Ha=~~(ia.r*255),Oa=~~(ia.g*255);ia=~~(ia.b*255);var za=~~(X.r*255),Ka=~~(X.g*255);X=~~(X.b*255);N[0]=ha<0?0:ha>255?255:ha;N[1]=ma<0?0:ma>255?255:ma;N[2]=S<0?0:S>255?255:S;N[4]=ya<0?0:ya>255?255:ya;N[5]=Fa<0?0:Fa>255?255:Fa;N[6]=ka<0?0:ka>255?255:ka;N[8]=Ha<0?0:Ha>255?255:Ha;N[9]=Oa<0?0:Oa>255?255:Oa;N[10]=ia<0?0:ia>255?255:ia;N[12]=za<0?0:za>255?255:za;N[13]=Ka<0?0:Ka>255?255:Ka;N[14]=X<0?0:X>255?255:
|
|
|
+X;ba.putImageData(ta,0,0);xa.drawImage(U,0,0);return Ba}function qa(S,ka,ia){S=(S-ka)/(ia-ka);return S*S*(3-2*S)}function va(S){S=(S+1)*0.5;return S<0?0:S>1?1:S}function ra(S,ka){var ia=ka.x-S.x,X=ka.y-S.y,ha=1/Math.sqrt(ia*ia+X*X);ia*=ha;X*=ha;ka.x+=ia;ka.y+=X;S.x-=ia;S.y-=X}var pa,sa,ja,Ca,Aa,Ra,Da,Qa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(W,Z,this.sortElements);(J=W.lights.length>0)&&fa(W);pa=0;for(sa=c.length;pa<sa;pa++){ja=c[pa];D.empty();if(ja instanceof THREE.RenderableParticle){u=
|
|
|
+ja;u.x*=k;u.y*=j;Ca=0;for(Aa=ja.materials.length;Ca<Aa;Ca++)Ia(u,ja,ja.materials[Ca],W)}else if(ja instanceof THREE.RenderableLine){u=ja.v1;e=ja.v2;u.positionScreen.x*=k;u.positionScreen.y*=j;e.positionScreen.x*=k;e.positionScreen.y*=j;D.addPoint(u.positionScreen.x,u.positionScreen.y);D.addPoint(e.positionScreen.x,e.positionScreen.y);if(H.instersects(D)){Ca=0;for(Aa=ja.materials.length;Ca<Aa;)wa(u,e,ja,ja.materials[Ca++],W)}}else if(ja instanceof THREE.RenderableFace3){u=ja.v1;e=ja.v2;q=ja.v3;u.positionScreen.x*=
|
|
|
+k;u.positionScreen.y*=j;e.positionScreen.x*=k;e.positionScreen.y*=j;q.positionScreen.x*=k;q.positionScreen.y*=j;if(ja.overdraw){ra(u.positionScreen,e.positionScreen);ra(e.positionScreen,q.positionScreen);ra(q.positionScreen,u.positionScreen)}D.add3Points(u.positionScreen.x,u.positionScreen.y,e.positionScreen.x,e.positionScreen.y,q.positionScreen.x,q.positionScreen.y);if(H.instersects(D)){Ca=0;for(Aa=ja.meshMaterials.length;Ca<Aa;){Qa=ja.meshMaterials[Ca++];if(Qa instanceof THREE.MeshFaceMaterial){Ra=
|
|
|
+0;for(Da=ja.faceMaterials.length;Ra<Da;)(Qa=ja.faceMaterials[Ra++])&&M(u,e,q,ja,Qa,W)}else M(u,e,q,ja,Qa,W)}}}T.addRectangle(D)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(A,y,v){var o,B,E,H;o=0;for(B=A.lights.length;o<B;o++){E=A.lights[o];if(E instanceof THREE.DirectionalLight){H=y.normalWorld.dot(E.position)*E.intensity;if(H>0){v.r+=E.color.r*H;v.g+=E.color.g*H;v.b+=E.color.b*H}}else if(E instanceof THREE.PointLight){Y.sub(E.position,y.centroidWorld);Y.normalize();H=y.normalWorld.dot(Y)*E.intensity;if(H>0){v.r+=E.color.r*H;v.g+=E.color.g*H;v.b+=E.color.b*H}}}}function b(A,y,v,o,B,E){G=d($++);G.setAttribute("d","M "+A.positionScreen.x+
|
|
|
+" "+A.positionScreen.y+" L "+y.positionScreen.x+" "+y.positionScreen.y+" L "+v.positionScreen.x+","+v.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)q.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(e){O.r=R.r;O.g=R.g;O.b=R.b;a(E,o,O);q.r=B.color.r*O.r;q.g=B.color.g*O.g;q.b=B.color.b*O.b;q.updateStyleString()}else q.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){I=1-B.__2near/(B.__farPlusNear-o.z*B.__farMinusNear);
|
|
|
+q.setRGB(I,I,I)}else B instanceof THREE.MeshNormalMaterial&&q.setRGB(f(o.normalWorld.x),f(o.normalWorld.y),f(o.normalWorld.z));B.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+B.opacity);k.appendChild(G)}function c(A,y,v,o,B,E,H){G=d($++);G.setAttribute("d",
|
|
|
+"M "+A.positionScreen.x+" "+A.positionScreen.y+" L "+y.positionScreen.x+" "+y.positionScreen.y+" L "+v.positionScreen.x+","+v.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");if(E instanceof THREE.MeshBasicMaterial)q.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshLambertMaterial)if(e){O.r=R.r;O.g=R.g;O.b=R.b;a(H,B,O);q.r=E.color.r*O.r;q.g=E.color.g*O.g;q.b=E.color.b*O.b;q.updateStyleString()}else q.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshDepthMaterial){I=
|
|
|
+1-E.__2near/(E.__farPlusNear-B.z*E.__farMinusNear);q.setRGB(I,I,I)}else E instanceof THREE.MeshNormalMaterial&&q.setRGB(f(B.normalWorld.x),f(B.normalWorld.y),f(B.normalWorld.z));E.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+E.wireframe_linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframe_linecap+"; stroke-linejoin: "+E.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+E.opacity);k.appendChild(G)}
|
|
|
+function d(A){if(V[A]==null){V[A]=document.createElementNS("http://www.w3.org/2000/svg","path");l==0&&V[A].setAttribute("shape-rendering","crispEdges")}return V[A]}function f(A){return A<0?Math.min((1+A)*0.5,0.5):0.5+Math.min(A*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,n,w,t,p,x,z,F=new THREE.Rectangle,u=new THREE.Rectangle,e=!1,q=new THREE.Color(16777215),O=new THREE.Color(16777215),R=new THREE.Color(0),ea=new THREE.Color(0),L=new THREE.Color(0),
|
|
|
+I,Y=new THREE.Vector3,V=[],ca=[],da=[],G,$,na,aa,l=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(A){switch(A){case "high":l=1;break;case "low":l=0}};this.setSize=function(A,y){j=A;m=y;n=j/2;w=m/2;k.setAttribute("viewBox",-n+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);F.set(-n,-w,n,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(A,y){var v,o,B,E,H,T,D,J;
|
|
|
+this.autoClear&&this.clear();g=h.projectScene(A,y,this.sortElements);aa=na=$=0;if(e=A.lights.length>0){D=A.lights;R.setRGB(0,0,0);ea.setRGB(0,0,0);L.setRGB(0,0,0);v=0;for(o=D.length;v<o;v++){B=D[v];E=B.color;if(B instanceof THREE.AmbientLight){R.r+=E.r;R.g+=E.g;R.b+=E.b}else if(B instanceof THREE.DirectionalLight){ea.r+=E.r;ea.g+=E.g;ea.b+=E.b}else if(B instanceof THREE.PointLight){L.r+=E.r;L.g+=E.g;L.b+=E.b}}}v=0;for(o=g.length;v<o;v++){D=g[v];u.empty();if(D instanceof THREE.RenderableParticle){t=
|
|
|
+D;t.x*=n;t.y*=-w;B=0;for(E=D.materials.length;B<E;B++)if(J=D.materials[B]){H=t;T=D;var P=na++;if(ca[P]==null){ca[P]=document.createElementNS("http://www.w3.org/2000/svg","circle");l==0&&ca[P].setAttribute("shape-rendering","crispEdges")}G=ca[P];G.setAttribute("cx",H.x);G.setAttribute("cy",H.y);G.setAttribute("r",T.scale.x*n);if(J instanceof THREE.ParticleCircleMaterial){if(e){O.r=R.r+ea.r+L.r;O.g=R.g+ea.g+L.g;O.b=R.b+ea.b+L.b;q.r=J.color.r*O.r;q.g=J.color.g*O.g;q.b=J.color.b*O.b;q.updateStyleString()}else q=
|
|
|
+J.color;G.setAttribute("style","fill: "+q.__styleString)}k.appendChild(G)}}else if(D instanceof THREE.RenderableLine){t=D.v1;p=D.v2;t.positionScreen.x*=n;t.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;u.addPoint(t.positionScreen.x,t.positionScreen.y);u.addPoint(p.positionScreen.x,p.positionScreen.y);if(F.instersects(u)){B=0;for(E=D.materials.length;B<E;)if(J=D.materials[B++]){H=t;T=p;P=aa++;if(da[P]==null){da[P]=document.createElementNS("http://www.w3.org/2000/svg","line");l==
|
|
|
+0&&da[P].setAttribute("shape-rendering","crispEdges")}G=da[P];G.setAttribute("x1",H.positionScreen.x);G.setAttribute("y1",H.positionScreen.y);G.setAttribute("x2",T.positionScreen.x);G.setAttribute("y2",T.positionScreen.y);if(J instanceof THREE.LineBasicMaterial){q.__styleString=J.color.__styleString;G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+J.linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.linecap+"; stroke-linejoin: "+J.linejoin);k.appendChild(G)}}}}else if(D instanceof
|
|
|
+THREE.RenderableFace3){t=D.v1;p=D.v2;x=D.v3;t.positionScreen.x*=n;t.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;u.addPoint(t.positionScreen.x,t.positionScreen.y);u.addPoint(p.positionScreen.x,p.positionScreen.y);u.addPoint(x.positionScreen.x,x.positionScreen.y);if(F.instersects(u)){B=0;for(E=D.meshMaterials.length;B<E;){J=D.meshMaterials[B++];if(J instanceof THREE.MeshFaceMaterial){H=0;for(T=D.faceMaterials.length;H<T;)(J=D.faceMaterials[H++])&&
|
|
|
+b(t,p,x,D,J,A)}else J&&b(t,p,x,D,J,A)}}}else if(D instanceof THREE.RenderableFace4){t=D.v1;p=D.v2;x=D.v3;z=D.v4;t.positionScreen.x*=n;t.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;z.positionScreen.x*=n;z.positionScreen.y*=-w;u.addPoint(t.positionScreen.x,t.positionScreen.y);u.addPoint(p.positionScreen.x,p.positionScreen.y);u.addPoint(x.positionScreen.x,x.positionScreen.y);u.addPoint(z.positionScreen.x,z.positionScreen.y);if(F.instersects(u)){B=
|
|
|
+0;for(E=D.meshMaterials.length;B<E;){J=D.meshMaterials[B++];if(J instanceof THREE.MeshFaceMaterial){H=0;for(T=D.faceMaterials.length;H<T;)(J=D.faceMaterials[H++])&&c(t,p,x,z,D,J,A)}else J&&c(t,p,x,z,D,J,A)}}}}}};
|
|
|
+THREE.WebGLRenderer=function(a){function b(l,A,y){var v,o,B,E=l.vertices,H=E.length,T=l.colors,D=T.length,J=l.__vertexArray,P=l.__colorArray,ga=l.__sortArray,la=l.__dirtyVertices,C=l.__dirtyColors;if(y.sortParticles){Y.multiplySelf(y.globalMatrix);for(v=0;v<H;v++){o=E[v].position;G.copy(o);Y.multiplyVector3(G);ga[v]=[G.z,v]}ga.sort(function(Q,K){return K[0]-Q[0]});for(v=0;v<H;v++){o=E[ga[v][1]].position;B=v*3;J[B]=o.x;J[B+1]=o.y;J[B+2]=o.z}for(v=0;v<D;v++){B=v*3;color=T[ga[v][1]];P[B]=color.r;P[B+
|
|
|
+1]=color.g;P[B+2]=color.b}}else{if(la)for(v=0;v<H;v++){o=E[v].position;B=v*3;J[B]=o.x;J[B+1]=o.y;J[B+2]=o.z}if(C)for(v=0;v<D;v++){color=T[v];B=v*3;P[B]=color.r;P[B+1]=color.g;P[B+2]=color.b}}if(la||y.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,J,A)}if(C||y.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,P,A)}}function c(l,A){l.fragment_shader=A.fragment_shader;l.vertex_shader=A.vertex_shader;l.uniforms=
|
|
|
+Uniforms.clone(A.uniforms)}function d(l,A){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(A.attributes.position);e.vertexAttribPointer(A.attributes.position,3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
+l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(A.attributes.normal);e.vertexAttribPointer(A.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function f(l){if(R!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);R=l.doubleSided}if(ea!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ea=l.flipSided}}function g(l){I[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);I[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+
|
|
|
+l.n14);I[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);I[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);I[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);I[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var A;for(l=0;l<5;l++){A=I[l];A.divideScalar(Math.sqrt(A.x*A.x+A.y*A.y+A.z*A.z))}}function h(l){for(var A=l.globalMatrix,y=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),v=0;v<6;v++){l=I[v].x*A.n14+I[v].y*A.n24+I[v].z*A.n34+I[v].w;
|
|
|
+if(l<=y)return!1}return!0}function k(l,A){l.list[l.count]=A;l.count+=1}function j(l){var A,y,v=l.object,o=l.opaque,B=l.transparent;B.count=0;l=o.count=0;for(A=v.materials.length;l<A;l++){y=v.materials[l];y.opacity&&y.opacity<1||y.blending!=THREE.NormalBlending?k(B,y):k(o,y)}}function m(l){var A,y,v,o,B=l.object,E=l.buffer,H=l.opaque,T=l.transparent;T.count=0;l=H.count=0;for(v=B.materials.length;l<v;l++){A=B.materials[l];if(A instanceof THREE.MeshFaceMaterial){A=0;for(y=E.materials.length;A<y;A++)(o=
|
|
|
+E.materials[A])&&(o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?k(T,o):k(H,o))}else{o=A;o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?k(T,o):k(H,o)}}}function n(l,A){return A.z-l.z}function w(l,A,y,v,o){if(A[y]==undefined){l.push({buffer:v,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}});A[y]=1}}function t(l,A){l._modelViewMatrix.multiplyToArray(A.globalMatrix,l.globalMatrix,l._modelViewMatrixArray);l._normalMatrix=THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}
|
|
|
+function p(l){if(l!=L){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}L=l}}function x(l,A){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();
|
|
|
+l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,F(l.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,F(l.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,F(l.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,F(l.min_filter));e.texImage2D(e.TEXTURE_2D,0,F(l.format),
|
|
|
+l.width,l.height,0,F(l.format),F(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var y,v,o;if(l){y=l.__webGLFramebuffer;v=l.width;o=l.height}else{y=null;v=u.width;o=u.height}if(y!=O){e.bindFramebuffer(e.FRAMEBUFFER,
|
|
|
+y);e.viewport(0,0,v,o);A&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);O=y}}function z(l,A){var y;if(l=="fragment")y=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(y=e.createShader(e.VERTEX_SHADER));e.shaderSource(y,A);e.compileShader(y);if(!e.getShaderParameter(y,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(y));return null}return y}function F(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;
|
|
|
case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;
|
|
|
-case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var o=document.createElement("canvas"),e,t=null,N=null,Q=null,ea=null,L=null,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
-new THREE.Vector4],Y=new THREE.Matrix4,T=new Float32Array(16),da=new Float32Array(16),Z=new Float32Array(16),H=new THREE.Vector4,aa=!0,na=new THREE.Color(0),ba=0;if(a){if(a.antialias!==undefined)aa=a.antialias;a.clearColor!==undefined&&na.setHex(a.clearColor);if(a.clearAlpha!==undefined)ba=a.clearAlpha}this.domElement=o;this.autoClear=!0;this.sortObjects=!1;(function(l,B,y){try{e=o.getContext("experimental-webgl",{antialias:l})}catch(v){console.log(v)}if(!e){alert("WebGL not supported");throw"cannot create webgl context";
|
|
|
-}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(B.r,B.g,B.b,y);_cullEnabled=!0})(aa,na,ba);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,B){o.width=l;o.height=B;e.viewport(0,0,o.width,o.height)};this.setClearColorHex=function(l,
|
|
|
-B){var y=new THREE.Color(l);e.clearColor(y.r,y.g,y.b,B)};this.setClearColor=function(l,B){e.clearColor(l.r,l.g,l.b,B)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.setupLights=function(l,B){var y,v,p,D=0,F=0,J=0,U,A,R,O=this.lights,ga=O.directional.colors,ma=O.directional.positions,E=O.point.colors,P=O.point.positions,I=0,V=0;y=p=p=0;for(v=B.length;y<v;y++){p=B[y];U=p.color;A=p.position;R=p.intensity;if(p instanceof THREE.AmbientLight){D+=U.r;F+=U.g;J+=U.b}else if(p instanceof
|
|
|
-THREE.DirectionalLight){p=I*3;ga[p]=U.r*R;ga[p+1]=U.g*R;ga[p+2]=U.b*R;ma[p]=A.x;ma[p+1]=A.y;ma[p+2]=A.z;I+=1}else if(p instanceof THREE.PointLight){p=V*3;E[p]=U.r*R;E[p+1]=U.g*R;E[p+2]=U.b*R;P[p]=A.x;P[p+1]=A.y;P[p+2]=A.z;V+=1}}for(y=I*3;y<ga.length;y++)ga[y]=0;for(y=V*3;y<E.length;y++)E[y]=0;O.point.length=V;O.directional.length=I;O.ambient[0]=D;O.ambient[1]=F;O.ambient[2]=J};this.initMaterial=function(l,B,y){var v,p;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof
|
|
|
-THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var D,F,J,U;p=J=U=0;for(D=B.length;p<D;p++){F=B[p];F instanceof THREE.DirectionalLight&&
|
|
|
-J++;F instanceof THREE.PointLight&&U++}if(U+J<=4)B=J;else{B=Math.ceil(4*J/(U+J));U=4-B}p={directional:B,point:U};U=l.fragment_shader;B=l.vertex_shader;D={fog:y,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLights:p.directional,maxPointLights:p.point};y=e.createProgram();p=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+D.maxPointLights,D.fog?"#define USE_FOG":"",D.fog instanceof
|
|
|
-THREE.FogExp2?"#define FOG_EXP2":"",D.map?"#define USE_MAP":"",D.env_map?"#define USE_ENVMAP":"",D.light_map?"#define USE_LIGHTMAP":"",D.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");D=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+D.maxPointLights,D.map?"#define USE_MAP":"",D.env_map?"#define USE_ENVMAP":"",D.light_map?"#define USE_LIGHTMAP":
|
|
|
-"",D.vertex_colors?"#define USE_COLOR":"",D.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
-e.attachShader(y,z("fragment",p+U));e.attachShader(y,z("vertex",D+B));e.linkProgram(y);e.getProgramParameter(y,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");y.uniforms={};y.attributes={};l.program=y;y=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(v in l.uniforms)y.push(v);v=l.program;U=0;for(B=y.length;U<
|
|
|
-B;U++){p=y[U];v.uniforms[p]=e.getUniformLocation(v,p)}l=l.program;v=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];y=0;for(U=v.length;y<U;y++){B=v[y];l.attributes[B]=e.getAttribLocation(l,B)}};this.setProgram=function(l,B,y,v,p){v.program||this.initMaterial(v,B,y);var D=v.program,F=D.uniforms,J=v.uniforms;if(D!=t){e.useProgram(D);t=D;e.uniformMatrix4fv(F.projectionMatrix,!1,T)}if(y&&(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||
|
|
|
-v instanceof THREE.MeshPhongMaterial||v instanceof THREE.LineBasicMaterial||v instanceof THREE.ParticleBasicMaterial)){J.fogColor.value.setHex(y.color.hex);if(y instanceof THREE.Fog){J.fogNear.value=y.near;J.fogFar.value=y.far}else if(y instanceof THREE.FogExp2)J.fogDensity.value=y.density}if(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial){this.setupLights(D,B);B=this.lights;J.enableLighting.value=B.directional.length+B.point.length;J.ambientLightColor.value=B.ambient;
|
|
|
-J.directionalLightColor.value=B.directional.colors;J.directionalLightDirection.value=B.directional.positions;J.pointLightColor.value=B.point.colors;J.pointLightPosition.value=B.point.positions}if(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial){J.diffuse.value.setRGB(v.color.r*v.opacity,v.color.g*v.opacity,v.color.b*v.opacity);J.opacity.value=v.opacity;J.map.texture=v.map;J.light_map.texture=v.light_map;J.env_map.texture=v.env_map;
|
|
|
-J.reflectivity.value=v.reflectivity;J.refraction_ratio.value=v.refraction_ratio;J.combine.value=v.combine;J.useRefract.value=v.env_map&&v.env_map.mapping instanceof THREE.CubeRefractionMapping}if(v instanceof THREE.LineBasicMaterial){J.diffuse.value.setRGB(v.color.r*v.opacity,v.color.g*v.opacity,v.color.b*v.opacity);J.opacity.value=v.opacity}else if(v instanceof THREE.ParticleBasicMaterial){J.psColor.value.setRGB(v.color.r*v.opacity,v.color.g*v.opacity,v.color.b*v.opacity);J.opacity.value=v.opacity;
|
|
|
-J.size.value=v.size;J.map.texture=v.map}else if(v instanceof THREE.MeshPhongMaterial){J.ambient.value.setRGB(v.ambient.r,v.ambient.g,v.ambient.b);J.specular.value.setRGB(v.specular.r,v.specular.g,v.specular.b);J.shininess.value=v.shininess}else if(v instanceof THREE.MeshDepthMaterial){J.mNear.value=l.near;J.mFar.value=l.far;J.opacity.value=v.opacity}else if(v instanceof THREE.MeshNormalMaterial)J.opacity.value=v.opacity;var U,A,R;for(U in J)if(R=D.uniforms[U]){y=J[U];A=y.type;B=y.value;if(A=="i")e.uniform1i(R,
|
|
|
-B);else if(A=="f")e.uniform1f(R,B);else if(A=="fv1")e.uniform1fv(R,B);else if(A=="fv")e.uniform3fv(R,B);else if(A=="v2")e.uniform2f(R,B.x,B.y);else if(A=="v3")e.uniform3f(R,B.x,B.y,B.z);else if(A=="c")e.uniform3f(R,B.r,B.g,B.b);else if(A=="t"){e.uniform1i(R,B);if(y=y.texture)if(y.image instanceof Array&&y.image.length==6){if(y.image.length==6){if(!y.image.__webGLTextureCube&&!y.image.__cubeMapInitialized&&y.image.loadCount==6){y.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,
|
|
|
-y.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(A=0;A<6;++A)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,y.image[A]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);y.image.__cubeMapInitialized=
|
|
|
-!0}e.activeTexture(e.TEXTURE0+B);e.bindTexture(e.TEXTURE_CUBE_MAP,y.image.__webGLTextureCube)}}else{if(!y.__webGLTexture&&y.image.loaded){y.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,y.__webGLTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,y.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,C(y.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,C(y.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,C(y.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,
|
|
|
-C(y.min_filter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}e.activeTexture(e.TEXTURE0+B);e.bindTexture(e.TEXTURE_2D,y.__webGLTexture)}}}e.uniformMatrix4fv(F.modelViewMatrix,!1,p._modelViewMatrixArray);e.uniformMatrix3fv(F.normalMatrix,!1,p._normalMatrixArray);(v instanceof THREE.MeshShaderMaterial||v instanceof THREE.MeshPhongMaterial||v.env_map)&&e.uniform3f(F.cameraPosition,l.position.x,l.position.y,l.position.z);(v instanceof THREE.MeshShaderMaterial||v.env_map||v.skinning)&&
|
|
|
-e.uniformMatrix4fv(F.objectMatrix,!1,p._objectMatrixArray);(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshShaderMaterial||v.skinning)&&e.uniformMatrix4fv(F.viewMatrix,!1,Z);if(v.skinning){e.uniformMatrix4fv(F.cameraInverseMatrix,!1,da);e.uniformMatrix4fv(F.uBoneGlobalMatrices,!1,p.boneMatrices)}return D};this.renderBuffer=function(l,B,y,v,p,D){l=this.setProgram(l,B,y,v,D).attributes;e.bindBuffer(e.ARRAY_BUFFER,p.__webGLVertexBuffer);e.vertexAttribPointer(l.position,
|
|
|
-3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.position);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.color)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.normal)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.tangent)}if(l.uv>=
|
|
|
-0)if(p.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(p.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);if(D instanceof THREE.SkinnedMesh){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,
|
|
|
-4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinVertexA);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinVertexB);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinIndex);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinWeight)}if(D instanceof
|
|
|
-THREE.Mesh)if(v.wireframe){e.lineWidth(v.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);e.drawElements(e.LINES,p.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,p.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(D instanceof THREE.Line){D=D.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(D,0,p.__webGLLineCount)}else D instanceof THREE.ParticleSystem&&e.drawArrays(e.POINTS,
|
|
|
-0,p.__webGLParticleCount)};this.render=function(l,B,y,v){var p,D,F,J,U,A,R,O=l.lights,ga=l.fog;B.autoUpdateMatrix&&B.update();B.globalMatrix.flattenToArray(Z);B.projectionMatrix.flattenToArray(T);B.inverseMatrix.flattenToArray(da);Y.multiply(B.projectionMatrix,B.globalMatrix);g(Y);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined,!1,B,this);this.initWebGLObjects(l,B);x(y,v!==undefined?v:!0);this.autoClear&&this.clear();J=l.__webGLObjects.length;for(v=0;v<J;v++){p=l.__webGLObjects[v];
|
|
|
-A=p.object;if(A.visible)if(!(A instanceof THREE.Mesh)||h(A)){A.globalMatrix.flattenToArray(A._objectMatrixArray);u(A,B);m(p);p.render=!0;if(this.sortObjects){H.copy(A.position);Y.multiplyVector3(H);p.z=H.z}}else p.render=!1;else p.render=!1}this.sortObjects&&l.__webGLObjects.sort(n);U=l.__webGLObjectsImmediate.length;for(v=0;v<U;v++){p=l.__webGLObjectsImmediate[v];A=p.object;if(A.visible){A.autoUpdateMatrix&&A.globalMatrix.flattenToArray(A._objectMatrixArray);u(A,B);j(p)}}q(THREE.NormalBlending);
|
|
|
-for(v=0;v<J;v++){p=l.__webGLObjects[v];if(p.render){A=p.object;R=p.buffer;F=p.opaque;f(A);for(p=0;p<F.count;p++){material=F.list[p];this.setDepthTest(material.depth_test);this.renderBuffer(B,O,ga,material,R,A)}}}for(v=0;v<U;v++){p=l.__webGLObjectsImmediate[v];A=p.object;if(A.visible){F=p.opaque;f(A);for(p=0;p<F.count;p++){material=F.list[p];this.setDepthTest(material.depth_test);D=this.setProgram(B,O,ga,material,A);A.render(function(ma){d(ma,D)})}}}for(v=0;v<J;v++){p=l.__webGLObjects[v];if(p.render){A=
|
|
|
-p.object;R=p.buffer;F=p.transparent;f(A);for(p=0;p<F.count;p++){material=F.list[p];q(material.blending);this.setDepthTest(material.depth_test);this.renderBuffer(B,O,ga,material,R,A)}}}for(v=0;v<U;v++){p=l.__webGLObjectsImmediate[v];A=p.object;if(A.visible){F=p.transparent;f(A);for(p=0;p<F.count;p++){material=F.list[p];q(material.blending);this.setDepthTest(material.depth_test);D=this.setProgram(B,O,ga,material,A);A.render(function(ma){d(ma,D)})}}}if(y&&y.min_filter!==THREE.NearestFilter&&y.min_filter!==
|
|
|
-THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,y.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){var B,y,v;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}B=0;for(y=l.objects.length;B<y;B++){v=l.objects[B];var p=l,D=void 0,F=void 0,J=void 0,U=void 0;F=v.geometry;if(p.__webGLObjectsMap[v.id]==undefined){p.__webGLObjectsMap[v.id]={};v._modelViewMatrix=new THREE.Matrix4;v._normalMatrixArray=
|
|
|
-new Float32Array(9);v._modelViewMatrixArray=new Float32Array(16);v._objectMatrixArray=new Float32Array(16);v.globalMatrix.flattenToArray(v._objectMatrixArray)}U=p.__webGLObjectsMap[v.id];objlist=p.__webGLObjects;if(v instanceof THREE.Mesh){for(D in F.geometryChunks){J=F.geometryChunks[D];if(!J.__webGLVertexBuffer){p=J;p.__webGLVertexBuffer=e.createBuffer();p.__webGLNormalBuffer=e.createBuffer();p.__webGLTangentBuffer=e.createBuffer();p.__webGLColorBuffer=e.createBuffer();p.__webGLUVBuffer=e.createBuffer();
|
|
|
-p.__webGLUV2Buffer=e.createBuffer();p.__webGLSkinVertexABuffer=e.createBuffer();p.__webGLSkinVertexBBuffer=e.createBuffer();p.__webGLSkinIndicesBuffer=e.createBuffer();p.__webGLSkinWeightsBuffer=e.createBuffer();p.__webGLFaceBuffer=e.createBuffer();p.__webGLLineBuffer=e.createBuffer();p=J;var A=v,R=void 0,O=void 0,ga=0,ma=0,E=0,P=A.geometry.faces,I=p.faces;R=0;for(O=I.length;R<O;R++){fi=I[R];face=P[fi];if(face instanceof THREE.Face3){ga+=3;ma+=1;E+=3}else if(face instanceof THREE.Face4){ga+=4;ma+=
|
|
|
-2;E+=4}}p.__vertexArray=new Float32Array(ga*3);p.__normalArray=new Float32Array(ga*3);p.__tangentArray=new Float32Array(ga*4);p.__colorArray=new Float32Array(ga*3);p.__uvArray=new Float32Array(ga*2);p.__uv2Array=new Float32Array(ga*2);p.__skinVertexAArray=new Float32Array(ga*4);p.__skinVertexBArray=new Float32Array(ga*4);p.__skinIndexArray=new Float32Array(ga*4);p.__skinWeightArray=new Float32Array(ga*4);p.__faceArray=new Uint16Array(ma*3);p.__lineArray=new Uint16Array(E*2);O=R=p;ga=void 0;P=void 0;
|
|
|
-var V=void 0,ca=void 0;V=void 0;I=!1;ga=0;for(P=A.materials.length;ga<P;ga++){V=A.materials[ga];if(V instanceof THREE.MeshFaceMaterial){V=0;for(ca=O.materials.length;V<ca;V++)if(O.materials[V]&&O.materials[V].shading!=undefined&&O.materials[V].shading==THREE.SmoothShading){I=!0;break}}else if(V&&V.shading!=undefined&&V.shading==THREE.SmoothShading){I=!0;break}if(I)break}R.__needsSmoothNormals=I;p.__webGLFaceCount=ma*3;p.__webGLLineCount=E*2;F.__dirtyVertices=!0;F.__dirtyElements=!0;F.__dirtyUvs=!0;
|
|
|
-F.__dirtyNormals=!0;F.__dirtyTangents=!0;F.__dirtyColors=!0}if(F.__dirtyVertices||F.__dirtyElements||F.__dirtyUvs||F.__dirtyNormals||F.__dirtyColors||F.__dirtyTangents){p=J;ma=e.DYNAMIC_DRAW;E=void 0;R=void 0;var ta=void 0,M=void 0,Ba=void 0,xa=void 0,Ea=void 0;ta=void 0;var W=void 0,$=void 0,fa=void 0,oa=void 0;W=void 0;$=void 0;fa=void 0;M=void 0;W=void 0;$=void 0;fa=void 0;oa=void 0;W=void 0;$=void 0;fa=void 0;oa=void 0;W=void 0;$=void 0;fa=void 0;oa=void 0;W=void 0;$=void 0;fa=void 0;oa=void 0;
|
|
|
-W=void 0;$=void 0;fa=void 0;oa=void 0;M=void 0;xa=void 0;Ba=void 0;Ea=void 0;var Ia=ca=V=I=P=ga=A=O=0,wa=0,K=0,ua=p.__vertexArray,Pa=p.__uvArray,Na=p.__uv2Array,La=p.__normalArray,qa=p.__tangentArray,va=p.__colorArray,ra=p.__skinVertexAArray,pa=p.__skinVertexBArray,sa=p.__skinIndexArray,ja=p.__skinWeightArray,Ca=p.__faceArray,Aa=p.__lineArray,Ra=p.__needsSmoothNormals,Da=v.geometry,Qa=Da.__dirtyVertices,S=Da.__dirtyElements,ka=Da.__dirtyUvs,ia=Da.__dirtyNormals,X=Da.__dirtyTangents,ha=Da.__dirtyColors,
|
|
|
-la=Da.vertices,ya=p.faces,Fa=Da.faces,Ha=Da.uvs,Oa=Da.uvs2,za=Da.colors,Ka=Da.skinVerticesA,Ma=Da.skinVerticesB,Ja=Da.skinIndices,Ga=Da.skinWeights;E=0;for(R=ya.length;E<R;E++){ta=ya[E];M=Fa[ta];Ea=Ha[ta];ta=Oa[ta];Ba=M.vertexNormals;xa=M.normal;if(M instanceof THREE.Face3){if(Qa){W=la[M.a].position;$=la[M.b].position;fa=la[M.c].position;ua[A]=W.x;ua[A+1]=W.y;ua[A+2]=W.z;ua[A+3]=$.x;ua[A+4]=$.y;ua[A+5]=$.z;ua[A+6]=fa.x;ua[A+7]=fa.y;ua[A+8]=fa.z;A+=9}if(Ga.length){W=Ga[M.a];$=Ga[M.b];fa=Ga[M.c];ja[K]=
|
|
|
-W.x;ja[K+1]=W.y;ja[K+2]=W.z;ja[K+3]=W.w;ja[K+4]=$.x;ja[K+5]=$.y;ja[K+6]=$.z;ja[K+7]=$.w;ja[K+8]=fa.x;ja[K+9]=fa.y;ja[K+10]=fa.z;ja[K+11]=fa.w;W=Ja[M.a];$=Ja[M.b];fa=Ja[M.c];sa[K]=W.x;sa[K+1]=W.y;sa[K+2]=W.z;sa[K+3]=W.w;sa[K+4]=$.x;sa[K+5]=$.y;sa[K+6]=$.z;sa[K+7]=$.w;sa[K+8]=fa.x;sa[K+9]=fa.y;sa[K+10]=fa.z;sa[K+11]=fa.w;W=Ka[M.a];$=Ka[M.b];fa=Ka[M.c];ra[K]=W.x;ra[K+1]=W.y;ra[K+2]=W.z;ra[K+3]=1;ra[K+4]=$.x;ra[K+5]=$.y;ra[K+6]=$.z;ra[K+7]=1;ra[K+8]=fa.x;ra[K+9]=fa.y;ra[K+10]=fa.z;ra[K+11]=1;W=Ma[M.a];
|
|
|
-$=Ma[M.b];fa=Ma[M.c];pa[K]=W.x;pa[K+1]=W.y;pa[K+2]=W.z;pa[K+3]=1;pa[K+4]=$.x;pa[K+5]=$.y;pa[K+6]=$.z;pa[K+7]=1;pa[K+8]=fa.x;pa[K+9]=fa.y;pa[K+10]=fa.z;pa[K+11]=1;K+=12}if(ha&&za.length){W=za[M.a];$=za[M.b];fa=za[M.c];va[wa]=W.r;va[wa+1]=W.g;va[wa+2]=W.b;va[wa+3]=$.r;va[wa+4]=$.g;va[wa+5]=$.b;va[wa+6]=fa.r;va[wa+7]=fa.g;va[wa+8]=fa.b;wa+=9}if(X&&Da.hasTangents){W=la[M.a].tangent;$=la[M.b].tangent;fa=la[M.c].tangent;qa[ca]=W.x;qa[ca+1]=W.y;qa[ca+2]=W.z;qa[ca+3]=W.w;qa[ca+4]=$.x;qa[ca+5]=$.y;qa[ca+6]=
|
|
|
-$.z;qa[ca+7]=$.w;qa[ca+8]=fa.x;qa[ca+9]=fa.y;qa[ca+10]=fa.z;qa[ca+11]=fa.w;ca+=12}if(ia)if(Ba.length==3&&Ra)for(M=0;M<3;M++){xa=Ba[M];La[V]=xa.x;La[V+1]=xa.y;La[V+2]=xa.z;V+=3}else for(M=0;M<3;M++){La[V]=xa.x;La[V+1]=xa.y;La[V+2]=xa.z;V+=3}if(ka&&Ea)for(M=0;M<3;M++){Ba=Ea[M];Pa[ga]=Ba.u;Pa[ga+1]=Ba.v;ga+=2}if(ka&&ta)for(M=0;M<3;M++){Ea=ta[M];Na[P]=Ea.u;Na[P+1]=Ea.v;P+=2}if(S){Ca[I]=O;Ca[I+1]=O+1;Ca[I+2]=O+2;I+=3;Aa[Ia]=O;Aa[Ia+1]=O+1;Aa[Ia+2]=O;Aa[Ia+3]=O+2;Aa[Ia+4]=O+1;Aa[Ia+5]=O+2;Ia+=6;O+=3}}else if(M instanceof
|
|
|
-THREE.Face4){if(Qa){W=la[M.a].position;$=la[M.b].position;fa=la[M.c].position;oa=la[M.d].position;ua[A]=W.x;ua[A+1]=W.y;ua[A+2]=W.z;ua[A+3]=$.x;ua[A+4]=$.y;ua[A+5]=$.z;ua[A+6]=fa.x;ua[A+7]=fa.y;ua[A+8]=fa.z;ua[A+9]=oa.x;ua[A+10]=oa.y;ua[A+11]=oa.z;A+=12}if(Ga.length){W=Ga[M.a];$=Ga[M.b];fa=Ga[M.c];oa=Ga[M.d];ja[K]=W.x;ja[K+1]=W.y;ja[K+2]=W.z;ja[K+3]=W.w;ja[K+4]=$.x;ja[K+5]=$.y;ja[K+6]=$.z;ja[K+7]=$.w;ja[K+8]=fa.x;ja[K+9]=fa.y;ja[K+10]=fa.z;ja[K+11]=fa.w;ja[K+12]=oa.x;ja[K+13]=oa.y;ja[K+14]=oa.z;ja[K+
|
|
|
-15]=oa.w;W=Ja[M.a];$=Ja[M.b];fa=Ja[M.c];oa=Ja[M.d];sa[K]=W.x;sa[K+1]=W.y;sa[K+2]=W.z;sa[K+3]=W.w;sa[K+4]=$.x;sa[K+5]=$.y;sa[K+6]=$.z;sa[K+7]=$.w;sa[K+8]=fa.x;sa[K+9]=fa.y;sa[K+10]=fa.z;sa[K+11]=fa.w;sa[K+12]=oa.x;sa[K+13]=oa.y;sa[K+14]=oa.z;sa[K+15]=oa.w;W=Ka[M.a];$=Ka[M.b];fa=Ka[M.c];oa=Ka[M.d];ra[K]=W.x;ra[K+1]=W.y;ra[K+2]=W.z;ra[K+3]=1;ra[K+4]=$.x;ra[K+5]=$.y;ra[K+6]=$.z;ra[K+7]=1;ra[K+8]=fa.x;ra[K+9]=fa.y;ra[K+10]=fa.z;ra[K+11]=1;ra[K+12]=oa.x;ra[K+13]=oa.y;ra[K+14]=oa.z;ra[K+15]=1;W=Ma[M.a];
|
|
|
-$=Ma[M.b];fa=Ma[M.c];oa=Ma[M.d];pa[K]=W.x;pa[K+1]=W.y;pa[K+2]=W.z;pa[K+3]=1;pa[K+4]=$.x;pa[K+5]=$.y;pa[K+6]=$.z;pa[K+7]=1;pa[K+8]=fa.x;pa[K+9]=fa.y;pa[K+10]=fa.z;pa[K+11]=1;pa[K+12]=oa.x;pa[K+13]=oa.y;pa[K+14]=oa.z;pa[K+15]=1;K+=16}if(ha&&za.length){W=za[M.a];$=za[M.b];fa=za[M.c];oa=za[M.d];va[wa]=W.r;va[wa+1]=W.g;va[wa+2]=W.b;va[wa+3]=$.r;va[wa+4]=$.g;va[wa+5]=$.b;va[wa+6]=fa.r;va[wa+7]=fa.g;va[wa+8]=fa.b;va[wa+9]=oa.r;va[wa+10]=oa.g;va[wa+11]=oa.b;wa+=12}if(X&&Da.hasTangents){W=la[M.a].tangent;
|
|
|
-$=la[M.b].tangent;fa=la[M.c].tangent;M=la[M.d].tangent;qa[ca]=W.x;qa[ca+1]=W.y;qa[ca+2]=W.z;qa[ca+3]=W.w;qa[ca+4]=$.x;qa[ca+5]=$.y;qa[ca+6]=$.z;qa[ca+7]=$.w;qa[ca+8]=fa.x;qa[ca+9]=fa.y;qa[ca+10]=fa.z;qa[ca+11]=fa.w;qa[ca+12]=M.x;qa[ca+13]=M.y;qa[ca+14]=M.z;qa[ca+15]=M.w;ca+=16}if(ia)if(Ba.length==4&&Ra)for(M=0;M<4;M++){xa=Ba[M];La[V]=xa.x;La[V+1]=xa.y;La[V+2]=xa.z;V+=3}else for(M=0;M<4;M++){La[V]=xa.x;La[V+1]=xa.y;La[V+2]=xa.z;V+=3}if(ka&&Ea)for(M=0;M<4;M++){Ba=Ea[M];Pa[ga]=Ba.u;Pa[ga+1]=Ba.v;ga+=
|
|
|
-2}if(ka&&ta)for(M=0;M<4;M++){Ea=ta[M];Na[P]=Ea.u;Na[P+1]=Ea.v;P+=2}if(S){Ca[I]=O;Ca[I+1]=O+1;Ca[I+2]=O+2;Ca[I+3]=O;Ca[I+4]=O+2;Ca[I+5]=O+3;I+=6;Aa[Ia]=O;Aa[Ia+1]=O+1;Aa[Ia+2]=O;Aa[Ia+3]=O+3;Aa[Ia+4]=O+1;Aa[Ia+5]=O+2;Aa[Ia+6]=O+2;Aa[Ia+7]=O+3;Ia+=8;O+=4}}}if(Qa){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ua,ma)}if(ha&&za.length){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,va,ma)}if(ia){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLNormalBuffer);
|
|
|
-e.bufferData(e.ARRAY_BUFFER,La,ma)}if(X&&Da.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,qa,ma)}if(ka&&ga>0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,ma)}if(ka&&P>0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Na,ma)}if(S){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ca,ma);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,
|
|
|
-Aa,ma)}if(K>0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ra,ma);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,pa,ma);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,sa,ma);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ja,ma)}}w(objlist,U,D,J,v)}F.__dirtyVertices=!1;F.__dirtyElements=!1;F.__dirtyUvs=!1;F.__dirtyNormals=!1;F.__dirtyTangents=!1;F.__dirtyColors=
|
|
|
-!1}else if(v instanceof THREE.Line){if(!F.__webGLVertexBuffer){D=F;D.__webGLVertexBuffer=e.createBuffer();D.__webGLColorBuffer=e.createBuffer();D=F;J=D.vertices.length;D.__vertexArray=new Float32Array(J*3);D.__colorArray=new Float32Array(J*3);D.__webGLLineCount=J;F.__dirtyVertices=!0;F.__dirtyColors=!0}if(F.__dirtyVertices||F.__dirtyColors){D=F;J=e.DYNAMIC_DRAW;O=void 0;O=void 0;A=void 0;p=void 0;ga=D.vertices;ma=D.colors;P=ga.length;E=ma.length;I=D.__vertexArray;R=D.__colorArray;V=D.__dirtyColors;
|
|
|
-if(D.__dirtyVertices){for(O=0;O<P;O++){A=ga[O].position;p=O*3;I[p]=A.x;I[p+1]=A.y;I[p+2]=A.z}e.bindBuffer(e.ARRAY_BUFFER,D.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,J)}if(V){for(O=0;O<E;O++){color=ma[O];p=O*3;R[p]=color.r;R[p+1]=color.g;R[p+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,D.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,R,J)}}w(objlist,U,0,F,v);F.__dirtyVertices=!1;F.__dirtyColors=!1}else if(v instanceof THREE.ParticleSystem){if(!F.__webGLVertexBuffer){D=F;D.__webGLVertexBuffer=e.createBuffer();
|
|
|
-D.__webGLColorBuffer=e.createBuffer();D=F;J=D.vertices.length;D.__vertexArray=new Float32Array(J*3);D.__colorArray=new Float32Array(J*3);D.__sortArray=[];D.__webGLParticleCount=J;F.__dirtyVertices=!0;F.__dirtyColors=!0}(F.__dirtyVertices||F.__dirtyColors||v.sortParticles)&&b(F,e.DYNAMIC_DRAW,v,camera);w(objlist,U,0,F,v);F.__dirtyVertices=!1;F.__dirtyColors=!1}else if(v instanceof THREE.MarchingCubes){F=U;if(F[0]==undefined){p.__webGLObjectsImmediate.push({object:v,opaque:{list:[],count:0},transparent:{list:[],
|
|
|
-count:0}});F[0]=1}}}};this.removeObject=function(l,B){var y,v;for(y=l.__webGLObjects.length-1;y>=0;y--){v=l.__webGLObjects[y].object;B==v&&l.__webGLObjects.splice(y,1)}};this.addToRenderList=function(){};this.removeFromRenderList=function(){};this.setDepthTest=function(l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)};this.setFaceCulling=function(l,B){if(l){!B||B=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);
|
|
|
-e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
+case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var u=document.createElement("canvas"),e,q=null,O=null,R=null,ea=null,L=null,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
+new THREE.Vector4],Y=new THREE.Matrix4,V=new Float32Array(16),ca=new Float32Array(16),da=new Float32Array(16),G=new THREE.Vector4,$=!0,na=new THREE.Color(0),aa=0;if(a){if(a.antialias!==undefined)$=a.antialias;a.clearColor!==undefined&&na.setHex(a.clearColor);if(a.clearAlpha!==undefined)aa=a.clearAlpha}this.domElement=u;this.autoClear=!0;this.sortObjects=!1;(function(l,A,y){try{e=u.getContext("experimental-webgl",{antialias:l})}catch(v){console.log(v)}if(!e){alert("WebGL not supported");throw"cannot create webgl context";
|
|
|
+}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(A.r,A.g,A.b,y);_cullEnabled=!0})($,na,aa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,A){u.width=l;u.height=A;e.viewport(0,0,u.width,u.height)};this.setClearColorHex=function(l,
|
|
|
+A){var y=new THREE.Color(l);e.clearColor(y.r,y.g,y.b,A)};this.setClearColor=function(l,A){e.clearColor(l.r,l.g,l.b,A)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.setupLights=function(l,A){var y,v,o,B=0,E=0,H=0,T,D,J,P=this.lights,ga=P.directional.colors,la=P.directional.positions,C=P.point.colors,Q=P.point.positions,K=0,U=0;y=o=o=0;for(v=A.length;y<v;y++){o=A[y];T=o.color;D=o.position;J=o.intensity;if(o instanceof THREE.AmbientLight){B+=T.r;E+=T.g;H+=T.b}else if(o instanceof
|
|
|
+THREE.DirectionalLight){o=K*3;ga[o]=T.r*J;ga[o+1]=T.g*J;ga[o+2]=T.b*J;la[o]=D.x;la[o+1]=D.y;la[o+2]=D.z;K+=1}else if(o instanceof THREE.PointLight){o=U*3;C[o]=T.r*J;C[o+1]=T.g*J;C[o+2]=T.b*J;Q[o]=D.x;Q[o+1]=D.y;Q[o+2]=D.z;U+=1}}for(y=K*3;y<ga.length;y++)ga[y]=0;for(y=U*3;y<C.length;y++)C[y]=0;P.point.length=U;P.directional.length=K;P.ambient[0]=B;P.ambient[1]=E;P.ambient[2]=H};this.initMaterial=function(l,A,y){var v,o;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof
|
|
|
+THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var B,E,H,T;o=H=T=0;for(B=A.length;o<B;o++){E=A[o];E instanceof THREE.DirectionalLight&&
|
|
|
+H++;E instanceof THREE.PointLight&&T++}if(T+H<=4)A=H;else{A=Math.ceil(4*H/(T+H));T=4-A}o={directional:A,point:T};T=l.fragment_shader;A=l.vertex_shader;B={fog:y,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLights:o.directional,maxPointLights:o.point};y=e.createProgram();o=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.fog?"#define USE_FOG":"",B.fog instanceof
|
|
|
+THREE.FogExp2?"#define FOG_EXP2":"",B.map?"#define USE_MAP":"",B.env_map?"#define USE_ENVMAP":"",B.light_map?"#define USE_LIGHTMAP":"",B.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");B=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.map?"#define USE_MAP":"",B.env_map?"#define USE_ENVMAP":"",B.light_map?"#define USE_LIGHTMAP":
|
|
|
+"",B.vertex_colors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
+e.attachShader(y,z("fragment",o+T));e.attachShader(y,z("vertex",B+A));e.linkProgram(y);e.getProgramParameter(y,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");y.uniforms={};y.attributes={};l.program=y;y=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(v in l.uniforms)y.push(v);v=l.program;T=0;for(A=y.length;T<
|
|
|
+A;T++){o=y[T];v.uniforms[o]=e.getUniformLocation(v,o)}l=l.program;v=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];y=0;for(T=v.length;y<T;y++){A=v[y];l.attributes[A]=e.getAttribLocation(l,A)}};this.setProgram=function(l,A,y,v,o){v.program||this.initMaterial(v,A,y);var B=v.program,E=B.uniforms,H=v.uniforms;if(B!=q){e.useProgram(B);q=B;e.uniformMatrix4fv(E.projectionMatrix,!1,V)}if(y&&(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||
|
|
|
+v instanceof THREE.MeshPhongMaterial||v instanceof THREE.LineBasicMaterial||v instanceof THREE.ParticleBasicMaterial)){H.fogColor.value.setHex(y.color.hex);if(y instanceof THREE.Fog){H.fogNear.value=y.near;H.fogFar.value=y.far}else if(y instanceof THREE.FogExp2)H.fogDensity.value=y.density}if(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial){this.setupLights(B,A);A=this.lights;H.enableLighting.value=A.directional.length+A.point.length;H.ambientLightColor.value=A.ambient;
|
|
|
+H.directionalLightColor.value=A.directional.colors;H.directionalLightDirection.value=A.directional.positions;H.pointLightColor.value=A.point.colors;H.pointLightPosition.value=A.point.positions}if(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial){H.diffuse.value.setRGB(v.color.r*v.opacity,v.color.g*v.opacity,v.color.b*v.opacity);H.opacity.value=v.opacity;H.map.texture=v.map;H.light_map.texture=v.light_map;H.env_map.texture=v.env_map;
|
|
|
+H.reflectivity.value=v.reflectivity;H.refraction_ratio.value=v.refraction_ratio;H.combine.value=v.combine;H.useRefract.value=v.env_map&&v.env_map.mapping instanceof THREE.CubeRefractionMapping}if(v instanceof THREE.LineBasicMaterial){H.diffuse.value.setRGB(v.color.r*v.opacity,v.color.g*v.opacity,v.color.b*v.opacity);H.opacity.value=v.opacity}else if(v instanceof THREE.ParticleBasicMaterial){H.psColor.value.setRGB(v.color.r*v.opacity,v.color.g*v.opacity,v.color.b*v.opacity);H.opacity.value=v.opacity;
|
|
|
+H.size.value=v.size;H.map.texture=v.map}else if(v instanceof THREE.MeshPhongMaterial){H.ambient.value.setRGB(v.ambient.r,v.ambient.g,v.ambient.b);H.specular.value.setRGB(v.specular.r,v.specular.g,v.specular.b);H.shininess.value=v.shininess}else if(v instanceof THREE.MeshDepthMaterial){H.mNear.value=l.near;H.mFar.value=l.far;H.opacity.value=v.opacity}else if(v instanceof THREE.MeshNormalMaterial)H.opacity.value=v.opacity;var T,D,J;for(T in H)if(J=B.uniforms[T]){y=H[T];D=y.type;A=y.value;if(D=="i")e.uniform1i(J,
|
|
|
+A);else if(D=="f")e.uniform1f(J,A);else if(D=="fv1")e.uniform1fv(J,A);else if(D=="fv")e.uniform3fv(J,A);else if(D=="v2")e.uniform2f(J,A.x,A.y);else if(D=="v3")e.uniform3f(J,A.x,A.y,A.z);else if(D=="c")e.uniform3f(J,A.r,A.g,A.b);else if(D=="t"){e.uniform1i(J,A);if(y=y.texture)if(y.image instanceof Array&&y.image.length==6){if(y.image.length==6){if(!y.image.__webGLTextureCube&&!y.image.__cubeMapInitialized&&y.image.loadCount==6){y.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,
|
|
|
+y.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(D=0;D<6;++D)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,y.image[D]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);y.image.__cubeMapInitialized=
|
|
|
+!0}e.activeTexture(e.TEXTURE0+A);e.bindTexture(e.TEXTURE_CUBE_MAP,y.image.__webGLTextureCube)}}else{if(!y.__webGLTexture&&y.image.loaded){y.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,y.__webGLTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,y.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,F(y.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,F(y.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,F(y.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,
|
|
|
+F(y.min_filter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}e.activeTexture(e.TEXTURE0+A);e.bindTexture(e.TEXTURE_2D,y.__webGLTexture)}}}e.uniformMatrix4fv(E.modelViewMatrix,!1,o._modelViewMatrixArray);e.uniformMatrix3fv(E.normalMatrix,!1,o._normalMatrixArray);(v instanceof THREE.MeshShaderMaterial||v instanceof THREE.MeshPhongMaterial||v.env_map)&&e.uniform3f(E.cameraPosition,l.position.x,l.position.y,l.position.z);(v instanceof THREE.MeshShaderMaterial||v.env_map||v.skinning)&&
|
|
|
+e.uniformMatrix4fv(E.objectMatrix,!1,o._objectMatrixArray);(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshShaderMaterial||v.skinning)&&e.uniformMatrix4fv(E.viewMatrix,!1,da);if(v.skinning){e.uniformMatrix4fv(E.cameraInverseMatrix,!1,ca);e.uniformMatrix4fv(E.uBoneGlobalMatrices,!1,o.boneMatrices)}return B};this.renderBuffer=function(l,A,y,v,o,B){l=this.setProgram(l,A,y,v,B).attributes;e.bindBuffer(e.ARRAY_BUFFER,o.__webGLVertexBuffer);e.vertexAttribPointer(l.position,
|
|
|
+3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.position);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.color)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.normal)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.tangent)}if(l.uv>=
|
|
|
+0)if(o.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(o.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);if(B instanceof THREE.SkinnedMesh){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,
|
|
|
+4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinVertexA);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinVertexB);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinIndex);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinWeight)}if(B instanceof
|
|
|
+THREE.Mesh)if(v.wireframe){e.lineWidth(v.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);e.drawElements(e.LINES,o.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,o.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(B instanceof THREE.Line){B=B.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(B,0,o.__webGLLineCount)}else B instanceof THREE.ParticleSystem&&e.drawArrays(e.POINTS,
|
|
|
+0,o.__webGLParticleCount)};this.render=function(l,A,y,v){var o,B,E,H,T,D,J,P,ga=l.lights,la=l.fog;A.autoUpdateMatrix&&A.update();A.globalMatrix.flattenToArray(da);A.projectionMatrix.flattenToArray(V);A.inverseMatrix.flattenToArray(ca);Y.multiply(A.projectionMatrix,A.globalMatrix);g(Y);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined,!1,A);this.initWebGLObjects(l,A);x(y,v!==undefined?v:!0);this.autoClear&&this.clear();T=l.__webGLObjects.length;for(v=0;v<T;v++){o=l.__webGLObjects[v];
|
|
|
+J=o.object;if(J.visible)if(!(J instanceof THREE.Mesh)||h(J)){J.globalMatrix.flattenToArray(J._objectMatrixArray);t(J,A);m(o);o.render=!0;if(this.sortObjects){G.copy(J.position);Y.multiplyVector3(G);o.z=G.z}}else o.render=!1;else o.render=!1}this.sortObjects&&l.__webGLObjects.sort(n);D=l.__webGLObjectsImmediate.length;for(v=0;v<D;v++){o=l.__webGLObjectsImmediate[v];J=o.object;if(J.visible){J.autoUpdateMatrix&&J.globalMatrix.flattenToArray(J._objectMatrixArray);t(J,A);j(o)}}p(THREE.NormalBlending);
|
|
|
+for(v=0;v<T;v++){o=l.__webGLObjects[v];if(o.render){J=o.object;P=o.buffer;E=o.opaque;f(J);for(o=0;o<E.count;o++){H=E.list[o];this.setDepthTest(H.depth_test);this.renderBuffer(A,ga,la,H,P,J)}}}for(v=0;v<D;v++){o=l.__webGLObjectsImmediate[v];J=o.object;if(J.visible){E=o.opaque;f(J);for(o=0;o<E.count;o++){H=E.list[o];this.setDepthTest(H.depth_test);B=this.setProgram(A,ga,la,H,J);J.render(function(C){d(C,B)})}}}for(v=0;v<T;v++){o=l.__webGLObjects[v];if(o.render){J=o.object;P=o.buffer;E=o.transparent;
|
|
|
+f(J);for(o=0;o<E.count;o++){H=E.list[o];p(H.blending);this.setDepthTest(H.depth_test);this.renderBuffer(A,ga,la,H,P,J)}}}for(v=0;v<D;v++){o=l.__webGLObjectsImmediate[v];J=o.object;if(J.visible){E=o.transparent;f(J);for(o=0;o<E.count;o++){H=E.list[o];p(H.blending);this.setDepthTest(H.depth_test);B=this.setProgram(A,ga,la,H,J);J.render(function(C){d(C,B)})}}}if(y&&y.min_filter!==THREE.NearestFilter&&y.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,y.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);
|
|
|
+e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){var A,y,v;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}A=0;for(y=l.objects.length;A<y;A++){v=l.objects[A];var o=l,B=void 0,E=void 0,H=void 0,T=void 0;E=v.geometry;if(o.__webGLObjectsMap[v.id]==undefined){o.__webGLObjectsMap[v.id]={};v._modelViewMatrix=new THREE.Matrix4;v._normalMatrixArray=new Float32Array(9);v._modelViewMatrixArray=new Float32Array(16);v._objectMatrixArray=new Float32Array(16);
|
|
|
+v.globalMatrix.flattenToArray(v._objectMatrixArray)}T=o.__webGLObjectsMap[v.id];objlist=o.__webGLObjects;if(v instanceof THREE.Mesh){for(B in E.geometryChunks){H=E.geometryChunks[B];if(!H.__webGLVertexBuffer){o=H;o.__webGLVertexBuffer=e.createBuffer();o.__webGLNormalBuffer=e.createBuffer();o.__webGLTangentBuffer=e.createBuffer();o.__webGLColorBuffer=e.createBuffer();o.__webGLUVBuffer=e.createBuffer();o.__webGLUV2Buffer=e.createBuffer();o.__webGLSkinVertexABuffer=e.createBuffer();o.__webGLSkinVertexBBuffer=
|
|
|
+e.createBuffer();o.__webGLSkinIndicesBuffer=e.createBuffer();o.__webGLSkinWeightsBuffer=e.createBuffer();o.__webGLFaceBuffer=e.createBuffer();o.__webGLLineBuffer=e.createBuffer();o=H;var D=v,J=void 0,P=void 0,ga=0,la=0,C=0,Q=D.geometry.faces,K=o.faces;J=0;for(P=K.length;J<P;J++){fi=K[J];face=Q[fi];if(face instanceof THREE.Face3){ga+=3;la+=1;C+=3}else if(face instanceof THREE.Face4){ga+=4;la+=2;C+=4}}o.__vertexArray=new Float32Array(ga*3);o.__normalArray=new Float32Array(ga*3);o.__tangentArray=new Float32Array(ga*
|
|
|
+4);o.__colorArray=new Float32Array(ga*3);o.__uvArray=new Float32Array(ga*2);o.__uv2Array=new Float32Array(ga*2);o.__skinVertexAArray=new Float32Array(ga*4);o.__skinVertexBArray=new Float32Array(ga*4);o.__skinIndexArray=new Float32Array(ga*4);o.__skinWeightArray=new Float32Array(ga*4);o.__faceArray=new Uint16Array(la*3);o.__lineArray=new Uint16Array(C*2);P=J=o;ga=void 0;Q=void 0;var U=void 0,ba=void 0;U=void 0;K=!1;ga=0;for(Q=D.materials.length;ga<Q;ga++){U=D.materials[ga];if(U instanceof THREE.MeshFaceMaterial){U=
|
|
|
+0;for(ba=P.materials.length;U<ba;U++)if(P.materials[U]&&P.materials[U].shading!=undefined&&P.materials[U].shading==THREE.SmoothShading){K=!0;break}}else if(U&&U.shading!=undefined&&U.shading==THREE.SmoothShading){K=!0;break}if(K)break}J.__needsSmoothNormals=K;o.__webGLFaceCount=la*3;o.__webGLLineCount=C*2;E.__dirtyVertices=!0;E.__dirtyElements=!0;E.__dirtyUvs=!0;E.__dirtyNormals=!0;E.__dirtyTangents=!0;E.__dirtyColors=!0}if(E.__dirtyVertices||E.__dirtyElements||E.__dirtyUvs||E.__dirtyNormals||E.__dirtyColors||
|
|
|
+E.__dirtyTangents){o=H;la=e.DYNAMIC_DRAW;C=void 0;J=void 0;var ta=void 0,N=void 0,Ba=void 0,xa=void 0,Ea=void 0;ta=void 0;var W=void 0,Z=void 0,fa=void 0,oa=void 0;W=void 0;Z=void 0;fa=void 0;N=void 0;W=void 0;Z=void 0;fa=void 0;oa=void 0;W=void 0;Z=void 0;fa=void 0;oa=void 0;W=void 0;Z=void 0;fa=void 0;oa=void 0;W=void 0;Z=void 0;fa=void 0;oa=void 0;W=void 0;Z=void 0;fa=void 0;oa=void 0;N=void 0;xa=void 0;Ba=void 0;Ea=void 0;var Ia=ba=U=K=Q=ga=D=P=0,wa=0,M=0,ua=o.__vertexArray,Pa=o.__uvArray,Na=
|
|
|
+o.__uv2Array,La=o.__normalArray,qa=o.__tangentArray,va=o.__colorArray,ra=o.__skinVertexAArray,pa=o.__skinVertexBArray,sa=o.__skinIndexArray,ja=o.__skinWeightArray,Ca=o.__faceArray,Aa=o.__lineArray,Ra=o.__needsSmoothNormals,Da=v.geometry,Qa=Da.__dirtyVertices,S=Da.__dirtyElements,ka=Da.__dirtyUvs,ia=Da.__dirtyNormals,X=Da.__dirtyTangents,ha=Da.__dirtyColors,ma=Da.vertices,ya=o.faces,Fa=Da.faces,Ha=Da.uvs,Oa=Da.uvs2,za=Da.colors,Ka=Da.skinVerticesA,Ma=Da.skinVerticesB,Ja=Da.skinIndices,Ga=Da.skinWeights;
|
|
|
+C=0;for(J=ya.length;C<J;C++){ta=ya[C];N=Fa[ta];Ea=Ha[ta];ta=Oa[ta];Ba=N.vertexNormals;xa=N.normal;if(N instanceof THREE.Face3){if(Qa){W=ma[N.a].position;Z=ma[N.b].position;fa=ma[N.c].position;ua[D]=W.x;ua[D+1]=W.y;ua[D+2]=W.z;ua[D+3]=Z.x;ua[D+4]=Z.y;ua[D+5]=Z.z;ua[D+6]=fa.x;ua[D+7]=fa.y;ua[D+8]=fa.z;D+=9}if(Ga.length){W=Ga[N.a];Z=Ga[N.b];fa=Ga[N.c];ja[M]=W.x;ja[M+1]=W.y;ja[M+2]=W.z;ja[M+3]=W.w;ja[M+4]=Z.x;ja[M+5]=Z.y;ja[M+6]=Z.z;ja[M+7]=Z.w;ja[M+8]=fa.x;ja[M+9]=fa.y;ja[M+10]=fa.z;ja[M+11]=fa.w;W=
|
|
|
+Ja[N.a];Z=Ja[N.b];fa=Ja[N.c];sa[M]=W.x;sa[M+1]=W.y;sa[M+2]=W.z;sa[M+3]=W.w;sa[M+4]=Z.x;sa[M+5]=Z.y;sa[M+6]=Z.z;sa[M+7]=Z.w;sa[M+8]=fa.x;sa[M+9]=fa.y;sa[M+10]=fa.z;sa[M+11]=fa.w;W=Ka[N.a];Z=Ka[N.b];fa=Ka[N.c];ra[M]=W.x;ra[M+1]=W.y;ra[M+2]=W.z;ra[M+3]=1;ra[M+4]=Z.x;ra[M+5]=Z.y;ra[M+6]=Z.z;ra[M+7]=1;ra[M+8]=fa.x;ra[M+9]=fa.y;ra[M+10]=fa.z;ra[M+11]=1;W=Ma[N.a];Z=Ma[N.b];fa=Ma[N.c];pa[M]=W.x;pa[M+1]=W.y;pa[M+2]=W.z;pa[M+3]=1;pa[M+4]=Z.x;pa[M+5]=Z.y;pa[M+6]=Z.z;pa[M+7]=1;pa[M+8]=fa.x;pa[M+9]=fa.y;pa[M+
|
|
|
+10]=fa.z;pa[M+11]=1;M+=12}if(ha&&za.length){W=za[N.a];Z=za[N.b];fa=za[N.c];va[wa]=W.r;va[wa+1]=W.g;va[wa+2]=W.b;va[wa+3]=Z.r;va[wa+4]=Z.g;va[wa+5]=Z.b;va[wa+6]=fa.r;va[wa+7]=fa.g;va[wa+8]=fa.b;wa+=9}if(X&&Da.hasTangents){W=ma[N.a].tangent;Z=ma[N.b].tangent;fa=ma[N.c].tangent;qa[ba]=W.x;qa[ba+1]=W.y;qa[ba+2]=W.z;qa[ba+3]=W.w;qa[ba+4]=Z.x;qa[ba+5]=Z.y;qa[ba+6]=Z.z;qa[ba+7]=Z.w;qa[ba+8]=fa.x;qa[ba+9]=fa.y;qa[ba+10]=fa.z;qa[ba+11]=fa.w;ba+=12}if(ia)if(Ba.length==3&&Ra)for(N=0;N<3;N++){xa=Ba[N];La[U]=
|
|
|
+xa.x;La[U+1]=xa.y;La[U+2]=xa.z;U+=3}else for(N=0;N<3;N++){La[U]=xa.x;La[U+1]=xa.y;La[U+2]=xa.z;U+=3}if(ka&&Ea)for(N=0;N<3;N++){Ba=Ea[N];Pa[ga]=Ba.u;Pa[ga+1]=Ba.v;ga+=2}if(ka&&ta)for(N=0;N<3;N++){Ea=ta[N];Na[Q]=Ea.u;Na[Q+1]=Ea.v;Q+=2}if(S){Ca[K]=P;Ca[K+1]=P+1;Ca[K+2]=P+2;K+=3;Aa[Ia]=P;Aa[Ia+1]=P+1;Aa[Ia+2]=P;Aa[Ia+3]=P+2;Aa[Ia+4]=P+1;Aa[Ia+5]=P+2;Ia+=6;P+=3}}else if(N instanceof THREE.Face4){if(Qa){W=ma[N.a].position;Z=ma[N.b].position;fa=ma[N.c].position;oa=ma[N.d].position;ua[D]=W.x;ua[D+1]=W.y;
|
|
|
+ua[D+2]=W.z;ua[D+3]=Z.x;ua[D+4]=Z.y;ua[D+5]=Z.z;ua[D+6]=fa.x;ua[D+7]=fa.y;ua[D+8]=fa.z;ua[D+9]=oa.x;ua[D+10]=oa.y;ua[D+11]=oa.z;D+=12}if(Ga.length){W=Ga[N.a];Z=Ga[N.b];fa=Ga[N.c];oa=Ga[N.d];ja[M]=W.x;ja[M+1]=W.y;ja[M+2]=W.z;ja[M+3]=W.w;ja[M+4]=Z.x;ja[M+5]=Z.y;ja[M+6]=Z.z;ja[M+7]=Z.w;ja[M+8]=fa.x;ja[M+9]=fa.y;ja[M+10]=fa.z;ja[M+11]=fa.w;ja[M+12]=oa.x;ja[M+13]=oa.y;ja[M+14]=oa.z;ja[M+15]=oa.w;W=Ja[N.a];Z=Ja[N.b];fa=Ja[N.c];oa=Ja[N.d];sa[M]=W.x;sa[M+1]=W.y;sa[M+2]=W.z;sa[M+3]=W.w;sa[M+4]=Z.x;sa[M+5]=
|
|
|
+Z.y;sa[M+6]=Z.z;sa[M+7]=Z.w;sa[M+8]=fa.x;sa[M+9]=fa.y;sa[M+10]=fa.z;sa[M+11]=fa.w;sa[M+12]=oa.x;sa[M+13]=oa.y;sa[M+14]=oa.z;sa[M+15]=oa.w;W=Ka[N.a];Z=Ka[N.b];fa=Ka[N.c];oa=Ka[N.d];ra[M]=W.x;ra[M+1]=W.y;ra[M+2]=W.z;ra[M+3]=1;ra[M+4]=Z.x;ra[M+5]=Z.y;ra[M+6]=Z.z;ra[M+7]=1;ra[M+8]=fa.x;ra[M+9]=fa.y;ra[M+10]=fa.z;ra[M+11]=1;ra[M+12]=oa.x;ra[M+13]=oa.y;ra[M+14]=oa.z;ra[M+15]=1;W=Ma[N.a];Z=Ma[N.b];fa=Ma[N.c];oa=Ma[N.d];pa[M]=W.x;pa[M+1]=W.y;pa[M+2]=W.z;pa[M+3]=1;pa[M+4]=Z.x;pa[M+5]=Z.y;pa[M+6]=Z.z;pa[M+
|
|
|
+7]=1;pa[M+8]=fa.x;pa[M+9]=fa.y;pa[M+10]=fa.z;pa[M+11]=1;pa[M+12]=oa.x;pa[M+13]=oa.y;pa[M+14]=oa.z;pa[M+15]=1;M+=16}if(ha&&za.length){W=za[N.a];Z=za[N.b];fa=za[N.c];oa=za[N.d];va[wa]=W.r;va[wa+1]=W.g;va[wa+2]=W.b;va[wa+3]=Z.r;va[wa+4]=Z.g;va[wa+5]=Z.b;va[wa+6]=fa.r;va[wa+7]=fa.g;va[wa+8]=fa.b;va[wa+9]=oa.r;va[wa+10]=oa.g;va[wa+11]=oa.b;wa+=12}if(X&&Da.hasTangents){W=ma[N.a].tangent;Z=ma[N.b].tangent;fa=ma[N.c].tangent;N=ma[N.d].tangent;qa[ba]=W.x;qa[ba+1]=W.y;qa[ba+2]=W.z;qa[ba+3]=W.w;qa[ba+4]=Z.x;
|
|
|
+qa[ba+5]=Z.y;qa[ba+6]=Z.z;qa[ba+7]=Z.w;qa[ba+8]=fa.x;qa[ba+9]=fa.y;qa[ba+10]=fa.z;qa[ba+11]=fa.w;qa[ba+12]=N.x;qa[ba+13]=N.y;qa[ba+14]=N.z;qa[ba+15]=N.w;ba+=16}if(ia)if(Ba.length==4&&Ra)for(N=0;N<4;N++){xa=Ba[N];La[U]=xa.x;La[U+1]=xa.y;La[U+2]=xa.z;U+=3}else for(N=0;N<4;N++){La[U]=xa.x;La[U+1]=xa.y;La[U+2]=xa.z;U+=3}if(ka&&Ea)for(N=0;N<4;N++){Ba=Ea[N];Pa[ga]=Ba.u;Pa[ga+1]=Ba.v;ga+=2}if(ka&&ta)for(N=0;N<4;N++){Ea=ta[N];Na[Q]=Ea.u;Na[Q+1]=Ea.v;Q+=2}if(S){Ca[K]=P;Ca[K+1]=P+1;Ca[K+2]=P+2;Ca[K+3]=P;Ca[K+
|
|
|
+4]=P+2;Ca[K+5]=P+3;K+=6;Aa[Ia]=P;Aa[Ia+1]=P+1;Aa[Ia+2]=P;Aa[Ia+3]=P+3;Aa[Ia+4]=P+1;Aa[Ia+5]=P+2;Aa[Ia+6]=P+2;Aa[Ia+7]=P+3;Ia+=8;P+=4}}}if(Qa){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ua,la)}if(ha&&za.length){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,va,la)}if(ia){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,La,la)}if(X&&Da.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
+qa,la)}if(ka&&ga>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,la)}if(ka&&Q>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Na,la)}if(S){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ca,la);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Aa,la)}if(M>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ra,la);
|
|
|
+e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,pa,la);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,sa,la);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ja,la)}}w(objlist,T,B,H,v)}E.__dirtyVertices=!1;E.__dirtyElements=!1;E.__dirtyUvs=!1;E.__dirtyNormals=!1;E.__dirtyTangents=!1;E.__dirtyColors=!1}else if(v instanceof THREE.Line){if(!E.__webGLVertexBuffer){B=E;B.__webGLVertexBuffer=e.createBuffer();
|
|
|
+B.__webGLColorBuffer=e.createBuffer();B=E;H=B.vertices.length;B.__vertexArray=new Float32Array(H*3);B.__colorArray=new Float32Array(H*3);B.__webGLLineCount=H;E.__dirtyVertices=!0;E.__dirtyColors=!0}if(E.__dirtyVertices||E.__dirtyColors){B=E;H=e.DYNAMIC_DRAW;P=void 0;P=void 0;D=void 0;o=void 0;ga=B.vertices;la=B.colors;Q=ga.length;C=la.length;K=B.__vertexArray;J=B.__colorArray;U=B.__dirtyColors;if(B.__dirtyVertices){for(P=0;P<Q;P++){D=ga[P].position;o=P*3;K[o]=D.x;K[o+1]=D.y;K[o+2]=D.z}e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
+B.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,K,H)}if(U){for(P=0;P<C;P++){color=la[P];o=P*3;J[o]=color.r;J[o+1]=color.g;J[o+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,B.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,J,H)}}w(objlist,T,0,E,v);E.__dirtyVertices=!1;E.__dirtyColors=!1}else if(v instanceof THREE.ParticleSystem){if(!E.__webGLVertexBuffer){B=E;B.__webGLVertexBuffer=e.createBuffer();B.__webGLColorBuffer=e.createBuffer();B=E;H=B.vertices.length;B.__vertexArray=new Float32Array(H*3);B.__colorArray=
|
|
|
+new Float32Array(H*3);B.__sortArray=[];B.__webGLParticleCount=H;E.__dirtyVertices=!0;E.__dirtyColors=!0}(E.__dirtyVertices||E.__dirtyColors||v.sortParticles)&&b(E,e.DYNAMIC_DRAW,v,camera);w(objlist,T,0,E,v);E.__dirtyVertices=!1;E.__dirtyColors=!1}else if(v instanceof THREE.MarchingCubes){E=T;if(E[0]==undefined){o.__webGLObjectsImmediate.push({object:v,opaque:{list:[],count:0},transparent:{list:[],count:0}});E[0]=1}}}};this.removeObject=function(l,A){var y,v;for(y=l.__webGLObjects.length-1;y>=0;y--){v=
|
|
|
+l.__webGLObjects[y].object;A==v&&l.__webGLObjects.splice(y,1)}};this.addToRenderList=function(){};this.removeFromRenderList=function(){};this.setDepthTest=function(l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)};this.setFaceCulling=function(l,A){if(l){!A||A=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
+0}};
|
|
|
THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
|
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",
|
|
@@ -280,17 +276,17 @@ THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=ne
|
|
|
THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
|
THREE.Detector={canvas:!!document.createElement("canvas").getContext,webgl:window.Uint8Array!=undefined,workers:!!window.Worker,addGetWebGLMessage:function(a){var b=document.body,c="oldie";if(a){if(a.parent!==undefined)b=a.parent;if(a.id!==undefined)c=a.id}a=document.createElement("center");var d=document.createElement("div");d.innerHTML='Sorry, your browser doesn\'t support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a><br/>\n<br/>\nPlease try in\n<a href="http://www.google.com/chrome">Chrome 9+</a> /\n<a href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 4+</a> /\n<a href="http://nightly.webkit.org/">Safari OSX 10.6+</a>';d.id=
|
|
|
c;c=d.style;c.fontFamily="monospace";c.fontSize="13px";c.textAlign="center";c.background="#eee";c.color="#000";c.padding="1em";c.width="475px";c.margin="5em auto 0";a.appendChild(d);b.appendChild(a);return d}};
|
|
|
-var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.autoUpdateMatrix&&b.updateMatrix();for(var n=0,w=h.length;n<w;n++){var u=new THREE.Vertex(h[n].position.clone());c&&b.matrix.multiplyVector3(u.position);g.push(u)}n=0;for(w=j.length;n<w;n++){h=j[n];var q,x=h.vertexNormals;if(h instanceof THREE.Face3)q=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(q=new THREE.Face4(h.a+
|
|
|
-d,h.b+d,h.c+d,h.d+d));q.centroid.copy(h.centroid);q.normal.copy(h.normal);c=0;for(g=x.length;c<g;c++){u=x[c];q.vertexNormals.push(u.clone())}q.materials=h.materials.slice();k.push(q)}n=0;for(w=f.length;n<w;n++){d=f[n];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image;d.onload=function(){this.loaded=!0;c&&c(this)};d.src=a;return new THREE.Texture(d,b)},loadArray:function(a,b){var c,d,f=[];c=f.loadCount=0;for(d=a.length;c<
|
|
|
-d;++c){f[c]=new Image;f[c].loaded=0;f[c].onload=function(){f.loadCount+=1;this.loaded=!0;b&&b(this)};f[c].src=a[c]}return f}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(n in L.objects)if(!H.objects[n]){z=L.objects[n];if(t=H.geometries[z.geometry]){ea=[];for(i=0;i<z.materials.length;i++)ea[i]=H.materials[z.materials[i]];C=z.position;r=z.rotation;s=z.scale;object=new THREE.Mesh(t,ea);object.position.set(C[0],C[1],C[2]);object.rotation.set(r[0],
|
|
|
-r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=z.visible;H.scene.addObject(object);H.objects[n]=object}}}function h(aa){return function(na){H.geometries[aa]=na;g();Y-=1;k()}}function k(){d({total_models:da,total_textures:Z,loaded_models:da-Y,loaded_textures:Z-T},H);Y==0&&T==0&&c(H)}var j,m,n,w,u,q,x,z,C,o,e,t,N,Q,ea,L,G,Y,T,da,Z,H;L=f.data;G=new THREE.Loader;T=Y=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};f=function(){T-=1;
|
|
|
-k()};for(u in L.cameras){o=L.cameras[u];if(o.type=="perspective")N=new THREE.Camera(o.fov,o.aspect,o.near,o.far);else if(o.type=="ortho"){N=new THREE.Camera;N.projectionMatrix=THREE.Matrix4.makeOrtho(o.left,o.right,o.top,o.bottom,o.near,o.far)}C=o.position;o=o.target;N.position.set(C[0],C[1],C[2]);N.target.position.set(o[0],o[1],o[2]);H.cameras[u]=N}for(w in L.lights){u=L.lights[w];if(u.type=="directional"){C=u.direction;light=new THREE.DirectionalLight;light.position.set(C[0],C[1],C[2]);light.position.normalize()}else if(u.type==
|
|
|
-"point"){C=u.position;light=new THREE.PointLight;light.position.set(C[0],C[1],C[2])}o=u.color;i=u.intensity||1;light.color.setRGB(o[0]*i,o[1]*i,o[2]*i);H.scene.addLight(light);H.lights[w]=light}for(q in L.fogs){w=L.fogs[q];if(w.type=="linear")Q=new THREE.Fog(0,w.near,w.far);else w.type=="exp2"&&(Q=new THREE.FogExp2(0,w.density));o=w.color;Q.color.setRGB(o[0],o[1],o[2]);H.fogs[q]=Q}if(H.cameras&&L.defaults.camera)H.currentCamera=H.cameras[L.defaults.camera];if(H.fogs&&L.defaults.fog)H.scene.fog=H.fogs[L.defaults.fog];
|
|
|
-o=L.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(o[0],o[1],o[2]);H.bgColorAlpha=L.defaults.bgalpha;for(j in L.geometries){q=L.geometries[j];if(q.type=="bin_mesh"||q.type=="ascii_mesh")Y+=1}da=Y;for(j in L.geometries){q=L.geometries[j];if(q.type=="cube"){t=new Cube(q.width,q.height,q.depth,q.segments_width,q.segments_height,null,q.flipped,q.sides);H.geometries[j]=t}else if(q.type=="plane"){t=new Plane(q.width,q.height,q.segments_width,q.segments_height);H.geometries[j]=t}else if(q.type==
|
|
|
-"sphere"){t=new Sphere(q.radius,q.segments_width,q.segments_height);H.geometries[j]=t}else if(q.type=="cylinder"){t=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);H.geometries[j]=t}else if(q.type=="torus"){t=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);H.geometries[j]=t}else if(q.type=="icosahedron"){t=new Icosahedron(q.subdivisions);H.geometries[j]=t}else if(q.type=="bin_mesh")G.loadBinary({model:q.url,callback:h(j)});else q.type=="ascii_mesh"&&G.loadAscii({model:q.url,
|
|
|
-callback:h(j)})}for(x in L.textures){j=L.textures[x];T+=j.url instanceof Array?j.url.length:1}Z=T;for(x in L.textures){j=L.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){q=ImageUtils.loadArray(j.url,f);q=new THREE.Texture(q,j.mapping)}else{q=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.min_filter]!=undefined)q.min_filter=THREE[j.min_filter];if(THREE[j.mag_filter]!=undefined)q.mag_filter=THREE[j.mag_filter]}H.textures[x]=
|
|
|
-q}for(m in L.materials){x=L.materials[m];for(e in x.parameters)if(e=="env_map"||e=="map"||e=="light_map")x.parameters[e]=H.textures[x.parameters[e]];else if(e=="shading")x.parameters[e]=x.parameters[e]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(e=="blending")x.parameters[e]=THREE[x.parameters[e]]?THREE[x.parameters[e]]:THREE.NormalBlending;else e=="combine"&&(x.parameters[e]=x.parameters[e]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);x=new THREE[x.type](x.parameters);H.materials[m]=
|
|
|
-x}g();b(H)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragment_shader:d.fragment_shader,vertex_shader:d.vertex_shader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,!0),c);a.addObject(b);return b},
|
|
|
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.autoUpdateMatrix&&b.updateMatrix();for(var n=0,w=h.length;n<w;n++){var t=new THREE.Vertex(h[n].position.clone());c&&b.localMatrix.multiplyVector3(t.position);g.push(t)}n=0;for(w=j.length;n<w;n++){h=j[n];var p,x=h.vertexNormals;if(h instanceof THREE.Face3)p=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+
|
|
|
+d,h.b+d,h.c+d,h.d+d));p.centroid.copy(h.centroid);p.normal.copy(h.normal);c=0;for(g=x.length;c<g;c++){t=x[c];p.vertexNormals.push(t.clone())}p.materials=h.materials.slice();k.push(p)}n=0;for(w=f.length;n<w;n++){d=f[n];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image;d.onload=function(){this.loaded=!0;c&&c(this)};d.src=a;return new THREE.Texture(d,b)},loadArray:function(a,b){var c,d,f=[];c=f.loadCount=0;for(d=a.length;c<
|
|
|
+d;++c){f[c]=new Image;f[c].loaded=0;f[c].onload=function(){f.loadCount+=1;this.loaded=!0;b&&b(this)};f[c].src=a[c]}return f}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(n in L.objects)if(!G.objects[n]){z=L.objects[n];if(q=G.geometries[z.geometry]){ea=[];for(i=0;i<z.materials.length;i++)ea[i]=G.materials[z.materials[i]];F=z.position;r=z.rotation;s=z.scale;object=new THREE.Mesh(q,ea);object.position.set(F[0],F[1],F[2]);object.rotation.set(r[0],
|
|
|
+r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=z.visible;G.scene.addObject(object);G.objects[n]=object}}}function h($){return function(na){G.geometries[$]=na;g();Y-=1;k()}}function k(){d({total_models:ca,total_textures:da,loaded_models:ca-Y,loaded_textures:da-V},G);Y==0&&V==0&&c(G)}var j,m,n,w,t,p,x,z,F,u,e,q,O,R,ea,L,I,Y,V,ca,da,G;L=f.data;I=new THREE.Loader;V=Y=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};f=function(){V-=
|
|
|
+1;k()};for(t in L.cameras){u=L.cameras[t];if(u.type=="perspective")O=new THREE.Camera(u.fov,u.aspect,u.near,u.far);else if(u.type=="ortho"){O=new THREE.Camera;O.projectionMatrix=THREE.Matrix4.makeOrtho(u.left,u.right,u.top,u.bottom,u.near,u.far)}F=u.position;u=u.target;O.position.set(F[0],F[1],F[2]);O.target.position.set(u[0],u[1],u[2]);G.cameras[t]=O}for(w in L.lights){t=L.lights[w];if(t.type=="directional"){F=t.direction;light=new THREE.DirectionalLight;light.position.set(F[0],F[1],F[2]);light.position.normalize()}else if(t.type==
|
|
|
+"point"){F=t.position;light=new THREE.PointLight;light.position.set(F[0],F[1],F[2])}u=t.color;i=t.intensity||1;light.color.setRGB(u[0]*i,u[1]*i,u[2]*i);G.scene.addLight(light);G.lights[w]=light}for(p in L.fogs){w=L.fogs[p];if(w.type=="linear")R=new THREE.Fog(0,w.near,w.far);else w.type=="exp2"&&(R=new THREE.FogExp2(0,w.density));u=w.color;R.color.setRGB(u[0],u[1],u[2]);G.fogs[p]=R}if(G.cameras&&L.defaults.camera)G.currentCamera=G.cameras[L.defaults.camera];if(G.fogs&&L.defaults.fog)G.scene.fog=G.fogs[L.defaults.fog];
|
|
|
+u=L.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(u[0],u[1],u[2]);G.bgColorAlpha=L.defaults.bgalpha;for(j in L.geometries){p=L.geometries[j];if(p.type=="bin_mesh"||p.type=="ascii_mesh")Y+=1}ca=Y;for(j in L.geometries){p=L.geometries[j];if(p.type=="cube"){q=new Cube(p.width,p.height,p.depth,p.segments_width,p.segments_height,null,p.flipped,p.sides);G.geometries[j]=q}else if(p.type=="plane"){q=new Plane(p.width,p.height,p.segments_width,p.segments_height);G.geometries[j]=q}else if(p.type==
|
|
|
+"sphere"){q=new Sphere(p.radius,p.segments_width,p.segments_height);G.geometries[j]=q}else if(p.type=="cylinder"){q=new Cylinder(p.numSegs,p.topRad,p.botRad,p.height,p.topOffset,p.botOffset);G.geometries[j]=q}else if(p.type=="torus"){q=new Torus(p.radius,p.tube,p.segmentsR,p.segmentsT);G.geometries[j]=q}else if(p.type=="icosahedron"){q=new Icosahedron(p.subdivisions);G.geometries[j]=q}else if(p.type=="bin_mesh")I.loadBinary({model:p.url,callback:h(j)});else p.type=="ascii_mesh"&&I.loadAscii({model:p.url,
|
|
|
+callback:h(j)})}for(x in L.textures){j=L.textures[x];V+=j.url instanceof Array?j.url.length:1}da=V;for(x in L.textures){j=L.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){p=ImageUtils.loadArray(j.url,f);p=new THREE.Texture(p,j.mapping)}else{p=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.min_filter]!=undefined)p.min_filter=THREE[j.min_filter];if(THREE[j.mag_filter]!=undefined)p.mag_filter=THREE[j.mag_filter]}G.textures[x]=
|
|
|
+p}for(m in L.materials){x=L.materials[m];for(e in x.parameters)if(e=="env_map"||e=="map"||e=="light_map")x.parameters[e]=G.textures[x.parameters[e]];else if(e=="shading")x.parameters[e]=x.parameters[e]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(e=="blending")x.parameters[e]=THREE[x.parameters[e]]?THREE[x.parameters[e]]:THREE.NormalBlending;else e=="combine"&&(x.parameters[e]=x.parameters[e]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);x=new THREE[x.type](x.parameters);G.materials[m]=
|
|
|
+x}g();b(G)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragment_shader:d.fragment_shader,vertex_shader:d.vertex_shader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,!0),c);a.addObject(b);return b},
|
|
|
addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,b,b,1,1,d,!0),new THREE.MeshFaceMaterial);
|
|
|
a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI/2,g=Math.PI;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
|
|
|
SceneUtils.addMesh(a,b,1,0,-d,0,-f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},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}},fragment_shader:"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}",
|
|
@@ -302,21 +298,21 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying ve
|
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nconst float fNintensity = 0.5;\nconst float fSintensity = 0.05;\nconst float fScount = 4096.0;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin(vUv.y * fScount), cos(vUv.y * fScount) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * fSintensity;\ncResult = cTextureScreen.rgb + clamp( fNintensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
|
-fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(z,C,o,e,t,N,Q,ea){var L,G,Y=d||1,T=f||1,da=Y+1,Z=T+1,H=t/2,aa=N/2;t/=Y;var na=N/T,ba=m.vertices.length;if(z=="x"&&C=="y"||z=="y"&&C=="x")L="z";else if(z=="x"&&C=="z"||z=="z"&&C=="x")L="y";
|
|
|
-else if(z=="z"&&C=="y"||z=="y"&&C=="z")L="x";for(G=0;G<Z;G++)for(N=0;N<da;N++){var l=new THREE.Vector3;l[z]=(N*t-H)*o;l[C]=(G*na-aa)*e;l[L]=Q;m.vertices.push(new THREE.Vertex(l))}for(G=0;G<T;G++)for(N=0;N<Y;N++){m.faces.push(new THREE.Face4(N+da*G+ba,N+da*(G+1)+ba,N+1+da*(G+1)+ba,N+1+da*G+ba,null,ea));m.uvs.push([new THREE.UV(N/Y,G/T),new THREE.UV(N/Y,(G+1)/T),new THREE.UV((N+1)/Y,(G+1)/T),new THREE.UV((N+1)/Y,G/T)])}}THREE.Geometry.call(this);var m=this,n=a/2,w=b/2,u=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
|
|
|
-Array)this.materials=g;else{this.materials=[];for(var q=0;q<6;q++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var x in k)this.sides[x]!=undefined&&(this.sides[x]=k[x]);this.sides.px&&j("z","y",1*h,-1,c,b,-n,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,n,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,w,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-w,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
|
|
|
-a,b,u,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-u,this.materials[5]);(function(){for(var z=[],C=[],o=0,e=m.vertices.length;o<e;o++){for(var t=m.vertices[o],N=!1,Q=0,ea=z.length;Q<ea;Q++){var L=z[Q];if(t.position.x==L.position.x&&t.position.y==L.position.y&&t.position.z==L.position.z){C[o]=Q;N=!0;break}}if(!N){C[o]=z.length;z.push(new THREE.Vertex(t.position.clone()))}}o=0;for(e=m.faces.length;o<e;o++){t=m.faces[o];t.a=C[t.a];t.b=C[t.b];t.c=C[t.c];t.d=C[t.d]}m.vertices=z})();this.computeCentroids();
|
|
|
+fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(z,F,u,e,q,O,R,ea){var L,I,Y=d||1,V=f||1,ca=Y+1,da=V+1,G=q/2,$=O/2;q/=Y;var na=O/V,aa=m.vertices.length;if(z=="x"&&F=="y"||z=="y"&&F=="x")L="z";else if(z=="x"&&F=="z"||z=="z"&&F=="x")L="y";
|
|
|
+else if(z=="z"&&F=="y"||z=="y"&&F=="z")L="x";for(I=0;I<da;I++)for(O=0;O<ca;O++){var l=new THREE.Vector3;l[z]=(O*q-G)*u;l[F]=(I*na-$)*e;l[L]=R;m.vertices.push(new THREE.Vertex(l))}for(I=0;I<V;I++)for(O=0;O<Y;O++){m.faces.push(new THREE.Face4(O+ca*I+aa,O+ca*(I+1)+aa,O+1+ca*(I+1)+aa,O+1+ca*I+aa,null,ea));m.uvs.push([new THREE.UV(O/Y,I/V),new THREE.UV(O/Y,(I+1)/V),new THREE.UV((O+1)/Y,(I+1)/V),new THREE.UV((O+1)/Y,I/V)])}}THREE.Geometry.call(this);var m=this,n=a/2,w=b/2,t=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
|
|
|
+Array)this.materials=g;else{this.materials=[];for(var p=0;p<6;p++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var x in k)this.sides[x]!=undefined&&(this.sides[x]=k[x]);this.sides.px&&j("z","y",1*h,-1,c,b,-n,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,n,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,w,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-w,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
|
|
|
+a,b,t,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-t,this.materials[5]);(function(){for(var z=[],F=[],u=0,e=m.vertices.length;u<e;u++){for(var q=m.vertices[u],O=!1,R=0,ea=z.length;R<ea;R++){var L=z[R];if(q.position.x==L.position.x&&q.position.y==L.position.y&&q.position.z==L.position.z){F[u]=R;O=!0;break}}if(!O){F[u]=z.length;z.push(new THREE.Vertex(q.position.clone()))}}u=0;for(e=m.faces.length;u<e;u++){q=m.faces[u];q.a=F[q.a];q.b=F[q.b];q.c=F[q.c];q.d=F[q.d]}m.vertices=z})();this.computeCentroids();
|
|
|
this.computeFaceNormals();this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
|
var Cylinder=function(a,b,c,d,f){function g(m,n,w){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,w)))}THREE.Geometry.call(this);var h=this,k=Math.PI,j;for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*b,Math.cos(2*k*j/a)*b,0);for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*c,Math.cos(2*k*j/a)*c,d);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c!=0){g(0,0,-f);for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(j=a+a/2;j<
|
|
|
2*a;j++)h.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
|
var Plane=function(a,b,c,d){THREE.Geometry.call(this);var f,g=a/2,h=b/2;c=c||1;d=d||1;var k=c+1,j=d+1;a/=c;var m=b/d;for(f=0;f<j;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*m-h),0)));for(f=0;f<d;f++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f));this.uvs.push([new THREE.UV(b/c,f/d),new THREE.UV(b/c,(f+1)/d),new THREE.UV((b+1)/c,(f+1)/d),new THREE.UV((b+1)/c,f/d)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
|
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
|
-var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var k=a*Math.cos(d*f),j=a*Math.sin(d*f),m=[],n=0;for(d=0;d<g;d++){var w=2*d/g,u=j*Math.sin(w*f);w=j*Math.cos(w*f);(c==0||c==h)&&d>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,k,u)))-1);m.push(n)}b.push(m)}var q,x,z;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){m=d==g-1;h=b[c][m?0:d+1];k=b[c][m?g-1:d];j=b[c-1][m?g-1:d];m=b[c-1][m?
|
|
|
-0:d+1];u=c/(f-1);q=(c-1)/(f-1);x=(d+1)/g;w=d/g;n=new THREE.UV(1-x,u);u=new THREE.UV(1-w,u);w=new THREE.UV(1-w,q);var C=new THREE.UV(1-x,q);if(c<b.length-1){q=this.vertices[h].position.clone();x=this.vertices[k].position.clone();z=this.vertices[j].position.clone();q.normalize();x.normalize();z.normalize();this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)]));this.uvs.push([n,u,w])}if(c>1){q=this.vertices[h].position.clone();
|
|
|
-x=this.vertices[j].position.clone();z=this.vertices[m].position.clone();q.normalize();x.normalize();z.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)]));this.uvs.push([n,w,C])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
+var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var k=a*Math.cos(d*f),j=a*Math.sin(d*f),m=[],n=0;for(d=0;d<g;d++){var w=2*d/g,t=j*Math.sin(w*f);w=j*Math.cos(w*f);(c==0||c==h)&&d>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,k,t)))-1);m.push(n)}b.push(m)}var p,x,z;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){m=d==g-1;h=b[c][m?0:d+1];k=b[c][m?g-1:d];j=b[c-1][m?g-1:d];m=b[c-1][m?
|
|
|
+0:d+1];t=c/(f-1);p=(c-1)/(f-1);x=(d+1)/g;w=d/g;n=new THREE.UV(1-x,t);t=new THREE.UV(1-w,t);w=new THREE.UV(1-w,p);var F=new THREE.UV(1-x,p);if(c<b.length-1){p=this.vertices[h].position.clone();x=this.vertices[k].position.clone();z=this.vertices[j].position.clone();p.normalize();x.normalize();z.normalize();this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)]));this.uvs.push([n,t,w])}if(c>1){p=this.vertices[h].position.clone();
|
|
|
+x=this.vertices[j].position.clone();z=this.vertices[m].position.clone();p.normalize();x.normalize();z.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)]));this.uvs.push([n,w,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
|
|
|
1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
|
|
|
-var Icosahedron=function(a){function b(w,u,q){var x=Math.sqrt(w*w+u*u+q*q);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(w/x,u/x,q/x)))-1}function c(w,u,q,x){x.faces.push(new THREE.Face3(w,u,q))}function d(w,u){var q=f.vertices[w].position,x=f.vertices[u].position;return b((q.x+x.x)/2,(q.y+x.y)/2,(q.z+x.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
|
|
|
+var Icosahedron=function(a){function b(w,t,p){var x=Math.sqrt(w*w+t*t+p*p);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(w/x,t/x,p/x)))-1}function c(w,t,p,x){x.faces.push(new THREE.Face3(w,t,p))}function d(w,t){var p=f.vertices[w].position,x=f.vertices[t].position;return b((p.x+x.x)/2,(p.y+x.y)/2,(p.z+x.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
|
|
|
1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),n=d(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,n,h);c(g.faces[k].b,m,j,h);c(g.faces[k].c,
|
|
|
n,m,h);c(j,m,n,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
function LathedObject(a,b,c){THREE.Geometry.call(this);c=c||2*Math.PI;b=c/(b||12);for(var d=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));f[k]=this.vertices.length-1;d[k]=new THREE.Vector3(a[k].x,a[k].y,a[k].z)}for(var j=THREE.Matrix4.rotationZMatrix(b),m=0;m<=c+0.0010;m+=b){for(k=0;k<d.length;k++)if(m<c){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],
|
|
@@ -324,16 +320,16 @@ g[k+1],f[k+1],f[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/
|
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;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.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;f[g]=this.lerp(n[c],n[c+3],h);f[g+1]=this.lerp(n[c+1],n[c+4],h);f[g+2]=this.lerp(n[c+2],n[c+5],h)};this.VIntY=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
|
|
|
2]=m;d=c+this.yd*3;f[g]=this.lerp(n[c],n[d],h);f[g+1]=this.lerp(n[c+1],n[d+1],h);f[g+2]=this.lerp(n[c+2],n[d+2],h)};this.VIntZ=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(n[c],n[d],h);f[g+1]=this.lerp(n[c+1],n[d+1],h);f[g+2]=this.lerp(n[c+2],n[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
|
|
|
-this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,k){var j=g+1,m=g+this.yd,n=g+this.zd,w=j+this.yd,u=j+this.zd,q=g+this.yd+this.zd,x=j+this.yd+this.zd,z=0,C=this.field[g],o=this.field[j],e=this.field[m],t=this.field[w],N=this.field[n],Q=this.field[u],ea=this.field[q],L=this.field[x];C<h&&(z|=1);o<h&&(z|=2);e<h&&(z|=8);t<h&&(z|=4);N<h&&(z|=16);Q<h&&(z|=32);ea<h&&(z|=128);L<h&&(z|=64);var G=THREE.edgeTable[z];if(G==0)return 0;
|
|
|
-var Y=this.delta,T=c+Y,da=d+Y;Y=f+Y;if(G&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,C,o)}if(G&2){this.compNorm(j);this.compNorm(w);this.VIntY(j*3,this.vlist,this.nlist,3,h,T,d,f,o,t)}if(G&4){this.compNorm(m);this.compNorm(w);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,da,f,e,t)}if(G&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,C,e)}if(G&16){this.compNorm(n);this.compNorm(u);this.VIntX(n*3,this.vlist,this.nlist,12,h,c,d,
|
|
|
-Y,N,Q)}if(G&32){this.compNorm(u);this.compNorm(x);this.VIntY(u*3,this.vlist,this.nlist,15,h,T,d,Y,Q,L)}if(G&64){this.compNorm(q);this.compNorm(x);this.VIntX(q*3,this.vlist,this.nlist,18,h,c,da,Y,ea,L)}if(G&128){this.compNorm(n);this.compNorm(q);this.VIntY(n*3,this.vlist,this.nlist,21,h,c,d,Y,N,ea)}if(G&256){this.compNorm(g);this.compNorm(n);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,C,N)}if(G&512){this.compNorm(j);this.compNorm(u);this.VIntZ(j*3,this.vlist,this.nlist,27,h,T,d,f,o,Q)}if(G&1024){this.compNorm(w);
|
|
|
-this.compNorm(x);this.VIntZ(w*3,this.vlist,this.nlist,30,h,T,da,f,t,L)}if(G&2048){this.compNorm(m);this.compNorm(q);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,da,f,e,ea)}z<<=4;for(h=g=0;THREE.triTable[z+h]!=-1;){c=z+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,k){var j=this.count*3;this.positionArray[j]=c[f];this.positionArray[j+1]=c[f+1];this.positionArray[j+2]=c[f+2];this.positionArray[j+
|
|
|
+this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,k){var j=g+1,m=g+this.yd,n=g+this.zd,w=j+this.yd,t=j+this.zd,p=g+this.yd+this.zd,x=j+this.yd+this.zd,z=0,F=this.field[g],u=this.field[j],e=this.field[m],q=this.field[w],O=this.field[n],R=this.field[t],ea=this.field[p],L=this.field[x];F<h&&(z|=1);u<h&&(z|=2);e<h&&(z|=8);q<h&&(z|=4);O<h&&(z|=16);R<h&&(z|=32);ea<h&&(z|=128);L<h&&(z|=64);var I=THREE.edgeTable[z];if(I==0)return 0;
|
|
|
+var Y=this.delta,V=c+Y,ca=d+Y;Y=f+Y;if(I&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,F,u)}if(I&2){this.compNorm(j);this.compNorm(w);this.VIntY(j*3,this.vlist,this.nlist,3,h,V,d,f,u,q)}if(I&4){this.compNorm(m);this.compNorm(w);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,ca,f,e,q)}if(I&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,F,e)}if(I&16){this.compNorm(n);this.compNorm(t);this.VIntX(n*3,this.vlist,this.nlist,12,h,c,d,
|
|
|
+Y,O,R)}if(I&32){this.compNorm(t);this.compNorm(x);this.VIntY(t*3,this.vlist,this.nlist,15,h,V,d,Y,R,L)}if(I&64){this.compNorm(p);this.compNorm(x);this.VIntX(p*3,this.vlist,this.nlist,18,h,c,ca,Y,ea,L)}if(I&128){this.compNorm(n);this.compNorm(p);this.VIntY(n*3,this.vlist,this.nlist,21,h,c,d,Y,O,ea)}if(I&256){this.compNorm(g);this.compNorm(n);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,F,O)}if(I&512){this.compNorm(j);this.compNorm(t);this.VIntZ(j*3,this.vlist,this.nlist,27,h,V,d,f,u,R)}if(I&1024){this.compNorm(w);
|
|
|
+this.compNorm(x);this.VIntZ(w*3,this.vlist,this.nlist,30,h,V,ca,f,q,L)}if(I&2048){this.compNorm(m);this.compNorm(p);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,ca,f,e,ea)}z<<=4;for(h=g=0;THREE.triTable[z+h]!=-1;){c=z+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,k){var j=this.count*3;this.positionArray[j]=c[f];this.positionArray[j+1]=c[f+1];this.positionArray[j+2]=c[f+2];this.positionArray[j+
|
|
|
3]=c[g];this.positionArray[j+4]=c[g+1];this.positionArray[j+5]=c[g+2];this.positionArray[j+6]=c[h];this.positionArray[j+7]=c[h+1];this.positionArray[j+8]=c[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
|
|
|
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=d*this.size,n=c*this.size,w=Math.floor(j-k);w<1&&(w=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var q=Math.floor(n-k);q<1&&(q=1);k=Math.floor(n+k);
|
|
|
-k>this.size-1&&(k=this.size-1);for(var x,z,C,o,e,t;w<j;w++){n=this.size2*w;z=w/this.size-f;e=z*z;for(z=u;z<m;z++){C=n+this.size*z;x=z/this.size-d;t=x*x;for(x=q;x<k;x++){o=x/this.size-c;o=g/(1.0E-6+o*o+t+e)-h;o>0&&(this.field[C+x]+=o)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,n=this.yd,w=this.zd,u=this.field,q=m*Math.sqrt(c/d);q>m&&(q=m);for(f=0;f<q;f++){g=f/m;g*=g;k=c/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=f+g*n;for(h=0;h<m;h++)u[w*h+j]+=k}}};this.addPlaneY=function(c,d){var f,g,
|
|
|
-h,k,j,m,n=this.size,w=this.yd,u=this.zd,q=this.field,x=n*Math.sqrt(c/d);x>n&&(x=n);for(g=0;g<x;g++){f=g/n;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=g*w;for(f=0;f<n;f++){m=j+f;for(h=0;h<n;h++)q[u*h+m]+=k}}}};this.addPlaneZ=function(c,d){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}}};this.reset=function(){var c;
|
|
|
-for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,k,j,m,n,w,u=this.size-2;for(h=1;h<u;h++){w=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){n=w+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<u;f++){k=(f-this.halfsize)/this.halfsize;d=n+f;this.polygonize(k,j,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,j,m,n,w,u;for(g=
|
|
|
-0;g<f.count;g++){m=g*3;w=m+1;u=m+2;h=f.positionArray[m];k=f.positionArray[w];j=f.positionArray[u];n=new THREE.Vector3(h,k,j);h=f.normalArray[m];k=f.normalArray[w];j=f.normalArray[u];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(n,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;w=m+1;u=m+2;n=d.vertices[m].normal;h=d.vertices[w].normal;k=d.vertices[u].normal;m=new THREE.Face3(m,w,u,[n,h,k]);d.faces.push(m)}c+=nfaces;f.count=0});d.sortFacesByMaterial();return d};
|
|
|
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=d*this.size,n=c*this.size,w=Math.floor(j-k);w<1&&(w=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(n-k);p<1&&(p=1);k=Math.floor(n+k);
|
|
|
+k>this.size-1&&(k=this.size-1);for(var x,z,F,u,e,q;w<j;w++){n=this.size2*w;z=w/this.size-f;e=z*z;for(z=t;z<m;z++){F=n+this.size*z;x=z/this.size-d;q=x*x;for(x=p;x<k;x++){u=x/this.size-c;u=g/(1.0E-6+u*u+q+e)-h;u>0&&(this.field[F+x]+=u)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,n=this.yd,w=this.zd,t=this.field,p=m*Math.sqrt(c/d);p>m&&(p=m);for(f=0;f<p;f++){g=f/m;g*=g;k=c/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=f+g*n;for(h=0;h<m;h++)t[w*h+j]+=k}}};this.addPlaneY=function(c,d){var f,g,
|
|
|
+h,k,j,m,n=this.size,w=this.yd,t=this.zd,p=this.field,x=n*Math.sqrt(c/d);x>n&&(x=n);for(g=0;g<x;g++){f=g/n;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=g*w;for(f=0;f<n;f++){m=j+f;for(h=0;h<n;h++)p[t*h+m]+=k}}}};this.addPlaneZ=function(c,d){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}}};this.reset=function(){var c;
|
|
|
+for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,k,j,m,n,w,t=this.size-2;for(h=1;h<t;h++){w=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<t;g++){n=w+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<t;f++){k=(f-this.halfsize)/this.halfsize;d=n+f;this.polygonize(k,j,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,j,m,n,w,t;for(g=
|
|
|
+0;g<f.count;g++){m=g*3;w=m+1;t=m+2;h=f.positionArray[m];k=f.positionArray[w];j=f.positionArray[t];n=new THREE.Vector3(h,k,j);h=f.normalArray[m];k=f.normalArray[w];j=f.normalArray[t];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(n,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;w=m+1;t=m+2;n=d.vertices[m].normal;h=d.vertices[w].normal;k=d.vertices[t].normal;m=new THREE.Face3(m,w,t,[n,h,k]);d.faces.push(m)}c+=nfaces;f.count=0});d.sortFacesByMaterial();return d};
|
|
|
this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
@@ -363,24 +359,24 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
|
|
|
b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
|
|
|
THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;
|
|
|
h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
|
|
|
-createBinModel:function(a,b,c,d){var f=function(g){function h(E,P){var I=n(E,P),V=n(E,P+1),ca=n(E,P+2),ta=n(E,P+3),M=(ta<<1&255|ca>>7)-127;I|=(ca&127)<<16|V<<8;if(I==0&&M==-127)return 0;return(1-2*(ta>>7))*(1+I*Math.pow(2,-23))*Math.pow(2,M)}function k(E,P){var I=n(E,P),V=n(E,P+1),ca=n(E,P+2);return(n(E,P+3)<<24)+(ca<<16)+(V<<8)+I}function j(E,P){var I=n(E,P);return(n(E,P+1)<<8)+I}function m(E,P){var I=n(E,P);return I>127?I-256:I}function n(E,P){return E.charCodeAt(P)&255}function w(E){var P,I,V;
|
|
|
-P=k(a,E);I=k(a,E+ea);V=k(a,E+L);E=j(a,E+G);THREE.Loader.prototype.f3(o,P,I,V,E)}function u(E){var P,I,V,ca,ta,M;P=k(a,E);I=k(a,E+ea);V=k(a,E+L);ca=j(a,E+G);ta=k(a,E+Y);M=k(a,E+T);E=k(a,E+da);THREE.Loader.prototype.f3n(o,N,P,I,V,ca,ta,M,E)}function q(E){var P,I,V,ca;P=k(a,E);I=k(a,E+Z);V=k(a,E+H);ca=k(a,E+aa);E=j(a,E+na);THREE.Loader.prototype.f4(o,P,I,V,ca,E)}function x(E){var P,I,V,ca,ta,M,Ba,xa;P=k(a,E);I=k(a,E+Z);V=k(a,E+H);ca=k(a,E+aa);ta=j(a,E+na);M=k(a,E+ba);Ba=k(a,E+l);xa=k(a,E+B);E=k(a,E+
|
|
|
-y);THREE.Loader.prototype.f4n(o,N,P,I,V,ca,ta,M,Ba,xa,E)}function z(E){var P,I;P=k(a,E);I=k(a,E+v);E=k(a,E+p);THREE.Loader.prototype.uv3(o.uvs,Q[P*2],Q[P*2+1],Q[I*2],Q[I*2+1],Q[E*2],Q[E*2+1])}function C(E){var P,I,V;P=k(a,E);I=k(a,E+D);V=k(a,E+F);E=k(a,E+J);THREE.Loader.prototype.uv4(o.uvs,Q[P*2],Q[P*2+1],Q[I*2],Q[I*2+1],Q[V*2],Q[V*2+1],Q[E*2],Q[E*2+1])}var o=this,e=0,t,N=[],Q=[],ea,L,G,Y,T,da,Z,H,aa,na,ba,l,B,y,v,p,D,F,J,U,A,R,O,ga,ma;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(o,
|
|
|
-d,g);t={signature:a.substr(e,8),header_bytes:n(a,e+8),vertex_coordinate_bytes:n(a,e+9),normal_coordinate_bytes:n(a,e+10),uv_coordinate_bytes:n(a,e+11),vertex_index_bytes:n(a,e+12),normal_index_bytes:n(a,e+13),uv_index_bytes:n(a,e+14),material_index_bytes:n(a,e+15),nvertices:k(a,e+16),nnormals:k(a,e+16+4),nuvs:k(a,e+16+8),ntri_flat:k(a,e+16+12),ntri_smooth:k(a,e+16+16),ntri_flat_uv:k(a,e+16+20),ntri_smooth_uv:k(a,e+16+24),nquad_flat:k(a,e+16+28),nquad_smooth:k(a,e+16+32),nquad_flat_uv:k(a,e+16+36),
|
|
|
-nquad_smooth_uv:k(a,e+16+40)};e+=t.header_bytes;ea=t.vertex_index_bytes;L=t.vertex_index_bytes*2;G=t.vertex_index_bytes*3;Y=t.vertex_index_bytes*3+t.material_index_bytes;T=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;da=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;Z=t.vertex_index_bytes;H=t.vertex_index_bytes*2;aa=t.vertex_index_bytes*3;na=t.vertex_index_bytes*4;ba=t.vertex_index_bytes*4+t.material_index_bytes;l=t.vertex_index_bytes*4+t.material_index_bytes+
|
|
|
-t.normal_index_bytes;B=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;y=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;v=t.uv_index_bytes;p=t.uv_index_bytes*2;D=t.uv_index_bytes;F=t.uv_index_bytes*2;J=t.uv_index_bytes*3;g=t.vertex_index_bytes*3+t.material_index_bytes;ma=t.vertex_index_bytes*4+t.material_index_bytes;U=t.ntri_flat*g;A=t.ntri_smooth*(g+t.normal_index_bytes*3);R=t.ntri_flat_uv*(g+t.uv_index_bytes*3);O=t.ntri_smooth_uv*(g+t.normal_index_bytes*
|
|
|
-3+t.uv_index_bytes*3);ga=t.nquad_flat*ma;g=t.nquad_smooth*(ma+t.normal_index_bytes*4);ma=t.nquad_flat_uv*(ma+t.uv_index_bytes*4);e+=function(E){for(var P,I,V,ca=t.vertex_coordinate_bytes*3,ta=E+t.nvertices*ca;E<ta;E+=ca){P=h(a,E);I=h(a,E+t.vertex_coordinate_bytes);V=h(a,E+t.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(o,P,I,V)}return t.nvertices*ca}(e);e+=function(E){for(var P,I,V,ca=t.normal_coordinate_bytes*3,ta=E+t.nnormals*ca;E<ta;E+=ca){P=m(a,E);I=m(a,E+t.normal_coordinate_bytes);V=m(a,
|
|
|
-E+t.normal_coordinate_bytes*2);N.push(P/127,I/127,V/127)}return t.nnormals*ca}(e);e+=function(E){for(var P,I,V=t.uv_coordinate_bytes*2,ca=E+t.nuvs*V;E<ca;E+=V){P=h(a,E);I=h(a,E+t.uv_coordinate_bytes);Q.push(P,I)}return t.nuvs*V}(e);U=e+U;A=U+A;R=A+R;O=R+O;ga=O+ga;g=ga+g;ma=g+ma;(function(E){var P,I=t.vertex_index_bytes*3+t.material_index_bytes,V=I+t.uv_index_bytes*3,ca=E+t.ntri_flat_uv*V;for(P=E;P<ca;P+=V){w(P);z(P+I)}return ca-E})(A);(function(E){var P,I=t.vertex_index_bytes*3+t.material_index_bytes+
|
|
|
-t.normal_index_bytes*3,V=I+t.uv_index_bytes*3,ca=E+t.ntri_smooth_uv*V;for(P=E;P<ca;P+=V){u(P);z(P+I)}return ca-E})(R);(function(E){var P,I=t.vertex_index_bytes*4+t.material_index_bytes,V=I+t.uv_index_bytes*4,ca=E+t.nquad_flat_uv*V;for(P=E;P<ca;P+=V){q(P);C(P+I)}return ca-E})(g);(function(E){var P,I=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,V=I+t.uv_index_bytes*4,ca=E+t.nquad_smooth_uv*V;for(P=E;P<ca;P+=V){x(P);C(P+I)}return ca-E})(ma);(function(E){var P,I=t.vertex_index_bytes*
|
|
|
-3+t.material_index_bytes,V=E+t.ntri_flat*I;for(P=E;P<V;P+=I)w(P);return V-E})(e);(function(E){var P,I=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,V=E+t.ntri_smooth*I;for(P=E;P<V;P+=I)u(P);return V-E})(U);(function(E){var P,I=t.vertex_index_bytes*4+t.material_index_bytes,V=E+t.nquad_flat*I;for(P=E;P<V;P+=I)q(P);return V-E})(O);(function(E){var P,I=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,V=E+t.nquad_smooth*I;for(P=E;P<V;P+=I)x(P);return V-E})(ga);
|
|
|
+createBinModel:function(a,b,c,d){var f=function(g){function h(C,Q){var K=n(C,Q),U=n(C,Q+1),ba=n(C,Q+2),ta=n(C,Q+3),N=(ta<<1&255|ba>>7)-127;K|=(ba&127)<<16|U<<8;if(K==0&&N==-127)return 0;return(1-2*(ta>>7))*(1+K*Math.pow(2,-23))*Math.pow(2,N)}function k(C,Q){var K=n(C,Q),U=n(C,Q+1),ba=n(C,Q+2);return(n(C,Q+3)<<24)+(ba<<16)+(U<<8)+K}function j(C,Q){var K=n(C,Q);return(n(C,Q+1)<<8)+K}function m(C,Q){var K=n(C,Q);return K>127?K-256:K}function n(C,Q){return C.charCodeAt(Q)&255}function w(C){var Q,K,U;
|
|
|
+Q=k(a,C);K=k(a,C+ea);U=k(a,C+L);C=j(a,C+I);THREE.Loader.prototype.f3(u,Q,K,U,C)}function t(C){var Q,K,U,ba,ta,N;Q=k(a,C);K=k(a,C+ea);U=k(a,C+L);ba=j(a,C+I);ta=k(a,C+Y);N=k(a,C+V);C=k(a,C+ca);THREE.Loader.prototype.f3n(u,O,Q,K,U,ba,ta,N,C)}function p(C){var Q,K,U,ba;Q=k(a,C);K=k(a,C+da);U=k(a,C+G);ba=k(a,C+$);C=j(a,C+na);THREE.Loader.prototype.f4(u,Q,K,U,ba,C)}function x(C){var Q,K,U,ba,ta,N,Ba,xa;Q=k(a,C);K=k(a,C+da);U=k(a,C+G);ba=k(a,C+$);ta=j(a,C+na);N=k(a,C+aa);Ba=k(a,C+l);xa=k(a,C+A);C=k(a,C+
|
|
|
+y);THREE.Loader.prototype.f4n(u,O,Q,K,U,ba,ta,N,Ba,xa,C)}function z(C){var Q,K;Q=k(a,C);K=k(a,C+v);C=k(a,C+o);THREE.Loader.prototype.uv3(u.uvs,R[Q*2],R[Q*2+1],R[K*2],R[K*2+1],R[C*2],R[C*2+1])}function F(C){var Q,K,U;Q=k(a,C);K=k(a,C+B);U=k(a,C+E);C=k(a,C+H);THREE.Loader.prototype.uv4(u.uvs,R[Q*2],R[Q*2+1],R[K*2],R[K*2+1],R[U*2],R[U*2+1],R[C*2],R[C*2+1])}var u=this,e=0,q,O=[],R=[],ea,L,I,Y,V,ca,da,G,$,na,aa,l,A,y,v,o,B,E,H,T,D,J,P,ga,la;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(u,
|
|
|
+d,g);q={signature:a.substr(e,8),header_bytes:n(a,e+8),vertex_coordinate_bytes:n(a,e+9),normal_coordinate_bytes:n(a,e+10),uv_coordinate_bytes:n(a,e+11),vertex_index_bytes:n(a,e+12),normal_index_bytes:n(a,e+13),uv_index_bytes:n(a,e+14),material_index_bytes:n(a,e+15),nvertices:k(a,e+16),nnormals:k(a,e+16+4),nuvs:k(a,e+16+8),ntri_flat:k(a,e+16+12),ntri_smooth:k(a,e+16+16),ntri_flat_uv:k(a,e+16+20),ntri_smooth_uv:k(a,e+16+24),nquad_flat:k(a,e+16+28),nquad_smooth:k(a,e+16+32),nquad_flat_uv:k(a,e+16+36),
|
|
|
+nquad_smooth_uv:k(a,e+16+40)};e+=q.header_bytes;ea=q.vertex_index_bytes;L=q.vertex_index_bytes*2;I=q.vertex_index_bytes*3;Y=q.vertex_index_bytes*3+q.material_index_bytes;V=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;ca=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;da=q.vertex_index_bytes;G=q.vertex_index_bytes*2;$=q.vertex_index_bytes*3;na=q.vertex_index_bytes*4;aa=q.vertex_index_bytes*4+q.material_index_bytes;l=q.vertex_index_bytes*4+q.material_index_bytes+
|
|
|
+q.normal_index_bytes;A=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;y=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;v=q.uv_index_bytes;o=q.uv_index_bytes*2;B=q.uv_index_bytes;E=q.uv_index_bytes*2;H=q.uv_index_bytes*3;g=q.vertex_index_bytes*3+q.material_index_bytes;la=q.vertex_index_bytes*4+q.material_index_bytes;T=q.ntri_flat*g;D=q.ntri_smooth*(g+q.normal_index_bytes*3);J=q.ntri_flat_uv*(g+q.uv_index_bytes*3);P=q.ntri_smooth_uv*(g+q.normal_index_bytes*
|
|
|
+3+q.uv_index_bytes*3);ga=q.nquad_flat*la;g=q.nquad_smooth*(la+q.normal_index_bytes*4);la=q.nquad_flat_uv*(la+q.uv_index_bytes*4);e+=function(C){for(var Q,K,U,ba=q.vertex_coordinate_bytes*3,ta=C+q.nvertices*ba;C<ta;C+=ba){Q=h(a,C);K=h(a,C+q.vertex_coordinate_bytes);U=h(a,C+q.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(u,Q,K,U)}return q.nvertices*ba}(e);e+=function(C){for(var Q,K,U,ba=q.normal_coordinate_bytes*3,ta=C+q.nnormals*ba;C<ta;C+=ba){Q=m(a,C);K=m(a,C+q.normal_coordinate_bytes);U=m(a,
|
|
|
+C+q.normal_coordinate_bytes*2);O.push(Q/127,K/127,U/127)}return q.nnormals*ba}(e);e+=function(C){for(var Q,K,U=q.uv_coordinate_bytes*2,ba=C+q.nuvs*U;C<ba;C+=U){Q=h(a,C);K=h(a,C+q.uv_coordinate_bytes);R.push(Q,K)}return q.nuvs*U}(e);T=e+T;D=T+D;J=D+J;P=J+P;ga=P+ga;g=ga+g;la=g+la;(function(C){var Q,K=q.vertex_index_bytes*3+q.material_index_bytes,U=K+q.uv_index_bytes*3,ba=C+q.ntri_flat_uv*U;for(Q=C;Q<ba;Q+=U){w(Q);z(Q+K)}return ba-C})(D);(function(C){var Q,K=q.vertex_index_bytes*3+q.material_index_bytes+
|
|
|
+q.normal_index_bytes*3,U=K+q.uv_index_bytes*3,ba=C+q.ntri_smooth_uv*U;for(Q=C;Q<ba;Q+=U){t(Q);z(Q+K)}return ba-C})(J);(function(C){var Q,K=q.vertex_index_bytes*4+q.material_index_bytes,U=K+q.uv_index_bytes*4,ba=C+q.nquad_flat_uv*U;for(Q=C;Q<ba;Q+=U){p(Q);F(Q+K)}return ba-C})(g);(function(C){var Q,K=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,U=K+q.uv_index_bytes*4,ba=C+q.nquad_smooth_uv*U;for(Q=C;Q<ba;Q+=U){x(Q);F(Q+K)}return ba-C})(la);(function(C){var Q,K=q.vertex_index_bytes*
|
|
|
+3+q.material_index_bytes,U=C+q.ntri_flat*K;for(Q=C;Q<U;Q+=K)w(Q);return U-C})(e);(function(C){var Q,K=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,U=C+q.ntri_smooth*K;for(Q=C;Q<U;Q+=K)t(Q);return U-C})(T);(function(C){var Q,K=q.vertex_index_bytes*4+q.material_index_bytes,U=C+q.nquad_flat*K;for(Q=C;Q<U;Q+=K)p(Q);return U-C})(P);(function(C){var Q,K=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,U=C+q.nquad_smooth*K;for(Q=C;Q<U;Q+=K)x(Q);return U-C})(ga);
|
|
|
this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,k,j,m,n;h=0;for(k=a.vertices.length;h<k;h+=3){j=a.vertices[h];m=a.vertices[h+1];n=a.vertices[h+2];THREE.Loader.prototype.v(g,j,m,n)}if(a.colors){h=0;for(k=a.colors.length;h<k;h+=3){j=a.colors[h];m=
|
|
|
-a.colors[h+1];n=a.colors[h+2];THREE.Loader.prototype.vc(g,j,m,n)}}})();(function(){function h(x,z){THREE.Loader.prototype.f3(g,x[z],x[z+1],x[z+2],x[z+3])}function k(x,z){THREE.Loader.prototype.f3n(g,a.normals,x[z],x[z+1],x[z+2],x[z+3],x[z+4],x[z+5],x[z+6])}function j(x,z){THREE.Loader.prototype.f4(g,x[z],x[z+1],x[z+2],x[z+3],x[z+4])}function m(x,z){THREE.Loader.prototype.f4n(g,a.normals,x[z],x[z+1],x[z+2],x[z+3],x[z+4],x[z+5],x[z+6],x[z+7],x[z+8])}function n(x,z){var C,o,e,t,N,Q,ea,L,G;C=x[z];o=x[z+
|
|
|
-1];e=x[z+2];t=a.uvs[C*2];ea=a.uvs[C*2+1];N=a.uvs[o*2];L=a.uvs[o*2+1];Q=a.uvs[e*2];G=a.uvs[e*2+1];THREE.Loader.prototype.uv3(g.uvs,t,ea,N,L,Q,G);if(a.uvs2&&a.uvs2.length){t=a.uvs2[C*2];ea=a.uvs2[C*2+1];N=a.uvs2[o*2];L=a.uvs2[o*2+1];Q=a.uvs2[e*2];G=a.uvs2[e*2+1];THREE.Loader.prototype.uv3(g.uvs2,t,1-ea,N,1-L,Q,1-G)}}function w(x,z){var C,o,e,t,N,Q,ea,L,G,Y,T,da;C=x[z];o=x[z+1];e=x[z+2];t=x[z+3];N=a.uvs[C*2];G=a.uvs[C*2+1];Q=a.uvs[o*2];Y=a.uvs[o*2+1];ea=a.uvs[e*2];T=a.uvs[e*2+1];L=a.uvs[t*2];da=a.uvs[t*
|
|
|
-2+1];THREE.Loader.prototype.uv4(g.uvs,N,G,Q,Y,ea,T,L,da);if(a.uvs2){N=a.uvs2[C*2];G=a.uvs2[C*2+1];Q=a.uvs2[o*2];Y=a.uvs2[o*2+1];ea=a.uvs2[e*2];T=a.uvs2[e*2+1];L=a.uvs2[t*2];da=a.uvs2[t*2+1];THREE.Loader.prototype.uv4(g.uvs2,N,1-G,Q,1-Y,ea,1-T,L,1-da)}}var u,q;u=0;for(q=a.triangles_uv.length;u<q;u+=7){h(a.triangles_uv,u);n(a.triangles_uv,u+4)}u=0;for(q=a.triangles_n_uv.length;u<q;u+=10){k(a.triangles_n_uv,u);n(a.triangles_n_uv,u+7)}u=0;for(q=a.quads_uv.length;u<q;u+=9){j(a.quads_uv,u);w(a.quads_uv,
|
|
|
-u+5)}u=0;for(q=a.quads_n_uv.length;u<q;u+=13){m(a.quads_n_uv,u);w(a.quads_n_uv,u+9)}u=0;for(q=a.triangles.length;u<q;u+=4)h(a.triangles,u);u=0;for(q=a.triangles_n.length;u<q;u+=7)k(a.triangles_n,u);u=0;for(q=a.quads.length;u<q;u+=5)j(a.quads,u);u=0;for(q=a.quads_n.length;u<q;u+=9)m(a.quads_n,u)})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,j,m,0,0)}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<
|
|
|
+a.colors[h+1];n=a.colors[h+2];THREE.Loader.prototype.vc(g,j,m,n)}}})();(function(){function h(x,z){THREE.Loader.prototype.f3(g,x[z],x[z+1],x[z+2],x[z+3])}function k(x,z){THREE.Loader.prototype.f3n(g,a.normals,x[z],x[z+1],x[z+2],x[z+3],x[z+4],x[z+5],x[z+6])}function j(x,z){THREE.Loader.prototype.f4(g,x[z],x[z+1],x[z+2],x[z+3],x[z+4])}function m(x,z){THREE.Loader.prototype.f4n(g,a.normals,x[z],x[z+1],x[z+2],x[z+3],x[z+4],x[z+5],x[z+6],x[z+7],x[z+8])}function n(x,z){var F,u,e,q,O,R,ea,L,I;F=x[z];u=x[z+
|
|
|
+1];e=x[z+2];q=a.uvs[F*2];ea=a.uvs[F*2+1];O=a.uvs[u*2];L=a.uvs[u*2+1];R=a.uvs[e*2];I=a.uvs[e*2+1];THREE.Loader.prototype.uv3(g.uvs,q,ea,O,L,R,I);if(a.uvs2&&a.uvs2.length){q=a.uvs2[F*2];ea=a.uvs2[F*2+1];O=a.uvs2[u*2];L=a.uvs2[u*2+1];R=a.uvs2[e*2];I=a.uvs2[e*2+1];THREE.Loader.prototype.uv3(g.uvs2,q,1-ea,O,1-L,R,1-I)}}function w(x,z){var F,u,e,q,O,R,ea,L,I,Y,V,ca;F=x[z];u=x[z+1];e=x[z+2];q=x[z+3];O=a.uvs[F*2];I=a.uvs[F*2+1];R=a.uvs[u*2];Y=a.uvs[u*2+1];ea=a.uvs[e*2];V=a.uvs[e*2+1];L=a.uvs[q*2];ca=a.uvs[q*
|
|
|
+2+1];THREE.Loader.prototype.uv4(g.uvs,O,I,R,Y,ea,V,L,ca);if(a.uvs2){O=a.uvs2[F*2];I=a.uvs2[F*2+1];R=a.uvs2[u*2];Y=a.uvs2[u*2+1];ea=a.uvs2[e*2];V=a.uvs2[e*2+1];L=a.uvs2[q*2];ca=a.uvs2[q*2+1];THREE.Loader.prototype.uv4(g.uvs2,O,1-I,R,1-Y,ea,1-V,L,1-ca)}}var t,p;t=0;for(p=a.triangles_uv.length;t<p;t+=7){h(a.triangles_uv,t);n(a.triangles_uv,t+4)}t=0;for(p=a.triangles_n_uv.length;t<p;t+=10){k(a.triangles_n_uv,t);n(a.triangles_n_uv,t+7)}t=0;for(p=a.quads_uv.length;t<p;t+=9){j(a.quads_uv,t);w(a.quads_uv,
|
|
|
+t+5)}t=0;for(p=a.quads_n_uv.length;t<p;t+=13){m(a.quads_n_uv,t);w(a.quads_n_uv,t+9)}t=0;for(p=a.triangles.length;t<p;t+=4)h(a.triangles,t);t=0;for(p=a.triangles_n.length;t<p;t+=7)k(a.triangles_n,t);t=0;for(p=a.quads.length;t<p;t+=5)j(a.quads,t);t=0;for(p=a.quads_n.length;t<p;t+=9)m(a.quads_n,t)})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,j,m,0,0)}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<
|
|
|
k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];THREE.Loader.prototype.si(g,j,m,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,
|
|
|
-c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],n=b[k*3+1];k=b[k*3+2];var w=b[j*3],u=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*
|
|
|
-3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,n,k),new THREE.Vector3(w,u,j)],g))},f4n:function(a,b,c,d,f,g,h,k,j,m,n){h=a.materials[h];var w=b[j*3],u=b[j*3+1];j=b[j*3+2];var q=b[m*3],x=b[m*3+1];m=b[m*3+2];var z=b[n*3],C=b[n*3+1];n=b[n*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(w,u,j),new THREE.Vector3(q,x,m),new THREE.Vector3(z,C,n)],h))},uv3:function(a,b,c,d,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,
|
|
|
+c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],n=b[k*3+1];k=b[k*3+2];var w=b[j*3],t=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*
|
|
|
+3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,n,k),new THREE.Vector3(w,t,j)],g))},f4n:function(a,b,c,d,f,g,h,k,j,m,n){h=a.materials[h];var w=b[j*3],t=b[j*3+1];j=b[j*3+2];var p=b[m*3],x=b[m*3+1];m=b[m*3+2];var z=b[n*3],F=b[n*3+1];n=b[n*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(w,t,j),new THREE.Vector3(p,x,m),new THREE.Vector3(z,F,n)],h))},uv3:function(a,b,c,d,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,
|
|
|
h));a.push(k)},uv4:function(a,b,c,d,f,g,h,k,j){var m=[];m.push(new THREE.UV(b,c));m.push(new THREE.UV(d,f));m.push(new THREE.UV(g,h));m.push(new THREE.UV(k,j));a.push(m)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!c(this.width)||!c(this.height)){var n=Math.pow(2,
|
|
|
Math.round(Math.log(this.width)/Math.LN2)),w=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));k.image.width=n;k.image.height=w;k.image.getContext("2d").drawImage(this,0,0,n,w)}else k.image=this;k.image.loaded=1};m.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,light_map:null,vertex_colors:a.vertex_colors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.map_diffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+a.map_diffuse)}else if(a.col_diffuse){h=
|
|
|
(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.a_dbg_color)g.color=a.a_dbg_color;if(a.map_lightmap&&b){h=document.createElement("canvas");g.light_map=new THREE.Texture(h);d(g.light_map,b+"/"+a.map_lightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|