Răsfoiți Sursa

Merge remote-tracking branch 'alteredq/unflip' into dev

Mr.doob 13 ani în urmă
părinte
comite
d5b863e702
34 a modificat fișierele cu 373 adăugiri și 382 ștergeri
  1. 72 71
      build/Three.js
  2. 113 113
      build/custom/ThreeCanvas.js
  3. 10 10
      build/custom/ThreeExtras.js
  4. 104 104
      build/custom/ThreeWebGL.js
  5. 3 6
      examples/misc_ubiquity_test.html
  6. 0 2
      examples/webgl_animation_skinning.html
  7. 2 4
      examples/webgl_geometries.html
  8. 6 8
      examples/webgl_geometries2.html
  9. 2 2
      examples/webgl_geometry_tessellation.html
  10. 4 4
      examples/webgl_loader_ctm_materials.html
  11. 1 2
      examples/webgl_loader_vtk.html
  12. 2 2
      examples/webgl_materials_cars.html
  13. 2 2
      examples/webgl_materials_cars_anaglyph.html
  14. 2 2
      examples/webgl_materials_cars_parallaxbarrier.html
  15. 2 2
      examples/webgl_materials_cubemap.html
  16. 2 2
      examples/webgl_materials_cubemap_balls_reflection.html
  17. 2 2
      examples/webgl_materials_cubemap_balls_reflection_anaglyph.html
  18. 2 2
      examples/webgl_materials_cubemap_balls_refraction.html
  19. 2 2
      examples/webgl_materials_cubemap_balls_refraction_crosseyed.html
  20. 2 2
      examples/webgl_materials_cubemap_escher.html
  21. 2 2
      examples/webgl_materials_cubemap_refraction.html
  22. 2 2
      examples/webgl_materials_shaders_fresnel.html
  23. 1 2
      examples/webgl_materials_skin.html
  24. 2 4
      examples/webgl_performance_doublesided.html
  25. 1 2
      examples/webgl_ribbons.html
  26. 1 3
      examples/webgl_shading_physical.html
  27. 2 5
      src/core/Object3D.js
  28. 0 3
      src/extras/SceneUtils.js
  29. 1 1
      src/extras/renderers/plugins/DepthPassPlugin.js
  30. 0 2
      src/extras/renderers/plugins/ShadowMapPlugin.js
  31. 12 0
      src/loaders/Loader.js
  32. 0 1
      src/loaders/SceneLoader.js
  33. 3 0
      src/materials/Material.js
  34. 11 11
      src/renderers/WebGLRenderer.js

+ 72 - 71
build/Three.js

@@ -5,7 +5,7 @@ function(a){clearTimeout(a)}})();THREE.NoShading=0;THREE.FlatShading=1;THREE.Smo
 THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;
 THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;
 THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.Clock=function(a){this.autoStart=a!==void 0?a:true;this.elapsedTime=this.oldTime=this.startTime=0;this.running=false};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=true};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=false};
-THREE.Clock.prototype.getElapsedTime=function(){return this.elapsedTime=this.elapsedTime+this.getDelta()};THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime=this.elapsedTime+a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
+THREE.Clock.prototype.getElapsedTime=function(){return this.elapsedTime=this.elapsedTime+this.getDelta()};THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime=this.elapsedTime+a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);
 this.b=Math.sqrt(this.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,f;if(c===0)this.r=this.g=this.b=0;else{d=Math.floor(a*6);e=a*6-d;a=c*(1-b);f=c*(1-b*e);b=c*(1-b*(1-e));if(d===0){this.r=c;this.g=b;this.b=a}else if(d===1){this.r=f;this.g=c;this.b=a}else if(d===2){this.r=a;this.g=c;this.b=b}else if(d===3){this.r=a;this.g=f;this.b=c}else if(d===4){this.r=b;this.g=a;this.b=c}else if(d===5){this.r=c;this.g=a;this.b=f}}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},lerpSelf:function(a,b){this.r=this.r+(a.r-this.r)*b;this.g=this.g+(a.g-this.g)*b;this.b=this.b+(a.b-this.b)*b;return this},getHex:function(){return Math.floor(this.r*255)<<16^Math.floor(this.g*255)<<8^Math.floor(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)}};
@@ -27,7 +27,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{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=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
 a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(Math.abs(d-g)<0.01&&Math.abs(f-c)<0.01&&Math.abs(i-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(f+c)<0.1&&Math.abs(i+b)<0.1&&Math.abs(e+h+j-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;if(e>h&&e>j)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(h>
-j)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=i/c}else if(j<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(j);b=f/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};
+j)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=i/c}else if(j<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(j);b=f/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],l=c[8],m=c[9],n=c[10],p=c[11],r=c[12],o=c[13],q=c[14],c=c[15];b[0].set(f-a,j-g,p-l,c-r);b[1].set(f+a,j+g,p+l,c+r);b[2].set(f+d,j+h,p+m,c+o);b[3].set(f-d,j-h,p-m,c-o);b[4].set(f-e,j-i,p-n,c-q);b[5].set(f+e,j+i,p+n,c+q);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;e<6;e++){b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
@@ -67,8 +67,8 @@ a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]
 return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=
 0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
 a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};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=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
-true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
+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.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=true;this.quaternion=new THREE.Quaternion;
+this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.setEulerFromRotationMatrix((new THREE.Matrix4).extractRotation(this.matrix),this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
@@ -78,12 +78,12 @@ THREE.Projector=function(){function a(a,c){g=0;C.objects.length=0;C.sprites.leng
 THREE.Light&&C.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)e(a.children[c])}};e(a);c===true&&C.objects.sort(d);return C}function b(){var a;if(g===h.length){a=new THREE.RenderableObject;h.push(a)}else a=h[g];g++;return a}function c(){var a;if(j===l.length){a=new THREE.RenderableVertex;l.push(a)}else a=l[j];j++;return a}function d(a,b){return b.z-a.z}function e(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;
 f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,g,h=[],i,j,l=[],m,n,p=[],r,o=[],q,s,x=[],t,w,z=[],C={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,A=new THREE.Vector4,u=new THREE.Matrix4,H=new THREE.Matrix4,J=new THREE.Frustum,M=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);u.multiply(b.projectionMatrix,
 b.matrixWorldInverse);u.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);u.multiply(b.matrixWorld,b.projectionMatrixInverse);u.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectScene=function(b,f,g){var h=f.near,F=f.far,E=false,X,N,Z,ca,I,da,ia,W,U,P,Y,ga,na,Ha,
-oa;w=s=r=n=0;C.elements.length=0;if(f.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");b.add(f)}b.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);u.multiply(f.projectionMatrix,f.matrixWorldInverse);J.setFromMatrix(u);C=a(b,false);b=0;for(X=C.objects.length;b<X;b++){U=C.objects[b].object;P=U.matrixWorld;j=0;if(U instanceof THREE.Mesh){Y=U.geometry;ga=U.geometry.materials;ca=Y.vertices;na=Y.faces;Ha=Y.faceVertexUvs;Y=U.matrixRotationWorld.extractRotation(P);
-N=0;for(Z=ca.length;N<Z;N++){i=c();i.positionWorld.copy(ca[N]);P.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);u.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>h&&i.positionScreen.z<F}ca=0;for(N=na.length;ca<N;ca++){Z=na[ca];if(Z instanceof THREE.Face3){I=l[Z.a];da=l[Z.b];ia=l[Z.c];if(I.visible===true&&da.visible===true&&ia.visible===true){E=(ia.positionScreen.x-
-I.positionScreen.x)*(da.positionScreen.y-I.positionScreen.y)-(ia.positionScreen.y-I.positionScreen.y)*(da.positionScreen.x-I.positionScreen.x)<0;if(U.doubleSided===true||E!==U.flipSided){W=void 0;if(n===p.length){W=new THREE.RenderableFace3;p.push(W)}else W=p[n];n++;m=W;m.v1.copy(I);m.v2.copy(da);m.v3.copy(ia)}else continue}else continue}else if(Z instanceof THREE.Face4){I=l[Z.a];da=l[Z.b];ia=l[Z.c];W=l[Z.d];if(I.visible===true&&da.visible===true&&ia.visible===true&&W.visible===true){E=(W.positionScreen.x-
-I.positionScreen.x)*(da.positionScreen.y-I.positionScreen.y)-(W.positionScreen.y-I.positionScreen.y)*(da.positionScreen.x-I.positionScreen.x)<0||(da.positionScreen.x-ia.positionScreen.x)*(W.positionScreen.y-ia.positionScreen.y)-(da.positionScreen.y-ia.positionScreen.y)*(W.positionScreen.x-ia.positionScreen.x)<0;if(U.doubleSided===true||E!==U.flipSided){oa=void 0;if(r===o.length){oa=new THREE.RenderableFace4;o.push(oa)}else oa=o[r];r++;m=oa;m.v1.copy(I);m.v2.copy(da);m.v3.copy(ia);m.v4.copy(W)}else continue}else continue}m.normalWorld.copy(Z.normal);
-E===false&&(U.flipSided===true||U.doubleSided===true)&&m.normalWorld.negate();Y.multiplyVector3(m.normalWorld);m.centroidWorld.copy(Z.centroid);P.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);u.multiplyVector3(m.centroidScreen);ia=Z.vertexNormals;I=0;for(da=ia.length;I<da;I++){W=m.vertexNormalsWorld[I];W.copy(ia[I]);E===false&&(U.flipSided===true||U.doubleSided===true)&&W.negate();Y.multiplyVector3(W)}I=0;for(da=Ha.length;I<da;I++){oa=Ha[I][ca];if(oa!==void 0){ia=0;for(W=
-oa.length;ia<W;ia++)m.uvs[I][ia]=oa[ia]}}m.material=U.material;m.faceMaterial=Z.materialIndex!==null?ga[Z.materialIndex]:null;m.z=m.centroidScreen.z;C.elements.push(m)}}else if(U instanceof THREE.Line){H.multiply(u,P);ca=U.geometry.vertices;I=c();I.positionScreen.copy(ca[0]);H.multiplyVector4(I.positionScreen);P=U.type===THREE.LinePieces?2:1;N=1;for(Z=ca.length;N<Z;N++){I=c();I.positionScreen.copy(ca[N]);H.multiplyVector4(I.positionScreen);if(!((N+1)%P>0)){da=l[j-2];M.copy(I.positionScreen);O.copy(da.positionScreen);
+oa;w=s=r=n=0;C.elements.length=0;b.updateMatrixWorld();f.parent===void 0&&f.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);u.multiply(f.projectionMatrix,f.matrixWorldInverse);J.setFromMatrix(u);C=a(b,false);b=0;for(X=C.objects.length;b<X;b++){U=C.objects[b].object;P=U.matrixWorld;j=0;if(U instanceof THREE.Mesh){Y=U.geometry;ga=U.geometry.materials;ca=Y.vertices;na=Y.faces;Ha=Y.faceVertexUvs;Y=U.matrixRotationWorld.extractRotation(P);N=0;for(Z=ca.length;N<Z;N++){i=c();i.positionWorld.copy(ca[N]);
+P.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);u.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>h&&i.positionScreen.z<F}ca=0;for(N=na.length;ca<N;ca++){Z=na[ca];if(Z instanceof THREE.Face3){I=l[Z.a];da=l[Z.b];ia=l[Z.c];if(I.visible===true&&da.visible===true&&ia.visible===true){E=(ia.positionScreen.x-I.positionScreen.x)*(da.positionScreen.y-I.positionScreen.y)-
+(ia.positionScreen.y-I.positionScreen.y)*(da.positionScreen.x-I.positionScreen.x)<0;if(U.doubleSided===true||E!==U.flipSided){W=void 0;if(n===p.length){W=new THREE.RenderableFace3;p.push(W)}else W=p[n];n++;m=W;m.v1.copy(I);m.v2.copy(da);m.v3.copy(ia)}else continue}else continue}else if(Z instanceof THREE.Face4){I=l[Z.a];da=l[Z.b];ia=l[Z.c];W=l[Z.d];if(I.visible===true&&da.visible===true&&ia.visible===true&&W.visible===true){E=(W.positionScreen.x-I.positionScreen.x)*(da.positionScreen.y-I.positionScreen.y)-
+(W.positionScreen.y-I.positionScreen.y)*(da.positionScreen.x-I.positionScreen.x)<0||(da.positionScreen.x-ia.positionScreen.x)*(W.positionScreen.y-ia.positionScreen.y)-(da.positionScreen.y-ia.positionScreen.y)*(W.positionScreen.x-ia.positionScreen.x)<0;if(U.doubleSided===true||E!==U.flipSided){oa=void 0;if(r===o.length){oa=new THREE.RenderableFace4;o.push(oa)}else oa=o[r];r++;m=oa;m.v1.copy(I);m.v2.copy(da);m.v3.copy(ia);m.v4.copy(W)}else continue}else continue}m.normalWorld.copy(Z.normal);E===false&&
+(U.flipSided===true||U.doubleSided===true)&&m.normalWorld.negate();Y.multiplyVector3(m.normalWorld);m.centroidWorld.copy(Z.centroid);P.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);u.multiplyVector3(m.centroidScreen);ia=Z.vertexNormals;I=0;for(da=ia.length;I<da;I++){W=m.vertexNormalsWorld[I];W.copy(ia[I]);E===false&&(U.flipSided===true||U.doubleSided===true)&&W.negate();Y.multiplyVector3(W)}I=0;for(da=Ha.length;I<da;I++){oa=Ha[I][ca];if(oa!==void 0){ia=0;for(W=oa.length;ia<
+W;ia++)m.uvs[I][ia]=oa[ia]}}m.material=U.material;m.faceMaterial=Z.materialIndex!==null?ga[Z.materialIndex]:null;m.z=m.centroidScreen.z;C.elements.push(m)}}else if(U instanceof THREE.Line){H.multiply(u,P);ca=U.geometry.vertices;I=c();I.positionScreen.copy(ca[0]);H.multiplyVector4(I.positionScreen);P=U.type===THREE.LinePieces?2:1;N=1;for(Z=ca.length;N<Z;N++){I=c();I.positionScreen.copy(ca[N]);H.multiplyVector4(I.positionScreen);if(!((N+1)%P>0)){da=l[j-2];M.copy(I.positionScreen);O.copy(da.positionScreen);
 if(e(M,O)===true){M.multiplyScalar(1/M.w);O.multiplyScalar(1/O.w);ga=void 0;if(s===x.length){ga=new THREE.RenderableLine;x.push(ga)}else ga=x[s];s++;q=ga;q.v1.positionScreen.copy(M);q.v2.positionScreen.copy(O);q.z=Math.max(M.z,O.z);q.material=U.material;C.elements.push(q)}}}}}b=0;for(X=C.sprites.length;b<X;b++){U=C.sprites[b].object;P=U.matrixWorld;if(U instanceof THREE.Particle){A.set(P.elements[12],P.elements[13],P.elements[14],1);u.multiplyVector4(A);A.z=A.z/A.w;if(A.z>0&&A.z<1){h=void 0;if(w===
 z.length){h=new THREE.RenderableParticle;z.push(h)}else h=z[w];w++;t=h;t.object=U;t.x=A.x/A.w;t.y=A.y/A.w;t.z=A.z;t.rotation=U.rotation.z;t.scale.x=U.scale.x*Math.abs(t.x-(A.x+f.projectionMatrix.elements[0])/(A.w+f.projectionMatrix.elements[12]));t.scale.y=U.scale.y*Math.abs(t.y-(A.y+f.projectionMatrix.elements[5])/(A.w+f.projectionMatrix.elements[13]));t.material=U.material;C.elements.push(t)}}}g&&C.elements.sort(d);return C}};
 THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
@@ -92,9 +92,9 @@ c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="ZXY"){this.x=f*d*e-c*g*h;this.y=c*g*
 d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;if(j>0){c=0.5/Math.sqrt(j+1);this.w=0.25/c;this.x=(i-g)*c;this.y=(d-h)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+h)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-h)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
 (d+h)/c;this.y=(g+i)/c;this.z=0.25*c}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=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
 this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,
-f=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*e-h*d,l=i*d+h*c-f*e,m=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+l*-h-m*-g;b.y=l*i+c*-g+m*-f-j*-h;b.z=m*i+c*-h+j*-g-l*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
+f=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*e-h*d,l=i*d+h*c-f*e,m=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+l*-h-m*-g;b.y=l*i+c*-g+m*-f-j*-h;b.z=m*i+c*-h+j*-g-l*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
 this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
 THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
@@ -133,11 +133,11 @@ THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStat
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
 Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=h.crossOrigin;f.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
 d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var l=a.shading.toLowerCase();l==="phong"?i="MeshPhongMaterial":l==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.visible!==void 0)j.visible=a.visible;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=
-THREE.VertexColors;if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(j,"normalMap",
-a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(i.uniforms);l.tNormal.texture=j.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(j.map){l.tDiffuse.texture=j.map;l.enableDiffuse.value=true}if(j.specularMap){l.tSpecular.texture=j.specularMap;l.enableSpecular.value=true}if(j.lightMap){l.tAO.texture=
-j.lightMap;l.enableAO.value=true}l.uDiffuseColor.value.setHex(j.color);l.uSpecularColor.value.setHex(j.specular);l.uAmbientColor.value.setHex(j.ambient);l.uShininess.value=j.shininess;if(j.opacity!==void 0)l.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:l,lights:true,fog:true})}else j=new THREE[i](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
-THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
+if(a.shading){var l=a.shading.toLowerCase();l==="phong"?i="MeshPhongMaterial":l==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.visible!==void 0)j.visible=a.visible;if(a.doubleSided!==void 0)j.doubleSided=a.doubleSided;if(a.flipSided!==void 0)j.flipSided=a.flipSided;
+if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);
+a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(i.uniforms);l.tNormal.texture=j.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(j.map){l.tDiffuse.texture=
+j.map;l.enableDiffuse.value=true}if(j.specularMap){l.tSpecular.texture=j.specularMap;l.enableSpecular.value=true}if(j.lightMap){l.tAO.texture=j.lightMap;l.enableAO.value=true}l.uDiffuseColor.value.setHex(j.color);l.uSpecularColor.value.setHex(j.specular);l.uAmbientColor.value.setHex(j.ambient);l.uShininess.value=j.shininess;if(j.opacity!==void 0)l.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:l,lights:true,fog:true})}else j=
+new THREE[i](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
 f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
@@ -174,24 +174,25 @@ p;){var q=g[m++],s=q&2,f=q&4,x=q&8,t=q&16,r=q&32,w=q&64,o=q&128;if(q&1){q=new TH
 THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
 THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(n in B.objects)if(!N.objects[n]){s=B.objects[n];if(s.geometry!==void 0){if(J=N.geometries[s.geometry]){a=false;M=N.materials[s.materials[0]];(a=M instanceof THREE.ShaderMaterial)&&J.computeTangents();z=s.position;C=s.rotation;E=s.quaternion;A=s.scale;x=s.matrix;E=0;s.materials.length==0&&(M=new THREE.MeshFaceMaterial);s.materials.length>1&&(M=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(J,M);a.name=n;if(x){a.matrixAutoUpdate=false;a.matrix.set(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15])}else{a.position.set(z[0],z[1],z[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(C[0],C[1],C[2]);a.scale.set(A[0],A[1],A[2])}a.visible=s.visible;a.doubleSided=s.doubleSided;a.castShadow=s.castShadow;a.receiveShadow=s.receiveShadow;N.scene.add(a);N.objects[n]=a}}else{z=s.position;C=s.rotation;E=s.quaternion;
-A=s.scale;E=0;a=new THREE.Object3D;a.name=n;a.position.set(z[0],z[1],z[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(C[0],C[1],C[2]);a.scale.set(A[0],A[1],A[2]);a.visible=s.visible!==void 0?s.visible:false;N.scene.add(a);N.objects[n]=a;N.empties[n]=a}}}function f(a){return function(b){N.geometries[a]=b;e();Q=Q-1;i.onLoadComplete();h()}}function g(a){return function(b){N.geometries[a]=b}}function h(){i.callbackProgress({totalModels:ba,totalTextures:X,loadedModels:ba-
-Q,loadedTextures:X-F},N);i.onLoadProgress();Q===0&&F===0&&b(N)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),l,m,n,p,r,o,q,s,x,t,w,z,C,E,A,u,H,J,M,O,$,B,G,Q,F,ba,X,N;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;F=Q=0;N={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(B.transform){a=B.transform.position;t=B.transform.rotation;u=B.transform.scale;a&&N.scene.position.set(a[0],a[1],a[2]);t&&N.scene.rotation.set(t[0],t[1],
-t[2]);u&&N.scene.scale.set(u[0],u[1],u[2]);if(a||t||u){N.scene.updateMatrix();N.scene.updateMatrixWorld()}}a=function(a){return function(){F=F-a;h();i.onLoadComplete()}};for(r in B.cameras){u=B.cameras[r];u.type==="perspective"?O=new THREE.PerspectiveCamera(u.fov,u.aspect,u.near,u.far):u.type==="ortho"&&(O=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far));z=u.position;t=u.target;u=u.up;O.position.set(z[0],z[1],z[2]);O.target=new THREE.Vector3(t[0],t[1],t[2]);u&&O.up.set(u[0],
-u[1],u[2]);N.cameras[r]=O}for(p in B.lights){t=B.lights[p];r=t.color!==void 0?t.color:16777215;O=t.intensity!==void 0?t.intensity:1;if(t.type==="directional"){z=t.direction;w=new THREE.DirectionalLight(r,O);w.position.set(z[0],z[1],z[2]);w.position.normalize()}else if(t.type==="point"){z=t.position;w=t.distance;w=new THREE.PointLight(r,O,w);w.position.set(z[0],z[1],z[2])}else t.type==="ambient"&&(w=new THREE.AmbientLight(r));N.scene.add(w);N.lights[p]=w}for(o in B.fogs){p=B.fogs[o];p.type==="linear"?
-$=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&($=new THREE.FogExp2(0,p.density));u=p.color;$.color.setRGB(u[0],u[1],u[2]);N.fogs[o]=$}if(N.cameras&&B.defaults.camera)N.currentCamera=N.cameras[B.defaults.camera];if(N.fogs&&B.defaults.fog)N.scene.fog=N.fogs[B.defaults.fog];u=B.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(u[0],u[1],u[2]);N.bgColorAlpha=B.defaults.bgalpha;for(l in B.geometries){o=B.geometries[l];if(o.type=="bin_mesh"||o.type=="ascii_mesh"){Q=Q+1;i.onLoadStart()}}ba=
-Q;for(l in B.geometries){o=B.geometries[l];if(o.type==="cube"){J=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);N.geometries[l]=J}else if(o.type==="plane"){J=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight);N.geometries[l]=J}else if(o.type==="sphere"){J=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight);N.geometries[l]=J}else if(o.type==="cylinder"){J=new THREE.CylinderGeometry(o.topRad,
-o.botRad,o.height,o.radSegs,o.heightSegs);N.geometries[l]=J}else if(o.type==="torus"){J=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT);N.geometries[l]=J}else if(o.type==="icosahedron"){J=new THREE.IcosahedronGeometry(o.radius,o.subdivisions);N.geometries[l]=J}else if(o.type==="bin_mesh")c.load(d(o.url,B.urlBaseType),f(l));else if(o.type==="ascii_mesh")G.load(d(o.url,B.urlBaseType),f(l));else if(o.type==="embedded_mesh"){o=B.embeds[o.id];o.metadata=B.metadata;o&&G.createModel(o,g(l),
-"")}}for(q in B.textures){l=B.textures[q];if(l.url instanceof Array){F=F+l.url.length;for(o=0;o<l.url.length;o++)i.onLoadStart()}else{F=F+1;i.onLoadStart()}}X=F;for(q in B.textures){l=B.textures[q];if(l.mapping!==void 0&&THREE[l.mapping]!==void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){o=l.url.length;$=[];for(c=0;c<o;c++)$[c]=d(l.url[c],B.urlBaseType);o=THREE.ImageUtils.loadTextureCube($,l.mapping,a(o))}else{o=THREE.ImageUtils.loadTexture(d(l.url,B.urlBaseType),l.mapping,a(1));if(THREE[l.minFilter]!==
-void 0)o.minFilter=THREE[l.minFilter];if(THREE[l.magFilter]!==void 0)o.magFilter=THREE[l.magFilter];if(l.repeat){o.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!==1)o.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!==1)o.wrapT=THREE.RepeatWrapping}l.offset&&o.offset.set(l.offset[0],l.offset[1]);if(l.wrap){$={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if($[l.wrap[0]]!==void 0)o.wrapS=$[l.wrap[0]];if($[l.wrap[1]]!==void 0)o.wrapT=$[l.wrap[1]]}}N.textures[q]=o}for(m in B.materials){x=
-B.materials[m];for(H in x.parameters)if(H==="envMap"||H==="map"||H==="lightMap")x.parameters[H]=N.textures[x.parameters[H]];else if(H==="shading")x.parameters[H]=x.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H==="blending")x.parameters[H]=x.parameters[H]in THREE?THREE[x.parameters[H]]:THREE.NormalBlending;else if(H==="combine")x.parameters[H]=x.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==="vertexColors")if(x.parameters[H]=="face")x.parameters[H]=
-THREE.FaceColors;else if(x.parameters[H])x.parameters[H]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=true;if(x.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);l=x.parameters.color;o=x.parameters.specular;$=x.parameters.ambient;c=x.parameters.shininess;a.tNormal.texture=N.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)a.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map){a.tDiffuse.texture=
-x.parameters.map;a.enableDiffuse.value=true}if(x.parameters.lightMap){a.tAO.texture=x.parameters.lightMap;a.enableAO.value=true}if(x.parameters.specularMap){a.tSpecular.texture=N.textures[x.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(o);a.uAmbientColor.value.setHex($);a.uShininess.value=c;if(x.parameters.opacity)a.uOpacity.value=x.parameters.opacity;M=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,
-uniforms:a,lights:true,fog:true})}else M=new THREE[x.type](x.parameters);N.materials[m]=M}e();i.callbackSync(N);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+a=new THREE.Mesh(J,M);a.name=n;if(x){a.matrixAutoUpdate=false;a.matrix.set(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15])}else{a.position.set(z[0],z[1],z[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(C[0],C[1],C[2]);a.scale.set(A[0],A[1],A[2])}a.visible=s.visible;a.castShadow=s.castShadow;a.receiveShadow=s.receiveShadow;N.scene.add(a);N.objects[n]=a}}else{z=s.position;C=s.rotation;E=s.quaternion;A=s.scale;E=0;a=new THREE.Object3D;
+a.name=n;a.position.set(z[0],z[1],z[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(C[0],C[1],C[2]);a.scale.set(A[0],A[1],A[2]);a.visible=s.visible!==void 0?s.visible:false;N.scene.add(a);N.objects[n]=a;N.empties[n]=a}}}function f(a){return function(b){N.geometries[a]=b;e();Q=Q-1;i.onLoadComplete();h()}}function g(a){return function(b){N.geometries[a]=b}}function h(){i.callbackProgress({totalModels:ba,totalTextures:X,loadedModels:ba-Q,loadedTextures:X-F},N);
+i.onLoadProgress();Q===0&&F===0&&b(N)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),l,m,n,p,r,o,q,s,x,t,w,z,C,E,A,u,H,J,M,O,$,B,G,Q,F,ba,X,N;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;F=Q=0;N={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(B.transform){a=B.transform.position;t=B.transform.rotation;u=B.transform.scale;a&&N.scene.position.set(a[0],a[1],a[2]);t&&N.scene.rotation.set(t[0],t[1],t[2]);u&&N.scene.scale.set(u[0],
+u[1],u[2]);if(a||t||u){N.scene.updateMatrix();N.scene.updateMatrixWorld()}}a=function(a){return function(){F=F-a;h();i.onLoadComplete()}};for(r in B.cameras){u=B.cameras[r];u.type==="perspective"?O=new THREE.PerspectiveCamera(u.fov,u.aspect,u.near,u.far):u.type==="ortho"&&(O=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far));z=u.position;t=u.target;u=u.up;O.position.set(z[0],z[1],z[2]);O.target=new THREE.Vector3(t[0],t[1],t[2]);u&&O.up.set(u[0],u[1],u[2]);N.cameras[r]=O}for(p in B.lights){t=
+B.lights[p];r=t.color!==void 0?t.color:16777215;O=t.intensity!==void 0?t.intensity:1;if(t.type==="directional"){z=t.direction;w=new THREE.DirectionalLight(r,O);w.position.set(z[0],z[1],z[2]);w.position.normalize()}else if(t.type==="point"){z=t.position;w=t.distance;w=new THREE.PointLight(r,O,w);w.position.set(z[0],z[1],z[2])}else t.type==="ambient"&&(w=new THREE.AmbientLight(r));N.scene.add(w);N.lights[p]=w}for(o in B.fogs){p=B.fogs[o];p.type==="linear"?$=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&
+($=new THREE.FogExp2(0,p.density));u=p.color;$.color.setRGB(u[0],u[1],u[2]);N.fogs[o]=$}if(N.cameras&&B.defaults.camera)N.currentCamera=N.cameras[B.defaults.camera];if(N.fogs&&B.defaults.fog)N.scene.fog=N.fogs[B.defaults.fog];u=B.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(u[0],u[1],u[2]);N.bgColorAlpha=B.defaults.bgalpha;for(l in B.geometries){o=B.geometries[l];if(o.type=="bin_mesh"||o.type=="ascii_mesh"){Q=Q+1;i.onLoadStart()}}ba=Q;for(l in B.geometries){o=B.geometries[l];if(o.type===
+"cube"){J=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);N.geometries[l]=J}else if(o.type==="plane"){J=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight);N.geometries[l]=J}else if(o.type==="sphere"){J=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight);N.geometries[l]=J}else if(o.type==="cylinder"){J=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs);N.geometries[l]=
+J}else if(o.type==="torus"){J=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT);N.geometries[l]=J}else if(o.type==="icosahedron"){J=new THREE.IcosahedronGeometry(o.radius,o.subdivisions);N.geometries[l]=J}else if(o.type==="bin_mesh")c.load(d(o.url,B.urlBaseType),f(l));else if(o.type==="ascii_mesh")G.load(d(o.url,B.urlBaseType),f(l));else if(o.type==="embedded_mesh"){o=B.embeds[o.id];o.metadata=B.metadata;o&&G.createModel(o,g(l),"")}}for(q in B.textures){l=B.textures[q];if(l.url instanceof
+Array){F=F+l.url.length;for(o=0;o<l.url.length;o++)i.onLoadStart()}else{F=F+1;i.onLoadStart()}}X=F;for(q in B.textures){l=B.textures[q];if(l.mapping!==void 0&&THREE[l.mapping]!==void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){o=l.url.length;$=[];for(c=0;c<o;c++)$[c]=d(l.url[c],B.urlBaseType);o=THREE.ImageUtils.loadTextureCube($,l.mapping,a(o))}else{o=THREE.ImageUtils.loadTexture(d(l.url,B.urlBaseType),l.mapping,a(1));if(THREE[l.minFilter]!==void 0)o.minFilter=THREE[l.minFilter];if(THREE[l.magFilter]!==
+void 0)o.magFilter=THREE[l.magFilter];if(l.repeat){o.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!==1)o.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!==1)o.wrapT=THREE.RepeatWrapping}l.offset&&o.offset.set(l.offset[0],l.offset[1]);if(l.wrap){$={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if($[l.wrap[0]]!==void 0)o.wrapS=$[l.wrap[0]];if($[l.wrap[1]]!==void 0)o.wrapT=$[l.wrap[1]]}}N.textures[q]=o}for(m in B.materials){x=B.materials[m];for(H in x.parameters)if(H==="envMap"||H===
+"map"||H==="lightMap")x.parameters[H]=N.textures[x.parameters[H]];else if(H==="shading")x.parameters[H]=x.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H==="blending")x.parameters[H]=x.parameters[H]in THREE?THREE[x.parameters[H]]:THREE.NormalBlending;else if(H==="combine")x.parameters[H]=x.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==="vertexColors")if(x.parameters[H]=="face")x.parameters[H]=THREE.FaceColors;else if(x.parameters[H])x.parameters[H]=
+THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=true;if(x.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);l=x.parameters.color;o=x.parameters.specular;$=x.parameters.ambient;c=x.parameters.shininess;a.tNormal.texture=N.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)a.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map){a.tDiffuse.texture=x.parameters.map;a.enableDiffuse.value=
+true}if(x.parameters.lightMap){a.tAO.texture=x.parameters.lightMap;a.enableAO.value=true}if(x.parameters.specularMap){a.tSpecular.texture=N.textures[x.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(o);a.uAmbientColor.value.setHex($);a.uShininess.value=c;if(x.parameters.opacity)a.uOpacity.value=x.parameters.opacity;M=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else M=
+new THREE[x.type](x.parameters);N.materials[m]=M}e();i.callbackSync(N);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
-a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.visible=a.visible!==void 0?a.visible:true;this.needsUpdate=true};THREE.MaterialCount=0;
-THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
+a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.visible=a.visible!==void 0?a.visible:true;this.doubleSided=a.doubleSided!==void 0?a.doubleSided:false;
+this.flipSided=a.flipSided!==void 0?a.flipSided:false;this.needsUpdate=true};THREE.MaterialCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};
+THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
 true;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==
 void 0?a.morphTargets:false};THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype);
@@ -314,7 +315,7 @@ if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===
 g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(o)for(d=0;d<g;d++){e=h[d];f=d*3;m[f]=e.x;m[f+1]=e.y;m[f+2]=e.z}if(p)for(d=0;d<j;d++){e=i[d];f=d*3;l[f]=e.r;l[f+1]=e.g;l[f+2]=e.b}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===
 3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(o||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,m,b)}if(p||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
 l,b)}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function i(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){da=N=null;ca=I=U=W=oa=Ha=P=-1;Ta=true;a[d].render(b,c,ec,Sa);da=N=null;ca=I=U=W=oa=Ha=P=-1;Ta=true}}function j(a,b,c,d,f,e,g,h){var i,k,j,m;if(b){k=a.length-1;m=b=-1}else{k=0;b=a.length;m=1}for(var l=k;l!==b;l=l+m){i=
-a[l];if(i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);x(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(k);j instanceof THREE.BufferGeometry?F.renderBufferDirect(d,f,e,i,j,k):F.renderBuffer(d,f,e,i,j,k)}}}function l(a,b,c,d,f,e,g){for(var h,i,k=0,j=a.length;k<j;k++){h=a[k];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;
+a[l];if(i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);x(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setMaterialFaces(i);j instanceof THREE.BufferGeometry?F.renderBufferDirect(d,f,e,i,j,k):F.renderBuffer(d,f,e,i,j,k)}}}function l(a,b,c,d,f,e,g){for(var h,i,k=0,j=a.length;k<j;k++){h=a[k];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;
 e&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);x(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,f,h,i)}}}function m(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,b){for(var c=a.length-
 1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,f){if(d.needsUpdate){d.program&&F.deallocateMaterial(d);F.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==N){k.useProgram(g);N=g;e=true}if(d.id!==ca){ca=d.id;e=true}if(e||a!==da){k.uniformMatrix4fv(h.projectionMatrix,
 false,a._projectionMatrixArray);a!==da&&(da=a)}if(e){if(c&&d.fog){i.fogColor.value=c.color;if(c instanceof THREE.Fog){i.fogNear.value=c.near;i.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ta){for(var j,m=0,l=0,n=0,o,p,r,q=Aa,s=q.directional.colors,t=q.directional.positions,u=q.point.colors,x=q.point.positions,z=q.point.distances,C=q.spot.colors,B=q.spot.positions,I=q.spot.distances,
@@ -367,28 +368,28 @@ e.__webglColorBuffer);k.vertexAttribPointer(b.color,3,k.FLOAT,false,0,0)}if(b.no
 if(b.uv2>=0)if(e.__webglUV2Buffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer);k.vertexAttribPointer(b.uv2,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv2)}else k.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexABuffer);k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,
 false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==nb){k.lineWidth(d);nb=d}a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)}else{a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);
 k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)}F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+e.__webglFaceCount;F.info.render.faces=F.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;d=d.linewidth;if(d!==nb){k.lineWidth(d);nb=d}k.drawArrays(f,0,e.__webglLineCount);F.info.render.calls++}else if(f instanceof THREE.ParticleSystem){k.drawArrays(k.POINTS,0,e.__webglParticleCount);F.info.render.calls++;
-F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,h,m,n=a.__lights,o=a.fog;ca=-1;Ta=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=
-new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ta.multiply(b.projectionMatrix,b.matrixWorldInverse);Ea.setFromMatrix(ta);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;f.render=false;if(h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||Ea.contains(h))){s(h,b);var p=f,r=p.object,q=p.buffer,u=void 0,u=u=void 0,u=r.material;if(u instanceof THREE.MeshFaceMaterial){u=q.materialIndex;if(u>=0){u=r.geometry.materials[u];if(u.transparent){p.transparent=u;p.opaque=null}else{p.opaque=u;p.transparent=null}}}else if(u)if(u.transparent){p.transparent=
-u;p.opaque=null}else{p.opaque=u;p.transparent=null}f.render=true;if(this.sortObjects)if(h.renderDepth)f.z=h.renderDepth;else{ra.copy(h.matrixWorld.getPosition());ta.multiplyVector3(ra);f.z=ra.z}}}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;if(h.visible){s(h,b);h=f.object.material;if(h.transparent){f.transparent=h;f.opaque=null}else{f.opaque=h;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,
-d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);x(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,o,true,d);l(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,o,false);l(a.__webglObjectsImmediate,"opaque",b,n,o,false);j(a.__webglObjects,false,"transparent",b,n,o,true);l(a.__webglObjectsImmediate,"transparent",b,n,o,true)}i(this.renderPluginsPost,
-a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);I=
--1;F.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,k,Ea):e.render(function(a){F.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,j=void 0,l=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){j=
-g.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=j,s=void 0,u=void 0,t=void 0,w=void 0,x=void 0,z=void 0,A=void 0,C={},E=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(u=q.faces.length;s<u;s++){t=q.faces[s];w=t.materialIndex;z=w!==void 0?w:-1;C[z]===void 0&&(C[z]={hash:z,counter:0});A=C[z].hash+"_"+C[z].counter;q.geometryGroups[A]===void 0&&(q.geometryGroups[A]={faces3:[],faces4:[],materialIndex:w,vertices:0,numMorphTargets:E,numMorphNormals:B});
-x=t instanceof THREE.Face3?3:4;if(q.geometryGroups[A].vertices+x>65535){C[z].counter=C[z].counter+1;A=C[z].hash+"_"+C[z].counter;q.geometryGroups[A]===void 0&&(q.geometryGroups[A]={faces3:[],faces4:[],materialIndex:w,vertices:0,numMorphTargets:E,numMorphNormals:B})}t instanceof THREE.Face3?q.geometryGroups[A].faces3.push(s):q.geometryGroups[A].faces4.push(s);q.geometryGroups[A].vertices=q.geometryGroups[A].vertices+x}q.geometryGroupsList=[];var U=void 0;for(U in q.geometryGroups){q.geometryGroups[U].id=
-ia++;q.geometryGroupsList.push(q.geometryGroups[U])}}for(i in j.geometryGroups){l=j.geometryGroups[i];if(!l.__webglVertexBuffer){var I=l;I.__webglVertexBuffer=k.createBuffer();I.__webglNormalBuffer=k.createBuffer();I.__webglTangentBuffer=k.createBuffer();I.__webglColorBuffer=k.createBuffer();I.__webglUVBuffer=k.createBuffer();I.__webglUV2Buffer=k.createBuffer();I.__webglSkinVertexABuffer=k.createBuffer();I.__webglSkinVertexBBuffer=k.createBuffer();I.__webglSkinIndicesBuffer=k.createBuffer();I.__webglSkinWeightsBuffer=
-k.createBuffer();I.__webglFaceBuffer=k.createBuffer();I.__webglLineBuffer=k.createBuffer();var H=void 0,P=void 0;if(I.numMorphTargets){I.__webglMorphTargetsBuffers=[];H=0;for(P=I.numMorphTargets;H<P;H++)I.__webglMorphTargetsBuffers.push(k.createBuffer())}if(I.numMorphNormals){I.__webglMorphNormalsBuffers=[];H=0;for(P=I.numMorphNormals;H<P;H++)I.__webglMorphNormalsBuffers.push(k.createBuffer())}F.info.memory.geometries++;var G=l,J=g,Y=J.geometry,M=G.faces3,N=G.faces4,O=M.length*3+N.length*4,Z=M.length*
-1+N.length*2,W=M.length*3+N.length*4,Q=c(J,G),$=e(Q),X=d(Q),ca=Q.vertexColors?Q.vertexColors:false;G.__vertexArray=new Float32Array(O*3);if(X)G.__normalArray=new Float32Array(O*3);if(Y.hasTangents)G.__tangentArray=new Float32Array(O*4);if(ca)G.__colorArray=new Float32Array(O*3);if($){if(Y.faceUvs.length>0||Y.faceVertexUvs.length>0)G.__uvArray=new Float32Array(O*2);if(Y.faceUvs.length>1||Y.faceVertexUvs.length>1)G.__uv2Array=new Float32Array(O*2)}if(J.geometry.skinWeights.length&&J.geometry.skinIndices.length){G.__skinVertexAArray=
-new Float32Array(O*4);G.__skinVertexBArray=new Float32Array(O*4);G.__skinIndexArray=new Float32Array(O*4);G.__skinWeightArray=new Float32Array(O*4)}G.__faceArray=new Uint16Array(Z*3);G.__lineArray=new Uint16Array(W*2);var ga=void 0,da=void 0;if(G.numMorphTargets){G.__morphTargetsArrays=[];ga=0;for(da=G.numMorphTargets;ga<da;ga++)G.__morphTargetsArrays.push(new Float32Array(O*3))}if(G.numMorphNormals){G.__morphNormalsArrays=[];ga=0;for(da=G.numMorphNormals;ga<da;ga++)G.__morphNormalsArrays.push(new Float32Array(O*
-3))}G.__webglFaceCount=Z*3;G.__webglLineCount=W*2;if(Q.attributes){if(G.__webglCustomAttributesList===void 0)G.__webglCustomAttributesList=[];var ba=void 0;for(ba in Q.attributes){var oa=Q.attributes[ba],na={},bb;for(bb in oa)na[bb]=oa[bb];if(!na.__webglInitialized||na.createUniqueBuffers){na.__webglInitialized=true;var Ha=1;na.type==="v2"?Ha=2:na.type==="v3"?Ha=3:na.type==="v4"?Ha=4:na.type==="c"&&(Ha=3);na.size=Ha;na.array=new Float32Array(O*Ha);na.buffer=k.createBuffer();na.buffer.belongsToAttribute=
-ba;oa.needsUpdate=true;na.__original=oa}G.__webglCustomAttributesList.push(na)}}G.__inittedArrays=true;j.verticesNeedUpdate=true;j.morphTargetsNeedUpdate=true;j.elementsNeedUpdate=true;j.uvsNeedUpdate=true;j.normalsNeedUpdate=true;j.tangentsNeedUpdate=true;j.colorsNeedUpdate=true}}}else if(j instanceof THREE.BufferGeometry){var Pa=j,Qa=void 0,ra=void 0,ta=void 0;for(Qa in Pa.attributes){ta=Qa==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;ra=Pa.attributes[Qa];ra.buffer=k.createBuffer();k.bindBuffer(ta,
-ra.buffer);k.bufferData(ta,ra.array,k.STATIC_DRAW)}}}else if(g instanceof THREE.Ribbon){j=g.geometry;if(!j.__webglVertexBuffer){var Aa=j;Aa.__webglVertexBuffer=k.createBuffer();Aa.__webglColorBuffer=k.createBuffer();F.info.memory.geometries++;var Ea=j,Ga=Ea.vertices.length;Ea.__vertexArray=new Float32Array(Ga*3);Ea.__colorArray=new Float32Array(Ga*3);Ea.__webglVertexCount=Ga;j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){j=g.geometry;if(!j.__webglVertexBuffer){var nb=
-j;nb.__webglVertexBuffer=k.createBuffer();nb.__webglColorBuffer=k.createBuffer();F.info.memory.geometries++;var gb=j,Wa=g,Ta=gb.vertices.length;gb.__vertexArray=new Float32Array(Ta*3);gb.__colorArray=new Float32Array(Ta*3);gb.__webglLineCount=Ta;b(gb,Wa);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){j=g.geometry;if(!j.__webglVertexBuffer){var Za=j;Za.__webglVertexBuffer=k.createBuffer();Za.__webglColorBuffer=k.createBuffer();F.info.geometries++;var Sa=
-j,Ob=g,ob=Sa.vertices.length;Sa.__vertexArray=new Float32Array(ob*3);Sa.__colorArray=new Float32Array(ob*3);Sa.__sortArray=[];Sa.__webglParticleCount=ob;b(Sa,Ob);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.BufferGeometry)m(h.__webglObjects,j,g);else for(i in j.geometryGroups){l=j.geometryGroups[i];m(h.__webglObjects,l,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){j=
-g.geometry;m(h.__webglObjects,j,g)}else g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var db=a.__objectsRemoved[0],kb=a;db instanceof THREE.Mesh||db instanceof THREE.ParticleSystem||db instanceof THREE.Ribbon||db instanceof
-THREE.Line?r(kb.__webglObjects,db):db instanceof THREE.Sprite?o(kb.__webglSprites,db):db instanceof THREE.LensFlare?o(kb.__webglFlares,db):(db instanceof THREE.ImmediateRenderObject||db.immediateRenderCallback)&&r(kb.__webglObjectsImmediate,db);db.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var hb=0,pb=a.__webglObjects.length;hb<pb;hb++){var lb=a.__webglObjects[hb].object,ea=lb.geometry,cb=void 0,oc=void 0,Xa=void 0;if(lb instanceof THREE.Mesh)if(ea instanceof THREE.BufferGeometry){if(ea.verticesNeedUpdate||
-ea.elementsNeedUpdate||ea.uvsNeedUpdate||ea.normalsNeedUpdate||ea.colorsNeedUpdate||ea.tangentsNeedUpdate){var Ib=ea,pc=k.DYNAMIC_DRAW,ec=!ea.dynamic,qc=Ib.attributes,Gb=qc.index,dc=qc.position,Yc=qc.normal,Zc=qc.uv,$c=qc.color,ad=qc.tangent;if(Ib.elementsNeedUpdate&&Gb!==void 0){k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Gb.buffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Gb.array,pc)}if(Ib.verticesNeedUpdate&&dc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,dc.buffer);k.bufferData(k.ARRAY_BUFFER,dc.array,pc)}if(Ib.normalsNeedUpdate&&
-Yc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Yc.buffer);k.bufferData(k.ARRAY_BUFFER,Yc.array,pc)}if(Ib.uvsNeedUpdate&&Zc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Zc.buffer);k.bufferData(k.ARRAY_BUFFER,Zc.array,pc)}if(Ib.colorsNeedUpdate&&$c!==void 0){k.bindBuffer(k.ARRAY_BUFFER,$c.buffer);k.bufferData(k.ARRAY_BUFFER,$c.array,pc)}if(Ib.tangentsNeedUpdate&&ad!==void 0){k.bindBuffer(k.ARRAY_BUFFER,ad.buffer);k.bufferData(k.ARRAY_BUFFER,ad.array,pc)}if(ec){var md=void 0;for(md in Ib.attributes)delete Ib.attributes[md].array}}ea.verticesNeedUpdate=
+F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,h,m,n=a.__lights,o=a.fog;ca=-1;Ta=true;this.autoUpdateScene&&a.updateMatrixWorld();b.parent===void 0&&b.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);
+b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ta.multiply(b.projectionMatrix,b.matrixWorldInverse);Ea.setFromMatrix(ta);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;
+for(e=m.length;d<e;d++){f=m[d];h=f.object;f.render=false;if(h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||Ea.contains(h))){s(h,b);var p=f,r=p.object,q=p.buffer,u=void 0,u=u=void 0,u=r.material;if(u instanceof THREE.MeshFaceMaterial){u=q.materialIndex;if(u>=0){u=r.geometry.materials[u];if(u.transparent){p.transparent=u;p.opaque=null}else{p.opaque=u;p.transparent=null}}}else if(u)if(u.transparent){p.transparent=u;p.opaque=null}else{p.opaque=u;p.transparent=
+null}f.render=true;if(this.sortObjects)if(h.renderDepth)f.z=h.renderDepth;else{ra.copy(h.matrixWorld.getPosition());ta.multiplyVector3(ra);f.z=ra.z}}}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;if(h.visible){s(h,b);h=f.object.material;if(h.transparent){f.transparent=h;f.opaque=null}else{f.opaque=h;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);
+this.setDepthWrite(d.depthWrite);x(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,o,true,d);l(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,o,false);l(a.__webglObjectsImmediate,"opaque",b,n,o,false);j(a.__webglObjects,false,"transparent",b,n,o,true);l(a.__webglObjectsImmediate,"transparent",b,n,o,true)}i(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&
+c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);I=-1;F.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,
+k,Ea):e.render(function(a){F.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,j=void 0,l=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=
+j,s=void 0,u=void 0,t=void 0,w=void 0,x=void 0,z=void 0,A=void 0,C={},E=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(u=q.faces.length;s<u;s++){t=q.faces[s];w=t.materialIndex;z=w!==void 0?w:-1;C[z]===void 0&&(C[z]={hash:z,counter:0});A=C[z].hash+"_"+C[z].counter;q.geometryGroups[A]===void 0&&(q.geometryGroups[A]={faces3:[],faces4:[],materialIndex:w,vertices:0,numMorphTargets:E,numMorphNormals:B});x=t instanceof THREE.Face3?3:4;if(q.geometryGroups[A].vertices+x>65535){C[z].counter=
+C[z].counter+1;A=C[z].hash+"_"+C[z].counter;q.geometryGroups[A]===void 0&&(q.geometryGroups[A]={faces3:[],faces4:[],materialIndex:w,vertices:0,numMorphTargets:E,numMorphNormals:B})}t instanceof THREE.Face3?q.geometryGroups[A].faces3.push(s):q.geometryGroups[A].faces4.push(s);q.geometryGroups[A].vertices=q.geometryGroups[A].vertices+x}q.geometryGroupsList=[];var U=void 0;for(U in q.geometryGroups){q.geometryGroups[U].id=ia++;q.geometryGroupsList.push(q.geometryGroups[U])}}for(i in j.geometryGroups){l=
+j.geometryGroups[i];if(!l.__webglVertexBuffer){var I=l;I.__webglVertexBuffer=k.createBuffer();I.__webglNormalBuffer=k.createBuffer();I.__webglTangentBuffer=k.createBuffer();I.__webglColorBuffer=k.createBuffer();I.__webglUVBuffer=k.createBuffer();I.__webglUV2Buffer=k.createBuffer();I.__webglSkinVertexABuffer=k.createBuffer();I.__webglSkinVertexBBuffer=k.createBuffer();I.__webglSkinIndicesBuffer=k.createBuffer();I.__webglSkinWeightsBuffer=k.createBuffer();I.__webglFaceBuffer=k.createBuffer();I.__webglLineBuffer=
+k.createBuffer();var H=void 0,P=void 0;if(I.numMorphTargets){I.__webglMorphTargetsBuffers=[];H=0;for(P=I.numMorphTargets;H<P;H++)I.__webglMorphTargetsBuffers.push(k.createBuffer())}if(I.numMorphNormals){I.__webglMorphNormalsBuffers=[];H=0;for(P=I.numMorphNormals;H<P;H++)I.__webglMorphNormalsBuffers.push(k.createBuffer())}F.info.memory.geometries++;var G=l,J=g,Y=J.geometry,M=G.faces3,N=G.faces4,O=M.length*3+N.length*4,Z=M.length*1+N.length*2,W=M.length*3+N.length*4,Q=c(J,G),$=e(Q),X=d(Q),ca=Q.vertexColors?
+Q.vertexColors:false;G.__vertexArray=new Float32Array(O*3);if(X)G.__normalArray=new Float32Array(O*3);if(Y.hasTangents)G.__tangentArray=new Float32Array(O*4);if(ca)G.__colorArray=new Float32Array(O*3);if($){if(Y.faceUvs.length>0||Y.faceVertexUvs.length>0)G.__uvArray=new Float32Array(O*2);if(Y.faceUvs.length>1||Y.faceVertexUvs.length>1)G.__uv2Array=new Float32Array(O*2)}if(J.geometry.skinWeights.length&&J.geometry.skinIndices.length){G.__skinVertexAArray=new Float32Array(O*4);G.__skinVertexBArray=
+new Float32Array(O*4);G.__skinIndexArray=new Float32Array(O*4);G.__skinWeightArray=new Float32Array(O*4)}G.__faceArray=new Uint16Array(Z*3);G.__lineArray=new Uint16Array(W*2);var ga=void 0,da=void 0;if(G.numMorphTargets){G.__morphTargetsArrays=[];ga=0;for(da=G.numMorphTargets;ga<da;ga++)G.__morphTargetsArrays.push(new Float32Array(O*3))}if(G.numMorphNormals){G.__morphNormalsArrays=[];ga=0;for(da=G.numMorphNormals;ga<da;ga++)G.__morphNormalsArrays.push(new Float32Array(O*3))}G.__webglFaceCount=Z*3;
+G.__webglLineCount=W*2;if(Q.attributes){if(G.__webglCustomAttributesList===void 0)G.__webglCustomAttributesList=[];var ba=void 0;for(ba in Q.attributes){var oa=Q.attributes[ba],na={},bb;for(bb in oa)na[bb]=oa[bb];if(!na.__webglInitialized||na.createUniqueBuffers){na.__webglInitialized=true;var Ha=1;na.type==="v2"?Ha=2:na.type==="v3"?Ha=3:na.type==="v4"?Ha=4:na.type==="c"&&(Ha=3);na.size=Ha;na.array=new Float32Array(O*Ha);na.buffer=k.createBuffer();na.buffer.belongsToAttribute=ba;oa.needsUpdate=true;
+na.__original=oa}G.__webglCustomAttributesList.push(na)}}G.__inittedArrays=true;j.verticesNeedUpdate=true;j.morphTargetsNeedUpdate=true;j.elementsNeedUpdate=true;j.uvsNeedUpdate=true;j.normalsNeedUpdate=true;j.tangentsNeedUpdate=true;j.colorsNeedUpdate=true}}}else if(j instanceof THREE.BufferGeometry){var Pa=j,Qa=void 0,ra=void 0,ta=void 0;for(Qa in Pa.attributes){ta=Qa==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;ra=Pa.attributes[Qa];ra.buffer=k.createBuffer();k.bindBuffer(ta,ra.buffer);k.bufferData(ta,
+ra.array,k.STATIC_DRAW)}}}else if(g instanceof THREE.Ribbon){j=g.geometry;if(!j.__webglVertexBuffer){var Aa=j;Aa.__webglVertexBuffer=k.createBuffer();Aa.__webglColorBuffer=k.createBuffer();F.info.memory.geometries++;var Ea=j,Ga=Ea.vertices.length;Ea.__vertexArray=new Float32Array(Ga*3);Ea.__colorArray=new Float32Array(Ga*3);Ea.__webglVertexCount=Ga;j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){j=g.geometry;if(!j.__webglVertexBuffer){var nb=j;nb.__webglVertexBuffer=
+k.createBuffer();nb.__webglColorBuffer=k.createBuffer();F.info.memory.geometries++;var gb=j,Wa=g,Ta=gb.vertices.length;gb.__vertexArray=new Float32Array(Ta*3);gb.__colorArray=new Float32Array(Ta*3);gb.__webglLineCount=Ta;b(gb,Wa);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){j=g.geometry;if(!j.__webglVertexBuffer){var Za=j;Za.__webglVertexBuffer=k.createBuffer();Za.__webglColorBuffer=k.createBuffer();F.info.geometries++;var Sa=j,Ob=g,ob=Sa.vertices.length;
+Sa.__vertexArray=new Float32Array(ob*3);Sa.__colorArray=new Float32Array(ob*3);Sa.__sortArray=[];Sa.__webglParticleCount=ob;b(Sa,Ob);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.BufferGeometry)m(h.__webglObjects,j,g);else for(i in j.geometryGroups){l=j.geometryGroups[i];m(h.__webglObjects,l,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){j=g.geometry;m(h.__webglObjects,
+j,g)}else g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var db=a.__objectsRemoved[0],kb=a;db instanceof THREE.Mesh||db instanceof THREE.ParticleSystem||db instanceof THREE.Ribbon||db instanceof THREE.Line?r(kb.__webglObjects,
+db):db instanceof THREE.Sprite?o(kb.__webglSprites,db):db instanceof THREE.LensFlare?o(kb.__webglFlares,db):(db instanceof THREE.ImmediateRenderObject||db.immediateRenderCallback)&&r(kb.__webglObjectsImmediate,db);db.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var hb=0,pb=a.__webglObjects.length;hb<pb;hb++){var lb=a.__webglObjects[hb].object,ea=lb.geometry,cb=void 0,oc=void 0,Xa=void 0;if(lb instanceof THREE.Mesh)if(ea instanceof THREE.BufferGeometry){if(ea.verticesNeedUpdate||ea.elementsNeedUpdate||
+ea.uvsNeedUpdate||ea.normalsNeedUpdate||ea.colorsNeedUpdate||ea.tangentsNeedUpdate){var Ib=ea,pc=k.DYNAMIC_DRAW,ec=!ea.dynamic,qc=Ib.attributes,Gb=qc.index,dc=qc.position,Yc=qc.normal,Zc=qc.uv,$c=qc.color,ad=qc.tangent;if(Ib.elementsNeedUpdate&&Gb!==void 0){k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Gb.buffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Gb.array,pc)}if(Ib.verticesNeedUpdate&&dc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,dc.buffer);k.bufferData(k.ARRAY_BUFFER,dc.array,pc)}if(Ib.normalsNeedUpdate&&Yc!==
+void 0){k.bindBuffer(k.ARRAY_BUFFER,Yc.buffer);k.bufferData(k.ARRAY_BUFFER,Yc.array,pc)}if(Ib.uvsNeedUpdate&&Zc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Zc.buffer);k.bufferData(k.ARRAY_BUFFER,Zc.array,pc)}if(Ib.colorsNeedUpdate&&$c!==void 0){k.bindBuffer(k.ARRAY_BUFFER,$c.buffer);k.bufferData(k.ARRAY_BUFFER,$c.array,pc)}if(Ib.tangentsNeedUpdate&&ad!==void 0){k.bindBuffer(k.ARRAY_BUFFER,ad.buffer);k.bufferData(k.ARRAY_BUFFER,ad.array,pc)}if(ec){var md=void 0;for(md in Ib.attributes)delete Ib.attributes[md].array}}ea.verticesNeedUpdate=
 false;ea.elementsNeedUpdate=false;ea.uvsNeedUpdate=false;ea.normalsNeedUpdate=false;ea.colorsNeedUpdate=false;ea.tangentsNeedUpdate=false}else{for(var bd=0,yd=ea.geometryGroupsList.length;bd<yd;bd++){cb=ea.geometryGroupsList[bd];Xa=c(lb,cb);oc=Xa.attributes&&n(Xa);if(ea.verticesNeedUpdate||ea.morphTargetsNeedUpdate||ea.elementsNeedUpdate||ea.uvsNeedUpdate||ea.normalsNeedUpdate||ea.colorsNeedUpdate||ea.tangentsNeedUpdate||oc){var ha=cb,zd=lb,$a=k.DYNAMIC_DRAW,Ad=!ea.dynamic,hc=Xa;if(ha.__inittedArrays){var nd=
 d(hc),cd=hc.vertexColors?hc.vertexColors:false,od=e(hc),Kc=nd===THREE.SmoothShading,D=void 0,V=void 0,jb=void 0,L=void 0,rc=void 0,Rb=void 0,mb=void 0,Lc=void 0,Jb=void 0,sc=void 0,tc=void 0,R=void 0,S=void 0,T=void 0,ja=void 0,qb=void 0,rb=void 0,sb=void 0,xc=void 0,tb=void 0,ub=void 0,vb=void 0,yc=void 0,wb=void 0,xb=void 0,yb=void 0,zc=void 0,zb=void 0,Ab=void 0,Bb=void 0,Ac=void 0,Cb=void 0,Db=void 0,Eb=void 0,Bc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Mc=void 0,Vb=void 0,Wb=void 0,Xb=void 0,Nc=
 void 0,ma=void 0,pd=void 0,Yb=void 0,uc=void 0,vc=void 0,Ka=void 0,qd=void 0,Ia=void 0,Ja=void 0,Zb=void 0,Kb=void 0,Ba=0,Fa=0,Lb=0,Mb=0,eb=0,Ra=0,qa=0,Ua=0,Ca=0,K=0,fa=0,y=0,pa=void 0,La=ha.__vertexArray,Cc=ha.__uvArray,Dc=ha.__uv2Array,fb=ha.__normalArray,ua=ha.__tangentArray,Ma=ha.__colorArray,va=ha.__skinVertexAArray,wa=ha.__skinVertexBArray,xa=ha.__skinIndexArray,ya=ha.__skinWeightArray,dd=ha.__morphTargetsArrays,ed=ha.__morphNormalsArrays,fd=ha.__webglCustomAttributesList,v=void 0,Fb=ha.__faceArray,
@@ -429,17 +430,17 @@ THREE.ParticleSystem){Xa=c(lb,cb);oc=Xa.attributes&&n(Xa);(ea.verticesNeedUpdate
 l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var o,p;o=g=e=n=0;for(f=b.length;o<f;o++){p=b[o];if(!p.onlyShadow){p instanceof THREE.DirectionalLight&&g++;p instanceof THREE.PointLight&&e++;p instanceof THREE.SpotLight&&n++}}if(e+n+g<=Q){o=g;f=e}else{o=Math.ceil(Q*g/(e+g));n=f=Q-o}e=
 o;g=n;n=m=0;for(o=b.length;n<o;n++){p=b[n];if(p.castShadow){p instanceof THREE.SpotLight&&m++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&m++}}if(dc&&d&&d.useVertexTexture)j=1024;else{b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}j=b}var r;a:{p=
 a.fragmentShader;o=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:j,useVertexTexture:dc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,
-maxPointLights:f,maxSpotLights:g,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(l)d.push(l);else{d.push(p);d.push(o)}for(q in c){d.push(q);d.push(c[q])}l=d.join();q=0;for(d=ba.length;q<d;q++){e=ba[q];if(e.code===l){e.usedTimes++;r=e.program;break a}}q=
-k.createProgram();d=["precision "+u+" float;",cb?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
-"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?
-"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+maxPointLights:f,maxSpotLights:g,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.doubleSided},q,d=[];if(l)d.push(l);else{d.push(p);d.push(o)}for(q in c){d.push(q);d.push(c[q])}l=d.join();q=0;for(d=ba.length;q<d;q++){e=ba[q];if(e.code===l){e.usedTimes++;r=e.program;break a}}q=k.createProgram();
+d=["precision "+u+" float;",cb?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?
+"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":
+"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 e=["precision "+u+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
 e=t("fragment",e+p);d=t("vertex",d+o);k.attachShader(q,d);k.attachShader(q,e);k.linkProgram(q);k.getProgramParameter(q,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(q,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(e);k.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):
 d.push("boneGlobalMatrices");for(s in n)d.push(s);s=d;d=0;for(n=s.length;d<n;d++){e=s[d];q.uniforms[e]=k.getUniformLocation(q,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(c=r.length;s<c;s++){d=r[s];q.attributes[d]=k.getAttribLocation(q,d)}q.id=X++;ba.push({program:q,code:l,usedTimes:1});F.info.memory.programs=
 ba.length;r=q}a.program=r;r=a.program.attributes;r.position>=0&&k.enableVertexAttribArray(r.position);r.color>=0&&k.enableVertexAttribArray(r.color);r.normal>=0&&k.enableVertexAttribArray(r.normal);r.tangent>=0&&k.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinVertexA);k.enableVertexAttribArray(r.skinVertexB);k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(i in a.attributes)r[i]!==
 void 0&&r[i]>=0&&k.enableVertexAttribArray(r[i]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";for(i=0;i<this.maxMorphTargets;i++){s=q+i;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(i=0;i<this.maxMorphNormals;i++){s=q+i;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=
-function(a,b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if(W!==a.doubleSided){a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE);W=a.doubleSided}if(U!==a.flipSided){a.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW);U=a.flipSided}};this.setDepthTest=function(a){if(Ha!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);
+function(a,b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setMaterialFaces=function(a){if(W!==a.doubleSided){a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE);W=a.doubleSided}if(U!==a.flipSided){a.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW);U=a.flipSided}};this.setDepthTest=function(a){if(Ha!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);
 Ha=a}};this.setDepthWrite=function(a){if(oa!==a){k.depthMask(a);oa=a}};this.setBlending=function(a,b,c,d){if(a!==P){if(a===THREE.NoBlending)k.disable(k.BLEND);else if(a===THREE.AdditiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE)}else if(a===THREE.SubtractiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR)}else if(a===
 THREE.CustomBlending)k.enable(k.BLEND);else{k.enable(k.BLEND);k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD);k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}P=a}if(a===THREE.CustomBlending){if(b!==Y){k.blendEquation(E(b));Y=b}if(c!==ga||d!==na){k.blendFunc(E(c),E(d));ga=c;na=d}}else na=ga=Y=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();F.info.memory.textures++}k.activeTexture(k.TEXTURE0+
 b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=E(a.format),f=E(a.type);w(k.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):k.texImage2D(k.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{k.activeTexture(k.TEXTURE0+
@@ -485,9 +486,9 @@ b,THREE.RGBFormat);a.needsUpdate=true;return a}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++){c=a.children[d];b(c);THREE.SceneUtils.traverseHierarchy(c,b)}},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;if(a instanceof THREE.MorphAnimMesh){b=new THREE.MorphAnimMesh(a.geometry,a.material);
 b.duration=a.duration;b.mirroredLoop=a.mirroredLoop;b.time=a.time;b.lastKeyframe=a.lastKeyframe;b.currentKeyframe=a.currentKeyframe;b.direction=a.direction;b.directionBackwards=a.directionBackwards}else if(a instanceof THREE.SkinnedMesh)b=new THREE.SkinnedMesh(a.geometry,a.material);else if(a instanceof THREE.Mesh)b=new THREE.Mesh(a.geometry,a.material);else if(a instanceof THREE.Line)b=new THREE.Line(a.geometry,a.material,a.type);else if(a instanceof THREE.Ribbon)b=new THREE.Ribbon(a.geometry,a.material);
 else if(a instanceof THREE.ParticleSystem){b=new THREE.ParticleSystem(a.geometry,a.material);b.sortParticles=a.sortParticles}else if(a instanceof THREE.Particle)b=new THREE.Particle(a.material);else if(a instanceof THREE.Sprite){b=new THREE.Sprite({});b.color.copy(a.color);b.map=a.map;b.blending=a.blending;b.useScreenCoordinates=a.useScreenCoordinates;b.mergeWith3D=a.mergeWith3D;b.affectedByDistance=a.affectedByDistance;b.scaleByViewport=a.scaleByViewport;b.alignment=a.alignment;b.rotation3d.copy(a.rotation3d);
-b.rotation=a.rotation;b.opacity=a.opacity;b.uvOffset.copy(a.uvOffset);b.uvScale.copy(a.uvScale)}else a instanceof THREE.LOD?b=new THREE.LOD:a instanceof THREE.Object3D&&(b=new THREE.Object3D);b.name=a.name;b.parent=a.parent;b.up.copy(a.up);b.position.copy(a.position);b.rotation instanceof THREE.Vector3&&b.rotation.copy(a.rotation);b.eulerOrder=a.eulerOrder;b.scale.copy(a.scale);b.dynamic=a.dynamic;b.doubleSided=a.doubleSided;b.flipSided=a.flipSided;b.renderDepth=a.renderDepth;b.rotationAutoUpdate=
-a.rotationAutoUpdate;b.matrix.copy(a.matrix);b.matrixWorld.copy(a.matrixWorld);b.matrixRotationWorld.copy(a.matrixRotationWorld);b.matrixAutoUpdate=a.matrixAutoUpdate;b.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;b.quaternion.copy(a.quaternion);b.useQuaternion=a.useQuaternion;b.boundRadius=a.boundRadius;b.boundRadiusScale=a.boundRadiusScale;b.visible=a.visible;b.castShadow=a.castShadow;b.receiveShadow=a.receiveShadow;b.frustumCulled=a.frustumCulled;for(var c=0;c<a.children.length;c++){var d=THREE.SceneUtils.cloneObject(a.children[c]);
-b.children[c]=d;d.parent=b}if(a instanceof THREE.LOD)for(c=0;c<a.LODs.length;c++)b.LODs[c]={visibleAtDistance:a.LODs[c].visibleAtDistance,object3D:b.children[c]};return b},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
+b.rotation=a.rotation;b.opacity=a.opacity;b.uvOffset.copy(a.uvOffset);b.uvScale.copy(a.uvScale)}else a instanceof THREE.LOD?b=new THREE.LOD:a instanceof THREE.Object3D&&(b=new THREE.Object3D);b.name=a.name;b.parent=a.parent;b.up.copy(a.up);b.position.copy(a.position);b.rotation instanceof THREE.Vector3&&b.rotation.copy(a.rotation);b.eulerOrder=a.eulerOrder;b.scale.copy(a.scale);b.dynamic=a.dynamic;b.renderDepth=a.renderDepth;b.rotationAutoUpdate=a.rotationAutoUpdate;b.matrix.copy(a.matrix);b.matrixWorld.copy(a.matrixWorld);
+b.matrixRotationWorld.copy(a.matrixRotationWorld);b.matrixAutoUpdate=a.matrixAutoUpdate;b.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;b.quaternion.copy(a.quaternion);b.useQuaternion=a.useQuaternion;b.boundRadius=a.boundRadius;b.boundRadiusScale=a.boundRadiusScale;b.visible=a.visible;b.castShadow=a.castShadow;b.receiveShadow=a.receiveShadow;b.frustumCulled=a.frustumCulled;for(var c=0;c<a.children.length;c++){var d=THREE.SceneUtils.cloneObject(a.children[c]);b.children[c]=d;d.parent=b}if(a instanceof
+THREE.LOD)for(c=0;c<a.LODs.length;c++)b.LODs[c]={visibleAtDistance:a.LODs[c].visibleAtDistance,object3D:b.children[c]};return b},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
 THREE.WebGLRenderer&&(THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",
@@ -574,7 +575,7 @@ this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);t
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
-THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=
+THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=
 false;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey=null;f.animationCache.nextKey=null;f.animationCache.originalMatrix=e instanceof THREE.Bone?
 e.skinMatrix:e.matrix}e=this.data.hierarchy[c].keys;if(e.length){f.animationCache.prevKey=e[0];f.animationCache.nextKey=e[1];this.startTime=Math.min(e[0].time,this.startTime);this.endTime=Math.max(e[e.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
@@ -593,7 +594,7 @@ THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;thi
 THREE.CombinedCamera.prototype.setLens=function(a,b){var c=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};
 THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=false};
 THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};
-THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.005;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.heightMax=1;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
+THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.heightMax=1;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
 this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=false;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.onMouseDown=function(a){this.domElement!==
 document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=true;break;case 2:this.moveBackward=true}this.mouseDragOn=true};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=false;break;case 2:this.moveBackward=false}this.mouseDragOn=false};this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-
 this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=true;break;case 37:case 65:this.moveLeft=true;break;case 40:case 83:this.moveBackward=true;break;case 39:case 68:this.moveRight=true;break;case 82:this.moveUp=true;break;case 70:this.moveDown=true;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
@@ -604,14 +605,14 @@ this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.
 c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),false);this.handleResize()};
 THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,s=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++){s=d*h.chunks[f]/h.total;b.keys[f]={time:s,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
 return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);e.vertices[c]=new THREE.Vector3(d.x,d.y,d.z)}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
-this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
+this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
 document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=
 a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};
 this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),
 b=new THREE.MeshLambertMaterial({color:65280}),c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),p=0;p<b.points.length;p++){c=new THREE.Mesh(g,h);c.position.copy(b.points[p]);a.add(c)}}this.domElement.addEventListener("mousemove",d(this,
 this.onMouseMove),false)};this.handleResize()};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
+THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
 new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 1;break;case 40:this.moveState.pitchDown=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){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -730,7 +731,7 @@ b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b
 "color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");p=false};this.render=function(a,d,e,s){var a=a.__webglFlares,x=a.length;if(x){var t=new THREE.Vector3,w=s/e,z=e*0.5,C=s*0.5,E=16/s,A=new THREE.Vector2(E*w,E),u=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),J=n,E=m;b.useProgram(l);if(!p){b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);p=true}b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,
 1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(E.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(E.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var M,O,$,B,G;for(M=0;M<x;M++){E=16/s;A.set(E*w,E);B=a[M];t.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(t);d.projectionMatrix.multiplyVector3(t);u.copy(t);H.x=u.x*z+z;H.y=u.y*C+C;if(j||H.x>0&&H.x<e&&H.y>0&&
 H.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,A.x,A.y);b.uniform3f(J.screenPosition,u.x,u.y,u.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(u);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);O=0;for($=B.lensFlares.length;O<$;O++){G=B.lensFlares[O];if(G.opacity>0.001&&G.scale>0.001){u.x=G.x;u.y=G.y;u.z=G.z;E=G.size*G.scale/s;A.x=E*w;A.y=E;b.uniform3f(J.screenPosition,u.x,u.y,u.z);b.uniform2f(J.scale,A.x,A.y);b.uniform1f(J.rotation,G.rotation);b.uniform1f(J.opacity,G.opacity);
+b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(u);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);O=0;for($=B.lensFlares.length;O<$;O++){G=B.lensFlares[O];if(G.opacity>0.0010&&G.scale>0.0010){u.x=G.x;u.y=G.y;u.z=G.z;E=G.size*G.scale/s;A.x=E*w;A.y=E;b.uniform3f(J.screenPosition,u.x,u.y,u.z);b.uniform2f(J.scale,A.x,A.y);b.uniform1f(J.rotation,G.rotation);b.uniform1f(J.opacity,G.opacity);
 b.uniform3f(J.color,G.color.r,G.color.g,G.color.b);c.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst);c.setTexture(G.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f=new THREE.Frustum,g=new THREE.Matrix4,h=new THREE.Vector3,i=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
 vertexShader:f.vertexShader,uniforms:g,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,l){var m,n,p,r,o,q,s,x,t,w=[];r=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);m=0;for(n=j.__lights.length;m<n;m++){p=j.__lights[m];if(p.castShadow)if(p instanceof THREE.DirectionalLight&&
@@ -753,8 +754,8 @@ b.uniform3f(s.screenPosition,(z.position.x-p)/p,(t-z.position.y)/t,Math.max(0,Ma
 b.uniform1f(s.opacity,z.opacity);b.uniform3f(s.color,z.color.r,z.color.g,z.color.b);b.uniform1f(s.rotation,z.rotation);b.uniform2fv(s.scale,C);if(z.mergeWith3D&&!w){b.enable(b.DEPTH_TEST);w=true}else if(!z.mergeWith3D&&w){b.disable(b.DEPTH_TEST);w=false}c.setBlending(z.blending,z.blendEquation,z.blendSrc,z.blendDst);c.setTexture(z.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
 function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,l,m,n,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
-h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(j=p.length;i<j;i++){l=p[i];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}i=0;for(j=p.length;i<j;i++){l=p[i];if(l.render){n=l.object;l=l.buffer;b.setObjectFaces(n);m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;l instanceof
-THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,m,l,n):b.renderBuffer(h,g.__lights,null,m,l,n)}}p=g.__webglObjectsImmediate;i=0;for(j=p.length;i<j;i++){l=p[i];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,n)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
+h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(j=p.length;i<j;i++){l=p[i];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}i=0;for(j=p.length;i<j;i++){l=p[i];if(l.render){n=l.object;l=l.buffer;n.material&&b.setMaterialFaces(n.material);m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?
+d:c;l instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,m,l,n):b.renderBuffer(h,g.__lights,null,m,l,n)}}p=g.__webglObjectsImmediate;i=0;for(j=p.length;i<j;i++){l=p[i];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,n)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",

+ 113 - 113
build/custom/ThreeCanvas.js

@@ -16,8 +16,8 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 a;this.z=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=this.x-a.x;this.y=this.y-a.y;this.z=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=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
 this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=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 Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
-a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],k=d[1],m=d[5],j=d[9],h=d[2],n=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-j,d);this.z=Math.atan2(-e,f)}else{this.x=Math.atan2(k,m);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(j));if(Math.abs(j)<
-0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(k,m)}else{this.y=Math.atan2(-h,f);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(n));if(Math.abs(n)<0.99999){this.y=Math.atan2(-h,d);this.z=Math.atan2(-e,m)}else{this.y=0;this.z=Math.atan2(g,f)}}else if(b==="ZYX"){this.y=Math.asin(-c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(n,d);this.z=Math.atan2(k,f)}else{this.x=0;this.z=Math.atan2(-e,m)}}else if(b==="YZX"){this.z=Math.asin(c(k));if(Math.abs(k)<0.99999){this.x=Math.atan2(-j,m);this.y=Math.atan2(-h,
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],j=d[1],m=d[5],k=d[9],h=d[2],n=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-k,d);this.z=Math.atan2(-e,f)}else{this.x=Math.atan2(j,m);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(k));if(Math.abs(k)<
+0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(j,m)}else{this.y=Math.atan2(-h,f);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(n));if(Math.abs(n)<0.99999){this.y=Math.atan2(-h,d);this.z=Math.atan2(-e,m)}else{this.y=0;this.z=Math.atan2(g,f)}}else if(b==="ZYX"){this.y=Math.asin(-c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(n,d);this.z=Math.atan2(j,f)}else{this.x=0;this.z=Math.atan2(-e,m)}}else if(b==="YZX"){this.z=Math.asin(c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(-k,m);this.y=Math.atan2(-h,
 f)}else{this.x=0;this.y=Math.atan2(h,d)}}else if(b==="XZY"){this.z=Math.asin(-c(e));if(Math.abs(e)<0.99999){this.x=Math.atan2(n,m);this.y=Math.atan2(g,f)}else{this.x=Math.atan2(-g,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,f=a.y*a.y,e=a.z*a.z,g=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-f+e);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-f-e)}else if(b===
 "YXZ"){this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-f+e);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+f-e)}else if(b==="ZXY"){this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-f+e);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+f-e)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-f+e);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-f-e)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
 a.y),g-d+f-e);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-f-e);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))}else if(b==="XZY"){this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+f-e);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-f-e);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=
@@ -25,75 +25,74 @@ b;this.y=c;this.z=a;return this},equals:function(a){return a.x===this.x&&a.y===t
 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!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=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=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{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=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
-a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,f=a[0];d=a[4];var e=a[8],g=a[1],k=a[5],m=a[9];c=a[2];b=a[6];var j=a[10];if(Math.abs(d-g)<0.01&&Math.abs(e-c)<0.01&&Math.abs(m-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(e+c)<0.1&&Math.abs(m+b)<0.1&&Math.abs(f+k+j-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;f=(f+1)/2;k=(k+1)/2;j=(j+1)/2;d=(d+g)/4;e=(e+c)/4;m=(m+b)/4;if(f>k&&f>j)if(f<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(f);c=d/b;d=e/b}else if(k>
-j)if(k<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(k);b=d/c;d=m/c}else if(j<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(j);b=e/d;c=m/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-m)*(b-m)+(e-c)*(e-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-m)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+k+j-1)/2);return this}};
+a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,f=a[0];d=a[4];var e=a[8],g=a[1],j=a[5],m=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-g)<0.01&&Math.abs(e-c)<0.01&&Math.abs(m-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(e+c)<0.1&&Math.abs(m+b)<0.1&&Math.abs(f+j+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;f=(f+1)/2;j=(j+1)/2;k=(k+1)/2;d=(d+g)/4;e=(e+c)/4;m=(m+b)/4;if(f>j&&f>k)if(f<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(f);c=d/b;d=e/b}else if(j>
+k)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=m/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=e/d;c=m/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-m)*(b-m)+(e-c)*(e-c)+(g-d)*(g-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-m)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+j+k-1)/2);return this}};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
-THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],f=c[2],e=c[3],g=c[4],k=c[5],m=c[6],j=c[7],h=c[8],n=c[9],i=c[10],o=c[11],q=c[12],l=c[13],p=c[14],c=c[15];b[0].set(e-a,j-g,o-h,c-q);b[1].set(e+a,j+g,o+h,c+q);b[2].set(e+d,j+k,o+n,c+l);b[3].set(e-d,j-k,o-n,c-l);b[4].set(e-f,j-m,o-i,c-p);b[5].set(e+f,j+m,o+i,c+p);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
+THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],f=c[2],e=c[3],g=c[4],j=c[5],m=c[6],k=c[7],h=c[8],n=c[9],i=c[10],o=c[11],q=c[12],l=c[13],p=c[14],c=c[15];b[0].set(e-a,k-g,o-h,c-q);b[1].set(e+a,k+g,o+h,c+q);b[2].set(e+d,k+j,o+n,c+l);b[3].set(e-d,k-j,o-n,c-l);b[4].set(e-f,k-m,o-i,c-p);b[5].set(e+f,k+m,o+i,c+p);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),f=0;f<6;f++){b=c[f].x*d[12]+c[f].y*d[13]+c[f].z*d[14]+c[f].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,o=function(a,b){return a.distance-b.distance},q=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,r,u,v,B=function(a,b,c){q.sub(c,a);r=q.dot(b);u=l.add(a,p.copy(b).multiplyScalar(r));
+THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,o=function(a,b){return a.distance-b.distance},q=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,r,u,v,B=function(a,b,c){q.sub(c,a);r=q.dot(b);u=l.add(a,p.copy(b).multiplyScalar(r));
 return v=c.distanceTo(u)},x,A,y,F,s,w,D,J,L=function(a,b,c,d){q.sub(d,b);l.sub(c,b);p.sub(a,b);x=q.dot(q);A=q.dot(l);y=q.dot(p);F=l.dot(l);s=l.dot(p);w=1/(x*F-A*A);D=(F*y-A*s)*w;J=(x*s-A*y)*w;return D>=0&&J>=0&&D+J<1},M=1.0E-4;this.setPrecision=function(a){M=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var l=0,q=a.children.length;l<q;l++)Array.prototype.push.apply(d,this.intersectObject(a.children[l],b));if(a instanceof THREE.Particle){v=B(this.origin,this.direction,a.matrixWorld.getPosition());
 if(v>a.scale.x)return[];c={distance:v,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){l=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());l=a.geometry.boundingSphere.radius*Math.max(l.x,Math.max(l.y,l.z));v=B(this.origin,this.direction,a.matrixWorld.getPosition());if(v>l)return d;var z,P,p=a.geometry,r=p.vertices,s;a.matrixRotationWorld.extractRotation(a.matrixWorld);l=0;for(q=p.faces.length;l<
-q;l++){c=p.faces[l];m.copy(this.origin);j.copy(this.direction);s=a.matrixWorld;h=s.multiplyVector3(h.copy(c.centroid)).subSelf(m);n=a.matrixRotationWorld.multiplyVector3(n.copy(c.normal));z=j.dot(n);if(!(Math.abs(z)<M)){P=n.dot(h)/z;if(!(P<0)&&(a.doubleSided||(a.flipSided?z>0:z<0))){i.add(m,j.multiplyScalar(P));v=m.distanceTo(i);if(!(v<this.near)&&!(v>this.far))if(c instanceof THREE.Face3){f=s.multiplyVector3(f.copy(r[c.a]));e=s.multiplyVector3(e.copy(r[c.b]));g=s.multiplyVector3(g.copy(r[c.c]));
-if(L(i,f,e,g)){c={distance:v,point:i.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){f=s.multiplyVector3(f.copy(r[c.a]));e=s.multiplyVector3(e.copy(r[c.b]));g=s.multiplyVector3(g.copy(r[c.c]));k=s.multiplyVector3(k.copy(r[c.d]));if(L(i,f,e,k)||L(i,e,g,k)){c={distance:v,point:i.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(o);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],b));c.sort(o);
+q;l++){c=p.faces[l];m.copy(this.origin);k.copy(this.direction);s=a.matrixWorld;h=s.multiplyVector3(h.copy(c.centroid)).subSelf(m);n=a.matrixRotationWorld.multiplyVector3(n.copy(c.normal));z=k.dot(n);if(!(Math.abs(z)<M)){P=n.dot(h)/z;if(!(P<0)&&(a.doubleSided||(a.flipSided?z>0:z<0))){i.add(m,k.multiplyScalar(P));v=m.distanceTo(i);if(!(v<this.near)&&!(v>this.far))if(c instanceof THREE.Face3){f=s.multiplyVector3(f.copy(r[c.a]));e=s.multiplyVector3(e.copy(r[c.b]));g=s.multiplyVector3(g.copy(r[c.c]));
+if(L(i,f,e,g)){c={distance:v,point:i.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){f=s.multiplyVector3(f.copy(r[c.a]));e=s.multiplyVector3(e.copy(r[c.b]));g=s.multiplyVector3(g.copy(r[c.c]));j=s.multiplyVector3(j.copy(r[c.d]));if(L(i,f,e,j)||L(i,e,g,j)){c={distance:v,point:i.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(o);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],b));c.sort(o);
 return c}};
-THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b=0,c=0,d=0,f=0,e=0,g=0,k=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,h,n){k=false;b=e;c=g;d=h;f=n;a()};this.addPoint=function(e,g){if(k===true){k=false;b=e;c=g;d=e;f=g}else{b=b<e?b:e;c=c<g?c:
-g;d=d>e?d:e;f=f>g?f:g}a()};this.add3Points=function(e,g,h,n,i,o){if(k===true){k=false;b=e<h?e<i?e:i:h<i?h:i;c=g<n?g<o?g:o:n<o?n:o;d=e>h?e>i?e:i:h>i?h:i;f=g>n?g>o?g:o:n>o?n:o}else{b=e<h?e<i?e<b?e:b:i<b?i:b:h<i?h<b?h:b:i<b?i:b;c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c;d=e>h?e>i?e>d?e:d:i>d?i:d:h>i?h>d?h:d:i>d?i:d;f=g>n?g>o?g>f?g:f:o>f?o:f:n>o?n>f?n:f:o>f?o:f}a()};this.addRectangle=function(e){if(k===true){k=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=b<e.getLeft()?b:e.getLeft();
-c=c<e.getTop()?c:e.getTop();d=d>e.getRight()?d:e.getRight();f=f>e.getBottom()?f:e.getBottom()}a()};this.inflate=function(e){b=b-e;c=c-e;d=d+e;f=f+e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){k=true;f=d=c=b=0;a()};this.isEmpty=function(){return k}};
+THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b=0,c=0,d=0,f=0,e=0,g=0,j=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,h,n){j=false;b=e;c=g;d=h;f=n;a()};this.addPoint=function(e,g){if(j===true){j=false;b=e;c=g;d=e;f=g}else{b=b<e?b:e;c=c<g?c:
+g;d=d>e?d:e;f=f>g?f:g}a()};this.add3Points=function(e,g,h,n,i,o){if(j===true){j=false;b=e<h?e<i?e:i:h<i?h:i;c=g<n?g<o?g:o:n<o?n:o;d=e>h?e>i?e:i:h>i?h:i;f=g>n?g>o?g:o:n>o?n:o}else{b=e<h?e<i?e<b?e:b:i<b?i:b:h<i?h<b?h:b:i<b?i:b;c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c;d=e>h?e>i?e>d?e:d:i>d?i:d:h>i?h>d?h:d:i>d?i:d;f=g>n?g>o?g>f?g:f:o>f?o:f:n>o?n>f?n:f:o>f?o:f}a()};this.addRectangle=function(e){if(j===true){j=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=b<e.getLeft()?b:e.getLeft();
+c=c<e.getTop()?c:e.getTop();d=d>e.getRight()?d:e.getRight();f=f>e.getBottom()?f:e.getBottom()}a()};this.inflate=function(e){b=b-e;c=c-e;d=d+e;f=f+e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){j=true;f=d=c=b=0;a()};this.isEmpty=function(){return j}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],f=-b[10]*b[4]+b[6]*b[8],e=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],k=b[9]*b[4]-b[5]*b[8],m=-b[9]*b[0]+b[1]*b[8],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*f+b[2]*k;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,h=this.elements;h[0]=b*a;h[1]=b*c;h[2]=b*d;h[3]=b*f;h[4]=b*e;h[5]=b*g;h[6]=b*k;h[7]=b*m;h[8]=b*j;return this},
-transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,e,g,k,m,j,h,n,i,o,q,l){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,k||0,m||0,j||0,h!==void 0?h:1,n||0,i||0,o||0,q||0,l!==void 0?l:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,k,m,j,h,n,i,o,q,l){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=f;p[5]=e;p[9]=g;p[13]=k;p[2]=m;p[6]=j;p[10]=h;p[14]=n;p[3]=i;p[7]=o;p[11]=q;p[15]=l;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;f.cross(c,g).normalize();if(f.length()===0){g.x=g.x+1.0E-4;f.cross(c,g).normalize()}e.cross(g,f);d[0]=f.x;d[4]=e.x;d[8]=g.x;d[1]=f.y;d[5]=e.y;d[9]=g.y;d[2]=f.z;d[6]=e.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],g=c[4],k=c[8],m=c[12],j=c[1],h=c[5],n=c[9],i=c[13],o=c[2],q=c[6],l=c[10],p=c[14],r=c[3],u=c[7],v=c[11],c=c[15],B=d[0],x=d[4],
-A=d[8],y=d[12],F=d[1],s=d[5],w=d[9],D=d[13],J=d[2],L=d[6],M=d[10],t=d[14],G=d[3],I=d[7],N=d[11],d=d[15];f[0]=e*B+g*F+k*J+m*G;f[4]=e*x+g*s+k*L+m*I;f[8]=e*A+g*w+k*M+m*N;f[12]=e*y+g*D+k*t+m*d;f[1]=j*B+h*F+n*J+i*G;f[5]=j*x+h*s+n*L+i*I;f[9]=j*A+h*w+n*M+i*N;f[13]=j*y+h*D+n*t+i*d;f[2]=o*B+q*F+l*J+p*G;f[6]=o*x+q*s+l*L+p*I;f[10]=o*A+q*w+l*M+p*N;f[14]=o*y+q*D+l*t+p*d;f[3]=r*B+u*F+v*J+c*G;f[7]=r*x+u*s+v*L+c*I;f[11]=r*A+u*w+v*M+c*N;f[15]=r*y+u*D+v*t+c*d;return this},multiplySelf:function(a){return this.multiply(this,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],f=-b[10]*b[4]+b[6]*b[8],e=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],j=b[9]*b[4]-b[5]*b[8],m=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*f+b[2]*j;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,h=this.elements;h[0]=b*a;h[1]=b*c;h[2]=b*d;h[3]=b*f;h[4]=b*e;h[5]=b*g;h[6]=b*j;h[7]=b*m;h[8]=b*k;return this},
+transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,e,g,j,m,k,h,n,i,o,q,l){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,j||0,m||0,k||0,h!==void 0?h:1,n||0,i||0,o||0,q||0,l!==void 0?l:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,j,m,k,h,n,i,o,q,l){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=f;p[5]=e;p[9]=g;p[13]=j;p[2]=m;p[6]=k;p[10]=h;p[14]=n;p[3]=i;p[7]=o;p[11]=q;p[15]=l;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
+f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;f.cross(c,g).normalize();if(f.length()===0){g.x=g.x+1.0E-4;f.cross(c,g).normalize()}e.cross(g,f);d[0]=f.x;d[4]=e.x;d[8]=g.x;d[1]=f.y;d[5]=e.y;d[9]=g.y;d[2]=f.z;d[6]=e.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],g=c[4],j=c[8],m=c[12],k=c[1],h=c[5],n=c[9],i=c[13],o=c[2],q=c[6],l=c[10],p=c[14],r=c[3],u=c[7],v=c[11],c=c[15],B=d[0],x=d[4],
+A=d[8],y=d[12],F=d[1],s=d[5],w=d[9],D=d[13],J=d[2],L=d[6],M=d[10],t=d[14],G=d[3],I=d[7],N=d[11],d=d[15];f[0]=e*B+g*F+j*J+m*G;f[4]=e*x+g*s+j*L+m*I;f[8]=e*A+g*w+j*M+m*N;f[12]=e*y+g*D+j*t+m*d;f[1]=k*B+h*F+n*J+i*G;f[5]=k*x+h*s+n*L+i*I;f[9]=k*A+h*w+n*M+i*N;f[13]=k*y+h*D+n*t+i*d;f[2]=o*B+q*F+l*J+p*G;f[6]=o*x+q*s+l*L+p*I;f[10]=o*A+q*w+l*M+p*N;f[14]=o*y+q*D+l*t+p*d;f[3]=r*B+u*F+v*J+c*G;f[7]=r*x+u*s+v*L+c*I;f[11]=r*A+u*w+v*M+c*N;f[15]=r*y+u*D+v*t+c*d;return this},multiplySelf:function(a){return this.multiply(this,
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=1/(b[3]*c+b[7]*d+b[11]*f+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*f+b[12])*e;a.y=(b[1]*c+b[5]*d+b[9]*f+b[13])*e;a.z=(b[2]*c+b[6]*d+b[10]*f+b[14])*e;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w;a.x=b[0]*c+b[4]*d+b[8]*f+b[12]*e;a.y=b[1]*c+b[5]*d+b[9]*f+b[13]*e;a.z=b[2]*c+b[6]*d+b[10]*f+b[14]*e;a.w=b[3]*c+b[7]*d+b[11]*f+b[15]*e;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,
 c=0,d=a.length;c<d;c=c+3){b.x=a[c];b.y=a[c+1];b.z=a[c+2];this.multiplyVector3(b);a[c]=b.x;a[c+1]=b.y;a[c+2]=b.z}return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z;a.x=c*b[0]+d*b[4]+f*b[8];a.y=c*b[1]+d*b[5]+f*b[9];a.z=c*b[2]+d*b[6]+f*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*
-a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],f=a[12],e=a[1],g=a[5],k=a[9],m=a[13],j=a[2],h=a[6],n=a[10],i=a[14],o=a[3],q=a[7],l=a[11],a=a[15];return f*k*h*o-d*m*h*o-f*g*n*o+c*m*n*o+d*g*i*o-c*k*i*o-f*k*j*q+d*m*j*q+f*e*n*q-b*m*n*q-d*e*i*q+b*k*i*q+f*g*j*l-c*m*j*l-f*e*h*l+b*m*h*l+c*e*i*l-b*g*i*l-d*g*j*a+c*k*j*a+d*e*h*a-b*k*h*a-c*e*n*a+b*g*n*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
+a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],f=a[12],e=a[1],g=a[5],j=a[9],m=a[13],k=a[2],h=a[6],n=a[10],i=a[14],o=a[3],q=a[7],l=a[11],a=a[15];return f*j*h*o-d*m*h*o-f*g*n*o+c*m*n*o+d*g*i*o-c*j*i*o-f*j*k*q+d*m*k*q+f*e*n*q-b*m*n*q-d*e*i*q+b*j*i*q+f*g*k*l-c*m*k*l-f*e*h*l+b*m*h*l+c*e*i*l-b*g*i*l-d*g*k*a+c*j*k*a+d*e*h*a-b*j*h*a-c*e*n*a+b*g*n*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
 b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=
 c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],
-a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],f=c[4],e=c[8],g=c[12],k=c[1],m=c[5],j=c[9],h=c[13],n=c[2],i=c[6],o=c[10],q=c[14],l=c[3],p=c[7],r=c[11],c=c[15];b[0]=j*q*p-h*o*p+h*i*r-m*q*r-j*i*c+m*o*c;b[4]=g*o*p-e*q*p-g*i*r+f*q*r+e*i*c-f*o*c;b[8]=e*h*p-g*j*p+g*m*r-f*h*r-e*m*c+f*j*c;b[12]=g*j*i-e*h*i-g*m*o+f*h*o+e*m*q-f*j*q;b[1]=h*o*l-j*q*l-h*n*r+k*q*r+j*n*c-k*o*c;b[5]=e*q*l-g*o*l+g*n*r-d*q*r-e*n*c+d*o*c;b[9]=g*j*l-e*h*l-g*k*r+d*h*r+e*k*c-d*j*c;b[13]=e*h*n-g*j*n+g*k*o-d*
-h*o-e*k*q+d*j*q;b[2]=m*q*l-h*i*l+h*n*p-k*q*p-m*n*c+k*i*c;b[6]=g*i*l-f*q*l-g*n*p+d*q*p+f*n*c-d*i*c;b[10]=f*h*l-g*m*l+g*k*p-d*h*p-f*k*c+d*m*c;b[14]=g*m*n-f*h*n-g*k*i+d*h*i+f*k*q-d*m*q;b[3]=j*i*l-m*o*l-j*n*p+k*o*p+m*n*r-k*i*r;b[7]=f*o*l-e*i*l+e*n*p-d*o*p-f*n*r+d*i*r;b[11]=e*m*l-f*j*l-e*k*p+d*j*p+f*k*r-d*m*r;b[15]=f*j*n-e*m*n+e*k*i-d*j*i-f*k*o+d*m*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,g=Math.cos(d),d=Math.sin(d),
-k=Math.cos(f),f=Math.sin(f),m=Math.cos(e),e=Math.sin(e);if(b===void 0||b==="XYZ"){var j=g*m,h=g*e,n=d*m,i=d*e;c[0]=k*m;c[4]=-k*e;c[8]=f;c[1]=h+n*f;c[5]=j-i*f;c[9]=-d*k;c[2]=i-j*f;c[6]=n+h*f;c[10]=g*k}else if(b==="YXZ"){j=k*m;h=k*e;n=f*m;i=f*e;c[0]=j+i*d;c[4]=n*d-h;c[8]=g*f;c[1]=g*e;c[5]=g*m;c[9]=-d;c[2]=h*d-n;c[6]=i+j*d;c[10]=g*k}else if(b==="ZXY"){j=k*m;h=k*e;n=f*m;i=f*e;c[0]=j-i*d;c[4]=-g*e;c[8]=n+h*d;c[1]=h+n*d;c[5]=g*m;c[9]=i-j*d;c[2]=-g*f;c[6]=d;c[10]=g*k}else if(b==="ZYX"){j=g*m;h=g*e;n=d*m;
-i=d*e;c[0]=k*m;c[4]=n*f-h;c[8]=j*f+i;c[1]=k*e;c[5]=i*f+j;c[9]=h*f-n;c[2]=-f;c[6]=d*k;c[10]=g*k}else if(b==="YZX"){j=g*k;h=g*f;n=d*k;i=d*f;c[0]=k*m;c[4]=i-j*e;c[8]=n*e+h;c[1]=e;c[5]=g*m;c[9]=-d*m;c[2]=-f*m;c[6]=h*e+n;c[10]=j-i*e}else if(b==="XZY"){j=g*k;h=g*f;n=d*k;i=d*f;c[0]=k*m;c[4]=-e;c[8]=f*m;c[1]=j*e+i;c[5]=g*m;c[9]=h*e-n;c[2]=n*e-h;c[6]=d*m;c[10]=i*e+j}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w,g=c+c,k=d+d,m=f+f,a=c*g,j=c*k,c=c*m,h=d*k,d=d*
-m,f=f*m,g=e*g,k=e*k,e=e*m;b[0]=1-(h+f);b[4]=j-e;b[8]=c+k;b[1]=j+e;b[5]=1-(a+f);b[9]=d-g;b[2]=c-k;b[6]=d+g;b[10]=1-(a+h);return this},compose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(b);e.makeScale(c.x,c.y,c.z);this.multiply(f,e);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;f.set(d[0],d[1],d[2]);e.set(d[4],d[5],d[6]);
+a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],f=c[4],e=c[8],g=c[12],j=c[1],m=c[5],k=c[9],h=c[13],n=c[2],i=c[6],o=c[10],q=c[14],l=c[3],p=c[7],r=c[11],c=c[15];b[0]=k*q*p-h*o*p+h*i*r-m*q*r-k*i*c+m*o*c;b[4]=g*o*p-e*q*p-g*i*r+f*q*r+e*i*c-f*o*c;b[8]=e*h*p-g*k*p+g*m*r-f*h*r-e*m*c+f*k*c;b[12]=g*k*i-e*h*i-g*m*o+f*h*o+e*m*q-f*k*q;b[1]=h*o*l-k*q*l-h*n*r+j*q*r+k*n*c-j*o*c;b[5]=e*q*l-g*o*l+g*n*r-d*q*r-e*n*c+d*o*c;b[9]=g*k*l-e*h*l-g*j*r+d*h*r+e*j*c-d*k*c;b[13]=e*h*n-g*k*n+g*j*o-d*
+h*o-e*j*q+d*k*q;b[2]=m*q*l-h*i*l+h*n*p-j*q*p-m*n*c+j*i*c;b[6]=g*i*l-f*q*l-g*n*p+d*q*p+f*n*c-d*i*c;b[10]=f*h*l-g*m*l+g*j*p-d*h*p-f*j*c+d*m*c;b[14]=g*m*n-f*h*n-g*j*i+d*h*i+f*j*q-d*m*q;b[3]=k*i*l-m*o*l-k*n*p+j*o*p+m*n*r-j*i*r;b[7]=f*o*l-e*i*l+e*n*p-d*o*p-f*n*r+d*i*r;b[11]=e*m*l-f*k*l-e*j*p+d*k*p+f*j*r-d*m*r;b[15]=f*k*n-e*m*n+e*j*i-d*k*i-f*j*o+d*m*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,g=Math.cos(d),d=Math.sin(d),
+j=Math.cos(f),f=Math.sin(f),m=Math.cos(e),e=Math.sin(e);if(b===void 0||b==="XYZ"){var k=g*m,h=g*e,n=d*m,i=d*e;c[0]=j*m;c[4]=-j*e;c[8]=f;c[1]=h+n*f;c[5]=k-i*f;c[9]=-d*j;c[2]=i-k*f;c[6]=n+h*f;c[10]=g*j}else if(b==="YXZ"){k=j*m;h=j*e;n=f*m;i=f*e;c[0]=k+i*d;c[4]=n*d-h;c[8]=g*f;c[1]=g*e;c[5]=g*m;c[9]=-d;c[2]=h*d-n;c[6]=i+k*d;c[10]=g*j}else if(b==="ZXY"){k=j*m;h=j*e;n=f*m;i=f*e;c[0]=k-i*d;c[4]=-g*e;c[8]=n+h*d;c[1]=h+n*d;c[5]=g*m;c[9]=i-k*d;c[2]=-g*f;c[6]=d;c[10]=g*j}else if(b==="ZYX"){k=g*m;h=g*e;n=d*m;
+i=d*e;c[0]=j*m;c[4]=n*f-h;c[8]=k*f+i;c[1]=j*e;c[5]=i*f+k;c[9]=h*f-n;c[2]=-f;c[6]=d*j;c[10]=g*j}else if(b==="YZX"){k=g*j;h=g*f;n=d*j;i=d*f;c[0]=j*m;c[4]=i-k*e;c[8]=n*e+h;c[1]=e;c[5]=g*m;c[9]=-d*m;c[2]=-f*m;c[6]=h*e+n;c[10]=k-i*e}else if(b==="XZY"){k=g*j;h=g*f;n=d*j;i=d*f;c[0]=j*m;c[4]=-e;c[8]=f*m;c[1]=k*e+i;c[5]=g*m;c[9]=h*e-n;c[2]=n*e-h;c[6]=d*m;c[10]=i*e+k}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w,g=c+c,j=d+d,m=f+f,a=c*g,k=c*j,c=c*m,h=d*j,d=d*
+m,f=f*m,g=e*g,j=e*j,e=e*m;b[0]=1-(h+f);b[4]=k-e;b[8]=c+j;b[1]=k+e;b[5]=1-(a+f);b[9]=d-g;b[2]=c-j;b[6]=d+g;b[10]=1-(a+h);return this},compose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(b);e.makeScale(c.x,c.y,c.z);this.multiply(f,e);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;f.set(d[0],d[1],d[2]);e.set(d[4],d[5],d[6]);
 g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=f.length();c.y=e.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/
 c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),f=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*f;b[5]=a[5]*f;b[6]=a[6]*f;b[8]=a[8]*c;b[9]=a[9]*
-c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],f=b[6],e=b[7],g=b[8],k=b[9],m=b[10],j=b[11],h=Math.cos(a),a=Math.sin(a);b[4]=h*c+a*g;b[5]=h*d+a*k;b[6]=h*f+a*m;b[7]=h*e+a*j;b[8]=h*g-a*c;b[9]=h*k-a*d;b[10]=h*m-a*f;b[11]=h*j-a*e;return this},rotateY:function(a){var b=
-this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[8],k=b[9],m=b[10],j=b[11],h=Math.cos(a),a=Math.sin(a);b[0]=h*c-a*g;b[1]=h*d-a*k;b[2]=h*f-a*m;b[3]=h*e-a*j;b[8]=h*g+a*c;b[9]=h*k+a*d;b[10]=h*m+a*f;b[11]=h*j+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[4],k=b[5],m=b[6],j=b[7],h=Math.cos(a),a=Math.sin(a);b[0]=h*c+a*g;b[1]=h*d+a*k;b[2]=h*f+a*m;b[3]=h*e+a*j;b[4]=h*g-a*c;b[5]=h*k-a*d;b[6]=h*m-a*f;b[7]=h*j-a*e;return this},rotateByAxis:function(a,b){var c=this.elements;
-if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,f=a.y,e=a.z,g=Math.sqrt(d*d+f*f+e*e),d=d/g,f=f/g,e=e/g,g=d*d,k=f*f,m=e*e,j=Math.cos(b),h=Math.sin(b),n=1-j,i=d*f*n,o=d*e*n,n=f*e*n,d=d*h,q=f*h,h=e*h,e=g+(1-g)*j,g=i+h,f=o-q,i=i-h,k=k+(1-k)*j,h=n+d,o=o+q,n=n-d,m=m+(1-m)*j,j=c[0],d=c[1],q=c[2],l=c[3],p=c[4],r=c[5],u=c[6],v=c[7],B=c[8],x=c[9],A=c[10],y=c[11];c[0]=e*j+g*p+f*B;c[1]=e*d+g*
-r+f*x;c[2]=e*q+g*u+f*A;c[3]=e*l+g*v+f*y;c[4]=i*j+k*p+h*B;c[5]=i*d+k*r+h*x;c[6]=i*q+k*u+h*A;c[7]=i*l+k*v+h*y;c[8]=o*j+n*p+m*B;c[9]=o*d+n*r+m*x;c[10]=o*q+n*u+m*A;c[11]=o*l+n*v+m*y;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+
+c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],f=b[6],e=b[7],g=b[8],j=b[9],m=b[10],k=b[11],h=Math.cos(a),a=Math.sin(a);b[4]=h*c+a*g;b[5]=h*d+a*j;b[6]=h*f+a*m;b[7]=h*e+a*k;b[8]=h*g-a*c;b[9]=h*j-a*d;b[10]=h*m-a*f;b[11]=h*k-a*e;return this},rotateY:function(a){var b=
+this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[8],j=b[9],m=b[10],k=b[11],h=Math.cos(a),a=Math.sin(a);b[0]=h*c-a*g;b[1]=h*d-a*j;b[2]=h*f-a*m;b[3]=h*e-a*k;b[8]=h*g+a*c;b[9]=h*j+a*d;b[10]=h*m+a*f;b[11]=h*k+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[4],j=b[5],m=b[6],k=b[7],h=Math.cos(a),a=Math.sin(a);b[0]=h*c+a*g;b[1]=h*d+a*j;b[2]=h*f+a*m;b[3]=h*e+a*k;b[4]=h*g-a*c;b[5]=h*j-a*d;b[6]=h*m-a*f;b[7]=h*k-a*e;return this},rotateByAxis:function(a,b){var c=this.elements;
+if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,f=a.y,e=a.z,g=Math.sqrt(d*d+f*f+e*e),d=d/g,f=f/g,e=e/g,g=d*d,j=f*f,m=e*e,k=Math.cos(b),h=Math.sin(b),n=1-k,i=d*f*n,o=d*e*n,n=f*e*n,d=d*h,q=f*h,h=e*h,e=g+(1-g)*k,g=i+h,f=o-q,i=i-h,j=j+(1-j)*k,h=n+d,o=o+q,n=n-d,m=m+(1-m)*k,k=c[0],d=c[1],q=c[2],l=c[3],p=c[4],r=c[5],u=c[6],v=c[7],B=c[8],x=c[9],A=c[10],y=c[11];c[0]=e*k+g*p+f*B;c[1]=e*d+g*
+r+f*x;c[2]=e*q+g*u+f*A;c[3]=e*l+g*v+f*y;c[4]=i*k+j*p+h*B;c[5]=i*d+j*r+h*x;c[6]=i*q+j*u+h*A;c[7]=i*l+j*v+h*y;c[8]=o*k+n*p+m*B;c[9]=o*d+n*r+m*x;c[10]=o*q+n*u+m*A;c[11]=o*l+n*v+m*y;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+
 a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);
-return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,k=a.z,m=f*e,j=f*g;this.set(m*e+c,m*g-d*k,m*k+d*g,0,m*g+d*k,j*g+c,j*k-d*e,0,m*k-d*g,j*k+d*e,f*k*k+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,f,e){var g=this.elements;g[0]=2*f/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*f/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(e+f)/(e-f);g[14]=-2*e*f/(e-f);g[3]=
-0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,b,c,d,f,e){var g=this.elements,k=b-a,m=c-d,j=e-f;g[0]=2/k;g[4]=0;g[8]=0;g[12]=-((b+a)/k);g[1]=0;g[5]=2/m;g[9]=0;g[13]=-((c+d)/m);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((e+f)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
+return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,j=a.z,m=f*e,k=f*g;this.set(m*e+c,m*g-d*j,m*j+d*g,0,m*g+d*j,k*g+c,k*j-d*e,0,m*j-d*g,k*j+d*e,f*j*j+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,f,e){var g=this.elements;g[0]=2*f/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*f/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(e+f)/(e-f);g[14]=-2*e*f/(e-f);g[3]=
+0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,b,c,d,f,e){var g=this.elements,j=b-a,m=c-d,k=e-f;g[0]=2/j;g[4]=0;g[8]=0;g[12]=-((b+a)/j);g[1]=0;g[5]=2/m;g[9]=0;g[13]=-((c+d)/m);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((e+f)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
 a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};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=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
-true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
+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.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=true;this.quaternion=new THREE.Quaternion;
+this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.setEulerFromRotationMatrix((new THREE.Matrix4).extractRotation(this.matrix),this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b){f=f.getChildByName(a,b);if(f!==void 0)return f}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion===true?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?this.matrixWorld.multiply(this.parent.matrixWorld,
 this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 THREE.Projector=function(){function a(a,c){g=0;A.objects.length=0;A.sprites.length=0;A.lights.length=0;var f=function(a){if(a.visible!==false){if((a instanceof THREE.Mesh||a instanceof THREE.Line)&&(a.frustumCulled===false||D.contains(a)===true)){y.copy(a.matrixWorld.getPosition());s.multiplyVector3(y);e=b();e.object=a;e.z=y.z;A.objects.push(e)}else if(a instanceof THREE.Sprite||a instanceof THREE.Particle){y.copy(a.matrixWorld.getPosition());s.multiplyVector3(y);e=b();e.object=a;e.z=y.z;A.sprites.push(e)}else a instanceof
-THREE.Light&&A.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)f(a.children[c])}};f(a);c===true&&A.objects.sort(d);return A}function b(){var a;if(g===k.length){a=new THREE.RenderableObject;k.push(a)}else a=k[g];g++;return a}function c(){var a;if(j===h.length){a=new THREE.RenderableVertex;h.push(a)}else a=h[j];j++;return a}function d(a,b){return b.z-a.z}function f(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(e>=0&&g>=0&&f>=0&&h>=0)return true;if(e<0&&g<0||f<0&&h<0)return false;
-e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g)));f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,g,k=[],m,j,h=[],n,i,o=[],q,l=[],p,r,u=[],v,B,x=[],A={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,F=new THREE.Vector4,s=new THREE.Matrix4,w=new THREE.Matrix4,D=new THREE.Frustum,J=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);s.multiply(b.projectionMatrix,
-b.matrixWorldInverse);s.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);s.multiply(b.matrixWorld,b.projectionMatrixInverse);s.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectScene=function(b,e,g){var k=e.near,y=e.far,Q=false,S,z,P,$,O,U,T,E,C,H,K,R,ja,ka,Y;
-B=r=q=i=0;A.elements.length=0;if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");b.add(e)}b.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);s.multiply(e.projectionMatrix,e.matrixWorldInverse);D.setFromMatrix(s);A=a(b,false);b=0;for(S=A.objects.length;b<S;b++){C=A.objects[b].object;H=C.matrixWorld;j=0;if(C instanceof THREE.Mesh){K=C.geometry;R=C.geometry.materials;$=K.vertices;ja=K.faces;ka=K.faceVertexUvs;K=C.matrixRotationWorld.extractRotation(H);
-z=0;for(P=$.length;z<P;z++){m=c();m.positionWorld.copy($[z]);H.multiplyVector3(m.positionWorld);m.positionScreen.copy(m.positionWorld);s.multiplyVector4(m.positionScreen);m.positionScreen.x=m.positionScreen.x/m.positionScreen.w;m.positionScreen.y=m.positionScreen.y/m.positionScreen.w;m.visible=m.positionScreen.z>k&&m.positionScreen.z<y}$=0;for(z=ja.length;$<z;$++){P=ja[$];if(P instanceof THREE.Face3){O=h[P.a];U=h[P.b];T=h[P.c];if(O.visible===true&&U.visible===true&&T.visible===true){Q=(T.positionScreen.x-
-O.positionScreen.x)*(U.positionScreen.y-O.positionScreen.y)-(T.positionScreen.y-O.positionScreen.y)*(U.positionScreen.x-O.positionScreen.x)<0;if(C.doubleSided===true||Q!==C.flipSided){E=void 0;if(i===o.length){E=new THREE.RenderableFace3;o.push(E)}else E=o[i];i++;n=E;n.v1.copy(O);n.v2.copy(U);n.v3.copy(T)}else continue}else continue}else if(P instanceof THREE.Face4){O=h[P.a];U=h[P.b];T=h[P.c];E=h[P.d];if(O.visible===true&&U.visible===true&&T.visible===true&&E.visible===true){Q=(E.positionScreen.x-
-O.positionScreen.x)*(U.positionScreen.y-O.positionScreen.y)-(E.positionScreen.y-O.positionScreen.y)*(U.positionScreen.x-O.positionScreen.x)<0||(U.positionScreen.x-T.positionScreen.x)*(E.positionScreen.y-T.positionScreen.y)-(U.positionScreen.y-T.positionScreen.y)*(E.positionScreen.x-T.positionScreen.x)<0;if(C.doubleSided===true||Q!==C.flipSided){Y=void 0;if(q===l.length){Y=new THREE.RenderableFace4;l.push(Y)}else Y=l[q];q++;n=Y;n.v1.copy(O);n.v2.copy(U);n.v3.copy(T);n.v4.copy(E)}else continue}else continue}n.normalWorld.copy(P.normal);
-Q===false&&(C.flipSided===true||C.doubleSided===true)&&n.normalWorld.negate();K.multiplyVector3(n.normalWorld);n.centroidWorld.copy(P.centroid);H.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);s.multiplyVector3(n.centroidScreen);T=P.vertexNormals;O=0;for(U=T.length;O<U;O++){E=n.vertexNormalsWorld[O];E.copy(T[O]);Q===false&&(C.flipSided===true||C.doubleSided===true)&&E.negate();K.multiplyVector3(E)}O=0;for(U=ka.length;O<U;O++){Y=ka[O][$];if(Y!==void 0){T=0;for(E=Y.length;T<
-E;T++)n.uvs[O][T]=Y[T]}}n.material=C.material;n.faceMaterial=P.materialIndex!==null?R[P.materialIndex]:null;n.z=n.centroidScreen.z;A.elements.push(n)}}else if(C instanceof THREE.Line){w.multiply(s,H);$=C.geometry.vertices;O=c();O.positionScreen.copy($[0]);w.multiplyVector4(O.positionScreen);H=C.type===THREE.LinePieces?2:1;z=1;for(P=$.length;z<P;z++){O=c();O.positionScreen.copy($[z]);w.multiplyVector4(O.positionScreen);if(!((z+1)%H>0)){U=h[j-2];J.copy(O.positionScreen);L.copy(U.positionScreen);if(f(J,
-L)===true){J.multiplyScalar(1/J.w);L.multiplyScalar(1/L.w);R=void 0;if(r===u.length){R=new THREE.RenderableLine;u.push(R)}else R=u[r];r++;p=R;p.v1.positionScreen.copy(J);p.v2.positionScreen.copy(L);p.z=Math.max(J.z,L.z);p.material=C.material;A.elements.push(p)}}}}}b=0;for(S=A.sprites.length;b<S;b++){C=A.sprites[b].object;H=C.matrixWorld;if(C instanceof THREE.Particle){F.set(H.elements[12],H.elements[13],H.elements[14],1);s.multiplyVector4(F);F.z=F.z/F.w;if(F.z>0&&F.z<1){k=void 0;if(B===x.length){k=
-new THREE.RenderableParticle;x.push(k)}else k=x[B];B++;v=k;v.object=C;v.x=F.x/F.w;v.y=F.y/F.w;v.z=F.z;v.rotation=C.rotation.z;v.scale.x=C.scale.x*Math.abs(v.x-(F.x+e.projectionMatrix.elements[0])/(F.w+e.projectionMatrix.elements[12]));v.scale.y=C.scale.y*Math.abs(v.y-(F.y+e.projectionMatrix.elements[5])/(F.w+e.projectionMatrix.elements[13]));v.material=C.material;A.elements.push(v)}}}g&&A.elements.sort(d);return A}};
-THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,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;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),f=Math.cos(a.z/2),e=Math.sin(a.x/2),g=Math.sin(a.y/2),k=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=e*d*f+c*g*k;this.y=c*g*f-e*d*k;this.z=c*d*k+e*g*f;this.w=c*d*f-e*g*k}else if(b==="YXZ"){this.x=e*d*f+c*g*k;this.y=c*g*f-e*d*k;this.z=
-c*d*k-e*g*f;this.w=c*d*f+e*g*k}else if(b==="ZXY"){this.x=e*d*f-c*g*k;this.y=c*g*f+e*d*k;this.z=c*d*k+e*g*f;this.w=c*d*f-e*g*k}else if(b==="ZYX"){this.x=e*d*f-c*g*k;this.y=c*g*f+e*d*k;this.z=c*d*k-e*g*f;this.w=c*d*f+e*g*k}else if(b==="YZX"){this.x=e*d*f+c*g*k;this.y=c*g*f+e*d*k;this.z=c*d*k-e*g*f;this.w=c*d*f-e*g*k}else if(b==="XZY"){this.x=e*d*f-c*g*k;this.y=c*g*f-e*d*k;this.z=c*d*k+e*g*f;this.w=c*d*f+e*g*k}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
-d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],f=b[1],e=b[5],g=b[9],k=b[2],m=b[6],b=b[10],j=c+e+b;if(j>0){c=0.5/Math.sqrt(j+1);this.w=0.25/c;this.x=(m-g)*c;this.y=(d-k)*c;this.z=(f-a)*c}else if(c>e&&c>b){c=2*Math.sqrt(1+c-e-b);this.w=(m-g)/c;this.x=0.25*c;this.y=(a+f)/c;this.z=(d+k)/c}else if(e>b){c=2*Math.sqrt(1+e-c-b);this.w=(d-k)/c;this.x=(a+f)/c;this.y=0.25*c;this.z=(g+m)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
-(d+k)/c;this.y=(g+m)/c;this.z=0.25*c}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=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
-this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,k=a.z,a=a.w;this.x=b*a+f*e+c*k-d*g;this.y=c*a+f*g+d*e-b*k;this.z=d*a+f*k+b*g-c*e;this.w=f*a-b*e-c*g-d*k;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,
-e=this.x,g=this.y,k=this.z,m=this.w,j=m*c+g*f-k*d,h=m*d+k*c-e*f,n=m*f+e*d-g*c,c=-e*c-g*d-k*f;b.x=j*m+c*-e+h*-k-n*-g;b.y=h*m+c*-g+n*-e-j*-k;b.z=n*m+c*-k+j*-g-h*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var k=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.001){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);
-this.y=0.5*(d+this.y);this.z=0.5*(f+this.z);return this}g=Math.sin((1-b)*k)/m;k=Math.sin(b*k)/m;this.w=e*g+this.w*k;this.x=c*g+this.x*k;this.y=d*g+this.y*k;this.z=f*g+this.z*k;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(f<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;f=-f}else c.copy(b);if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}f=Math.sin((1-d)*b)/e;d=Math.sin(d*b)/e;c.w=a.w*f+c.w*d;c.x=a.x*f+c.x*d;c.y=a.y*f+c.y*d;c.z=a.z*f+c.z*d;return c};
+THREE.Light&&A.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)f(a.children[c])}};f(a);c===true&&A.objects.sort(d);return A}function b(){var a;if(g===j.length){a=new THREE.RenderableObject;j.push(a)}else a=j[g];g++;return a}function c(){var a;if(k===h.length){a=new THREE.RenderableVertex;h.push(a)}else a=h[k];k++;return a}function d(a,b){return b.z-a.z}function f(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(e>=0&&g>=0&&f>=0&&h>=0)return true;if(e<0&&g<0||f<0&&h<0)return false;
+e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g)));f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,g,j=[],m,k,h=[],n,i,o=[],q,l=[],p,r,u=[],v,B,x=[],A={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,F=new THREE.Vector4,s=new THREE.Matrix4,w=new THREE.Matrix4,D=new THREE.Frustum,J=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);s.multiply(b.projectionMatrix,
+b.matrixWorldInverse);s.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);s.multiply(b.matrixWorld,b.projectionMatrixInverse);s.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectScene=function(b,e,g){var j=e.near,y=e.far,Q=false,S,z,P,$,O,U,T,E,C,H,K,R,ja,ka,Y;
+B=r=q=i=0;A.elements.length=0;b.updateMatrixWorld();e.parent===void 0&&e.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);s.multiply(e.projectionMatrix,e.matrixWorldInverse);D.setFromMatrix(s);A=a(b,false);b=0;for(S=A.objects.length;b<S;b++){C=A.objects[b].object;H=C.matrixWorld;k=0;if(C instanceof THREE.Mesh){K=C.geometry;R=C.geometry.materials;$=K.vertices;ja=K.faces;ka=K.faceVertexUvs;K=C.matrixRotationWorld.extractRotation(H);z=0;for(P=$.length;z<P;z++){m=c();m.positionWorld.copy($[z]);
+H.multiplyVector3(m.positionWorld);m.positionScreen.copy(m.positionWorld);s.multiplyVector4(m.positionScreen);m.positionScreen.x=m.positionScreen.x/m.positionScreen.w;m.positionScreen.y=m.positionScreen.y/m.positionScreen.w;m.visible=m.positionScreen.z>j&&m.positionScreen.z<y}$=0;for(z=ja.length;$<z;$++){P=ja[$];if(P instanceof THREE.Face3){O=h[P.a];U=h[P.b];T=h[P.c];if(O.visible===true&&U.visible===true&&T.visible===true){Q=(T.positionScreen.x-O.positionScreen.x)*(U.positionScreen.y-O.positionScreen.y)-
+(T.positionScreen.y-O.positionScreen.y)*(U.positionScreen.x-O.positionScreen.x)<0;if(C.doubleSided===true||Q!==C.flipSided){E=void 0;if(i===o.length){E=new THREE.RenderableFace3;o.push(E)}else E=o[i];i++;n=E;n.v1.copy(O);n.v2.copy(U);n.v3.copy(T)}else continue}else continue}else if(P instanceof THREE.Face4){O=h[P.a];U=h[P.b];T=h[P.c];E=h[P.d];if(O.visible===true&&U.visible===true&&T.visible===true&&E.visible===true){Q=(E.positionScreen.x-O.positionScreen.x)*(U.positionScreen.y-O.positionScreen.y)-
+(E.positionScreen.y-O.positionScreen.y)*(U.positionScreen.x-O.positionScreen.x)<0||(U.positionScreen.x-T.positionScreen.x)*(E.positionScreen.y-T.positionScreen.y)-(U.positionScreen.y-T.positionScreen.y)*(E.positionScreen.x-T.positionScreen.x)<0;if(C.doubleSided===true||Q!==C.flipSided){Y=void 0;if(q===l.length){Y=new THREE.RenderableFace4;l.push(Y)}else Y=l[q];q++;n=Y;n.v1.copy(O);n.v2.copy(U);n.v3.copy(T);n.v4.copy(E)}else continue}else continue}n.normalWorld.copy(P.normal);Q===false&&(C.flipSided===
+true||C.doubleSided===true)&&n.normalWorld.negate();K.multiplyVector3(n.normalWorld);n.centroidWorld.copy(P.centroid);H.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);s.multiplyVector3(n.centroidScreen);T=P.vertexNormals;O=0;for(U=T.length;O<U;O++){E=n.vertexNormalsWorld[O];E.copy(T[O]);Q===false&&(C.flipSided===true||C.doubleSided===true)&&E.negate();K.multiplyVector3(E)}O=0;for(U=ka.length;O<U;O++){Y=ka[O][$];if(Y!==void 0){T=0;for(E=Y.length;T<E;T++)n.uvs[O][T]=Y[T]}}n.material=
+C.material;n.faceMaterial=P.materialIndex!==null?R[P.materialIndex]:null;n.z=n.centroidScreen.z;A.elements.push(n)}}else if(C instanceof THREE.Line){w.multiply(s,H);$=C.geometry.vertices;O=c();O.positionScreen.copy($[0]);w.multiplyVector4(O.positionScreen);H=C.type===THREE.LinePieces?2:1;z=1;for(P=$.length;z<P;z++){O=c();O.positionScreen.copy($[z]);w.multiplyVector4(O.positionScreen);if(!((z+1)%H>0)){U=h[k-2];J.copy(O.positionScreen);L.copy(U.positionScreen);if(f(J,L)===true){J.multiplyScalar(1/J.w);
+L.multiplyScalar(1/L.w);R=void 0;if(r===u.length){R=new THREE.RenderableLine;u.push(R)}else R=u[r];r++;p=R;p.v1.positionScreen.copy(J);p.v2.positionScreen.copy(L);p.z=Math.max(J.z,L.z);p.material=C.material;A.elements.push(p)}}}}}b=0;for(S=A.sprites.length;b<S;b++){C=A.sprites[b].object;H=C.matrixWorld;if(C instanceof THREE.Particle){F.set(H.elements[12],H.elements[13],H.elements[14],1);s.multiplyVector4(F);F.z=F.z/F.w;if(F.z>0&&F.z<1){j=void 0;if(B===x.length){j=new THREE.RenderableParticle;x.push(j)}else j=
+x[B];B++;v=j;v.object=C;v.x=F.x/F.w;v.y=F.y/F.w;v.z=F.z;v.rotation=C.rotation.z;v.scale.x=C.scale.x*Math.abs(v.x-(F.x+e.projectionMatrix.elements[0])/(F.w+e.projectionMatrix.elements[12]));v.scale.y=C.scale.y*Math.abs(v.y-(F.y+e.projectionMatrix.elements[5])/(F.w+e.projectionMatrix.elements[13]));v.material=C.material;A.elements.push(v)}}}g&&A.elements.sort(d);return A}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,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;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),f=Math.cos(a.z/2),e=Math.sin(a.x/2),g=Math.sin(a.y/2),j=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=e*d*f+c*g*j;this.y=c*g*f-e*d*j;this.z=c*d*j+e*g*f;this.w=c*d*f-e*g*j}else if(b==="YXZ"){this.x=e*d*f+c*g*j;this.y=c*g*f-e*d*j;this.z=
+c*d*j-e*g*f;this.w=c*d*f+e*g*j}else if(b==="ZXY"){this.x=e*d*f-c*g*j;this.y=c*g*f+e*d*j;this.z=c*d*j+e*g*f;this.w=c*d*f-e*g*j}else if(b==="ZYX"){this.x=e*d*f-c*g*j;this.y=c*g*f+e*d*j;this.z=c*d*j-e*g*f;this.w=c*d*f+e*g*j}else if(b==="YZX"){this.x=e*d*f+c*g*j;this.y=c*g*f+e*d*j;this.z=c*d*j-e*g*f;this.w=c*d*f-e*g*j}else if(b==="XZY"){this.x=e*d*f-c*g*j;this.y=c*g*f-e*d*j;this.z=c*d*j+e*g*f;this.w=c*d*f+e*g*j}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
+d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],f=b[1],e=b[5],g=b[9],j=b[2],m=b[6],b=b[10],k=c+e+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(m-g)*c;this.y=(d-j)*c;this.z=(f-a)*c}else if(c>e&&c>b){c=2*Math.sqrt(1+c-e-b);this.w=(m-g)/c;this.x=0.25*c;this.y=(a+f)/c;this.z=(d+j)/c}else if(e>b){c=2*Math.sqrt(1+e-c-b);this.w=(d-j)/c;this.x=(a+f)/c;this.y=0.25*c;this.z=(g+m)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
+(d+j)/c;this.y=(g+m)/c;this.z=0.25*c}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=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
+this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,j=a.z,a=a.w;this.x=b*a+f*e+c*j-d*g;this.y=c*a+f*g+d*e-b*j;this.z=d*a+f*j+b*g-c*e;this.w=f*a-b*e-c*g-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,
+e=this.x,g=this.y,j=this.z,m=this.w,k=m*c+g*f-j*d,h=m*d+j*c-e*f,n=m*f+e*d-g*c,c=-e*c-g*d-j*f;b.x=k*m+c*-e+h*-j-n*-g;b.y=h*m+c*-g+n*-e-k*-j;b.z=n*m+c*-j+k*-g-h*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var j=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.0010){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);
+this.y=0.5*(d+this.y);this.z=0.5*(f+this.z);return this}g=Math.sin((1-b)*j)/m;j=Math.sin(b*j)/m;this.w=e*g+this.w*j;this.x=c*g+this.x*j;this.y=d*g+this.y*j;this.z=f*g+this.z*j;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(f<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;f=-f}else c.copy(b);if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}f=Math.sin((1-d)*b)/e;d=Math.sin(d*b)/e;c.w=a.w*f+c.w*d;c.x=a.x*f+c.x*d;c.y=a.y*f+c.y*d;c.z=a.z*f+c.z*d;return c};
 THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
@@ -101,19 +100,19 @@ THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.
 return a}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u=this.u+(a.u-this.u)*b;this.v=this.v+(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.name="";this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=false};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,
-0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,f,e,g=new THREE.Vector3,k=new THREE.Vector3;a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];d=this.vertices[c.a];f=this.vertices[c.b];e=this.vertices[c.c];g.sub(e,f);k.sub(d,f);g.crossSelf(k);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
+0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,f,e,g=new THREE.Vector3,j=new THREE.Vector3;a=0;for(b=this.faces.length;a<
+b;a++){c=this.faces[a];d=this.vertices[c.a];f=this.vertices[c.b];e=this.vertices[c.c];g.sub(e,f);j.sub(d,f);g.crossSelf(j);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
 else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,f;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.__originalFaceNormal?
 f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];a=0;for(b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var e=new THREE.Geometry;e.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
-[];var g=this.morphNormals[a].faceNormals,k=this.morphNormals[a].vertexNormals,m,j;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];m=new THREE.Vector3;j=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(m);k.push(j)}}g=this.morphNormals[a];e.vertices=this.morphTargets[a].vertices;e.computeFaceNormals();e.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];
-m=g.faceNormals[c];j=g.vertexNormals[c];m.copy(f.normal);if(f instanceof THREE.Face3){j.a.copy(f.vertexNormals[0]);j.b.copy(f.vertexNormals[1]);j.c.copy(f.vertexNormals[2])}else{j.a.copy(f.vertexNormals[0]);j.b.copy(f.vertexNormals[1]);j.c.copy(f.vertexNormals[2]);j.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,t){k=a.vertices[b];m=a.vertices[c];
-j=a.vertices[d];h=g[e];n=g[f];i=g[t];o=m.x-k.x;q=j.x-k.x;l=m.y-k.y;p=j.y-k.y;r=m.z-k.z;u=j.z-k.z;v=n.u-h.u;B=i.u-h.u;x=n.v-h.v;A=i.v-h.v;y=1/(v*A-B*x);D.set((A*o-x*q)*y,(A*l-x*p)*y,(A*r-x*u)*y);J.set((v*q-B*o)*y,(v*p-B*l)*y,(v*u-B*r)*y);s[b].addSelf(D);s[c].addSelf(D);s[d].addSelf(D);w[b].addSelf(J);w[c].addSelf(J);w[d].addSelf(J)}var b,c,d,f,e,g,k,m,j,h,n,i,o,q,l,p,r,u,v,B,x,A,y,F,s=[],w=[],D=new THREE.Vector3,J=new THREE.Vector3,L=new THREE.Vector3,M=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=
+[];var g=this.morphNormals[a].faceNormals,j=this.morphNormals[a].vertexNormals,m,k;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];m=new THREE.Vector3;k=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(m);j.push(k)}}g=this.morphNormals[a];e.vertices=this.morphTargets[a].vertices;e.computeFaceNormals();e.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];
+m=g.faceNormals[c];k=g.vertexNormals[c];m.copy(f.normal);if(f instanceof THREE.Face3){k.a.copy(f.vertexNormals[0]);k.b.copy(f.vertexNormals[1]);k.c.copy(f.vertexNormals[2])}else{k.a.copy(f.vertexNormals[0]);k.b.copy(f.vertexNormals[1]);k.c.copy(f.vertexNormals[2]);k.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,t){j=a.vertices[b];m=a.vertices[c];
+k=a.vertices[d];h=g[e];n=g[f];i=g[t];o=m.x-j.x;q=k.x-j.x;l=m.y-j.y;p=k.y-j.y;r=m.z-j.z;u=k.z-j.z;v=n.u-h.u;B=i.u-h.u;x=n.v-h.v;A=i.v-h.v;y=1/(v*A-B*x);D.set((A*o-x*q)*y,(A*l-x*p)*y,(A*r-x*u)*y);J.set((v*q-B*o)*y,(v*p-B*l)*y,(v*u-B*r)*y);s[b].addSelf(D);s[c].addSelf(D);s[d].addSelf(D);w[b].addSelf(J);w[c].addSelf(J);w[d].addSelf(J)}var b,c,d,f,e,g,j,m,k,h,n,i,o,q,l,p,r,u,v,B,x,A,y,F,s=[],w=[],D=new THREE.Vector3,J=new THREE.Vector3,L=new THREE.Vector3,M=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=
 this.vertices.length;b<c;b++){s[b]=new THREE.Vector3;w[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];g=this.faceVertexUvs[0][b];if(e instanceof THREE.Face3)a(this,e.a,e.b,e.c,0,1,2);else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.d,0,1,3);a(this,e.b,e.c,e.d,1,2,3)}}var G=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++){t.copy(e.vertexNormals[d]);f=e[G[d]];F=s[f];L.copy(F);L.subSelf(t.multiplyScalar(t.dot(F))).normalize();
 M.cross(e.vertexNormals[d],F);f=M.dot(w[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.z,f)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<f;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
-a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g,k,m;e=0;for(g=this.vertices.length;e<g;e++){d=this.vertices[e];d=
+a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g,j,m;e=0;for(g=this.vertices.length;e<g;e++){d=this.vertices[e];d=
 [Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=e;b.push(this.vertices[e]);c[e]=b.length-1}else c[e]=c[a[d]]}e=0;for(g=this.faces.length;e<g;e++){a=this.faces[e];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];d=[a.a,a.b,a.c,a.d];for(f=3;f>0;f--)if(d.indexOf(a["abcd"[f]])!==f){d.splice(f,1);this.faces[e]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);
-d=0;for(k=this.faceVertexUvs.length;d<k;d++)(m=this.faceVertexUvs[d][e])&&m.splice(f,1);this.faces[e].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);
+d=0;for(j=this.faceVertexUvs.length;d<j;d++)(m=this.faceVertexUvs[d][e])&&m.splice(f,1);this.faces[e].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);
 THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);
 THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
@@ -124,67 +123,68 @@ this.shadowCascade=false;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);th
 THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=k.crossOrigin;e.src=b}function e(a,c,d,e,g,h){var k=document.createElement("canvas");a[c]=new THREE.Texture(k);a[c].sourceFile=
-d;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var k=this,m="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var h=a.shading.toLowerCase();h==="phong"?m="MeshPhongMaterial":h==="basic"&&(m="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.visible!==void 0)j.visible=a.visible;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=
-THREE.VertexColors;if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&e(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(j,"normalMap",
-a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){m=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(m.uniforms);h.tNormal.texture=j.normalMap;if(a.mapNormalFactor)h.uNormalScale.value=a.mapNormalFactor;if(j.map){h.tDiffuse.texture=j.map;h.enableDiffuse.value=true}if(j.specularMap){h.tSpecular.texture=j.specularMap;h.enableSpecular.value=true}if(j.lightMap){h.tAO.texture=
-j.lightMap;h.enableAO.value=true}h.uDiffuseColor.value.setHex(j.color);h.uSpecularColor.value.setHex(j.specular);h.uAmbientColor.value.setHex(j.ambient);h.uShininess.value=j.shininess;if(j.opacity!==void 0)h.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:h,lights:true,fog:true})}else j=new THREE[m](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
-THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
-THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var k=JSON.parse(g.responseText);a.loadAjaxBuffers(k,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,k=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){k==0&&(k=e.getResponseHeader("Content-Length"));f({total:k,loaded:e.responseText.length})}}else e.readyState==2&&(k=e.getResponseHeader("Content-Length"))};
+Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=j.crossOrigin;e.src=b}function e(a,c,d,e,g,h){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=
+d;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var j=this,m="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
+if(a.shading){var h=a.shading.toLowerCase();h==="phong"?m="MeshPhongMaterial":h==="basic"&&(m="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)k.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.depthWrite!==void 0)k.depthWrite=a.depthWrite;if(a.visible!==void 0)k.visible=a.visible;if(a.doubleSided!==void 0)k.doubleSided=a.doubleSided;if(a.flipSided!==void 0)k.flipSided=a.flipSided;
+if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;if(a.colorDiffuse)k.color=g(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=g(a.colorSpecular);if(a.colorAmbient)k.ambient=g(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&e(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);
+a.mapLight&&b&&e(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(k,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){m=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(m.uniforms);h.tNormal.texture=k.normalMap;if(a.mapNormalFactor)h.uNormalScale.value=a.mapNormalFactor;if(k.map){h.tDiffuse.texture=
+k.map;h.enableDiffuse.value=true}if(k.specularMap){h.tSpecular.texture=k.specularMap;h.enableSpecular.value=true}if(k.lightMap){h.tAO.texture=k.lightMap;h.enableAO.value=true}h.uDiffuseColor.value.setHex(k.color);h.uSpecularColor.value.setHex(k.specular);h.uAmbientColor.value.setHex(k.ambient);h.uShininess.value=k.shininess;if(k.opacity!==void 0)h.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:h,lights:true,fog:true})}else k=
+new THREE[m](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
+THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var j=JSON.parse(g.responseText);a.loadAjaxBuffers(j,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,j=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){j==0&&(j=e.getResponseHeader("Content-Length"));f({total:j,loaded:e.responseText.length})}}else e.readyState==2&&(j=e.getResponseHeader("Content-Length"))};
 e.open("GET",g,true);e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,m,j,h,n,i,o,q,l,p,r,u,v,B;function x(a){return a%4?4-a%4:0}function A(a,b){return(new Uint8Array(a,b,1))[0]}function y(a,b){return(new Uint32Array(a,b,1))[0]}function F(b,c){var d,e,g,f,h,k,j,m,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];g=l[d*3+1];f=l[d*3+2];h=I[e*2];e=I[e*2+1];k=I[g*2];j=I[g*2+1];g=I[f*2];m=I[f*2+1];f=M.faceVertexUvs[0];var i=[];i.push(new THREE.UV(h,e));i.push(new THREE.UV(k,j));i.push(new THREE.UV(g,
-m));f.push(i)}}function s(b,c){var d,e,g,f,h,k,j,m,l,i,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];g=n[d*4+1];f=n[d*4+2];h=n[d*4+3];k=I[e*2];e=I[e*2+1];j=I[g*2];l=I[g*2+1];m=I[f*2];i=I[f*2+1];f=I[h*2];g=I[h*2+1];h=M.faceVertexUvs[0];var o=[];o.push(new THREE.UV(k,e));o.push(new THREE.UV(j,l));o.push(new THREE.UV(m,i));o.push(new THREE.UV(f,g));h.push(o)}}function w(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];g=c[d*3+1];f=c[d*3+2];h=k[d];
-M.faces.push(new THREE.Face3(e,g,f,null,null,h))}}function D(b,c,d){for(var e,g,f,h,k,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];g=c[d*4+1];f=c[d*4+2];h=c[d*4+3];k=j[d];M.faces.push(new THREE.Face4(e,g,f,h,null,null,k))}}function J(b,c,d,e){for(var g,f,h,k,j,m,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),i=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*3];f=c[e*3+1];h=c[e*3+2];j=d[e*3];m=d[e*3+1];l=d[e*3+2];k=i[e];var n=G[m*3],o=G[m*3+1];m=G[m*3+2];var p=G[l*3],
-q=G[l*3+1];l=G[l*3+2];M.faces.push(new THREE.Face3(g,f,h,[new THREE.Vector3(G[j*3],G[j*3+1],G[j*3+2]),new THREE.Vector3(n,o,m),new THREE.Vector3(p,q,l)],null,k))}}function L(b,c,d,e){for(var g,f,h,k,j,m,l,i,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*4];f=c[e*4+1];h=c[e*4+2];k=c[e*4+3];m=d[e*4];l=d[e*4+1];i=d[e*4+2];n=d[e*4+3];j=o[e];var p=G[l*3],q=G[l*3+1];l=G[l*3+2];var r=G[i*3],s=G[i*3+1];i=G[i*3+2];var t=G[n*3],w=G[n*3+1];n=G[n*3+2];M.faces.push(new THREE.Face4(g,
-f,h,k,[new THREE.Vector3(G[m*3],G[m*3+1],G[m*3+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,i),new THREE.Vector3(t,w,n)],null,j))}}var M=this,t=0,G=[],I=[],N,Q,S;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(M,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,t,12);c=A(a,t+12);A(a,t+13);A(a,t+14);A(a,t+15);f=A(a,t+16);m=A(a,t+17);j=A(a,t+18);h=A(a,t+19);n=y(a,t+20);i=y(a,t+20+4);o=y(a,t+20+8);b=y(a,t+20+12);q=
-y(a,t+20+16);l=y(a,t+20+20);p=y(a,t+20+24);r=y(a,t+20+28);u=y(a,t+20+32);v=y(a,t+20+36);B=y(a,t+20+40);t=t+c;c=f*3+h;S=f*4+h;N=b*c;Q=q*(c+m*3);f=l*(c+j*3);h=p*(c+m*3+j*3);c=r*S;m=u*(S+m*4);j=v*(S+j*4);t=t+function(b){var b=new Float32Array(a,b,n*3),c,d,e,g;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];g=b[c*3+2];M.vertices.push(new THREE.Vector3(d,e,g))}return n*3*Float32Array.BYTES_PER_ELEMENT}(t);t=t+function(b){if(i){var b=new Int8Array(a,b,i*3),c,d,e,g;for(c=0;c<i;c++){d=b[c*3];e=b[c*3+1];g=b[c*3+2];G.push(d/
-127,e/127,g/127)}}return i*3*Int8Array.BYTES_PER_ELEMENT}(t);t=t+x(i*3);t=t+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];I.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(t);N=t+N+x(b*2);Q=N+Q+x(q*2);f=Q+f+x(l*2);h=f+h+x(p*2);c=h+c+x(r*2);m=c+m+x(u*2);j=m+j+x(v*2);(function(a){if(l){var b=a+l*Uint32Array.BYTES_PER_ELEMENT*3;w(l,a,b+l*Uint32Array.BYTES_PER_ELEMENT*3);F(l,b)}})(Q);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-p*Uint32Array.BYTES_PER_ELEMENT*3;J(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);F(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;D(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);s(v,b)}})(m);(function(a){if(B){var b=a+B*Uint32Array.BYTES_PER_ELEMENT*4,c=b+B*Uint32Array.BYTES_PER_ELEMENT*4;L(B,a,b,c+B*Uint32Array.BYTES_PER_ELEMENT*4);s(B,c)}})(j);b&&w(b,t,t+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;J(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,m,k,h,n,i,o,q,l,p,r,u,v,B;function x(a){return a%4?4-a%4:0}function A(a,b){return(new Uint8Array(a,b,1))[0]}function y(a,b){return(new Uint32Array(a,b,1))[0]}function F(b,c){var d,e,g,f,h,j,k,m,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];g=l[d*3+1];f=l[d*3+2];h=I[e*2];e=I[e*2+1];j=I[g*2];k=I[g*2+1];g=I[f*2];m=I[f*2+1];f=M.faceVertexUvs[0];var i=[];i.push(new THREE.UV(h,e));i.push(new THREE.UV(j,k));i.push(new THREE.UV(g,
+m));f.push(i)}}function s(b,c){var d,e,g,f,h,j,k,m,l,i,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];g=n[d*4+1];f=n[d*4+2];h=n[d*4+3];j=I[e*2];e=I[e*2+1];k=I[g*2];l=I[g*2+1];m=I[f*2];i=I[f*2+1];f=I[h*2];g=I[h*2+1];h=M.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,e));o.push(new THREE.UV(k,l));o.push(new THREE.UV(m,i));o.push(new THREE.UV(f,g));h.push(o)}}function w(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];g=c[d*3+1];f=c[d*3+2];h=j[d];
+M.faces.push(new THREE.Face3(e,g,f,null,null,h))}}function D(b,c,d){for(var e,g,f,h,j,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];g=c[d*4+1];f=c[d*4+2];h=c[d*4+3];j=k[d];M.faces.push(new THREE.Face4(e,g,f,h,null,null,j))}}function J(b,c,d,e){for(var g,f,h,j,k,m,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),i=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*3];f=c[e*3+1];h=c[e*3+2];k=d[e*3];m=d[e*3+1];l=d[e*3+2];j=i[e];var n=G[m*3],o=G[m*3+1];m=G[m*3+2];var p=G[l*3],
+q=G[l*3+1];l=G[l*3+2];M.faces.push(new THREE.Face3(g,f,h,[new THREE.Vector3(G[k*3],G[k*3+1],G[k*3+2]),new THREE.Vector3(n,o,m),new THREE.Vector3(p,q,l)],null,j))}}function L(b,c,d,e){for(var g,f,h,j,k,m,l,i,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*4];f=c[e*4+1];h=c[e*4+2];j=c[e*4+3];m=d[e*4];l=d[e*4+1];i=d[e*4+2];n=d[e*4+3];k=o[e];var p=G[l*3],q=G[l*3+1];l=G[l*3+2];var r=G[i*3],s=G[i*3+1];i=G[i*3+2];var t=G[n*3],w=G[n*3+1];n=G[n*3+2];M.faces.push(new THREE.Face4(g,
+f,h,j,[new THREE.Vector3(G[m*3],G[m*3+1],G[m*3+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,i),new THREE.Vector3(t,w,n)],null,k))}}var M=this,t=0,G=[],I=[],N,Q,S;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(M,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,t,12);c=A(a,t+12);A(a,t+13);A(a,t+14);A(a,t+15);f=A(a,t+16);m=A(a,t+17);k=A(a,t+18);h=A(a,t+19);n=y(a,t+20);i=y(a,t+20+4);o=y(a,t+20+8);b=y(a,t+20+12);q=
+y(a,t+20+16);l=y(a,t+20+20);p=y(a,t+20+24);r=y(a,t+20+28);u=y(a,t+20+32);v=y(a,t+20+36);B=y(a,t+20+40);t=t+c;c=f*3+h;S=f*4+h;N=b*c;Q=q*(c+m*3);f=l*(c+k*3);h=p*(c+m*3+k*3);c=r*S;m=u*(S+m*4);k=v*(S+k*4);t=t+function(b){var b=new Float32Array(a,b,n*3),c,d,e,g;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];g=b[c*3+2];M.vertices.push(new THREE.Vector3(d,e,g))}return n*3*Float32Array.BYTES_PER_ELEMENT}(t);t=t+function(b){if(i){var b=new Int8Array(a,b,i*3),c,d,e,g;for(c=0;c<i;c++){d=b[c*3];e=b[c*3+1];g=b[c*3+2];G.push(d/
+127,e/127,g/127)}}return i*3*Int8Array.BYTES_PER_ELEMENT}(t);t=t+x(i*3);t=t+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];I.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(t);N=t+N+x(b*2);Q=N+Q+x(q*2);f=Q+f+x(l*2);h=f+h+x(p*2);c=h+c+x(r*2);m=c+m+x(u*2);k=m+k+x(v*2);(function(a){if(l){var b=a+l*Uint32Array.BYTES_PER_ELEMENT*3;w(l,a,b+l*Uint32Array.BYTES_PER_ELEMENT*3);F(l,b)}})(Q);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+p*Uint32Array.BYTES_PER_ELEMENT*3;J(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);F(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;D(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);s(v,b)}})(m);(function(a){if(B){var b=a+B*Uint32Array.BYTES_PER_ELEMENT*4,c=b+B*Uint32Array.BYTES_PER_ELEMENT*4;L(B,a,b,c+B*Uint32Array.BYTES_PER_ELEMENT*4);s(B,c)}})(k);b&&w(b,t,t+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;J(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
 3)}})(N);r&&D(r,h,h+r*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;L(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=Object.create(THREE.Geometry.prototype);b(new f(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
 THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
-THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,g=0;e.onreadystatechange=function(){if(e.readyState===e.DONE)if(e.status===200||e.status===0){if(e.responseText){var k=JSON.parse(e.responseText);a.createModel(k,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+e.status+"]");else if(e.readyState===e.LOADING){if(f){g===0&&(g=e.getResponseHeader("Content-Length"));
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,g=0;e.onreadystatechange=function(){if(e.readyState===e.DONE)if(e.status===200||e.status===0){if(e.responseText){var j=JSON.parse(e.responseText);a.createModel(j,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+e.status+"]");else if(e.readyState===e.LOADING){if(f){g===0&&(g=e.getResponseHeader("Content-Length"));
 f({total:g,loaded:e.responseText.length})}}else e.readyState===e.HEADERS_RECEIVED&&(g=e.getResponseHeader("Content-Length"))};e.open("GET",b,true);e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,m,j,h,n,i,o,q,l,p,r,u,v,B=a.faces;n=a.vertices;var x=a.normals,A=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(h=n.length;j<h;){i=new THREE.Vector3;i.x=n[j++]*b;i.y=n[j++]*b;i.z=n[j++]*b;d.vertices.push(i)}j=0;for(h=B.length;j<h;){b=B[j++];n=b&1;m=b&2;c=b&
-4;f=b&8;o=b&16;i=b&32;l=b&64;b=b&128;if(n){p=new THREE.Face4;p.a=B[j++];p.b=B[j++];p.c=B[j++];p.d=B[j++];n=4}else{p=new THREE.Face3;p.a=B[j++];p.b=B[j++];p.c=B[j++];n=3}if(m){m=B[j++];p.materialIndex=m}m=d.faces.length;if(c)for(c=0;c<y;c++){r=a.uvs[c];q=B[j++];v=r[q*2];q=r[q*2+1];d.faceUvs[c][m]=new THREE.UV(v,q)}if(f)for(c=0;c<y;c++){r=a.uvs[c];u=[];for(f=0;f<n;f++){q=B[j++];v=r[q*2];q=r[q*2+1];u[f]=new THREE.UV(v,q)}d.faceVertexUvs[c][m]=u}if(o){o=B[j++]*3;f=new THREE.Vector3;f.x=x[o++];f.y=x[o++];
-f.z=x[o];p.normal=f}if(i)for(c=0;c<n;c++){o=B[j++]*3;f=new THREE.Vector3;f.x=x[o++];f.y=x[o++];f.z=x[o];p.vertexNormals.push(f)}if(l){i=B[j++];i=new THREE.Color(A[i]);p.color=i}if(b)for(c=0;c<n;c++){i=B[j++];i=new THREE.Color(A[i]);p.vertexColors.push(i)}d.faces.push(p)}})(f);(function(){var b,c,f,m;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];m=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,m,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-b+2){f=a.skinIndices[b];m=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,m,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,m,j,h,n;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];h=d.morphTargets[c].vertices;n=a.morphTargets[c].vertices;m=0;for(j=n.length;m<j;m=m+3){var i=new THREE.Vector3;i.x=n[m]*b;i.y=n[m+1]*b;i.z=n[m+2]*b;h.push(i)}}}if(a.morphColors!==
-void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;h=a.morphColors[c].colors;b=0;for(m=h.length;b<m;b=b+3){n=new THREE.Color(16755200);n.setRGB(h[b],h[b+1],h[b+2]);j.push(n)}}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,m,k,h,n,i,o,q,l,p,r,u,v,B=a.faces;n=a.vertices;var x=a.normals,A=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(h=n.length;k<h;){i=new THREE.Vector3;i.x=n[k++]*b;i.y=n[k++]*b;i.z=n[k++]*b;d.vertices.push(i)}k=0;for(h=B.length;k<h;){b=B[k++];n=b&1;m=b&2;c=b&
+4;f=b&8;o=b&16;i=b&32;l=b&64;b=b&128;if(n){p=new THREE.Face4;p.a=B[k++];p.b=B[k++];p.c=B[k++];p.d=B[k++];n=4}else{p=new THREE.Face3;p.a=B[k++];p.b=B[k++];p.c=B[k++];n=3}if(m){m=B[k++];p.materialIndex=m}m=d.faces.length;if(c)for(c=0;c<y;c++){r=a.uvs[c];q=B[k++];v=r[q*2];q=r[q*2+1];d.faceUvs[c][m]=new THREE.UV(v,q)}if(f)for(c=0;c<y;c++){r=a.uvs[c];u=[];for(f=0;f<n;f++){q=B[k++];v=r[q*2];q=r[q*2+1];u[f]=new THREE.UV(v,q)}d.faceVertexUvs[c][m]=u}if(o){o=B[k++]*3;f=new THREE.Vector3;f.x=x[o++];f.y=x[o++];
+f.z=x[o];p.normal=f}if(i)for(c=0;c<n;c++){o=B[k++]*3;f=new THREE.Vector3;f.x=x[o++];f.y=x[o++];f.z=x[o];p.vertexNormals.push(f)}if(l){i=B[k++];i=new THREE.Color(A[i]);p.color=i}if(b)for(c=0;c<n;c++){i=B[k++];i=new THREE.Color(A[i]);p.vertexColors.push(i)}d.faces.push(p)}})(f);(function(){var b,c,f,m;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];m=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,m,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){f=a.skinIndices[b];m=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,m,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,m,k,h,n;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];h=d.morphTargets[c].vertices;n=a.morphTargets[c].vertices;m=0;for(k=n.length;m<k;m=m+3){var i=new THREE.Vector3;i.x=n[m]*b;i.y=n[m+1]*b;i.z=n[m+2]*b;h.push(i)}}}if(a.morphColors!==
+void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;h=a.morphColors[c].colors;b=0;for(m=h.length;b<m;b=b+3){n=new THREE.Color(16755200);n.setRGB(h[b],h[b+1],h[b+2]);k.push(n)}}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
 THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),f):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
-a,true);d.send(null);var f=new THREE.LoadingMonitor;f.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});f.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var e=0;e<a.materials.length;++e){var g=a.materials[e],k=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},m=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},j=function(a,d,e,f,g,h){a[d]=new THREE.Texture;a[d].sourceFile=
-e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!=1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[d].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[d].wrapT=f[h[1]]}var j=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!k(a.width)||!k(a.height)){var b=m(a.width),c=m(a.height);j.image=document.createElement("canvas");j.image.width=
-b;j.image.height=c;j.image.getContext("2d").drawImage(a,0,0,b,c)}else j.image=a;j.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},h=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},n="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:g.wireframe};if(g.shading){var o=g.shading.toLowerCase();o==="phong"?n="MeshPhongMaterial":o==="basic"&&(n="MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==void 0)i.blending=
+a,true);d.send(null);var f=new THREE.LoadingMonitor;f.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});f.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var e=0;e<a.materials.length;++e){var g=a.materials[e],j=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},m=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},k=function(a,d,e,f,g,h){a[d]=new THREE.Texture;a[d].sourceFile=
+e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!=1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[d].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[d].wrapT=f[h[1]]}var k=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!j(a.width)||!j(a.height)){var b=m(a.width),c=m(a.height);k.image=document.createElement("canvas");k.image.width=
+b;k.image.height=c;k.image.getContext("2d").drawImage(a,0,0,b,c)}else k.image=a;k.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},h=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},n="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:g.wireframe};if(g.shading){var o=g.shading.toLowerCase();o==="phong"?n="MeshPhongMaterial":o==="basic"&&(n="MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==void 0)i.blending=
 THREE[g.blending];if(g.transparent!==void 0||g.opacity<1)i.transparent=g.transparent;if(g.depthTest!==void 0)i.depthTest=g.depthTest;if(g.depthWrite!==void 0)i.depthWrite=g.depthWrite;if(g.vertexColors!==void 0)if(g.vertexColors=="face")i.vertexColors=THREE.FaceColors;else if(g.vertexColors)i.vertexColors=THREE.VertexColors;if(g.colorDiffuse)i.color=h(g.colorDiffuse);else if(g.DbgColor)i.color=g.DbgColor;if(g.colorSpecular)i.specular=h(g.colorSpecular);if(g.colorAmbient)i.ambient=h(g.colorAmbient);
-if(g.transparency)i.opacity=g.transparency;if(g.specularCoef)i.shininess=g.specularCoef;g.mapDiffuse&&j(i,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&j(i,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapNormal&&j(i,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&j(i,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){j=THREE.ShaderUtils.lib.normal;
-h=THREE.UniformsUtils.clone(j.uniforms);h.tNormal.texture=i.normalMap;if(g.mapNormalFactor)h.uNormalScale.value=g.mapNormalFactor;if(i.map){h.tDiffuse.texture=i.map;h.enableDiffuse.value=true}if(i.specularMap){h.tSpecular.texture=i.specularMap;h.enableSpecular.value=true}if(i.lightMap){h.tAO.texture=i.lightMap;h.enableAO.value=true}h.uDiffuseColor.value.setHex(i.color);h.uSpecularColor.value.setHex(i.specular);h.uAmbientColor.value.setHex(i.ambient);h.uShininess.value=i.shininess;if(i.opacity!==void 0)h.uOpacity.value=
-i.opacity;i=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:h,lights:true,fog:true})}else i=new THREE[n](i);if(g.DbgName!==void 0)i.name=g.DbgName;d.materials[e]=i}}var g=a.faces,q=a.vertices,i=a.normals,j=a.colors,h=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&h++;for(e=0;e<h;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}n=0;for(o=q.length;n<o;){var l=new THREE.Vector3;l.x=q[n++]*f;l.y=q[n++]*f;l.z=q[n++]*f;d.vertices.push(l)}n=0;for(o=g.length;n<
+if(g.transparency)i.opacity=g.transparency;if(g.specularCoef)i.shininess=g.specularCoef;g.mapDiffuse&&k(i,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&k(i,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapNormal&&k(i,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&k(i,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){k=THREE.ShaderUtils.lib.normal;
+h=THREE.UniformsUtils.clone(k.uniforms);h.tNormal.texture=i.normalMap;if(g.mapNormalFactor)h.uNormalScale.value=g.mapNormalFactor;if(i.map){h.tDiffuse.texture=i.map;h.enableDiffuse.value=true}if(i.specularMap){h.tSpecular.texture=i.specularMap;h.enableSpecular.value=true}if(i.lightMap){h.tAO.texture=i.lightMap;h.enableAO.value=true}h.uDiffuseColor.value.setHex(i.color);h.uSpecularColor.value.setHex(i.specular);h.uAmbientColor.value.setHex(i.ambient);h.uShininess.value=i.shininess;if(i.opacity!==void 0)h.uOpacity.value=
+i.opacity;i=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:h,lights:true,fog:true})}else i=new THREE[n](i);if(g.DbgName!==void 0)i.name=g.DbgName;d.materials[e]=i}}var g=a.faces,q=a.vertices,i=a.normals,k=a.colors,h=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&h++;for(e=0;e<h;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}n=0;for(o=q.length;n<o;){var l=new THREE.Vector3;l.x=q[n++]*f;l.y=q[n++]*f;l.z=q[n++]*f;d.vertices.push(l)}n=0;for(o=g.length;n<
 o;){var p=g[n++],r=p&2,e=p&4,u=p&8,v=p&16,q=p&32,B=p&64,l=p&128;if(p&1){p=new THREE.Face4;p.a=g[n++];p.b=g[n++];p.c=g[n++];p.d=g[n++];var x=4}else{p=new THREE.Face3;p.a=g[n++];p.b=g[n++];p.c=g[n++];x=3}if(r){r=g[n++];p.materialIndex=r}var A=d.faces.length;if(e)for(e=0;e<h;e++){var y=a.uvs[e],r=g[n++],F=y[r*2],r=y[r*2+1];d.faceUvs[e][A]=new THREE.UV(F,r)}if(u)for(e=0;e<h;e++){for(var y=a.uvs[e],u=[],s=0;s<x;s++){r=g[n++];F=y[r*2];r=y[r*2+1];u[s]=new THREE.UV(F,r)}d.faceVertexUvs[e][A]=u}if(v){v=g[n++]*
-3;r=new THREE.Vector3;r.x=i[v++];r.y=i[v++];r.z=i[v];p.normal=r}if(q)for(e=0;e<x;e++){v=g[n++]*3;r=new THREE.Vector3;r.x=i[v++];r.y=i[v++];r.z=i[v];p.vertexNormals.push(r)}if(B){q=g[n++];p.color=new THREE.Color(j[q])}if(l)for(e=0;e<x;e++){q=g[n++];p.vertexColors.push(new THREE.Color(j[q]))}d.faces.push(p)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(g=a.skinIndices.length;e<g;e=e+
-2){i=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],i,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(g=a.morphTargets.length;e<g;e++){d.morphTargets[e]={};d.morphTargets[e].name=a.morphTargets[e].name;d.morphTargets[e].vertices=[];i=d.morphTargets[e].vertices;j=a.morphTargets[e].vertices;r=0;for(h=j.length;r<h;r=r+3){l=new THREE.Vector3;l.x=j[r]*f;l.y=j[r+1]*f;l.z=j[r+2]*f;i.push(l)}}}if(a.morphColors){e=0;for(g=a.morphColors.length;e<g;e++){d.morphColors[e]=
-{};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;j=a.morphColors[e].colors;i=0;for(h=j.length;i<h;i=i+3){n=new THREE.Color(16755200);n.setRGB(j[i],j[i+1],j[i+2]);f.push(n)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+3;r=new THREE.Vector3;r.x=i[v++];r.y=i[v++];r.z=i[v];p.normal=r}if(q)for(e=0;e<x;e++){v=g[n++]*3;r=new THREE.Vector3;r.x=i[v++];r.y=i[v++];r.z=i[v];p.vertexNormals.push(r)}if(B){q=g[n++];p.color=new THREE.Color(k[q])}if(l)for(e=0;e<x;e++){q=g[n++];p.vertexColors.push(new THREE.Color(k[q]))}d.faces.push(p)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(g=a.skinIndices.length;e<g;e=e+
+2){i=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],i,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(g=a.morphTargets.length;e<g;e++){d.morphTargets[e]={};d.morphTargets[e].name=a.morphTargets[e].name;d.morphTargets[e].vertices=[];i=d.morphTargets[e].vertices;k=a.morphTargets[e].vertices;r=0;for(h=k.length;r<h;r=r+3){l=new THREE.Vector3;l.x=k[r]*f;l.y=k[r+1]*f;l.z=k[r+2]*f;i.push(l)}}}if(a.morphColors){e=0;for(g=a.morphColors.length;e<g;e++){d.morphColors[e]=
+{};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;k=a.morphColors[e].colors;i=0;for(h=k.length;i<h;i=i+3){n=new THREE.Color(16755200);n.setRGB(k[i],k[i+1],k[i+2]);f.push(n)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var f=JSON.parse(d.responseText);c.createScene(f,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function f(){var a;for(i in t.objects)if(!z.objects[i]){r=t.objects[i];if(r.geometry!==void 0){if(D=z.geometries[r.geometry]){a=false;J=z.materials[r.materials[0]];(a=J instanceof THREE.ShaderMaterial)&&D.computeTangents();x=r.position;A=r.rotation;y=r.quaternion;F=r.scale;u=r.matrix;y=0;r.materials.length==0&&(J=new THREE.MeshFaceMaterial);r.materials.length>1&&(J=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(D,J);a.name=i;if(u){a.matrixAutoUpdate=false;a.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{a.position.set(x[0],x[1],x[2]);if(y){a.quaternion.set(y[0],y[1],y[2],y[3]);a.useQuaternion=true}else a.rotation.set(A[0],A[1],A[2]);a.scale.set(F[0],F[1],F[2])}a.visible=r.visible;a.doubleSided=r.doubleSided;a.castShadow=r.castShadow;a.receiveShadow=r.receiveShadow;z.scene.add(a);z.objects[i]=a}}else{x=r.position;A=r.rotation;y=r.quaternion;
-F=r.scale;y=0;a=new THREE.Object3D;a.name=i;a.position.set(x[0],x[1],x[2]);if(y){a.quaternion.set(y[0],y[1],y[2],y[3]);a.useQuaternion=true}else a.rotation.set(A[0],A[1],A[2]);a.scale.set(F[0],F[1],F[2]);a.visible=r.visible!==void 0?r.visible:false;z.scene.add(a);z.objects[i]=a;z.empties[i]=a}}}function e(a){return function(b){z.geometries[a]=b;f();I=I-1;m.onLoadComplete();k()}}function g(a){return function(b){z.geometries[a]=b}}function k(){m.callbackProgress({totalModels:Q,totalTextures:S,loadedModels:Q-
-I,loadedTextures:S-N},z);m.onLoadProgress();I===0&&N===0&&b(z)}var m=this,j=THREE.Loader.prototype.extractUrlBase(c),h,n,i,o,q,l,p,r,u,v,B,x,A,y,F,s,w,D,J,L,M,t,G,I,N,Q,S,z;t=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;N=I=0;z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(t.transform){a=t.transform.position;v=t.transform.rotation;s=t.transform.scale;a&&z.scene.position.set(a[0],a[1],a[2]);v&&z.scene.rotation.set(v[0],v[1],
-v[2]);s&&z.scene.scale.set(s[0],s[1],s[2]);if(a||v||s){z.scene.updateMatrix();z.scene.updateMatrixWorld()}}a=function(a){return function(){N=N-a;k();m.onLoadComplete()}};for(q in t.cameras){s=t.cameras[q];s.type==="perspective"?L=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):s.type==="ortho"&&(L=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far));x=s.position;v=s.target;s=s.up;L.position.set(x[0],x[1],x[2]);L.target=new THREE.Vector3(v[0],v[1],v[2]);s&&L.up.set(s[0],
-s[1],s[2]);z.cameras[q]=L}for(o in t.lights){v=t.lights[o];q=v.color!==void 0?v.color:16777215;L=v.intensity!==void 0?v.intensity:1;if(v.type==="directional"){x=v.direction;B=new THREE.DirectionalLight(q,L);B.position.set(x[0],x[1],x[2]);B.position.normalize()}else if(v.type==="point"){x=v.position;B=v.distance;B=new THREE.PointLight(q,L,B);B.position.set(x[0],x[1],x[2])}else v.type==="ambient"&&(B=new THREE.AmbientLight(q));z.scene.add(B);z.lights[o]=B}for(l in t.fogs){o=t.fogs[l];o.type==="linear"?
-M=new THREE.Fog(0,o.near,o.far):o.type==="exp2"&&(M=new THREE.FogExp2(0,o.density));s=o.color;M.color.setRGB(s[0],s[1],s[2]);z.fogs[l]=M}if(z.cameras&&t.defaults.camera)z.currentCamera=z.cameras[t.defaults.camera];if(z.fogs&&t.defaults.fog)z.scene.fog=z.fogs[t.defaults.fog];s=t.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(s[0],s[1],s[2]);z.bgColorAlpha=t.defaults.bgalpha;for(h in t.geometries){l=t.geometries[h];if(l.type=="bin_mesh"||l.type=="ascii_mesh"){I=I+1;m.onLoadStart()}}Q=I;
-for(h in t.geometries){l=t.geometries[h];if(l.type==="cube"){D=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides);z.geometries[h]=D}else if(l.type==="plane"){D=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight);z.geometries[h]=D}else if(l.type==="sphere"){D=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight);z.geometries[h]=D}else if(l.type==="cylinder"){D=new THREE.CylinderGeometry(l.topRad,
-l.botRad,l.height,l.radSegs,l.heightSegs);z.geometries[h]=D}else if(l.type==="torus"){D=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT);z.geometries[h]=D}else if(l.type==="icosahedron"){D=new THREE.IcosahedronGeometry(l.radius,l.subdivisions);z.geometries[h]=D}else if(l.type==="bin_mesh")c.load(d(l.url,t.urlBaseType),e(h));else if(l.type==="ascii_mesh")G.load(d(l.url,t.urlBaseType),e(h));else if(l.type==="embedded_mesh"){l=t.embeds[l.id];l.metadata=t.metadata;l&&G.createModel(l,g(h),
-"")}}for(p in t.textures){h=t.textures[p];if(h.url instanceof Array){N=N+h.url.length;for(l=0;l<h.url.length;l++)m.onLoadStart()}else{N=N+1;m.onLoadStart()}}S=N;for(p in t.textures){h=t.textures[p];if(h.mapping!==void 0&&THREE[h.mapping]!==void 0)h.mapping=new THREE[h.mapping];if(h.url instanceof Array){l=h.url.length;M=[];for(c=0;c<l;c++)M[c]=d(h.url[c],t.urlBaseType);l=THREE.ImageUtils.loadTextureCube(M,h.mapping,a(l))}else{l=THREE.ImageUtils.loadTexture(d(h.url,t.urlBaseType),h.mapping,a(1));if(THREE[h.minFilter]!==
-void 0)l.minFilter=THREE[h.minFilter];if(THREE[h.magFilter]!==void 0)l.magFilter=THREE[h.magFilter];if(h.repeat){l.repeat.set(h.repeat[0],h.repeat[1]);if(h.repeat[0]!==1)l.wrapS=THREE.RepeatWrapping;if(h.repeat[1]!==1)l.wrapT=THREE.RepeatWrapping}h.offset&&l.offset.set(h.offset[0],h.offset[1]);if(h.wrap){M={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(M[h.wrap[0]]!==void 0)l.wrapS=M[h.wrap[0]];if(M[h.wrap[1]]!==void 0)l.wrapT=M[h.wrap[1]]}}z.textures[p]=l}for(n in t.materials){u=
-t.materials[n];for(w in u.parameters)if(w==="envMap"||w==="map"||w==="lightMap")u.parameters[w]=z.textures[u.parameters[w]];else if(w==="shading")u.parameters[w]=u.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w==="blending")u.parameters[w]=u.parameters[w]in THREE?THREE[u.parameters[w]]:THREE.NormalBlending;else if(w==="combine")u.parameters[w]=u.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w==="vertexColors")if(u.parameters[w]=="face")u.parameters[w]=
-THREE.FaceColors;else if(u.parameters[w])u.parameters[w]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);h=u.parameters.color;l=u.parameters.specular;M=u.parameters.ambient;c=u.parameters.shininess;a.tNormal.texture=z.textures[u.parameters.normalMap];if(u.parameters.normalMapFactor)a.uNormalScale.value=u.parameters.normalMapFactor;if(u.parameters.map){a.tDiffuse.texture=
-u.parameters.map;a.enableDiffuse.value=true}if(u.parameters.lightMap){a.tAO.texture=u.parameters.lightMap;a.enableAO.value=true}if(u.parameters.specularMap){a.tSpecular.texture=z.textures[u.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(h);a.uSpecularColor.value.setHex(l);a.uAmbientColor.value.setHex(M);a.uShininess.value=c;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;J=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,
-uniforms:a,lights:true,fog:true})}else J=new THREE[u.type](u.parameters);z.materials[n]=J}f();m.callbackSync(z);k()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function f(){var a;for(i in t.objects)if(!z.objects[i]){r=t.objects[i];if(r.geometry!==void 0){if(D=z.geometries[r.geometry]){a=false;J=z.materials[r.materials[0]];(a=J instanceof THREE.ShaderMaterial)&&D.computeTangents();x=r.position;A=r.rotation;y=r.quaternion;F=r.scale;u=r.matrix;y=0;r.materials.length==0&&(J=new THREE.MeshFaceMaterial);r.materials.length>1&&(J=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(D,J);a.name=i;if(u){a.matrixAutoUpdate=false;a.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{a.position.set(x[0],x[1],x[2]);if(y){a.quaternion.set(y[0],y[1],y[2],y[3]);a.useQuaternion=true}else a.rotation.set(A[0],A[1],A[2]);a.scale.set(F[0],F[1],F[2])}a.visible=r.visible;a.castShadow=r.castShadow;a.receiveShadow=r.receiveShadow;z.scene.add(a);z.objects[i]=a}}else{x=r.position;A=r.rotation;y=r.quaternion;F=r.scale;y=0;a=new THREE.Object3D;
+a.name=i;a.position.set(x[0],x[1],x[2]);if(y){a.quaternion.set(y[0],y[1],y[2],y[3]);a.useQuaternion=true}else a.rotation.set(A[0],A[1],A[2]);a.scale.set(F[0],F[1],F[2]);a.visible=r.visible!==void 0?r.visible:false;z.scene.add(a);z.objects[i]=a;z.empties[i]=a}}}function e(a){return function(b){z.geometries[a]=b;f();I=I-1;m.onLoadComplete();j()}}function g(a){return function(b){z.geometries[a]=b}}function j(){m.callbackProgress({totalModels:Q,totalTextures:S,loadedModels:Q-I,loadedTextures:S-N},z);
+m.onLoadProgress();I===0&&N===0&&b(z)}var m=this,k=THREE.Loader.prototype.extractUrlBase(c),h,n,i,o,q,l,p,r,u,v,B,x,A,y,F,s,w,D,J,L,M,t,G,I,N,Q,S,z;t=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;N=I=0;z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(t.transform){a=t.transform.position;v=t.transform.rotation;s=t.transform.scale;a&&z.scene.position.set(a[0],a[1],a[2]);v&&z.scene.rotation.set(v[0],v[1],v[2]);s&&z.scene.scale.set(s[0],
+s[1],s[2]);if(a||v||s){z.scene.updateMatrix();z.scene.updateMatrixWorld()}}a=function(a){return function(){N=N-a;j();m.onLoadComplete()}};for(q in t.cameras){s=t.cameras[q];s.type==="perspective"?L=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):s.type==="ortho"&&(L=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far));x=s.position;v=s.target;s=s.up;L.position.set(x[0],x[1],x[2]);L.target=new THREE.Vector3(v[0],v[1],v[2]);s&&L.up.set(s[0],s[1],s[2]);z.cameras[q]=L}for(o in t.lights){v=
+t.lights[o];q=v.color!==void 0?v.color:16777215;L=v.intensity!==void 0?v.intensity:1;if(v.type==="directional"){x=v.direction;B=new THREE.DirectionalLight(q,L);B.position.set(x[0],x[1],x[2]);B.position.normalize()}else if(v.type==="point"){x=v.position;B=v.distance;B=new THREE.PointLight(q,L,B);B.position.set(x[0],x[1],x[2])}else v.type==="ambient"&&(B=new THREE.AmbientLight(q));z.scene.add(B);z.lights[o]=B}for(l in t.fogs){o=t.fogs[l];o.type==="linear"?M=new THREE.Fog(0,o.near,o.far):o.type==="exp2"&&
+(M=new THREE.FogExp2(0,o.density));s=o.color;M.color.setRGB(s[0],s[1],s[2]);z.fogs[l]=M}if(z.cameras&&t.defaults.camera)z.currentCamera=z.cameras[t.defaults.camera];if(z.fogs&&t.defaults.fog)z.scene.fog=z.fogs[t.defaults.fog];s=t.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(s[0],s[1],s[2]);z.bgColorAlpha=t.defaults.bgalpha;for(h in t.geometries){l=t.geometries[h];if(l.type=="bin_mesh"||l.type=="ascii_mesh"){I=I+1;m.onLoadStart()}}Q=I;for(h in t.geometries){l=t.geometries[h];if(l.type===
+"cube"){D=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides);z.geometries[h]=D}else if(l.type==="plane"){D=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight);z.geometries[h]=D}else if(l.type==="sphere"){D=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight);z.geometries[h]=D}else if(l.type==="cylinder"){D=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,l.heightSegs);z.geometries[h]=
+D}else if(l.type==="torus"){D=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT);z.geometries[h]=D}else if(l.type==="icosahedron"){D=new THREE.IcosahedronGeometry(l.radius,l.subdivisions);z.geometries[h]=D}else if(l.type==="bin_mesh")c.load(d(l.url,t.urlBaseType),e(h));else if(l.type==="ascii_mesh")G.load(d(l.url,t.urlBaseType),e(h));else if(l.type==="embedded_mesh"){l=t.embeds[l.id];l.metadata=t.metadata;l&&G.createModel(l,g(h),"")}}for(p in t.textures){h=t.textures[p];if(h.url instanceof
+Array){N=N+h.url.length;for(l=0;l<h.url.length;l++)m.onLoadStart()}else{N=N+1;m.onLoadStart()}}S=N;for(p in t.textures){h=t.textures[p];if(h.mapping!==void 0&&THREE[h.mapping]!==void 0)h.mapping=new THREE[h.mapping];if(h.url instanceof Array){l=h.url.length;M=[];for(c=0;c<l;c++)M[c]=d(h.url[c],t.urlBaseType);l=THREE.ImageUtils.loadTextureCube(M,h.mapping,a(l))}else{l=THREE.ImageUtils.loadTexture(d(h.url,t.urlBaseType),h.mapping,a(1));if(THREE[h.minFilter]!==void 0)l.minFilter=THREE[h.minFilter];if(THREE[h.magFilter]!==
+void 0)l.magFilter=THREE[h.magFilter];if(h.repeat){l.repeat.set(h.repeat[0],h.repeat[1]);if(h.repeat[0]!==1)l.wrapS=THREE.RepeatWrapping;if(h.repeat[1]!==1)l.wrapT=THREE.RepeatWrapping}h.offset&&l.offset.set(h.offset[0],h.offset[1]);if(h.wrap){M={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(M[h.wrap[0]]!==void 0)l.wrapS=M[h.wrap[0]];if(M[h.wrap[1]]!==void 0)l.wrapT=M[h.wrap[1]]}}z.textures[p]=l}for(n in t.materials){u=t.materials[n];for(w in u.parameters)if(w==="envMap"||w===
+"map"||w==="lightMap")u.parameters[w]=z.textures[u.parameters[w]];else if(w==="shading")u.parameters[w]=u.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w==="blending")u.parameters[w]=u.parameters[w]in THREE?THREE[u.parameters[w]]:THREE.NormalBlending;else if(w==="combine")u.parameters[w]=u.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w==="vertexColors")if(u.parameters[w]=="face")u.parameters[w]=THREE.FaceColors;else if(u.parameters[w])u.parameters[w]=
+THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);h=u.parameters.color;l=u.parameters.specular;M=u.parameters.ambient;c=u.parameters.shininess;a.tNormal.texture=z.textures[u.parameters.normalMap];if(u.parameters.normalMapFactor)a.uNormalScale.value=u.parameters.normalMapFactor;if(u.parameters.map){a.tDiffuse.texture=u.parameters.map;a.enableDiffuse.value=
+true}if(u.parameters.lightMap){a.tAO.texture=u.parameters.lightMap;a.enableAO.value=true}if(u.parameters.specularMap){a.tSpecular.texture=z.textures[u.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(h);a.uSpecularColor.value.setHex(l);a.uAmbientColor.value.setHex(M);a.uShininess.value=c;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;J=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:true,fog:true})}else J=
+new THREE[u.type](u.parameters);z.materials[n]=J}f();m.callbackSync(z);j()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
-a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.visible=a.visible!==void 0?a.visible:true;this.needsUpdate=true};THREE.MaterialCount=0;
-THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
+a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.visible=a.visible!==void 0?a.visible:true;this.doubleSided=a.doubleSided!==void 0?a.doubleSided:false;
+this.flipSided=a.flipSided!==void 0?a.flipSided:false;this.needsUpdate=true};THREE.MaterialCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};
+THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
 true;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==
 void 0?a.morphTargets:false};THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype);
@@ -198,9 +198,9 @@ a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:fa
 THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshFaceMaterial=function(){};
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:true;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.ParticleBasicMaterial.prototype=Object.create(THREE.Material.prototype);
 THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=Object.create(THREE.Material.prototype);
-THREE.Texture=function(a,b,c,d,f,e,g,k,m){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=e!==void 0?e:THREE.LinearMipMapLinearFilter;this.anisotropy=m!==void 0?m:1;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=k!==void 0?k:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=
+THREE.Texture=function(a,b,c,d,f,e,g,j,m){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=e!==void 0?e:THREE.LinearMipMapLinearFilter;this.anisotropy=m!==void 0?m:1;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=j!==void 0?j:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=
 new THREE.Vector2(1,1);this.generateMipmaps=true;this.premultiplyAlpha=false;this.flipY=true;this.needsUpdate=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type,this.anisotropy);a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;return a}};
-THREE.TextureCount=0;THREE.DataTexture=function(a,b,c,d,f,e,g,k,m,j){THREE.Texture.call(this,null,e,g,k,m,j,d,f);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};
+THREE.TextureCount=0;THREE.DataTexture=function(a,b,c,d,f,e,g,j,m,k){THREE.Texture.call(this,null,e,g,j,m,k,d,f);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};
 THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);
@@ -212,14 +212,14 @@ THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.to
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=false;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light){this.__lights.indexOf(a)===-1&&this.__lights.push(a);a.target&&a.target.parent===void 0&&this.add(a.target)}else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
-THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=l.globalAlpha=a}function c(a){if(v!==a){if(a===THREE.NormalBlending)l.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)l.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)l.globalCompositeOperation="darker";v=a}}function d(a){if(B!==a)B=l.strokeStyle=a}function f(a){if(x!==a)x=l.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,k,m,j=new THREE.Projector,h=a.canvas!==
+THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=l.globalAlpha=a}function c(a){if(v!==a){if(a===THREE.NormalBlending)l.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)l.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)l.globalCompositeOperation="darker";v=a}}function d(a){if(B!==a)B=l.strokeStyle=a}function f(a){if(x!==a)x=l.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,j,m,k=new THREE.Projector,h=a.canvas!==
 void 0?a.canvas:document.createElement("canvas"),n,i,o,q,l=h.getContext("2d"),p=new THREE.Color(0),r=0,u=1,v=0,B=null,x=null,A=null,y=null,F=null,s,w,D,J,L=new THREE.RenderableVertex,M=new THREE.RenderableVertex,t,G,I,N,Q,S,z,P,$,O,U,T,E=new THREE.Color,C=new THREE.Color,H=new THREE.Color,K=new THREE.Color,R=new THREE.Color,ja=[],ka=[],Y,ea,da,la,za,Aa,Ba,Ca,Da,Ea,ga=new THREE.Rectangle,aa=new THREE.Rectangle,X=new THREE.Rectangle,ua=false,Z=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,V=
 new THREE.Vector3,ra,sa,ya,ba,ta,va,a=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);ya=sa.getImageData(0,0,2,2);ba=ya.data;ta=document.createElement("canvas");ta.width=ta.height=a;va=ta.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;i=b;o=Math.floor(n/2);q=Math.floor(i/
 2);h.width=n;h.height=i;ga.set(-o,-q,o,q);aa.set(-o,-q,o,q);u=1;v=0;F=y=A=x=B=null};this.setClearColor=function(a,b){p.copy(a);r=b!==void 0?b:1;aa.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){p.setHex(a);r=b!==void 0?b:1;aa.set(-o,-q,o,q)};this.clear=function(){l.setTransform(1,0,0,-1,o,q);if(aa.isEmpty()===false){aa.minSelf(ga);aa.inflate(2);r<1&&l.clearRect(Math.floor(aa.getX()),Math.floor(aa.getY()),Math.floor(aa.getWidth()),Math.floor(aa.getHeight()));if(r>0){c(THREE.NormalBlending);b(1);
 f("rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")");l.fillRect(Math.floor(aa.getX()),Math.floor(aa.getY()),Math.floor(aa.getWidth()),Math.floor(aa.getHeight()))}aa.empty()}};this.render=function(a,h){function i(a){var b,c,d,e;Z.setRGB(0,0,0);ma.setRGB(0,0,0);na.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){Z.r=Z.r+e.r;Z.g=Z.g+e.g;Z.b=Z.b+e.b}else if(d instanceof THREE.DirectionalLight){ma.r=ma.r+e.r;ma.g=ma.g+e.g;
-ma.b=ma.b+e.b}else if(d instanceof THREE.PointLight){na.r=na.r+e.r;na.g=na.g+e.g;na.b=na.b+e.b}}}function n(a,b,c,d){var e,f,g,h,j,k;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){j=g.matrixWorld.getPosition();k=c.dot(j);if(!(k<=0)){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*k}}else if(g instanceof THREE.PointLight){j=g.matrixWorld.getPosition();k=c.dot(V.sub(j,b).normalize());if(!(k<=0)){k=k*(g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,
-1));if(k!=0){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*k}}}}}function p(a,e,g){b(g.opacity);c(g.blending);var h,k,j,m,n,i;if(g instanceof THREE.ParticleBasicMaterial){if(g.map===null){j=e.object.scale.x;m=e.object.scale.y;j=j*e.scale.x*o;m=m*e.scale.y*q;X.set(a.x-j,a.y-m,a.x+j,a.y+m);if(ga.intersects(X)===false)return;f(g.color.getContextStyle());l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(j,m);l.fillRect(-1,-1,2,2)}else{g=g.map.image;n=g.width>>1;i=g.height>>1;j=e.scale.x*
-o;m=e.scale.y*q;h=j*n;k=m*i;X.set(a.x-h,a.y-k,a.x+h,a.y+k);if(ga.intersects(X)===false)return;l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(j,-m);l.translate(-n,-i);l.drawImage(g,0,0)}l.restore()}else if(g instanceof THREE.ParticleCanvasMaterial){h=e.scale.x*o;k=e.scale.y*q;X.set(a.x-h,a.y-k,a.x+h,a.y+k);if(ga.intersects(X)!==false){d(g.color.getContextStyle());f(g.color.getContextStyle());l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(h,k);g.program(l);l.restore()}}}function r(a,
+ma.b=ma.b+e.b}else if(d instanceof THREE.PointLight){na.r=na.r+e.r;na.g=na.g+e.g;na.b=na.b+e.b}}}function n(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){k=g.matrixWorld.getPosition();j=c.dot(k);if(!(j<=0)){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}else if(g instanceof THREE.PointLight){k=g.matrixWorld.getPosition();j=c.dot(V.sub(k,b).normalize());if(!(j<=0)){j=j*(g.distance==0?1:1-Math.min(b.distanceTo(k)/g.distance,
+1));if(j!=0){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}}}}function p(a,e,g){b(g.opacity);c(g.blending);var h,j,k,m,n,i;if(g instanceof THREE.ParticleBasicMaterial){if(g.map===null){k=e.object.scale.x;m=e.object.scale.y;k=k*e.scale.x*o;m=m*e.scale.y*q;X.set(a.x-k,a.y-m,a.x+k,a.y+m);if(ga.intersects(X)===false)return;f(g.color.getContextStyle());l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(k,m);l.fillRect(-1,-1,2,2)}else{g=g.map.image;n=g.width>>1;i=g.height>>1;k=e.scale.x*
+o;m=e.scale.y*q;h=k*n;j=m*i;X.set(a.x-h,a.y-j,a.x+h,a.y+j);if(ga.intersects(X)===false)return;l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(k,-m);l.translate(-n,-i);l.drawImage(g,0,0)}l.restore()}else if(g instanceof THREE.ParticleCanvasMaterial){h=e.scale.x*o;j=e.scale.y*q;X.set(a.x-h,a.y-j,a.x+h,a.y+j);if(ga.intersects(X)!==false){d(g.color.getContextStyle());f(g.color.getContextStyle());l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(h,j);g.program(l);l.restore()}}}function r(a,
 e,f,g){b(g.opacity);c(g.blending);l.beginPath();l.moveTo(a.positionScreen.x,a.positionScreen.y);l.lineTo(e.positionScreen.x,e.positionScreen.y);l.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!==a)A=l.lineWidth=a;a=g.linecap;if(y!==a)y=l.lineCap=a;a=g.linejoin;if(F!==a)F=l.lineJoin=a;d(g.color.getContextStyle());l.stroke();X.inflate(g.linewidth*2)}}function u(a,d,f,g,k,j,l,i){e.info.render.vertices=e.info.render.vertices+3;e.info.render.faces++;b(i.opacity);c(i.blending);
 t=a.positionScreen.x;G=a.positionScreen.y;I=d.positionScreen.x;N=d.positionScreen.y;Q=f.positionScreen.x;S=f.positionScreen.y;x(t,G,I,N,Q,S);if(i instanceof THREE.MeshBasicMaterial)if(i.map!==null){if(i.map.mapping instanceof THREE.UVMapping){la=l.uvs[0];Fa(t,G,I,N,Q,S,la[g].u,la[g].v,la[k].u,la[k].v,la[j].u,la[j].v,i.map)}}else if(i.envMap!==null){if(i.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=h.matrixWorldInverse;V.copy(l.vertexNormalsWorld[g]);za=(V.x*a.elements[0]+V.y*a.elements[4]+
 V.z*a.elements[8])*0.5+0.5;Aa=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(l.vertexNormalsWorld[k]);Ba=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ca=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(l.vertexNormalsWorld[j]);Da=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ea=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;Fa(t,G,I,N,Q,S,za,Aa,Ba,Ca,Da,Ea,i.envMap)}}else i.wireframe===true?ha(i.color,
@@ -237,7 +237,7 @@ l.createPattern(o.image,p===true&&q===true?"repeat":p===true&&q===false?"repeat-
 b.drawImage(o.image,0,0);ka[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=ka[o.id];h=(Math.floor(h)+Math.floor(i)*o.image.width)*4;E.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);fa(E)}else{p=1/p;o=(n*c-j*e)*p;j=(n*d-j*g)*p;c=(k*e-m*c)*p;d=(k*g-m*d)*p;a=a-o*h-c*i;h=b-j*h-d*i;l.save();l.transform(o,j,c,d,a,h);l.fill();l.restore()}}}function pa(a,b,c,d,e,f,g,h,i,j,k,m,n){var o,p;o=n.width-1;p=n.height-1;g=g*o;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;i=i*o-g;j=j*p-h;k=k*o-g;m=m*p-h;p=1/(i*m-k*j);o=(m*
 c-j*e)*p;j=(m*d-j*f)*p;c=(i*e-k*c)*p;d=(i*f-k*d)*p;a=a-o*g-c*h;b=b-j*g-d*h;l.save();l.transform(o,j,c,d,a,b);l.clip();l.drawImage(n,0,0);l.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ba[0]=e<0?0:e>255?255:e;ba[1]=f<0?0:f>255?255:f;ba[2]=a<0?0:a>255?255:a;ba[4]=g<0?0:g>255?255:g;ba[5]=h<0?0:h>255?255:h;ba[6]=b<0?0:b>255?255:b;ba[8]=i<0?0:i>255?
 255:i;ba[9]=j<0?0:j>255?255:j;ba[10]=c<0?0:c>255?255:c;ba[12]=k<0?0:k>255?255:k;ba[13]=l<0?0:l>255?255:l;ba[14]=d<0?0:d>255?255:d;sa.putImageData(ya,0,0);va.drawImage(ra,0,0);return ta}function oa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function qa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!==0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var xa,Ga,W,ca;this.autoClear===true?this.clear():l.setTransform(1,0,0,-1,o,q);e.info.render.vertices=
-0;e.info.render.faces=0;g=j.projectScene(a,h,this.sortElements);k=g.elements;m=g.lights;ua=m.length>0;ua===true&&i(m);xa=0;for(Ga=k.length;xa<Ga;xa++){W=k[xa];ca=W.material;ca=ca instanceof THREE.MeshFaceMaterial?W.faceMaterial:ca;if(!(ca===void 0||ca.visible===false)){X.empty();if(W instanceof THREE.RenderableParticle){s=W;s.x=s.x*o;s.y=s.y*q;p(s,W,ca,a)}else if(W instanceof THREE.RenderableLine){s=W.v1;w=W.v2;s.positionScreen.x=s.positionScreen.x*o;s.positionScreen.y=s.positionScreen.y*q;w.positionScreen.x=
+0;e.info.render.faces=0;g=k.projectScene(a,h,this.sortElements);j=g.elements;m=g.lights;ua=m.length>0;ua===true&&i(m);xa=0;for(Ga=j.length;xa<Ga;xa++){W=j[xa];ca=W.material;ca=ca instanceof THREE.MeshFaceMaterial?W.faceMaterial:ca;if(!(ca===void 0||ca.visible===false)){X.empty();if(W instanceof THREE.RenderableParticle){s=W;s.x=s.x*o;s.y=s.y*q;p(s,W,ca,a)}else if(W instanceof THREE.RenderableLine){s=W.v1;w=W.v2;s.positionScreen.x=s.positionScreen.x*o;s.positionScreen.y=s.positionScreen.y*q;w.positionScreen.x=
 w.positionScreen.x*o;w.positionScreen.y=w.positionScreen.y*q;X.addPoint(s.positionScreen.x,s.positionScreen.y);X.addPoint(w.positionScreen.x,w.positionScreen.y);ga.intersects(X)===true&&r(s,w,W,ca,a)}else if(W instanceof THREE.RenderableFace3){s=W.v1;w=W.v2;D=W.v3;s.positionScreen.x=s.positionScreen.x*o;s.positionScreen.y=s.positionScreen.y*q;w.positionScreen.x=w.positionScreen.x*o;w.positionScreen.y=w.positionScreen.y*q;D.positionScreen.x=D.positionScreen.x*o;D.positionScreen.y=D.positionScreen.y*
 q;if(ca.overdraw===true){ia(s.positionScreen,w.positionScreen);ia(w.positionScreen,D.positionScreen);ia(D.positionScreen,s.positionScreen)}X.add3Points(s.positionScreen.x,s.positionScreen.y,w.positionScreen.x,w.positionScreen.y,D.positionScreen.x,D.positionScreen.y);ga.intersects(X)===true&&u(s,w,D,0,1,2,W,ca,a)}else if(W instanceof THREE.RenderableFace4){s=W.v1;w=W.v2;D=W.v3;J=W.v4;s.positionScreen.x=s.positionScreen.x*o;s.positionScreen.y=s.positionScreen.y*q;w.positionScreen.x=w.positionScreen.x*
 o;w.positionScreen.y=w.positionScreen.y*q;D.positionScreen.x=D.positionScreen.x*o;D.positionScreen.y=D.positionScreen.y*q;J.positionScreen.x=J.positionScreen.x*o;J.positionScreen.y=J.positionScreen.y*q;L.positionScreen.copy(w.positionScreen);M.positionScreen.copy(J.positionScreen);if(ca.overdraw===true){ia(s.positionScreen,w.positionScreen);ia(w.positionScreen,J.positionScreen);ia(J.positionScreen,s.positionScreen);ia(D.positionScreen,L.positionScreen);ia(D.positionScreen,M.positionScreen)}X.addPoint(s.positionScreen.x,

+ 10 - 10
build/custom/ThreeExtras.js

@@ -28,9 +28,9 @@ THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(b,a,c,d){var e=ne
 THREE.SceneUtils={showHierarchy:function(b,a){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=a})},traverseHierarchy:function(b,a){var c,d,e=b.children.length;for(d=0;d<e;d++)c=b.children[d],a(c),THREE.SceneUtils.traverseHierarchy(c,a)},createMultiMaterialObject:function(b,a){var c,d=a.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(b,a[c]);e.add(f)}return e},cloneObject:function(b){var a;b instanceof THREE.MorphAnimMesh?(a=new THREE.MorphAnimMesh(b.geometry,b.material),
 a.duration=b.duration,a.mirroredLoop=b.mirroredLoop,a.time=b.time,a.lastKeyframe=b.lastKeyframe,a.currentKeyframe=b.currentKeyframe,a.direction=b.direction,a.directionBackwards=b.directionBackwards):b instanceof THREE.SkinnedMesh?a=new THREE.SkinnedMesh(b.geometry,b.material):b instanceof THREE.Mesh?a=new THREE.Mesh(b.geometry,b.material):b instanceof THREE.Line?a=new THREE.Line(b.geometry,b.material,b.type):b instanceof THREE.Ribbon?a=new THREE.Ribbon(b.geometry,b.material):b instanceof THREE.ParticleSystem?
 (a=new THREE.ParticleSystem(b.geometry,b.material),a.sortParticles=b.sortParticles):b instanceof THREE.Particle?a=new THREE.Particle(b.material):b instanceof THREE.Sprite?(a=new THREE.Sprite({}),a.color.copy(b.color),a.map=b.map,a.blending=b.blending,a.useScreenCoordinates=b.useScreenCoordinates,a.mergeWith3D=b.mergeWith3D,a.affectedByDistance=b.affectedByDistance,a.scaleByViewport=b.scaleByViewport,a.alignment=b.alignment,a.rotation3d.copy(b.rotation3d),a.rotation=b.rotation,a.opacity=b.opacity,
-a.uvOffset.copy(b.uvOffset),a.uvScale.copy(b.uvScale)):b instanceof THREE.LOD?a=new THREE.LOD:b instanceof THREE.Object3D&&(a=new THREE.Object3D);a.name=b.name;a.parent=b.parent;a.up.copy(b.up);a.position.copy(b.position);a.rotation instanceof THREE.Vector3&&a.rotation.copy(b.rotation);a.eulerOrder=b.eulerOrder;a.scale.copy(b.scale);a.dynamic=b.dynamic;a.doubleSided=b.doubleSided;a.flipSided=b.flipSided;a.renderDepth=b.renderDepth;a.rotationAutoUpdate=b.rotationAutoUpdate;a.matrix.copy(b.matrix);
-a.matrixWorld.copy(b.matrixWorld);a.matrixRotationWorld.copy(b.matrixRotationWorld);a.matrixAutoUpdate=b.matrixAutoUpdate;a.matrixWorldNeedsUpdate=b.matrixWorldNeedsUpdate;a.quaternion.copy(b.quaternion);a.useQuaternion=b.useQuaternion;a.boundRadius=b.boundRadius;a.boundRadiusScale=b.boundRadiusScale;a.visible=b.visible;a.castShadow=b.castShadow;a.receiveShadow=b.receiveShadow;a.frustumCulled=b.frustumCulled;for(var c=0;c<b.children.length;c++){var d=THREE.SceneUtils.cloneObject(b.children[c]);a.children[c]=
-d;d.parent=a}if(b instanceof THREE.LOD)for(c=0;c<b.LODs.length;c++)a.LODs[c]={visibleAtDistance:b.LODs[c].visibleAtDistance,object3D:a.children[c]};return a},detach:function(b,a,c){b.applyMatrix(a.matrixWorld);a.remove(b);c.add(b)},attach:function(b,a,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);b.applyMatrix(d);a.remove(b);c.add(b)}};
+a.uvOffset.copy(b.uvOffset),a.uvScale.copy(b.uvScale)):b instanceof THREE.LOD?a=new THREE.LOD:b instanceof THREE.Object3D&&(a=new THREE.Object3D);a.name=b.name;a.parent=b.parent;a.up.copy(b.up);a.position.copy(b.position);a.rotation instanceof THREE.Vector3&&a.rotation.copy(b.rotation);a.eulerOrder=b.eulerOrder;a.scale.copy(b.scale);a.dynamic=b.dynamic;a.renderDepth=b.renderDepth;a.rotationAutoUpdate=b.rotationAutoUpdate;a.matrix.copy(b.matrix);a.matrixWorld.copy(b.matrixWorld);a.matrixRotationWorld.copy(b.matrixRotationWorld);
+a.matrixAutoUpdate=b.matrixAutoUpdate;a.matrixWorldNeedsUpdate=b.matrixWorldNeedsUpdate;a.quaternion.copy(b.quaternion);a.useQuaternion=b.useQuaternion;a.boundRadius=b.boundRadius;a.boundRadiusScale=b.boundRadiusScale;a.visible=b.visible;a.castShadow=b.castShadow;a.receiveShadow=b.receiveShadow;a.frustumCulled=b.frustumCulled;for(var c=0;c<b.children.length;c++){var d=THREE.SceneUtils.cloneObject(b.children[c]);a.children[c]=d;d.parent=a}if(b instanceof THREE.LOD)for(c=0;c<b.LODs.length;c++)a.LODs[c]=
+{visibleAtDistance:b.LODs[c].visibleAtDistance,object3D:a.children[c]};return a},detach:function(b,a,c){b.applyMatrix(a.matrixWorld);a.remove(b);c.add(b)},attach:function(b,a,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);b.applyMatrix(d);a.remove(b);c.add(b)}};
 THREE.WebGLRenderer&&(THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",
@@ -117,7 +117,7 @@ this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);t
 THREE.Animation.prototype.interpolateCatmullRom=function(b,a){var c=[],d=[],e,f,g,h,i,j;e=(b.length-1)*a;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>b.length-2?f:f+1;c[3]=f>b.length-3?f:f+2;f=b[c[0]];h=b[c[1]];i=b[c[2]];j=b[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(b,a,c,d,e,f,g){b=(c-b)*0.5;d=(d-a)*0.5;return(2*(a-c)+b+d)*g+(-3*(a-c)-2*b-d)*f+b*e+a};THREE.Animation.prototype.getNextKeyWith=function(b,a,c){for(var d=this.data.hierarchy[a].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(d[c][b]!==void 0)return d[c];return this.data.hierarchy[a].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,a,c){for(var d=this.data.hierarchy[a].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][b]!==void 0)return d[c];return this.data.hierarchy[a].keys[d.length-1]};
-THREE.KeyFrameAnimation=function(b,a,c){this.root=b;this.data=THREE.AnimationHandler.get(a);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=0.001;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;b=0;for(a=this.hierarchy.length;b<a;b++){var c=this.data.hierarchy[b].sids,d=this.hierarchy[b];if(this.data.hierarchy[b].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,b,0);g&&g.apply(f)}d.matrixAutoUpdate=
+THREE.KeyFrameAnimation=function(b,a,c){this.root=b;this.data=THREE.AnimationHandler.get(a);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;b=0;for(a=this.hierarchy.length;b<a;b++){var c=this.data.hierarchy[b].sids,d=this.hierarchy[b];if(this.data.hierarchy[b].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,b,0);g&&g.apply(f)}d.matrixAutoUpdate=
 false;this.data.hierarchy[b].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}};
 THREE.KeyFrameAnimation.prototype.play=function(b,a){if(!this.isPlaying){this.isPlaying=true;this.loop=b!==void 0?b:true;this.currentTime=a!==void 0?a:0;this.startTimeMs=a;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey=null;f.animationCache.nextKey=null;f.animationCache.originalMatrix=e instanceof THREE.Bone?
 e.skinMatrix:e.matrix}e=this.data.hierarchy[c].keys;if(e.length){f.animationCache.prevKey=e[0];f.animationCache.nextKey=e[1];this.startTime=Math.min(e[0].time,this.startTime);this.endTime=Math.max(e[e.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
@@ -136,7 +136,7 @@ THREE.CombinedCamera.prototype.setSize=function(b,a){this.cameraP.aspect=b/a;thi
 THREE.CombinedCamera.prototype.setLens=function(b,a){var c=2*Math.atan((a!==void 0?a:24)/(b*2))*(180/Math.PI);this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(b){this.zoom=b;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};
 THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=false};
 THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};
-THREE.FirstPersonControls=function(b,a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=b;this.target=new THREE.Vector3(0,0,0);this.domElement=a!==void 0?a:document;this.movementSpeed=1;this.lookSpeed=0.005;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.heightMax=1;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
+THREE.FirstPersonControls=function(b,a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=b;this.target=new THREE.Vector3(0,0,0);this.domElement=a!==void 0?a:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.heightMax=1;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
 this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=false;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.onMouseDown=function(a){this.domElement!==
 document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=true;break;case 2:this.moveBackward=true}this.mouseDragOn=true};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=false;break;case 2:this.moveBackward=false}this.mouseDragOn=false};this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-
 this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=true;break;case 37:case 65:this.moveLeft=true;break;case 40:case 83:this.moveBackward=true;break;case 39:case 68:this.moveRight=true;break;case 82:this.moveUp=true;break;case 70:this.moveDown=true;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
@@ -147,14 +147,14 @@ this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.
 c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),false);this.handleResize()};
 THREE.PathControls=function(b,a){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,s=0;f=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++){s=d*h.chunks[f]/h.total;b.keys[f]={time:s,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
 return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);e.vertices[c]=new THREE.Vector3(d.x,d.y,d.z)}return e}this.object=b;this.domElement=a!==void 0?a:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
-this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
+this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
 document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=
 a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};
 this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),
 b=new THREE.MeshLambertMaterial({color:65280}),c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),k=0;k<b.points.length;k++){c=new THREE.Mesh(g,h);c.position.copy(b.points[k]);a.add(c)}}this.domElement.addEventListener("mousemove",d(this,
 this.onMouseMove),false)};this.handleResize()};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(b,a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=b;this.domElement=a!==void 0?a:document;a&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
+THREE.FlyControls=function(b,a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=b;this.domElement=a!==void 0?a:document;a&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
 new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 1;break;case 40:this.moveState.pitchDown=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){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -273,7 +273,7 @@ a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);if(a.getParameter(a
 "color");n.scale=a.getUniformLocation(l,"scale");n.rotation=a.getUniformLocation(l,"rotation");n.screenPosition=a.getUniformLocation(l,"screenPosition");k=false};this.render=function(b,d,e,s){var b=b.__webglFlares,u=b.length;if(u){var t=new THREE.Vector3,r=s/e,v=e*0.5,z=s*0.5,A=16/s,x=new THREE.Vector2(A*r,A),w=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),B=n,A=m;a.useProgram(l);if(!k){a.enableVertexAttribArray(m.vertex);a.enableVertexAttribArray(m.uv);k=true}a.uniform1i(B.occlusionMap,0);a.uniform1i(B.map,
 1);a.bindBuffer(a.ARRAY_BUFFER,f);a.vertexAttribPointer(A.vertex,2,a.FLOAT,false,16,0);a.vertexAttribPointer(A.uv,2,a.FLOAT,false,16,8);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,g);a.disable(a.CULL_FACE);a.depthMask(false);var E,G,L,H,D;for(E=0;E<u;E++){A=16/s;x.set(A*r,A);H=b[E];t.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(t);d.projectionMatrix.multiplyVector3(t);w.copy(t);C.x=w.x*v+v;C.y=w.y*z+z;if(j||C.x>0&&C.x<e&&C.y>0&&
 C.y<s){a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,h);a.copyTexImage2D(a.TEXTURE_2D,0,a.RGB,C.x-8,C.y-8,16,16,0);a.uniform1i(B.renderType,0);a.uniform2f(B.scale,x.x,x.y);a.uniform3f(B.screenPosition,w.x,w.y,w.z);a.disable(a.BLEND);a.enable(a.DEPTH_TEST);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0);a.activeTexture(a.TEXTURE0);a.bindTexture(a.TEXTURE_2D,i);a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,C.x-8,C.y-8,16,16,0);a.uniform1i(B.renderType,1);a.disable(a.DEPTH_TEST);a.activeTexture(a.TEXTURE1);
-a.bindTexture(a.TEXTURE_2D,h);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0);H.positionScreen.copy(w);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();a.uniform1i(B.renderType,2);a.enable(a.BLEND);G=0;for(L=H.lensFlares.length;G<L;G++){D=H.lensFlares[G];if(D.opacity>0.001&&D.scale>0.001){w.x=D.x;w.y=D.y;w.z=D.z;A=D.size*D.scale/s;x.x=A*r;x.y=A;a.uniform3f(B.screenPosition,w.x,w.y,w.z);a.uniform2f(B.scale,x.x,x.y);a.uniform1f(B.rotation,D.rotation);a.uniform1f(B.opacity,D.opacity);
+a.bindTexture(a.TEXTURE_2D,h);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0);H.positionScreen.copy(w);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();a.uniform1i(B.renderType,2);a.enable(a.BLEND);G=0;for(L=H.lensFlares.length;G<L;G++){D=H.lensFlares[G];if(D.opacity>0.0010&&D.scale>0.0010){w.x=D.x;w.y=D.y;w.z=D.z;A=D.size*D.scale/s;x.x=A*r;x.y=A;a.uniform3f(B.screenPosition,w.x,w.y,w.z);a.uniform2f(B.scale,x.x,x.y);a.uniform1f(B.rotation,D.rotation);a.uniform1f(B.opacity,D.opacity);
 a.uniform3f(B.color,D.color.r,D.color.g,D.color.b);c.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst);c.setTexture(D.texture,1);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0)}}}}a.enable(a.CULL_FACE);a.enable(a.DEPTH_TEST);a.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var b,a,c,d,e,f=new THREE.Frustum,g=new THREE.Matrix4,h=new THREE.Vector3,i=new THREE.Vector3;this.init=function(f){b=f.context;a=f;var f=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
 vertexShader:f.vertexShader,uniforms:g,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(b,c){a.shadowMapEnabled&&a.shadowMapAutoUpdate&&this.update(b,c)};this.update=function(j,l){var m,n,k,o,q,p,s,u,t,r=[];o=0;b.clearColor(1,1,1,1);b.disable(b.BLEND);b.enable(b.CULL_FACE);a.shadowMapCullFrontFaces?b.cullFace(b.FRONT):b.cullFace(b.BACK);a.setDepthTest(true);m=0;for(n=j.__lights.length;m<n;m++){k=j.__lights[m];if(k.castShadow)if(k instanceof THREE.DirectionalLight&&
@@ -296,8 +296,8 @@ a.uniform3f(s.screenPosition,(v.position.x-k)/k,(t-v.position.y)/t,Math.max(0,Ma
 a.uniform1f(s.opacity,v.opacity);a.uniform3f(s.color,v.color.r,v.color.g,v.color.b);a.uniform1f(s.rotation,v.rotation);a.uniform2fv(s.scale,z);if(v.mergeWith3D&&!r){a.enable(a.DEPTH_TEST);r=true}else if(!v.mergeWith3D&&r){a.disable(a.DEPTH_TEST);r=false}c.setBlending(v.blending,v.blendEquation,v.blendSrc,v.blendDst);c.setTexture(v.map,0);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0)}}a.enable(a.CULL_FACE);a.enable(a.DEPTH_TEST);a.depthMask(true)}}};
 THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var b,a,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){b=e.context;a=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
 function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,l,m,n,k;b.clearColor(1,1,1,1);b.disable(b.BLEND);a.setDepthTest(true);a.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
-h.matrixWorldInverse);e.setFromMatrix(f);a.setRenderTarget(this.renderTarget);a.clear();k=g.__webglObjects;i=0;for(j=k.length;i<j;i++){l=k[i];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}i=0;for(j=k.length;i<j;i++){l=k[i];if(l.render){n=l.object;l=l.buffer;a.setObjectFaces(n);m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;l instanceof
-THREE.BufferGeometry?a.renderBufferDirect(h,g.__lights,null,m,l,n):a.renderBuffer(h,g.__lights,null,m,l,n)}}k=g.__webglObjectsImmediate;i=0;for(j=k.length;i<j;i++){l=k[i];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);a.renderImmediateObject(h,g.__lights,null,c,n)}}i=a.getClearColor();j=a.getClearAlpha();b.clearColor(i.r,i.g,i.b,j);b.enable(b.BLEND)}};
+h.matrixWorldInverse);e.setFromMatrix(f);a.setRenderTarget(this.renderTarget);a.clear();k=g.__webglObjects;i=0;for(j=k.length;i<j;i++){l=k[i];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}i=0;for(j=k.length;i<j;i++){l=k[i];if(l.render){n=l.object;l=l.buffer;n.material&&a.setMaterialFaces(n.material);m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?
+d:c;l instanceof THREE.BufferGeometry?a.renderBufferDirect(h,g.__lights,null,m,l,n):a.renderBuffer(h,g.__lights,null,m,l,n)}}k=g.__webglObjectsImmediate;i=0;for(j=k.length;i<j;i++){l=k[i];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);a.renderImmediateObject(h,g.__lights,null,c,n)}}i=a.getClearColor();j=a.getClearAlpha();b.clearColor(i.r,i.g,i.b,j);b.enable(b.BLEND)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",

+ 104 - 104
build/custom/ThreeWebGL.js

@@ -26,7 +26,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{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=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
 a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],h=a[1],j=a[5],l=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-h)<0.01&&Math.abs(f-c)<0.01&&Math.abs(l-b)<0.01){if(Math.abs(d+h)<0.1&&Math.abs(f+c)<0.1&&Math.abs(l+b)<0.1&&Math.abs(e+j+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;j=(j+1)/2;k=(k+1)/2;d=(d+h)/4;f=(f+c)/4;l=(l+b)/4;if(e>j&&e>k)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(j>
-k)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=l/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=f/d;c=l/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-l)*(b-l)+(f-c)*(f-c)+(h-d)*(h-d));Math.abs(a)<0.001&&(a=1);this.x=(b-l)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+j+k-1)/2);return this}};
+k)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=l/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=f/d;c=l/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-l)*(b-l)+(f-c)*(f-c)+(h-d)*(h-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-l)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+j+k-1)/2);return this}};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],j=c[5],l=c[6],k=c[7],i=c[8],m=c[9],n=c[10],o=c[11],u=c[12],q=c[13],r=c[14],c=c[15];b[0].set(f-a,k-h,o-i,c-u);b[1].set(f+a,k+h,o+i,c+u);b[2].set(f+d,k+j,o+m,c+q);b[3].set(f-d,k-j,o-m,c-q);b[4].set(f-e,k-l,o-n,c-r);b[5].set(f+e,k+l,o+n,c+r);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;e<6;e++){b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
@@ -66,8 +66,8 @@ a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]
 return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,j=a.z,l=e*f,k=e*h;this.set(l*f+c,l*h-d*j,l*j+d*h,0,l*h+d*j,k*h+c,k*j-d*f,0,l*j-d*h,k*j+d*f,e*j*j+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var h=this.elements;h[0]=2*e/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*e/(d-c);h[9]=(d+c)/(d-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(f+e)/(f-e);h[14]=-2*f*e/(f-e);h[3]=
 0;h[7]=0;h[11]=-1;h[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var h=this.elements,j=b-a,l=c-d,k=f-e;h[0]=2/j;h[4]=0;h[8]=0;h[12]=-((b+a)/j);h[1]=0;h[5]=2/l;h[9]=0;h[13]=-((c+d)/l);h[2]=0;h[6]=0;h[10]=-2/k;h[14]=-((f+e)/k);h[3]=0;h[7]=0;h[11]=0;h[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
 a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};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=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
-true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
+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.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=true;this.quaternion=new THREE.Quaternion;
+this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.setEulerFromRotationMatrix((new THREE.Matrix4).extractRotation(this.matrix),this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
@@ -77,23 +77,23 @@ THREE.Projector=function(){function a(a,c){h=0;E.objects.length=0;E.sprites.leng
 THREE.Light&&E.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)e(a.children[c])}};e(a);c===true&&E.objects.sort(d);return E}function b(){var a;if(h===j.length){a=new THREE.RenderableObject;j.push(a)}else a=j[h];h++;return a}function c(){var a;if(k===i.length){a=new THREE.RenderableVertex;i.push(a)}else a=i[k];k++;return a}function d(a,b){return b.z-a.z}function e(a,b){var c=0,d=1,f=a.z+a.w,h=b.z+b.w,e=-a.z+a.w,j=-b.z+b.w;if(f>=0&&h>=0&&e>=0&&j>=0)return true;if(f<0&&h<0||e<0&&j<0)return false;
 f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));e<0?c=Math.max(c,e/(e-j)):j<0&&(d=Math.min(d,e/(e-j)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,h,j=[],l,k,i=[],m,n,o=[],u,q=[],r,p,x=[],w,H,v=[],E={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,G=new THREE.Vector4,C=new THREE.Matrix4,P=new THREE.Matrix4,I=new THREE.Frustum,U=new THREE.Vector4,W=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,
 b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,b.projectionMatrixInverse);C.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectScene=function(b,f,h){var j=f.near,A=f.far,ea=false,ja,Q,la,aa,T,da,ta,ia,N,ua,Ba,ma,
-Ja,Ia,Ca;H=p=u=n=0;E.elements.length=0;if(f.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");b.add(f)}b.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);C.multiply(f.projectionMatrix,f.matrixWorldInverse);I.setFromMatrix(C);E=a(b,false);b=0;for(ja=E.objects.length;b<ja;b++){N=E.objects[b].object;ua=N.matrixWorld;k=0;if(N instanceof THREE.Mesh){Ba=N.geometry;ma=N.geometry.materials;aa=Ba.vertices;Ja=Ba.faces;Ia=Ba.faceVertexUvs;Ba=N.matrixRotationWorld.extractRotation(ua);
-Q=0;for(la=aa.length;Q<la;Q++){l=c();l.positionWorld.copy(aa[Q]);ua.multiplyVector3(l.positionWorld);l.positionScreen.copy(l.positionWorld);C.multiplyVector4(l.positionScreen);l.positionScreen.x=l.positionScreen.x/l.positionScreen.w;l.positionScreen.y=l.positionScreen.y/l.positionScreen.w;l.visible=l.positionScreen.z>j&&l.positionScreen.z<A}aa=0;for(Q=Ja.length;aa<Q;aa++){la=Ja[aa];if(la instanceof THREE.Face3){T=i[la.a];da=i[la.b];ta=i[la.c];if(T.visible===true&&da.visible===true&&ta.visible===true){ea=
-(ta.positionScreen.x-T.positionScreen.x)*(da.positionScreen.y-T.positionScreen.y)-(ta.positionScreen.y-T.positionScreen.y)*(da.positionScreen.x-T.positionScreen.x)<0;if(N.doubleSided===true||ea!==N.flipSided){ia=void 0;if(n===o.length){ia=new THREE.RenderableFace3;o.push(ia)}else ia=o[n];n++;m=ia;m.v1.copy(T);m.v2.copy(da);m.v3.copy(ta)}else continue}else continue}else if(la instanceof THREE.Face4){T=i[la.a];da=i[la.b];ta=i[la.c];ia=i[la.d];if(T.visible===true&&da.visible===true&&ta.visible===true&&
-ia.visible===true){ea=(ia.positionScreen.x-T.positionScreen.x)*(da.positionScreen.y-T.positionScreen.y)-(ia.positionScreen.y-T.positionScreen.y)*(da.positionScreen.x-T.positionScreen.x)<0||(da.positionScreen.x-ta.positionScreen.x)*(ia.positionScreen.y-ta.positionScreen.y)-(da.positionScreen.y-ta.positionScreen.y)*(ia.positionScreen.x-ta.positionScreen.x)<0;if(N.doubleSided===true||ea!==N.flipSided){Ca=void 0;if(u===q.length){Ca=new THREE.RenderableFace4;q.push(Ca)}else Ca=q[u];u++;m=Ca;m.v1.copy(T);
-m.v2.copy(da);m.v3.copy(ta);m.v4.copy(ia)}else continue}else continue}m.normalWorld.copy(la.normal);ea===false&&(N.flipSided===true||N.doubleSided===true)&&m.normalWorld.negate();Ba.multiplyVector3(m.normalWorld);m.centroidWorld.copy(la.centroid);ua.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);C.multiplyVector3(m.centroidScreen);ta=la.vertexNormals;T=0;for(da=ta.length;T<da;T++){ia=m.vertexNormalsWorld[T];ia.copy(ta[T]);ea===false&&(N.flipSided===true||N.doubleSided===true)&&
-ia.negate();Ba.multiplyVector3(ia)}T=0;for(da=Ia.length;T<da;T++){Ca=Ia[T][aa];if(Ca!==void 0){ta=0;for(ia=Ca.length;ta<ia;ta++)m.uvs[T][ta]=Ca[ta]}}m.material=N.material;m.faceMaterial=la.materialIndex!==null?ma[la.materialIndex]:null;m.z=m.centroidScreen.z;E.elements.push(m)}}else if(N instanceof THREE.Line){P.multiply(C,ua);aa=N.geometry.vertices;T=c();T.positionScreen.copy(aa[0]);P.multiplyVector4(T.positionScreen);ua=N.type===THREE.LinePieces?2:1;Q=1;for(la=aa.length;Q<la;Q++){T=c();T.positionScreen.copy(aa[Q]);
-P.multiplyVector4(T.positionScreen);if(!((Q+1)%ua>0)){da=i[k-2];U.copy(T.positionScreen);W.copy(da.positionScreen);if(e(U,W)===true){U.multiplyScalar(1/U.w);W.multiplyScalar(1/W.w);ma=void 0;if(p===x.length){ma=new THREE.RenderableLine;x.push(ma)}else ma=x[p];p++;r=ma;r.v1.positionScreen.copy(U);r.v2.positionScreen.copy(W);r.z=Math.max(U.z,W.z);r.material=N.material;E.elements.push(r)}}}}}b=0;for(ja=E.sprites.length;b<ja;b++){N=E.sprites[b].object;ua=N.matrixWorld;if(N instanceof THREE.Particle){G.set(ua.elements[12],
-ua.elements[13],ua.elements[14],1);C.multiplyVector4(G);G.z=G.z/G.w;if(G.z>0&&G.z<1){j=void 0;if(H===v.length){j=new THREE.RenderableParticle;v.push(j)}else j=v[H];H++;w=j;w.object=N;w.x=G.x/G.w;w.y=G.y/G.w;w.z=G.z;w.rotation=N.rotation.z;w.scale.x=N.scale.x*Math.abs(w.x-(G.x+f.projectionMatrix.elements[0])/(G.w+f.projectionMatrix.elements[12]));w.scale.y=N.scale.y*Math.abs(w.y-(G.y+f.projectionMatrix.elements[5])/(G.w+f.projectionMatrix.elements[13]));w.material=N.material;E.elements.push(w)}}}h&&
-E.elements.sort(d);return E}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+Ja,Ia,Ca;H=p=u=n=0;E.elements.length=0;b.updateMatrixWorld();f.parent===void 0&&f.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);C.multiply(f.projectionMatrix,f.matrixWorldInverse);I.setFromMatrix(C);E=a(b,false);b=0;for(ja=E.objects.length;b<ja;b++){N=E.objects[b].object;ua=N.matrixWorld;k=0;if(N instanceof THREE.Mesh){Ba=N.geometry;ma=N.geometry.materials;aa=Ba.vertices;Ja=Ba.faces;Ia=Ba.faceVertexUvs;Ba=N.matrixRotationWorld.extractRotation(ua);Q=0;for(la=aa.length;Q<la;Q++){l=
+c();l.positionWorld.copy(aa[Q]);ua.multiplyVector3(l.positionWorld);l.positionScreen.copy(l.positionWorld);C.multiplyVector4(l.positionScreen);l.positionScreen.x=l.positionScreen.x/l.positionScreen.w;l.positionScreen.y=l.positionScreen.y/l.positionScreen.w;l.visible=l.positionScreen.z>j&&l.positionScreen.z<A}aa=0;for(Q=Ja.length;aa<Q;aa++){la=Ja[aa];if(la instanceof THREE.Face3){T=i[la.a];da=i[la.b];ta=i[la.c];if(T.visible===true&&da.visible===true&&ta.visible===true){ea=(ta.positionScreen.x-T.positionScreen.x)*
+(da.positionScreen.y-T.positionScreen.y)-(ta.positionScreen.y-T.positionScreen.y)*(da.positionScreen.x-T.positionScreen.x)<0;if(N.doubleSided===true||ea!==N.flipSided){ia=void 0;if(n===o.length){ia=new THREE.RenderableFace3;o.push(ia)}else ia=o[n];n++;m=ia;m.v1.copy(T);m.v2.copy(da);m.v3.copy(ta)}else continue}else continue}else if(la instanceof THREE.Face4){T=i[la.a];da=i[la.b];ta=i[la.c];ia=i[la.d];if(T.visible===true&&da.visible===true&&ta.visible===true&&ia.visible===true){ea=(ia.positionScreen.x-
+T.positionScreen.x)*(da.positionScreen.y-T.positionScreen.y)-(ia.positionScreen.y-T.positionScreen.y)*(da.positionScreen.x-T.positionScreen.x)<0||(da.positionScreen.x-ta.positionScreen.x)*(ia.positionScreen.y-ta.positionScreen.y)-(da.positionScreen.y-ta.positionScreen.y)*(ia.positionScreen.x-ta.positionScreen.x)<0;if(N.doubleSided===true||ea!==N.flipSided){Ca=void 0;if(u===q.length){Ca=new THREE.RenderableFace4;q.push(Ca)}else Ca=q[u];u++;m=Ca;m.v1.copy(T);m.v2.copy(da);m.v3.copy(ta);m.v4.copy(ia)}else continue}else continue}m.normalWorld.copy(la.normal);
+ea===false&&(N.flipSided===true||N.doubleSided===true)&&m.normalWorld.negate();Ba.multiplyVector3(m.normalWorld);m.centroidWorld.copy(la.centroid);ua.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);C.multiplyVector3(m.centroidScreen);ta=la.vertexNormals;T=0;for(da=ta.length;T<da;T++){ia=m.vertexNormalsWorld[T];ia.copy(ta[T]);ea===false&&(N.flipSided===true||N.doubleSided===true)&&ia.negate();Ba.multiplyVector3(ia)}T=0;for(da=Ia.length;T<da;T++){Ca=Ia[T][aa];if(Ca!==void 0){ta=
+0;for(ia=Ca.length;ta<ia;ta++)m.uvs[T][ta]=Ca[ta]}}m.material=N.material;m.faceMaterial=la.materialIndex!==null?ma[la.materialIndex]:null;m.z=m.centroidScreen.z;E.elements.push(m)}}else if(N instanceof THREE.Line){P.multiply(C,ua);aa=N.geometry.vertices;T=c();T.positionScreen.copy(aa[0]);P.multiplyVector4(T.positionScreen);ua=N.type===THREE.LinePieces?2:1;Q=1;for(la=aa.length;Q<la;Q++){T=c();T.positionScreen.copy(aa[Q]);P.multiplyVector4(T.positionScreen);if(!((Q+1)%ua>0)){da=i[k-2];U.copy(T.positionScreen);
+W.copy(da.positionScreen);if(e(U,W)===true){U.multiplyScalar(1/U.w);W.multiplyScalar(1/W.w);ma=void 0;if(p===x.length){ma=new THREE.RenderableLine;x.push(ma)}else ma=x[p];p++;r=ma;r.v1.positionScreen.copy(U);r.v2.positionScreen.copy(W);r.z=Math.max(U.z,W.z);r.material=N.material;E.elements.push(r)}}}}}b=0;for(ja=E.sprites.length;b<ja;b++){N=E.sprites[b].object;ua=N.matrixWorld;if(N instanceof THREE.Particle){G.set(ua.elements[12],ua.elements[13],ua.elements[14],1);C.multiplyVector4(G);G.z=G.z/G.w;
+if(G.z>0&&G.z<1){j=void 0;if(H===v.length){j=new THREE.RenderableParticle;v.push(j)}else j=v[H];H++;w=j;w.object=N;w.x=G.x/G.w;w.y=G.y/G.w;w.z=G.z;w.rotation=N.rotation.z;w.scale.x=N.scale.x*Math.abs(w.x-(G.x+f.projectionMatrix.elements[0])/(G.w+f.projectionMatrix.elements[12]));w.scale.y=N.scale.y*Math.abs(w.y-(G.y+f.projectionMatrix.elements[5])/(G.w+f.projectionMatrix.elements[13]));w.material=N.material;E.elements.push(w)}}}h&&E.elements.sort(d);return E}};
+THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,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;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),h=Math.sin(a.y/2),j=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*h*j;this.y=c*h*e-f*d*j;this.z=c*d*j+f*h*e;this.w=c*d*e-f*h*j}else if(b==="YXZ"){this.x=f*d*e+c*h*j;this.y=c*h*e-f*d*j;this.z=
 c*d*j-f*h*e;this.w=c*d*e+f*h*j}else if(b==="ZXY"){this.x=f*d*e-c*h*j;this.y=c*h*e+f*d*j;this.z=c*d*j+f*h*e;this.w=c*d*e-f*h*j}else if(b==="ZYX"){this.x=f*d*e-c*h*j;this.y=c*h*e+f*d*j;this.z=c*d*j-f*h*e;this.w=c*d*e+f*h*j}else if(b==="YZX"){this.x=f*d*e+c*h*j;this.y=c*h*e+f*d*j;this.z=c*d*j-f*h*e;this.w=c*d*e-f*h*j}else if(b==="XZY"){this.x=f*d*e-c*h*j;this.y=c*h*e-f*d*j;this.z=c*d*j+f*h*e;this.w=c*d*e+f*h*j}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
 d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],h=b[9],j=b[2],l=b[6],b=b[10],k=c+f+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(l-h)*c;this.y=(d-j)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(l-h)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+j)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-j)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(h+l)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
 (d+j)/c;this.y=(h+l)/c;this.z=0.25*c}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=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
 this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,h=a.y,j=a.z,a=a.w;this.x=b*a+e*f+c*j-d*h;this.y=c*a+e*h+d*f-b*j;this.z=d*a+e*j+b*h-c*f;this.w=e*a-b*f-c*h-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,
-f=this.x,h=this.y,j=this.z,l=this.w,k=l*c+h*e-j*d,i=l*d+j*c-f*e,m=l*e+f*d-h*c,c=-f*c-h*d-j*e;b.x=k*l+c*-f+i*-j-m*-h;b.y=i*l+c*-h+m*-f-k*-j;b.z=m*l+c*-j+k*-h-i*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,h=f*a.w+c*a.x+d*a.y+e*a.z;if(h<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;h=-h}else this.copy(a);if(h>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var j=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
+f=this.x,h=this.y,j=this.z,l=this.w,k=l*c+h*e-j*d,i=l*d+j*c-f*e,m=l*e+f*d-h*c,c=-f*c-h*d-j*e;b.x=k*l+c*-f+i*-j-m*-h;b.y=i*l+c*-h+m*-f-k*-j;b.z=m*l+c*-j+k*-h-i*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,h=f*a.w+c*a.x+d*a.y+e*a.z;if(h<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;h=-h}else this.copy(a);if(h>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var j=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
 this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}h=Math.sin((1-b)*j)/l;j=Math.sin(b*j)/l;this.w=f*h+this.w*j;this.x=c*h+this.x*j;this.y=d*h+this.y*j;this.z=e*h+this.z*j;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
 THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,e,f,h){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
@@ -132,11 +132,11 @@ THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStat
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
 Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=j.crossOrigin;f.src=b}function f(a,c,d,f,h,j){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
 d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}h&&a[c].offset.set(h[0],h[1]);if(j){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[j[0]]!==void 0)a[c].wrapS=f[j[0]];if(f[j[1]]!==void 0)a[c].wrapT=f[j[1]]}e(a[c],b+"/"+d)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var j=this,l="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var i=a.shading.toLowerCase();i==="phong"?l="MeshPhongMaterial":i==="basic"&&(l="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)k.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.depthWrite!==void 0)k.depthWrite=a.depthWrite;if(a.visible!==void 0)k.visible=a.visible;if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=
-THREE.VertexColors;if(a.colorDiffuse)k.color=h(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=h(a.colorSpecular);if(a.colorAmbient)k.ambient=h(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",
-a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){l=THREE.ShaderUtils.lib.normal;i=THREE.UniformsUtils.clone(l.uniforms);i.tNormal.texture=k.normalMap;if(a.mapNormalFactor)i.uNormalScale.value=a.mapNormalFactor;if(k.map){i.tDiffuse.texture=k.map;i.enableDiffuse.value=true}if(k.specularMap){i.tSpecular.texture=k.specularMap;i.enableSpecular.value=true}if(k.lightMap){i.tAO.texture=
-k.lightMap;i.enableAO.value=true}i.uDiffuseColor.value.setHex(k.color);i.uSpecularColor.value.setHex(k.specular);i.uAmbientColor.value.setHex(k.ambient);i.uShininess.value=k.shininess;if(k.opacity!==void 0)i.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:i,lights:true,fog:true})}else k=new THREE[l](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
-THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
+if(a.shading){var i=a.shading.toLowerCase();i==="phong"?l="MeshPhongMaterial":i==="basic"&&(l="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)k.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.depthWrite!==void 0)k.depthWrite=a.depthWrite;if(a.visible!==void 0)k.visible=a.visible;if(a.doubleSided!==void 0)k.doubleSided=a.doubleSided;if(a.flipSided!==void 0)k.flipSided=a.flipSided;
+if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;if(a.colorDiffuse)k.color=h(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=h(a.colorSpecular);if(a.colorAmbient)k.ambient=h(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);
+a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){l=THREE.ShaderUtils.lib.normal;i=THREE.UniformsUtils.clone(l.uniforms);i.tNormal.texture=k.normalMap;if(a.mapNormalFactor)i.uNormalScale.value=a.mapNormalFactor;if(k.map){i.tDiffuse.texture=
+k.map;i.enableDiffuse.value=true}if(k.specularMap){i.tSpecular.texture=k.specularMap;i.enableSpecular.value=true}if(k.lightMap){i.tAO.texture=k.lightMap;i.enableAO.value=true}i.uDiffuseColor.value.setHex(k.color);i.uSpecularColor.value.setHex(k.specular);i.uAmbientColor.value.setHex(k.ambient);i.uShininess.value=k.shininess;if(k.opacity!==void 0)i.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:i,lights:true,fog:true})}else k=
+new THREE[l](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState==4)if(h.status==200||h.status==0){var j=JSON.parse(h.responseText);a.loadAjaxBuffers(j,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+h.status+"]")};h.open("GET",b,true);h.overrideMimeType&&h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,h=c+"/"+a.buffers,j=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+h+"] ["+f.status+"]");else if(f.readyState==3){if(e){j==0&&(j=f.getResponseHeader("Content-Length"));e({total:j,loaded:f.responseText.length})}}else f.readyState==2&&(j=f.getResponseHeader("Content-Length"))};
 f.open("GET",h,true);f.responseType="arraybuffer";f.send(null)};
@@ -173,24 +173,25 @@ o;){var r=h[m++],p=r&2,f=r&4,x=r&8,w=r&16,u=r&32,H=r&64,q=r&128;if(r&1){r=new TH
 THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
 THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(n in z.objects)if(!Q.objects[n]){p=z.objects[n];if(p.geometry!==void 0){if(I=Q.geometries[p.geometry]){a=false;U=Q.materials[p.materials[0]];(a=U instanceof THREE.ShaderMaterial)&&I.computeTangents();v=p.position;E=p.rotation;A=p.quaternion;G=p.scale;x=p.matrix;A=0;p.materials.length==0&&(U=new THREE.MeshFaceMaterial);p.materials.length>1&&(U=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(I,U);a.name=n;if(x){a.matrixAutoUpdate=false;a.matrix.set(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15])}else{a.position.set(v[0],v[1],v[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(E[0],E[1],E[2]);a.scale.set(G[0],G[1],G[2])}a.visible=p.visible;a.doubleSided=p.doubleSided;a.castShadow=p.castShadow;a.receiveShadow=p.receiveShadow;Q.scene.add(a);Q.objects[n]=a}}else{v=p.position;E=p.rotation;A=p.quaternion;
-G=p.scale;A=0;a=new THREE.Object3D;a.name=n;a.position.set(v[0],v[1],v[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(E[0],E[1],E[2]);a.scale.set(G[0],G[1],G[2]);a.visible=p.visible!==void 0?p.visible:false;Q.scene.add(a);Q.objects[n]=a;Q.empties[n]=a}}}function f(a){return function(b){Q.geometries[a]=b;e();V=V-1;l.onLoadComplete();j()}}function h(a){return function(b){Q.geometries[a]=b}}function j(){l.callbackProgress({totalModels:ea,totalTextures:ja,loadedModels:ea-
-V,loadedTextures:ja-F},Q);l.onLoadProgress();V===0&&F===0&&b(Q)}var l=this,k=THREE.Loader.prototype.extractUrlBase(c),i,m,n,o,u,q,r,p,x,w,H,v,E,A,G,C,P,I,U,W,S,z,O,V,F,ea,ja,Q;z=a;c=new THREE.BinaryLoader;O=new THREE.JSONLoader;F=V=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(z.transform){a=z.transform.position;w=z.transform.rotation;C=z.transform.scale;a&&Q.scene.position.set(a[0],a[1],a[2]);w&&Q.scene.rotation.set(w[0],
-w[1],w[2]);C&&Q.scene.scale.set(C[0],C[1],C[2]);if(a||w||C){Q.scene.updateMatrix();Q.scene.updateMatrixWorld()}}a=function(a){return function(){F=F-a;j();l.onLoadComplete()}};for(u in z.cameras){C=z.cameras[u];C.type==="perspective"?W=new THREE.PerspectiveCamera(C.fov,C.aspect,C.near,C.far):C.type==="ortho"&&(W=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far));v=C.position;w=C.target;C=C.up;W.position.set(v[0],v[1],v[2]);W.target=new THREE.Vector3(w[0],w[1],w[2]);C&&W.up.set(C[0],
-C[1],C[2]);Q.cameras[u]=W}for(o in z.lights){w=z.lights[o];u=w.color!==void 0?w.color:16777215;W=w.intensity!==void 0?w.intensity:1;if(w.type==="directional"){v=w.direction;H=new THREE.DirectionalLight(u,W);H.position.set(v[0],v[1],v[2]);H.position.normalize()}else if(w.type==="point"){v=w.position;H=w.distance;H=new THREE.PointLight(u,W,H);H.position.set(v[0],v[1],v[2])}else w.type==="ambient"&&(H=new THREE.AmbientLight(u));Q.scene.add(H);Q.lights[o]=H}for(q in z.fogs){o=z.fogs[q];o.type==="linear"?
-S=new THREE.Fog(0,o.near,o.far):o.type==="exp2"&&(S=new THREE.FogExp2(0,o.density));C=o.color;S.color.setRGB(C[0],C[1],C[2]);Q.fogs[q]=S}if(Q.cameras&&z.defaults.camera)Q.currentCamera=Q.cameras[z.defaults.camera];if(Q.fogs&&z.defaults.fog)Q.scene.fog=Q.fogs[z.defaults.fog];C=z.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(C[0],C[1],C[2]);Q.bgColorAlpha=z.defaults.bgalpha;for(i in z.geometries){q=z.geometries[i];if(q.type=="bin_mesh"||q.type=="ascii_mesh"){V=V+1;l.onLoadStart()}}ea=
-V;for(i in z.geometries){q=z.geometries[i];if(q.type==="cube"){I=new THREE.CubeGeometry(q.width,q.height,q.depth,q.segmentsWidth,q.segmentsHeight,q.segmentsDepth,null,q.flipped,q.sides);Q.geometries[i]=I}else if(q.type==="plane"){I=new THREE.PlaneGeometry(q.width,q.height,q.segmentsWidth,q.segmentsHeight);Q.geometries[i]=I}else if(q.type==="sphere"){I=new THREE.SphereGeometry(q.radius,q.segmentsWidth,q.segmentsHeight);Q.geometries[i]=I}else if(q.type==="cylinder"){I=new THREE.CylinderGeometry(q.topRad,
-q.botRad,q.height,q.radSegs,q.heightSegs);Q.geometries[i]=I}else if(q.type==="torus"){I=new THREE.TorusGeometry(q.radius,q.tube,q.segmentsR,q.segmentsT);Q.geometries[i]=I}else if(q.type==="icosahedron"){I=new THREE.IcosahedronGeometry(q.radius,q.subdivisions);Q.geometries[i]=I}else if(q.type==="bin_mesh")c.load(d(q.url,z.urlBaseType),f(i));else if(q.type==="ascii_mesh")O.load(d(q.url,z.urlBaseType),f(i));else if(q.type==="embedded_mesh"){q=z.embeds[q.id];q.metadata=z.metadata;q&&O.createModel(q,h(i),
-"")}}for(r in z.textures){i=z.textures[r];if(i.url instanceof Array){F=F+i.url.length;for(q=0;q<i.url.length;q++)l.onLoadStart()}else{F=F+1;l.onLoadStart()}}ja=F;for(r in z.textures){i=z.textures[r];if(i.mapping!==void 0&&THREE[i.mapping]!==void 0)i.mapping=new THREE[i.mapping];if(i.url instanceof Array){q=i.url.length;S=[];for(c=0;c<q;c++)S[c]=d(i.url[c],z.urlBaseType);q=THREE.ImageUtils.loadTextureCube(S,i.mapping,a(q))}else{q=THREE.ImageUtils.loadTexture(d(i.url,z.urlBaseType),i.mapping,a(1));
-if(THREE[i.minFilter]!==void 0)q.minFilter=THREE[i.minFilter];if(THREE[i.magFilter]!==void 0)q.magFilter=THREE[i.magFilter];if(i.repeat){q.repeat.set(i.repeat[0],i.repeat[1]);if(i.repeat[0]!==1)q.wrapS=THREE.RepeatWrapping;if(i.repeat[1]!==1)q.wrapT=THREE.RepeatWrapping}i.offset&&q.offset.set(i.offset[0],i.offset[1]);if(i.wrap){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(S[i.wrap[0]]!==void 0)q.wrapS=S[i.wrap[0]];if(S[i.wrap[1]]!==void 0)q.wrapT=S[i.wrap[1]]}}Q.textures[r]=
-q}for(m in z.materials){x=z.materials[m];for(P in x.parameters)if(P==="envMap"||P==="map"||P==="lightMap")x.parameters[P]=Q.textures[x.parameters[P]];else if(P==="shading")x.parameters[P]=x.parameters[P]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(P==="blending")x.parameters[P]=x.parameters[P]in THREE?THREE[x.parameters[P]]:THREE.NormalBlending;else if(P==="combine")x.parameters[P]=x.parameters[P]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(P==="vertexColors")if(x.parameters[P]==
-"face")x.parameters[P]=THREE.FaceColors;else if(x.parameters[P])x.parameters[P]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=true;if(x.parameters.normalMap){r=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(r.uniforms);i=x.parameters.color;q=x.parameters.specular;S=x.parameters.ambient;c=x.parameters.shininess;a.tNormal.texture=Q.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)a.uNormalScale.value=x.parameters.normalMapFactor;
-if(x.parameters.map){a.tDiffuse.texture=x.parameters.map;a.enableDiffuse.value=true}if(x.parameters.lightMap){a.tAO.texture=x.parameters.lightMap;a.enableAO.value=true}if(x.parameters.specularMap){a.tSpecular.texture=Q.textures[x.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(i);a.uSpecularColor.value.setHex(q);a.uAmbientColor.value.setHex(S);a.uShininess.value=c;if(x.parameters.opacity)a.uOpacity.value=x.parameters.opacity;U=new THREE.ShaderMaterial({fragmentShader:r.fragmentShader,
-vertexShader:r.vertexShader,uniforms:a,lights:true,fog:true})}else U=new THREE[x.type](x.parameters);Q.materials[m]=U}e();l.callbackSync(Q);j()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+a=new THREE.Mesh(I,U);a.name=n;if(x){a.matrixAutoUpdate=false;a.matrix.set(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15])}else{a.position.set(v[0],v[1],v[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(E[0],E[1],E[2]);a.scale.set(G[0],G[1],G[2])}a.visible=p.visible;a.castShadow=p.castShadow;a.receiveShadow=p.receiveShadow;Q.scene.add(a);Q.objects[n]=a}}else{v=p.position;E=p.rotation;A=p.quaternion;G=p.scale;A=0;a=new THREE.Object3D;
+a.name=n;a.position.set(v[0],v[1],v[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(E[0],E[1],E[2]);a.scale.set(G[0],G[1],G[2]);a.visible=p.visible!==void 0?p.visible:false;Q.scene.add(a);Q.objects[n]=a;Q.empties[n]=a}}}function f(a){return function(b){Q.geometries[a]=b;e();V=V-1;l.onLoadComplete();j()}}function h(a){return function(b){Q.geometries[a]=b}}function j(){l.callbackProgress({totalModels:ea,totalTextures:ja,loadedModels:ea-V,loadedTextures:ja-F},
+Q);l.onLoadProgress();V===0&&F===0&&b(Q)}var l=this,k=THREE.Loader.prototype.extractUrlBase(c),i,m,n,o,u,q,r,p,x,w,H,v,E,A,G,C,P,I,U,W,S,z,O,V,F,ea,ja,Q;z=a;c=new THREE.BinaryLoader;O=new THREE.JSONLoader;F=V=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(z.transform){a=z.transform.position;w=z.transform.rotation;C=z.transform.scale;a&&Q.scene.position.set(a[0],a[1],a[2]);w&&Q.scene.rotation.set(w[0],w[1],w[2]);C&&Q.scene.scale.set(C[0],
+C[1],C[2]);if(a||w||C){Q.scene.updateMatrix();Q.scene.updateMatrixWorld()}}a=function(a){return function(){F=F-a;j();l.onLoadComplete()}};for(u in z.cameras){C=z.cameras[u];C.type==="perspective"?W=new THREE.PerspectiveCamera(C.fov,C.aspect,C.near,C.far):C.type==="ortho"&&(W=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far));v=C.position;w=C.target;C=C.up;W.position.set(v[0],v[1],v[2]);W.target=new THREE.Vector3(w[0],w[1],w[2]);C&&W.up.set(C[0],C[1],C[2]);Q.cameras[u]=W}for(o in z.lights){w=
+z.lights[o];u=w.color!==void 0?w.color:16777215;W=w.intensity!==void 0?w.intensity:1;if(w.type==="directional"){v=w.direction;H=new THREE.DirectionalLight(u,W);H.position.set(v[0],v[1],v[2]);H.position.normalize()}else if(w.type==="point"){v=w.position;H=w.distance;H=new THREE.PointLight(u,W,H);H.position.set(v[0],v[1],v[2])}else w.type==="ambient"&&(H=new THREE.AmbientLight(u));Q.scene.add(H);Q.lights[o]=H}for(q in z.fogs){o=z.fogs[q];o.type==="linear"?S=new THREE.Fog(0,o.near,o.far):o.type==="exp2"&&
+(S=new THREE.FogExp2(0,o.density));C=o.color;S.color.setRGB(C[0],C[1],C[2]);Q.fogs[q]=S}if(Q.cameras&&z.defaults.camera)Q.currentCamera=Q.cameras[z.defaults.camera];if(Q.fogs&&z.defaults.fog)Q.scene.fog=Q.fogs[z.defaults.fog];C=z.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(C[0],C[1],C[2]);Q.bgColorAlpha=z.defaults.bgalpha;for(i in z.geometries){q=z.geometries[i];if(q.type=="bin_mesh"||q.type=="ascii_mesh"){V=V+1;l.onLoadStart()}}ea=V;for(i in z.geometries){q=z.geometries[i];if(q.type===
+"cube"){I=new THREE.CubeGeometry(q.width,q.height,q.depth,q.segmentsWidth,q.segmentsHeight,q.segmentsDepth,null,q.flipped,q.sides);Q.geometries[i]=I}else if(q.type==="plane"){I=new THREE.PlaneGeometry(q.width,q.height,q.segmentsWidth,q.segmentsHeight);Q.geometries[i]=I}else if(q.type==="sphere"){I=new THREE.SphereGeometry(q.radius,q.segmentsWidth,q.segmentsHeight);Q.geometries[i]=I}else if(q.type==="cylinder"){I=new THREE.CylinderGeometry(q.topRad,q.botRad,q.height,q.radSegs,q.heightSegs);Q.geometries[i]=
+I}else if(q.type==="torus"){I=new THREE.TorusGeometry(q.radius,q.tube,q.segmentsR,q.segmentsT);Q.geometries[i]=I}else if(q.type==="icosahedron"){I=new THREE.IcosahedronGeometry(q.radius,q.subdivisions);Q.geometries[i]=I}else if(q.type==="bin_mesh")c.load(d(q.url,z.urlBaseType),f(i));else if(q.type==="ascii_mesh")O.load(d(q.url,z.urlBaseType),f(i));else if(q.type==="embedded_mesh"){q=z.embeds[q.id];q.metadata=z.metadata;q&&O.createModel(q,h(i),"")}}for(r in z.textures){i=z.textures[r];if(i.url instanceof
+Array){F=F+i.url.length;for(q=0;q<i.url.length;q++)l.onLoadStart()}else{F=F+1;l.onLoadStart()}}ja=F;for(r in z.textures){i=z.textures[r];if(i.mapping!==void 0&&THREE[i.mapping]!==void 0)i.mapping=new THREE[i.mapping];if(i.url instanceof Array){q=i.url.length;S=[];for(c=0;c<q;c++)S[c]=d(i.url[c],z.urlBaseType);q=THREE.ImageUtils.loadTextureCube(S,i.mapping,a(q))}else{q=THREE.ImageUtils.loadTexture(d(i.url,z.urlBaseType),i.mapping,a(1));if(THREE[i.minFilter]!==void 0)q.minFilter=THREE[i.minFilter];
+if(THREE[i.magFilter]!==void 0)q.magFilter=THREE[i.magFilter];if(i.repeat){q.repeat.set(i.repeat[0],i.repeat[1]);if(i.repeat[0]!==1)q.wrapS=THREE.RepeatWrapping;if(i.repeat[1]!==1)q.wrapT=THREE.RepeatWrapping}i.offset&&q.offset.set(i.offset[0],i.offset[1]);if(i.wrap){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(S[i.wrap[0]]!==void 0)q.wrapS=S[i.wrap[0]];if(S[i.wrap[1]]!==void 0)q.wrapT=S[i.wrap[1]]}}Q.textures[r]=q}for(m in z.materials){x=z.materials[m];for(P in x.parameters)if(P===
+"envMap"||P==="map"||P==="lightMap")x.parameters[P]=Q.textures[x.parameters[P]];else if(P==="shading")x.parameters[P]=x.parameters[P]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(P==="blending")x.parameters[P]=x.parameters[P]in THREE?THREE[x.parameters[P]]:THREE.NormalBlending;else if(P==="combine")x.parameters[P]=x.parameters[P]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(P==="vertexColors")if(x.parameters[P]=="face")x.parameters[P]=THREE.FaceColors;else if(x.parameters[P])x.parameters[P]=
+THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=true;if(x.parameters.normalMap){r=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(r.uniforms);i=x.parameters.color;q=x.parameters.specular;S=x.parameters.ambient;c=x.parameters.shininess;a.tNormal.texture=Q.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)a.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map){a.tDiffuse.texture=x.parameters.map;a.enableDiffuse.value=
+true}if(x.parameters.lightMap){a.tAO.texture=x.parameters.lightMap;a.enableAO.value=true}if(x.parameters.specularMap){a.tSpecular.texture=Q.textures[x.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(i);a.uSpecularColor.value.setHex(q);a.uAmbientColor.value.setHex(S);a.uShininess.value=c;if(x.parameters.opacity)a.uOpacity.value=x.parameters.opacity;U=new THREE.ShaderMaterial({fragmentShader:r.fragmentShader,vertexShader:r.vertexShader,uniforms:a,lights:true,fog:true})}else U=
+new THREE[x.type](x.parameters);Q.materials[m]=U}e();l.callbackSync(Q);j()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
-a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.visible=a.visible!==void 0?a.visible:true;this.needsUpdate=true};THREE.MaterialCount=0;
-THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
+a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.visible=a.visible!==void 0?a.visible:true;this.doubleSided=a.doubleSided!==void 0?a.doubleSided:false;
+this.flipSided=a.flipSided!==void 0?a.flipSided:false;this.needsUpdate=true};THREE.MaterialCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};
+THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
 true;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==
 void 0?a.morphTargets:false};THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype);
@@ -276,7 +277,7 @@ if(i.boundTo===void 0||i.boundTo==="vertices"){e=0;f=i.value.length;if(i.size===
 h=i.value[h];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;i.array[e+3]=h.w;e=e+4}}}}}else{if(o)for(d=0;d<h;d++){f=i[d];e=d*3;m[e]=f.x;m[e+1]=f.y;m[e+2]=f.z}if(q)for(d=0;d<k;d++){f=j[d];e=d*3;l[e]=f.r;l[e+1]=f.g;l[e+2]=f.b}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){f=i.value.length;e=0;if(i.size===1)for(d=0;d<f;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+1]=h.y;e=e+2}else if(i.size===
 3)if(i.type==="c")for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.r;i.array[e+1]=h.g;i.array[e+2]=h.b;e=e+3}else for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;e=e+3}else if(i.size===4)for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;i.array[e+3]=h.w;e=e+4}}}}}if(o||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,m,b)}if(q||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,
 l,b)}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];if(i.needsUpdate||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.bufferData(g.ARRAY_BUFFER,i.array,b)}}}}function h(a,b){return b.z-a.z}function j(a,b){return b[1]-a[1]}function l(a,b,c){if(a.length)for(var d=0,g=a.length;d<g;d++){da=Q=null;aa=T=N=ia=Ca=Ia=ua=-1;Wa=true;a[d].render(b,c,gc,xc);da=Q=null;aa=T=N=ia=Ca=Ia=ua=-1;Wa=true}}function k(a,b,c,d,g,f,e,h){var i,j,k,m;if(b){j=a.length-1;m=b=-1}else{j=0;b=a.length;m=1}for(var l=j;l!==b;l=
-l+m){i=a[l];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;e&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);x(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(j);k instanceof THREE.BufferGeometry?F.renderBufferDirect(d,g,f,i,k,j):F.renderBuffer(d,g,f,i,k,j)}}}function i(a,b,c,d,g,f,e){for(var h,i,j=0,k=a.length;j<k;j++){h=a[j];i=h.object;if(i.visible){if(e)h=e;else{h=h[b];
+l+m){i=a[l];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;e&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);x(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setMaterialFaces(i);k instanceof THREE.BufferGeometry?F.renderBufferDirect(d,g,f,i,k,j):F.renderBuffer(d,g,f,i,k,j)}}}function i(a,b,c,d,g,f,e){for(var h,i,j=0,k=a.length;j<k;j++){h=a[j];i=h.object;if(i.visible){if(e)h=e;else{h=h[b];
 if(!h)continue;f&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);x(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,g,h,i)}}}function m(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function o(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function u(a,b){for(var c=
 a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function r(a,b,c,d,f){if(d.needsUpdate){d.program&&F.deallocateMaterial(d);F.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);var e=false,h=d.program,i=h.uniforms,j=d.uniforms;if(h!==Q){g.useProgram(h);Q=h;e=true}if(d.id!==aa){aa=d.id;e=true}if(e||a!==da){g.uniformMatrix4fv(i.projectionMatrix,
 false,a._projectionMatrixArray);a!==da&&(da=a)}if(e){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Wa){for(var k,m=0,l=0,n=0,o,q,r,p=yc,u=p.directional.colors,w=p.directional.positions,v=p.point.colors,x=p.point.positions,z=p.point.distances,C=p.spot.colors,E=p.spot.positions,O=p.spot.distances,
@@ -329,79 +330,78 @@ e.__webglColorBuffer);g.vertexAttribPointer(b.color,3,g.FLOAT,false,0,0)}if(b.no
 if(b.uv2>=0)if(e.__webglUV2Buffer){g.bindBuffer(g.ARRAY_BUFFER,e.__webglUV2Buffer);g.vertexAttribPointer(b.uv2,2,g.FLOAT,false,0,0);g.enableVertexAttribArray(b.uv2)}else g.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexABuffer);g.vertexAttribPointer(b.skinVertexA,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,
 false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);g.vertexAttribPointer(b.skinIndex,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==Mb){g.lineWidth(d);Mb=d}a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);g.drawElements(g.LINES,e.__webglLineCount,g.UNSIGNED_SHORT,0)}else{a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);
 g.drawElements(g.TRIANGLES,e.__webglFaceCount,g.UNSIGNED_SHORT,0)}F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+e.__webglFaceCount;F.info.render.faces=F.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?g.LINE_STRIP:g.LINES;d=d.linewidth;if(d!==Mb){g.lineWidth(d);Mb=d}g.drawArrays(f,0,e.__webglLineCount);F.info.render.calls++}else if(f instanceof THREE.ParticleSystem){g.drawArrays(g.POINTS,0,e.__webglParticleCount);F.info.render.calls++;
-F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,j,m,n=a.__lights,o=a.fog;aa=-1;Wa=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=
-new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Wb.multiply(b.projectionMatrix,b.matrixWorldInverse);ic.setFromMatrix(Wb);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];j=f.object;f.render=false;if(j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||ic.contains(j))){p(j,b);var q=f,r=q.object,u=q.buffer,v=void 0,v=v=void 0,v=r.material;if(v instanceof THREE.MeshFaceMaterial){v=u.materialIndex;if(v>=0){v=r.geometry.materials[v];if(v.transparent){q.transparent=v;q.opaque=null}else{q.opaque=v;q.transparent=null}}}else if(v)if(v.transparent){q.transparent=
-v;q.opaque=null}else{q.opaque=v;q.transparent=null}f.render=true;if(this.sortObjects)if(j.renderDepth)f.z=j.renderDepth;else{pb.copy(j.matrixWorld.getPosition());Wb.multiplyVector3(pb);f.z=pb.z}}}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];j=f.object;if(j.visible){p(j,b);j=f.object.material;if(j.transparent){f.transparent=j;f.opaque=null}else{f.opaque=j;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,
-d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);x(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);k(a.__webglObjects,false,"",b,n,o,true,d);i(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);k(a.__webglObjects,true,"opaque",b,n,o,false);i(a.__webglObjectsImmediate,"opaque",b,n,o,false);k(a.__webglObjects,false,"transparent",b,n,o,true);i(a.__webglObjectsImmediate,"transparent",b,n,o,true)}l(this.renderPluginsPost,
-a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture);g.generateMipmap(g.TEXTURE_CUBE_MAP);g.bindTexture(g.TEXTURE_CUBE_MAP,null)}else{g.bindTexture(g.TEXTURE_2D,c.__webglTexture);g.generateMipmap(g.TEXTURE_2D);g.bindTexture(g.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=r(a,b,c,d,e);T=
--1;F.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,g,ic):e.render(function(a){F.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,j=void 0,k=void 0,l=void 0;if(!h.__webglInit){h.__webglInit=true;h._modelViewMatrix=new THREE.Matrix4;h._normalMatrix=new THREE.Matrix3;if(h instanceof THREE.Mesh){k=
-h.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var p=k,r=void 0,v=void 0,w=void 0,x=void 0,z=void 0,A=void 0,C=void 0,E={},H=p.morphTargets.length,P=p.morphNormals.length;p.geometryGroups={};r=0;for(v=p.faces.length;r<v;r++){w=p.faces[r];x=w.materialIndex;A=x!==void 0?x:-1;E[A]===void 0&&(E[A]={hash:A,counter:0});C=E[A].hash+"_"+E[A].counter;p.geometryGroups[C]===void 0&&(p.geometryGroups[C]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:P});
-z=w instanceof THREE.Face3?3:4;if(p.geometryGroups[C].vertices+z>65535){E[A].counter=E[A].counter+1;C=E[A].hash+"_"+E[A].counter;p.geometryGroups[C]===void 0&&(p.geometryGroups[C]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:P})}w instanceof THREE.Face3?p.geometryGroups[C].faces3.push(r):p.geometryGroups[C].faces4.push(r);p.geometryGroups[C].vertices=p.geometryGroups[C].vertices+z}p.geometryGroupsList=[];var O=void 0;for(O in p.geometryGroups){p.geometryGroups[O].id=
-ta++;p.geometryGroupsList.push(p.geometryGroups[O])}}for(j in k.geometryGroups){l=k.geometryGroups[j];if(!l.__webglVertexBuffer){var G=l;G.__webglVertexBuffer=g.createBuffer();G.__webglNormalBuffer=g.createBuffer();G.__webglTangentBuffer=g.createBuffer();G.__webglColorBuffer=g.createBuffer();G.__webglUVBuffer=g.createBuffer();G.__webglUV2Buffer=g.createBuffer();G.__webglSkinVertexABuffer=g.createBuffer();G.__webglSkinVertexBBuffer=g.createBuffer();G.__webglSkinIndicesBuffer=g.createBuffer();G.__webglSkinWeightsBuffer=
-g.createBuffer();G.__webglFaceBuffer=g.createBuffer();G.__webglLineBuffer=g.createBuffer();var N=void 0,Q=void 0;if(G.numMorphTargets){G.__webglMorphTargetsBuffers=[];N=0;for(Q=G.numMorphTargets;N<Q;N++)G.__webglMorphTargetsBuffers.push(g.createBuffer())}if(G.numMorphNormals){G.__webglMorphNormalsBuffers=[];N=0;for(Q=G.numMorphNormals;N<Q;N++)G.__webglMorphNormalsBuffers.push(g.createBuffer())}F.info.memory.geometries++;var I=l,S=h,T=S.geometry,U=I.faces3,W=I.faces4,V=U.length*3+W.length*4,da=U.length*
-1+W.length*2,ea=U.length*3+W.length*4,aa=c(S,I),ia=e(aa),la=d(aa),ua=aa.vertexColors?aa.vertexColors:false;I.__vertexArray=new Float32Array(V*3);if(la)I.__normalArray=new Float32Array(V*3);if(T.hasTangents)I.__tangentArray=new Float32Array(V*4);if(ua)I.__colorArray=new Float32Array(V*3);if(ia){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)I.__uvArray=new Float32Array(V*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)I.__uv2Array=new Float32Array(V*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length){I.__skinVertexAArray=
-new Float32Array(V*4);I.__skinVertexBArray=new Float32Array(V*4);I.__skinIndexArray=new Float32Array(V*4);I.__skinWeightArray=new Float32Array(V*4)}I.__faceArray=new Uint16Array(da*3);I.__lineArray=new Uint16Array(ea*2);var ja=void 0,Lb=void 0;if(I.numMorphTargets){I.__morphTargetsArrays=[];ja=0;for(Lb=I.numMorphTargets;ja<Lb;ja++)I.__morphTargetsArrays.push(new Float32Array(V*3))}if(I.numMorphNormals){I.__morphNormalsArrays=[];ja=0;for(Lb=I.numMorphNormals;ja<Lb;ja++)I.__morphNormalsArrays.push(new Float32Array(V*
-3))}I.__webglFaceCount=da*3;I.__webglLineCount=ea*2;if(aa.attributes){if(I.__webglCustomAttributesList===void 0)I.__webglCustomAttributesList=[];var Ca=void 0;for(Ca in aa.attributes){var Ba=aa.attributes[Ca],ma={},Ja;for(Ja in Ba)ma[Ja]=Ba[Ja];if(!ma.__webglInitialized||ma.createUniqueBuffers){ma.__webglInitialized=true;var Ia=1;ma.type==="v2"?Ia=2:ma.type==="v3"?Ia=3:ma.type==="v4"?Ia=4:ma.type==="c"&&(Ia=3);ma.size=Ia;ma.array=new Float32Array(V*Ia);ma.buffer=g.createBuffer();ma.buffer.belongsToAttribute=
-Ca;Ba.needsUpdate=true;ma.__original=Ba}I.__webglCustomAttributesList.push(ma)}}I.__inittedArrays=true;k.verticesNeedUpdate=true;k.morphTargetsNeedUpdate=true;k.elementsNeedUpdate=true;k.uvsNeedUpdate=true;k.normalsNeedUpdate=true;k.tangentsNeedUpdate=true;k.colorsNeedUpdate=true}}}else if(k instanceof THREE.BufferGeometry){var Mb=k,Ma=void 0,xb=void 0,Va=void 0;for(Ma in Mb.attributes){Va=Ma==="index"?g.ELEMENT_ARRAY_BUFFER:g.ARRAY_BUFFER;xb=Mb.attributes[Ma];xb.buffer=g.createBuffer();g.bindBuffer(Va,
-xb.buffer);g.bufferData(Va,xb.array,g.STATIC_DRAW)}}}else if(h instanceof THREE.Ribbon){k=h.geometry;if(!k.__webglVertexBuffer){var pb=k;pb.__webglVertexBuffer=g.createBuffer();pb.__webglColorBuffer=g.createBuffer();F.info.memory.geometries++;var Wa=k,Za=Wa.vertices.length;Wa.__vertexArray=new Float32Array(Za*3);Wa.__colorArray=new Float32Array(Za*3);Wa.__webglVertexCount=Za;k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.Line){k=h.geometry;if(!k.__webglVertexBuffer){var wb=
-k;wb.__webglVertexBuffer=g.createBuffer();wb.__webglColorBuffer=g.createBuffer();F.info.memory.geometries++;var kc=k,Wb=h,Nb=kc.vertices.length;kc.__vertexArray=new Float32Array(Nb*3);kc.__colorArray=new Float32Array(Nb*3);kc.__webglLineCount=Nb;b(kc,Wb);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){k=h.geometry;if(!k.__webglVertexBuffer){var Vb=k;Vb.__webglVertexBuffer=g.createBuffer();Vb.__webglColorBuffer=g.createBuffer();F.info.geometries++;var Xb=
-k,hc=h,Ob=Xb.vertices.length;Xb.__vertexArray=new Float32Array(Ob*3);Xb.__colorArray=new Float32Array(Ob*3);Xb.__sortArray=[];Xb.__webglParticleCount=Ob;b(Xb,hc);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.BufferGeometry)m(i.__webglObjects,k,h);else for(j in k.geometryGroups){l=k.geometryGroups[j];m(i.__webglObjects,l,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){k=
-h.geometry;m(i.__webglObjects,k,h)}else h instanceof THREE.ImmediateRenderObject||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ra=a.__objectsRemoved[0],Ac=a;Ra instanceof THREE.Mesh||Ra instanceof THREE.ParticleSystem||Ra instanceof THREE.Ribbon||Ra instanceof
-THREE.Line?u(Ac.__webglObjects,Ra):Ra instanceof THREE.Sprite?q(Ac.__webglSprites,Ra):Ra instanceof THREE.LensFlare?q(Ac.__webglFlares,Ra):(Ra instanceof THREE.ImmediateRenderObject||Ra.immediateRenderCallback)&&u(Ac.__webglObjectsImmediate,Ra);Ra.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Pb=0,ic=a.__webglObjects.length;Pb<ic;Pb++){var Xa=a.__webglObjects[Pb].object,X=Xa.geometry,lc=void 0,Yb=void 0,Na=void 0;if(Xa instanceof THREE.Mesh)if(X instanceof THREE.BufferGeometry){if(X.verticesNeedUpdate||
-X.elementsNeedUpdate||X.uvsNeedUpdate||X.normalsNeedUpdate||X.colorsNeedUpdate||X.tangentsNeedUpdate){var qb=X,Zb=g.DYNAMIC_DRAW,jc=!X.dynamic,$b=qb.attributes,Rc=$b.index,Sc=$b.position,Tc=$b.normal,Uc=$b.uv,Vc=$b.color,Wc=$b.tangent;if(qb.elementsNeedUpdate&&Rc!==void 0){g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Rc.buffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Rc.array,Zb)}if(qb.verticesNeedUpdate&&Sc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Sc.buffer);g.bufferData(g.ARRAY_BUFFER,Sc.array,Zb)}if(qb.normalsNeedUpdate&&
-Tc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Tc.buffer);g.bufferData(g.ARRAY_BUFFER,Tc.array,Zb)}if(qb.uvsNeedUpdate&&Uc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Uc.buffer);g.bufferData(g.ARRAY_BUFFER,Uc.array,Zb)}if(qb.colorsNeedUpdate&&Vc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Vc.buffer);g.bufferData(g.ARRAY_BUFFER,Vc.array,Zb)}if(qb.tangentsNeedUpdate&&Wc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Wc.buffer);g.bufferData(g.ARRAY_BUFFER,Wc.array,Zb)}if(jc){var gc=void 0;for(gc in qb.attributes)delete qb.attributes[gc].array}}X.verticesNeedUpdate=
-false;X.elementsNeedUpdate=false;X.uvsNeedUpdate=false;X.normalsNeedUpdate=false;X.colorsNeedUpdate=false;X.tangentsNeedUpdate=false}else{for(var Xc=0,xc=X.geometryGroupsList.length;Xc<xc;Xc++){lc=X.geometryGroupsList[Xc];Na=c(Xa,lc);Yb=Na.attributes&&n(Na);if(X.verticesNeedUpdate||X.morphTargetsNeedUpdate||X.elementsNeedUpdate||X.uvsNeedUpdate||X.normalsNeedUpdate||X.colorsNeedUpdate||X.tangentsNeedUpdate||Yb){var Z=lc,yc=Xa,Pa=g.DYNAMIC_DRAW,zc=!X.dynamic,Qb=Na;if(Z.__inittedArrays){var fd=d(Qb),
-Yc=Qb.vertexColors?Qb.vertexColors:false,gd=e(Qb),Bc=fd===THREE.SmoothShading,y=void 0,M=void 0,Ua=void 0,D=void 0,ac=void 0,yb=void 0,Ya=void 0,Cc=void 0,rb=void 0,bc=void 0,cc=void 0,J=void 0,K=void 0,L=void 0,$=void 0,$a=void 0,ab=void 0,bb=void 0,mc=void 0,cb=void 0,db=void 0,eb=void 0,nc=void 0,fb=void 0,gb=void 0,hb=void 0,oc=void 0,ib=void 0,jb=void 0,kb=void 0,pc=void 0,lb=void 0,mb=void 0,nb=void 0,qc=void 0,zb=void 0,Ab=void 0,Bb=void 0,Dc=void 0,Cb=void 0,Db=void 0,Eb=void 0,Ec=void 0,
-fa=void 0,hd=void 0,Fb=void 0,dc=void 0,ec=void 0,Da=void 0,id=void 0,za=void 0,Aa=void 0,Gb=void 0,sb=void 0,va=0,ya=0,tb=0,ub=0,Sa=0,Ha=0,ha=0,Ka=0,wa=0,B=0,Y=0,t=0,ga=void 0,Ea=Z.__vertexArray,rc=Z.__uvArray,sc=Z.__uv2Array,Ta=Z.__normalArray,na=Z.__tangentArray,Fa=Z.__colorArray,oa=Z.__skinVertexAArray,pa=Z.__skinVertexBArray,qa=Z.__skinIndexArray,ra=Z.__skinWeightArray,Zc=Z.__morphTargetsArrays,$c=Z.__morphNormalsArrays,ad=Z.__webglCustomAttributesList,s=void 0,ob=Z.__faceArray,Qa=Z.__lineArray,
-La=yc.geometry,Pc=La.elementsNeedUpdate,jd=La.uvsNeedUpdate,Qc=La.normalsNeedUpdate,qd=La.tangentsNeedUpdate,rd=La.colorsNeedUpdate,sd=La.morphTargetsNeedUpdate,Rb=La.vertices,ba=Z.faces3,ca=Z.faces4,xa=La.faces,bd=La.faceVertexUvs[0],cd=La.faceVertexUvs[1],Sb=La.skinVerticesA,Tb=La.skinVerticesB,Ub=La.skinIndices,Hb=La.skinWeights,Ib=La.morphTargets,Fc=La.morphNormals;if(La.verticesNeedUpdate){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=Rb[D.a];K=Rb[D.b];L=Rb[D.c];Ea[ya]=J.x;Ea[ya+1]=J.y;Ea[ya+2]=
-J.z;Ea[ya+3]=K.x;Ea[ya+4]=K.y;Ea[ya+5]=K.z;Ea[ya+6]=L.x;Ea[ya+7]=L.y;Ea[ya+8]=L.z;ya=ya+9}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=Rb[D.a];K=Rb[D.b];L=Rb[D.c];$=Rb[D.d];Ea[ya]=J.x;Ea[ya+1]=J.y;Ea[ya+2]=J.z;Ea[ya+3]=K.x;Ea[ya+4]=K.y;Ea[ya+5]=K.z;Ea[ya+6]=L.x;Ea[ya+7]=L.y;Ea[ya+8]=L.z;Ea[ya+9]=$.x;Ea[ya+10]=$.y;Ea[ya+11]=$.z;ya=ya+12}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Ea,Pa)}if(sd){Da=0;for(id=Ib.length;Da<id;Da++){y=Y=0;for(M=ba.length;y<M;y++){Gb=ba[y];
-D=xa[Gb];J=Ib[Da].vertices[D.a];K=Ib[Da].vertices[D.b];L=Ib[Da].vertices[D.c];za=Zc[Da];za[Y]=J.x;za[Y+1]=J.y;za[Y+2]=J.z;za[Y+3]=K.x;za[Y+4]=K.y;za[Y+5]=K.z;za[Y+6]=L.x;za[Y+7]=L.y;za[Y+8]=L.z;if(Qb.morphNormals){if(Bc){sb=Fc[Da].vertexNormals[Gb];cb=sb.a;db=sb.b;eb=sb.c}else eb=db=cb=Fc[Da].faceNormals[Gb];Aa=$c[Da];Aa[Y]=cb.x;Aa[Y+1]=cb.y;Aa[Y+2]=cb.z;Aa[Y+3]=db.x;Aa[Y+4]=db.y;Aa[Y+5]=db.z;Aa[Y+6]=eb.x;Aa[Y+7]=eb.y;Aa[Y+8]=eb.z}Y=Y+9}y=0;for(M=ca.length;y<M;y++){Gb=ca[y];D=xa[Gb];J=Ib[Da].vertices[D.a];
-K=Ib[Da].vertices[D.b];L=Ib[Da].vertices[D.c];$=Ib[Da].vertices[D.d];za=Zc[Da];za[Y]=J.x;za[Y+1]=J.y;za[Y+2]=J.z;za[Y+3]=K.x;za[Y+4]=K.y;za[Y+5]=K.z;za[Y+6]=L.x;za[Y+7]=L.y;za[Y+8]=L.z;za[Y+9]=$.x;za[Y+10]=$.y;za[Y+11]=$.z;if(Qb.morphNormals){if(Bc){sb=Fc[Da].vertexNormals[Gb];cb=sb.a;db=sb.b;eb=sb.c;nc=sb.d}else nc=eb=db=cb=Fc[Da].faceNormals[Gb];Aa=$c[Da];Aa[Y]=cb.x;Aa[Y+1]=cb.y;Aa[Y+2]=cb.z;Aa[Y+3]=db.x;Aa[Y+4]=db.y;Aa[Y+5]=db.z;Aa[Y+6]=eb.x;Aa[Y+7]=eb.y;Aa[Y+8]=eb.z;Aa[Y+9]=nc.x;Aa[Y+10]=nc.y;
-Aa[Y+11]=nc.z}Y=Y+12}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglMorphTargetsBuffers[Da]);g.bufferData(g.ARRAY_BUFFER,Zc[Da],Pa);if(Qb.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglMorphNormalsBuffers[Da]);g.bufferData(g.ARRAY_BUFFER,$c[Da],Pa)}}}if(Hb.length){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];ib=Hb[D.a];jb=Hb[D.b];kb=Hb[D.c];ra[B]=ib.x;ra[B+1]=ib.y;ra[B+2]=ib.z;ra[B+3]=ib.w;ra[B+4]=jb.x;ra[B+5]=jb.y;ra[B+6]=jb.z;ra[B+7]=jb.w;ra[B+8]=kb.x;ra[B+9]=kb.y;ra[B+10]=kb.z;ra[B+11]=kb.w;lb=Ub[D.a];mb=
-Ub[D.b];nb=Ub[D.c];qa[B]=lb.x;qa[B+1]=lb.y;qa[B+2]=lb.z;qa[B+3]=lb.w;qa[B+4]=mb.x;qa[B+5]=mb.y;qa[B+6]=mb.z;qa[B+7]=mb.w;qa[B+8]=nb.x;qa[B+9]=nb.y;qa[B+10]=nb.z;qa[B+11]=nb.w;zb=Sb[D.a];Ab=Sb[D.b];Bb=Sb[D.c];oa[B]=zb.x;oa[B+1]=zb.y;oa[B+2]=zb.z;oa[B+3]=1;oa[B+4]=Ab.x;oa[B+5]=Ab.y;oa[B+6]=Ab.z;oa[B+7]=1;oa[B+8]=Bb.x;oa[B+9]=Bb.y;oa[B+10]=Bb.z;oa[B+11]=1;Cb=Tb[D.a];Db=Tb[D.b];Eb=Tb[D.c];pa[B]=Cb.x;pa[B+1]=Cb.y;pa[B+2]=Cb.z;pa[B+3]=1;pa[B+4]=Db.x;pa[B+5]=Db.y;pa[B+6]=Db.z;pa[B+7]=1;pa[B+8]=Eb.x;pa[B+
-9]=Eb.y;pa[B+10]=Eb.z;pa[B+11]=1;B=B+12}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];ib=Hb[D.a];jb=Hb[D.b];kb=Hb[D.c];pc=Hb[D.d];ra[B]=ib.x;ra[B+1]=ib.y;ra[B+2]=ib.z;ra[B+3]=ib.w;ra[B+4]=jb.x;ra[B+5]=jb.y;ra[B+6]=jb.z;ra[B+7]=jb.w;ra[B+8]=kb.x;ra[B+9]=kb.y;ra[B+10]=kb.z;ra[B+11]=kb.w;ra[B+12]=pc.x;ra[B+13]=pc.y;ra[B+14]=pc.z;ra[B+15]=pc.w;lb=Ub[D.a];mb=Ub[D.b];nb=Ub[D.c];qc=Ub[D.d];qa[B]=lb.x;qa[B+1]=lb.y;qa[B+2]=lb.z;qa[B+3]=lb.w;qa[B+4]=mb.x;qa[B+5]=mb.y;qa[B+6]=mb.z;qa[B+7]=mb.w;qa[B+8]=nb.x;qa[B+
-9]=nb.y;qa[B+10]=nb.z;qa[B+11]=nb.w;qa[B+12]=qc.x;qa[B+13]=qc.y;qa[B+14]=qc.z;qa[B+15]=qc.w;zb=Sb[D.a];Ab=Sb[D.b];Bb=Sb[D.c];Dc=Sb[D.d];oa[B]=zb.x;oa[B+1]=zb.y;oa[B+2]=zb.z;oa[B+3]=1;oa[B+4]=Ab.x;oa[B+5]=Ab.y;oa[B+6]=Ab.z;oa[B+7]=1;oa[B+8]=Bb.x;oa[B+9]=Bb.y;oa[B+10]=Bb.z;oa[B+11]=1;oa[B+12]=Dc.x;oa[B+13]=Dc.y;oa[B+14]=Dc.z;oa[B+15]=1;Cb=Tb[D.a];Db=Tb[D.b];Eb=Tb[D.c];Ec=Tb[D.d];pa[B]=Cb.x;pa[B+1]=Cb.y;pa[B+2]=Cb.z;pa[B+3]=1;pa[B+4]=Db.x;pa[B+5]=Db.y;pa[B+6]=Db.z;pa[B+7]=1;pa[B+8]=Eb.x;pa[B+9]=Eb.y;
-pa[B+10]=Eb.z;pa[B+11]=1;pa[B+12]=Ec.x;pa[B+13]=Ec.y;pa[B+14]=Ec.z;pa[B+15]=1;B=B+16}if(B>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinVertexABuffer);g.bufferData(g.ARRAY_BUFFER,oa,Pa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinVertexBBuffer);g.bufferData(g.ARRAY_BUFFER,pa,Pa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinIndicesBuffer);g.bufferData(g.ARRAY_BUFFER,qa,Pa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinWeightsBuffer);g.bufferData(g.ARRAY_BUFFER,ra,Pa)}}if(rd&&Yc){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];
-Ya=D.vertexColors;Cc=D.color;if(Ya.length===3&&Yc===THREE.VertexColors){fb=Ya[0];gb=Ya[1];hb=Ya[2]}else hb=gb=fb=Cc;Fa[wa]=fb.r;Fa[wa+1]=fb.g;Fa[wa+2]=fb.b;Fa[wa+3]=gb.r;Fa[wa+4]=gb.g;Fa[wa+5]=gb.b;Fa[wa+6]=hb.r;Fa[wa+7]=hb.g;Fa[wa+8]=hb.b;wa=wa+9}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];Ya=D.vertexColors;Cc=D.color;if(Ya.length===4&&Yc===THREE.VertexColors){fb=Ya[0];gb=Ya[1];hb=Ya[2];oc=Ya[3]}else oc=hb=gb=fb=Cc;Fa[wa]=fb.r;Fa[wa+1]=fb.g;Fa[wa+2]=fb.b;Fa[wa+3]=gb.r;Fa[wa+4]=gb.g;Fa[wa+5]=gb.b;Fa[wa+
-6]=hb.r;Fa[wa+7]=hb.g;Fa[wa+8]=hb.b;Fa[wa+9]=oc.r;Fa[wa+10]=oc.g;Fa[wa+11]=oc.b;wa=wa+12}if(wa>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Fa,Pa)}}if(qd&&La.hasTangents){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];rb=D.vertexTangents;$a=rb[0];ab=rb[1];bb=rb[2];na[ha]=$a.x;na[ha+1]=$a.y;na[ha+2]=$a.z;na[ha+3]=$a.w;na[ha+4]=ab.x;na[ha+5]=ab.y;na[ha+6]=ab.z;na[ha+7]=ab.w;na[ha+8]=bb.x;na[ha+9]=bb.y;na[ha+10]=bb.z;na[ha+11]=bb.w;ha=ha+12}y=0;for(M=ca.length;y<M;y++){D=
-xa[ca[y]];rb=D.vertexTangents;$a=rb[0];ab=rb[1];bb=rb[2];mc=rb[3];na[ha]=$a.x;na[ha+1]=$a.y;na[ha+2]=$a.z;na[ha+3]=$a.w;na[ha+4]=ab.x;na[ha+5]=ab.y;na[ha+6]=ab.z;na[ha+7]=ab.w;na[ha+8]=bb.x;na[ha+9]=bb.y;na[ha+10]=bb.z;na[ha+11]=bb.w;na[ha+12]=mc.x;na[ha+13]=mc.y;na[ha+14]=mc.z;na[ha+15]=mc.w;ha=ha+16}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglTangentBuffer);g.bufferData(g.ARRAY_BUFFER,na,Pa)}if(Qc&&fd){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];ac=D.vertexNormals;yb=D.normal;if(ac.length===3&&Bc)for(fa=
-0;fa<3;fa++){Fb=ac[fa];Ta[Ha]=Fb.x;Ta[Ha+1]=Fb.y;Ta[Ha+2]=Fb.z;Ha=Ha+3}else for(fa=0;fa<3;fa++){Ta[Ha]=yb.x;Ta[Ha+1]=yb.y;Ta[Ha+2]=yb.z;Ha=Ha+3}}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];ac=D.vertexNormals;yb=D.normal;if(ac.length===4&&Bc)for(fa=0;fa<4;fa++){Fb=ac[fa];Ta[Ha]=Fb.x;Ta[Ha+1]=Fb.y;Ta[Ha+2]=Fb.z;Ha=Ha+3}else for(fa=0;fa<4;fa++){Ta[Ha]=yb.x;Ta[Ha+1]=yb.y;Ta[Ha+2]=yb.z;Ha=Ha+3}}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,Ta,Pa)}if(jd&&bd&&gd){y=0;for(M=
-ba.length;y<M;y++){Ua=ba[y];D=xa[Ua];bc=bd[Ua];if(bc!==void 0)for(fa=0;fa<3;fa++){dc=bc[fa];rc[tb]=dc.u;rc[tb+1]=dc.v;tb=tb+2}}y=0;for(M=ca.length;y<M;y++){Ua=ca[y];D=xa[Ua];bc=bd[Ua];if(bc!==void 0)for(fa=0;fa<4;fa++){dc=bc[fa];rc[tb]=dc.u;rc[tb+1]=dc.v;tb=tb+2}}if(tb>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglUVBuffer);g.bufferData(g.ARRAY_BUFFER,rc,Pa)}}if(jd&&cd&&gd){y=0;for(M=ba.length;y<M;y++){Ua=ba[y];D=xa[Ua];cc=cd[Ua];if(cc!==void 0)for(fa=0;fa<3;fa++){ec=cc[fa];sc[ub]=ec.u;sc[ub+1]=ec.v;ub=
-ub+2}}y=0;for(M=ca.length;y<M;y++){Ua=ca[y];D=xa[Ua];cc=cd[Ua];if(cc!==void 0)for(fa=0;fa<4;fa++){ec=cc[fa];sc[ub]=ec.u;sc[ub+1]=ec.v;ub=ub+2}}if(ub>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglUV2Buffer);g.bufferData(g.ARRAY_BUFFER,sc,Pa)}}if(Pc){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];ob[Sa]=va;ob[Sa+1]=va+1;ob[Sa+2]=va+2;Sa=Sa+3;Qa[Ka]=va;Qa[Ka+1]=va+1;Qa[Ka+2]=va;Qa[Ka+3]=va+2;Qa[Ka+4]=va+1;Qa[Ka+5]=va+2;Ka=Ka+6;va=va+3}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];ob[Sa]=va;ob[Sa+1]=va+1;ob[Sa+2]=va+
-3;ob[Sa+3]=va+1;ob[Sa+4]=va+2;ob[Sa+5]=va+3;Sa=Sa+6;Qa[Ka]=va;Qa[Ka+1]=va+1;Qa[Ka+2]=va;Qa[Ka+3]=va+3;Qa[Ka+4]=va+1;Qa[Ka+5]=va+2;Qa[Ka+6]=va+2;Qa[Ka+7]=va+3;Ka=Ka+8;va=va+4}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,ob,Pa);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Qa,Pa)}if(ad){fa=0;for(hd=ad.length;fa<hd;fa++){s=ad[fa];if(s.__original.needsUpdate){t=0;if(s.size===1)if(s.boundTo===void 0||s.boundTo===
-"vertices"){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];s.array[t]=s.value[D.a];s.array[t+1]=s.value[D.b];s.array[t+2]=s.value[D.c];t=t+3}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];s.array[t]=s.value[D.a];s.array[t+1]=s.value[D.b];s.array[t+2]=s.value[D.c];s.array[t+3]=s.value[D.d];t=t+4}}else{if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){ga=s.value[ba[y]];s.array[t]=ga;s.array[t+1]=ga;s.array[t+2]=ga;t=t+3}y=0;for(M=ca.length;y<M;y++){ga=s.value[ca[y]];s.array[t]=ga;s.array[t+1]=ga;s.array[t+2]=
-ga;s.array[t+3]=ga;t=t+4}}}else if(s.size===2)if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;t=t+6}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];$=s.value[D.d];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;s.array[t+6]=$.x;
-s.array[t+7]=$.y;t=t+8}}else{if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){L=K=J=ga=s.value[ba[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;t=t+6}y=0;for(M=ca.length;y<M;y++){$=L=K=J=ga=s.value[ca[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;s.array[t+6]=$.x;s.array[t+7]=$.y;t=t+8}}}else if(s.size===3){var R;R=s.type==="c"?["r","g","b"]:["x","y","z"];if(s.boundTo===void 0||
-s.boundTo==="vertices"){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];$=s.value[D.d];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];
-s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}else if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){L=K=J=ga=s.value[ba[y]];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(M=ca.length;y<M;y++){$=L=K=J=ga=s.value[ca[y]];s.array[t]=J[R[0]];
-s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}else if(s.boundTo==="faceVertices"){y=0;for(M=ba.length;y<M;y++){ga=s.value[ba[y]];J=ga[0];K=ga[1];L=ga[2];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+
-7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(M=ca.length;y<M;y++){ga=s.value[ca[y]];J=ga[0];K=ga[1];L=ga[2];$=ga[3];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}}else if(s.size===4)if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=s.value[D.a];K=
-s.value[D.b];L=s.value[D.c];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];$=s.value[D.d];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+
-9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}else if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){L=K=J=ga=s.value[ba[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(M=ca.length;y<M;y++){$=L=K=J=ga=s.value[ca[y]];s.array[t]=J.x;s.array[t+1]=J.y;
-s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}else if(s.boundTo==="faceVertices"){y=0;for(M=ba.length;y<M;y++){ga=s.value[ba[y]];J=ga[0];K=ga[1];L=ga[2];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+
-8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(M=ca.length;y<M;y++){ga=s.value[ca[y]];J=ga[0];K=ga[1];L=ga[2];$=ga[3];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}g.bindBuffer(g.ARRAY_BUFFER,s.buffer);g.bufferData(g.ARRAY_BUFFER,s.array,
-Pa)}}}if(zc){delete Z.__inittedArrays;delete Z.__colorArray;delete Z.__normalArray;delete Z.__tangentArray;delete Z.__uvArray;delete Z.__uv2Array;delete Z.__faceArray;delete Z.__vertexArray;delete Z.__lineArray;delete Z.__skinVertexAArray;delete Z.__skinVertexBArray;delete Z.__skinIndexArray;delete Z.__skinWeightArray}}}}X.verticesNeedUpdate=false;X.morphTargetsNeedUpdate=false;X.elementsNeedUpdate=false;X.uvsNeedUpdate=false;X.normalsNeedUpdate=false;X.colorsNeedUpdate=false;X.tangentsNeedUpdate=
-false;Na.attributes&&o(Na)}else if(Xa instanceof THREE.Ribbon){if(X.verticesNeedUpdate||X.colorsNeedUpdate){var Jb=X,kd=g.DYNAMIC_DRAW,tc=void 0,uc=void 0,Gc=void 0,Kb=void 0,Hc=void 0,ld=Jb.vertices,md=Jb.colors,td=ld.length,ud=md.length,Ic=Jb.__vertexArray,Jc=Jb.__colorArray,vd=Jb.colorsNeedUpdate;if(Jb.verticesNeedUpdate){for(tc=0;tc<td;tc++){Gc=ld[tc];Kb=tc*3;Ic[Kb]=Gc.x;Ic[Kb+1]=Gc.y;Ic[Kb+2]=Gc.z}g.bindBuffer(g.ARRAY_BUFFER,Jb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Ic,kd)}if(vd){for(uc=
-0;uc<ud;uc++){Hc=md[uc];Kb=uc*3;Jc[Kb]=Hc.r;Jc[Kb+1]=Hc.g;Jc[Kb+2]=Hc.b}g.bindBuffer(g.ARRAY_BUFFER,Jb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Jc,kd)}}X.verticesNeedUpdate=false;X.colorsNeedUpdate=false}else if(Xa instanceof THREE.Line){Na=c(Xa,lc);Yb=Na.attributes&&n(Na);if(X.verticesNeedUpdate||X.colorsNeedUpdate||Yb){var vb=X,dd=g.DYNAMIC_DRAW,vc=void 0,wc=void 0,Kc=void 0,sa=void 0,Lc=void 0,nd=vb.vertices,od=vb.colors,wd=nd.length,xd=od.length,Mc=vb.__vertexArray,Nc=vb.__colorArray,yd=
-vb.colorsNeedUpdate,ed=vb.__webglCustomAttributesList,Oc=void 0,pd=void 0,Ga=void 0,fc=void 0,Oa=void 0,ka=void 0;if(vb.verticesNeedUpdate){for(vc=0;vc<wd;vc++){Kc=nd[vc];sa=vc*3;Mc[sa]=Kc.x;Mc[sa+1]=Kc.y;Mc[sa+2]=Kc.z}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Mc,dd)}if(yd){for(wc=0;wc<xd;wc++){Lc=od[wc];sa=wc*3;Nc[sa]=Lc.r;Nc[sa+1]=Lc.g;Nc[sa+2]=Lc.b}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Nc,dd)}if(ed){Oc=0;for(pd=ed.length;Oc<
-pd;Oc++){ka=ed[Oc];if(ka.needsUpdate&&(ka.boundTo===void 0||ka.boundTo==="vertices")){sa=0;fc=ka.value.length;if(ka.size===1)for(Ga=0;Ga<fc;Ga++)ka.array[Ga]=ka.value[Ga];else if(ka.size===2)for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.x;ka.array[sa+1]=Oa.y;sa=sa+2}else if(ka.size===3)if(ka.type==="c")for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.r;ka.array[sa+1]=Oa.g;ka.array[sa+2]=Oa.b;sa=sa+3}else for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.x;ka.array[sa+1]=Oa.y;ka.array[sa+
-2]=Oa.z;sa=sa+3}else if(ka.size===4)for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.x;ka.array[sa+1]=Oa.y;ka.array[sa+2]=Oa.z;ka.array[sa+3]=Oa.w;sa=sa+4}g.bindBuffer(g.ARRAY_BUFFER,ka.buffer);g.bufferData(g.ARRAY_BUFFER,ka.array,dd)}}}}X.verticesNeedUpdate=false;X.colorsNeedUpdate=false;Na.attributes&&o(Na)}else if(Xa instanceof THREE.ParticleSystem){Na=c(Xa,lc);Yb=Na.attributes&&n(Na);(X.verticesNeedUpdate||X.colorsNeedUpdate||Xa.sortParticles||Yb)&&f(X,g.DYNAMIC_DRAW,Xa);X.verticesNeedUpdate=
-false;X.colorsNeedUpdate=false;Na.attributes&&o(Na)}}};this.initMaterial=function(a,b,c,d){var e,f,h,i,j,k,l,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];a.uniforms=
-THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var o,q;o=h=e=n=0;for(f=b.length;o<f;o++){q=b[o];if(!q.onlyShadow){q instanceof THREE.DirectionalLight&&h++;q instanceof THREE.PointLight&&e++;q instanceof THREE.SpotLight&&n++}}if(e+n+h<=V){o=h;f=e}else{o=Math.ceil(V*h/(e+h));n=f=V-o}e=o;h=n;n=l=0;for(o=b.length;n<o;n++){q=b[n];if(q.castShadow){q instanceof THREE.SpotLight&&l++;q instanceof THREE.DirectionalLight&&!q.shadowCascade&&l++}}if(hc&&d&&
-d.useVertexTexture)k=1024;else{b=g.getParameter(g.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}k=b}var p;a:{q=a.fragmentShader;o=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
-sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:k,useVertexTexture:hc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,
-shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(m)d.push(m);else{d.push(q);d.push(o)}for(r in c){d.push(r);d.push(c[r])}m=d.join();r=0;for(d=ea.length;r<d;r++){e=ea[r];if(e.code===m){e.usedTimes++;p=e.program;break a}}r=g.createProgram();d=["precision "+C+" float;",jc?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?
-"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):
-"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":
-"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,j,m,n=a.__lights,o=a.fog;aa=-1;Wa=true;this.autoUpdateScene&&a.updateMatrixWorld();b.parent===void 0&&b.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);
+b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Wb.multiply(b.projectionMatrix,b.matrixWorldInverse);ic.setFromMatrix(Wb);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;
+for(e=m.length;d<e;d++){f=m[d];j=f.object;f.render=false;if(j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||ic.contains(j))){p(j,b);var q=f,r=q.object,u=q.buffer,v=void 0,v=v=void 0,v=r.material;if(v instanceof THREE.MeshFaceMaterial){v=u.materialIndex;if(v>=0){v=r.geometry.materials[v];if(v.transparent){q.transparent=v;q.opaque=null}else{q.opaque=v;q.transparent=null}}}else if(v)if(v.transparent){q.transparent=v;q.opaque=null}else{q.opaque=v;q.transparent=
+null}f.render=true;if(this.sortObjects)if(j.renderDepth)f.z=j.renderDepth;else{pb.copy(j.matrixWorld.getPosition());Wb.multiplyVector3(pb);f.z=pb.z}}}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];j=f.object;if(j.visible){p(j,b);j=f.object.material;if(j.transparent){f.transparent=j;f.opaque=null}else{f.opaque=j;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);
+this.setDepthWrite(d.depthWrite);x(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);k(a.__webglObjects,false,"",b,n,o,true,d);i(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);k(a.__webglObjects,true,"opaque",b,n,o,false);i(a.__webglObjectsImmediate,"opaque",b,n,o,false);k(a.__webglObjects,false,"transparent",b,n,o,true);i(a.__webglObjectsImmediate,"transparent",b,n,o,true)}l(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&
+c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture);g.generateMipmap(g.TEXTURE_CUBE_MAP);g.bindTexture(g.TEXTURE_CUBE_MAP,null)}else{g.bindTexture(g.TEXTURE_2D,c.__webglTexture);g.generateMipmap(g.TEXTURE_2D);g.bindTexture(g.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=r(a,b,c,d,e);T=-1;F.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,
+g,ic):e.render(function(a){F.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,j=void 0,k=void 0,l=void 0;if(!h.__webglInit){h.__webglInit=true;h._modelViewMatrix=new THREE.Matrix4;h._normalMatrix=new THREE.Matrix3;if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var p=
+k,r=void 0,v=void 0,w=void 0,x=void 0,z=void 0,A=void 0,C=void 0,E={},H=p.morphTargets.length,P=p.morphNormals.length;p.geometryGroups={};r=0;for(v=p.faces.length;r<v;r++){w=p.faces[r];x=w.materialIndex;A=x!==void 0?x:-1;E[A]===void 0&&(E[A]={hash:A,counter:0});C=E[A].hash+"_"+E[A].counter;p.geometryGroups[C]===void 0&&(p.geometryGroups[C]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:P});z=w instanceof THREE.Face3?3:4;if(p.geometryGroups[C].vertices+z>65535){E[A].counter=
+E[A].counter+1;C=E[A].hash+"_"+E[A].counter;p.geometryGroups[C]===void 0&&(p.geometryGroups[C]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:P})}w instanceof THREE.Face3?p.geometryGroups[C].faces3.push(r):p.geometryGroups[C].faces4.push(r);p.geometryGroups[C].vertices=p.geometryGroups[C].vertices+z}p.geometryGroupsList=[];var O=void 0;for(O in p.geometryGroups){p.geometryGroups[O].id=ta++;p.geometryGroupsList.push(p.geometryGroups[O])}}for(j in k.geometryGroups){l=
+k.geometryGroups[j];if(!l.__webglVertexBuffer){var G=l;G.__webglVertexBuffer=g.createBuffer();G.__webglNormalBuffer=g.createBuffer();G.__webglTangentBuffer=g.createBuffer();G.__webglColorBuffer=g.createBuffer();G.__webglUVBuffer=g.createBuffer();G.__webglUV2Buffer=g.createBuffer();G.__webglSkinVertexABuffer=g.createBuffer();G.__webglSkinVertexBBuffer=g.createBuffer();G.__webglSkinIndicesBuffer=g.createBuffer();G.__webglSkinWeightsBuffer=g.createBuffer();G.__webglFaceBuffer=g.createBuffer();G.__webglLineBuffer=
+g.createBuffer();var N=void 0,Q=void 0;if(G.numMorphTargets){G.__webglMorphTargetsBuffers=[];N=0;for(Q=G.numMorphTargets;N<Q;N++)G.__webglMorphTargetsBuffers.push(g.createBuffer())}if(G.numMorphNormals){G.__webglMorphNormalsBuffers=[];N=0;for(Q=G.numMorphNormals;N<Q;N++)G.__webglMorphNormalsBuffers.push(g.createBuffer())}F.info.memory.geometries++;var I=l,S=h,T=S.geometry,U=I.faces3,W=I.faces4,V=U.length*3+W.length*4,da=U.length*1+W.length*2,ea=U.length*3+W.length*4,aa=c(S,I),ia=e(aa),la=d(aa),ua=
+aa.vertexColors?aa.vertexColors:false;I.__vertexArray=new Float32Array(V*3);if(la)I.__normalArray=new Float32Array(V*3);if(T.hasTangents)I.__tangentArray=new Float32Array(V*4);if(ua)I.__colorArray=new Float32Array(V*3);if(ia){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)I.__uvArray=new Float32Array(V*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)I.__uv2Array=new Float32Array(V*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length){I.__skinVertexAArray=new Float32Array(V*4);I.__skinVertexBArray=
+new Float32Array(V*4);I.__skinIndexArray=new Float32Array(V*4);I.__skinWeightArray=new Float32Array(V*4)}I.__faceArray=new Uint16Array(da*3);I.__lineArray=new Uint16Array(ea*2);var ja=void 0,Lb=void 0;if(I.numMorphTargets){I.__morphTargetsArrays=[];ja=0;for(Lb=I.numMorphTargets;ja<Lb;ja++)I.__morphTargetsArrays.push(new Float32Array(V*3))}if(I.numMorphNormals){I.__morphNormalsArrays=[];ja=0;for(Lb=I.numMorphNormals;ja<Lb;ja++)I.__morphNormalsArrays.push(new Float32Array(V*3))}I.__webglFaceCount=da*
+3;I.__webglLineCount=ea*2;if(aa.attributes){if(I.__webglCustomAttributesList===void 0)I.__webglCustomAttributesList=[];var Ca=void 0;for(Ca in aa.attributes){var Ba=aa.attributes[Ca],ma={},Ja;for(Ja in Ba)ma[Ja]=Ba[Ja];if(!ma.__webglInitialized||ma.createUniqueBuffers){ma.__webglInitialized=true;var Ia=1;ma.type==="v2"?Ia=2:ma.type==="v3"?Ia=3:ma.type==="v4"?Ia=4:ma.type==="c"&&(Ia=3);ma.size=Ia;ma.array=new Float32Array(V*Ia);ma.buffer=g.createBuffer();ma.buffer.belongsToAttribute=Ca;Ba.needsUpdate=
+true;ma.__original=Ba}I.__webglCustomAttributesList.push(ma)}}I.__inittedArrays=true;k.verticesNeedUpdate=true;k.morphTargetsNeedUpdate=true;k.elementsNeedUpdate=true;k.uvsNeedUpdate=true;k.normalsNeedUpdate=true;k.tangentsNeedUpdate=true;k.colorsNeedUpdate=true}}}else if(k instanceof THREE.BufferGeometry){var Mb=k,Ma=void 0,xb=void 0,Va=void 0;for(Ma in Mb.attributes){Va=Ma==="index"?g.ELEMENT_ARRAY_BUFFER:g.ARRAY_BUFFER;xb=Mb.attributes[Ma];xb.buffer=g.createBuffer();g.bindBuffer(Va,xb.buffer);
+g.bufferData(Va,xb.array,g.STATIC_DRAW)}}}else if(h instanceof THREE.Ribbon){k=h.geometry;if(!k.__webglVertexBuffer){var pb=k;pb.__webglVertexBuffer=g.createBuffer();pb.__webglColorBuffer=g.createBuffer();F.info.memory.geometries++;var Wa=k,Za=Wa.vertices.length;Wa.__vertexArray=new Float32Array(Za*3);Wa.__colorArray=new Float32Array(Za*3);Wa.__webglVertexCount=Za;k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.Line){k=h.geometry;if(!k.__webglVertexBuffer){var wb=k;wb.__webglVertexBuffer=
+g.createBuffer();wb.__webglColorBuffer=g.createBuffer();F.info.memory.geometries++;var kc=k,Wb=h,Nb=kc.vertices.length;kc.__vertexArray=new Float32Array(Nb*3);kc.__colorArray=new Float32Array(Nb*3);kc.__webglLineCount=Nb;b(kc,Wb);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){k=h.geometry;if(!k.__webglVertexBuffer){var Vb=k;Vb.__webglVertexBuffer=g.createBuffer();Vb.__webglColorBuffer=g.createBuffer();F.info.geometries++;var Xb=k,hc=h,Ob=Xb.vertices.length;
+Xb.__vertexArray=new Float32Array(Ob*3);Xb.__colorArray=new Float32Array(Ob*3);Xb.__sortArray=[];Xb.__webglParticleCount=Ob;b(Xb,hc);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.BufferGeometry)m(i.__webglObjects,k,h);else for(j in k.geometryGroups){l=k.geometryGroups[j];m(i.__webglObjects,l,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){k=h.geometry;m(i.__webglObjects,
+k,h)}else h instanceof THREE.ImmediateRenderObject||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ra=a.__objectsRemoved[0],Ac=a;Ra instanceof THREE.Mesh||Ra instanceof THREE.ParticleSystem||Ra instanceof THREE.Ribbon||Ra instanceof THREE.Line?u(Ac.__webglObjects,
+Ra):Ra instanceof THREE.Sprite?q(Ac.__webglSprites,Ra):Ra instanceof THREE.LensFlare?q(Ac.__webglFlares,Ra):(Ra instanceof THREE.ImmediateRenderObject||Ra.immediateRenderCallback)&&u(Ac.__webglObjectsImmediate,Ra);Ra.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Pb=0,ic=a.__webglObjects.length;Pb<ic;Pb++){var Xa=a.__webglObjects[Pb].object,X=Xa.geometry,lc=void 0,Yb=void 0,Na=void 0;if(Xa instanceof THREE.Mesh)if(X instanceof THREE.BufferGeometry){if(X.verticesNeedUpdate||X.elementsNeedUpdate||
+X.uvsNeedUpdate||X.normalsNeedUpdate||X.colorsNeedUpdate||X.tangentsNeedUpdate){var qb=X,Zb=g.DYNAMIC_DRAW,jc=!X.dynamic,$b=qb.attributes,Rc=$b.index,Sc=$b.position,Tc=$b.normal,Uc=$b.uv,Vc=$b.color,Wc=$b.tangent;if(qb.elementsNeedUpdate&&Rc!==void 0){g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Rc.buffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Rc.array,Zb)}if(qb.verticesNeedUpdate&&Sc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Sc.buffer);g.bufferData(g.ARRAY_BUFFER,Sc.array,Zb)}if(qb.normalsNeedUpdate&&Tc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,
+Tc.buffer);g.bufferData(g.ARRAY_BUFFER,Tc.array,Zb)}if(qb.uvsNeedUpdate&&Uc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Uc.buffer);g.bufferData(g.ARRAY_BUFFER,Uc.array,Zb)}if(qb.colorsNeedUpdate&&Vc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Vc.buffer);g.bufferData(g.ARRAY_BUFFER,Vc.array,Zb)}if(qb.tangentsNeedUpdate&&Wc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Wc.buffer);g.bufferData(g.ARRAY_BUFFER,Wc.array,Zb)}if(jc){var gc=void 0;for(gc in qb.attributes)delete qb.attributes[gc].array}}X.verticesNeedUpdate=false;
+X.elementsNeedUpdate=false;X.uvsNeedUpdate=false;X.normalsNeedUpdate=false;X.colorsNeedUpdate=false;X.tangentsNeedUpdate=false}else{for(var Xc=0,xc=X.geometryGroupsList.length;Xc<xc;Xc++){lc=X.geometryGroupsList[Xc];Na=c(Xa,lc);Yb=Na.attributes&&n(Na);if(X.verticesNeedUpdate||X.morphTargetsNeedUpdate||X.elementsNeedUpdate||X.uvsNeedUpdate||X.normalsNeedUpdate||X.colorsNeedUpdate||X.tangentsNeedUpdate||Yb){var Z=lc,yc=Xa,Pa=g.DYNAMIC_DRAW,zc=!X.dynamic,Qb=Na;if(Z.__inittedArrays){var fd=d(Qb),Yc=Qb.vertexColors?
+Qb.vertexColors:false,gd=e(Qb),Bc=fd===THREE.SmoothShading,y=void 0,M=void 0,Ua=void 0,D=void 0,ac=void 0,yb=void 0,Ya=void 0,Cc=void 0,rb=void 0,bc=void 0,cc=void 0,J=void 0,K=void 0,L=void 0,$=void 0,$a=void 0,ab=void 0,bb=void 0,mc=void 0,cb=void 0,db=void 0,eb=void 0,nc=void 0,fb=void 0,gb=void 0,hb=void 0,oc=void 0,ib=void 0,jb=void 0,kb=void 0,pc=void 0,lb=void 0,mb=void 0,nb=void 0,qc=void 0,zb=void 0,Ab=void 0,Bb=void 0,Dc=void 0,Cb=void 0,Db=void 0,Eb=void 0,Ec=void 0,fa=void 0,hd=void 0,
+Fb=void 0,dc=void 0,ec=void 0,Da=void 0,id=void 0,za=void 0,Aa=void 0,Gb=void 0,sb=void 0,va=0,ya=0,tb=0,ub=0,Sa=0,Ha=0,ha=0,Ka=0,wa=0,B=0,Y=0,t=0,ga=void 0,Ea=Z.__vertexArray,rc=Z.__uvArray,sc=Z.__uv2Array,Ta=Z.__normalArray,na=Z.__tangentArray,Fa=Z.__colorArray,oa=Z.__skinVertexAArray,pa=Z.__skinVertexBArray,qa=Z.__skinIndexArray,ra=Z.__skinWeightArray,Zc=Z.__morphTargetsArrays,$c=Z.__morphNormalsArrays,ad=Z.__webglCustomAttributesList,s=void 0,ob=Z.__faceArray,Qa=Z.__lineArray,La=yc.geometry,Pc=
+La.elementsNeedUpdate,jd=La.uvsNeedUpdate,Qc=La.normalsNeedUpdate,qd=La.tangentsNeedUpdate,rd=La.colorsNeedUpdate,sd=La.morphTargetsNeedUpdate,Rb=La.vertices,ba=Z.faces3,ca=Z.faces4,xa=La.faces,bd=La.faceVertexUvs[0],cd=La.faceVertexUvs[1],Sb=La.skinVerticesA,Tb=La.skinVerticesB,Ub=La.skinIndices,Hb=La.skinWeights,Ib=La.morphTargets,Fc=La.morphNormals;if(La.verticesNeedUpdate){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=Rb[D.a];K=Rb[D.b];L=Rb[D.c];Ea[ya]=J.x;Ea[ya+1]=J.y;Ea[ya+2]=J.z;Ea[ya+3]=K.x;
+Ea[ya+4]=K.y;Ea[ya+5]=K.z;Ea[ya+6]=L.x;Ea[ya+7]=L.y;Ea[ya+8]=L.z;ya=ya+9}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=Rb[D.a];K=Rb[D.b];L=Rb[D.c];$=Rb[D.d];Ea[ya]=J.x;Ea[ya+1]=J.y;Ea[ya+2]=J.z;Ea[ya+3]=K.x;Ea[ya+4]=K.y;Ea[ya+5]=K.z;Ea[ya+6]=L.x;Ea[ya+7]=L.y;Ea[ya+8]=L.z;Ea[ya+9]=$.x;Ea[ya+10]=$.y;Ea[ya+11]=$.z;ya=ya+12}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Ea,Pa)}if(sd){Da=0;for(id=Ib.length;Da<id;Da++){y=Y=0;for(M=ba.length;y<M;y++){Gb=ba[y];D=xa[Gb];J=Ib[Da].vertices[D.a];
+K=Ib[Da].vertices[D.b];L=Ib[Da].vertices[D.c];za=Zc[Da];za[Y]=J.x;za[Y+1]=J.y;za[Y+2]=J.z;za[Y+3]=K.x;za[Y+4]=K.y;za[Y+5]=K.z;za[Y+6]=L.x;za[Y+7]=L.y;za[Y+8]=L.z;if(Qb.morphNormals){if(Bc){sb=Fc[Da].vertexNormals[Gb];cb=sb.a;db=sb.b;eb=sb.c}else eb=db=cb=Fc[Da].faceNormals[Gb];Aa=$c[Da];Aa[Y]=cb.x;Aa[Y+1]=cb.y;Aa[Y+2]=cb.z;Aa[Y+3]=db.x;Aa[Y+4]=db.y;Aa[Y+5]=db.z;Aa[Y+6]=eb.x;Aa[Y+7]=eb.y;Aa[Y+8]=eb.z}Y=Y+9}y=0;for(M=ca.length;y<M;y++){Gb=ca[y];D=xa[Gb];J=Ib[Da].vertices[D.a];K=Ib[Da].vertices[D.b];
+L=Ib[Da].vertices[D.c];$=Ib[Da].vertices[D.d];za=Zc[Da];za[Y]=J.x;za[Y+1]=J.y;za[Y+2]=J.z;za[Y+3]=K.x;za[Y+4]=K.y;za[Y+5]=K.z;za[Y+6]=L.x;za[Y+7]=L.y;za[Y+8]=L.z;za[Y+9]=$.x;za[Y+10]=$.y;za[Y+11]=$.z;if(Qb.morphNormals){if(Bc){sb=Fc[Da].vertexNormals[Gb];cb=sb.a;db=sb.b;eb=sb.c;nc=sb.d}else nc=eb=db=cb=Fc[Da].faceNormals[Gb];Aa=$c[Da];Aa[Y]=cb.x;Aa[Y+1]=cb.y;Aa[Y+2]=cb.z;Aa[Y+3]=db.x;Aa[Y+4]=db.y;Aa[Y+5]=db.z;Aa[Y+6]=eb.x;Aa[Y+7]=eb.y;Aa[Y+8]=eb.z;Aa[Y+9]=nc.x;Aa[Y+10]=nc.y;Aa[Y+11]=nc.z}Y=Y+12}g.bindBuffer(g.ARRAY_BUFFER,
+Z.__webglMorphTargetsBuffers[Da]);g.bufferData(g.ARRAY_BUFFER,Zc[Da],Pa);if(Qb.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglMorphNormalsBuffers[Da]);g.bufferData(g.ARRAY_BUFFER,$c[Da],Pa)}}}if(Hb.length){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];ib=Hb[D.a];jb=Hb[D.b];kb=Hb[D.c];ra[B]=ib.x;ra[B+1]=ib.y;ra[B+2]=ib.z;ra[B+3]=ib.w;ra[B+4]=jb.x;ra[B+5]=jb.y;ra[B+6]=jb.z;ra[B+7]=jb.w;ra[B+8]=kb.x;ra[B+9]=kb.y;ra[B+10]=kb.z;ra[B+11]=kb.w;lb=Ub[D.a];mb=Ub[D.b];nb=Ub[D.c];qa[B]=lb.x;qa[B+1]=lb.y;qa[B+
+2]=lb.z;qa[B+3]=lb.w;qa[B+4]=mb.x;qa[B+5]=mb.y;qa[B+6]=mb.z;qa[B+7]=mb.w;qa[B+8]=nb.x;qa[B+9]=nb.y;qa[B+10]=nb.z;qa[B+11]=nb.w;zb=Sb[D.a];Ab=Sb[D.b];Bb=Sb[D.c];oa[B]=zb.x;oa[B+1]=zb.y;oa[B+2]=zb.z;oa[B+3]=1;oa[B+4]=Ab.x;oa[B+5]=Ab.y;oa[B+6]=Ab.z;oa[B+7]=1;oa[B+8]=Bb.x;oa[B+9]=Bb.y;oa[B+10]=Bb.z;oa[B+11]=1;Cb=Tb[D.a];Db=Tb[D.b];Eb=Tb[D.c];pa[B]=Cb.x;pa[B+1]=Cb.y;pa[B+2]=Cb.z;pa[B+3]=1;pa[B+4]=Db.x;pa[B+5]=Db.y;pa[B+6]=Db.z;pa[B+7]=1;pa[B+8]=Eb.x;pa[B+9]=Eb.y;pa[B+10]=Eb.z;pa[B+11]=1;B=B+12}y=0;for(M=
+ca.length;y<M;y++){D=xa[ca[y]];ib=Hb[D.a];jb=Hb[D.b];kb=Hb[D.c];pc=Hb[D.d];ra[B]=ib.x;ra[B+1]=ib.y;ra[B+2]=ib.z;ra[B+3]=ib.w;ra[B+4]=jb.x;ra[B+5]=jb.y;ra[B+6]=jb.z;ra[B+7]=jb.w;ra[B+8]=kb.x;ra[B+9]=kb.y;ra[B+10]=kb.z;ra[B+11]=kb.w;ra[B+12]=pc.x;ra[B+13]=pc.y;ra[B+14]=pc.z;ra[B+15]=pc.w;lb=Ub[D.a];mb=Ub[D.b];nb=Ub[D.c];qc=Ub[D.d];qa[B]=lb.x;qa[B+1]=lb.y;qa[B+2]=lb.z;qa[B+3]=lb.w;qa[B+4]=mb.x;qa[B+5]=mb.y;qa[B+6]=mb.z;qa[B+7]=mb.w;qa[B+8]=nb.x;qa[B+9]=nb.y;qa[B+10]=nb.z;qa[B+11]=nb.w;qa[B+12]=qc.x;
+qa[B+13]=qc.y;qa[B+14]=qc.z;qa[B+15]=qc.w;zb=Sb[D.a];Ab=Sb[D.b];Bb=Sb[D.c];Dc=Sb[D.d];oa[B]=zb.x;oa[B+1]=zb.y;oa[B+2]=zb.z;oa[B+3]=1;oa[B+4]=Ab.x;oa[B+5]=Ab.y;oa[B+6]=Ab.z;oa[B+7]=1;oa[B+8]=Bb.x;oa[B+9]=Bb.y;oa[B+10]=Bb.z;oa[B+11]=1;oa[B+12]=Dc.x;oa[B+13]=Dc.y;oa[B+14]=Dc.z;oa[B+15]=1;Cb=Tb[D.a];Db=Tb[D.b];Eb=Tb[D.c];Ec=Tb[D.d];pa[B]=Cb.x;pa[B+1]=Cb.y;pa[B+2]=Cb.z;pa[B+3]=1;pa[B+4]=Db.x;pa[B+5]=Db.y;pa[B+6]=Db.z;pa[B+7]=1;pa[B+8]=Eb.x;pa[B+9]=Eb.y;pa[B+10]=Eb.z;pa[B+11]=1;pa[B+12]=Ec.x;pa[B+13]=Ec.y;
+pa[B+14]=Ec.z;pa[B+15]=1;B=B+16}if(B>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinVertexABuffer);g.bufferData(g.ARRAY_BUFFER,oa,Pa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinVertexBBuffer);g.bufferData(g.ARRAY_BUFFER,pa,Pa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinIndicesBuffer);g.bufferData(g.ARRAY_BUFFER,qa,Pa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinWeightsBuffer);g.bufferData(g.ARRAY_BUFFER,ra,Pa)}}if(rd&&Yc){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];Ya=D.vertexColors;Cc=D.color;if(Ya.length===
+3&&Yc===THREE.VertexColors){fb=Ya[0];gb=Ya[1];hb=Ya[2]}else hb=gb=fb=Cc;Fa[wa]=fb.r;Fa[wa+1]=fb.g;Fa[wa+2]=fb.b;Fa[wa+3]=gb.r;Fa[wa+4]=gb.g;Fa[wa+5]=gb.b;Fa[wa+6]=hb.r;Fa[wa+7]=hb.g;Fa[wa+8]=hb.b;wa=wa+9}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];Ya=D.vertexColors;Cc=D.color;if(Ya.length===4&&Yc===THREE.VertexColors){fb=Ya[0];gb=Ya[1];hb=Ya[2];oc=Ya[3]}else oc=hb=gb=fb=Cc;Fa[wa]=fb.r;Fa[wa+1]=fb.g;Fa[wa+2]=fb.b;Fa[wa+3]=gb.r;Fa[wa+4]=gb.g;Fa[wa+5]=gb.b;Fa[wa+6]=hb.r;Fa[wa+7]=hb.g;Fa[wa+8]=hb.b;Fa[wa+
+9]=oc.r;Fa[wa+10]=oc.g;Fa[wa+11]=oc.b;wa=wa+12}if(wa>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Fa,Pa)}}if(qd&&La.hasTangents){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];rb=D.vertexTangents;$a=rb[0];ab=rb[1];bb=rb[2];na[ha]=$a.x;na[ha+1]=$a.y;na[ha+2]=$a.z;na[ha+3]=$a.w;na[ha+4]=ab.x;na[ha+5]=ab.y;na[ha+6]=ab.z;na[ha+7]=ab.w;na[ha+8]=bb.x;na[ha+9]=bb.y;na[ha+10]=bb.z;na[ha+11]=bb.w;ha=ha+12}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];rb=D.vertexTangents;$a=rb[0];ab=
+rb[1];bb=rb[2];mc=rb[3];na[ha]=$a.x;na[ha+1]=$a.y;na[ha+2]=$a.z;na[ha+3]=$a.w;na[ha+4]=ab.x;na[ha+5]=ab.y;na[ha+6]=ab.z;na[ha+7]=ab.w;na[ha+8]=bb.x;na[ha+9]=bb.y;na[ha+10]=bb.z;na[ha+11]=bb.w;na[ha+12]=mc.x;na[ha+13]=mc.y;na[ha+14]=mc.z;na[ha+15]=mc.w;ha=ha+16}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglTangentBuffer);g.bufferData(g.ARRAY_BUFFER,na,Pa)}if(Qc&&fd){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];ac=D.vertexNormals;yb=D.normal;if(ac.length===3&&Bc)for(fa=0;fa<3;fa++){Fb=ac[fa];Ta[Ha]=Fb.x;Ta[Ha+1]=
+Fb.y;Ta[Ha+2]=Fb.z;Ha=Ha+3}else for(fa=0;fa<3;fa++){Ta[Ha]=yb.x;Ta[Ha+1]=yb.y;Ta[Ha+2]=yb.z;Ha=Ha+3}}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];ac=D.vertexNormals;yb=D.normal;if(ac.length===4&&Bc)for(fa=0;fa<4;fa++){Fb=ac[fa];Ta[Ha]=Fb.x;Ta[Ha+1]=Fb.y;Ta[Ha+2]=Fb.z;Ha=Ha+3}else for(fa=0;fa<4;fa++){Ta[Ha]=yb.x;Ta[Ha+1]=yb.y;Ta[Ha+2]=yb.z;Ha=Ha+3}}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,Ta,Pa)}if(jd&&bd&&gd){y=0;for(M=ba.length;y<M;y++){Ua=ba[y];D=xa[Ua];bc=bd[Ua];
+if(bc!==void 0)for(fa=0;fa<3;fa++){dc=bc[fa];rc[tb]=dc.u;rc[tb+1]=dc.v;tb=tb+2}}y=0;for(M=ca.length;y<M;y++){Ua=ca[y];D=xa[Ua];bc=bd[Ua];if(bc!==void 0)for(fa=0;fa<4;fa++){dc=bc[fa];rc[tb]=dc.u;rc[tb+1]=dc.v;tb=tb+2}}if(tb>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglUVBuffer);g.bufferData(g.ARRAY_BUFFER,rc,Pa)}}if(jd&&cd&&gd){y=0;for(M=ba.length;y<M;y++){Ua=ba[y];D=xa[Ua];cc=cd[Ua];if(cc!==void 0)for(fa=0;fa<3;fa++){ec=cc[fa];sc[ub]=ec.u;sc[ub+1]=ec.v;ub=ub+2}}y=0;for(M=ca.length;y<M;y++){Ua=ca[y];D=
+xa[Ua];cc=cd[Ua];if(cc!==void 0)for(fa=0;fa<4;fa++){ec=cc[fa];sc[ub]=ec.u;sc[ub+1]=ec.v;ub=ub+2}}if(ub>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglUV2Buffer);g.bufferData(g.ARRAY_BUFFER,sc,Pa)}}if(Pc){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];ob[Sa]=va;ob[Sa+1]=va+1;ob[Sa+2]=va+2;Sa=Sa+3;Qa[Ka]=va;Qa[Ka+1]=va+1;Qa[Ka+2]=va;Qa[Ka+3]=va+2;Qa[Ka+4]=va+1;Qa[Ka+5]=va+2;Ka=Ka+6;va=va+3}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];ob[Sa]=va;ob[Sa+1]=va+1;ob[Sa+2]=va+3;ob[Sa+3]=va+1;ob[Sa+4]=va+2;ob[Sa+5]=va+3;Sa=
+Sa+6;Qa[Ka]=va;Qa[Ka+1]=va+1;Qa[Ka+2]=va;Qa[Ka+3]=va+3;Qa[Ka+4]=va+1;Qa[Ka+5]=va+2;Qa[Ka+6]=va+2;Qa[Ka+7]=va+3;Ka=Ka+8;va=va+4}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,ob,Pa);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Qa,Pa)}if(ad){fa=0;for(hd=ad.length;fa<hd;fa++){s=ad[fa];if(s.__original.needsUpdate){t=0;if(s.size===1)if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(M=ba.length;y<M;y++){D=
+xa[ba[y]];s.array[t]=s.value[D.a];s.array[t+1]=s.value[D.b];s.array[t+2]=s.value[D.c];t=t+3}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];s.array[t]=s.value[D.a];s.array[t+1]=s.value[D.b];s.array[t+2]=s.value[D.c];s.array[t+3]=s.value[D.d];t=t+4}}else{if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){ga=s.value[ba[y]];s.array[t]=ga;s.array[t+1]=ga;s.array[t+2]=ga;t=t+3}y=0;for(M=ca.length;y<M;y++){ga=s.value[ca[y]];s.array[t]=ga;s.array[t+1]=ga;s.array[t+2]=ga;s.array[t+3]=ga;t=t+4}}}else if(s.size===
+2)if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;t=t+6}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];$=s.value[D.d];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;s.array[t+6]=$.x;s.array[t+7]=$.y;t=t+8}}else{if(s.boundTo===
+"faces"){y=0;for(M=ba.length;y<M;y++){L=K=J=ga=s.value[ba[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;t=t+6}y=0;for(M=ca.length;y<M;y++){$=L=K=J=ga=s.value[ca[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;s.array[t+6]=$.x;s.array[t+7]=$.y;t=t+8}}}else if(s.size===3){var R;R=s.type==="c"?["r","g","b"]:["x","y","z"];if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(M=ba.length;y<
+M;y++){D=xa[ba[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];$=s.value[D.d];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];
+s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}else if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){L=K=J=ga=s.value[ba[y]];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(M=ca.length;y<M;y++){$=L=K=J=ga=s.value[ca[y]];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];
+s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}else if(s.boundTo==="faceVertices"){y=0;for(M=ba.length;y<M;y++){ga=s.value[ba[y]];J=ga[0];K=ga[1];L=ga[2];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=
+0;for(M=ca.length;y<M;y++){ga=s.value[ca[y]];J=ga[0];K=ga[1];L=ga[2];$=ga[3];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}}else if(s.size===4)if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];s.array[t]=
+J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];$=s.value[D.d];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=
+L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}else if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){L=K=J=ga=s.value[ba[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(M=ca.length;y<M;y++){$=L=K=J=ga=s.value[ca[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+
+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}else if(s.boundTo==="faceVertices"){y=0;for(M=ba.length;y<M;y++){ga=s.value[ba[y]];J=ga[0];K=ga[1];L=ga[2];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;
+s.array[t+11]=L.w;t=t+12}y=0;for(M=ca.length;y<M;y++){ga=s.value[ca[y]];J=ga[0];K=ga[1];L=ga[2];$=ga[3];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}g.bindBuffer(g.ARRAY_BUFFER,s.buffer);g.bufferData(g.ARRAY_BUFFER,s.array,Pa)}}}if(zc){delete Z.__inittedArrays;delete Z.__colorArray;
+delete Z.__normalArray;delete Z.__tangentArray;delete Z.__uvArray;delete Z.__uv2Array;delete Z.__faceArray;delete Z.__vertexArray;delete Z.__lineArray;delete Z.__skinVertexAArray;delete Z.__skinVertexBArray;delete Z.__skinIndexArray;delete Z.__skinWeightArray}}}}X.verticesNeedUpdate=false;X.morphTargetsNeedUpdate=false;X.elementsNeedUpdate=false;X.uvsNeedUpdate=false;X.normalsNeedUpdate=false;X.colorsNeedUpdate=false;X.tangentsNeedUpdate=false;Na.attributes&&o(Na)}else if(Xa instanceof THREE.Ribbon){if(X.verticesNeedUpdate||
+X.colorsNeedUpdate){var Jb=X,kd=g.DYNAMIC_DRAW,tc=void 0,uc=void 0,Gc=void 0,Kb=void 0,Hc=void 0,ld=Jb.vertices,md=Jb.colors,td=ld.length,ud=md.length,Ic=Jb.__vertexArray,Jc=Jb.__colorArray,vd=Jb.colorsNeedUpdate;if(Jb.verticesNeedUpdate){for(tc=0;tc<td;tc++){Gc=ld[tc];Kb=tc*3;Ic[Kb]=Gc.x;Ic[Kb+1]=Gc.y;Ic[Kb+2]=Gc.z}g.bindBuffer(g.ARRAY_BUFFER,Jb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Ic,kd)}if(vd){for(uc=0;uc<ud;uc++){Hc=md[uc];Kb=uc*3;Jc[Kb]=Hc.r;Jc[Kb+1]=Hc.g;Jc[Kb+2]=Hc.b}g.bindBuffer(g.ARRAY_BUFFER,
+Jb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Jc,kd)}}X.verticesNeedUpdate=false;X.colorsNeedUpdate=false}else if(Xa instanceof THREE.Line){Na=c(Xa,lc);Yb=Na.attributes&&n(Na);if(X.verticesNeedUpdate||X.colorsNeedUpdate||Yb){var vb=X,dd=g.DYNAMIC_DRAW,vc=void 0,wc=void 0,Kc=void 0,sa=void 0,Lc=void 0,nd=vb.vertices,od=vb.colors,wd=nd.length,xd=od.length,Mc=vb.__vertexArray,Nc=vb.__colorArray,yd=vb.colorsNeedUpdate,ed=vb.__webglCustomAttributesList,Oc=void 0,pd=void 0,Ga=void 0,fc=void 0,Oa=void 0,
+ka=void 0;if(vb.verticesNeedUpdate){for(vc=0;vc<wd;vc++){Kc=nd[vc];sa=vc*3;Mc[sa]=Kc.x;Mc[sa+1]=Kc.y;Mc[sa+2]=Kc.z}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Mc,dd)}if(yd){for(wc=0;wc<xd;wc++){Lc=od[wc];sa=wc*3;Nc[sa]=Lc.r;Nc[sa+1]=Lc.g;Nc[sa+2]=Lc.b}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Nc,dd)}if(ed){Oc=0;for(pd=ed.length;Oc<pd;Oc++){ka=ed[Oc];if(ka.needsUpdate&&(ka.boundTo===void 0||ka.boundTo==="vertices")){sa=0;fc=ka.value.length;
+if(ka.size===1)for(Ga=0;Ga<fc;Ga++)ka.array[Ga]=ka.value[Ga];else if(ka.size===2)for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.x;ka.array[sa+1]=Oa.y;sa=sa+2}else if(ka.size===3)if(ka.type==="c")for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.r;ka.array[sa+1]=Oa.g;ka.array[sa+2]=Oa.b;sa=sa+3}else for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.x;ka.array[sa+1]=Oa.y;ka.array[sa+2]=Oa.z;sa=sa+3}else if(ka.size===4)for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.x;ka.array[sa+1]=
+Oa.y;ka.array[sa+2]=Oa.z;ka.array[sa+3]=Oa.w;sa=sa+4}g.bindBuffer(g.ARRAY_BUFFER,ka.buffer);g.bufferData(g.ARRAY_BUFFER,ka.array,dd)}}}}X.verticesNeedUpdate=false;X.colorsNeedUpdate=false;Na.attributes&&o(Na)}else if(Xa instanceof THREE.ParticleSystem){Na=c(Xa,lc);Yb=Na.attributes&&n(Na);(X.verticesNeedUpdate||X.colorsNeedUpdate||Xa.sortParticles||Yb)&&f(X,g.DYNAMIC_DRAW,Xa);X.verticesNeedUpdate=false;X.colorsNeedUpdate=false;Na.attributes&&o(Na)}}};this.initMaterial=function(a,b,c,d){var e,f,h,i,
+j,k,l,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var o,
+q;o=h=e=n=0;for(f=b.length;o<f;o++){q=b[o];if(!q.onlyShadow){q instanceof THREE.DirectionalLight&&h++;q instanceof THREE.PointLight&&e++;q instanceof THREE.SpotLight&&n++}}if(e+n+h<=V){o=h;f=e}else{o=Math.ceil(V*h/(e+h));n=f=V-o}e=o;h=n;n=l=0;for(o=b.length;n<o;n++){q=b[n];if(q.castShadow){q instanceof THREE.SpotLight&&l++;q instanceof THREE.DirectionalLight&&!q.shadowCascade&&l++}}if(hc&&d&&d.useVertexTexture)k=1024;else{b=g.getParameter(g.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==
+void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}k=b}var p;a:{q=a.fragmentShader;o=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:k,useVertexTexture:hc&&d&&d.useVertexTexture,
+boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,
+doubleSided:a.doubleSided},r,d=[];if(m)d.push(m);else{d.push(q);d.push(o)}for(r in c){d.push(r);d.push(c[r])}m=d.join();r=0;for(d=ea.length;r<d;r++){e=ea[r];if(e.code===m){e.usedTimes++;p=e.program;break a}}r=g.createProgram();d=["precision "+C+" float;",jc?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,
+"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?
+"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 e=["precision "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
 e=w("fragment",e+q);d=w("vertex",d+o);g.attachShader(r,d);g.attachShader(r,e);g.linkProgram(r);g.getProgramParameter(r,g.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+g.getProgramParameter(r,g.VALIDATE_STATUS)+", gl error ["+g.getError()+"]");g.deleteShader(e);g.deleteShader(d);r.uniforms={};r.attributes={};var u,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):
 d.push("boneGlobalMatrices");for(u in n)d.push(u);u=d;d=0;for(n=u.length;d<n;d++){e=u[d];r.uniforms[e]=g.getUniformLocation(r,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)d.push("morphTarget"+u);for(u=0;u<c.maxMorphNormals;u++)d.push("morphNormal"+u);for(p in b)d.push(p);p=d;u=0;for(c=p.length;u<c;u++){d=p[u];r.attributes[d]=g.getAttribLocation(r,d)}r.id=ja++;ea.push({program:r,code:m,usedTimes:1});F.info.memory.programs=
 ea.length;p=r}a.program=p;p=a.program.attributes;p.position>=0&&g.enableVertexAttribArray(p.position);p.color>=0&&g.enableVertexAttribArray(p.color);p.normal>=0&&g.enableVertexAttribArray(p.normal);p.tangent>=0&&g.enableVertexAttribArray(p.tangent);if(a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0){g.enableVertexAttribArray(p.skinVertexA);g.enableVertexAttribArray(p.skinVertexB);g.enableVertexAttribArray(p.skinIndex);g.enableVertexAttribArray(p.skinWeight)}if(a.attributes)for(j in a.attributes)p[j]!==
 void 0&&p[j]>=0&&g.enableVertexAttribArray(p[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;r="morphTarget";for(j=0;j<this.maxMorphTargets;j++){u=r+j;if(p[u]>=0){g.enableVertexAttribArray(p[u]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;r="morphNormal";for(j=0;j<this.maxMorphNormals;j++){u=r+j;if(p[u]>=0){g.enableVertexAttribArray(p[u]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=
-function(a,b){if(a){!b||b==="ccw"?g.frontFace(g.CCW):g.frontFace(g.CW);a==="back"?g.cullFace(g.BACK):a==="front"?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK);g.enable(g.CULL_FACE)}else g.disable(g.CULL_FACE)};this.setObjectFaces=function(a){if(ia!==a.doubleSided){a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE);ia=a.doubleSided}if(N!==a.flipSided){a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW);N=a.flipSided}};this.setDepthTest=function(a){if(Ia!==a){a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST);
+function(a,b){if(a){!b||b==="ccw"?g.frontFace(g.CCW):g.frontFace(g.CW);a==="back"?g.cullFace(g.BACK):a==="front"?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK);g.enable(g.CULL_FACE)}else g.disable(g.CULL_FACE)};this.setMaterialFaces=function(a){if(ia!==a.doubleSided){a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE);ia=a.doubleSided}if(N!==a.flipSided){a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW);N=a.flipSided}};this.setDepthTest=function(a){if(Ia!==a){a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST);
 Ia=a}};this.setDepthWrite=function(a){if(Ca!==a){g.depthMask(a);Ca=a}};this.setBlending=function(a,b,c,d){if(a!==ua){if(a===THREE.NoBlending)g.disable(g.BLEND);else if(a===THREE.AdditiveBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE)}else if(a===THREE.SubtractiveBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,
 g.SRC_COLOR)}else if(a===THREE.CustomBlending)g.enable(g.BLEND);else{g.enable(g.BLEND);g.blendEquationSeparate(g.FUNC_ADD,g.FUNC_ADD);g.blendFuncSeparate(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA,g.ONE,g.ONE_MINUS_SRC_ALPHA)}ua=a}if(a===THREE.CustomBlending){if(b!==Ba){g.blendEquation(A(b));Ba=b}if(c!==ma||d!==Ja){g.blendFunc(A(c),A(d));ma=c;Ja=d}}else Ja=ma=Ba=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=g.createTexture();F.info.memory.textures++}g.activeTexture(g.TEXTURE0+
 b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture);g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,a.flipY);g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=A(a.format),f=A(a.type);H(g.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?g.texImage2D(g.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):g.texImage2D(g.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&g.generateMipmap(g.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{g.activeTexture(g.TEXTURE0+
@@ -442,7 +442,7 @@ b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b
 "color");n.scale=b.getUniformLocation(i,"scale");n.rotation=b.getUniformLocation(i,"rotation");n.screenPosition=b.getUniformLocation(i,"screenPosition");o=false};this.render=function(a,d,e,p){var a=a.__webglFlares,x=a.length;if(x){var w=new THREE.Vector3,H=p/e,v=e*0.5,E=p*0.5,A=16/p,G=new THREE.Vector2(A*H,A),C=new THREE.Vector3(1,1,0),P=new THREE.Vector2(1,1),I=n,A=m;b.useProgram(i);if(!o){b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);o=true}b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
 1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(A.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(false);var U,W,S,z,O;for(U=0;U<x;U++){A=16/p;G.set(A*H,A);z=a[U];w.set(z.matrixWorld.elements[12],z.matrixWorld.elements[13],z.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(w);d.projectionMatrix.multiplyVector3(w);C.copy(w);P.x=C.x*v+v;P.y=C.y*E+E;if(k||P.x>0&&P.x<e&&P.y>0&&
 P.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,P.x-8,P.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,G.x,G.y);b.uniform3f(I.screenPosition,C.x,C.y,C.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,l);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,P.x-8,P.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,j);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(C);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);W=0;for(S=z.lensFlares.length;W<S;W++){O=z.lensFlares[W];if(O.opacity>0.001&&O.scale>0.001){C.x=O.x;C.y=O.y;C.z=O.z;A=O.size*O.scale/p;G.x=A*H;G.y=A;b.uniform3f(I.screenPosition,C.x,C.y,C.z);b.uniform2f(I.scale,G.x,G.y);b.uniform1f(I.rotation,O.rotation);b.uniform1f(I.opacity,O.opacity);
+b.bindTexture(b.TEXTURE_2D,j);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(C);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);W=0;for(S=z.lensFlares.length;W<S;W++){O=z.lensFlares[W];if(O.opacity>0.0010&&O.scale>0.0010){C.x=O.x;C.y=O.y;C.z=O.z;A=O.size*O.scale/p;G.x=A*H;G.y=A;b.uniform3f(I.screenPosition,C.x,C.y,C.z);b.uniform2f(I.scale,G.x,G.y);b.uniform1f(I.rotation,O.rotation);b.uniform1f(I.opacity,O.opacity);
 b.uniform3f(I.color,O.color.r,O.color.g,O.color.b);c.setBlending(O.blending,O.blendEquation,O.blendSrc,O.blendDst);c.setTexture(O.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f=new THREE.Frustum,h=new THREE.Matrix4,j=new THREE.Vector3,l=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:h,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
 vertexShader:f.vertexShader,uniforms:h,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,i){var m,n,o,u,q,r,p,x,w,H=[];u=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);m=0;for(n=k.__lights.length;m<n;m++){o=k.__lights[m];if(o.castShadow)if(o instanceof THREE.DirectionalLight&&

+ 3 - 6
examples/misc_ubiquity_test.html

@@ -79,10 +79,9 @@
 
 				// PLANE
 
-				mesh = new THREE.Mesh( new THREE.PlaneGeometry( 100, 100 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
+				mesh = new THREE.Mesh( new THREE.PlaneGeometry( 100, 100 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, doubleSided: true } ) );
 				mesh.position.y = -500;
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
-				mesh.doubleSided = true;
 				scene.add( mesh );
 
 				// CYLINDER
@@ -111,7 +110,7 @@
 
 					var face = new THREE.Face3( geometry.vertices.push( v0 ) - 1, geometry.vertices.push( v1 ) - 1, geometry.vertices.push( v2 ) - 1, null, null, geometry.materials.length );
 
-					geometry.materials.push( new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
+					geometry.materials.push( new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, doubleSided: true } ) );
 
 					geometry.faces.push( face );
 
@@ -125,12 +124,10 @@
 				scene.add( group );
 
 				mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() );
-				mesh.doubleSided = true;
 				group.add( mesh );
 
 				/*
-				mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true, wireframe: true, wireframeLinewidth: 10 } ) );
-				mesh.doubleSided = true;
+				mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true, wireframe: true, wireframeLinewidth: 10, doubleSided: true } ) );
 				group.add( mesh );
 				*/
 

+ 0 - 2
examples/webgl_animation_skinning.html

@@ -167,8 +167,6 @@
 
 						buffalo = new THREE.SkinnedMesh( geometry, material, false );
 
-						//buffalo.doubleSided = true;
-
 						buffalo.position.x = - ( gridx - 1 ) * sepx * 0.5 + x * sepx + Math.random() * 0.5 * sepx;
 						buffalo.position.z = - ( gridz - 1 ) * sepz * 0.5 + z * sepz + Math.random() * 0.5 * sepz - 500;
 

+ 2 - 4
examples/webgl_geometries.html

@@ -50,8 +50,8 @@
 				scene.add( light );
 
 				materials = [
-					new THREE.MeshLambertMaterial( { ambient: 0xbbbbbb, map: THREE.ImageUtils.loadTexture( 'textures/ash_uvgrid01.jpg' ) } ),
-					new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1 } )
+					new THREE.MeshLambertMaterial( { ambient: 0xbbbbbb, map: THREE.ImageUtils.loadTexture( 'textures/ash_uvgrid01.jpg' ), doubleSided: true } ),
+					new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1, doubleSided: true } )
 				];
 
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.CubeGeometry( 100, 100, 100, 4, 4, 4 ), materials );
@@ -76,7 +76,6 @@
 				scene.add( object );
 
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.PlaneGeometry( 100, 100, 4, 4 ), materials );
-				object.children[ 0 ].doubleSided = true;
 				object.position.set( -200, 0, 0 );
 				scene.add( object );
 
@@ -93,7 +92,6 @@
 				}
 
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.LatheGeometry( points, 20 ), materials );
-				object.children[ 0 ].doubleSided = true;
 				object.position.set( 200, 0, 0 );
 				scene.add( object );
 

+ 6 - 8
examples/webgl_geometries2.html

@@ -61,8 +61,8 @@
 				scene.add( light );
 
 				materials = [
-					new THREE.MeshLambertMaterial( { ambient: 0xbbbbbb, map: THREE.ImageUtils.loadTexture( 'textures/ash_uvgrid01.jpg' ) } ),
-					new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1 } )
+					new THREE.MeshLambertMaterial( { ambient: 0xbbbbbb, map: THREE.ImageUtils.loadTexture( 'textures/ash_uvgrid01.jpg' ), doubleSided: true } ),
+					new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1, doubleSided: true } )
 				];
 
 
@@ -93,19 +93,19 @@
 				var geo;
 
 				// Klein Bottle
+
 				geo = new THREE.ParametricGeometry(THREE.ParametricGeometries.klein, 20, 20);
 				object = THREE.SceneUtils.createMultiMaterialObject( geo, materials );
-				object.children[ 0 ].doubleSided = true;
 				object.position.set( 0, 0, 0 );
-				object.scale.multiplyScalar(10);
+				object.scale.multiplyScalar( 10 );
 				scene.add( object );
 
 				// Mobius Strip
+
 				geo = new THREE.ParametricGeometry(THREE.ParametricGeometries.mobius, 20, 20);
 				object = THREE.SceneUtils.createMultiMaterialObject( geo, materials );
-				// object.children[ 0 ].doubleSided = true;
 				object.position.set( 10, 0, 0 );
-				object.scale.multiplyScalar(100);
+				object.scale.multiplyScalar( 100 );
 				scene.add( object );
 
 				var geo = new THREE.ParametricGeometry(THREE.ParametricGeometries.plane(200, 200), 10, 20);
@@ -144,12 +144,10 @@
 
 
 				// object = THREE.SceneUtils.createMultiMaterialObject( new THREE.PlaneGeometry( 400, 400, 4, 4 ), materials );
-				// // object.children[ 0 ].doubleSided = true;
 				// object.position.set( -200, 100, 0 );
 				// scene.add( object );
 
 				// object = THREE.SceneUtils.createMultiMaterialObject( new THREE.PlaneGeometry2( 400, 400, 4, 4 ), materials );
-				// object.children[ 0 ].doubleSided = true;
 				// object.position.set( -200, 100, 0 );
 				// scene.add( object );
 

+ 2 - 2
examples/webgl_geometry_tessellation.html

@@ -128,7 +128,8 @@
 				attributes:     attributes,
 				vertexShader:   document.getElementById( 'vertexshader' ).textContent,
 				fragmentShader: document.getElementById( 'fragmentshader' ).textContent,
-				shading: 		THREE.FlatShading
+				shading: 		THREE.FlatShading,
+				doubleSided:	true
 
 			});
 
@@ -209,7 +210,6 @@
 
 			mesh = new THREE.Mesh( geometry, shaderMaterial );
 			mesh.rotation.set( 0.5, 0.5, 0 );
-			mesh.doubleSided = true;
 
 			scene.add( mesh );
 

+ 4 - 4
examples/webgl_loader_ctm_materials.html

@@ -113,12 +113,12 @@
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
 					uniforms: shader.uniforms,
-					depthWrite: false
+					depthWrite: false,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100 ), material );
-				mesh.flipSided = true;
 				sceneCube.add( mesh );
 
 				// LIGHTS
@@ -214,7 +214,6 @@
 						var mesh = new THREE.Mesh( geometries[ i ], materials[ i ] );
 						mesh.position = position;
 						mesh.scale = scale;
-						mesh.doubleSided = true;
 						scene.add( mesh );
 
 					}
@@ -282,6 +281,8 @@
 
 					}
 
+					materials[ i ].doubleSided = true;
+
 				}
 
 			}
@@ -300,7 +301,6 @@
 				mesh = new THREE.Mesh( geometry, material );
 				mesh.position.set( x, y, z );
 				mesh.scale.set( s, s, s );
-				mesh.doubleSided = true;
 				scene.add( mesh );
 
 			}

+ 1 - 2
examples/webgl_loader_vtk.html

@@ -80,7 +80,7 @@
 				camera.add( dirLight );
 				camera.add( dirLight.target );
 
-				var material = new THREE.MeshLambertMaterial( { color:0xffffff} );
+				var material = new THREE.MeshLambertMaterial( { color:0xffffff, doubleSided: true } );
 
 				var loader = new THREE.VTKLoader();
 				loader.addEventListener( 'load', function ( event ) {
@@ -88,7 +88,6 @@
 					var geometry = event.content;
 
 					var mesh = new THREE.Mesh( geometry, material );
-					mesh.doubleSided = true;
 					mesh.position.setY( - 0.09 );
 					scene.add( mesh );
 

+ 2 - 2
examples/webgl_materials_cars.html

@@ -197,12 +197,12 @@
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
 					uniforms: shader.uniforms,
-					depthWrite: false
+					depthWrite: false,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100 ), material );
-				mesh.flipSided = true;
 				sceneCube.add( mesh );
 
 				//

+ 2 - 2
examples/webgl_materials_cars_anaglyph.html

@@ -191,12 +191,12 @@
 
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
-					uniforms: shader.uniforms
+					uniforms: shader.uniforms,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000 ), material );
-				mesh.flipSided = true;
 				scene.add( mesh );
 
 				//

+ 2 - 2
examples/webgl_materials_cars_parallaxbarrier.html

@@ -191,12 +191,12 @@
 
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
-					uniforms: shader.uniforms
+					uniforms: shader.uniforms,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000 ), material );
-				mesh.flipSided = true;
 				scene.add( mesh );
 
 				//

+ 2 - 2
examples/webgl_materials_cubemap.html

@@ -124,12 +124,12 @@
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
 					uniforms: shader.uniforms,
-					depthWrite: false
+					depthWrite: false,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100 ), material );
-				mesh.flipSided = true;
 				sceneCube.add( mesh );
 
 				//

+ 2 - 2
examples/webgl_materials_cubemap_balls_reflection.html

@@ -116,12 +116,12 @@
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
 					uniforms: shader.uniforms,
-					depthWrite: false
+					depthWrite: false,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100 ), material );
-				mesh.flipSided = true;
 				sceneCube.add( mesh );
 
 				//

+ 2 - 2
examples/webgl_materials_cubemap_balls_reflection_anaglyph.html

@@ -113,12 +113,12 @@
 
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
-					uniforms: shader.uniforms
+					uniforms: shader.uniforms,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000 ), material );
-				mesh.flipSided = true;
 				scene.add( mesh );
 
 				//

+ 2 - 2
examples/webgl_materials_cubemap_balls_refraction.html

@@ -115,12 +115,12 @@
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
 					uniforms: shader.uniforms,
-					depthWrite: false
+					depthWrite: false,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100 ), material );
-				mesh.flipSided = true;
 				sceneCube.add( mesh );
 
 				//

+ 2 - 2
examples/webgl_materials_cubemap_balls_refraction_crosseyed.html

@@ -114,12 +114,12 @@
 
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
-					uniforms: shader.uniforms
+					uniforms: shader.uniforms,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000 ), material );
-				mesh.flipSided = true;
 				scene.add( mesh );
 
 				//

+ 2 - 2
examples/webgl_materials_cubemap_escher.html

@@ -93,12 +93,12 @@
 
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
-					uniforms: shader.uniforms
+					uniforms: shader.uniforms,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 6000, 6000, 6000 ), material );
-				mesh.flipSided = true;
 				scene.add( mesh );
 
 				//

+ 2 - 2
examples/webgl_materials_cubemap_refraction.html

@@ -116,12 +116,12 @@
 
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
-					uniforms: shader.uniforms
+					uniforms: shader.uniforms,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000 ), material );
-				mesh.flipSided = true;
 				sceneCube.add( mesh );
 
 				//

+ 2 - 2
examples/webgl_materials_shaders_fresnel.html

@@ -125,12 +125,12 @@
 
 					fragmentShader: shader.fragmentShader,
 					vertexShader: shader.vertexShader,
-					uniforms: shader.uniforms
+					uniforms: shader.uniforms,
+					flipSided: true
 
 				} ),
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000 ), material );
-				mesh.flipSided = true;
 				sceneCube.add( mesh );
 
 				//

+ 1 - 2
examples/webgl_materials_skin.html

@@ -278,7 +278,6 @@
 				mesh = new THREE.Mesh( geometry, material );
 				mesh.position.y = - 50;
 				mesh.scale.set( scale, scale, scale );
-				mesh.doubleSided = true;
 
 				scene.add( mesh );
 
@@ -286,7 +285,7 @@
 
 			}
 
-			function onDocumentMouseMove(event) {
+			function onDocumentMouseMove( event ) {
 
 				mouseX = ( event.clientX - windowHalfX );
 				mouseY = ( event.clientY - windowHalfY );

+ 2 - 4
examples/webgl_performance_doublesided.html

@@ -80,13 +80,13 @@
 					var reflectionCube = THREE.ImageUtils.loadTextureCube( urls );
 					reflectionCube.format = THREE.RGBFormat;
 
-					var material = new THREE.MeshPhongMaterial( { specular: 0xffffff, shininess: 100, envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.1, perPixel: true } );
+					var material = new THREE.MeshPhongMaterial( { specular: 0xffffff, shininess: 100, envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.1, perPixel: true, doubleSided: true } );
 					material.wrapAround = true;
 					material.wrapRGB.set( 0.5, 0.5, 0.5 );
 
 				} else {
 
-					var material = new THREE.MeshPhongMaterial( { specular: 0xffffff, shading: THREE.SmoothShading, perPixel: true } );
+					var material = new THREE.MeshPhongMaterial( { specular: 0xffffff, shading: THREE.SmoothShading, perPixel: true, doubleSided: true } );
 
 				}
 
@@ -107,8 +107,6 @@
 					mesh.matrixAutoUpdate = false;
 					mesh.updateMatrix();
 
-					mesh.doubleSided = true;
-
 					scene.add( mesh );
 
 				}

+ 1 - 2
examples/webgl_ribbons.html

@@ -124,7 +124,7 @@
 				for ( i = 0; i < xgrid; i ++ )
 				for ( j = 0; j < ygrid; j ++ ) {
 
-					materials[ c ] = new THREE.MeshBasicMaterial( { color: 0xffffff, vertexColors: true } );
+					materials[ c ] = new THREE.MeshBasicMaterial( { color: 0xffffff, vertexColors: true, doubleSided: true } );
 
 					ribbon = new THREE.Ribbon( i % 2 ? geometry : geometry2, materials[ c ] );
 					ribbon.rotation.x = 0;
@@ -138,7 +138,6 @@
 
 					materials[c].color.setHSV( i / xgrid, 0.3 +  0.7 * j / ygrid, 1 );
 
-					ribbon.doubleSided = true;
 					ribbon.matrixAutoUpdate = false;
 
 					// manually create local matrix

+ 1 - 3
examples/webgl_shading_physical.html

@@ -290,7 +290,7 @@
 
 				loader.load( "models/animated/sittingBox.js", function( geometry ) {
 
-					var morphMaterial = new THREE.MeshPhongMaterial( { ambient: 0x000000, color: 0x000000, specular: 0xff9900, shininess: 50, morphTargets: true, morphNormals: true  } );
+					var morphMaterial = new THREE.MeshPhongMaterial( { ambient: 0x000000, color: 0x000000, specular: 0xff9900, shininess: 50, morphTargets: true, morphNormals: true, doubleSided: true } );
 					morphMaterial.shading = THREE.FlatShading;
 
 					geometry.computeMorphNormals();
@@ -305,8 +305,6 @@
 					morph.castShadow = true;
 					morph.receiveShadow = true;
 
-					morph.doubleSided = true;
-
 					scene.add( morph );
 
 				} );

+ 2 - 5
src/core/Object3D.js

@@ -20,9 +20,6 @@ THREE.Object3D = function () {
 	this.eulerOrder = 'XYZ';
 	this.scale = new THREE.Vector3( 1, 1, 1 );
 
-	this.doubleSided = false;
-	this.flipSided = false;
-
 	this.renderDepth = null;
 
 	this.rotationAutoUpdate = true;
@@ -61,10 +58,10 @@ THREE.Object3D.prototype = {
 		this.matrix.multiply( matrix, this.matrix );
 
 		this.scale.getScaleFromMatrix( this.matrix );
-		
+
 		var mat = new THREE.Matrix4().extractRotation( this.matrix );
 		this.rotation.setEulerFromRotationMatrix( mat, this.eulerOrder );
-		
+
 		this.position.getPositionFromMatrix( this.matrix );
 
 	},

+ 0 - 3
src/extras/SceneUtils.js

@@ -148,9 +148,6 @@ THREE.SceneUtils = {
 
 		object.dynamic = source.dynamic;
 
-		object.doubleSided = source.doubleSided;
-		object.flipSided = source.flipSided;
-
 		object.renderDepth = source.renderDepth;
 
 		object.rotationAutoUpdate = source.rotationAutoUpdate;

+ 1 - 1
src/extras/renderers/plugins/DepthPassPlugin.js

@@ -114,7 +114,7 @@ THREE.DepthPassPlugin = function ( ) {
 				object = webglObject.object;
 				buffer = webglObject.buffer;
 
-				_renderer.setObjectFaces( object );
+				if ( object.material ) _renderer.setMaterialFaces( object.material );
 
 				if ( object.customDepthMaterial ) {
 

+ 0 - 2
src/extras/renderers/plugins/ShadowMapPlugin.js

@@ -259,8 +259,6 @@ THREE.ShadowMapPlugin = function ( ) {
 					// culling is overriden globally for all objects
 					// while rendering depth map
 
-					//_renderer.setObjectFaces( object );
-
 					if ( object.customDepthMaterial ) {
 
 						material = object.customDepthMaterial;

+ 12 - 0
src/loaders/Loader.js

@@ -231,6 +231,18 @@ THREE.Loader.prototype = {
 
 		}
 
+		if ( m.doubleSided !== undefined ) {
+
+			mpars.doubleSided = m.doubleSided;
+
+		}
+
+		if ( m.flipSided !== undefined ) {
+
+			mpars.flipSided = m.flipSided;
+
+		}
+
 		if ( m.vertexColors !== undefined ) {
 
 			if ( m.vertexColors == "face" ) {

+ 0 - 1
src/loaders/SceneLoader.js

@@ -211,7 +211,6 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
 						}
 
 						object.visible = o.visible;
-						object.doubleSided = o.doubleSided;
 						object.castShadow = o.castShadow;
 						object.receiveShadow = o.receiveShadow;
 

+ 3 - 0
src/materials/Material.js

@@ -33,6 +33,9 @@ THREE.Material = function ( parameters ) {
 
 	this.visible = parameters.visible !== undefined ? parameters.visible : true;
 
+	this.doubleSided = parameters.doubleSided !== undefined ? parameters.doubleSided : false;
+	this.flipSided = parameters.flipSided !== undefined ? parameters.flipSided : false;
+
 	this.needsUpdate = true;
 
 }

+ 11 - 11
src/renderers/WebGLRenderer.js

@@ -3957,7 +3957,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				}
 
-				_this.setObjectFaces( object );
+				_this.setMaterialFaces( material );
 
 				if ( buffer instanceof THREE.BufferGeometry ) {
 
@@ -4018,7 +4018,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		_currentGeometryGroupHash = -1;
 
-		_this.setObjectFaces( object );
+		_this.setMaterialFaces( material );
 
 		if ( object.immediateRenderCallback ) {
 
@@ -4672,7 +4672,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			metal: material.metal,
 			perPixel: material.perPixel,
 			wrapAround: material.wrapAround,
-			doubleSided: object && object.doubleSided
+			doubleSided: material.doubleSided
 
 		};
 
@@ -5353,7 +5353,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function setupMatrices ( object, camera ) {
 
-		object._modelViewMatrix.multiply( camera.matrixWorldInverse, object.matrixWorld);
+		object._modelViewMatrix.multiply( camera.matrixWorldInverse, object.matrixWorld );
 
 		object._normalMatrix.getInverse( object._modelViewMatrix );
 		object._normalMatrix.transpose();
@@ -5572,11 +5572,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
-	this.setObjectFaces = function ( object ) {
+	this.setMaterialFaces = function ( material ) {
 
-		if ( _oldDoubleSided !== object.doubleSided ) {
+		if ( _oldDoubleSided !== material.doubleSided ) {
 
-			if ( object.doubleSided ) {
+			if ( material.doubleSided ) {
 
 				_gl.disable( _gl.CULL_FACE );
 
@@ -5586,13 +5586,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
-			_oldDoubleSided = object.doubleSided;
+			_oldDoubleSided = material.doubleSided;
 
 		}
 
-		if ( _oldFlipSided !== object.flipSided ) {
+		if ( _oldFlipSided !== material.flipSided ) {
 
-			if ( object.flipSided ) {
+			if ( material.flipSided ) {
 
 				_gl.frontFace( _gl.CW );
 
@@ -5602,7 +5602,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
-			_oldFlipSided = object.flipSided;
+			_oldFlipSided = material.flipSided;
 
 		}