diff --git a/README.md b/README.md index e889c381..51969b29 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a & material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } ); mesh = new THREE.Mesh( geometry, material ); - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/build/Three.js b/build/Three.js index 8d755697..020dd854 100644 --- a/build/Three.js +++ b/build/Three.js @@ -1,91 +1,91 @@ // Three.js r45dev - http://github.com/mrdoob/three.js -var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this}; +var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,h,m;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),h=b*6-f,b=e*(1-c),m=e*(1-c*h),c=e*(1-c*(1-h)),f){case 1:this.r=m;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=m;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r= e;this.g=b;this.b=m;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this}, divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)}, equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.x=b||0;this.y=c||0;this.z=e||0}; -THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,e){this.x=b;this.y=c;this.z=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z= -b.z-c.z;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){this.x/=b.x;this.y/=b.y;this.z/=b.z;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)}, -dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y* -b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13);Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()< -1.0E-4}};THREE.Vector4=function(b,c,e,f){this.x=b||0;this.y=c||0;this.z=e||0;this.w=f||1}; +THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,e){this.x=b;this.y=c;this.z=e;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},setZ:function(b){this.z=b;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this}, +addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){this.x/=b.x;this.y/=b.y;this.z/=b.z;return this}, +divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)}, +cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y*b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13); +Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(b,c,e,f){this.x=b||0;this.y=c||0;this.z=e||0;this.w=f||1}; THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w||1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;this.w= b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c0&&b>0&&k+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x, -Math.max(b.scale.y,b.scale.z)))return[];var h,m,k,n,t,p,v,u,x,w,y=b.geometry,z=y.vertices,A=[],f=0;for(h=y.faces.length;f0:u<0)))if(u=v.dot((new THREE.Vector3).sub(k,x))/u,x=x.addSelf(w.multiplyScalar(u)),m instanceof THREE.Face3)e(x,k,n,t)&&(m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m));else if(m instanceof THREE.Face4&&(e(x,k,n,p)||e(x,n,t,p)))m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m);A.sort(function(b,e){return b.distance-e.distance});return A}else return[]}}; -THREE.Rectangle=function(){function b(){m=f-c;k=h-e}var c,e,f,h,m,k,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,v,u){n=!1;c=k;e=m;f=v;h=u;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=ck?f:k,h=h>m?h:m);b()};this.add3Points= -function(k,m,v,u,x,w){n?(n=!1,c=kv?k>x?k:x:v>x?v:x,h=m>u?m>w?m:w:u>w?u:w):(c=kv?k>x?k>f?k:f:x>f?x:f:v>x?v>f?v:f:x>f?x:f,h=m>u?m>w?m>h?m:h:w>h?w:h:u>w?u>h?u:h:w>h?w:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=ck.getRight()?f:k.getRight(),h=h> +Math.max(b.scale.y,b.scale.z)))return[];var h,m,k,n,p,v,u,t,x,w,y=b.geometry,z=y.vertices,A=[],f=0;for(h=y.faces.length;f0:t<0)))if(t=u.dot((new THREE.Vector3).sub(k,x))/t,x=x.addSelf(w.multiplyScalar(t)),m instanceof THREE.Face3)e(x,k,n,p)&&(m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m));else if(m instanceof THREE.Face4&&(e(x,k,n,v)||e(x,n,p,v)))m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m);A.sort(function(b,e){return b.distance-e.distance});return A}else return[]}}; +THREE.Rectangle=function(){function b(){m=f-c;k=h-e}var c,e,f,h,m,k,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,u,t){n=!1;c=k;e=m;f=u;h=t;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=ck?f:k,h=h>m?h:m);b()};this.add3Points= +function(k,m,u,t,x,w){n?(n=!1,c=ku?k>x?k:x:u>x?u:x,h=m>t?m>w?m:w:t>w?t:w):(c=ku?k>x?k>f?k:f:x>f?x:f:u>x?u>f?u:f:x>f?x:f,h=m>t?m>w?m>h?m:h:w>h?w:h:t>w?t>h?t:h:w>h?w:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=ck.getRight()?f:k.getRight(),h=h> k.getBottom()?h:k.getBottom());b()};this.inflate=function(k){c-=k;e-=k;f+=k;h+=k;b()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){n=!0;h=f=e=c=0;b()};this.isEmpty=function(){return n}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,h,m,k,n,t,p,v,u,x,w,y,z){this.set(b||1,c||0,e||0,f||0,h||0,m||1,k||0,n||0,t||0,p||0,v||1,u||0,x||0,w||0,y||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,t,p,v,u,x,w,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=m;this.n23=k;this.n24=n;this.n31=t;this.n32=p;this.n33=v;this.n34=u;this.n41=x;this.n42=w;this.n43=y;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, +THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,h,m,k,n,p,v,u,t,x,w,y,z){this.set(b||1,c||0,e||0,f||0,h||0,m||1,k||0,n||0,p||0,v||0,u||1,t||0,x||0,w||0,y||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,p,v,u,t,x,w,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=m;this.n23=k;this.n24=n;this.n31=p;this.n32=v;this.n33=u;this.n34=t;this.n41=x;this.n42=w;this.n43=y;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h; b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+ -e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,t=b.n23,p=b.n24,v=b.n31,u=b.n32,x=b.n33,w=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44,E=c.n11,G=c.n12, -H=c.n13,O=c.n14,S=c.n21,J=c.n22,I=c.n23,K=c.n24,W=c.n31,D=c.n32,M=c.n33,U=c.n34,V=c.n41,R=c.n42,o=c.n43,pa=c.n44;this.n11=e*E+f*S+h*W+m*V;this.n12=e*G+f*J+h*D+m*R;this.n13=e*H+f*I+h*M+m*o;this.n14=e*O+f*K+h*U+m*pa;this.n21=k*E+n*S+t*W+p*V;this.n22=k*G+n*J+t*D+p*R;this.n23=k*H+n*I+t*M+p*o;this.n24=k*O+n*K+t*U+p*pa;this.n31=v*E+u*S+x*W+w*V;this.n32=v*G+u*J+x*D+w*R;this.n33=v*H+u*I+x*M+w*o;this.n34=v*O+u*K+x*U+w*pa;this.n41=y*E+z*S+A*W+C*V;this.n42=y*G+z*J+A*D+C*R;this.n43=y*H+z*I+A*M+C*o;this.n44=y* -O+z*K+A*U+C*pa;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*= -b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,m=this.n22,k=this.n23,n=this.n24,t=this.n31,p=this.n32,v=this.n33,u=this.n34,x=this.n41,w=this.n42,y=this.n43,z=this.n44;return f*k*p*x-e*n*p*x-f*m*v*x+c*n*v*x+e*m*u*x-c*k*u*x-f*k*t*w+e*n*t*w+f*h*v*w-b*n*v*w-e*h*u*w+b*k*u*w+f*m*t*y-c*n*t*y-f*h*p*y+b*n*p*y+c*h*u*y-b*m*u*y-e*m*t*z+c*k*t*z+e*h*p*z-b*k*p*z-c*h* -v*z+b*m*v*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34= +e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,p=b.n23,v=b.n24,u=b.n31,t=b.n32,x=b.n33,w=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44,E=c.n11,G=c.n12, +H=c.n13,N=c.n14,S=c.n21,J=c.n22,I=c.n23,K=c.n24,W=c.n31,D=c.n32,M=c.n33,U=c.n34,V=c.n41,R=c.n42,o=c.n43,pa=c.n44;this.n11=e*E+f*S+h*W+m*V;this.n12=e*G+f*J+h*D+m*R;this.n13=e*H+f*I+h*M+m*o;this.n14=e*N+f*K+h*U+m*pa;this.n21=k*E+n*S+p*W+v*V;this.n22=k*G+n*J+p*D+v*R;this.n23=k*H+n*I+p*M+v*o;this.n24=k*N+n*K+p*U+v*pa;this.n31=u*E+t*S+x*W+w*V;this.n32=u*G+t*J+x*D+w*R;this.n33=u*H+t*I+x*M+w*o;this.n34=u*N+t*K+x*U+w*pa;this.n41=y*E+z*S+A*W+C*V;this.n42=y*G+z*J+A*D+C*R;this.n43=y*H+z*I+A*M+C*o;this.n44=y* +N+z*K+A*U+C*pa;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*= +b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,m=this.n22,k=this.n23,n=this.n24,p=this.n31,v=this.n32,u=this.n33,t=this.n34,x=this.n41,w=this.n42,y=this.n43,z=this.n44;return f*k*v*x-e*n*v*x-f*m*u*x+c*n*u*x+e*m*t*x-c*k*t*x-f*k*p*w+e*n*p*w+f*h*u*w-b*n*u*w-e*h*t*w+b*k*t*w+f*m*p*y-c*n*p*y-f*h*v*y+b*n*v*y+c*h*t*y-b*m*t*y-e*m*p*z+c*k*p*z+e*h*v*z-b*k*v*z-c*h* +u*z+b*m*u*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34= this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]= this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]= this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0, -0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,m=b.x,k=b.y,n=b.z,t=h*m,p=h*k;this.set(t*m+e,t*k-f*n,t*n+f*k,0,t*k+f*n,p*k+e,p*n-f*m,0,t*n-f*k,p*n+f*m,h*n*n+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= -new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,h=b.z,m=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var t= -k*n,p=k*h,v=f*n,u=f*h;this.n11=t+u*e;this.n12=v*e-p;this.n13=m*f;this.n21=m*h;this.n22=m*n;this.n23=-e;this.n31=p*e-v;this.n32=u+t*e;this.n33=m*k;break;case "ZXY":t=k*n;p=k*h;v=f*n;u=f*h;this.n11=t-u*e;this.n12=-m*h;this.n13=v+p*e;this.n21=p+v*e;this.n22=m*n;this.n23=u-t*e;this.n31=-m*f;this.n32=e;this.n33=m*k;break;case "ZYX":t=m*n;p=m*h;v=e*n;u=e*h;this.n11=k*n;this.n12=v*f-p;this.n13=t*f+u;this.n21=k*h;this.n22=u*f+t;this.n23=p*f-v;this.n31=-f;this.n32=e*k;this.n33=m*k;break;case "YZX":t=m*k;p= -m*f;v=e*k;u=e*f;this.n11=k*n;this.n12=u-t*h;this.n13=v*h+p;this.n21=h;this.n22=m*n;this.n23=-e*n;this.n31=-f*n;this.n32=p*h+v;this.n33=t-u*h;break;case "XZY":t=m*k;p=m*f;v=e*k;u=e*f;this.n11=k*n;this.n12=-h;this.n13=f*n;this.n21=t*h+u;this.n22=m*n;this.n23=p*h-v;this.n31=v*h-p;this.n32=e*n;this.n33=u*h+t;break;default:t=m*n,p=m*h,v=e*n,u=e*h,this.n11=k*n,this.n12=-k*h,this.n13=f,this.n21=p+v*f,this.n22=t-u*f,this.n23=-e*k,this.n31=u-t*f,this.n32=v+p*f,this.n33=m*k}return this},setRotationFromQuaternion:function(b){var c= -b.x,e=b.y,f=b.z,h=b.w,m=c+c,k=e+e,n=f+f,b=c*m,t=c*k;c*=n;var p=e*k;e*=n;f*=n;m*=h;k*=h;h*=n;this.n11=1-(p+f);this.n12=t-h;this.n13=c+k;this.n21=t+h;this.n22=1-(b+f);this.n23=e-m;this.n31=c-k;this.n32=e+m;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2; +0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,m=b.x,k=b.y,n=b.z,p=h*m,v=h*k;this.set(p*m+e,p*k-f*n,p*n+f*k,0,p*k+f*n,v*k+e,v*n-f*m,0,p*n-f*k,v*n+f*m,h*n*n+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= +new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,h=b.z,m=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var p= +k*n,v=k*h,u=f*n,t=f*h;this.n11=p+t*e;this.n12=u*e-v;this.n13=m*f;this.n21=m*h;this.n22=m*n;this.n23=-e;this.n31=v*e-u;this.n32=t+p*e;this.n33=m*k;break;case "ZXY":p=k*n;v=k*h;u=f*n;t=f*h;this.n11=p-t*e;this.n12=-m*h;this.n13=u+v*e;this.n21=v+u*e;this.n22=m*n;this.n23=t-p*e;this.n31=-m*f;this.n32=e;this.n33=m*k;break;case "ZYX":p=m*n;v=m*h;u=e*n;t=e*h;this.n11=k*n;this.n12=u*f-v;this.n13=p*f+t;this.n21=k*h;this.n22=t*f+p;this.n23=v*f-u;this.n31=-f;this.n32=e*k;this.n33=m*k;break;case "YZX":p=m*k;v= +m*f;u=e*k;t=e*f;this.n11=k*n;this.n12=t-p*h;this.n13=u*h+v;this.n21=h;this.n22=m*n;this.n23=-e*n;this.n31=-f*n;this.n32=v*h+u;this.n33=p-t*h;break;case "XZY":p=m*k;v=m*f;u=e*k;t=e*f;this.n11=k*n;this.n12=-h;this.n13=f*n;this.n21=p*h+t;this.n22=m*n;this.n23=v*h-u;this.n31=u*h-v;this.n32=e*n;this.n33=t*h+p;break;default:p=m*n,v=m*h,u=e*n,t=e*h,this.n11=k*n,this.n12=-k*h,this.n13=f,this.n21=v+u*f,this.n22=p-t*f,this.n23=-e*k,this.n31=t-p*f,this.n32=u+v*f,this.n33=m*k}return this},setRotationFromQuaternion:function(b){var c= +b.x,e=b.y,f=b.z,h=b.w,m=c+c,k=e+e,n=f+f,b=c*m,p=c*k;c*=n;var v=e*k;e*=n;f*=n;m*=h;k*=h;h*=n;this.n11=1-(v+f);this.n12=p-h;this.n13=c+k;this.n21=p+h;this.n22=1-(b+f);this.n23=e-m;this.n31=c-k;this.n32=e+m;this.n33=1-(b+v);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2; f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);m.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); e.y=h.length();e.z=m.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23= b.n23*h;this.n33=b.n33*h}}; -THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,t=b.n23,p=b.n24,v=b.n31,u=b.n32,x=b.n33,w=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*w*z-p*x*z+p*u*A-n*w*A-t*u*C+n*x*C;c.n12=m*x*z-h*w*z-m*u*A+f*w*A+h*u*C-f*x*C;c.n13=h*p*z-m*t*z+m*n*A-f*p*A-h*n*C+f*t*C;c.n14=m*t*u-h*p*u-m*n*x+f*p*x+h*n*w-f*t*w;c.n21=p*x*y-t*w*y-p*v*A+k*w*A+t*v*C-k*x*C;c.n22=h*w*y-m*x*y+m*v*A-e*w*A-h*v*C+e*x*C;c.n23=m*t*y-h*p*y-m*k*A+e*p*A+h*k*C-e*t*C;c.n24= -h*p*v-m*t*v+m*k*x-e*p*x-h*k*w+e*t*w;c.n31=n*w*y-p*u*y+p*v*z-k*w*z-n*v*C+k*u*C;c.n32=m*u*y-f*w*y-m*v*z+e*w*z+f*v*C-e*u*C;c.n33=h*p*y-m*n*y+m*k*z-e*p*z-f*k*C+e*n*C;c.n34=m*n*v-f*p*v-m*k*u+e*p*u+f*k*w-e*n*w;c.n41=t*u*y-n*x*y-t*v*z+k*x*z+n*v*A-k*u*A;c.n42=f*x*y-h*u*y+h*v*z-e*x*z-f*v*A+e*u*A;c.n43=h*n*y-f*t*y-h*k*z+e*t*z+f*k*A-e*n*A;c.n44=f*t*v-h*n*v+h*k*u-e*t*u-f*k*x+e*n*x;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,t=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,v=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*m;e[3]=b*k;e[4]=b*n;e[5]=b*t;e[6]=b*p;e[7]=b*v;e[8]=b*u;return c}; +THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,p=b.n23,v=b.n24,u=b.n31,t=b.n32,x=b.n33,w=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*w*z-v*x*z+v*t*A-n*w*A-p*t*C+n*x*C;c.n12=m*x*z-h*w*z-m*t*A+f*w*A+h*t*C-f*x*C;c.n13=h*v*z-m*p*z+m*n*A-f*v*A-h*n*C+f*p*C;c.n14=m*p*t-h*v*t-m*n*x+f*v*x+h*n*w-f*p*w;c.n21=v*x*y-p*w*y-v*u*A+k*w*A+p*u*C-k*x*C;c.n22=h*w*y-m*x*y+m*u*A-e*w*A-h*u*C+e*x*C;c.n23=m*p*y-h*v*y-m*k*A+e*v*A+h*k*C-e*p*C;c.n24= +h*v*u-m*p*u+m*k*x-e*v*x-h*k*w+e*p*w;c.n31=n*w*y-v*t*y+v*u*z-k*w*z-n*u*C+k*t*C;c.n32=m*t*y-f*w*y-m*u*z+e*w*z+f*u*C-e*t*C;c.n33=h*v*y-m*n*y+m*k*z-e*v*z-f*k*C+e*n*C;c.n34=m*n*u-f*v*u-m*k*t+e*v*t+f*k*w-e*n*w;c.n41=p*t*y-n*x*y-p*u*z+k*x*z+n*u*A-k*t*A;c.n42=f*x*y-h*t*y+h*u*z-e*x*z-f*u*A+e*t*A;c.n43=h*n*y-f*p*y-h*k*z+e*p*z+f*k*A-e*n*A;c.n44=f*p*u-h*n*u+h*k*t-e*p*t-f*k*x+e*n*x;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,v=b.n23*b.n12-b.n22*b.n13,u=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*v;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*m;e[3]=b*k;e[4]=b*n;e[5]=b*p;e[6]=b*v;e[7]=b*u;e[8]=b*t;return c}; THREE.Matrix4.makeFrustum=function(b,c,e,f,h,m){var k;k=new THREE.Matrix4;k.n11=2*h/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*h/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(m+h)/(m-h);k.n34=-2*m*h/(m-h);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)}; -THREE.Matrix4.makeOrtho=function(b,c,e,f,h,m){var k,n,t,p;k=new THREE.Matrix4;n=c-b;t=e-f;p=m-h;k.n11=2/n;k.n12=0;k.n13=0;k.n14=-((c+b)/n);k.n21=0;k.n22=2/t;k.n23=0;k.n24=-((e+f)/t);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((m+h)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; +THREE.Matrix4.makeOrtho=function(b,c,e,f,h,m){var k,n,p,v;k=new THREE.Matrix4;n=c-b;p=e-f;v=m-h;k.n11=2/n;k.n12=0;k.n13=0;k.n14=-((c+b)/n);k.n21=0;k.n22=2/p;k.n23=0;k.n24=-((e+f)/p);k.n31=0;k.n32=0;k.n33=-2/v;k.n34=-((m+h)/v);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3}; THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)=== -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,h;e=0;for(f=this.children.length;e=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),fo&&k.positionScreen.z0&&J.z<1))ma=G[E]=G[E]||new THREE.RenderableParticle,E++,C=ma,C.x=J.x/J.w,C.y=J.y/J.w,C.z= -J.z,C.rotation=Y.rotation.z,C.scale.x=Y.scale.x*Math.abs(C.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),C.scale.y=Y.scale.y*Math.abs(C.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),C.materials=Y.materials,O.push(C);m&&O.sort(c);return O}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)}; +o=b.objects;b=0;for(e=o.length;bo&&k.positionScreen.z0&&J.z<1))ma=G[E]=G[E]||new THREE.RenderableParticle,E++,C=ma,C.x=J.x/J.w,C.y=J.y/J.w,C.z= +J.z,C.rotation=Y.rotation.z,C.scale.x=Y.scale.x*Math.abs(C.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),C.scale.y=Y.scale.y*Math.abs(C.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),C.materials=Y.materials,N.push(C);m&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),m=Math.cos(e),e=Math.sin(e),k=b*c,n=f*h;this.w=k*m-n*e;this.x=k*e+n*m;this.y=f*c*m+b*h*e;this.z=b*h*m-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e); this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c= -this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,m=this.x,k=this.y,n=this.z,t=this.w,p=t*e+k*h-n*f,v=t*f+n*e-m*h,u=t*h+m*f-k*e,e=-m* -e-k*f-n*h;c.x=p*t+e*-m+v*-n-u*-k;c.y=v*t+e*-k+u*-m-p*-n;c.z=u*t+e*-n+p*-k-v*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; +this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,m=this.x,k=this.y,n=this.z,p=this.w,v=p*e+k*h-n*f,u=p*f+n*e-m*h,t=p*h+m*f-k*e,e=-m* +e-k*f-n*h;c.x=v*p+e*-m+u*-n-t*-k;c.y=u*p+e*-k+t*-m-v*-n;c.z=t*p+e*-n+v*-k-u*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,m){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,c,e,f,h,m,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;cthis.points.length-2?m:m+1;e[3]=m>this.points.length-3?m:m+2;p=this.points[e[0]];v=this.points[e[1]]; -u=this.points[e[2]];x=this.points[e[3]];n=k*k;t=k*n;f.x=c(p.x,v.x,u.x,x.x,k,n,t);f.y=c(p.y,v.y,u.y,x.y,k,n,t);f.z=c(p.z,v.z,u.z,x.z,k,n,t);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;bthis.points.length-2?m:m+1;e[3]=m>this.points.length-3?m:m+2;v=this.points[e[0]];u=this.points[e[1]]; +t=this.points[e[2]];x=this.points[e[3]];n=k*k;p=k*n;f.x=c(v.x,u.x,t.x,x.x,k,n,p);f.y=c(v.y,u.y,t.y,x.y,k,n,p);f.z=c(v.z,u.z,t.z,x.z,k,n,p);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b* -255)+","+z+")"),w.fillRect(Math.floor(P.getX()),Math.floor(P.getY()),Math.floor(P.getWidth()),Math.floor(P.getHeight()))),P.empty())};this.render=function(b,t){function p(b){var e,c,f,k=b.lights;qa.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b>1,v=ha.height>>1,m=k.scale.x*u,t=k.scale.y*x,o=m*p,n=t*v,ea.set(b.x-o,b.y-n,b.x+o,b.y+n),L.instersects(ea)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-t),w.translate(-p,-v),w.drawImage(ha,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,ea.set(b.x-o,b.y-n,b.x+o,b.y+n),L.instersects(ea)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n), -m.program(w),w.restore()))}function C(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)w.lineWidth=H=b;b=m.linecap;if(O!=b)w.lineCap=O=b;b=m.linejoin;if(S!=b)w.lineJoin=S=b;f(m.color.getContextStyle());w.stroke();ea.inflate(m.linewidth*2)}}function z(b,f,k,h,n,u,ha,p,w){m.data.vertices+=3;m.data.faces++;c(p.opacity);e(p.blending); -U=b.positionScreen.x;V=b.positionScreen.y;R=f.positionScreen.x;o=f.positionScreen.y;pa=k.positionScreen.x;T=k.positionScreen.y;E(U,V,R,o,pa,T);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ta=ha.uvs[0],$a(U,V,R,o,pa,T,ta[h].u,ta[h].v,ta[n].u,ta[n].v,ta[u].u,ta[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=t.matrixWorldInverse,oa.copy(ha.vertexNormalsWorld[0]),ra=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+ -0.5,wa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ha.vertexNormalsWorld[1]),Ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,za=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ha.vertexNormalsWorld[2]),Aa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ea=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,$a(U,V,R,o,pa,T,ra,wa,Ca,za,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&& -!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ta=ha.uvs[0],$a(U,V,R,o,pa,T,ta[h].u,ta[h].v,ta[n].u,ta[n].v,ta[u].u,ta[u].v,p.map)),e(THREE.SubtractiveBlending)),$?!p.wireframe&&p.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3?(fa.r=Y.r=ma.r=qa.r,fa.g=Y.g=ma.g=qa.g,fa.b=Y.b=ma.b=qa.b,v(w,ha.v1.positionWorld,ha.vertexNormalsWorld[0],fa),v(w,ha.v2.positionWorld,ha.vertexNormalsWorld[1],Y),v(w,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ma),ia.r=(Y.r+ma.r)*0.5,ia.g=(Y.g+ma.g)* -0.5,ia.b=(Y.b+ma.b)*0.5,ua=Xa(fa,Y,ma,ia),Sa(U,V,R,o,pa,T,0,0,1,0,0,1,ua)):(ga.r=qa.r,ga.g=qa.g,ga.b=qa.b,v(w,ha.centroidWorld,ha.normalWorld,ga),Z.r=Math.max(0,Math.min(p.color.r*ga.r,1)),Z.g=Math.max(0,Math.min(p.color.g*ga.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ga.b,1)),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)N= -t.near,ca=t.far,fa.r=fa.g=fa.b=1-Na(b.positionScreen.z,N,ca),Y.r=Y.g=Y.b=1-Na(f.positionScreen.z,N,ca),ma.r=ma.g=ma.b=1-Na(k.positionScreen.z,N,ca),ia.r=(Y.r+ma.r)*0.5,ia.g=(Y.g+ma.g)*0.5,ia.b=(Y.b+ma.b)*0.5,ua=Xa(fa,Y,ma,ia),Sa(U,V,R,o,pa,T,0,0,1,0,0,1,ua);else if(p instanceof THREE.MeshNormalMaterial)Z.r=Ta(ha.normalWorld.x),Z.g=Ta(ha.normalWorld.y),Z.b=Ta(ha.normalWorld.z),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)}function A(b,f,k,h,n,p,ha,u,w){m.data.vertices+= -4;m.data.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)z(b,f,h,0,1,3,ha,u,w),z(n,k,p,1,2,3,ha,u,w);else if(U=b.positionScreen.x,V=b.positionScreen.y,R=f.positionScreen.x,o=f.positionScreen.y,pa=k.positionScreen.x,T=k.positionScreen.y,la=h.positionScreen.x,aa=h.positionScreen.y,na=n.positionScreen.x,ja=n.positionScreen.y,ka=p.positionScreen.x,da=p.positionScreen.y,u instanceof THREE.MeshBasicMaterial)G(U,V,R,o,pa,T,la,aa),u.wireframe?Ia(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin): -Ja(u.color);else if(u instanceof THREE.MeshLambertMaterial)$?!u.wireframe&&u.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4?(fa.r=Y.r=ma.r=ia.r=qa.r,fa.g=Y.g=ma.g=ia.g=qa.g,fa.b=Y.b=ma.b=ia.b=qa.b,v(w,ha.v1.positionWorld,ha.vertexNormalsWorld[0],fa),v(w,ha.v2.positionWorld,ha.vertexNormalsWorld[1],Y),v(w,ha.v4.positionWorld,ha.vertexNormalsWorld[3],ma),v(w,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ia),ua=Xa(fa,Y,ma,ia),E(U,V,R,o,la,aa),Sa(U,V,R,o,la,aa,0,0,1,0,0,1,ua),E(na,ja,pa, -T,ka,da),Sa(na,ja,pa,T,ka,da,1,0,1,1,0,1,ua)):(ga.r=qa.r,ga.g=qa.g,ga.b=qa.b,v(w,ha.centroidWorld,ha.normalWorld,ga),Z.r=Math.max(0,Math.min(u.color.r*ga.r,1)),Z.g=Math.max(0,Math.min(u.color.g*ga.g,1)),Z.b=Math.max(0,Math.min(u.color.b*ga.b,1)),G(U,V,R,o,pa,T,la,aa),u.wireframe?Ia(Z,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ja(Z)):(G(U,V,R,o,pa,T,la,aa),u.wireframe?Ia(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ja(u.color));else if(u instanceof THREE.MeshNormalMaterial)Z.r= -Ta(ha.normalWorld.x),Z.g=Ta(ha.normalWorld.y),Z.b=Ta(ha.normalWorld.z),G(U,V,R,o,pa,T,la,aa),u.wireframe?Ia(Z,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ja(Z);else if(u instanceof THREE.MeshDepthMaterial)N=t.near,ca=t.far,fa.r=fa.g=fa.b=1-Na(b.positionScreen.z,N,ca),Y.r=Y.g=Y.b=1-Na(f.positionScreen.z,N,ca),ma.r=ma.g=ma.b=1-Na(h.positionScreen.z,N,ca),ia.r=ia.g=ia.b=1-Na(k.positionScreen.z,N,ca),ua=Xa(fa,Y,ma,ia),E(U,V,R,o,la,aa),Sa(U,V,R,o,la,aa,0,0,1,0,0,1,ua),E(na,ja,pa,T,ka, -da),Sa(na,ja,pa,T,ka,da,1,0,1,1,0,1,ua)}function E(b,e,c,f,k,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,k,h,m,o){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,e);w.closePath()}function Ia(b,e,c,k){if(H!=e)w.lineWidth=H=e;if(O!=c)w.lineCap=O=c;if(S!=k)w.lineJoin=S=k;f(b.getContextStyle());w.stroke();ea.inflate(e*2)}function Ja(b){h(b.getContextStyle());w.fill()}function $a(b,e,c,f,k,m,o,n,u,p,ha,t,v){if(v.image.width!= -0){if(v.needsUpdate==!0||sa[v.id]==void 0){var x=v.wrapS==THREE.RepeatWrapping,Ma=v.wrapT==THREE.RepeatWrapping;sa[v.id]=w.createPattern(v.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");v.needsUpdate=!1}h(sa[v.id]);var x=v.offset.x/v.repeat.x,Ma=v.offset.y/v.repeat.y,L=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+x)*L,n=(n+Ma)*v,u=(u+x)*L,p=(p+Ma)*v,ha=(ha+x)*L,t=(t+Ma)*v;c-=b;f-=e;k-=b;m-=e;u-=o;p-=n;ha-=o;t-=n;x=1/(u*t-ha*p);v=(t*c-p*k)*x;p=(t*f-p*m)* -x;c=(u*k-ha*c)*x;f=(u*m-ha*f)*x;b=b-v*o-c*n;e=e-p*o-f*n;w.save();w.transform(v,p,c,f,b,e);w.fill();w.restore()}}function Sa(b,e,c,f,k,h,m,o,n,u,p,ha,t){var v,x;v=t.width-1;x=t.height-1;m*=v;o*=x;n*=v;u*=x;p*=v;ha*=x;c-=b;f-=e;k-=b;h-=e;n-=m;u-=o;p-=m;ha-=o;x=1/(n*ha-p*u);v=(ha*c-u*k)*x;u=(ha*f-u*h)*x;c=(n*k-p*c)*x;f=(n*h-p*f)*x;b=b-v*m-c*o;e=e-u*m-f*o;w.save();w.transform(v,u,c,f,b,e);w.clip();w.drawImage(t,0,0);w.restore()}function Xa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r* -255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),u=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);ha[0]=k<0?0:k>255?255:k;ha[1]=h<0?0:h>255?255:h;ha[2]=b<0?0:b>255?255:b;ha[4]=m<0?0:m>255?255:m;ha[5]=o<0?0:o>255?255:o;ha[6]=e<0?0:e>255?255:e;ha[8]=n<0?0:n>255?255:n;ha[9]=u<0?0:u>255?255:u;ha[10]=c<0?0:c>255?255:c;ha[12]=p<0?0:p>255?255:p;ha[13]=t<0?0:t>255?255:t;ha[14]=f<0?0:f>255?255:f;X.putImageData(Ba,0,0);Wa.drawImage(Fa,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b* -b*(3-2*b)}function Ta(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,cb,va,Da,La,Ua,Za,F;this.autoClear?this.clear():w.setTransform(1,0,0,-1,u,x);m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,t,this.sortElements);($=b.lights.length>0)&&p(b);Ya=0;for(cb=k.length;Ya0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(W.sub(h.position,e.centroidWorld),W.normalize(),m=e.normalWorld.dot(W)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,u){m.data.vertices+=3;m.data.faces++;U=f(V++);U.setAttribute("d", -"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(O.r=S.r,O.g=S.g,O.b=S.b,b(u,o,O),H.r=Math.max(0,Math.min(n.color.r*O.r,1)),H.g=Math.max(0,Math.min(n.color.g*O.g,1)),H.b=Math.max(0,Math.min(n.color.b*O.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear), -H.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(U)}function e(e,c,k,o,n,u,p){m.data.vertices+=4;m.data.faces++; -U=f(V++);U.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?H.copy(u.color):u instanceof THREE.MeshLambertMaterial?G?(O.r=S.r,O.g=S.g,O.b=S.b,b(p,n,O),H.r=Math.max(0,Math.min(u.color.r*O.r,1)),H.g=Math.max(0,Math.min(u.color.g*O.g,1)),H.b=Math.max(0,Math.min(u.color.b*O.b,1))):H.copy(u.color):u instanceof -THREE.MeshDepthMaterial?(K=1-u.__2near/(u.__farPlusNear-n.z*u.__farMinusNear),H.setRGB(K,K,K)):u instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));u.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+ -u.opacity);t.appendChild(U)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,v,u,x,w,y,z,A,C=new THREE.Rectangle,E=new THREE.Rectangle,G=!1,H=new THREE.Color(16777215),O=new THREE.Color(16777215),S=new THREE.Color(0),J=new THREE.Color(0), -I=new THREE.Color(0),K,W=new THREE.Vector3,D=[],M=[],U,V,R,o=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){p=b;v=e;u=p/2;x=v/2;t.setAttribute("viewBox",-u+" "+-x+" "+p+" "+v);t.setAttribute("width",p);t.setAttribute("height",v);C.set(-u,-x,u,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render= -function(b,f){var h,p,v,H,O,D,K,fa;this.autoClear&&this.clear();m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,f,this.sortElements);R=V=0;if(G=b.lights.length>0){K=b.lights;S.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(p=K.length;h0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b* +255)+","+z+")"),w.fillRect(Math.floor(P.getX()),Math.floor(P.getY()),Math.floor(P.getWidth()),Math.floor(P.getHeight()))),P.empty())};this.render=function(b,v){function p(b){var e,c,f,k=b.lights;qa.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b>1,u=ca.height>>1,m=k.scale.x*t,v=k.scale.y*x,o=m*p,n=v*u,fa.set(b.x-o,b.y-n,b.x+o,b.y+n),L.instersects(fa)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-v),w.translate(-p,-u),w.drawImage(ca,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,fa.set(b.x-o,b.y-n,b.x+o,b.y+n),L.instersects(fa)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n), +m.program(w),w.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)w.lineWidth=H=b;b=m.linecap;if(N!=b)w.lineCap=N=b;b=m.linejoin;if(S!=b)w.lineJoin=S=b;f(m.color.getContextStyle());w.stroke();fa.inflate(m.linewidth*2)}}function A(b,f,k,h,n,t,ca,p,w){m.data.vertices+=3;m.data.faces++;c(p.opacity);e(p.blending); +U=b.positionScreen.x;V=b.positionScreen.y;R=f.positionScreen.x;o=f.positionScreen.y;pa=k.positionScreen.x;T=k.positionScreen.y;E(U,V,R,o,pa,T);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ta=ca.uvs[0],$a(U,V,R,o,pa,T,ta[h].u,ta[h].v,ta[n].u,ta[n].v,ta[t].u,ta[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,oa.copy(ca.vertexNormalsWorld[0]),ra=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+ +0.5,wa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ca.vertexNormalsWorld[1]),Ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,za=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ca.vertexNormalsWorld[2]),Aa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ea=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,$a(U,V,R,o,pa,T,ra,wa,Ca,za,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&& +!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ta=ca.uvs[0],$a(U,V,R,o,pa,T,ta[h].u,ta[h].v,ta[n].u,ta[n].v,ta[t].u,ta[t].v,p.map)),e(THREE.SubtractiveBlending)),$?!p.wireframe&&p.shading==THREE.SmoothShading&&ca.vertexNormalsWorld.length==3?(ga.r=Y.r=ma.r=qa.r,ga.g=Y.g=ma.g=qa.g,ga.b=Y.b=ma.b=qa.b,u(w,ca.v1.positionWorld,ca.vertexNormalsWorld[0],ga),u(w,ca.v2.positionWorld,ca.vertexNormalsWorld[1],Y),u(w,ca.v3.positionWorld,ca.vertexNormalsWorld[2],ma),ia.r=(Y.r+ma.r)*0.5,ia.g=(Y.g+ma.g)* +0.5,ia.b=(Y.b+ma.b)*0.5,ua=Xa(ga,Y,ma,ia),Sa(U,V,R,o,pa,T,0,0,1,0,0,1,ua)):(ha.r=qa.r,ha.g=qa.g,ha.b=qa.b,u(w,ca.centroidWorld,ca.normalWorld,ha),Z.r=Math.max(0,Math.min(p.color.r*ha.r,1)),Z.g=Math.max(0,Math.min(p.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ha.b,1)),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)O= +v.near,da=v.far,ga.r=ga.g=ga.b=1-Na(b.positionScreen.z,O,da),Y.r=Y.g=Y.b=1-Na(f.positionScreen.z,O,da),ma.r=ma.g=ma.b=1-Na(k.positionScreen.z,O,da),ia.r=(Y.r+ma.r)*0.5,ia.g=(Y.g+ma.g)*0.5,ia.b=(Y.b+ma.b)*0.5,ua=Xa(ga,Y,ma,ia),Sa(U,V,R,o,pa,T,0,0,1,0,0,1,ua);else if(p instanceof THREE.MeshNormalMaterial)Z.r=Ta(ca.normalWorld.x),Z.g=Ta(ca.normalWorld.y),Z.b=Ta(ca.normalWorld.z),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)}function C(b,f,k,h,n,p,t,ca,w){m.data.vertices+= +4;m.data.faces++;c(ca.opacity);e(ca.blending);if(ca.map||ca.envMap)A(b,f,h,0,1,3,t,ca,w),A(n,k,p,1,2,3,t,ca,w);else if(U=b.positionScreen.x,V=b.positionScreen.y,R=f.positionScreen.x,o=f.positionScreen.y,pa=k.positionScreen.x,T=k.positionScreen.y,la=h.positionScreen.x,aa=h.positionScreen.y,na=n.positionScreen.x,ja=n.positionScreen.y,ka=p.positionScreen.x,ea=p.positionScreen.y,ca instanceof THREE.MeshBasicMaterial)G(U,V,R,o,pa,T,la,aa),ca.wireframe?Ia(ca.color,ca.wireframeLinewidth,ca.wireframeLinecap, +ca.wireframeLinejoin):Ja(ca.color);else if(ca instanceof THREE.MeshLambertMaterial)$?!ca.wireframe&&ca.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(ga.r=Y.r=ma.r=ia.r=qa.r,ga.g=Y.g=ma.g=ia.g=qa.g,ga.b=Y.b=ma.b=ia.b=qa.b,u(w,t.v1.positionWorld,t.vertexNormalsWorld[0],ga),u(w,t.v2.positionWorld,t.vertexNormalsWorld[1],Y),u(w,t.v4.positionWorld,t.vertexNormalsWorld[3],ma),u(w,t.v3.positionWorld,t.vertexNormalsWorld[2],ia),ua=Xa(ga,Y,ma,ia),E(U,V,R,o,la,aa),Sa(U,V,R,o,la,aa,0,0,1,0,0, +1,ua),E(na,ja,pa,T,ka,ea),Sa(na,ja,pa,T,ka,ea,1,0,1,1,0,1,ua)):(ha.r=qa.r,ha.g=qa.g,ha.b=qa.b,u(w,t.centroidWorld,t.normalWorld,ha),Z.r=Math.max(0,Math.min(ca.color.r*ha.r,1)),Z.g=Math.max(0,Math.min(ca.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(ca.color.b*ha.b,1)),G(U,V,R,o,pa,T,la,aa),ca.wireframe?Ia(Z,ca.wireframeLinewidth,ca.wireframeLinecap,ca.wireframeLinejoin):Ja(Z)):(G(U,V,R,o,pa,T,la,aa),ca.wireframe?Ia(ca.color,ca.wireframeLinewidth,ca.wireframeLinecap,ca.wireframeLinejoin):Ja(ca.color)); +else if(ca instanceof THREE.MeshNormalMaterial)Z.r=Ta(t.normalWorld.x),Z.g=Ta(t.normalWorld.y),Z.b=Ta(t.normalWorld.z),G(U,V,R,o,pa,T,la,aa),ca.wireframe?Ia(Z,ca.wireframeLinewidth,ca.wireframeLinecap,ca.wireframeLinejoin):Ja(Z);else if(ca instanceof THREE.MeshDepthMaterial)O=v.near,da=v.far,ga.r=ga.g=ga.b=1-Na(b.positionScreen.z,O,da),Y.r=Y.g=Y.b=1-Na(f.positionScreen.z,O,da),ma.r=ma.g=ma.b=1-Na(h.positionScreen.z,O,da),ia.r=ia.g=ia.b=1-Na(k.positionScreen.z,O,da),ua=Xa(ga,Y,ma,ia),E(U,V,R,o,la, +aa),Sa(U,V,R,o,la,aa,0,0,1,0,0,1,ua),E(na,ja,pa,T,ka,ea),Sa(na,ja,pa,T,ka,ea,1,0,1,1,0,1,ua)}function E(b,e,c,f,k,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,k,h,m,o){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,e);w.closePath()}function Ia(b,e,c,k){if(H!=e)w.lineWidth=H=e;if(N!=c)w.lineCap=N=c;if(S!=k)w.lineJoin=S=k;f(b.getContextStyle());w.stroke();fa.inflate(e*2)}function Ja(b){h(b.getContextStyle()); +w.fill()}function $a(b,e,c,f,k,m,o,n,ca,p,t,v,u){if(u.image.width!=0){if(u.needsUpdate==!0||sa[u.id]==void 0){var x=u.wrapS==THREE.RepeatWrapping,Ma=u.wrapT==THREE.RepeatWrapping;sa[u.id]=w.createPattern(u.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");u.needsUpdate=!1}h(sa[u.id]);var x=u.offset.x/u.repeat.x,Ma=u.offset.y/u.repeat.y,L=(u.image.width-1)*u.repeat.x,u=(u.image.height-1)*u.repeat.y,o=(o+x)*L,n=(n+Ma)*u,ca=(ca+x)*L,p=(p+Ma)*u,t=(t+x)*L,v=(v+Ma)*u;c-=b;f-=e;k-=b; +m-=e;ca-=o;p-=n;t-=o;v-=n;x=1/(ca*v-t*p);u=(v*c-p*k)*x;p=(v*f-p*m)*x;c=(ca*k-t*c)*x;f=(ca*m-t*f)*x;b=b-u*o-c*n;e=e-p*o-f*n;w.save();w.transform(u,p,c,f,b,e);w.fill();w.restore()}}function Sa(b,e,c,f,k,h,m,o,n,ca,p,t,v){var u,x;u=v.width-1;x=v.height-1;m*=u;o*=x;n*=u;ca*=x;p*=u;t*=x;c-=b;f-=e;k-=b;h-=e;n-=m;ca-=o;p-=m;t-=o;x=1/(n*t-p*ca);u=(t*c-ca*k)*x;ca=(t*f-ca*h)*x;c=(n*k-p*c)*x;f=(n*h-p*f)*x;b=b-u*m-c*o;e=e-ca*m-f*o;w.save();w.transform(u,ca,c,f,b,e);w.clip();w.drawImage(v,0,0);w.restore()}function Xa(b, +e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),t=~~(f.r*255),v=~~(f.g*255),f=~~(f.b*255);ca[0]=k<0?0:k>255?255:k;ca[1]=h<0?0:h>255?255:h;ca[2]=b<0?0:b>255?255:b;ca[4]=m<0?0:m>255?255:m;ca[5]=o<0?0:o>255?255:o;ca[6]=e<0?0:e>255?255:e;ca[8]=n<0?0:n>255?255:n;ca[9]=p<0?0:p>255?255:p;ca[10]=c<0?0:c>255?255:c;ca[12]=t<0?0:t>255?255:t;ca[13]=v<0?0:v>255?255:v;ca[14]=f<0?0:f>255?255:f;X.putImageData(Ba,0,0);Wa.drawImage(Fa, +0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,cb,va,Da,La,Ua,Za,F;this.autoClear?this.clear():w.setTransform(1,0,0,-1,t,x);m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,v,this.sortElements);($=b.lights.length>0)&&p(b);Ya=0;for(cb=k.length;Ya0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(W.sub(h.position,e.centroidWorld),W.normalize(),m=e.normalWorld.dot(W)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,t){m.data.vertices+=3;m.data.faces++;U=f(V++);U.setAttribute("d", +"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(N.r=S.r,N.g=S.g,N.b=S.b,b(t,o,N),H.r=Math.max(0,Math.min(n.color.r*N.r,1)),H.g=Math.max(0,Math.min(n.color.g*N.g,1)),H.b=Math.max(0,Math.min(n.color.b*N.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear), +H.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(U)}function e(e,c,k,o,n,t,v){m.data.vertices+=4;m.data.faces++; +U=f(V++);U.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?H.copy(t.color):t instanceof THREE.MeshLambertMaterial?G?(N.r=S.r,N.g=S.g,N.b=S.b,b(v,n,N),H.r=Math.max(0,Math.min(t.color.r*N.r,1)),H.g=Math.max(0,Math.min(t.color.g*N.g,1)),H.b=Math.max(0,Math.min(t.color.b*N.b,1))):H.copy(t.color):t instanceof +THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),H.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+ +t.opacity);p.appendChild(U)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,u,t,x,w,y,z,A,C=new THREE.Rectangle,E=new THREE.Rectangle,G=!1,H=new THREE.Color(16777215),N=new THREE.Color(16777215),S=new THREE.Color(0),J=new THREE.Color(0), +I=new THREE.Color(0),K,W=new THREE.Vector3,D=[],M=[],U,V,R,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){v=b;u=e;t=v/2;x=u/2;p.setAttribute("viewBox",-t+" "+-x+" "+v+" "+u);p.setAttribute("width",v);p.setAttribute("height",u);C.set(-t,-x,t,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render= +function(b,f){var h,v,u,H,N,D,K,ga;this.autoClear&&this.clear();m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,f,this.sortElements);R=V=0;if(G=b.lights.length>0){K=b.lights;S.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(v=K.length;h=0)o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(b.position, -3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=h.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,p=m.morphTargetForcedOrder,u=m.morphTargetInfluences;ft&&(v=w,t=u[v]);o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=t;p[v]=1;t= --1;f++}}h.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(h.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>=0&&(c=k.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglNormalBuffer), -o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)): -o.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinWeightsBuffer), -o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(h.wireframe?(o.lineWidth(h.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer),o.drawElements(o.LINES,k.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),o.drawElements(o.TRIANGLES,k.__webglFaceCount,o.UNSIGNED_SHORT,0)),R.data.vertices+=k.__webglFaceCount,R.data.faces+=k.__webglFaceCount/3,R.data.drawCalls++):m instanceof THREE.Line?(m=m.type==THREE.LineStrip? -o.LINE_STRIP:o.LINES,o.lineWidth(h.linewidth),o.drawArrays(m,0,k.__webglLineCount),R.data.drawCalls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,k.__webglParticleCount),R.data.drawCalls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,k.__webglVertexCount),R.data.drawCalls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer), -o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,k,h,m,n,p,u,t,v,w,x=b.count*3;for(w=0;w=0)o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position, +3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,p=m.morphTargetForcedOrder,t=m.morphTargetInfluences;fv&&(u=w,v=t[u]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=v;p[u]=1;v= +-1;f++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=0&&(c=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer), +o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)): +o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer), +o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),R.data.vertices+=h.__webglFaceCount,R.data.faces+=h.__webglFaceCount/3,R.data.drawCalls++):m instanceof THREE.Line?(m=m.type==THREE.LineStrip? +o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),R.data.drawCalls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),R.data.drawCalls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),R.data.drawCalls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer), +o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,p,t,v,u,w,x=b.count*3;for(w=0;w=0;c--)b[c].object==e&&b.splice(c,1)}function O(b){function e(b){var k=[];c=0;for(f=b.length;c65535&&(u[o].counter+=1,p=u[o].hash+"_"+u[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[], -materials:n,vertices:0,numMorphTargets:t})),b.geometryGroups[p].faces.push(k),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[v])}function S(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=ja){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO, +w++}}function A(b,e){var c,f,h;c=X.attributes;var k=X.uniforms,m=O/sa,n,p=[],t=sa*0.5,v=O*0.5,u=!0;o.useProgram(X.program);T=X.program;ka=ja=-1;Ba||(o.enableVertexAttribArray(X.attributes.position),o.enableVertexAttribArray(X.attributes.uv),Ba=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix, +!1,ta);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[], +materials:n,vertices:0,numMorphTargets:v})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])}function S(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=ja){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO, o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ja=b}}function I(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,V(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,V(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,V(e.magFilter)),o.texParameteri(b, o.TEXTURE_MIN_FILTER,V(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,U(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,U(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D, 0,V(b.format),b.image.width,b.image.height,0,V(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);I(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function W(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer(); b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);I(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),I(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type), null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height), o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER, -null)}var f,k;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,k=f=0):(e=null,c=sa,b=N,f=ma,k=ia);e!=la&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,k,c,b),la=e)}function D(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))} +null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=sa,b=O,f=ma,h=ia);e!=la&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),la=e)}function D(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))} function M(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(e),null;return c}function U(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT; case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE; case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var R=this,o,pa=[],T=null, -la=null,aa=null,na=null,ja=null,ka=null,da=null,Z=null,fa=null,Y=null,ma=0,ia=0,sa=0,N=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,ta=new Float32Array(16),ra=new Float32Array(16),wa=new THREE.Vector4,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},za=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0? -b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,P=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ea=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=za;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear= -1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var $,ga=[],b=THREE.ShaderLib.depthRGBA,qa=THREE.UniformsUtils.clone(b.uniforms),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:qa}),xa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:qa,morphTargets:!0});ya._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=za.getContext("experimental-webgl", +la=null,aa=null,na=null,ja=null,ka=null,ea=null,Z=null,ga=null,Y=null,ma=0,ia=0,sa=0,O=0,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,ta=new Float32Array(16),ra=new Float32Array(16),wa=new THREE.Vector4,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},za=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0? +b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,P=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),fa=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=za;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear= +1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var $,ha=[],b=THREE.ShaderLib.depthRGBA,qa=THREE.UniformsUtils.clone(b.uniforms),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:qa}),xa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:qa,morphTargets:!0});ya._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=za.getContext("experimental-webgl", {antialias:L,stencil:Aa,preserveDrawingBuffer:Ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(oa){console.error(oa)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD); -o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(P.r,P.g,P.b,ea);this.context=o;var Fa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);i=0;X.vertices[i++]=-1;X.vertices[i++]=-1;X.vertices[i++]=0;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=0;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=0;i=X.vertices[i++]= +o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(P.r,P.g,P.b,fa);this.context=o;var Fa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);i=0;X.vertices[i++]=-1;X.vertices[i++]=-1;X.vertices[i++]=0;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=0;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=0;i=X.vertices[i++]= 0;X.faces[i++]=0;X.faces[i++]=1;X.faces[i++]=2;X.faces[i++]=0;X.faces[i++]=2;X.faces[i++]=3;X.vertexBuffer=o.createBuffer();X.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,X.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,X.faces,o.STATIC_DRAW);X.program=o.createProgram();o.attachShader(X.program,M("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(X.program,M("vertex", THREE.ShaderLib.sprite.vertexShader));o.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=o.getAttribLocation(X.program,"position");X.attributes.uv=o.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=o.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=o.getUniformLocation(X.program,"uvScale");X.uniforms.rotation=o.getUniformLocation(X.program,"rotation");X.uniforms.scale=o.getUniformLocation(X.program,"scale");X.uniforms.alignment=o.getUniformLocation(X.program, "alignment");X.uniforms.map=o.getUniformLocation(X.program,"map");X.uniforms.opacity=o.getUniformLocation(X.program,"opacity");X.uniforms.useScreenCoordinates=o.getUniformLocation(X.program,"useScreenCoordinates");X.uniforms.affectedByDistance=o.getUniformLocation(X.program,"affectedByDistance");X.uniforms.screenPosition=o.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=o.getUniformLocation(X.program,"modelViewMatrix");X.uniforms.projectionMatrix=o.getUniformLocation(X.program, -"projectionMatrix");var Ba=!1;this.setSize=function(b,e){za.width=b;za.height=e;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(b,e,c,f){ma=b;ia=e;sa=c;N=f;o.viewport(ma,ia,sa,N)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){P.setHex(b);ea=e;o.clearColor(P.r,P.g,P.b,ea)};this.setClearColor=function(b,e){P.copy(b);ea=e;o.clearColor(P.r,P.g,P.b,ea)}; +"projectionMatrix");var Ba=!1;this.setSize=function(b,e){za.width=b;za.height=e;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(b,e,c,f){ma=b;ia=e;sa=c;O=f;o.viewport(ma,ia,sa,O)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){P.setHex(b);fa=e;o.clearColor(P.r,P.g,P.b,fa)};this.setClearColor=function(b,e){P.copy(b);fa=e;o.clearColor(P.r,P.g,P.b,fa)}; this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer); o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer);o.deleteBuffer(e.__webglSkinIndicesBuffer);o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex), -o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(k in b.attributes)w[k]!==void 0&&w[k]>=0&&o.enableVertexAttribArray(w[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,e,f){W(b);b=0;c&&(b|=o.COLOR_BUFFER_BIT);e&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);o.clear(b)};this.render=function(b,c,o,u){var L,ea,P,E,G,H,$,N,I=b.lights, -qa=b.fog;this.shadowMapEnabled&&z(b,c);R.data.vertices=0;R.data.faces=0;R.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ra);c.projectionMatrix.flattenToArray(ta);ua.multiply(c.projectionMatrix,c.matrixWorldInverse);p(ua);this.initWebGLObjects(b);W(o);(this.autoClear||u)&&this.clear();G=b.__webglObjects.length;for(u=0;u=0;u--)if(L=b.__webglObjects[u],L.render){$=L.object;N=L.buffer;P=L.opaque;m($);for(L=0;L=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){W(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);o.clear(b)};this.render=function(b,c,o,t){var L,fa,P,E,G,H,$,O,I=b.lights, +qa=b.fog;this.shadowMapEnabled&&z(b,c);R.data.vertices=0;R.data.faces=0;R.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ra);c.projectionMatrix.flattenToArray(ta);ua.multiply(c.projectionMatrix,c.matrixWorldInverse);v(ua);this.initWebGLObjects(b);W(o);(this.autoClear||t)&&this.clear();G=b.__webglObjects.length;for(t=0;t=0;t--)if(L=b.__webglObjects[t],L.render){$=L.object;O=L.buffer;P=L.opaque;m($);for(L=0;L0||x.faceVertexUvs.length>0)n.__uvArray=new Float32Array(p*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(u.geometry.skinWeights.length&& -u.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray=new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(y*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(ea*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];x=0;for(L=n.numMorphTargets;x0||x.faceVertexUvs.length>0)n.__uvArray=new Float32Array(p*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(t.geometry.skinWeights.length&& +t.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray=new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(y*3+(t.geometry.edgeFaces?t.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(fa*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];x=0;for(L=n.numMorphTargets;x=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Aa&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,na,z));Ea&&wa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,Z,z));Ba&&ta>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER, -ma,z));Ba&&fa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Ca&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,sa,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,la,z));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ra,z),o.bindBuffer(o.ARRAY_BUFFER, -p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ia,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,da,z));y&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets= -!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;G(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=ea=y=y=void 0;x=k.vertices;u=k.colors;t=x.length;p=u.length;w=k.__vertexArray;z=k.__colorArray;L=k.__dirtyColors;if(k.__dirtyVertices){for(y=0;y0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Ca&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,sa,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,la,z));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ra,z),o.bindBuffer(o.ARRAY_BUFFER, +p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ia,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ea,z));y&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets= +!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=fa=y=y=void 0;x=h.vertices;t=h.colors;v=x.length;p=t.length;w=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;y1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=k;c.v=m;return c}, clamp:function(b,c,e){return be?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,h=e?c.geometry:c,m=b.vertices,k=h.vertices,n=b.faces,t=h.faces,p=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var v=0,u=k.length;v1&&(f=1-f,h=1-h);m=1-f-h;k.copy(b);k.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);k.addSelf(n);n.copy(e);n.multiplyScalar(m);k.addSelf(n);return k},randomPointInFace:function(b, +THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,h=e?c.geometry:c,m=b.vertices,k=h.vertices,n=b.faces,p=h.faces,v=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var u=0,t=k.length;u1&&(f=1-f,h=1-h);m=1-f-h;k.copy(b);k.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);k.addSelf(n);n.copy(e);n.multiplyScalar(m);k.addSelf(n);return k},randomPointInFace:function(b, c,e){var f,h,m;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,m=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,m);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;m=c.vertices[b.c].position;var c=c.vertices[b.d].position,k;e?b._area1&&b._area2?(e=b._area1,k=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),k=THREE.GeometryUtils.triangleArea(h,m,c),b._area1=e,b._area2=k):(e=THREE.GeometryUtils.triangleArea(f, -h,c),k=THREE.GeometryUtils.triangleArea(h,m,c));return THREE.GeometryUtils.random()*(e+k)b?e(c,k-1):p[k]b?e(c,h-1):v[h]0)n=f-1;else{n=f;break}f=n;if(e[f]==m)return f/(h-1);k=e[f];return e=(f+(m-k)/(e[f+1]-k))/(h-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)}; +THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,h=e.length,m;m=c?c:b*e[h-1];time=Date.now();for(var k=0,n=h-1,p;k<=n;)if(f=Math.floor(k+(n-k)/2),p=e[f]-m,p<0)k=f+1;else if(p>0)n=f-1;else{n=f;break}f=n;if(e[f]==m)return f/(h-1);k=e[f];return e=(f+(m-k)/(e[f+1]-k))/(h-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)}; THREE.Curve.prototype.getTangent=function(b){var c=b-1.0E-4;b+=1.0E-4;c<0&&(c=0);b>1&&(b=1);var c=this.getPoint(c),b=this.getPoint(b),e=new THREE.Vector2;e.sub(b,c);return e.unit()};THREE.LineCurve=function(b,c){b instanceof THREE.Vector2?(this.v1=b,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(b,c,e,f){this.constructor(new THREE.Vector2(b,c),new THREE.Vector2(e,f))};THREE.LineCurve.prototype=new THREE.Curve; THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(b).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(b){return this.getPoint(b)};THREE.LineCurve.prototype.getTangent=function(){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.normalize();return b}; THREE.QuadraticBezierCurve=function(b,c,e){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),b=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),e=new THREE.Vector2(f[4],f[5]);this.v0=b;this.v1=c;this.v2=e};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; @@ -377,47 +377,47 @@ THREE.Curve.create=function(b,c){b.prototype=new THREE.Curve;b.prototype.constru THREE.QuadraticBezierCurve3=THREE.Curve.create(function(b,c,e){this.v0=b;this.v1=c;this.v2=e},function(b){var c,e;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);e=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);b=THREE.Shape.Utils.b2(b,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,e,b)});THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(b){this.curves.push(b)}; THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};THREE.CurvePath.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.getCurveLengths(),b=0;b=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};THREE.CurvePath.prototype.getLength=function(){var b=this.getCurveLengths();return b[b.length-1]}; THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var b=[],c=0,e,f=this.curves.length;for(e=0;ec)c=m.x;else if(m.xe)e=m.y;else if(m.yc)c=m.x;else if(m.xe)e=m.y;else if(m.y0?(k=e[e.length-1],w=k.x,y=k.y):(k=this.actions[f-1].args,w=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b2(z,w,u,n),z=THREE.Shape.Utils.b2(z,y,x, -t),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=m[4];t=m[5];u=m[0];x=m[1];p=m[2];v=m[3];e.length>0?(k=e[e.length-1],w=k.x,y=k.y):(k=this.actions[f-1].args,w=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b3(z,w,u,p,n),z=THREE.Shape.Utils.b3(z,y,x,v,t),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];z=b*m[0].length;k=k.concat(m[0]);m=new THREE.SplineCurve(k); -for(k=1;k<=z;k++)e.push(m.getPointAt(k/z));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=m[0];t=m[1];p=m[2];u=m[3];z=m[4];x=!!m[5];v=k[k.length-2];w=k[k.length-1];k.length==0&&(v=w=0);y=z-u;var A=b*2;for(k=1;k<=A;k++)z=k/A,x||(z=1-z),z=u+z*y,m=v+n+p*Math.cos(z),z=w+t+p*Math.sin(z),e.push(new THREE.Vector2(m,z))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; -THREE.Path.prototype.nltransform=function(b,c,e,f,h,m){var k=this.getPoints(),n,t,p,v,u;n=0;for(t=k.length;n0?(k=e[e.length-1],w=k.x,y=k.y):(k=this.actions[f-1].args,w=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b2(z,w,t,n),z=THREE.Shape.Utils.b2(z,y,x, +p),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=m[4];p=m[5];t=m[0];x=m[1];v=m[2];u=m[3];e.length>0?(k=e[e.length-1],w=k.x,y=k.y):(k=this.actions[f-1].args,w=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b3(z,w,t,v,n),z=THREE.Shape.Utils.b3(z,y,x,u,p),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];z=b*m[0].length;k=k.concat(m[0]);m=new THREE.SplineCurve(k); +for(k=1;k<=z;k++)e.push(m.getPointAt(k/z));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=m[0];p=m[1];v=m[2];t=m[3];z=m[4];x=!!m[5];u=k[k.length-2];w=k[k.length-1];k.length==0&&(u=w=0);y=z-t;var A=b*2;for(k=1;k<=A;k++)z=k/A,x||(z=1-z),z=t+z*y,m=u+n+v*Math.cos(z),z=w+p+v*Math.sin(z),e.push(new THREE.Vector2(m,z))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; +THREE.Path.prototype.nltransform=function(b,c,e,f,h,m){var k=this.getPoints(),n,p,v,u,t;n=0;for(p=k.length;n=0?n-1:e.length-1;m=k-1>=0?k-1:p.length-1;var z=[p[k],e[n],e[h]];u=THREE.FontUtils.Triangulate.area(z);var A=[p[k],p[m],e[n]];x=THREE.FontUtils.Triangulate.area(A);w=n;v=k;n+=1;k+=-1;n<0&&(n+=e.length);n%= -e.length;k<0&&(k+=p.length);k%=p.length;h=n-1>=0?n-1:e.length-1;m=k-1>=0?k-1:p.length-1;z=[p[k],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);A=[p[k],p[m],e[n]];A=THREE.FontUtils.Triangulate.area(A);u+x>z+A&&(n=w,k=v,n<0&&(n+=e.length),n%=e.length,k<0&&(k+=p.length),k%=p.length,h=n-1>=0?n-1:e.length-1,m=k-1>=0?k-1:p.length-1);u=e.slice(0,n);x=e.slice(n);w=p.slice(k);v=p.slice(0,k);m=[p[k],p[m],e[n]];y.push([p[k],e[n],e[h]]);y.push(m);e=u.concat(w).concat(v).concat(x)}return{shape:e,isolatedPts:y, -allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),m,k,n,t,p={};m=0;for(k=f.length;m=0?n-1:e.length-1;m=k-1>=0?k-1:v.length-1;var z=[v[k],e[n],e[h]];t=THREE.FontUtils.Triangulate.area(z);var A=[v[k],v[m],e[n]];x=THREE.FontUtils.Triangulate.area(A);w=n;u=k;n+=1;k+=-1;n<0&&(n+=e.length);n%= +e.length;k<0&&(k+=v.length);k%=v.length;h=n-1>=0?n-1:e.length-1;m=k-1>=0?k-1:v.length-1;z=[v[k],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);A=[v[k],v[m],e[n]];A=THREE.FontUtils.Triangulate.area(A);t+x>z+A&&(n=w,k=u,n<0&&(n+=e.length),n%=e.length,k<0&&(k+=v.length),k%=v.length,h=n-1>=0?n-1:e.length-1,m=k-1>=0?k-1:v.length-1);t=e.slice(0,n);x=e.slice(n);w=v.slice(k);u=v.slice(0,k);m=[v[k],v[m],e[n]];y.push([v[k],e[n],e[h]]);y.push(m);e=t.concat(w).concat(u).concat(x)}return{shape:e,isolatedPts:y, +allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),m,k,n,p,v={};m=0;for(k=f.length;m1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,m,k,n,p,v,u=this.data.JIT.hierarchy,t,x;this.currentTime+=b*this.timeScale;x=this.currentTime;t=this.currentTime%=this.data.length;v=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,y=this.hierarchy.length;w1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= this.getPrevKeyWith("pos",w,k.index-1).pos,this.points[1]=h,this.points[2]=m,this.points[3]=this.getNextKeyWith("pos",w,n.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== -"rot")THREE.Quaternion.slerp(h,m,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f}}if(this.JITCompile&&v[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;wb.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];t=b[e[2]];p=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],t[0],p[0],h,e,k);f[1]=this.interpolate(m[1],n[1],t[1],p[1],h,e,k);f[2]=this.interpolate(m[2],n[2],t[2],p[2],h,e,k);return f}; +"rot")THREE.Quaternion.slerp(h,m,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f}}if(this.JITCompile&&u[0][v]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;wb.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];p=b[e[2]];v=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],p[0],v[0],h,e,k);f[1]=this.interpolate(m[1],n[1],p[1],v[1],h,e,k);f[2]=this.interpolate(m[2],n[2],p[2],v[2],h,e,k);return f}; THREE.Animation.prototype.interpolate=function(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]}; THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed= @@ -430,14 +430,14 @@ this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown 1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)* Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)}; THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))}; -THREE.PathCamera=function(b){function c(b,e,c,f){var k={name:c,fps:0.6,length:f,hierarchy:[]},h,m=e.getControlPointsArray(),n=e.getLength(),t=m.length,E=0;h=t-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:m[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h=0?f:f+h;f=this.verticalAngleMap.srcRange;k=this.verticalAngleMap.dstRange;var n=k[1]-k[0];this.phi= TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/n)*n+k[0];f=this.horizontalAngleMap.srcRange;k=this.horizontalAngleMap.dstRange;n=k[1]-k[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/n)*n+k[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX= -b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),k=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),t=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(t,k);b.position.set(0,10,0);this.animation= +b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),k=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),p=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(p,k);b.position.set(0,10,0);this.animation= c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove), !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward= @@ -450,189 +450,189 @@ this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVec this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!= document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this, this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype; -THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Matrix4,t=!1,p=1,v=0,u=0,x=0,w=0,y=0,z=window.innerWidth/2,A=window.innerHeight/2;this.update= -function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*w),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(v>0||this.autoForward&&!(v<0)?1:v));this.translateX(b*u);this.translateY(b*x);t&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); +THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Matrix4,p=!1,v=1,u=0,t=0,x=0,w=0,y=0,z=window.innerWidth/2,A=window.innerHeight/2;this.update= +function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*w),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(u>0||this.autoForward&&!(u<0)?1:u));this.translateX(b*t);this.translateY(b*x);p&&(this.roll+=this.rollSpeed*this.delta*v);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); else if(this.forward.y1?e.normalize():e.z=Math.sqrt(1-f*f);h=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(h).setLength(e.x));f.addSelf(h.setLength(e.z));return f}; -this.rotateCamera=function(){var b=Math.acos(m.dot(k)/m.length()/k.length());if(b){var c=(new THREE.Vector3).cross(m,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(h);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?m=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(t.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b),this.staticMoving?n=t:n.y+=(t.y-n.y)*this.dynamicDampingFactor)}; -this.panCamera=function(){var b=v.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?p=v:p.addSelf(b.sub(v,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), +this.rotateCamera=function(){var b=Math.acos(m.dot(k)/m.length()/k.length());if(b){var c=(new THREE.Vector3).cross(m,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(h);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?m=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(p.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b),this.staticMoving?n=p:n.y+=(p.y-n.y)*this.dynamicDampingFactor)}; +this.panCamera=function(){var b=u.clone().subSelf(v);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?v=u:v.addSelf(b.sub(u,v).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), h.lengthSq()0){e=new THREE.Vector3(0,0,-1);k(0,0,-v-(m||0));for(t=b;t0){c=new THREE.Vector3(0,0,1);k(0,0,v+(h||0));for(t=b+b/2;t<2*b;t++)n.faces.push(new THREE.Face4(2*b+1,(2*t-2*b+2)%b+b,(2*t-2*b+1)%b+b,(2*t-2*b)%b+b,[c,c,c,c]))}t= -0;for(b=this.faces.length;t0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;nb&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(D=b.length;--D>=0;){ka=D;da=D-1;da<0&&(da=b.length- -1);for(var c=0,e=w+v*2,c=0;c=0;U--){V=U/v;R=t*(1-V);V=p*Math.sin(V*Math.PI/2);D=0;for(M=E.length;Db&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(D=b.length;--D>=0;){ka=D;ea=D-1;ea<0&&(ea=b.length- +1);for(var c=0,e=w+u*2,c=0;c=0;U--){V=U/u;R=p*(1-V);V=v*Math.sin(V*Math.PI/2);D=0;for(M=E.length;D0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,n,x)))-1);p.push(v)}c.push(p)}for(var w,y,z,h=c.length,e=0;e0)for(f=0;f1&&(w= -this.vertices[k].position.clone(),y=this.vertices[t].position.clone(),z=this.vertices[p].position.clone(),w.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(k,t,p,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([v,u,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,m=Math.max(3,c||8),k=Math.max(2,e||6),c=[],e=0;e0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,n,x)))-1);v.push(u)}c.push(v)}for(var w,y,z,h=c.length,e=0;e0)for(f=0;f1&&(w= +this.vertices[k].position.clone(),y=this.vertices[p].position.clone(),z=this.vertices[v].position.clone(),w.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(k,p,v,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([u,t,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c= -this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[],b=0;b0)for(p=0;p2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}t=p;h<=t&&(t=0);p=t+1;h<=p&&(p=0);v=p+1;h<=v&&(v=0);var x;a:{x=b;var w=t,y=p,z=v,A=h,C=k,E=void 0,G=void 0,H=void 0, -O=void 0,S=void 0,J=void 0,I=void 0,K=void 0,W=void 0,G=x[C[w]].x,H=x[C[w]].y,O=x[C[y]].x,S=x[C[y]].y,J=x[C[z]].x,I=x[C[z]].y;if(1.0E-10>(O-G)*(I-H)-(S-H)*(J-G))x=!1;else{for(E=0;E=0&&U>=0&&R>=0){x=!1; -break a}}x=!0}}if(x){m.push([b[k[t]],b[k[p]],b[k[v]]]);n.push([k[t],k[p],k[v]]);t=p;for(v=p+1;v0)for(v=0;v2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}p=v;h<=p&&(p=0);v=p+1;h<=v&&(v=0);u=v+1;h<=u&&(u=0);var x;a:{x=b;var w=p,y=v,z=u,A=h,C=k,E=void 0,G=void 0,H=void 0, +N=void 0,S=void 0,J=void 0,I=void 0,K=void 0,W=void 0,G=x[C[w]].x,H=x[C[w]].y,N=x[C[y]].x,S=x[C[y]].y,J=x[C[z]].x,I=x[C[z]].y;if(1.0E-10>(N-G)*(I-H)-(S-H)*(J-G))x=!1;else{for(E=0;E=0&&U>=0&&R>=0){x=!1; +break a}}x=!0}}if(x){m.push([b[k[p]],b[k[v]],b[k[u]]]);n.push([k[p],k[v],k[u]]);p=v;for(u=v+1;u>7)-127;f|=(h&127)<<16|k<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=v(b,c),f=v(b,c+1),k=v(b,c+2);return(v(b,c+3)<<24)+(k<<16)+(f<<8)+e}function t(b,c){var e=v(b,c);return(v(b,c+1)<<8)+e}function p(b,c){var e=v(b,c);return e>127?e-256:e}function v(b,c){return b.charCodeAt(c)&255}function u(c){var e, -f,k;e=h(b,c);f=h(b,c+S);k=h(b,c+J);c=t(b,c+I);C.faces.push(new THREE.Face3(e,f,k,null,null,C.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+S);k=h(b,c+J);m=t(b,c+I);o=h(b,c+K);p=h(b,c+W);c=h(b,c+D);m=C.materials[m];var u=H[p*3],v=H[p*3+1];p=H[p*3+2];var w=H[c*3],L=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(u,v,p),new THREE.Vector3(w,L,c)],null,m))}function w(c){var e,f,k,m;e=h(b,c);f=h(b,c+M);k=h(b,c+U);m=h(b, -c+V);c=t(b,c+R);C.faces.push(new THREE.Face4(e,f,k,m,null,null,C.materials[c]))}function y(c){var e,f,k,m,p,u,v,w;e=h(b,c);f=h(b,c+M);k=h(b,c+U);m=h(b,c+V);p=t(b,c+R);u=h(b,c+o);v=h(b,c+pa);w=h(b,c+T);c=h(b,c+la);p=C.materials[p];var x=H[v*3],L=H[v*3+1];v=H[v*3+2];var P=H[w*3],ea=H[w*3+1];w=H[w*3+2];var y=H[c*3],z=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(H[u*3],H[u*3+1],H[u*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(P,ea,w),new THREE.Vector3(y,z,c)],null,p))} -function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+na);c=O[e*2];m=O[e*2+1];e=O[f*2];var o=C.faceVertexUvs[0];f=O[f*2+1];var p=O[k*2];k=O[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ja);k=h(b,c+ka);m=h(b,c+da);c=O[e*2];o=O[e*2+1];e=O[f*2];p=O[f*2+1];f=O[k*2];var t=C.faceVertexUvs[0];k=O[k*2+1];var u=O[m*2];m=O[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f, -k));v.push(new THREE.UV(u,m));t.push(v)}var C=this,E=0,G,H=[],O=[],S,J,I,K,W,D,M,U,V,R,o,pa,T,la,aa,na,ja,ka,da,Z,fa,Y,ma,ia,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);G={signature:b.substr(E,8),header_bytes:v(b,E+8),vertex_coordinate_bytes:v(b,E+9),normal_coordinate_bytes:v(b,E+10),uv_coordinate_bytes:v(b,E+11),vertex_index_bytes:v(b,E+12),normal_index_bytes:v(b,E+13),uv_index_bytes:v(b,E+14),material_index_bytes:v(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b, +THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=u(b,c),h=u(b,c+1),k=u(b,c+2),m=u(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=u(b,c),f=u(b,c+1),k=u(b,c+2);return(u(b,c+3)<<24)+(k<<16)+(f<<8)+e}function p(b,c){var e=u(b,c);return(u(b,c+1)<<8)+e}function v(b,c){var e=u(b,c);return e>127?e-256:e}function u(b,c){return b.charCodeAt(c)&255}function t(c){var e, +f,k;e=h(b,c);f=h(b,c+S);k=h(b,c+J);c=p(b,c+I);C.faces.push(new THREE.Face3(e,f,k,null,null,C.materials[c]))}function x(c){var e,f,k,m,o,t;e=h(b,c);f=h(b,c+S);k=h(b,c+J);m=p(b,c+I);o=h(b,c+K);t=h(b,c+W);c=h(b,c+D);m=C.materials[m];var v=H[t*3],u=H[t*3+1];t=H[t*3+2];var w=H[c*3],L=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(v,u,t),new THREE.Vector3(w,L,c)],null,m))}function w(c){var e,f,k,m;e=h(b,c);f=h(b,c+M);k=h(b,c+U);m=h(b, +c+V);c=p(b,c+R);C.faces.push(new THREE.Face4(e,f,k,m,null,null,C.materials[c]))}function y(c){var e,f,k,m,t,v,u,w;e=h(b,c);f=h(b,c+M);k=h(b,c+U);m=h(b,c+V);t=p(b,c+R);v=h(b,c+o);u=h(b,c+pa);w=h(b,c+T);c=h(b,c+la);t=C.materials[t];var x=H[u*3],L=H[u*3+1];u=H[u*3+2];var P=H[w*3],fa=H[w*3+1];w=H[w*3+2];var y=H[c*3],z=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(H[v*3],H[v*3+1],H[v*3+2]),new THREE.Vector3(x,L,u),new THREE.Vector3(P,fa,w),new THREE.Vector3(y,z,c)],null,t))} +function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+na);c=N[e*2];m=N[e*2+1];e=N[f*2];var o=C.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ja);k=h(b,c+ka);m=h(b,c+ea);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[k*2];var t=C.faceVertexUvs[0];k=N[k*2+1];var v=N[m*2];m=N[m*2+1];var u=[];u.push(new THREE.UV(c,o));u.push(new THREE.UV(e,p));u.push(new THREE.UV(f, +k));u.push(new THREE.UV(v,m));t.push(u)}var C=this,E=0,G,H=[],N=[],S,J,I,K,W,D,M,U,V,R,o,pa,T,la,aa,na,ja,ka,ea,Z,ga,Y,ma,ia,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);G={signature:b.substr(E,8),header_bytes:u(b,E+8),vertex_coordinate_bytes:u(b,E+9),normal_coordinate_bytes:u(b,E+10),uv_coordinate_bytes:u(b,E+11),vertex_index_bytes:u(b,E+12),normal_index_bytes:u(b,E+13),uv_index_bytes:u(b,E+14),material_index_bytes:u(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b, E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=G.header_bytes;S=G.vertex_index_bytes;J=G.vertex_index_bytes*2;I=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;W=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;D=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;M=G.vertex_index_bytes; -U=G.vertex_index_bytes*2;V=G.vertex_index_bytes*3;R=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;pa=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;T=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;la=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;aa=G.uv_index_bytes;na=G.uv_index_bytes*2;ja=G.uv_index_bytes;ka=G.uv_index_bytes*2;da=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;sa=G.vertex_index_bytes* -4+G.material_index_bytes;Z=G.ntri_flat*c;fa=G.ntri_smooth*(c+G.normal_index_bytes*3);Y=G.ntri_flat_uv*(c+G.uv_index_bytes*3);ma=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ia=G.nquad_flat*sa;c=G.nquad_smooth*(sa+G.normal_index_bytes*4);sa=G.nquad_flat_uv*(sa+G.uv_index_bytes*4);E+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[]; -for(y=0;y1){o=new THREE.MeshFaceMaterial;for(j=0;j=0){y=o.invBindMatrices[u];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[]; +for(y=0;y1){o=new THREE.MeshFaceMaterial;for(j=0;j1?e[1].substr(0,c):"0";e[1].length=0,m=k.indexOf("(")>=0,n;if(h)f=k.split("."),k=f.shift(),f.shift();else if(m){n=k.split("(");k=n.shift();for(f=0;fc){t=p.output[o];break}m=t!==void 0?t instanceof THREE.Matrix4?m.multiply(m,t):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14, -c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b1?e[1].substr(0,c):"0";e[1].length=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;fc){v=p.output[o];break}m=v!==void 0?v instanceof THREE.Matrix4?m.multiply(m,v):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14, +c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};u.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b3)for(k=2;k3)for(h=2;h0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b={},c=this.transparency!==void 0&& +1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=(new I).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=Z.evaluate(".//dae:float",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b={},c=this.transparency!==void 0&& this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];if(f instanceof I)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ia[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ca+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex()); break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};W.prototype.parse=function(b){for(var c=0;c=0,f=b.indexOf("(")>=0,k,h;if(e)c=b.split("."),b=c.shift(),h=c.shift();else if(f){k=b.split("(");b=k.shift();for(c=0;c=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c1&&(W=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(S,W);object.name=w;object.position.set(G[0],G[1],G[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;T.scene.addObject(object);T.objects[w]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b)); if(E.castsShadow)b=new THREE.ShadowVolume(S),T.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}}else G=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(G[0],G[1],G[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], -s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,T.scene.addObject(object),T.objects[w]=object,T.empties[w]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function t(b){return function(c){T.geometries[b]=c;n();V-=1;e.onLoadComplete();v()}}function p(b){return function(c){T.geometries[b]=c}}function v(){e.callbackProgress({totalModels:o,totalTextures:pa,loadedModels:o-V,loadedTextures:pa-R},T);e.onLoadProgress();V==0&&R==0&&c(T)} -var u,x,w,y,z,A,C,E,G,H,O,S,J,I,K,W,D,M,U,V,R,o,pa,T;M=b.data;K=new THREE.BinaryLoader;U=new THREE.JSONLoader;R=V=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in M.objects)if(E=M.objects[w],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;H=M.transform.rotation;var la=M.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);H&&T.scene.rotation.set(H[0], -H[1],H[2]);la&&T.scene.scale.set(la[0],la[1],la[2]);(b||H||la)&&T.scene.updateMatrix()}b=function(){R-=1;v();e.onLoadComplete()};for(z in M.cameras){H=M.cameras[z];if(H.type=="perspective")J=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);G=H.position;H=H.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(H[0],H[1],H[2]);T.cameras[z]=J}for(y in M.lights)z=M.lights[y], +s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,T.scene.addObject(object),T.objects[w]=object,T.empties[w]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function p(b){return function(c){T.geometries[b]=c;n();V-=1;e.onLoadComplete();u()}}function v(b){return function(c){T.geometries[b]=c}}function u(){e.callbackProgress({totalModels:o,totalTextures:pa,loadedModels:o-V,loadedTextures:pa-R},T);e.onLoadProgress();V==0&&R==0&&c(T)} +var t,x,w,y,z,A,C,E,G,H,N,S,J,I,K,W,D,M,U,V,R,o,pa,T;M=b.data;K=new THREE.BinaryLoader;U=new THREE.JSONLoader;R=V=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in M.objects)if(E=M.objects[w],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;H=M.transform.rotation;var la=M.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);H&&T.scene.rotation.set(H[0], +H[1],H[2]);la&&T.scene.scale.set(la[0],la[1],la[2]);(b||H||la)&&T.scene.updateMatrix()}b=function(){R-=1;u();e.onLoadComplete()};for(z in M.cameras){H=M.cameras[z];if(H.type=="perspective")J=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);G=H.position;H=H.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(H[0],H[1],H[2]);T.cameras[z]=J}for(y in M.lights)z=M.lights[y], J=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(G=z.direction,D=new THREE.DirectionalLight(J,H),D.position.set(G[0],G[1],G[2]),D.position.normalize()):z.type=="point"?(G=z.position,d=z.distance,D=new THREE.PointLight(J,H,d),D.position.set(G[0],G[1],G[2])):z.type=="ambient"&&(D=new THREE.AmbientLight(J)),T.scene.addLight(D),T.lights[y]=D;for(A in M.fogs)y=M.fogs[A],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0, -y.density)),H=y.color,I.color.setRGB(H[0],H[1],H[2]),T.fogs[A]=I;if(T.cameras&&M.defaults.camera)T.currentCamera=T.cameras[M.defaults.camera];if(T.fogs&&M.defaults.fog)T.scene.fog=T.fogs[M.defaults.fog];H=M.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(H[0],H[1],H[2]);T.bgColorAlpha=M.defaults.bgalpha;for(u in M.geometries)if(A=M.geometries[u],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(u in M.geometries)A=M.geometries[u],A.type=="cube"?(S=new THREE.CubeGeometry(A.width, -A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),T.geometries[u]=S):A.type=="plane"?(S=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),T.geometries[u]=S):A.type=="sphere"?(S=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),T.geometries[u]=S):A.type=="cylinder"?(S=new THREE.CylinderGeometry(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset),T.geometries[u]=S):A.type=="torus"?(S=new THREE.TorusGeometry(A.radius, -A.tube,A.segmentsR,A.segmentsT),T.geometries[u]=S):A.type=="icosahedron"?(S=new THREE.IcosahedronGeometry(A.subdivisions),T.geometries[u]=S):A.type=="bin_mesh"?K.load({model:f(A.url,M.urlBaseType),callback:t(u)}):A.type=="ascii_mesh"?U.load({model:f(A.url,M.urlBaseType),callback:t(u)}):A.type=="embedded_mesh"&&(A=M.embeds[A.id])&&U.createModel(A,p(u),"");for(C in M.textures)if(u=M.textures[C],u.url instanceof Array){R+=u.url.length;for(K=0;K=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var m=0,k=0;k>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h=this.maxCount-3&&n(this)};this.begin=function(){this.count=0; -this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(t=this.size-1);var x=Math.floor(p-n);x<1&&(x=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var w=Math.floor(v-n);w<1&&(w=1);n=Math.floor(v+n);n>this.size-1&&(n=this.size- -1);for(var y,z,A,C,E,G;u0&&(this.field[A+y]+=C)}}};this.addPlaneX=function(b,c){var h,m,k,n,t,p=this.size,v=this.yd,u=this.zd,x=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(h=0;h0)for(m=0;mv&&(y=v);for(m=0;m0){t=m*u;for(h=0;hsize&&(dist=size);for(k=0;k0){t=zd*k;for(m=0;m=this.maxCount-3&&n(this)};this.begin=function(){this.count=0; +this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(p=this.size-1);var x=Math.floor(v-n);x<1&&(x=1);v=Math.floor(v+n);v>this.size-1&&(v=this.size-1);var w=Math.floor(u-n);w<1&&(w=1);n=Math.floor(u+n);n>this.size-1&&(n=this.size- +1);for(var y,z,A,C,E,G;t0&&(this.field[A+y]+=C)}}};this.addPlaneX=function(b,c){var h,m,k,n,p,v=this.size,u=this.yd,t=this.zd,x=this.field,w=v*Math.sqrt(b/c);w>v&&(w=v);for(h=0;h0)for(m=0;mu&&(y=u);for(m=0;m0){p=m*t;for(h=0;hsize&&(dist=size);for(k=0;k0){p=zd*k;for(m=0;mm?this.hits.push(h):this.hits.unshift(h),m=f;return this.hits}; +THREE.Trident=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),e=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));e.position.x=100;e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280})); +this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));e.position.y=100;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));e.rotation.x=Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));e.position.z=100;e.rotation.x=Math.PI/2;this.add(e)};THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c}; +THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem; +THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,h,m=0;c=0;for(e=this.colliders.length;cm?this.hits.push(h):this.hits.unshift(h),m=f;return this.hits}; THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.distc.length)return null;return c[e]}; THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,m=0;m=n*h))return Number.MAX_VALUE;k/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(k);n.addSelf(b.origin);Math.abs(m.x)> +THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,m=0;m=n*h))return Number.MAX_VALUE;k/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(k);n.addSelf(b.origin);Math.abs(m.x)> Math.abs(m.y)?Math.abs(m.x)>Math.abs(m.z)?(b=n.y-c.y,m=e.y-c.y,h=f.y-c.y,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(m.y)>Math.abs(m.z)?(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y);c=m*f-e*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-n*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=m*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k}; THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f}; -THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,m=0,k=0,n=0,t=0,p=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,k=1);e.origin.yc.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y, -p=!1,n=1);e.origin.zc.max.z&&(m=c.max.z-e.origin.z,m/=e.direction.z,p=!1,t=1);if(p)return-1;p=0;h>f&&(p=1,f=h);m>f&&(p=2,f=m);switch(p){case 0:n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(kc.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z* -f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case 2:k=e.origin.x+e.direction.x*f;if(kc.max.x)return Number.MAX_VALUE;n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,t)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE}; +THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,m=0,k=0,n=0,p=0,v=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,v=!1,k=1);e.origin.yc.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y, +v=!1,n=1);e.origin.zc.max.z&&(m=c.max.z-e.origin.z,m/=e.direction.z,v=!1,p=1);if(v)return-1;v=0;h>f&&(v=1,f=h);m>f&&(v=2,f=m);switch(v){case 0:n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(kc.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z* +f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case 2:k=e.origin.x+e.direction.x*f;if(kc.max.x)return Number.MAX_VALUE;n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,p)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE}; THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c}; THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,t,p,v;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z= -2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); -var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(t!==e.aspect||p!==e.near||v!==e.fov){t=e.aspect;p=e.near;v=e.fov;var C=e.projectionMatrix.clone(),E=125/30*0.5,G=E*p/125,H=p*Math.tan(v*Math.PI/360),O;k.n14=E;n.n14=-E;E=-H*t+G;O=H*t+G;C.n11=2*p/(O-E);C.n13=(O+E)/(O-E);h.projectionMatrix=C.clone();E=-H*t-G;O=H*t-G;C.n11=2*p/(O-E); -C.n13=(O+E)/(O-E);m.projectionMatrix=C.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,u,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=p;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,y,w)}}; +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,p,v,u;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z= +2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); +var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||v!==e.near||u!==e.fov){p=e.aspect;v=e.near;u=e.fov;var C=e.projectionMatrix.clone(),E=125/30*0.5,G=E*v/125,H=v*Math.tan(u*Math.PI/360),N;k.n14=E;n.n14=-E;E=-H*p+G;N=H*p+G;C.n11=2*v/(N-E);C.n13=(N+E)/(N-E);h.projectionMatrix=C.clone();E=-H*p-G;N=H*p-G;C.n11=2*v/(N-E); +C.n13=(N+E)/(N-E);m.projectionMatrix=C.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=v;h.far=e.far;f.call(c,b,h,t,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=v;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,y,w)}}; if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,m,k=new THREE.Camera,n=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;m=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far; k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);n.projectionMatrix=k.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,m);f.call(c,b,k);this.setViewport(h,0,h,m);f.call(c,b,n,!1)}}; diff --git a/build/custom/ThreeCanvas.js b/build/custom/ThreeCanvas.js index 1aea771b..06f483b8 100644 --- a/build/custom/ThreeCanvas.js +++ b/build/custom/ThreeCanvas.js @@ -1,16 +1,16 @@ // ThreeCanvas.js r45dev - http://github.com/mrdoob/three.js -var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; +var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,g;if(c==0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),g=c*(1-b*f),b=c*(1-b*(1-f)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r= c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,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},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf: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},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this}, divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)}, equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}; -THREE.Vector3.prototype={constructor:THREE.Vector3,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},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},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},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){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)}, -dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},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){return this.set(this.y* -a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*a.y-this.y*a.x)},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()< -1.0E-4}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d||1}; +THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},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},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){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)}, +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){return this.set(this.y*a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*a.y-this.y*a.x)},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);this.y=Math.asin(a.n13); +Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};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={constructor:THREE.Vector4,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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w= a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; diff --git a/build/custom/ThreeDOM.js b/build/custom/ThreeDOM.js index 1f303c0f..ce5eab9f 100644 --- a/build/custom/ThreeDOM.js +++ b/build/custom/ThreeDOM.js @@ -1,16 +1,16 @@ // ThreeDOM.js r45dev - http://github.com/mrdoob/three.js -var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; +var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,g;if(c==0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),g=c*(1-b*e),b=c*(1-b*(1-e)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r= c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,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},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf: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},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this}, divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)}, equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}; -THREE.Vector3.prototype={constructor:THREE.Vector3,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},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},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},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){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)}, -dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},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){return this.set(this.y* -a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*a.y-this.y*a.x)},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()< -1.0E-4}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d||1}; +THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},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},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){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)}, +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){return this.set(this.y*a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*a.y-this.y*a.x)},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);this.y=Math.asin(a.n13); +Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};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={constructor:THREE.Vector4,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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w= a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index 05ab2880..5d38175d 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -1,18 +1,18 @@ // ThreeExtras.js r45dev - http://github.com/mrdoob/three.js -THREE.ColorUtils={adjustHSV:function(a,b,c,e){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.ColorUtils.clamp(g.h+b,0,1);g.s=THREE.ColorUtils.clamp(g.s+c,0,1);g.v=THREE.ColorUtils.clamp(g.v+e,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,g=a.b,h=Math.max(Math.max(c,e),g),f=Math.min(Math.min(c,e),g);if(f==h)f=c=0;else{var k=h-f,f=k/h,c=c==h?(e-g)/k:e==h?2+(g-c)/k:4+(c-e)/k;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=h;return b}, +THREE.ColorUtils={adjustHSV:function(a,b,c,e){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,h);h.h=THREE.ColorUtils.clamp(h.h+b,0,1);h.s=THREE.ColorUtils.clamp(h.s+c,0,1);h.v=THREE.ColorUtils.clamp(h.v+e,0,1);a.setHSV(h.h,h.s,h.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,h=a.b,g=Math.max(Math.max(c,e),h),f=Math.min(Math.min(c,e),h);if(f==g)f=c=0;else{var k=g-f,f=k/g,c=c==g?(e-h)/k:e==g?2+(h-c)/k:4+(c-e)/k;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;return b}, clamp:function(a,b,c){return ac?c:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,g=c?b.geometry:b,h=a.vertices,f=g.vertices,k=a.faces,l=g.faces,m=a.faceVertexUvs[0],g=g.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var n=0,o=f.length;n1&&(e=1-e,g=1-g);h=1-e-g;f.copy(a);f.multiplyScalar(e);k.copy(b);k.multiplyScalar(g);f.addSelf(k);k.copy(c);k.multiplyScalar(h);f.addSelf(k);return f},randomPointInFace:function(a, -b,c){var e,g,h;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,g=b.vertices[a.b].position,h=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,g,h);else if(a instanceof THREE.Face4){e=b.vertices[a.a].position;g=b.vertices[a.b].position;h=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(e,g,b),f=THREE.GeometryUtils.triangleArea(g,h,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(e, -g,b),f=THREE.GeometryUtils.triangleArea(g,h,b));return THREE.GeometryUtils.random()*(c+f)a?c(b,f-1):m[f]1&&(e=1-e,h=1-h);g=1-e-h;f.copy(a);f.multiplyScalar(e);k.copy(b);k.multiplyScalar(h);f.addSelf(k);k.copy(c);k.multiplyScalar(g);f.addSelf(k);return f},randomPointInFace:function(a, +b,c){var e,h,g;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,h=b.vertices[a.b].position,g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,h,g);else if(a instanceof THREE.Face4){e=b.vertices[a.a].position;h=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(e,h,b),f=THREE.GeometryUtils.triangleArea(h,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(e, +h,b),f=THREE.GeometryUtils.triangleArea(h,g,b));return THREE.GeometryUtils.random()*(c+f)a?c(b,f-1):m[f] 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"}, cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"}}}; THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c}; -THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,e=this.getPoint(0),g,h=0;b.push(0);for(g=1;g<=a;g++)c=this.getPoint(g/a),h+=c.distanceTo(e),b.push(h),e=c;return this.cacheArcLengths=b}; -THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),e=0,g=c.length,h;h=b?b:a*c[g-1];time=Date.now();for(var f=0,k=g-1,l;f<=k;)if(e=Math.floor(f+(k-f)/2),l=c[e]-h,l<0)f=e+1;else if(l>0)k=e-1;else{k=e;break}e=k;if(c[e]==h)return e/(g-1);f=c[e];return c=(e+(h-f)/(c[e+1]-f))/(g-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)}; +THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,e=this.getPoint(0),h,g=0;b.push(0);for(h=1;h<=a;h++)c=this.getPoint(h/a),g+=c.distanceTo(e),b.push(g),e=c;return this.cacheArcLengths=b}; +THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),e=0,h=c.length,g;g=b?b:a*c[h-1];time=Date.now();for(var f=0,k=h-1,l;f<=k;)if(e=Math.floor(f+(k-f)/2),l=c[e]-g,l<0)f=e+1;else if(l>0)k=e-1;else{k=e;break}e=k;if(c[e]==g)return e/(h-1);f=c[e];return c=(e+(g-f)/(c[e+1]-f))/(h-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)}; THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4;a+=1.0E-4;b<0&&(b=0);a>1&&(a=1);var b=this.getPoint(b),a=this.getPoint(a),c=new THREE.Vector2;c.sub(a,b);return c.unit()};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,b,c,e){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,e))};THREE.LineCurve.prototype=new THREE.Curve; THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a}; THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),b=new THREE.Vector2(e[2],e[3]),c=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b}; -THREE.CubicBezierCurve=function(a,b,c,e){if(!(b instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),a=new THREE.Vector2(g[0],g[1]),b=new THREE.Vector2(g[2],g[3]),c=new THREE.Vector2(g[4],g[5]),e=new THREE.Vector2(g[6],g[7]);this.v0=a;this.v1=b;this.v2=c;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; +THREE.CubicBezierCurve=function(a,b,c,e){if(!(b instanceof THREE.Vector2))var h=Array.prototype.slice.call(arguments),a=new THREE.Vector2(h[0],h[1]),b=new THREE.Vector2(h[2],h[3]),c=new THREE.Vector2(h[4],h[5]),e=new THREE.Vector2(h[6],h[7]);this.v0=a;this.v1=b;this.v2=c;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b}; THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve; -THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],e=this.points,g;g=(e.length-1)*a;a=Math.floor(g);g-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>e.length-2?a:a+1;c[3]=a>e.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(e[c[0]].x,e[c[1]].x,e[c[2]].x,e[c[3]].x,g);b.y=THREE.Curve.Utils.interpolate(e[c[0]].y,e[c[1]].y,e[c[2]].y,e[c[3]].y,g);return b};THREE.ArcCurve=function(a,b,c,e,g,h){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=e;this.aEndAngle=g;this.aClockwise=h}; +THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],e=this.points,h;h=(e.length-1)*a;a=Math.floor(h);h-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>e.length-2?a:a+1;c[3]=a>e.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(e[c[0]].x,e[c[1]].x,e[c[2]].x,e[c[3]].x,h);b.y=THREE.Curve.Utils.interpolate(e[c[0]].y,e[c[1]].y,e[c[2]].y,e[c[3]].y,h);return b};THREE.ArcCurve=function(a,b,c,e,h,g){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=e;this.aEndAngle=h;this.aClockwise=g}; THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*b;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))}; -THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,e){return 2*(1-a)*(c-b)+2*a*(e-c)},tangentCubicBezier:function(a,b,c,e,g){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*g},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,e,g){var a=(c-a)*0.5,e=(e-b)*0.5,h=g*g;return(2*b-2*c+a+e)*g*h+(-3*b+3*c-2*a-e)*h+a*g+b}}; +THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,e){return 2*(1-a)*(c-b)+2*a*(e-c)},tangentCubicBezier:function(a,b,c,e,h){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*h},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,e,h){var a=(c-a)*0.5,e=(e-b)*0.5,g=h*h;return(2*b-2*c+a+e)*h*g+(-3*b+3*c-2*a-e)*g+a*h+b}}; THREE.Curve.create=function(a,b){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=b;return a};THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.sub(v2,v1);b.multiplyScalar(a);b.addSelf(this.v1);return b}); THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)}; THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]}; THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,e=this.curves.length;for(c=0;cb)b=h.x;else if(h.xc)c=h.y;else if(h.yb)b=g.x;else if(g.xc)c=g.y;else if(g.y0?(f=c[c.length-1],t=f.x,x=f.y):(f=this.actions[e-1].args,t=f[f.length-2],x=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,h=THREE.Shape.Utils.b2(v,t,o,k),v=THREE.Shape.Utils.b2(v,x,p, -l),c.push(new THREE.Vector2(h,v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];p=h[1];m=h[2];n=h[3];c.length>0?(f=c[c.length-1],t=f.x,x=f.y):(f=this.actions[e-1].args,t=f[f.length-2],x=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,h=THREE.Shape.Utils.b3(v,t,o,m,k),v=THREE.Shape.Utils.b3(v,x,p,n,l),c.push(new THREE.Vector2(h,v));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];v=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f); -for(f=1;f<=v;f++)c.push(h.getPointAt(f/v));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];v=h[4];p=!!h[5];n=f[f.length-2];t=f[f.length-1];f.length==0&&(n=t=0);x=v-o;var u=a*2;for(f=1;f<=u;f++)v=f/u,p||(v=1-v),v=o+v*x,h=n+k+m*Math.cos(v),v=t+l+m*Math.sin(v),c.push(new THREE.Vector2(h,v))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)}; -THREE.Path.prototype.nltransform=function(a,b,c,e,g,h){var f=this.getPoints(),k,l,m,n,o;k=0;for(l=f.length;k0?(f=c[c.length-1],t=f.x,x=f.y):(f=this.actions[e-1].args,t=f[f.length-2],x=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,g=THREE.Shape.Utils.b2(v,t,o,k),v=THREE.Shape.Utils.b2(v,x,p, +l),c.push(new THREE.Vector2(g,v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=g[4];l=g[5];o=g[0];p=g[1];m=g[2];n=g[3];c.length>0?(f=c[c.length-1],t=f.x,x=f.y):(f=this.actions[e-1].args,t=f[f.length-2],x=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,g=THREE.Shape.Utils.b3(v,t,o,m,k),v=THREE.Shape.Utils.b3(v,x,p,n,l),c.push(new THREE.Vector2(g,v));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];v=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f); +for(f=1;f<=v;f++)c.push(g.getPointAt(f/v));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=g[0];l=g[1];m=g[2];o=g[3];v=g[4];p=!!g[5];n=f[f.length-2];t=f[f.length-1];f.length==0&&(n=t=0);x=v-o;var u=a*2;for(f=1;f<=u;f++)v=f/u,p||(v=1-v),v=o+v*x,g=n+k+m*Math.cos(v),v=t+l+m*Math.sin(v),c.push(new THREE.Vector2(g,v))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)}; +THREE.Path.prototype.nltransform=function(a,b,c,e,h,g){var f=this.getPoints(),k,l,m,n,o;k=0;for(l=f.length;k=0?k-1:c.length-1;h=f-1>=0?f-1:m.length-1;var v=[m[f],c[k],c[g]];o=THREE.FontUtils.Triangulate.area(v);var u=[m[f],m[h],c[k]];p=THREE.FontUtils.Triangulate.area(u);t=k;n=f;k+=1;f+=-1;k<0&&(k+=c.length);k%= -c.length;f<0&&(f+=m.length);f%=m.length;g=k-1>=0?k-1:c.length-1;h=f-1>=0?f-1:m.length-1;v=[m[f],c[k],c[g]];v=THREE.FontUtils.Triangulate.area(v);u=[m[f],m[h],c[k]];u=THREE.FontUtils.Triangulate.area(u);o+p>v+u&&(k=t,f=n,k<0&&(k+=c.length),k%=c.length,f<0&&(f+=m.length),f%=m.length,g=k-1>=0?k-1:c.length-1,h=f-1>=0?f-1:m.length-1);o=c.slice(0,k);p=c.slice(k);t=m.slice(f);n=m.slice(0,f);h=[m[f],m[h],c[k]];x.push([m[f],c[k],c[g]]);x.push(h);c=o.concat(t).concat(n).concat(p)}return{shape:c,isolatedPts:x, -allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,g=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,f,k,l,m={};h=0;for(f=e.length;h=0?k-1:c.length-1;g=f-1>=0?f-1:m.length-1;var v=[m[f],c[k],c[h]];o=THREE.FontUtils.Triangulate.area(v);var u=[m[f],m[g],c[k]];p=THREE.FontUtils.Triangulate.area(u);t=k;n=f;k+=1;f+=-1;k<0&&(k+=c.length);k%= +c.length;f<0&&(f+=m.length);f%=m.length;h=k-1>=0?k-1:c.length-1;g=f-1>=0?f-1:m.length-1;v=[m[f],c[k],c[h]];v=THREE.FontUtils.Triangulate.area(v);u=[m[f],m[g],c[k]];u=THREE.FontUtils.Triangulate.area(u);o+p>v+u&&(k=t,f=n,k<0&&(k+=c.length),k%=c.length,f<0&&(f+=m.length),f%=m.length,h=k-1>=0?k-1:c.length-1,g=f-1>=0?f-1:m.length-1);o=c.slice(0,k);p=c.slice(k);t=m.slice(f);n=m.slice(0,f);g=[m[f],m[g],c[k]];x.push([m[f],c[k],c[h]]);x.push(g);c=o.concat(t).concat(n).concat(p)}return{shape:c,isolatedPts:x, +allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,h=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,k,l,m={};g=0;for(f=e.length;g1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=g[0]+(h[0]-g[0])*e,c.y=g[1]+(h[1]-g[1])*e,c.z=g[2]+(h[2]-g[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",t,f.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos,e=e*0.33+0.33,g=this.interpolateCatmullRom(this.points,e),c.x=g[0],c.y=g[1],c.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c=== -"rot")THREE.Quaternion.slerp(g,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=g[0]+(h[0]-g[0])*e,c.y=g[1]+(h[1]-g[1])*e,c.z=g[2]+(h[2]-g[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;ta.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];k=a[c[1]];l=a[c[2]];m=a[c[3]];c=g*g;f=g*c;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,c,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,c,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,c,f);return e}; -THREE.Animation.prototype.interpolate=function(a,b,c,e,g,h,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*h+a*g+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=h[0]+(g[0]-h[0])*e,c.y=h[1]+(g[1]-h[1])*e,c.z=h[2]+(g[2]-h[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",t,f.index-1).pos,this.points[1]=h,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos,e=e*0.33+0.33,h=this.interpolateCatmullRom(this.points,e),c.x=h[0],c.y=h[1],c.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c=== +"rot")THREE.Quaternion.slerp(h,g,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=h[0]+(g[0]-h[0])*e,c.y=h[1]+(g[1]-h[1])*e,c.z=h[2]+(g[2]-h[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;ta.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];k=a[c[1]];l=a[c[2]];m=a[c[3]];c=h*h;f=h*c;e[0]=this.interpolate(g[0],k[0],l[0],m[0],h,c,f);e[1]=this.interpolate(g[1],k[1],l[1],m[1],h,c,f);e[2]=this.interpolate(g[2],k[2],l[2],m[2],h,c,f);return e}; +THREE.Animation.prototype.interpolate=function(a,b,c,e,h,g,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*g+a*h+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]}; THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed= a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!== @@ -86,16 +86,16 @@ void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.mouseX=a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward= !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update= function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.position.ythis.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var b=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.translateZ(b);this.moveLeft&&this.translateX(-b); -this.moveRight&&this.translateX(b);this.moveUp&&this.translateY(b);this.moveDown&&this.translateY(-b);b=this.tdiff*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a= -1;this.constrainVertical&&(a=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.z+100*Math.sin(this.phi)* +this.moveRight&&this.translateX(b);this.moveUp&&this.translateY(b);this.moveDown&&this.translateY(-b);b=this.tdiff*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,h=this.position;a.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=h.y+100*Math.cos(this.phi);a.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a= +1;this.constrainVertical&&(a=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;h=this.position;a.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=h.y+100*Math.cos(this.phi);a.z=h.z+100*Math.sin(this.phi)* Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)}; THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))}; -THREE.PathCamera=function(a){function b(a,c,b,e){var f={name:b,fps:0.6,length:e,hierarchy:[]},h,g=c.getControlPointsArray(),k=c.getLength(),l=g.length,y=0;h=l-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h=0?e:e+g;e=this.verticalAngleMap.srcRange;f=this.verticalAngleMap.dstRange;var k=f[1]-f[0];this.phi= +window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var h=Math.PI*2,g=Math.PI/180;this.update=function(a,c,b){var e,f;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;e=this.phi%h;this.phi=e>=0?e:e+h;e=this.verticalAngleMap.srcRange;f=this.verticalAngleMap.dstRange;var k=f[1]-f[0];this.phi= TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/k)*k+f[0];e=this.horizontalAngleMap.srcRange;f=this.horizontalAngleMap.dstRange;k=f[1]-f[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/k)*k+f[0];e=this.target.position;e.x=100*Math.sin(this.phi)*Math.cos(this.theta);e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,c,b)};this.onMouseMove=function(a){this.mouseX= a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),f=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),l=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(l,f);a.position.set(0,10,0);this.animation= b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,c){return function(){c.apply(a,arguments)}}(this,this.onMouseMove), @@ -104,195 +104,195 @@ THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,argument a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier= 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}}; this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break; -case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),g=b.size[0]/2,h=b.size[1]/2;this.moveState.yawLeft=-(a.clientX-b.offset[0]-g)/g;this.moveState.pitchDown=(a.clientY- -b.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,b=this.tdiff* +case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),h=b.size[0]/2,g=b.size[1]/2;this.moveState.yawLeft=-(a.clientX-b.offset[0]-h)/h;this.moveState.pitchDown=(a.clientY- +b.offset[1]-g)/g;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,b=this.tdiff* this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVector.y*a);this.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*b,this.rotationVector.y*b,this.rotationVector.z*b,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var a=this.moveState.forward|| this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!= document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,this.mouseup),!1);window.addEventListener("keydown",b(this,this.keydown),!1);window.addEventListener("keyup",b(this, this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype; -THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,k=new THREE.Matrix4,l=!1,m=1,n=0,o=0,p=0,t=0,x=0,v=window.innerWidth/2,u=window.innerHeight/2;this.update= +THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Vector3,k=new THREE.Matrix4,l=!1,m=1,n=0,o=0,p=0,t=0,x=0,v=window.innerWidth/2,u=window.innerHeight/2;this.update= function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*t),this.rotateVertically(a*x));a=this.delta*this.movementSpeed;this.translateZ(a*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(a*o);this.translateY(a*p);l&&(this.roll+=this.rollSpeed*this.delta*m);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); -else if(this.forward.y1?b.normalize():b.z=Math.sqrt(1-e*e);g=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(b.y);e.addSelf(this.up.clone().crossSelf(g).setLength(b.x));e.addSelf(g.setLength(b.z));return e}; -this.rotateCamera=function(){var a=Math.acos(h.dot(f)/h.length()/f.length());if(a){var c=(new THREE.Vector3).cross(h,f).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(g);b.multiplyVector3(this.up);b.multiplyVector3(f);this.staticMoving?h=f:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(l.y-k.y)*this.zoomSpeed;a!==1&&a>0&&(g.multiplyScalar(a),this.staticMoving?k=l:k.y+=(l.y-k.y)*this.dynamicDampingFactor)}; -this.panCamera=function(){var a=n.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(g.length()*this.panSpeed);var b=g.clone().crossSelf(this.up).setLength(a.x);b.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(b);this.target.position.addSelf(b);this.staticMoving?m=n:m.addSelf(a.sub(n,m).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), -g.lengthSq()1?b.normalize():b.z=Math.sqrt(1-e*e);h=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(b.y);e.addSelf(this.up.clone().crossSelf(h).setLength(b.x));e.addSelf(h.setLength(b.z));return e}; +this.rotateCamera=function(){var a=Math.acos(g.dot(f)/g.length()/f.length());if(a){var c=(new THREE.Vector3).cross(g,f).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(h);b.multiplyVector3(this.up);b.multiplyVector3(f);this.staticMoving?g=f:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(l.y-k.y)*this.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),this.staticMoving?k=l:k.y+=(l.y-k.y)*this.dynamicDampingFactor)}; +this.panCamera=function(){var a=n.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.up).setLength(a.x);c.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?m=n:m.addSelf(a.sub(n,m).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), +h.lengthSq()0){c=new THREE.Vector3(0,0,-1);f(0,0,-n-(h||0));for(l=a;l0){b=new THREE.Vector3(0,0,1);f(0,0,n+(g||0));for(l=a+a/2;l<2*a;l++)k.faces.push(new THREE.Face4(2*a+1,(2*l-2*a+2)%a+a,(2*l-2*a+1)%a+a,(2*l-2*a)%a+a,[b,b,b,b]))}l= -0;for(a=this.faces.length;la&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(B=a.length;--B>=0;){T=B;R=B-1;R<0&&(R=a.length- -1);for(var b=0,c=t+n*2,b=0;b0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;ka&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(h).addSelf(k).subSelf(a).clone()}function h(a){for(B=a.length;--B>=0;){T=B;R=B-1;R<0&&(R=a.length- +1);for(var c=0,b=t+n*2,c=0;c=0;J--){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=y.length;B=0;J--){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=y.length;B0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,p)))-1);m.push(n)}b.push(m)}for(var t,x,v,g=b.length,c=0;c0)for(e=0;e1&&(t= +THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,h=Math.PI,g=Math.max(3,b||8),f=Math.max(2,c||6),b=[],c=0;c0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,p)))-1);m.push(n)}b.push(m)}for(var t,x,v,h=b.length,c=0;c0)for(e=0;e1&&(t= this.vertices[f].position.clone(),x=this.vertices[l].position.clone(),v=this.vertices[m].position.clone(),t.normalize(),x.normalize(),v.normalize(),this.faces.push(new THREE.Face3(f,l,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,o,u]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry; THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var e=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,b){return(new TextPath(a,b)).toShapes()},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b= -this.getFace(),c=this.size/b.resolution,e=0,g=String(a).split(""),h=g.length,f=[],a=0;a0)for(m=0;m2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var p;a:{p=a;var t=l,x=m,v=n,u=g,z=f,y=void 0,w=void 0,A=void 0, -C=void 0,F=void 0,G=void 0,I=void 0,H=void 0,M=void 0,w=p[z[t]].x,A=p[z[t]].y,C=p[z[x]].x,F=p[z[x]].y,G=p[z[v]].x,I=p[z[v]].y;if(1.0E-10>(C-w)*(I-A)-(F-A)*(G-w))p=!1;else{for(y=0;y=0&&J>=0&&N>=0){p=!1;break a}}p=!0}}if(p){h.push([a[f[l]], -a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n0)for(m=0;m2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return g}l=m;h<=l&&(l=0);m=l+1;h<=m&&(m=0);n=m+1;h<=n&&(n=0);var p;a:{p=a;var t=l,x=m,v=n,u=h,z=f,y=void 0,w=void 0,A=void 0, +C=void 0,F=void 0,G=void 0,I=void 0,H=void 0,M=void 0,w=p[z[t]].x,A=p[z[t]].y,C=p[z[x]].x,F=p[z[x]].y,G=p[z[v]].x,I=p[z[v]].y;if(1.0E-10>(C-w)*(I-A)-(F-A)*(G-w))p=!1;else{for(y=0;y=0&&J>=0&&N>=0){p=!1;break a}}p=!0}}if(p){g.push([a[f[l]], +a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,b){var c=n(a,b),e=n(a,b+1),f=n(a,b+2);return(n(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=n(a,b);return(n(a,b+1)<<8)+c}function m(a,b){var c=n(a,b);return c>127?c-256:c}function n(a,b){return a.charCodeAt(b)&255}function o(b){var c, -e,f;c=g(a,b);e=g(a,b+F);f=g(a,b+G);b=l(a,b+I);z.faces.push(new THREE.Face3(c,e,f,null,null,z.materials[b]))}function p(b){var c,e,f,h,m,n;c=g(a,b);e=g(a,b+F);f=g(a,b+G);h=l(a,b+I);m=g(a,b+H);n=g(a,b+M);b=g(a,b+B);h=z.materials[h];var o=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[b*3],ha=A[b*3+1],b=A[b*3+2];z.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(o,p,n),new THREE.Vector3(t,ha,b)],null,h))}function t(b){var c,e,f,h;c=g(a,b);e=g(a,b+D);f=g(a,b+J);h= -g(a,b+L);b=l(a,b+N);z.faces.push(new THREE.Face4(c,e,f,h,null,null,z.materials[b]))}function x(b){var c,e,f,h,m,n,o,p;c=g(a,b);e=g(a,b+D);f=g(a,b+J);h=g(a,b+L);m=l(a,b+N);n=g(a,b+K);o=g(a,b+P);p=g(a,b+E);b=g(a,b+S);m=z.materials[m];var t=A[o*3],ha=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var v=A[b*3],u=A[b*3+1],b=A[b*3+2];z.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(t,ha,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(v,u,b)], -null,m))}function v(b){var c,e,f,h;c=g(a,b);e=g(a,b+O);f=g(a,b+U);b=C[c*2];h=C[c*2+1];c=C[e*2];var l=z.faceVertexUvs[0];e=C[e*2+1];var m=C[f*2];f=C[f*2+1];var n=[];n.push(new THREE.UV(b,h));n.push(new THREE.UV(c,e));n.push(new THREE.UV(m,f));l.push(n)}function u(b){var c,e,f,h,l,m;c=g(a,b);e=g(a,b+W);f=g(a,b+T);h=g(a,b+R);b=C[c*2];l=C[c*2+1];c=C[e*2];m=C[e*2+1];e=C[f*2];var n=z.faceVertexUvs[0];f=C[f*2+1];var o=C[h*2];h=C[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e, -f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,y=0,w,A=[],C=[],F,G,I,H,M,B,D,J,L,N,K,P,E,S,O,U,W,T,R,Q,Z,X,Y,$,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,b);w={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+ -8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=w.header_bytes;F=w.vertex_index_bytes;G=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;H=w.vertex_index_bytes*3+w.material_index_bytes;M=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;B=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;D=w.vertex_index_bytes; -J=w.vertex_index_bytes*2;L=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;E=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;S=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;U=w.uv_index_bytes*2;W=w.uv_index_bytes;T=w.uv_index_bytes*2;R=w.uv_index_bytes*3;b=w.vertex_index_bytes*3+w.material_index_bytes;V=w.vertex_index_bytes* -4+w.material_index_bytes;Q=w.ntri_flat*b;Z=w.ntri_smooth*(b+w.normal_index_bytes*3);X=w.ntri_flat_uv*(b+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(b+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*V;b=w.nquad_smooth*(V+w.normal_index_bytes*4);V=w.nquad_flat_uv*(V+w.uv_index_bytes*4);y+=function(b){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=b+w.nvertices*k;b=0){u=l.invBindMatrices[p];m.invBindMatrix=u;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,u);m.weights=[]; -for(u=0;u1){l=new THREE.MeshFaceMaterial;for(j=0;j>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function h(a,c){var b=n(a,c),e=n(a,c+1),f=n(a,c+2);return(n(a,c+3)<<24)+(f<<16)+(e<<8)+b}function l(a,c){var b=n(a,c);return(n(a,c+1)<<8)+b}function m(a,c){var b=n(a,c);return b>127?b-256:b}function n(a,c){return a.charCodeAt(c)&255}function o(c){var b, +e,f;b=h(a,c);e=h(a,c+F);f=h(a,c+G);c=l(a,c+I);z.faces.push(new THREE.Face3(b,e,f,null,null,z.materials[c]))}function p(c){var b,e,f,g,m,n;b=h(a,c);e=h(a,c+F);f=h(a,c+G);g=l(a,c+I);m=h(a,c+H);n=h(a,c+M);c=h(a,c+B);g=z.materials[g];var o=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[c*3],ha=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(o,p,n),new THREE.Vector3(t,ha,c)],null,g))}function t(c){var b,e,f,g;b=h(a,c);e=h(a,c+D);f=h(a,c+J);g= +h(a,c+L);c=l(a,c+N);z.faces.push(new THREE.Face4(b,e,f,g,null,null,z.materials[c]))}function x(c){var b,e,f,g,m,n,o,p;b=h(a,c);e=h(a,c+D);f=h(a,c+J);g=h(a,c+L);m=l(a,c+N);n=h(a,c+K);o=h(a,c+P);p=h(a,c+E);c=h(a,c+S);m=z.materials[m];var t=A[o*3],ha=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var v=A[c*3],u=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face4(b,e,f,g,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(t,ha,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(v,u,c)], +null,m))}function v(c){var b,e,f,g;b=h(a,c);e=h(a,c+O);f=h(a,c+U);c=C[b*2];g=C[b*2+1];b=C[e*2];var l=z.faceVertexUvs[0];e=C[e*2+1];var m=C[f*2];f=C[f*2+1];var n=[];n.push(new THREE.UV(c,g));n.push(new THREE.UV(b,e));n.push(new THREE.UV(m,f));l.push(n)}function u(c){var b,e,f,g,l,m;b=h(a,c);e=h(a,c+W);f=h(a,c+T);g=h(a,c+R);c=C[b*2];l=C[b*2+1];b=C[e*2];m=C[e*2+1];e=C[f*2];var n=z.faceVertexUvs[0];f=C[f*2+1];var o=C[g*2];g=C[g*2+1];var p=[];p.push(new THREE.UV(c,l));p.push(new THREE.UV(b,m));p.push(new THREE.UV(e, +f));p.push(new THREE.UV(o,g));n.push(p)}var z=this,y=0,w,A=[],C=[],F,G,I,H,M,B,D,J,L,N,K,P,E,S,O,U,W,T,R,Q,Z,X,Y,$,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);w={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:h(a,y+16),nnormals:h(a,y+16+4),nuvs:h(a,y+16+ +8),ntri_flat:h(a,y+16+12),ntri_smooth:h(a,y+16+16),ntri_flat_uv:h(a,y+16+20),ntri_smooth_uv:h(a,y+16+24),nquad_flat:h(a,y+16+28),nquad_smooth:h(a,y+16+32),nquad_flat_uv:h(a,y+16+36),nquad_smooth_uv:h(a,y+16+40)};y+=w.header_bytes;F=w.vertex_index_bytes;G=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;H=w.vertex_index_bytes*3+w.material_index_bytes;M=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;B=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;D=w.vertex_index_bytes; +J=w.vertex_index_bytes*2;L=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;E=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;S=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;U=w.uv_index_bytes*2;W=w.uv_index_bytes;T=w.uv_index_bytes*2;R=w.uv_index_bytes*3;c=w.vertex_index_bytes*3+w.material_index_bytes;V=w.vertex_index_bytes* +4+w.material_index_bytes;Q=w.ntri_flat*c;Z=w.ntri_smooth*(c+w.normal_index_bytes*3);X=w.ntri_flat_uv*(c+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(c+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*V;c=w.nquad_smooth*(V+w.normal_index_bytes*4);V=w.nquad_flat_uv*(V+w.uv_index_bytes*4);y+=function(c){for(var e,g,h,k=w.vertex_coordinate_bytes*3,l=c+w.nvertices*k;c=0){u=l.invBindMatrices[p];m.invBindMatrix=u;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,u);m.weights=[]; +for(u=0;u1){l=new THREE.MeshFaceMaterial;for(j=0;j1?c[1].substr(0,b):"0";c[1].length=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;eb){t=m.output[l];break}g=t!==void 0?t instanceof THREE.Matrix4?g.multiply(g,t):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);b=g;c.push({time:a,pos:[b.n14, -b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a1?b[1].substr(0,c):"0";b[1].length=0,h=f.indexOf("(")>=0,k;if(g)e=f.split("."),f=e.shift(),e.shift();else if(h){k=f.split("(");f=k.shift();for(e=0;ec){t=m.output[l];break}h=t!==void 0?t instanceof THREE.Matrix4?h.multiply(h,t):h.multiply(h,k.matrix):h.multiply(h,k.matrix)}else h=h.multiply(h,k.matrix);c=h;b.push({time:a,pos:[c.n14, +c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a3)for(f=2;f0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a={},b=this.transparency!== -void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=$[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]= -e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};M.prototype.parse=function(a){for(var b=0;b=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b3)for(f=2;f0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a={},c=this.transparency!== +void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=$[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]= +e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};M.prototype.parse=function(a){for(var c=0;c=0,e=a.indexOf("(")>=0,f,g;if(b)c=a.split("."),a=c.shift(),g=c.shift();else if(e){f=a.split("(");a=f.shift();for(c=0;c1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(F,M);object.name=t;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;E.scene.addObject(object);E.objects[t]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),E.scene.collisions.colliders.push(a)); if(y.castsShadow)a=new THREE.ShadowVolume(F),E.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},E.triggers[object.name]=a)}}else w=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], -s[1],s[2]),object.visible=y.visible!==void 0?y.visible:!1,E.scene.addObject(object),E.objects[t]=object,E.empties[t]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},E.triggers[object.name]=a)}function l(a){return function(b){E.geometries[a]=b;k();L-=1;c.onLoadComplete();n()}}function m(a){return function(b){E.geometries[a]=b}}function n(){c.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-L,loadedTextures:P-N},E);c.onLoadProgress();L==0&&N==0&&b(E)}var o, +s[1],s[2]),object.visible=y.visible!==void 0?y.visible:!1,E.scene.addObject(object),E.objects[t]=object,E.empties[t]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},E.triggers[object.name]=a)}function l(a){return function(b){E.geometries[a]=b;k();L-=1;c.onLoadComplete();n()}}function m(a){return function(c){E.geometries[a]=c}}function n(){c.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-L,loadedTextures:P-N},E);c.onLoadProgress();L==0&&N==0&&b(E)}var o, p,t,x,v,u,z,y,w,A,C,F,G,I,H,M,B,D,J,L,N,K,P,E;D=a.data;H=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=L=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(t in D.objects)if(y=D.objects[t],y.meshCollider){a=!0;break}if(a)E.scene.collisions=new THREE.CollisionSystem;if(D.transform){a=D.transform.position;A=D.transform.rotation;var S=D.transform.scale;a&&E.scene.position.set(a[0],a[1],a[2]);A&&E.scene.rotation.set(A[0], A[1],A[2]);S&&E.scene.scale.set(S[0],S[1],S[2]);(a||A||S)&&E.scene.updateMatrix()}a=function(){N-=1;n();c.onLoadComplete()};for(v in D.cameras){A=D.cameras[v];if(A.type=="perspective")G=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")G=new THREE.Camera,G.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);w=A.position;A=A.target;G.position.set(w[0],w[1],w[2]);G.target.position.set(A[0],A[1],A[2]);E.cameras[v]=G}for(x in D.lights)v=D.lights[x], G=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(w=v.direction,B=new THREE.DirectionalLight(G,A),B.position.set(w[0],w[1],w[2]),B.position.normalize()):v.type=="point"?(w=v.position,d=v.distance,B=new THREE.PointLight(G,A,d),B.position.set(w[0],w[1],w[2])):v.type=="ambient"&&(B=new THREE.AmbientLight(G)),E.scene.addLight(B),E.lights[x]=B;for(u in D.fogs)x=D.fogs[u],x.type=="linear"?I=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(I=new THREE.FogExp2(0, x.density)),A=x.color,I.color.setRGB(A[0],A[1],A[2]),E.fogs[u]=I;if(E.cameras&&D.defaults.camera)E.currentCamera=E.cameras[D.defaults.camera];if(E.fogs&&D.defaults.fog)E.scene.fog=E.fogs[D.defaults.fog];A=D.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(A[0],A[1],A[2]);E.bgColorAlpha=D.defaults.bgalpha;for(o in D.geometries)if(u=D.geometries[o],u.type=="bin_mesh"||u.type=="ascii_mesh")L+=1,c.onLoadStart();K=L;for(o in D.geometries)u=D.geometries[o],u.type=="cube"?(F=new THREE.CubeGeometry(u.width, -u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),E.geometries[o]=F):u.type=="plane"?(F=new THREE.PlaneGeometry(u.width,u.height,u.segmentsWidth,u.segmentsHeight),E.geometries[o]=F):u.type=="sphere"?(F=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),E.geometries[o]=F):u.type=="cylinder"?(F=new THREE.CylinderGeometry(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset),E.geometries[o]=F):u.type=="torus"?(F=new THREE.TorusGeometry(u.radius, -u.tube,u.segmentsR,u.segmentsT),E.geometries[o]=F):u.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(u.subdivisions),E.geometries[o]=F):u.type=="bin_mesh"?H.load({model:e(u.url,D.urlBaseType),callback:l(o)}):u.type=="ascii_mesh"?J.load({model:e(u.url,D.urlBaseType),callback:l(o)}):u.type=="embedded_mesh"&&(u=D.embeds[u.id])&&J.createModel(u,m(o),"");for(z in D.textures)if(o=D.textures[z],o.url instanceof Array){N+=o.url.length;for(H=0;H=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,g=0;g<8;g++){for(var h=0,f=0;f>1^-(k&1);c[8*f+g]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(g=f=0;g=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,h=0;h<8;h++){for(var g=0,f=0;f>1^-(k&1);c[8*f+h]=g}e+=b}b=a.length-e;g=new Uint16Array(b);for(h=f=0;h=this.maxCount-3&&k(this)};this.begin=function(){this.count=0; -this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;bthis.size-1&&(l=this.size-1);var p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(n-k);t<1&&(t=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size- -1);for(var x,v,u,z,y,w;o0&&(this.field[u+x]+=z)}}};this.addPlaneX=function(a,b){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,p=this.field,t=m*Math.sqrt(a/b);t>m&&(t=m);for(g=0;g0)for(h=0;hn&&(x=n);for(h=0;h0){l=h*o;for(g=0;gsize&&(dist=size);for(f=0;f0){l=zd*f;for(h=0;h=this.maxCount-3&&k(this)};this.begin=function(){this.count=0; +this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;bthis.size-1&&(l=this.size-1);var p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(n-k);t<1&&(t=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size- +1);for(var x,v,u,z,y,w;o0&&(this.field[u+x]+=z)}}};this.addPlaneX=function(a,b){var h,g,f,k,l,m=this.size,n=this.yd,o=this.zd,p=this.field,t=m*Math.sqrt(a/b);t>m&&(t=m);for(h=0;h0)for(g=0;gn&&(x=n);for(g=0;g0){l=g*o;for(h=0;hsize&&(dist=size);for(f=0;f0){l=zd*f;for(g=0;gh?this.hits.push(g):this.hits.unshift(g),h=e;return this.hits}; +THREE.Trident=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280})); +this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.PlaneCollider=function(a,b){this.point=a;this.normal=b}; +THREE.SphereCollider=function(a,b){this.center=a;this.radius=b;this.radiusSq=b*b};THREE.BoxCollider=function(a,b){this.min=a;this.max=b;this.dynamic=!0;this.normal=new THREE.Vector3};THREE.MeshCollider=function(a,b){this.mesh=a;this.box=b;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem; +THREE.CollisionSystem.prototype.merge=function(a){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,e,h,g=0;b=0;for(c=this.colliders.length;bg?this.hits.push(h):this.hits.unshift(h),g=e;return this.hits}; THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,b[c]);if(e.distb.length)return null;return b[c]}; THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,g,h=0;h=k*g))return Number.MAX_VALUE;f/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(f);k.addSelf(a.origin);Math.abs(h.x)> -Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-b.y,h=c.y-b.y,g=e.y-b.y,k=k.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=k.x-b.x,h=c.x-b.x,g=e.x-b.x,k=k.y-b.y,c=c.y-b.y,e=e.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-b.x,h=c.x-b.x,g=e.x-b.x,k=k.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=k.x-b.x,h=c.x-b.x,g=e.x-b.x,k=k.y-b.y,c=c.y-b.y,e=e.y-b.y);b=h*e-c*g;if(b==0)return Number.MAX_VALUE;b=1/b;e=(a*e-k*g)*b;if(!(e>=0))return Number.MAX_VALUE;b*=h*k-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-e-b>=0))return Number.MAX_VALUE;return f}; +THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,h,g=0;g=k*h))return Number.MAX_VALUE;f/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(f);k.addSelf(a.origin);Math.abs(g.x)> +Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(a=k.y-b.y,g=c.y-b.y,h=e.y-b.y,k=k.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=k.x-b.x,g=c.x-b.x,h=e.x-b.x,k=k.y-b.y,c=c.y-b.y,e=e.y-b.y):Math.abs(g.y)>Math.abs(g.z)?(a=k.x-b.x,g=c.x-b.x,h=e.x-b.x,k=k.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=k.x-b.x,g=c.x-b.x,h=e.x-b.x,k=k.y-b.y,c=c.y-b.y,e=e.y-b.y);b=g*e-c*h;if(b==0)return Number.MAX_VALUE;b=1/b;e=(a*e-k*h)*b;if(!(e>=0))return Number.MAX_VALUE;b*=g*k-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-e-b>=0))return Number.MAX_VALUE;return f}; THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);c.multiplyVector3(e.origin);c.rotateAxis(e.direction);e.direction.normalize();return e}; -THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,g=0,h=0,f=0,k=0,l=0,m=!0;c.origin.xb.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,m=!1,f=1);c.origin.yb.max.y&&(g=b.max.y-c.origin.y,g/=c.direction.y, -m=!1,k=1);c.origin.zb.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,m=!1,l=1);if(m)return-1;m=0;g>e&&(m=1,e=g);h>e&&(m=2,e=h);switch(m){case 0:k=c.origin.y+c.direction.y*e;if(kb.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(cb.max.z)return Number.MAX_VALUE;b.normal.set(f,0,0);break;case 1:f=c.origin.x+c.direction.x*e;if(fb.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z* +THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,h=0,g=0,f=0,k=0,l=0,m=!0;c.origin.xb.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,m=!1,f=1);c.origin.yb.max.y&&(h=b.max.y-c.origin.y,h/=c.direction.y, +m=!1,k=1);c.origin.zb.max.z&&(g=b.max.z-c.origin.z,g/=c.direction.z,m=!1,l=1);if(m)return-1;m=0;h>e&&(m=1,e=h);g>e&&(m=2,e=g);switch(m){case 0:k=c.origin.y+c.direction.y*e;if(kb.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(cb.max.z)return Number.MAX_VALUE;b.normal.set(f,0,0);break;case 1:f=c.origin.x+c.direction.x*e;if(fb.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z* e;if(cb.max.z)return Number.MAX_VALUE;b.normal.set(0,k,0);break;case 2:f=c.origin.x+c.direction.x*e;if(fb.max.x)return Number.MAX_VALUE;k=c.origin.y+c.direction.y*e;if(kb.max.y)return Number.MAX_VALUE;b.normal.set(0,0,l)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),e=b.point.dot(b.normal);if(c<0)c=(e-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE}; THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq=0)return Math.abs(e)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b}; THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,g=new THREE.Camera,h=new THREE.Camera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.Camera(53,1,1,1E4);t.position.z= +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,h=new THREE.Camera,g=new THREE.Camera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;h.useTarget=g.useTarget=!1;h.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.Camera(53,1,1,1E4);t.position.z= 2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:p}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); -var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);o.width=a;o.height=e;p.width=a;p.height=e};this.render=function(a,c){c.update(null,!0);if(l!==c.aspect||m!==c.near||n!==c.fov){l=c.aspect;m=c.near;n=c.fov;var z=c.projectionMatrix.clone(),y=125/30*0.5,w=y*m/125,A=m*Math.tan(n*Math.PI/360),C;f.n14=y;k.n14=-y;y=-A*l+w;C=A*l+w;z.n11=2*m/(C-y);z.n13=(C+y)/(C-y);g.projectionMatrix=z.clone();y=-A*l-w;C=A*l-w;z.n11=2*m/(C-y); -z.n13=(C+y)/(C-y);h.projectionMatrix=z.clone()}g.matrix=c.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(c.position);g.near=m;g.far=c.far;e.call(b,a,g,o,!0);h.matrix=c.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(c.position);h.near=m;h.far=c.far;e.call(b,a,h,p,!0);e.call(b,x,t)}}; -if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,g,h,f=new THREE.Camera,k=new THREE.Camera;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,e){c.call(b,a,e);g=a/2;h=e};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=c.far; -f.updateProjectionMatrix();f.position.copy(c.position);f.target.position.copy(c.target.position);f.translateX(b.separation);k.projectionMatrix=f.projectionMatrix;k.position.copy(c.position);k.target.position.copy(c.target.position);k.translateX(-b.separation);this.setViewport(0,0,g,h);e.call(b,a,f);this.setViewport(g,0,g,h);e.call(b,a,k,!1)}}; +var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);o.width=a;o.height=e;p.width=a;p.height=e};this.render=function(a,c){c.update(null,!0);if(l!==c.aspect||m!==c.near||n!==c.fov){l=c.aspect;m=c.near;n=c.fov;var z=c.projectionMatrix.clone(),y=125/30*0.5,w=y*m/125,A=m*Math.tan(n*Math.PI/360),C;f.n14=y;k.n14=-y;y=-A*l+w;C=A*l+w;z.n11=2*m/(C-y);z.n13=(C+y)/(C-y);h.projectionMatrix=z.clone();y=-A*l-w;C=A*l-w;z.n11=2*m/(C-y); +z.n13=(C+y)/(C-y);g.projectionMatrix=z.clone()}h.matrix=c.matrixWorld.clone().multiplySelf(k);h.update(null,!0);h.position.copy(c.position);h.near=m;h.far=c.far;e.call(b,a,h,o,!0);g.matrix=c.matrixWorld.clone().multiplySelf(f);g.update(null,!0);g.position.copy(c.position);g.near=m;g.far=c.far;e.call(b,a,g,p,!0);e.call(b,x,t)}}; +if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,h,g,f=new THREE.Camera,k=new THREE.Camera;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,e){c.call(b,a,e);h=a/2;g=e};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=c.far; +f.updateProjectionMatrix();f.position.copy(c.position);f.target.position.copy(c.target.position);f.translateX(b.separation);k.projectionMatrix=f.projectionMatrix;k.position.copy(c.position);k.target.position.copy(c.target.position);k.translateX(-b.separation);this.setViewport(0,0,h,g);e.call(b,a,f);this.setViewport(h,0,h,g);e.call(b,a,k,!1)}}; diff --git a/build/custom/ThreeSVG.js b/build/custom/ThreeSVG.js index 678ce6d4..e07e6aab 100644 --- a/build/custom/ThreeSVG.js +++ b/build/custom/ThreeSVG.js @@ -1,16 +1,16 @@ // ThreeSVG.js r45dev - http://github.com/mrdoob/three.js -var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; +var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,g;if(c==0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),g=c*(1-b*e),b=c*(1-b*(1-e)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r= c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,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},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf: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},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this}, divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)}, equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}; -THREE.Vector3.prototype={constructor:THREE.Vector3,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},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},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},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){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)}, -dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},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){return this.set(this.y* -a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*a.y-this.y*a.x)},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()< -1.0E-4}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d||1}; +THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},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},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){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)}, +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){return this.set(this.y*a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*a.y-this.y*a.x)},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);this.y=Math.asin(a.n13); +Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};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={constructor:THREE.Vector4,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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w= a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index 5b283b88..d872e65d 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -1,16 +1,16 @@ // ThreeWebGL.js r45dev - http://github.com/mrdoob/three.js -var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this}; +var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;return this},setHSV:function(b,c,d){var e,j,h;if(d==0)this.r=this.g=this.b=0;else switch(e=Math.floor(b*6),j=b*6-e,b=d*(1-c),h=d*(1-c*j),c=d*(1-c*(1-j)),e){case 1:this.r=h;this.g=d;this.b=b;break;case 2:this.r=b;this.g=d;this.b=c;break;case 3:this.r=b;this.g=h;this.b=d;break;case 4:this.r=c;this.g=b;this.b=d;break;case 5:this.r= d;this.g=b;this.b=h;break;case 6:case 0:this.r=d,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this}, divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)}, equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,d){this.x=b||0;this.y=c||0;this.z=d||0}; -THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,d){this.x=b;this.y=c;this.z=d;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z= -b.z-c.z;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){this.x/=b.x;this.y/=b.y;this.z/=b.z;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)}, -dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y* -b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13);Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()< -1.0E-4}};THREE.Vector4=function(b,c,d,e){this.x=b||0;this.y=c||0;this.z=d||0;this.w=e||1}; +THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,d){this.x=b;this.y=c;this.z=d;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},setZ:function(b){this.z=b;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this}, +addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){this.x/=b.x;this.y/=b.y;this.z/=b.z;return this}, +divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)}, +cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y*b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13); +Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(b,c,d,e){this.x=b||0;this.y=c||0;this.z=d||0;this.w=e||1}; THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w||1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;this.w= b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; diff --git a/examples/canvas_camera_orthographic.html b/examples/canvas_camera_orthographic.html index 2317b0e0..c3b7a911 100644 --- a/examples/canvas_camera_orthographic.html +++ b/examples/canvas_camera_orthographic.html @@ -59,12 +59,12 @@ var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.2 } ) ); line.position.z = ( i * 50 ) - 500; - scene.addObject( line ); + scene.add( line ); var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.2 } ) ); line.position.x = ( i * 50 ) - 500; line.rotation.y = 90 * Math.PI / 180; - scene.addObject( line ); + scene.add( line ); } @@ -84,28 +84,28 @@ cube.position.y = ( cube.scale.y * 50 ) / 2; cube.position.z = Math.floor( ( Math.random() * 1000 - 500 ) / 50 ) * 50 + 25; - scene.addObject(cube); + scene.add(cube); } // Lights var ambientLight = new THREE.AmbientLight( Math.random() * 0x10 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_birds.html b/examples/canvas_geometry_birds.html index 9c45b580..db3f7b69 100644 --- a/examples/canvas_geometry_birds.html +++ b/examples/canvas_geometry_birds.html @@ -361,7 +361,7 @@ bird.position = boids[ i ].position; bird.doubleSided = true; // bird.scale.x = bird.scale.y = bird.scale.z = 10; - scene.addObject( bird ); + scene.add( bird ); } diff --git a/examples/canvas_geometry_cube.html b/examples/canvas_geometry_cube.html index e5976d7a..849fa809 100644 --- a/examples/canvas_geometry_cube.html +++ b/examples/canvas_geometry_cube.html @@ -73,14 +73,14 @@ cube = new THREE.Mesh( new THREE.CubeGeometry( 200, 200, 200, 1, 1, 1, materials ), new THREE.MeshFaceMaterial() ); cube.position.y = 150; cube.overdraw = true; - scene.addObject( cube ); + scene.add( cube ); // Plane plane = new THREE.Mesh( new THREE.PlaneGeometry( 200, 200 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0 } ) ); plane.rotation.x = - 90 * ( Math.PI / 180 ); plane.overdraw = true; - scene.addObject( plane ); + scene.add( plane ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_earth.html b/examples/canvas_geometry_earth.html index cedb970e..654e05e2 100644 --- a/examples/canvas_geometry_earth.html +++ b/examples/canvas_geometry_earth.html @@ -67,11 +67,11 @@ mesh.overdraw = true; mesh.position.y = - 250; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject(mesh); + scene.add(mesh); mesh = new THREE.Mesh( new THREE.SphereGeometry( 200, 20, 20 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ) ); mesh.overdraw = true; - scene.addObject(mesh); + scene.add(mesh); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_hierarchy.html b/examples/canvas_geometry_hierarchy.html index 5e7aeda2..bda95e7e 100644 --- a/examples/canvas_geometry_hierarchy.html +++ b/examples/canvas_geometry_hierarchy.html @@ -65,11 +65,11 @@ mesh.matrixAutoUpdate = false; mesh.updateMatrix(); - group.addChild( mesh ); + group.add( mesh ); } - scene.addObject( group ); + scene.add( group ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_panorama.html b/examples/canvas_geometry_panorama.html index 01f7b27b..0e92bdf1 100644 --- a/examples/canvas_geometry_panorama.html +++ b/examples/canvas_geometry_panorama.html @@ -78,7 +78,7 @@ mesh = new THREE.Mesh( new THREE.CubeGeometry( 300, 300, 300, 7, 7, 7, materials, true ), new THREE.MeshFaceMaterial() ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_panorama_fisheye.html b/examples/canvas_geometry_panorama_fisheye.html index 3e67d2c5..dedf89f2 100644 --- a/examples/canvas_geometry_panorama_fisheye.html +++ b/examples/canvas_geometry_panorama_fisheye.html @@ -78,7 +78,7 @@ mesh = new THREE.Mesh( new THREE.CubeGeometry( 300, 300, 300, 7, 7, 7, materials, true ), new THREE.MeshFaceMaterial() ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); for ( var i = 0, l = mesh.geometry.vertices.length; i < l; i ++ ) { diff --git a/examples/canvas_geometry_terrain.html b/examples/canvas_geometry_terrain.html index fbf7a0da..8c6333db 100644 --- a/examples/canvas_geometry_terrain.html +++ b/examples/canvas_geometry_terrain.html @@ -84,7 +84,7 @@ mesh = new THREE.Mesh( plane, material ); mesh.rotation.x = -90 * Math.PI / 180; mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_text.html b/examples/canvas_geometry_text.html index 3d828197..18eb3f8d 100644 --- a/examples/canvas_geometry_text.html +++ b/examples/canvas_geometry_text.html @@ -104,9 +104,9 @@ text.overdraw = true; parent = new THREE.Object3D(); - parent.addChild( text ); + parent.add( text ); - scene.addObject( parent ); + scene.add( parent ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_interactive_cubes.html b/examples/canvas_interactive_cubes.html index 8eef9ccc..805e056c 100644 --- a/examples/canvas_interactive_cubes.html +++ b/examples/canvas_interactive_cubes.html @@ -63,7 +63,7 @@ object.rotation.x = ( Math.random() * 360 ) * Math.PI / 180; object.rotation.y = ( Math.random() * 360 ) * Math.PI / 180; object.rotation.z = ( Math.random() * 360 ) * Math.PI / 180; - scene.addObject( object ); + scene.add( object ); objects.push( object ); @@ -118,7 +118,7 @@ var particle = new THREE.Particle( particleMaterial ); particle.position = intersects[ 0 ].point; particle.scale.x = particle.scale.y = 8; - scene.addObject( particle ); + scene.add( particle ); } diff --git a/examples/canvas_interactive_cubes_tween.html b/examples/canvas_interactive_cubes_tween.html index ba62bd1e..640fba7b 100644 --- a/examples/canvas_interactive_cubes_tween.html +++ b/examples/canvas_interactive_cubes_tween.html @@ -61,7 +61,7 @@ object.rotation.x = ( Math.random() * 360 ) * Math.PI / 180; object.rotation.y = ( Math.random() * 360 ) * Math.PI / 180; object.rotation.z = ( Math.random() * 360 ) * Math.PI / 180; - scene.addObject( object ); + scene.add( object ); } diff --git a/examples/canvas_interactive_particles.html b/examples/canvas_interactive_particles.html index 23bee24c..ca13a5a6 100644 --- a/examples/canvas_interactive_particles.html +++ b/examples/canvas_interactive_particles.html @@ -76,7 +76,7 @@ particle.position.y = Math.random() * 800 - 400; particle.position.z = Math.random() * 800 - 400; particle.scale.x = particle.scale.y = Math.random() * 10 + 10; - scene.addObject( particle ); + scene.add( particle ); } diff --git a/examples/canvas_interactive_voxelpainter.html b/examples/canvas_interactive_voxelpainter.html index 02bd7bc3..8b6c677b 100644 --- a/examples/canvas_interactive_voxelpainter.html +++ b/examples/canvas_interactive_voxelpainter.html @@ -62,12 +62,12 @@ var line = new THREE.Line( geometry, material ); line.position.z = ( i * 50 ) - 500; - scene.addObject( line ); + scene.add( line ); var line = new THREE.Line( geometry, material ); line.position.x = ( i * 50 ) - 500; line.rotation.y = 90 * Math.PI / 180; - scene.addObject( line ); + scene.add( line ); } @@ -75,7 +75,7 @@ plane = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 20, 20 ), new THREE.MeshFaceMaterial() ); plane.rotation.x = - 90 * Math.PI / 180; - scene.addObject( plane ); + scene.add( plane ); mouse2D = new THREE.Vector3( 0, 10000, 0.5 ); ray = new THREE.Ray( camera.position, null ); @@ -83,21 +83,21 @@ // Lights var ambientLight = new THREE.AmbientLight( 0x606060 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); var directionalLight = new THREE.DirectionalLight( 0x808080 ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); @@ -137,7 +137,7 @@ if ( intersects[ 0 ].object != plane ) { - scene.removeObject( intersects[ 0 ].object ); + scene.remove( intersects[ 0 ].object ); } @@ -152,7 +152,7 @@ voxel.matrixAutoUpdate = false; voxel.updateMatrix(); voxel.overdraw = true; - scene.addObject( voxel ); + scene.add( voxel ); } diff --git a/examples/canvas_lights_pointlights.html b/examples/canvas_lights_pointlights.html index bf89005f..64c9e856 100644 --- a/examples/canvas_lights_pointlights.html +++ b/examples/canvas_lights_pointlights.html @@ -62,16 +62,16 @@ scene = new THREE.Scene(); - scene.addLight( new THREE.AmbientLight( 0x00020 ) ); + scene.add( new THREE.AmbientLight( 0x00020 ) ); light1 = new THREE.PointLight( 0xff0040, 1, 50 ); - scene.addLight( light1 ); + scene.add( light1 ); light2 = new THREE.PointLight( 0x0040ff, 1, 50 ); - scene.addLight( light2 ); + scene.add( light2 ); light3 = new THREE.PointLight( 0x80ff80, 1, 50 ); - scene.addLight( light3 ); + scene.add( light3 ); var PI2 = Math.PI * 2; var program = function ( context ) { @@ -85,19 +85,19 @@ particle1 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0xff0040, program: program } ) ); particle1.scale.x = particle1.scale.y = particle1.scale.z = 0.5; - scene.addObject( particle1 ); + scene.add( particle1 ); particle2 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0x0040ff, program: program } ) ); particle2.scale.x = particle2.scale.y = particle2.scale.z = 0.5; - scene.addObject( particle2 ); + scene.add( particle2 ); particle3 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0x80ff80, program: program } ) ); particle3.scale.x = particle3.scale.y = particle3.scale.z = 0.5; - scene.addObject( particle3 ); + scene.add( particle3 ); mesh = new THREE.Mesh( new WaltHead(), new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading } ) ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_lights_pointlights_smooth.html b/examples/canvas_lights_pointlights_smooth.html index f22f4093..cb59acd9 100644 --- a/examples/canvas_lights_pointlights_smooth.html +++ b/examples/canvas_lights_pointlights_smooth.html @@ -62,16 +62,16 @@ scene = new THREE.Scene(); - scene.addLight( new THREE.AmbientLight( 0x00020 ) ); + scene.add( new THREE.AmbientLight( 0x00020 ) ); light1 = new THREE.PointLight( 0xff0040, 1, 50 ); - scene.addLight( light1 ); + scene.add( light1 ); light2 = new THREE.PointLight( 0x0040ff, 1, 50 ); - scene.addLight( light2 ); + scene.add( light2 ); light3 = new THREE.PointLight( 0x80ff80, 1, 50 ); - scene.addLight( light3 ); + scene.add( light3 ); var PI2 = Math.PI * 2; var program = function ( context ) { @@ -85,22 +85,22 @@ particle1 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0xff0040, program: program } ) ); particle1.scale.x = particle1.scale.y = particle1.scale.z = 0.5; - scene.addObject( particle1 ); + scene.add( particle1 ); particle2 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0x0040ff, program: program } ) ); particle2.scale.x = particle2.scale.y = particle2.scale.z = 0.5; - scene.addObject( particle2 ); + scene.add( particle2 ); particle3 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0x80ff80, program: program } ) ); particle3.scale.x = particle3.scale.y = particle3.scale.z = 0.5; - scene.addObject( particle3 ); + scene.add( particle3 ); geometry = new WaltHead(); geometry.computeVertexNormals(); mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ) ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_lines.html b/examples/canvas_lines.html index b9a8c1e5..bc1adb8b 100644 --- a/examples/canvas_lines.html +++ b/examples/canvas_lines.html @@ -83,7 +83,7 @@ particle.position.normalize(); particle.position.multiplyScalar( Math.random() * 10 + 450 ); particle.scale.x = particle.scale.y = 5; - scene.addObject( particle ); + scene.add( particle ); geometry.vertices.push( new THREE.Vertex( particle.position ) ); @@ -92,7 +92,7 @@ // lines var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0xffffff, opacity: 0.5 } ) ); - scene.addObject( line ); + scene.add( line ); document.addEventListener( 'mousemove', onDocumentMouseMove, false ); document.addEventListener( 'touchstart', onDocumentTouchStart, false ); diff --git a/examples/canvas_lines_sphere.html b/examples/canvas_lines_sphere.html index 579c54d5..5af4270f 100644 --- a/examples/canvas_lines_sphere.html +++ b/examples/canvas_lines_sphere.html @@ -83,7 +83,7 @@ particle.position.z = Math.random() * 2 - 1; particle.position.normalize(); particle.position.multiplyScalar( Math.random() * 10 + 450 ); - scene.addObject( particle ); + scene.add( particle ); } @@ -105,7 +105,7 @@ geometry.vertices.push( new THREE.Vertex( vector2 ) ); var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0xffffff, opacity: Math.random() } ) ); - scene.addObject( line ); + scene.add( line ); } document.addEventListener( 'mousemove', onDocumentMouseMove, false ); diff --git a/examples/canvas_materials.html b/examples/canvas_materials.html index 9194c04e..995d159d 100644 --- a/examples/canvas_materials.html +++ b/examples/canvas_materials.html @@ -53,13 +53,13 @@ var line = new THREE.Line( geometry, material ); line.position.y = - 120; line.position.z = ( i * 100 ) - 500; - scene.addObject( line ); + scene.add( line ); var line = new THREE.Line( geometry, material ); line.position.x = ( i * 100 ) - 500; line.position.y = - 120; line.rotation.y = 90 * Math.PI / 180; - scene.addObject( line ); + scene.add( line ); } @@ -107,7 +107,7 @@ objects.push( sphere ); - scene.addObject( sphere ); + scene.add( sphere ); } @@ -123,21 +123,21 @@ particleLight = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0xffffff, program: program } ) ); particleLight.scale.x = particleLight.scale.y = particleLight.scale.z = 4; - scene.addObject( particleLight ); + scene.add( particleLight ); // Lights - scene.addLight( new THREE.AmbientLight( Math.random() * 0x202020 ) ); + scene.add( new THREE.AmbientLight( Math.random() * 0x202020 ) ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffffff, 1 ); - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.CanvasRenderer(); // renderer = new THREE.WebGLRenderer(); diff --git a/examples/canvas_materials_depth.html b/examples/canvas_materials_depth.html index 13e45514..692886ed 100644 --- a/examples/canvas_materials_depth.html +++ b/examples/canvas_materials_depth.html @@ -79,7 +79,7 @@ plane.rotation.x = - 90 * ( Math.PI / 180 ); plane.position.y = - 100; - scene.addObject( plane ); + scene.add( plane ); // Spheres @@ -108,24 +108,24 @@ cube.scale.x = cube.scale.y = cube.scale.z = Math.random() + 0.5; */ - scene.addObject(cube); + scene.add(cube); } // Lights var ambientLight = new THREE.AmbientLight( Math.random() * 0x202020 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); var pointLight = new THREE.PointLight( 0xff0000, 1 ); - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_materials_normal.html b/examples/canvas_materials_normal.html index c4c469eb..cb47d4c0 100644 --- a/examples/canvas_materials_normal.html +++ b/examples/canvas_materials_normal.html @@ -63,7 +63,7 @@ object = new THREE.Mesh( new WaltHead(), new THREE.MeshNormalMaterial() ); object.overdraw = true; object.scale.x = object.scale.y = object.scale.z = 10; - scene.addObject( object ); + scene.add( object ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_materials_reflection.html b/examples/canvas_materials_reflection.html index 92864055..b89d399e 100644 --- a/examples/canvas_materials_reflection.html +++ b/examples/canvas_materials_reflection.html @@ -68,7 +68,7 @@ mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } ) ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_materials_video.html b/examples/canvas_materials_video.html index 63e1e77b..831f33ef 100644 --- a/examples/canvas_materials_video.html +++ b/examples/canvas_materials_video.html @@ -109,7 +109,7 @@ mesh = new THREE.Mesh( plane, material ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 1.5; mesh.overdraw = true; - scene.addObject(mesh); + scene.add(mesh); mesh = new THREE.Mesh( plane, materialReflection ); mesh.position.y = -306; @@ -117,7 +117,7 @@ mesh.rotation.x = 180 * Math.PI / 180; mesh.doubleSided = true; mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); // @@ -148,7 +148,7 @@ particle.position.x = ix * separation - ( ( amountx * separation ) / 2 ); particle.position.y = -153 particle.position.z = iy * separation - ( ( amounty * separation ) / 2 ); - scene.addObject( particle ); + scene.add( particle ); } } diff --git a/examples/canvas_particles_floor.html b/examples/canvas_particles_floor.html index e4bfee2a..745443a3 100644 --- a/examples/canvas_particles_floor.html +++ b/examples/canvas_particles_floor.html @@ -71,7 +71,7 @@ particle = new THREE.Particle( material ); particle.position.x = ix * SEPARATION - ( ( AMOUNTX * SEPARATION ) / 2 ); particle.position.z = iy * SEPARATION - ( ( AMOUNTY * SEPARATION ) / 2 ); - scene.addObject( particle ); + scene.add( particle ); } } diff --git a/examples/canvas_particles_random.html b/examples/canvas_particles_random.html index 7698aa9a..12d839b8 100644 --- a/examples/canvas_particles_random.html +++ b/examples/canvas_particles_random.html @@ -56,7 +56,7 @@ } group = new THREE.Object3D(); - scene.addObject( group ); + scene.add( group ); for ( var i = 0; i < 1000; i++ ) { @@ -65,7 +65,7 @@ particle.position.y = Math.random() * 2000 - 1000; particle.position.z = Math.random() * 2000 - 1000; particle.scale.x = particle.scale.y = Math.random() * 10 + 5; - group.addChild( particle ); + group.add( particle ); } renderer = new THREE.CanvasRenderer(); diff --git a/examples/canvas_particles_shapes.html b/examples/canvas_particles_shapes.html index 0b787ba7..4f96e7c4 100644 --- a/examples/canvas_particles_shapes.html +++ b/examples/canvas_particles_shapes.html @@ -115,14 +115,14 @@ text.overdraw = true; parent = new THREE.Object3D(); - parent.addChild( text ); + parent.add( text ); particleCloud = new THREE.Object3D(); // Just a group particleCloud.y = 800; - parent.addChild( particleCloud ); + parent.add( particleCloud ); - scene.addObject( parent ); + scene.add( parent ); // Create Particle Systems @@ -184,7 +184,7 @@ particle = new THREE.Particle( material ); particle.scale.x = particle.scale.y = Math.random() * 20 +20; - particleCloud.addChild( particle ); + particleCloud.add( particle ); return particle; }; @@ -196,7 +196,7 @@ var onParticleDead = function(particle) { particle.target.visible = false; - particleCloud.removeChild(particle.target); + particleCloud.remove(particle.target); }; diff --git a/examples/canvas_particles_sprites.html b/examples/canvas_particles_sprites.html index 2f7f9338..bab5a3ef 100644 --- a/examples/canvas_particles_sprites.html +++ b/examples/canvas_particles_sprites.html @@ -54,7 +54,7 @@ initParticle( particle, i * 10 ); - scene.addObject( particle ); + scene.add( particle ); } renderer = new THREE.CanvasRenderer(); diff --git a/examples/canvas_particles_waves.html b/examples/canvas_particles_waves.html index 0d0ceb6a..d612617c 100644 --- a/examples/canvas_particles_waves.html +++ b/examples/canvas_particles_waves.html @@ -75,7 +75,7 @@ particle = particles[ i ++ ] = new THREE.Particle( material ); particle.position.x = ix * SEPARATION - ( ( AMOUNTX * SEPARATION ) / 2 ); particle.position.z = iy * SEPARATION - ( ( AMOUNTY * SEPARATION ) / 2 ); - scene.addObject( particle ); + scene.add( particle ); } diff --git a/examples/canvas_performance.html b/examples/canvas_performance.html index d84b02e6..dd775161 100644 --- a/examples/canvas_performance.html +++ b/examples/canvas_performance.html @@ -63,12 +63,12 @@ var line = new THREE.Line( geometry, material ); line.position.z = ( i * 100 ) - 500; - scene.addObject( line ); + scene.add( line ); var line = new THREE.Line( geometry, material ); line.position.x = ( i * 100 ) - 500; line.rotation.y = 90 * Math.PI / 180; - scene.addObject( line ); + scene.add( line ); } @@ -85,23 +85,23 @@ sphere.position.x = ( i % 5 ) * 200 - 400; sphere.position.z = Math.floor( i / 5 ) * 200 - 400; - scene.addObject( sphere ); + scene.add( sphere ); } // Lights var ambientLight = new THREE.AmbientLight( Math.random() * 0x202020 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = 0; directionalLight.position.y = 1; directionalLight.position.z = 0; - scene.addLight( directionalLight ); + scene.add( directionalLight ); var pointLight = new THREE.PointLight( 0xff0000, 1, 500 ); - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_sandbox.html b/examples/canvas_sandbox.html index 038e9e0a..e23ae6c4 100644 --- a/examples/canvas_sandbox.html +++ b/examples/canvas_sandbox.html @@ -178,12 +178,12 @@ var line = new THREE.Line( geometry, material ); line.position.z = ( i * 100 ) - 500; - scene.addObject( line ); + scene.add( line ); var line = new THREE.Line( geometry, material ); line.position.x = ( i * 100 ) - 500; line.rotation.y = 90 * Math.PI / 180; - scene.addObject( line ); + scene.add( line ); } @@ -211,24 +211,24 @@ objects.push( sphere ); - scene.addObject( sphere ); + scene.add( sphere ); } // Lights var ambientLight = new THREE.AmbientLight( Math.random() * 0x202020 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xff0000, 1 ); - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/misc_camera_path.html b/examples/misc_camera_path.html index d9eef97f..4fb46d15 100644 --- a/examples/misc_camera_path.html +++ b/examples/misc_camera_path.html @@ -102,24 +102,24 @@ mesh.updateMatrix(); mesh.matrixAutoUpdate = false; - scene.addChild( mesh ); + scene.add( mesh ); } - scene.addObject( camera.animationParent ); + scene.add( camera.animationParent ); // lights light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 1, 1, 1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.DirectionalLight( 0x002288 ); light.position.set( -1, -1, -1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.AmbientLight( 0x222222 ); - scene.addChild( light ); + scene.add( light ); // renderer diff --git a/examples/misc_camera_roll.html b/examples/misc_camera_roll.html index 1fb05577..b145bc8a 100644 --- a/examples/misc_camera_roll.html +++ b/examples/misc_camera_roll.html @@ -85,7 +85,7 @@ mesh.updateMatrix(); mesh.matrixAutoUpdate = false; - scene.addChild( mesh ); + scene.add( mesh ); } @@ -100,37 +100,37 @@ var material = new THREE.MeshPhongMaterial( { color:0xff0000 } ); var mesh = new THREE.Mesh( new THREE.Cube( 40, 5, 5 ), material ); mesh.position.x = 20; - cross.addChild( mesh ); + cross.add( mesh ); var material = new THREE.MeshPhongMaterial( { color:0x00ff00 } ); var mesh = new THREE.Mesh( new THREE.Cube( 5, 40, 5 ), material ); mesh.position.y = 20; - cross.addChild( mesh ); + cross.add( mesh ); var material = new THREE.MeshPhongMaterial( { color:0x0000ff } ); var mesh = new THREE.Mesh( new THREE.Cube( 5, 5, 40 ), material ); mesh.position.z = 20; - cross.addChild( mesh ); - camera.addChild( cross ); + cross.add( mesh ); + camera.add( cross ); */ - scene.addChild( camera ); + scene.add( camera ); // lights light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 1, 1, 1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.DirectionalLight( 0x002288 ); light.position.set( -1, -1, -1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.AmbientLight( 0x222222 ); - scene.addChild( light ); + scene.add( light ); // renderer diff --git a/examples/misc_camera_trackball.html b/examples/misc_camera_trackball.html index 3eb58fa5..e38e46ce 100644 --- a/examples/misc_camera_trackball.html +++ b/examples/misc_camera_trackball.html @@ -102,7 +102,7 @@ mesh.updateMatrix(); mesh.matrixAutoUpdate = false; - scene.addChild( mesh ); + scene.add( mesh ); } @@ -117,19 +117,19 @@ var material = new THREE.MeshPhongMaterial( { color:0xff0000 } ); var mesh = new THREE.Mesh( new THREE.Cube( 40, 5, 5 ), material ); mesh.position.x = 20; - cross.addChild( mesh ); + cross.add( mesh ); var material = new THREE.MeshPhongMaterial( { color:0x00ff00 } ); var mesh = new THREE.Mesh( new THREE.Cube( 5, 40, 5 ), material ); mesh.position.y = 20; - cross.addChild( mesh ); + cross.add( mesh ); var material = new THREE.MeshPhongMaterial( { color:0x0000ff } ); var mesh = new THREE.Mesh( new THREE.Cube( 5, 5, 40 ), material ); mesh.position.z = 20; - cross.addChild( mesh ); - camera.addChild( cross ); + cross.add( mesh ); + camera.add( cross ); */ @@ -137,14 +137,14 @@ light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 1, 1, 1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.DirectionalLight( 0x002288 ); light.position.set( -1, -1, -1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.AmbientLight( 0x222222 ); - scene.addChild( light ); + scene.add( light ); // renderer diff --git a/examples/misc_lights_test.html b/examples/misc_lights_test.html index 6f3afbb4..39e85ba7 100644 --- a/examples/misc_lights_test.html +++ b/examples/misc_lights_test.html @@ -101,7 +101,7 @@ mesh.position.z = 500 * ( Math.random() - 0.5 ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.25 * ( Math.random() + 0.5 ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); } @@ -109,30 +109,30 @@ mesh = new THREE.Mesh( new THREE.TorusGeometry( 100, 25, 15, 30 ), new THREE.MeshLambertMaterial( { color: 0xffffff } ) ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); // Lights var ambient = new THREE.AmbientLight( 0x101010 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.y = -70; directionalLight.position.z = 100; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00 ); pointLight.position.x = 0; pointLight.position.y = 0; pointLight.position.z = 0; - scene.addLight( pointLight ); + scene.add( pointLight ); lightMesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) ); lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05; lightMesh.position = pointLight.position; lightMesh.overdraw = true; - scene.addObject(lightMesh); + scene.add(lightMesh); if ( render_canvas ) { @@ -193,7 +193,7 @@ function render() { - counter == 30 ? scene.removeLight( directionalLight ) : counter ++; + counter == 30 ? scene.remove( directionalLight ) : counter ++; camera.position.x += ( mouseX - camera.position.x ) * .05; camera.position.y += ( - mouseY - camera.position.y ) * .05; diff --git a/examples/misc_lookat.html b/examples/misc_lookat.html index b1686498..42b2a7bf 100644 --- a/examples/misc_lookat.html +++ b/examples/misc_lookat.html @@ -68,7 +68,7 @@ var material = new THREE.MeshNormalMaterial( { shading: THREE.SmoothShading } ); target = new THREE.Mesh( new THREE.SphereGeometry( 100, 20, 20 ), material ); - scene.addObject( target ); + scene.add( target ); for ( var i = 0; i < 1000; i ++ ) { @@ -77,7 +77,7 @@ mesh.position.y = Math.random() * 4000 - 2000; mesh.position.z = Math.random() * 4000 - 2000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 4 + 2; - scene.addObject( mesh ); + scene.add( mesh ); } diff --git a/examples/misc_materials_multimaterials.html b/examples/misc_materials_multimaterials.html index 6fc3ef43..fcd48ed2 100644 --- a/examples/misc_materials_multimaterials.html +++ b/examples/misc_materials_multimaterials.html @@ -60,7 +60,7 @@ var mesh, zmesh, geometry; - var directionalLight, pointLight; + var directionalLight; var mouseX = 0; var mouseY = 0; @@ -108,7 +108,7 @@ mesh.position.y = 500 * ( Math.random() - 0.5 ); mesh.position.z = 500 * ( Math.random() - 0.5 ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.25 * (Math.random() + 0.5); - scene.addObject(mesh); + scene.add(mesh); } @@ -116,24 +116,18 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x101010 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.y = -70; directionalLight.position.z = 100; directionalLight.position.normalize(); - scene.addLight( directionalLight ); - - pointLight = new THREE.PointLight( 0xffaa00 ); - pointLight.position.x = 0; - pointLight.position.y = 0; - pointLight.position.z = 120; - //scene.addLight( pointLight ); + scene.add( directionalLight ); mesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xff0000 } ) ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.1; - mesh.position = pointLight.position; - scene.addObject(mesh); + mesh.position.set( 0, 0, 120 ); + scene.add(mesh); if ( render_gl ) { try { @@ -230,7 +224,7 @@ zmesh.scale.x = zmesh.scale.y = zmesh.scale.z = 3; zmesh.overdraw = true; zmesh.updateMatrix(); - scene.addObject(zmesh); + scene.add(zmesh); // PLANES with all materials from the model @@ -250,7 +244,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; mesh.doubleSided = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); // number var x = document.createElement( "canvas" ); @@ -272,7 +266,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; mesh.doubleSided = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); } } diff --git a/examples/misc_sound.html b/examples/misc_sound.html index 2e7a12fa..90145eb2 100644 --- a/examples/misc_sound.html +++ b/examples/misc_sound.html @@ -118,7 +118,7 @@ light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0.5, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var sphere = new THREE.SphereGeometry( 20, 32, 16 ); @@ -136,7 +136,7 @@ var mesh1 = new THREE.Mesh( sphere, material_sphere1 ); mesh1.position.set( -250, 30, 0 ); mesh1.scale.set( s, s, s ); - scene.addObject( mesh1 ); + scene.add( mesh1 ); sound1 = new Sound( [ 'sounds/358232_j_s_song.mp3', 'sounds/358232_j_s_song.ogg' ], 275, 1 ); sound1.position.copy( mesh1.position ); @@ -147,7 +147,7 @@ var mesh2 = new THREE.Mesh( sphere, material_sphere2 ); mesh2.position.set( 250, 30, 0 ); mesh2.scale.set( s, s, s ); - scene.addObject( mesh2 ); + scene.add( mesh2 ); sound2 = new Sound( [ 'sounds/376737_Skullbeatz___Bad_Cat_Maste.mp3', 'sounds/376737_Skullbeatz___Bad_Cat_Maste.ogg' ], 275, 1 ); sound2.position.copy( mesh2.position ); @@ -164,7 +164,7 @@ mesh = new THREE.Mesh( plane, material_wireframe ); mesh.position.y = 0.1; mesh.rotation.x = -1.57; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1, antialias: false } ); diff --git a/examples/misc_ubiquity_test.html b/examples/misc_ubiquity_test.html index 0b489123..b121ce57 100644 --- a/examples/misc_ubiquity_test.html +++ b/examples/misc_ubiquity_test.html @@ -27,6 +27,7 @@ + @@ -36,6 +37,7 @@ + @@ -67,7 +69,6 @@ - @@ -86,6 +87,11 @@ + + + + + @@ -94,11 +100,6 @@ - - - - - @@ -110,8 +111,9 @@ - + + @@ -163,7 +165,7 @@ qrcode = mesh = new THREE.Mesh( new Qrcode(), new THREE.MeshFaceMaterial() ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.addObject( mesh ); + scene.add( mesh ); // CUBES @@ -174,7 +176,7 @@ mesh.rotation.x = Math.random(); mesh.rotation.y = Math.random(); mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( cube, new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) ); mesh.position.x = 500; @@ -182,7 +184,7 @@ mesh.rotation.x = Math.random(); mesh.rotation.y = Math.random(); mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.addObject( mesh ); + scene.add( mesh ); // PLANE @@ -190,14 +192,15 @@ mesh.position.y = -500; mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; mesh.doubleSided = true; - scene.addObject( mesh ); + scene.add( mesh ); // CYLINDER - mesh = new THREE.Mesh( new THREE.CylinderGeometry( 10, 20, 100, 200, - 50, - 20 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) ); + mesh = new THREE.Mesh( new THREE.CylinderGeometry( 20, 100, 200, 10 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) ); mesh.position.x = -500; + mesh.rotation.x = - Math.PI / 2; mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.addObject( mesh ); + scene.add( mesh ); // POLYFIELD @@ -226,16 +229,16 @@ mesh = new THREE.Mesh( geometry, [ new THREE.MeshFaceMaterial(), new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true, wireframe: true, wireframeLinewidth: 10 } ) ] ); mesh.doubleSided = true; mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.addObject( mesh ); + scene.add( mesh ); // LIGHTS var ambient = new THREE.AmbientLight( 0x80ffff ); - scene.addLight( ambient ); + scene.add( ambient ); var directional = new THREE.DirectionalLight( 0xffff00 ); - scene.addLight( directional ); + scene.add( directional ); canvasRenderer = new THREE.CanvasRenderer(); canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT ); diff --git a/examples/scenes/test_scene.js b/examples/scenes/test_scene.js index d779310c..ec588ba6 100644 --- a/examples/scenes/test_scene.js +++ b/examples/scenes/test_scene.js @@ -73,7 +73,7 @@ var scene = { "geometry" : "cone", "materials": [ "lambert_blue" ], "position" : [ -50, 15, -50 ], - "rotation" : [ 1.57, 0, 0 ], + "rotation" : [ 0, 0, 0 ], "scale" : [ 1, 1, 1 ], "visible" : true }, @@ -82,7 +82,7 @@ var scene = { "geometry" : "cylinder", "materials": [ "lambert_blue" ], "position" : [ 50, 15, -50 ], - "rotation" : [ 1.57, 0, 0 ], + "rotation" : [ 0, 0, 0 ], "scale" : [ 1, 1, 1 ], "visible" : true }, @@ -186,22 +186,20 @@ var scene = { "cylinder": { "type" : "cylinder", - "numSegs" : 32, "topRad" : 5, "botRad" : 5, "height" : 50, - "topOffset": 0, - "botOffset": 0 + "radSegs" : 32, + "heightSegs": 1 }, "cone": { "type" : "cylinder", - "numSegs" : 32, "topRad" : 0, "botRad" : 5, "height" : 50, - "topOffset": 0, - "botOffset": 0 + "radSegs" : 32, + "heightSegs" : 1 }, "WaltHead": { @@ -492,4 +490,4 @@ var scene = { }; postMessage( scene ); -close(); \ No newline at end of file +close(); diff --git a/examples/webgl_animation_skinning.html b/examples/webgl_animation_skinning.html index e9932da1..a2ce4b02 100644 --- a/examples/webgl_animation_skinning.html +++ b/examples/webgl_animation_skinning.html @@ -86,7 +86,7 @@ light = new THREE.DirectionalLight( 0xffffff, 1.5 ); light.position.set( 0, 1, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var planeSimple = new THREE.PlaneGeometry( 200, 300 ); var planeTesselated = new THREE.PlaneGeometry( 100, 300, 25, 40 ); @@ -98,12 +98,12 @@ floor.position.y = -10; floor.rotation.x = -1.57; floor.scale.set( 25, 25, 25 ); - scene.addObject( floor ); + scene.add( floor ); floor = new THREE.Mesh( planeTesselated, matWire ); floor.rotation.x = -1.57; floor.scale.set( 25, 25, 25 ); - scene.addObject( floor ); + scene.add( floor ); renderer = new THREE.WebGLRenderer( { clearColor: 0xffffff, clearAlpha: 1 } ); renderer.setSize( window.innerWidth, height ); @@ -161,7 +161,7 @@ buffalo.position.y = buffalo.boundRadius * 0.5; buffalo.rotation.y = 0.2 - Math.random() * 0.4; - scene.addObject( buffalo ); + scene.add( buffalo ); buffalos.push( buffalo ); diff --git a/examples/webgl_collada.html b/examples/webgl_collada.html index 5977feeb..103d65cd 100644 --- a/examples/webgl_collada.html +++ b/examples/webgl_collada.html @@ -76,29 +76,29 @@ } var line = new THREE.Line( geometry, line_material, THREE.LinePieces ); - scene.addObject( line ); + scene.add( line ); // Add the COLLADA - scene.addObject( dae ); + scene.add( dae ); particleLight = new THREE.Mesh( new THREE.SphereGeometry( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) ); - scene.addObject( particleLight ); + scene.add( particleLight ); // Lights - scene.addLight( new THREE.AmbientLight( 0xcccccc ) ); + scene.add( new THREE.AmbientLight( 0xcccccc ) ); var directionalLight = new THREE.DirectionalLight(/*Math.random() * 0xffffff*/0xeeeeee ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffffff, 4 ); pointLight.position.x = 10000; - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_collisions_box.html b/examples/webgl_collisions_box.html index cddd0b43..b433b6b5 100644 --- a/examples/webgl_collisions_box.html +++ b/examples/webgl_collisions_box.html @@ -68,11 +68,11 @@ function init() { container.appendChild(renderer.domElement); var ambientLight = new THREE.AmbientLight( 0x606060 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); sun = new THREE.DirectionalLight( 0xffffff ); sun.position = camera.position.clone(); - scene.addLight( sun ); + scene.add( sun ); createCube( 200, new THREE.Vector3( 0,0,0 ) ); @@ -94,7 +94,7 @@ function createCube( s, p ) { ); cube.position = p; - scene.addObject( cube ); + scene.add( cube ); THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB( cube ) ); diff --git a/examples/webgl_collisions_mesh.html b/examples/webgl_collisions_mesh.html index 2f3c3e24..628db1b2 100644 --- a/examples/webgl_collisions_mesh.html +++ b/examples/webgl_collisions_mesh.html @@ -76,11 +76,11 @@ function init() { container.appendChild( renderer.domElement ); var ambientLight = new THREE.AmbientLight( 0x606060 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); sun = new THREE.DirectionalLight( 0xffffff ); sun.position = camera.position.clone(); - scene.addLight( sun ); + scene.add( sun ); loadCube(); @@ -174,7 +174,7 @@ function addCube( p, g) { //mesh.scale.y = Math.random() + 0.5; //mesh.scale.z = Math.random() + 0.5; - scene.addObject( mesh ); + scene.add( mesh ); var mc = THREE.CollisionUtils.MeshColliderWBox(mesh); THREE.Collisions.colliders.push( mc ); meshes.push( mesh ); diff --git a/examples/webgl_collisions_normal.html b/examples/webgl_collisions_normal.html index a6ea935d..4ab6bf34 100644 --- a/examples/webgl_collisions_normal.html +++ b/examples/webgl_collisions_normal.html @@ -76,11 +76,11 @@ function init() { container.appendChild( renderer.domElement ); var ambientLight = new THREE.AmbientLight( 0x606060 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); sun = new THREE.DirectionalLight( 0xffffff ); sun.position = camera.position.clone(); - scene.addLight( sun ); + scene.add( sun ); loadCube(); @@ -91,7 +91,7 @@ function init() { geom.vertices.push( new THREE.Vertex( new THREE.Vector3( 100, 0, 0) ) ); line = new THREE.Line(geom, lineMat); - scene.addObject( line ); + scene.add( line ); stats = new Stats(); stats.domElement.style.position = 'absolute'; @@ -127,7 +127,7 @@ function addCube( p, g) { var mesh = new THREE.Mesh( g, new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); mesh.position = p; - scene.addObject( mesh ); + scene.add( mesh ); var mc = THREE.CollisionUtils.MeshColliderWBox(mesh); THREE.Collisions.colliders.push( mc ); meshes.push( mesh ); diff --git a/examples/webgl_collisions_primitives.html b/examples/webgl_collisions_primitives.html index def66f3d..3d43bd79 100644 --- a/examples/webgl_collisions_primitives.html +++ b/examples/webgl_collisions_primitives.html @@ -73,10 +73,10 @@ container.appendChild(renderer.domElement); var ambientLight = new THREE.AmbientLight(0x606060); - scene.addLight(ambientLight); + scene.add(ambientLight); sun = new THREE.DirectionalLight(0xffffff); - scene.addLight(sun); + scene.add(sun); //makeWall(480); //makeWall(360); @@ -91,7 +91,7 @@ plane = new THREE.Mesh( new THREE.PlaneGeometry( 30000, 30000, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); plane.position.y = - 480; plane.rotation.x = Math.PI / - 2; - scene.addObject( plane ); + scene.add( plane ); geoms.push( plane ); var cplane = new THREE.PlaneCollider( plane.position, new THREE.Vector3( 0, 1, 0 ) ); @@ -123,7 +123,7 @@ function createCube(s, p){ var cube = new THREE.Mesh(new THREE.CubeGeometry( s, s, s ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); cube.position = p; - scene.addObject(cube); + scene.add(cube); geoms.push(cube); THREE.Collisions.colliders.push(THREE.CollisionUtils.MeshAABB(cube, p)); } @@ -131,7 +131,7 @@ function createSphere(rad, p){ var sphere = new THREE.Mesh( new THREE.SphereGeometry( rad, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); sphere.position = p; - scene.addObject(sphere); + scene.add(sphere); geoms.push(sphere); var sc = new THREE.SphereCollider(p, rad); diff --git a/examples/webgl_collisions_reaction.html b/examples/webgl_collisions_reaction.html index 319b91bd..c1a6316a 100644 --- a/examples/webgl_collisions_reaction.html +++ b/examples/webgl_collisions_reaction.html @@ -74,18 +74,18 @@ scene = new THREE.Scene(); sphere = new THREE.Mesh( new THREE.SphereGeometry( sphereSize, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0xff0000 } ) ); - scene.addObject( sphere ); + scene.add( sphere ); renderer = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); container.appendChild(renderer.domElement); var ambientLight = new THREE.AmbientLight(0xdddddd); - scene.addLight(ambientLight); + scene.add(ambientLight); sun = new THREE.DirectionalLight(0xffffff); sun.position = new THREE.Vector3(1, -1, 1).normalize(); - scene.addLight(sun); + scene.add(sun); createObstacles(); @@ -93,7 +93,7 @@ geometry.vertices.push( new THREE.Vertex( new THREE.Vector3(0, 0, 0) ) ); geometry.vertices.push( new THREE.Vertex( new THREE.Vector3(10, 0, 0) ) ); debugNormal = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0xff0000 } ) ); - scene.addObject( debugNormal ); + scene.add( debugNormal ); container.onmousemove = onDocumentMouseMove; animate(); @@ -110,7 +110,7 @@ var cube = new THREE.Mesh( new THREE.CubeGeometry( sx, sy, sz ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); cube.position = p; cube.rotation.y = ry; - scene.addObject(cube); + scene.add(cube); THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB(cube) ); cubes.push(cube); return cube; diff --git a/examples/webgl_collisions_terrain.html b/examples/webgl_collisions_terrain.html index bee6c3b0..3931896b 100644 --- a/examples/webgl_collisions_terrain.html +++ b/examples/webgl_collisions_terrain.html @@ -69,18 +69,18 @@ function init() { ray.direction = new THREE.Vector3(0, -1, 0); sphere = new THREE.Mesh( new THREE.SphereGeometry( sphereSize, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0xff0000 } ) ); - scene.addObject(sphere); + scene.add(sphere); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); container.appendChild(renderer.domElement); var ambientLight = new THREE.AmbientLight( 0x444444 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); sun = new THREE.DirectionalLight( 0xaaaaaa ); sun.position = new THREE.Vector3(-1,1, -1).normalize(); - scene.addLight( sun ); + scene.add( sun ); loadCube(); @@ -93,7 +93,7 @@ function init() { function loadCube(p) { var onGeometry = function( geometry ) { var mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xf3e4b8 } ) ); - scene.addObject( mesh ); + scene.add( mesh ); THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshColliderWBox(mesh) ); }; diff --git a/examples/webgl_collisions_trigger.html b/examples/webgl_collisions_trigger.html index c69dbb5f..bedf619a 100644 --- a/examples/webgl_collisions_trigger.html +++ b/examples/webgl_collisions_trigger.html @@ -74,18 +74,18 @@ scene = new THREE.Scene(); sphere = new THREE.Mesh( new THREE.SphereGeometry( sphereSize, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0xff0000 } ) ); - scene.addObject( sphere ); + scene.add( sphere ); renderer = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); container.appendChild(renderer.domElement); var ambientLight = new THREE.AmbientLight(0xdddddd); - scene.addLight(ambientLight); + scene.add(ambientLight); sun = new THREE.DirectionalLight(0xffffff); sun.position = new THREE.Vector3(1, -1, 1).normalize(); - scene.addLight(sun); + scene.add(sun); createObstacles(); @@ -102,7 +102,7 @@ function createCube(sx, sy, sz, p){ var cube = new THREE.Mesh(new THREE.CubeGeometry( sx, sy, sz ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); cube.position = p; - scene.addObject(cube); + scene.add(cube); THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB(cube) ); cubes.push(cube); return cube; diff --git a/examples/webgl_custom_attributes.html b/examples/webgl_custom_attributes.html index 927dbd3c..e825a6dc 100644 --- a/examples/webgl_custom_attributes.html +++ b/examples/webgl_custom_attributes.html @@ -149,7 +149,7 @@ } - scene.addChild( sphere ); + scene.add( sphere ); renderer = new THREE.WebGLRenderer( { clearColor: 0x050505, clearAlpha: 1 } ); renderer.setSize( WIDTH, HEIGHT ); diff --git a/examples/webgl_custom_attributes_particles.html b/examples/webgl_custom_attributes_particles.html index d9ad8b3e..7e3f8997 100644 --- a/examples/webgl_custom_attributes_particles.html +++ b/examples/webgl_custom_attributes_particles.html @@ -165,7 +165,7 @@ } - scene.addChild( sphere ); + scene.add( sphere ); renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } ); renderer.setSize( WIDTH, HEIGHT ); @@ -221,4 +221,4 @@ - \ No newline at end of file + diff --git a/examples/webgl_custom_attributes_particles2.html b/examples/webgl_custom_attributes_particles2.html index 7f54f913..788a17c8 100644 --- a/examples/webgl_custom_attributes_particles2.html +++ b/examples/webgl_custom_attributes_particles2.html @@ -162,7 +162,7 @@ } - scene.addChild( sphere ); + scene.add( sphere ); renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } ); renderer.setSize( WIDTH, HEIGHT ); @@ -220,4 +220,4 @@ - \ No newline at end of file + diff --git a/examples/webgl_custom_attributes_particles3.html b/examples/webgl_custom_attributes_particles3.html index f33b62f9..3abd76b0 100644 --- a/examples/webgl_custom_attributes_particles3.html +++ b/examples/webgl_custom_attributes_particles3.html @@ -221,7 +221,7 @@ console.log( vertices.length ); - scene.addObject( object ); + scene.add( object ); renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } ); renderer.setSize( WIDTH, HEIGHT ); @@ -279,4 +279,4 @@ - \ No newline at end of file + diff --git a/examples/webgl_flycamera_earth.html b/examples/webgl_flycamera_earth.html index 043dff05..bed568ed 100644 --- a/examples/webgl_flycamera_earth.html +++ b/examples/webgl_flycamera_earth.html @@ -106,10 +106,10 @@ dirLight = new THREE.DirectionalLight( 0xffffff ); dirLight.position.set( -1, 0, 1 ); dirLight.position.normalize(); - scene.addLight( dirLight ); + scene.add( dirLight ); ambientLight = new THREE.AmbientLight( 0x000000 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var planetTexture = THREE.ImageUtils.loadTexture( "textures/planets/earth_atmos_2048.jpg" ); var cloudsTexture = THREE.ImageUtils.loadTexture( "textures/planets/earth_clouds_1024.png" ); @@ -148,7 +148,7 @@ meshPlanet = new THREE.Mesh( geometry, materialNormalMap ); meshPlanet.rotation.y = 1.3; meshPlanet.rotation.z = tilt; - scene.addObject( meshPlanet ); + scene.add( meshPlanet ); // clouds @@ -157,7 +157,7 @@ meshClouds = new THREE.Mesh( geometry, materialClouds ); meshClouds.scale.set( cloudsScale, cloudsScale, cloudsScale ); meshClouds.rotation.z = tilt; - scene.addObject( meshClouds ); + scene.add( meshClouds ); // moon @@ -166,7 +166,7 @@ meshMoon = new THREE.Mesh( geometry, materialMoon ); meshMoon.position.set( radius * 5, 0, 0 ); meshMoon.scale.set( moonScale, moonScale, moonScale ); - scene.addObject( meshMoon ); + scene.add( meshMoon ); // stars @@ -214,7 +214,7 @@ stars.matrixAutoUpdate = false; stars.updateMatrix(); - scene.addObject( stars ); + scene.add( stars ); } diff --git a/examples/webgl_geometries.html b/examples/webgl_geometries.html index ec2e0abd..5a2e0b6f 100644 --- a/examples/webgl_geometries.html +++ b/examples/webgl_geometries.html @@ -49,11 +49,11 @@ var light, object, material; - scene.addLight( new THREE.AmbientLight( 0x404040 ) ); + scene.add( new THREE.AmbientLight( 0x404040 ) ); light = new THREE.DirectionalLight( 0xffffff, 1 ); light.position.z = 1; - scene.addLight( light ); + scene.add( light ); material = [ new THREE.MeshLambertMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/UV.jpg' ) } ), @@ -63,25 +63,25 @@ objects[ 0 ] = object = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100, 4, 4, 4 ), material ); object.position.x = - 200; object.position.z = 200; - scene.addObject( object ); + scene.add( object ); - objects[ 1 ] = object = new THREE.Mesh( new THREE.CylinderGeometry( 50, 25, 75, 100 ), material ); + objects[ 1 ] = object = new THREE.Mesh( new THREE.CylinderGeometry( 25, 75, 100, 40, 5 ), material ); object.position.z = 200; - scene.addObject( object ); + scene.add( object ); objects[ 2 ] = object = new THREE.Mesh( new THREE.IcosahedronGeometry( 2 ), material ); object.position.x = 200; object.position.z = 200; object.scale.x = object.scale.y = object.scale.z = 75; - scene.addObject( object ); + scene.add( object ); objects[ 3 ] = object = new THREE.Mesh( new THREE.PlaneGeometry( 100, 100, 4, 4 ), material ); object.position.x = - 200; - scene.addObject( object ); + scene.add( object ); objects[ 4 ] = object = new THREE.Mesh( new THREE.SphereGeometry( 75, 20, 10 ), material ); - scene.addObject( object ); + scene.add( object ); var points = []; @@ -93,22 +93,22 @@ objects[ 5 ] = object = new THREE.Mesh( new THREE.LatheGeometry( points, 20 ), material ); object.position.x = 200; - scene.addObject( object ); + scene.add( object ); objects[ 6 ] = object = new THREE.Mesh( new THREE.TorusGeometry( 50, 20, 20, 20 ), material ); object.position.x = - 200; object.position.z = - 200; - scene.addObject( object ); + scene.add( object ); objects[ 7 ] = object = new THREE.Mesh( new THREE.TorusKnotGeometry( 50, 10, 50, 20 ), material ); object.position.z = - 200; - scene.addObject( object ); + scene.add( object ); objects[ 8 ] = object = new THREE.Trident(); object.position.x = 200; object.position.z = - 200; object.scale.x = object.scale.y = object.scale.z = 0.5; - scene.addObject( object ); + scene.add( object ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_blenderexport_colors.html b/examples/webgl_geometry_blenderexport_colors.html index f115edfc..1c0a00ce 100644 --- a/examples/webgl_geometry_blenderexport_colors.html +++ b/examples/webgl_geometry_blenderexport_colors.html @@ -66,12 +66,10 @@ scene = new THREE.Scene(); - //scene.addLight( new THREE.AmbientLight( 0x333333 ) ); - light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var loader = new THREE.JSONLoader(); loader.load( { model: "obj/cubecolors/cubecolors.js", callback: createScene1 } ); @@ -100,7 +98,7 @@ mesh = new THREE.Mesh( geometry, material ); mesh.position.x = 400; mesh.scale.x = mesh.scale.y = mesh.scale.z = 250; - scene.addObject( mesh ); + scene.add( mesh ); } @@ -113,7 +111,7 @@ mesh2 = new THREE.Mesh( geometry, material ); mesh2.position.x = - 400; mesh2.scale.x = mesh2.scale.y = mesh2.scale.z = 250; - scene.addObject( mesh2 ); + scene.add( mesh2 ); } diff --git a/examples/webgl_geometry_colors.html b/examples/webgl_geometry_colors.html index d64be5a6..5da550ab 100644 --- a/examples/webgl_geometry_colors.html +++ b/examples/webgl_geometry_colors.html @@ -69,7 +69,7 @@ light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var shadowMaterial = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } ); var shadowGeo = new THREE.PlaneGeometry( 300, 300, 1, 1 ); @@ -77,19 +77,19 @@ mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = - 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); var faceIndices = [ 'a', 'b', 'c', 'd' ]; @@ -144,19 +144,19 @@ mesh.position.x = -400; mesh.scale.x = mesh.scale.y = mesh.scale.z = 200; mesh.rotation.x = -1.87; - scene.addObject( mesh ); + scene.add( mesh ); mesh2 = new THREE.Mesh( geometry2, materials ); mesh2.position.x = 400; mesh2.rotation.x = 0; mesh2.scale = mesh.scale; - scene.addObject( mesh2 ); + scene.add( mesh2 ); mesh3 = new THREE.Mesh( geometry3, materials ); mesh3.position.x = 0; mesh3.rotation.x = 0; mesh3.scale = mesh.scale; - scene.addObject( mesh3 ); + scene.add( mesh3 ); renderer = new THREE.WebGLRenderer( { antialias: true } ); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_dynamic.html b/examples/webgl_geometry_dynamic.html index 377f8893..92feb639 100644 --- a/examples/webgl_geometry_dynamic.html +++ b/examples/webgl_geometry_dynamic.html @@ -82,10 +82,6 @@ scene = new THREE.Scene(); scene.fog = new THREE.FogExp2( 0xaaccff, 0.0007 ); - //var light = new THREE.PointLight( 0xffffff, 2 ); - //light.position.y = 500; - //scene.addLight( light ); - camera.position.y = 200; camera.target.position.y = camera.position.y; @@ -113,7 +109,7 @@ mesh = new THREE.Mesh( geometry, material ); mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer( { clearColor:0xaaccff, clearAlpha: 1 } ); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_hierarchy.html b/examples/webgl_geometry_hierarchy.html index da7d1548..83373d42 100644 --- a/examples/webgl_geometry_hierarchy.html +++ b/examples/webgl_geometry_hierarchy.html @@ -65,11 +65,11 @@ mesh.matrixAutoUpdate = false; mesh.updateMatrix(); - group.addChild( mesh ); + group.add( mesh ); } - scene.addObject( group ); + scene.add( group ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_hierarchy2.html b/examples/webgl_geometry_hierarchy2.html index 37d53986..059bf902 100644 --- a/examples/webgl_geometry_hierarchy2.html +++ b/examples/webgl_geometry_hierarchy2.html @@ -66,7 +66,7 @@ child = new THREE.Mesh( geometry, material ); child.position.x = 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); @@ -80,7 +80,7 @@ child = new THREE.Mesh( geometry, material ); child.position.x = - 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); @@ -94,7 +94,7 @@ child = new THREE.Mesh( geometry, material ); child.position.y = - 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); @@ -108,7 +108,7 @@ child = new THREE.Mesh( geometry, material ); child.position.y = 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); @@ -122,7 +122,7 @@ child = new THREE.Mesh( geometry, material ); child.position.z = - 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); @@ -136,14 +136,14 @@ child = new THREE.Mesh( geometry, material ); child.position.z = 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); } - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_large_mesh.html b/examples/webgl_geometry_large_mesh.html index 6d396be3..99a760af 100644 --- a/examples/webgl_geometry_large_mesh.html +++ b/examples/webgl_geometry_large_mesh.html @@ -97,7 +97,7 @@ mesh.rotation.z = rz; mesh.overdraw = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); } @@ -115,20 +115,20 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x101010 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 2; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00 ); pointLight.position.x = 0; pointLight.position.y = 0; pointLight.position.z = 0; - scene.addLight( pointLight ); + scene.add( pointLight ); // light representation sphere = new THREE.SphereGeometry( 100, 16, 8, 1 ); @@ -137,7 +137,7 @@ lightMesh.position = pointLight.position; lightMesh.overdraw = true; lightMesh.updateMatrix(); - scene.addObject( lightMesh ); + scene.add( lightMesh ); if ( render_gl ) { diff --git a/examples/webgl_geometry_minecraft.html b/examples/webgl_geometry_minecraft.html index c06be920..f08d4779 100644 --- a/examples/webgl_geometry_minecraft.html +++ b/examples/webgl_geometry_minecraft.html @@ -151,17 +151,17 @@ } mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() ); - scene.addObject( mesh ); + scene.add( mesh ); var ambientLight = new THREE.AmbientLight( 0xcccccc ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( 0xffffff, 1.5 ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_minecraft_ao.html b/examples/webgl_geometry_minecraft_ao.html index 19c6f3f6..55a1a55b 100644 --- a/examples/webgl_geometry_minecraft_ao.html +++ b/examples/webgl_geometry_minecraft_ao.html @@ -438,17 +438,17 @@ } mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() ); - scene.addObject( mesh ); + scene.add( mesh ); var ambientLight = new THREE.AmbientLight( 0xcccccc ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( 0xffffff, 1.5 ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_shapes.html b/examples/webgl_geometry_shapes.html index c29317c2..f69ef700 100644 --- a/examples/webgl_geometry_shapes.html +++ b/examples/webgl_geometry_shapes.html @@ -65,11 +65,11 @@ var light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); parent = new THREE.Object3D(); parent.position.y = 50; - scene.addChild( parent ); + scene.add( parent ); function addGeometry( geometry, points, spacedPoints, color, x, y, z, rx, ry, rz, s ) { @@ -79,7 +79,7 @@ mesh.position.set( x, y, z - 75 ); mesh.rotation.set( rx, ry, rz ); mesh.scale.set( s, s, s ); - parent.addChild( mesh ); + parent.add( mesh ); // solid line @@ -87,7 +87,7 @@ line.position.set( x, y, z + 25 ); line.rotation.set( rx, ry, rz ); line.scale.set( s, s, s ); - parent.addChild( line ); + parent.add( line ); // transparent line from real points @@ -95,7 +95,7 @@ line.position.set( x, y, z + 75 ); line.rotation.set( rx, ry, rz ); line.scale.set( s, s, s ); - parent.addChild( line ); + parent.add( line ); // vertices from real points @@ -104,7 +104,7 @@ particles.position.set( x, y, z + 75 ); particles.rotation.set( rx, ry, rz ); particles.scale.set( s, s, s ); - parent.addChild( particles ); + parent.add( particles ); // transparent line from equidistance sampled points @@ -112,7 +112,7 @@ line.position.set( x, y, z + 100 ); line.rotation.set( rx, ry, rz ); line.scale.set( s, s, s ); - parent.addChild( line ); + parent.add( line ); // equidistance sampled points @@ -121,7 +121,7 @@ particles2.position.set( x, y, z + 100 ); particles2.rotation.set( rx, ry, rz ); particles2.scale.set( s, s, s ); - parent.addChild( particles2 ); + parent.add( particles2 ); } diff --git a/examples/webgl_geometry_terrain.html b/examples/webgl_geometry_terrain.html index 3c335837..8f568cbf 100644 --- a/examples/webgl_geometry_terrain.html +++ b/examples/webgl_geometry_terrain.html @@ -96,7 +96,7 @@ mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: texture } ) ); mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_terrain_fog.html b/examples/webgl_geometry_terrain_fog.html index 3f0b5e64..5ade2246 100644 --- a/examples/webgl_geometry_terrain_fog.html +++ b/examples/webgl_geometry_terrain_fog.html @@ -96,7 +96,7 @@ mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: texture } ) ); mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer( { clearColor: 0xefd1b5, clearAlpha: 1 } ); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_text.html b/examples/webgl_geometry_text.html index fd56dc67..2a335951 100644 --- a/examples/webgl_geometry_text.html +++ b/examples/webgl_geometry_text.html @@ -175,11 +175,11 @@ var dirLight = new THREE.DirectionalLight( 0xffffff, 0.125 ); dirLight.position.set( 0, 0, 1 ); dirLight.position.normalize(); - scene.addLight( dirLight ); + scene.add( dirLight ); var pointLight = new THREE.PointLight( 0xffffff, 1.5 ); pointLight.position.set( 0, 100, 90 ); - scene.addLight( pointLight ); + scene.add( pointLight ); //text = capitalize( font ) + " " + capitalize( weight ); //text = "abcdefghijklmnopqrstuvwxyz0123456789"; @@ -228,14 +228,14 @@ parent = new THREE.Object3D(); parent.position.y = 100; - scene.addChild( parent ); + scene.add( parent ); createText(); var plane = new THREE.Mesh( new THREE.PlaneGeometry( 10000, 10000 ), new THREE.MeshBasicMaterial( { color: 0xffffff, opacity: 0.5, transparent: true } ) ); plane.rotation.x = -1.57; plane.position.y = 100; - scene.addChild( plane ); + scene.add( plane ); // RENDERER @@ -499,7 +499,7 @@ textMesh1.rotation.x = 0; textMesh1.rotation.y = Math.PI * 2; - parent.addChild( textMesh1 ); + parent.add( textMesh1 ); if ( mirror ) { @@ -512,7 +512,7 @@ textMesh2.rotation.x = Math.PI; textMesh2.rotation.y = Math.PI * 2; - parent.addChild( textMesh2 ); + parent.add( textMesh2 ); } @@ -522,8 +522,8 @@ updatePermalink(); - scene.removeChild( textMesh1 ); - if ( mirror ) scene.removeChild( textMesh2 ); + scene.remove( textMesh1 ); + if ( mirror ) scene.remove( textMesh2 ); if ( !text ) return; diff --git a/examples/webgl_hdr.html b/examples/webgl_hdr.html index 2c657add..57a3763f 100644 --- a/examples/webgl_hdr.html +++ b/examples/webgl_hdr.html @@ -125,7 +125,7 @@ directionalLight.position.y = 0; directionalLight.position.z = 1; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); var texture = THREE.ImageUtils.loadTexture( "textures/memorial.png" ); texture.minFilter = THREE.LinearFilter; @@ -147,7 +147,7 @@ quad = new THREE.Mesh( plane, materialHDR ); quad.position.z = -100; - scene.addObject( quad ); + scene.add( quad ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_interactive_cubes.html b/examples/webgl_interactive_cubes.html index 3ede8438..8c618de4 100644 --- a/examples/webgl_interactive_cubes.html +++ b/examples/webgl_interactive_cubes.html @@ -53,14 +53,14 @@ light.position.y = 1; light.position.z = 1; light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var light = new THREE.DirectionalLight( 0xffffff ); light.position.x = - 1; light.position.y = - 1; light.position.z = - 1; light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var geometry = new THREE.CubeGeometry( 20, 20, 20 ); @@ -76,7 +76,7 @@ object.scale.x = Math.random() * 2 + 1; object.scale.y = Math.random() * 2 + 1; object.scale.z = Math.random() * 2 + 1; - scene.addObject( object ); + scene.add( object ); } diff --git a/examples/webgl_interactive_voxelpainter.html b/examples/webgl_interactive_voxelpainter.html index 557d1854..f456e4c4 100644 --- a/examples/webgl_interactive_voxelpainter.html +++ b/examples/webgl_interactive_voxelpainter.html @@ -64,7 +64,7 @@ rollOverGeo = new THREE.CubeGeometry( 50, 50, 50 ); rollOverMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } ); rollOverMesh = new THREE.Mesh( rollOverGeo, rollOverMaterial ); - scene.addObject( rollOverMesh ); + scene.add( rollOverMesh ); // cubes @@ -80,7 +80,7 @@ plane = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 20, 20 ), new THREE.MeshBasicMaterial( { color: 0x555555, wireframe: true } ) ); plane.rotation.x = - 90 * Math.PI / 180; - scene.addObject( plane ); + scene.add( plane ); mouse2D = new THREE.Vector3( 0, 10000, 0.5 ); ray = new THREE.Ray( camera.position, null ); @@ -88,21 +88,21 @@ // Lights var ambientLight = new THREE.AmbientLight( 0x606060 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); var directionalLight = new THREE.DirectionalLight( 0x808080 ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); renderer = new THREE.WebGLRenderer( { antialias: true } ); renderer.setSize( window.innerWidth, window.innerHeight ); @@ -176,7 +176,7 @@ if ( intersector.object != plane ) { - scene.removeObject( intersector.object ); + scene.remove( intersector.object ); } @@ -191,7 +191,7 @@ voxel.position.copy( voxelPosition ); voxel.matrixAutoUpdate = false; voxel.updateMatrix(); - scene.addObject( voxel ); + scene.add( voxel ); } diff --git a/examples/webgl_lights_pointlights.html b/examples/webgl_lights_pointlights.html index 096b345d..8da860e5 100644 --- a/examples/webgl_lights_pointlights.html +++ b/examples/webgl_lights_pointlights.html @@ -77,48 +77,38 @@ object = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial( { ambient: 0x555555, color: 0x555555, specular: 0xffffff, shininess: 50, shading: THREE.SmoothShading } ) ); object.scale.x = object.scale.y = object.scale.z = 0.80; - scene.addObject( object ); + scene.add( object ); loader.statusDomElement.style.display = "none"; }; - //loader.load( { model: "obj/walt/WaltHead_slim.js", callback: callback } ); loader.load( { model: "obj/walt/WaltHead_bin.js", callback: callback } ); - /* - var directionalLight = new THREE.DirectionalLight( 0x111111, 0.9 ); - directionalLight.position.x = 1; - directionalLight.position.y = 1; - directionalLight.position.z = 2; - directionalLight.position.normalize(); - scene.addLight( directionalLight ); - */ - - scene.addLight( new THREE.AmbientLight( 0x00000 ) ); + scene.add( new THREE.AmbientLight( 0x00000 ) ); light1 = new THREE.PointLight( 0xff0040, 2, 50 ); - scene.addLight( light1 ); + scene.add( light1 ); light2 = new THREE.PointLight( 0x0040ff, 2, 50 ); - scene.addLight( light2 ); + scene.add( light2 ); light3 = new THREE.PointLight( 0x80ff80, 2, 50 ); - scene.addLight( light3 ); + scene.add( light3 ); var sphere = new THREE.SphereGeometry( 0.5, 16, 8 ); var l1 = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xff0040 } ) ); l1.position = light1.position; - scene.addObject( l1 ); + scene.add( l1 ); var l2 = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0x0040ff } ) ); l2.position = light2.position; - scene.addObject( l2 ); + scene.add( l2 ); var l3 = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0x80ff80 } ) ); l3.position = light3.position; - scene.addObject( l3 ); + scene.add( l3 ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_lines_colors.html b/examples/webgl_lines_colors.html index 5854470d..4ba0b0ed 100644 --- a/examples/webgl_lines_colors.html +++ b/examples/webgl_lines_colors.html @@ -135,7 +135,7 @@ line.position.x = p[ 2 ][ 0 ]; line.position.y = p[ 2 ][ 1 ]; line.position.z = p[ 2 ][ 2 ]; - scene.addObject( line ); + scene.add( line ); } diff --git a/examples/webgl_lines_cubes.html b/examples/webgl_lines_cubes.html index e765f1b4..d7439bf4 100644 --- a/examples/webgl_lines_cubes.html +++ b/examples/webgl_lines_cubes.html @@ -112,7 +112,7 @@ line.position.x = p[ 2 ][ 0 ]; line.position.y = p[ 2 ][ 1 ]; line.position.z = p[ 2 ][ 2 ]; - scene.addObject( line ); + scene.add( line ); } diff --git a/examples/webgl_lines_sphere.html b/examples/webgl_lines_sphere.html index 7ba84b3a..b024ea0d 100644 --- a/examples/webgl_lines_sphere.html +++ b/examples/webgl_lines_sphere.html @@ -111,7 +111,7 @@ line.originalScale = p[ 0 ]; line.rotation.y = Math.random() * Math.PI; line.updateMatrix(); - scene.addObject( line ); + scene.add( line ); } diff --git a/examples/webgl_lines_splines.html b/examples/webgl_lines_splines.html index ab01e570..eaa9d906 100644 --- a/examples/webgl_lines_splines.html +++ b/examples/webgl_lines_splines.html @@ -137,7 +137,7 @@ line.position.x = p[ 2 ][ 0 ]; line.position.y = p[ 2 ][ 1 ]; line.position.z = p[ 2 ][ 2 ]; - scene.addObject( line ); + scene.add( line ); } diff --git a/examples/webgl_lod.html b/examples/webgl_lod.html index 8492b87f..170642fa 100644 --- a/examples/webgl_lod.html +++ b/examples/webgl_lod.html @@ -74,12 +74,12 @@ var light = new THREE.PointLight( 0xff2200 ); light.position.set( 0, 0, 0 ); - scene.addLight( light ); + scene.add( light ); var light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var material = new THREE.MeshLambertMaterial( { color: 0xffffff, wireframe: true } ); @@ -113,7 +113,7 @@ lod.position.z = 10000 * ( 0.5 - Math.random() ); lod.updateMatrix(); lod.matrixAutoUpdate = false; - scene.addObject( lod ); + scene.add( lod ); } diff --git a/examples/webgl_lod_text.html b/examples/webgl_lod_text.html index 05a6ba15..e00d9386 100644 --- a/examples/webgl_lod_text.html +++ b/examples/webgl_lod_text.html @@ -89,12 +89,12 @@ var light = new THREE.PointLight( 0xff2200 ); light.position.set( 0, 0, 0 ); - scene.addLight( light ); + scene.add( light ); var light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var wireMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, opacity: 0.5, wireframe: true } ); @@ -154,7 +154,7 @@ lod.position.z = 10000 * ( 0.5 - Math.random() ); lod.updateMatrix(); lod.matrixAutoUpdate = false; - scene.addObject( lod ); + scene.add( lod ); } diff --git a/examples/webgl_materials.html b/examples/webgl_materials.html index 20e8a79d..43194ebf 100644 --- a/examples/webgl_materials.html +++ b/examples/webgl_materials.html @@ -63,7 +63,7 @@ } var line = new THREE.Line( geometry, line_material, THREE.LinePieces ); - scene.addObject( line ); + scene.add( line ); // Materials @@ -123,26 +123,26 @@ objects.push( sphere ); - scene.addObject( sphere ); + scene.add( sphere ); } particleLight = new THREE.Mesh( new THREE.SphereGeometry( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) ); - scene.addObject( particleLight ); + scene.add( particleLight ); // Lights - scene.addLight( new THREE.AmbientLight( 0x202020 ) ); + scene.add( new THREE.AmbientLight( 0x202020 ) ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffffff, 1 ); - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_materials_cars.html b/examples/webgl_materials_cars.html index c6528efb..664c42df 100644 --- a/examples/webgl_materials_cars.html +++ b/examples/webgl_materials_cars.html @@ -174,27 +174,27 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x555555 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff, 2 ); directionalLight.position.x = 2; directionalLight.position.y = 1.2; directionalLight.position.z = 10; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); directionalLight = new THREE.DirectionalLight( 0xffffff, 1 ); directionalLight.position.x = - 2; directionalLight.position.y = 1.2; directionalLight.position.z = - 10; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00, 2 ); pointLight.position.x = 2000; pointLight.position.y = 1200; pointLight.position.z = 10000; - scene.addLight( pointLight ); + scene.add( pointLight ); // Skybox @@ -210,7 +210,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // @@ -573,7 +573,7 @@ mesh.rotation.y = r[ 1 ]; mesh.rotation.z = r[ 2 ]; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); CARS[ car ].object = mesh; diff --git a/examples/webgl_materials_cars_anaglyph.html b/examples/webgl_materials_cars_anaglyph.html index 66aa7d03..aee0a944 100644 --- a/examples/webgl_materials_cars_anaglyph.html +++ b/examples/webgl_materials_cars_anaglyph.html @@ -170,27 +170,27 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x555555 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff, 2 ); directionalLight.position.x = 2; directionalLight.position.y = 1.2; directionalLight.position.z = 10; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); directionalLight = new THREE.DirectionalLight( 0xffffff, 1 ); directionalLight.position.x = - 2; directionalLight.position.y = 1.2; directionalLight.position.z = - 10; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00, 2 ); pointLight.position.x = 2000; pointLight.position.y = 1200; pointLight.position.z = 10000; - scene.addLight( pointLight ); + scene.add( pointLight ); // Skybox @@ -206,7 +206,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - scene.addObject( mesh ); + scene.add( mesh ); // @@ -568,7 +568,7 @@ mesh.rotation.y = r[ 1 ]; mesh.rotation.z = r[ 2 ]; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); CARS[ car ].object = mesh; diff --git a/examples/webgl_materials_cars_camaro.html b/examples/webgl_materials_cars_camaro.html index fe2baa55..6d67c506 100644 --- a/examples/webgl_materials_cars_camaro.html +++ b/examples/webgl_materials_cars_camaro.html @@ -76,20 +76,20 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x555555 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00 ); pointLight.position.x = 0; pointLight.position.y = 0; pointLight.position.z = 0; - scene.addLight( pointLight ); + scene.add( pointLight ); sphere = new THREE.SphereGeometry( 100, 16, 8, 1 ); @@ -98,7 +98,7 @@ lightMesh.position = pointLight.position; lightMesh.overdraw = true; lightMesh.updateMatrix(); - scene.addObject(lightMesh); + scene.add(lightMesh); webglRenderer = new THREE.WebGLRenderer(); @@ -190,7 +190,7 @@ var mesh = new THREE.Mesh( geometry, m ); mesh.rotation.y = 1; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); createButtons( materials.body, geometry ); diff --git a/examples/webgl_materials_cars_camaro_crosseyed.html b/examples/webgl_materials_cars_camaro_crosseyed.html index 0b1ed1d1..d4cc2f19 100644 --- a/examples/webgl_materials_cars_camaro_crosseyed.html +++ b/examples/webgl_materials_cars_camaro_crosseyed.html @@ -79,20 +79,20 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x555555 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00 ); pointLight.position.x = 0; pointLight.position.y = 0; pointLight.position.z = 0; - scene.addLight( pointLight ); + scene.add( pointLight ); sphere = new THREE.SphereGeometry( 100, 16, 8, 1 ); @@ -101,7 +101,7 @@ lightMesh.position = pointLight.position; lightMesh.overdraw = true; lightMesh.updateMatrix(); - scene.addObject(lightMesh); + scene.add(lightMesh); webglRenderer = new THREE.CrosseyedWebGLRenderer( { separation: 20, antialias: true } ); @@ -195,7 +195,7 @@ var mesh = new THREE.Mesh( geometry, m ); mesh.rotation.y = 1; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); createButtons( materials.body, geometry ); diff --git a/examples/webgl_materials_cubemap.html b/examples/webgl_materials_cubemap.html index ccca0afe..f10d61da 100644 --- a/examples/webgl_materials_cubemap.html +++ b/examples/webgl_materials_cubemap.html @@ -84,17 +84,17 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0xffffff ); - scene.addLight( ambient ); + scene.add( ambient ); pointLight = new THREE.PointLight( 0xffffff, 2 ); - scene.addLight( pointLight ); + scene.add( pointLight ); // light representation sphere = new THREE.SphereGeometry( 100, 16, 8 ); lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color:0xffaa00 } ) ); lightMesh.position = pointLight.position; lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05; - scene.addObject(lightMesh); + scene.add(lightMesh); var path = "textures/cube/SwedishRoyalCastle/"; var format = '.jpg'; @@ -127,7 +127,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 10, 10, 10, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // @@ -156,19 +156,19 @@ var mesh = new THREE.Mesh( geometry, m1 ); mesh.position.z = - 100; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); var mesh = new THREE.Mesh( geometry, m2 ); mesh.position.x = - 900; mesh.position.z = - 100; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); var mesh = new THREE.Mesh( geometry, m3 ); mesh.position.x = 900; mesh.position.z = - 100; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); loader.statusDomElement.style.display = "none"; diff --git a/examples/webgl_materials_cubemap_balls_reflection.html b/examples/webgl_materials_cubemap_balls_reflection.html index 593ee4fc..ea744d27 100644 --- a/examples/webgl_materials_cubemap_balls_reflection.html +++ b/examples/webgl_materials_cubemap_balls_reflection.html @@ -97,7 +97,7 @@ mesh.position.y = Math.random() * 10000 - 5000; mesh.position.z = Math.random() * 10000 - 5000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.addObject( mesh ); + scene.add( mesh ); spheres.push( mesh ); @@ -117,7 +117,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // diff --git a/examples/webgl_materials_cubemap_balls_reflection_anaglyph.html b/examples/webgl_materials_cubemap_balls_reflection_anaglyph.html index 70654537..b8736c75 100644 --- a/examples/webgl_materials_cubemap_balls_reflection_anaglyph.html +++ b/examples/webgl_materials_cubemap_balls_reflection_anaglyph.html @@ -93,7 +93,7 @@ mesh.position.y = Math.random() * 10000 - 5000; mesh.position.z = Math.random() * 10000 - 5000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.addObject( mesh ); + scene.add( mesh ); spheres.push( mesh ); @@ -113,7 +113,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - scene.addObject( mesh ); + scene.add( mesh ); // diff --git a/examples/webgl_materials_cubemap_balls_refraction.html b/examples/webgl_materials_cubemap_balls_refraction.html index 21da2bbc..b806b3a7 100644 --- a/examples/webgl_materials_cubemap_balls_refraction.html +++ b/examples/webgl_materials_cubemap_balls_refraction.html @@ -96,7 +96,7 @@ mesh.position.y = Math.random() * 10000 - 5000; mesh.position.z = Math.random() * 10000 - 5000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.addObject( mesh ); + scene.add( mesh ); spheres.push( mesh ); @@ -116,7 +116,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // diff --git a/examples/webgl_materials_cubemap_balls_refraction_crosseyed.html b/examples/webgl_materials_cubemap_balls_refraction_crosseyed.html index b462212c..ff98ef68 100644 --- a/examples/webgl_materials_cubemap_balls_refraction_crosseyed.html +++ b/examples/webgl_materials_cubemap_balls_refraction_crosseyed.html @@ -95,7 +95,7 @@ mesh.position.y = Math.random() * 10000 - 5000; mesh.position.z = Math.random() * 10000 - 5000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.addObject( mesh ); + scene.add( mesh ); spheres.push( mesh ); @@ -115,7 +115,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - scene.addObject( mesh ); + scene.add( mesh ); // diff --git a/examples/webgl_materials_cubemap_escher.html b/examples/webgl_materials_cubemap_escher.html index 49d57561..4410d283 100644 --- a/examples/webgl_materials_cubemap_escher.html +++ b/examples/webgl_materials_cubemap_escher.html @@ -85,7 +85,7 @@ var mesh = new THREE.Mesh( geometry, material ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 16; - scene.addObject( mesh ); + scene.add( mesh ); // Skybox @@ -101,7 +101,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 6000, 6000, 6000, 1, 1, 1, null, true ), material ); - scene.addObject( mesh ); + scene.add( mesh ); // diff --git a/examples/webgl_materials_cubemap_refraction.html b/examples/webgl_materials_cubemap_refraction.html index 1401454b..40fb599e 100644 --- a/examples/webgl_materials_cubemap_refraction.html +++ b/examples/webgl_materials_cubemap_refraction.html @@ -82,10 +82,10 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0xffffff ); - scene.addLight( ambient ); + scene.add( ambient ); pointLight = new THREE.PointLight( 0xffffff, 2 ); - scene.addLight( pointLight ); + scene.add( pointLight ); // light representation @@ -93,7 +93,7 @@ lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color:0xffaa00 } ) ); lightMesh.position = pointLight.position; lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05; - scene.addObject(lightMesh); + scene.add(lightMesh); // material samples @@ -123,7 +123,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // @@ -154,19 +154,19 @@ var mesh = new THREE.Mesh( geometry, m1 ); mesh.position.z = z; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); var mesh = new THREE.Mesh( geometry, m2 ); mesh.position.x = - 900; mesh.position.z = z; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); var mesh = new THREE.Mesh( geometry, m3 ); mesh.position.x = 900; mesh.position.z = z; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); loader.statusDomElement.style.display = "none"; diff --git a/examples/webgl_materials_grass.html b/examples/webgl_materials_grass.html index ba37262c..165dfe7a 100644 --- a/examples/webgl_materials_grass.html +++ b/examples/webgl_materials_grass.html @@ -50,7 +50,7 @@ mesh.materials[0].map.needsUpdate = true; mesh.rotation.x = - 90 * ( Math.PI / 180 ); mesh.position.y = i * 0.25; - scene.addObject( mesh ); + scene.add( mesh ); } diff --git a/examples/webgl_materials_normalmap.html b/examples/webgl_materials_normalmap.html index fc932ed9..67b4014a 100644 --- a/examples/webgl_materials_normalmap.html +++ b/examples/webgl_materials_normalmap.html @@ -92,18 +92,18 @@ // LIGHTS ambientLight = new THREE.AmbientLight( 0x111111 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); pointLight = new THREE.PointLight( 0xffff55 ); pointLight.position.z = 10000; - scene.addLight( pointLight ); + scene.add( pointLight ); directionalLight = new THREE.DirectionalLight( 0xaaaa88 ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); // light representation @@ -111,7 +111,7 @@ lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) ); lightMesh.position = pointLight.position; lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05; - scene.addObject(lightMesh); + scene.add(lightMesh); // common material parameters @@ -176,12 +176,12 @@ mesh1 = new THREE.Mesh( geometry, material1 ); mesh1.position.x = - scale * 12; mesh1.scale.set( scale, scale, scale ); - scene.addObject( mesh1 ); + scene.add( mesh1 ); mesh2 = new THREE.Mesh( geometry, material2 ); mesh2.position.x = scale * 12; mesh2.scale.set( scale, scale, scale ); - scene.addObject( mesh2 ); + scene.add( mesh2 ); loader.statusDomElement.style.display = "none"; diff --git a/examples/webgl_materials_normalmap2.html b/examples/webgl_materials_normalmap2.html index 67f54f6d..104bca69 100644 --- a/examples/webgl_materials_normalmap2.html +++ b/examples/webgl_materials_normalmap2.html @@ -95,19 +95,19 @@ // LIGHTS ambientLight = new THREE.AmbientLight( 0x444444 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); pointLight = new THREE.PointLight( 0xffffff ); pointLight.position.z = 600; - scene.addLight( pointLight ); + scene.add( pointLight ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = - 1; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); // material parameters @@ -164,7 +164,7 @@ mesh1 = new THREE.Mesh( geometry, material ); mesh1.position.y = - 50; mesh1.scale.x = mesh1.scale.y = mesh1.scale.z = scale; - scene.addObject( mesh1 ); + scene.add( mesh1 ); loader.statusDomElement.style.display = "none"; diff --git a/examples/webgl_materials_shaders.html b/examples/webgl_materials_shaders.html index 034d7259..046312b9 100644 --- a/examples/webgl_materials_shaders.html +++ b/examples/webgl_materials_shaders.html @@ -86,7 +86,7 @@ mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); } @@ -104,15 +104,15 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x101010 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.set( 1, 1, 2 ); directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffffff ); - scene.addLight( pointLight ); + scene.add( pointLight ); // light representation @@ -121,7 +121,7 @@ lightMesh.scale.set( 0.05, 0.05, 0.05 ); lightMesh.position = pointLight.position; lightMesh.overdraw = true; - scene.addObject( lightMesh ); + scene.add( lightMesh ); // material samples diff --git a/examples/webgl_materials_shaders_fresnel.html b/examples/webgl_materials_shaders_fresnel.html index d02ecd3d..9c6ac114 100644 --- a/examples/webgl_materials_shaders_fresnel.html +++ b/examples/webgl_materials_shaders_fresnel.html @@ -107,7 +107,7 @@ mesh.position.y = Math.random() * 10000 - 5000; mesh.position.z = Math.random() * 10000 - 5000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.addObject( mesh ); + scene.add( mesh ); spheres.push( mesh ); @@ -129,7 +129,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // diff --git a/examples/webgl_materials_texture_filters.html b/examples/webgl_materials_texture_filters.html index 372d2bdd..79e059f2 100644 --- a/examples/webgl_materials_texture_filters.html +++ b/examples/webgl_materials_texture_filters.html @@ -147,8 +147,8 @@ texturePainting2.image = image; texturePainting2.needsUpdate = true; - scene.addObject( meshCanvas ); - scene2.addObject( meshCanvas2 ); + scene.add( meshCanvas ); + scene2.add( meshCanvas2 ); var geometry = new THREE.PlaneGeometry( 100, 100 ), mesh = new THREE.Mesh( geometry, materialPainting ), @@ -162,14 +162,14 @@ zmesh.scale.x = image.width / 100; zmesh.scale.y = image.height / 100; - zscene.addObject( zmesh ); + zscene.add( zmesh ); var meshFrame = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x000000, polygonOffset: true, polygonOffsetFactor: 1, polygonOffsetUnits: 5 } ) ); meshFrame.scale.x = 1.1 * image.width / 100; meshFrame.scale.y = 1.1 * image.height / 100; - zscene.addObject( meshFrame ); + zscene.add( meshFrame ); var meshShadow = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.9, transparent: true } ) ); @@ -177,7 +177,7 @@ meshShadow.scale.x = 1.1 * image.width / 100; meshShadow.scale.y = 1.1 * image.height / 100; meshShadow.rotation.x = -Math.PI / 2; - zscene.addObject( meshShadow ); + zscene.add( meshShadow ); meshShadow.position.y = - 1.1 * image.height/2; diff --git a/examples/webgl_materials_video.html b/examples/webgl_materials_video.html index 7306cc2e..a6637270 100644 --- a/examples/webgl_materials_video.html +++ b/examples/webgl_materials_video.html @@ -97,7 +97,7 @@ var light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0.5, 1, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); renderer = new THREE.WebGLRenderer( { antialias: false } ); renderer.setSize( window.innerWidth, window.innerHeight ); @@ -160,7 +160,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; - scene.addObject(mesh); + scene.add(mesh); mesh.dx = 0.001 * ( 0.5 - Math.random() ); mesh.dy = 0.001 * ( 0.5 - Math.random() ); diff --git a/examples/webgl_morphtargets.html b/examples/webgl_morphtargets.html index 0a48affb..6b395610 100644 --- a/examples/webgl_morphtargets.html +++ b/examples/webgl_morphtargets.html @@ -103,10 +103,10 @@ var light = new THREE.PointLight( 0xff2200 ); light.position.set( 100, 100, 100 ); - scene.addLight( light ); + scene.add( light ); var light = new THREE.AmbientLight( 0x333333 ); - scene.addLight( light ); + scene.add( light ); var geometry = new THREE.CubeGeometry( 100, 100, 100 ); @@ -138,7 +138,7 @@ mesh = new THREE.Mesh( geometry, material ); - scene.addChild( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer( { clearColor:0x222222, clearAlpha: 1 } ); diff --git a/examples/webgl_morphtargets_horse.html b/examples/webgl_morphtargets_horse.html index e6488821..f4fa049a 100644 --- a/examples/webgl_morphtargets_horse.html +++ b/examples/webgl_morphtargets_horse.html @@ -52,21 +52,21 @@ light.position.y = 1; light.position.z = 1; light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var light = new THREE.DirectionalLight( 0xffefef, 2 ); light.position.x = - 1; light.position.y = - 1; light.position.z = - 1; light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var loader = new THREE.JSONLoader( true ); loader.load( { model: "models/animated/horse.js", callback: function( geometry ) { mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0x606060, morphTargets: true } ) ); mesh.scale.set( 1.5, 1.5, 1.5 ); - scene.addObject( mesh ); + scene.add( mesh ); } } ); diff --git a/examples/webgl_multiple_canvases_complex.html b/examples/webgl_multiple_canvases_complex.html index a2f03934..c4c2366c 100755 --- a/examples/webgl_multiple_canvases_complex.html +++ b/examples/webgl_multiple_canvases_complex.html @@ -129,7 +129,7 @@ light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var shadowMaterial = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } ); var shadowGeo = new THREE.PlaneGeometry( 300, 300, 1, 1 ); @@ -137,19 +137,19 @@ mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = - 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); var faceIndices = [ 'a', 'b', 'c', 'd' ]; @@ -204,19 +204,19 @@ mesh.position.x = -400; mesh.scale.x = mesh.scale.y = mesh.scale.z = 200; mesh.rotation.x = -1.87; - scene.addObject( mesh ); + scene.add( mesh ); mesh2 = new THREE.Mesh( geometry2, materials ); mesh2.position.x = 400; mesh2.rotation.x = 0; mesh2.scale = mesh.scale; - scene.addObject( mesh2 ); + scene.add( mesh2 ); mesh3 = new THREE.Mesh( geometry3, materials ); mesh3.position.x = 0; mesh3.rotation.x = 0; mesh3.scale = mesh.scale; - scene.addObject( mesh3 ); + scene.add( mesh3 ); renderer = new THREE.WebGLRenderer( { antialias: true } ); renderer.setSize( container.clientWidth, container.clientHeight ); diff --git a/examples/webgl_multiple_canvases_grid.html b/examples/webgl_multiple_canvases_grid.html index 32d7bb96..e56ca605 100755 --- a/examples/webgl_multiple_canvases_grid.html +++ b/examples/webgl_multiple_canvases_grid.html @@ -145,7 +145,7 @@ light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var shadowMaterial = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } ); var shadowGeo = new THREE.PlaneGeometry( 300, 300, 1, 1 ); @@ -153,19 +153,19 @@ mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = - 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); var faceIndices = [ 'a', 'b', 'c', 'd' ]; @@ -220,19 +220,19 @@ mesh.position.x = -400; mesh.scale.x = mesh.scale.y = mesh.scale.z = 200; mesh.rotation.x = -1.87; - scene.addObject( mesh ); + scene.add( mesh ); mesh2 = new THREE.Mesh( geometry2, materials ); mesh2.position.x = 400; mesh2.rotation.x = 0; mesh2.scale = mesh.scale; - scene.addObject( mesh2 ); + scene.add( mesh2 ); mesh3 = new THREE.Mesh( geometry3, materials ); mesh3.position.x = 0; mesh3.rotation.x = 0; mesh3.scale = mesh.scale; - scene.addObject( mesh3 ); + scene.add( mesh3 ); renderer = new THREE.WebGLRenderer( { antialias: true } ); renderer.setSize( container.clientWidth, container.clientHeight ); diff --git a/examples/webgl_objconvert_test.html b/examples/webgl_objconvert_test.html index 5e3508e7..ed8efece 100644 --- a/examples/webgl_objconvert_test.html +++ b/examples/webgl_objconvert_test.html @@ -116,7 +116,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 10; mesh.doubleSided = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); // SPHERES @@ -132,7 +132,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.25 * (Math.random() + 0.5); mesh.overdraw = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); } @@ -140,16 +140,13 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x221100 ); - scene.addLight( ambient ); + scene.add( ambient ); var directionalLight = new THREE.DirectionalLight( 0xffeedd ); directionalLight.position.y = -70; directionalLight.position.z = 100; directionalLight.position.normalize(); - scene.addLight( directionalLight ); - - var pointLight = new THREE.PointLight( 0xff0000, 1 ); - //scene.addLight( pointLight ); + scene.add( directionalLight ); if ( render_gl ) { @@ -201,7 +198,7 @@ zmesh.scale.x = zmesh.scale.y = zmesh.scale.z = 3; zmesh.overdraw = true; zmesh.updateMatrix(); - scene.addObject(zmesh); + scene.add(zmesh); createMaterialsPalette( geometry.materials, 100, b ); @@ -220,7 +217,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; mesh.doubleSided = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); // number @@ -243,7 +240,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; mesh.doubleSided = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); } diff --git a/examples/webgl_panorama_equirectangular.html b/examples/webgl_panorama_equirectangular.html index 6b8e7e2f..f2cb686c 100644 --- a/examples/webgl_panorama_equirectangular.html +++ b/examples/webgl_panorama_equirectangular.html @@ -61,7 +61,7 @@ mesh = new THREE.Mesh( new THREE.SphereGeometry( 500, 60, 40 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/2294472375_24a3b8ef46_o.jpg' ) } ) ); mesh.scale.x = -1; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_particles_billboards.html b/examples/webgl_particles_billboards.html index 2c43f6e2..f898bba1 100644 --- a/examples/webgl_particles_billboards.html +++ b/examples/webgl_particles_billboards.html @@ -87,13 +87,13 @@ particles = new THREE.ParticleSystem( geometry, material ); particles.sortParticles = true; particles.updateMatrix(); - scene.addObject( particles ); + scene.add( particles ); var light = new THREE.DirectionalLight( 0xffffff ); light.position.x = 0; light.position.y = 0; light.position.z = 1; - scene.addLight( light ); + scene.add( light ); renderer = new THREE.WebGLRenderer( { clearAlpha: 1 }); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_particles_billboards_colors.html b/examples/webgl_particles_billboards_colors.html index 646e882b..6bb37e54 100644 --- a/examples/webgl_particles_billboards_colors.html +++ b/examples/webgl_particles_billboards_colors.html @@ -91,13 +91,13 @@ particles = new THREE.ParticleSystem( geometry, material ); particles.sortParticles = true; particles.updateMatrix(); - scene.addObject( particles ); + scene.add( particles ); var light = new THREE.DirectionalLight( 0xffffff ); light.position.x = 0; light.position.y = 0; light.position.z = 1; - scene.addLight( light ); + scene.add( light ); renderer = new THREE.WebGLRenderer( { clearAlpha: 1 } ); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_particles_dynamic.html b/examples/webgl_particles_dynamic.html index 28412c67..ac4979fc 100644 --- a/examples/webgl_particles_dynamic.html +++ b/examples/webgl_particles_dynamic.html @@ -94,7 +94,7 @@ directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.set( 0, 0, 1 ); directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); aloader = new THREE.JSONLoader( ); bloader = new THREE.BinaryLoader( true ); @@ -155,12 +155,12 @@ // parent = new THREE.Object3D(); - scene.addObject( parent ); + scene.add( parent ); var grid = new THREE.ParticleSystem( new THREE.PlaneGeometry( 15000, 15000, 64, 64 ), new THREE.ParticleBasicMaterial( { color: 0xff0000, size: 10 } ) ); grid.rotation.x = 1.57; grid.position.y = -400; - parent.addChild( grid ); + parent.add( grid ); totaln += 1; total += grid.geometry.vertices.length; @@ -254,7 +254,7 @@ mesh.position.y = y + clones[ i ][ 1 ]; mesh.position.z = z + clones[ i ][ 2 ]; - parent.addChild( mesh ); + parent.add( mesh ); clonemeshes.push( { mesh: mesh, speed: 0.5 + Math.random() } ); @@ -272,7 +272,7 @@ mesh.position.y = y; mesh.position.z = z; - parent.addChild( mesh ); + parent.add( mesh ); totaln += 1; total += vl; diff --git a/examples/webgl_particles_random.html b/examples/webgl_particles_random.html index 9c729c00..b47fad74 100644 --- a/examples/webgl_particles_random.html +++ b/examples/webgl_particles_random.html @@ -93,7 +93,7 @@ particles.rotation.x = Math.random() * 6; particles.rotation.y = Math.random() * 6; particles.rotation.z = Math.random() * 6; - scene.addObject( particles ); + scene.add( particles ); } diff --git a/examples/webgl_particles_sprites.html b/examples/webgl_particles_sprites.html index 981605a1..48527e97 100644 --- a/examples/webgl_particles_sprites.html +++ b/examples/webgl_particles_sprites.html @@ -98,7 +98,7 @@ particles.rotation.x = Math.random() * 6; particles.rotation.y = Math.random() * 6; particles.rotation.z = Math.random() * 6; - scene.addObject( particles ); + scene.add( particles ); } diff --git a/examples/webgl_performance.html b/examples/webgl_performance.html index 18864c18..3e5cd9c8 100644 --- a/examples/webgl_performance.html +++ b/examples/webgl_performance.html @@ -72,7 +72,7 @@ //mesh.frustumCulled = false; - scene.addObject( mesh ); + scene.add( mesh ); } diff --git a/examples/webgl_postprocessing.html b/examples/webgl_postprocessing.html index cce2d076..b82b2e03 100644 --- a/examples/webgl_postprocessing.html +++ b/examples/webgl_postprocessing.html @@ -129,7 +129,7 @@ directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.set( 0, 0, 1 ); directionalLight.position.normalize(); - sceneModel.addLight( directionalLight ); + sceneModel.add( directionalLight ); loader = new THREE.JSONLoader( true ); document.body.appendChild( loader.statusDomElement ); @@ -153,7 +153,7 @@ quadBG = new THREE.Mesh( plane, materialColor ); quadBG.position.z = -500; quadBG.scale.set( window.innerWidth, window.innerHeight, 1 ); - sceneBG.addObject( quadBG ); + sceneBG.add( quadBG ); // @@ -164,7 +164,7 @@ quadMask = new THREE.Mesh( plane, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) ); quadMask.position.z = -300; quadMask.scale.set( window.innerWidth / 2, window.innerHeight/2, 1 ); - sceneMask.addObject( quadMask ); + sceneMask.add( quadMask ); // @@ -360,7 +360,7 @@ mesh.position.set( 0, -50, 0 ); mesh.scale.set( scale, scale, scale ); - scene.addObject( mesh ); + scene.add( mesh ); loader.statusDomElement.style.display = "none"; diff --git a/examples/webgl_postprocessing_dof.html b/examples/webgl_postprocessing_dof.html index abd51301..ad1bf71d 100644 --- a/examples/webgl_postprocessing_dof.html +++ b/examples/webgl_postprocessing_dof.html @@ -147,7 +147,7 @@ mesh.matrixAutoUpdate = false; mesh.updateMatrix(); - scene.addObject( mesh ); + scene.add( mesh ); objects.push( mesh ); c++; @@ -260,7 +260,7 @@ postprocessing.quad = new THREE.Mesh( new THREE.PlaneGeometry( window.innerWidth, window.innerHeight ), postprocessing.materialBokeh ); postprocessing.quad.position.z = - 500; - postprocessing.scene.addObject( postprocessing.quad ); + postprocessing.scene.add( postprocessing.quad ); } diff --git a/examples/webgl_ribbons.html b/examples/webgl_ribbons.html index 1ddf4505..f23d605f 100644 --- a/examples/webgl_ribbons.html +++ b/examples/webgl_ribbons.html @@ -167,7 +167,7 @@ ribbon.boundRadiusScale = Math.max( ribbon.scale.x, Math.max( ribbon.scale.y, ribbon.scale.z ) ); ribbons.push( ribbon ); - scene.addObject( ribbon ); + scene.add( ribbon ); c ++; diff --git a/examples/webgl_rtt.html b/examples/webgl_rtt.html index a87f55e5..b6beb2ff 100644 --- a/examples/webgl_rtt.html +++ b/examples/webgl_rtt.html @@ -121,12 +121,12 @@ var light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - sceneRTT.addLight( light ); + sceneRTT.add( light ); light = new THREE.DirectionalLight( 0xffaaaa, 1.5 ); light.position.set( 0, 0, -1 ); light.position.normalize(); - sceneRTT.addLight( light ); + sceneRTT.add( light ); rtTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBFormat } ); @@ -152,13 +152,13 @@ quad = new THREE.Mesh( plane, material ); quad.position.z = -100; - sceneRTT.addObject( quad ); + sceneRTT.add( quad ); createMesh( new THREE.TorusGeometry( 100, 25, 15, 30 ), sceneRTT ); quad = new THREE.Mesh( plane, materialScreen ); quad.position.z = -100; - sceneScreen.addObject( quad ); + sceneScreen.add( quad ); var n = 5, geometry = new THREE.SphereGeometry( 10, 64, 32 ), @@ -176,7 +176,7 @@ mesh.rotation.y = 1.57; - scene.addObject( mesh ); + scene.add( mesh ); } } @@ -204,12 +204,12 @@ zmesh1 = new THREE.Mesh( geometry, mat1 ); zmesh1.position.set( 0, 0, 100 ); zmesh1.scale.set( 1.5, 1.5, 1.5 ); - xscene.addObject( zmesh1 ); + xscene.add( zmesh1 ); zmesh2 = new THREE.Mesh( geometry, mat2 ); zmesh2.position.set( 0, 150, 100 ); zmesh2.scale.set( 0.75, 0.75, 0.75 ); - xscene.addObject( zmesh2 ); + xscene.add( zmesh2 ); } diff --git a/examples/webgl_sandbox.html b/examples/webgl_sandbox.html index 4430b3c0..fdd7f93d 100644 --- a/examples/webgl_sandbox.html +++ b/examples/webgl_sandbox.html @@ -230,7 +230,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 4 + 1; mesh.matrixAutoUpdate = false; mesh.updateMatrix(); - scene.addObject( mesh ); + scene.add( mesh ); } diff --git a/examples/webgl_scene_test.html b/examples/webgl_scene_test.html index 12ed7e8a..209ffcc5 100644 --- a/examples/webgl_scene_test.html +++ b/examples/webgl_scene_test.html @@ -372,18 +372,18 @@ object.rotation.z = Math.random() * 6; object.matrixAutoUpdate = false; object.updateMatrix(); - result.scene.addObject( object ); + result.scene.add( object ); } result.scene.matrixAutoUpdate = false; light = new THREE.PointLight( 0xffffff ); - result.scene.addLight( light ); + result.scene.add( light ); light = new THREE.DirectionalLight( 0x111111 ); light.position.x = 1; - result.scene.addLight( light ); + result.scene.add( light ); return result; diff --git a/examples/webgl_scene_test_blender.html b/examples/webgl_scene_test_blender.html index b0614148..fdcb97db 100644 --- a/examples/webgl_scene_test_blender.html +++ b/examples/webgl_scene_test_blender.html @@ -337,18 +337,18 @@ object.rotation.z = Math.random() * 6; object.matrixAutoUpdate = false; object.updateMatrix(); - result.scene.addObject( object ); + result.scene.add( object ); } result.scene.matrixAutoUpdate = false; light = new THREE.PointLight( 0xffffff ); - result.scene.addLight( light ); + result.scene.add( light ); light = new THREE.DirectionalLight( 0x111111 ); light.position.x = 1; - result.scene.addLight( light ); + result.scene.add( light ); return result; diff --git a/examples/webgl_shader.html b/examples/webgl_shader.html index 434bb11c..8235c91a 100644 --- a/examples/webgl_shader.html +++ b/examples/webgl_shader.html @@ -126,7 +126,7 @@ } ); mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), material ); - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer(); container.appendChild( renderer.domElement ); diff --git a/examples/webgl_shader2.html b/examples/webgl_shader2.html index ed0f5e75..fdc3b3f0 100644 --- a/examples/webgl_shader2.html +++ b/examples/webgl_shader2.html @@ -231,7 +231,7 @@ mesh = new THREE.Mesh( new THREE.CubeGeometry( size, size, size, 1, 1, 1, [ mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ] ], false ), new THREE.MeshFaceMaterial() ); mesh.position.x = i - ( params.length - 1 ) / 2; mesh.position.y = i % 2 - 0.5; - scene.addObject( mesh ); + scene.add( mesh ); meshes[ i ] = mesh; diff --git a/examples/webgl_shader_lava.html b/examples/webgl_shader_lava.html index 1c2b22ae..879e6496 100644 --- a/examples/webgl_shader_lava.html +++ b/examples/webgl_shader_lava.html @@ -175,7 +175,7 @@ mesh.position.x = 0; mesh.position.y = 0; mesh.rotation.x = 0.3; - scene.addObject( mesh ); + scene.add( mesh ); // diff --git a/examples/webgl_shadowmap.html b/examples/webgl_shadowmap.html index c6049fe1..9fdad2c6 100644 --- a/examples/webgl_shadowmap.html +++ b/examples/webgl_shadowmap.html @@ -91,13 +91,13 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x444444 ); - scene.addLight( ambient ); + scene.add( ambient ); light = new THREE.SpotLight( 0xffffff ); light.position.set( 0, 1500, 1000 ); light.target.position.set( 0, 0, 0 ); light.castShadow = true; - scene.addLight( light ); + scene.add( light ); createHUD(); createScene(); @@ -151,7 +151,7 @@ hudMesh.position.y = ( SCREEN_HEIGHT - SHADOW_MAP_HEIGHT / 2 ) * -0.5; sceneHUD = new THREE.Scene(); - sceneHUD.addObject( hudMesh ); + sceneHUD.add( hudMesh ); } @@ -172,7 +172,7 @@ ground.castShadow = false; ground.receiveShadow = true; - scene.addObject( ground ); + scene.add( ground ); // TEXT @@ -204,7 +204,7 @@ mesh.castShadow = true; mesh.receiveShadow = true; - scene.addObject( mesh ); + scene.add( mesh ); // CUBES @@ -216,7 +216,7 @@ mesh.castShadow = true; mesh.receiveShadow = true; - scene.addObject( mesh ); + scene.add( mesh ); var mesh = new THREE.Mesh( new THREE.CubeGeometry( 1600, 170, 250 ), planeMaterial ); @@ -226,7 +226,7 @@ mesh.castShadow = true; mesh.receiveShadow = true; - scene.addObject( mesh ); + scene.add( mesh ); // MORPHS @@ -244,7 +244,7 @@ meshAnim.castShadow = true; meshAnim.receiveShadow = false; - scene.addObject( meshAnim ); + scene.add( meshAnim ); morphs.push( { mesh: meshAnim, lastKeyframe: 0, currentKeyframe: 0, offset: Math.random() * 6, speed: speed, duration: duration, diff --git a/examples/webgl_sprites.html b/examples/webgl_sprites.html index 9e08903f..660860a2 100644 --- a/examples/webgl_sprites.html +++ b/examples/webgl_sprites.html @@ -71,27 +71,27 @@ sprite.position.normalize(); sprite.position.multiplyScalar( radius ); - group.addChild( sprite ); + group.add( sprite ); } - scene.addChild( group ); + scene.add( group ); // add 2d-sprites sprite = new THREE.Sprite( { map: mapA, alignment:THREE.SpriteAlignment.topLeft } ); sprite.position.set( 100, 100, 0 ); sprite.opacity = 0.25; - scene.addChild( sprite ); + scene.add( sprite ); sprite = new THREE.Sprite( { map: mapA, alignment:THREE.SpriteAlignment.topLeft } ); sprite.position.set( 150, 150, 2 ); sprite.opacity = 0.5; - scene.addChild( sprite ); + scene.add( sprite ); sprite = new THREE.Sprite( { map: mapA, alignment:THREE.SpriteAlignment.topLeft } ); sprite.position.set( 200, 200, 3 ); sprite.opacity = 1; - scene.addChild( sprite ); + scene.add( sprite ); // renderer diff --git a/examples/webgl_test_memory.html b/examples/webgl_test_memory.html index c5beee56..0dd2e3d8 100644 --- a/examples/webgl_test_memory.html +++ b/examples/webgl_test_memory.html @@ -78,11 +78,11 @@ var mesh = new THREE.Mesh( geometry, material ); - scene.addObject( mesh ); + scene.add( mesh ); renderer.render( scene, camera ); - scene.removeObject( mesh ); + scene.remove( mesh ); renderer.deallocateObject( mesh ); renderer.deallocateTexture( texture ); diff --git a/examples/webgl_trackballcamera_earth.html b/examples/webgl_trackballcamera_earth.html index d0f5718c..4005d6af 100644 --- a/examples/webgl_trackballcamera_earth.html +++ b/examples/webgl_trackballcamera_earth.html @@ -126,10 +126,7 @@ dirLight = new THREE.DirectionalLight( 0xFFFFFF ); dirLight.position.set( -1, 0, 1 ); dirLight.position.normalize(); - scene.addLight( dirLight ); - - ambientLight = new THREE.AmbientLight( 0xFFFFFF ); - //scene.addLight( ambientLight ); + scene.add( dirLight ); var planetTexture = THREE.ImageUtils.loadTexture( "textures/planets/earth_atmos_2048.jpg" ), cloudsTexture = THREE.ImageUtils.loadTexture( "textures/planets/earth_clouds_1024.png" ), @@ -172,7 +169,7 @@ meshPlanet = new THREE.Mesh( geometry, materialNormalMap ); meshPlanet.rotation.y = 1.3; meshPlanet.rotation.z = tilt; - scene.addObject( meshPlanet ); + scene.add( meshPlanet ); // clouds @@ -182,7 +179,7 @@ meshClouds = new THREE.Mesh( geometry, materialClouds ); meshClouds.scale.set( cloudsScale, cloudsScale, cloudsScale ); meshClouds.rotation.z = tilt; - scene.addObject( meshClouds ); + scene.add( meshClouds ); // moon @@ -192,7 +189,7 @@ meshMoon = new THREE.Mesh( geometry, materialMoon ); meshMoon.position.set( radius * 5, 0, 0 ); meshMoon.scale.set( moonScale, moonScale, moonScale ); - scene.addObject( meshMoon ); + scene.add( meshMoon ); // stars @@ -234,7 +231,7 @@ stars.matrixAutoUpdate = false; stars.updateMatrix(); - scene.addObject( stars ); + scene.add( stars ); } diff --git a/examples/webgl_utf8loader.html b/examples/webgl_utf8loader.html index dd8b5562..12860e8d 100644 --- a/examples/webgl_utf8loader.html +++ b/examples/webgl_utf8loader.html @@ -90,12 +90,12 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x221100 ); - scene.addLight( ambient ); + scene.add( ambient ); var directionalLight = new THREE.DirectionalLight( 0xffeedd ); directionalLight.position.set( 0, 0, 1 ); directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); // RENDERER @@ -137,7 +137,7 @@ mesh.position.set( x, y, z ); mesh.scale.set( s, s, s ); - scene.addObject( mesh ); + scene.add( mesh ); } diff --git a/src/Three.js b/src/Three.js index f593c83e..602a36a8 100644 --- a/src/Three.js +++ b/src/Three.js @@ -4,9 +4,9 @@ var THREE = THREE || {}; -if ( ! window.Int32Array ) { +if ( ! self.Int32Array ) { - window.Int32Array = Array; - window.Float32Array = Array; + self.Int32Array = Array; + self.Float32Array = Array; } diff --git a/src/core/Vector3.js b/src/core/Vector3.js index c3792d13..dfabfbcc 100644 --- a/src/core/Vector3.js +++ b/src/core/Vector3.js @@ -29,6 +29,30 @@ THREE.Vector3.prototype = { }, + setX: function ( x ) { + + this.x = x; + + return this; + + }, + + setY: function ( y ) { + + this.y = y; + + return this; + + }, + + setZ: function ( z ) { + + this.z = z; + + return this; + + }, + copy: function ( v ) { this.x = v.x; diff --git a/src/extras/geometries/CylinderGeometry.js b/src/extras/geometries/CylinderGeometry.js index 491d7087..4c898900 100644 --- a/src/extras/geometries/CylinderGeometry.js +++ b/src/extras/geometries/CylinderGeometry.js @@ -1,151 +1,131 @@ /** - * @author kile / http://kile.stravaganza.org/ * @author mr.doob / http://mrdoob.com/ - * @author fuzzthink */ -THREE.CylinderGeometry = function ( numSegs, topRad, botRad, height, topOffset, botOffset ) { +THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRadius, segmentsHeight, openEnded ) { THREE.Geometry.call( this ); - var scope = this, i, PI2 = Math.PI * 2, halfHeight = height / 2; + var radiusTop = radiusTop != null ? radiusTop : 20; + var radiusBottom = radiusBottom != null ? radiusBottom : 20; + var height = height || 100; + var heightHalf = height / 2; + var segmentsX = segmentsRadius || 8; + var segmentsY = segmentsHeight || 1; - // Top circle vertices + var x, y, vertices = [], uvs = []; - for ( i = 0; i < numSegs; i ++ ) { + for ( y = 0; y <= segmentsY; y ++ ) { - v( Math.sin( PI2 * i / numSegs ) * topRad, Math.cos( PI2 * i / numSegs ) * topRad, - halfHeight ); + var verticesRow = []; + var uvsRow = []; + + var v = y / segmentsY; + var radius = v * ( radiusBottom - radiusTop ) + radiusTop; + + for ( x = 0; x <= segmentsX; x ++ ) { + + var u = x / segmentsX; + + var xpos = radius * Math.sin( u * Math.PI * 2 ); + var ypos = - v * height + heightHalf; + var zpos = radius * Math.cos( u * Math.PI * 2 ); + + this.vertices.push( new THREE.Vertex( new THREE.Vector3( xpos, ypos, zpos ) ) ); + + verticesRow.push( this.vertices.length - 1 ); + uvsRow.push( new THREE.UV( u, v ) ); + + } + + vertices.push( verticesRow ); + uvs.push( uvsRow ); } - // Bottom circle vertices + for ( y = 0; y < segmentsY; y ++ ) { - for ( i = 0; i < numSegs; i ++ ) { + for ( x = 0; x < segmentsX; x ++ ) { - v( Math.sin( PI2 * i / numSegs ) * botRad, Math.cos( PI2 * i / numSegs ) * botRad, halfHeight ); + var v1 = vertices[ y ][ x ]; + var v2 = vertices[ y + 1 ][ x ]; + var v3 = vertices[ y + 1 ][ x + 1 ]; + var v4 = vertices[ y ][ x + 1 ]; - } + var n1 = this.vertices[ v1 ].position.clone().setY( 0 ).normalize(); + var n2 = this.vertices[ v2 ].position.clone().setY( 0 ).normalize(); + var n3 = this.vertices[ v3 ].position.clone().setY( 0 ).normalize(); + var n4 = this.vertices[ v4 ].position.clone().setY( 0 ).normalize(); - // Body faces - - var na, nb, nc, nd; - - var nz = topRad - botRad; - - for ( i = 0; i < numSegs; i++ ) { - - na = new THREE.Vector3(); - na.copy( scope.vertices[ i ].position ); - na.z = nz; - na.normalize(); - - nb = new THREE.Vector3(); - nb.copy( scope.vertices[ i + numSegs ].position ); - nb.z = nz; - nb.normalize(); - - nc = new THREE.Vector3(); - nc.copy( scope.vertices[ numSegs + ( i + 1 ) % numSegs ].position ); - nc.z = nz; - nc.normalize(); - - nd = new THREE.Vector3(); - nd.copy( scope.vertices[ ( i + 1 ) % numSegs ].position ); - nd.z = nz; - nd.normalize(); - - f4n( i, - i + numSegs, - numSegs + ( i + 1 ) % numSegs, - ( i + 1 ) % numSegs, - na, nb, nc, nd - ); - - } - - // Bottom circle faces - - if ( botRad > 0 ) { - - var nbottom = new THREE.Vector3( 0, 0, -1 ); - - v( 0, 0, - halfHeight - ( botOffset || 0 ) ); - - for ( i = numSegs; i < numSegs + ( numSegs / 2 ); i++ ) { - - f4n( 2 * numSegs, - ( 2 * i - 2 * numSegs ) % numSegs, - ( 2 * i - 2 * numSegs + 1 ) % numSegs, - ( 2 * i - 2 * numSegs + 2 ) % numSegs, - nbottom, nbottom, nbottom, nbottom - ); + var uv1 = uvs[ y ][ x ].clone(); + var uv2 = uvs[ y + 1 ][ x ].clone(); + var uv3 = uvs[ y + 1 ][ x + 1 ].clone(); + var uv4 = uvs[ y ][ x + 1 ].clone(); + this.faces.push( new THREE.Face4( v1, v2, v3, v4, [ n1, n2, n3, n4 ] ) ); + this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3, uv4 ] ); } } - // Top circle faces + // top cap - if ( topRad > 0 ) { + if ( !openEnded && radiusTop > 0 ) { - var ntop = new THREE.Vector3( 0, 0, 1 ); + this.vertices.push( new THREE.Vertex( new THREE.Vector3( 0, heightHalf, 0 ) ) ); - v( 0, 0, halfHeight + ( topOffset || 0 ) ); + for ( x = 0; x < segmentsX; x ++ ) { - for ( i = numSegs + ( numSegs / 2 ); i < 2 * numSegs; i ++ ) { + var v1 = vertices[ 0 ][ x ]; + var v2 = vertices[ 0 ][ x + 1 ]; + var v3 = this.vertices.length - 1; - f4n( 2 * numSegs + 1, - ( 2 * i - 2 * numSegs + 2 ) % numSegs + numSegs, - ( 2 * i - 2 * numSegs + 1 ) % numSegs + numSegs, - ( 2 * i - 2 * numSegs ) % numSegs + numSegs, - ntop, ntop, ntop, ntop - ); + var n1 = new THREE.Vector3( 0, 1, 0 ); + var n2 = new THREE.Vector3( 0, 1, 0 ); + var n3 = new THREE.Vector3( 0, 1, 0 ); + + var uv1 = uvs[ 0 ][ x ].clone(); + var uv2 = uvs[ 0 ][ x + 1 ].clone(); + var uv3 = new THREE.UV( uv2.u, 0 ); + + this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) ); + this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] ); } } - // Cylindrical mapping + // bottom cap - for ( var i = 0, il = this.faces.length; i < il; i ++ ) { + if ( !openEnded && radiusBottom > 0 ) { - var uvs = [], face = this.faces[ i ], - a = this.vertices[ face.a ], - b = this.vertices[ face.b ], - c = this.vertices[ face.c ], - d = this.vertices[ face.d ]; + this.vertices.push( new THREE.Vertex( new THREE.Vector3( 0, - heightHalf, 0 ) ) ); - uvs.push( new THREE.UV( 0.5 + Math.atan2( a.position.x, a.position.y ) / PI2, 0.5 + ( a.position.z / height ) ) ); - uvs.push( new THREE.UV( 0.5 + Math.atan2( b.position.x, b.position.y ) / PI2, 0.5 + ( b.position.z / height ) ) ); - uvs.push( new THREE.UV( 0.5 + Math.atan2( c.position.x, c.position.y ) / PI2, 0.5 + ( c.position.z / height ) ) ); + for ( x = 0; x < segmentsX; x ++ ) { - if ( face instanceof THREE.Face4 ) { + var v1 = vertices[ y ][ x + 1 ]; + var v2 = vertices[ y ][ x ]; + var v3 = this.vertices.length - 1; - uvs.push( new THREE.UV( 0.5 + ( Math.atan2( d.position.x, d.position.y ) / PI2 ), 0.5 + ( d.position.z / height ) ) ); + var n1 = new THREE.Vector3( 0, - 1, 0 ); + var n2 = new THREE.Vector3( 0, - 1, 0 ); + var n3 = new THREE.Vector3( 0, - 1, 0 ); + + var uv1 = uvs[ y ][ x + 1 ].clone(); + var uv2 = uvs[ y ][ x ].clone(); + var uv3 = new THREE.UV( uv2.u, 1 ); + + this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) ); + this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] ); } - this.faceVertexUvs[ 0 ].push( uvs ); - } this.computeCentroids(); this.computeFaceNormals(); - function v( x, y, z ) { - - scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); - - } - - function f4n( a, b, c, d, na, nb, nc, nd ) { - - scope.faces.push( new THREE.Face4( a, b, c, d, [ na, nb, nc, nd ] ) ); - - } - -}; - +} THREE.CylinderGeometry.prototype = new THREE.Geometry(); THREE.CylinderGeometry.prototype.constructor = THREE.CylinderGeometry; diff --git a/src/extras/geometries/TextGeometry.js b/src/extras/geometries/TextGeometry.js index de1a3469..cfea4892 100644 --- a/src/extras/geometries/TextGeometry.js +++ b/src/extras/geometries/TextGeometry.js @@ -568,4 +568,4 @@ THREE.FontUtils = { })(THREE.FontUtils); // To use the typeface.js face files, hook up the API -window._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace }; +self._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace }; diff --git a/src/extras/loaders/SceneLoader.js b/src/extras/loaders/SceneLoader.js index 239dc6b9..32195f24 100644 --- a/src/extras/loaders/SceneLoader.js +++ b/src/extras/loaders/SceneLoader.js @@ -502,7 +502,7 @@ THREE.SceneLoader.prototype = { } else if ( g.type == "cylinder" ) { - geometry = new THREE.CylinderGeometry( g.numSegs, g.topRad, g.botRad, g.height, g.topOffset, g.botOffset ); + geometry = new THREE.CylinderGeometry( g.topRad, g.botRad, g.height, g.radSegs, g.heightSegs ); result.geometries[ dg ] = geometry; } else if ( g.type == "torus" ) { diff --git a/src/extras/objects/Trident.js b/src/extras/objects/Trident.js index 6dfcf652..f2623260 100644 --- a/src/extras/objects/Trident.js +++ b/src/extras/objects/Trident.js @@ -1,77 +1,50 @@ /** * @author sroucheray / http://sroucheray.org/ + * @author mr.doob / http://mrdoob.com/ */ -/** - * @constructor - * Three axis representing the cartesian coordinates - * @param xAxisColor {number} - * @param yAxisColor {number} - * @param zAxisColor {number} - * @param showArrows {Boolean} - * @param length {number} - * @param scale {number} - * - * @see THREE.Trident.defaultParams - */ -THREE.Trident = function ( params /** Object */) { +THREE.Trident = function () { THREE.Object3D.call( this ); - - var hPi = Math.PI / 2, cone; - - params = params || THREE.Trident.defaultParams; - - if(params !== THREE.Trident.defaultParams){ - for ( var key in THREE.Trident.defaultParams) { - if(!params.hasOwnProperty(key)){ - params[key] = THREE.Trident.defaultParams[key]; - } - } - } - - this.scale = new THREE.Vector3( params.scale, params.scale, params.scale ); - this.addChild( getSegment( new THREE.Vector3(params.length,0,0), params.xAxisColor ) ); - this.addChild( getSegment( new THREE.Vector3(0,params.length,0), params.yAxisColor ) ); - this.addChild( getSegment( new THREE.Vector3(0,0,params.length), params.zAxisColor ) ); - - if(params.showArrows){ - cone = getCone(params.xAxisColor); - cone.rotation.y = - hPi; - cone.position.x = params.length; - this.addChild( cone ); - - cone = getCone(params.yAxisColor); - cone.rotation.x = hPi; - cone.position.y = params.length; - this.addChild( cone ); - - cone = getCone(params.zAxisColor); - cone.rotation.y = Math.PI; - cone.position.z = params.length; - this.addChild( cone ); - } - function getCone ( color ) { - //0.1 required to get a cone with a mapped bottom face - return new THREE.Mesh( new THREE.CylinderGeometry( 30, 0.1, params.length / 20, params.length / 5 ), new THREE.MeshBasicMaterial( { color : color } ) ); - } + var lineGeometry = new THREE.Geometry(); + lineGeometry.vertices.push( new THREE.Vertex() ); + lineGeometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 0, 100, 0 ) ) ); + + var coneGeometry = new THREE.CylinderGeometry( 0, 5, 25, 5, 1 ); + + // x + + var line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color : 0xff0000 } ) ); + line.rotation.z = - Math.PI / 2; + this.add( line ); + + var cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color : 0xff0000 } ) ); + cone.position.x = 100; + cone.rotation.z = - Math.PI / 2; + this.add( cone ); + + // y + + var line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color : 0x00ff00 } ) ); + this.add( line ); + + var cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color : 0x00ff00 } ) ); + cone.position.y = 100; + this.add( cone ); + + // z + + var line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color : 0x0000ff } ) ); + line.rotation.x = Math.PI / 2; + this.add( line ); + + var cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color : 0x0000ff } ) ); + cone.position.z = 100; + cone.rotation.x = Math.PI / 2; + this.add( cone ); - function getSegment ( point, color ){ - var geom = new THREE.Geometry(); - geom.vertices = [new THREE.Vertex(), new THREE.Vertex(point)]; - return new THREE.Line( geom, new THREE.LineBasicMaterial( { color : color } ) ); - } }; THREE.Trident.prototype = new THREE.Object3D(); THREE.Trident.prototype.constructor = THREE.Trident; - -THREE.Trident.defaultParams = { - xAxisColor : 0xFF0000, - yAxisColor : 0x00FF00, - zAxisColor : 0x0000FF, - showArrows : true, - length : 100, - scale : 1 -};