瀏覽代碼

Updated Blender exporter to export new JSON format.

Also some fixes along the way to properly handle vertex colors in loaders.

Many things still broken, but we move forward.
alteredq 14 年之前
父節點
當前提交
071de366c2

+ 21 - 20
build/Three.js

@@ -88,7 +88,7 @@ THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.po
 THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 !1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.FlatShading=0;THREE.SmoothShading=1;THREE.MaterialColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
+THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
 THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
@@ -271,7 +271,7 @@ n.__webGLColorBuffer=f.createBuffer();n=w;E=n.vertices.length;n.__vertexArray=ne
 opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){D=m.__objectsRemoved[0];p=m;w=void 0;n=void 0;for(w=p.__webglObjects.length-1;w>=0;w--){n=p.__webglObjects[w].object;D==n&&p.__webglObjects.splice(w,1)}m.__objectsRemoved.splice(0,1)}D=0;for(p=m.__webglObjects.length;D<p;D++){n=m.__webglObjects[D].object;E=void 0;w=void 0;C=void 0;if(n instanceof THREE.Mesh){w=n.geometry;for(E in w.geometryGroups){C=w.geometryGroups[E];if(w.__dirtyVertices||
 opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){D=m.__objectsRemoved[0];p=m;w=void 0;n=void 0;for(w=p.__webglObjects.length-1;w>=0;w--){n=p.__webglObjects[w].object;D==n&&p.__webglObjects.splice(w,1)}m.__objectsRemoved.splice(0,1)}D=0;for(p=m.__webglObjects.length;D<p;D++){n=m.__webglObjects[D].object;E=void 0;w=void 0;C=void 0;if(n instanceof THREE.Mesh){w=n.geometry;for(E in w.geometryGroups){C=w.geometryGroups[E];if(w.__dirtyVertices||
 w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){G=f.DYNAMIC_DRAW;S=void 0;va=void 0;var Ga=void 0,O=void 0;Ga=void 0;var Oa=void 0,Fa=void 0,Sa=void 0;P=void 0;wa=void 0;M=void 0;ca=void 0;ha=void 0;var U=void 0,$=void 0,aa=void 0,ma=void 0;Fa=void 0;Sa=void 0;U=void 0;O=void 0;U=void 0;$=void 0;aa=void 0;Fa=void 0;U=void 0;$=void 0;aa=void 0;ma=void 0;U=void 0;$=void 0;aa=void 0;ma=void 0;U=void 0;$=void 0;aa=void 0;ma=void 0;U=void 0;
 w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){G=f.DYNAMIC_DRAW;S=void 0;va=void 0;var Ga=void 0,O=void 0;Ga=void 0;var Oa=void 0,Fa=void 0,Sa=void 0;P=void 0;wa=void 0;M=void 0;ca=void 0;ha=void 0;var U=void 0,$=void 0,aa=void 0,ma=void 0;Fa=void 0;Sa=void 0;U=void 0;O=void 0;U=void 0;$=void 0;aa=void 0;Fa=void 0;U=void 0;$=void 0;aa=void 0;ma=void 0;U=void 0;$=void 0;aa=void 0;ma=void 0;U=void 0;$=void 0;aa=void 0;ma=void 0;U=void 0;
 $=void 0;aa=void 0;ma=void 0;O=void 0;Oa=void 0;Ga=void 0;Ga=void 0;var Ka=void 0,Xa=void 0,Ma=void 0,Va=Ra=Ja=ra=ia=0,Qa=0,L=0,ga=0,X=0,B=0,T=0,ja=C.__vertexArray,Na=C.__uvArray,Pa=C.__uv2Array,La=C.__normalArray,Ba=C.__tangentArray,Ha=C.__colorArray,Ca=C.__skinVertexAArray,Ia=C.__skinVertexBArray,Aa=C.__skinIndexArray,Da=C.__skinWeightArray,eb=C.__morphTargetsArrays,Ya=C.__faceArray,Ua=C.__lineArray,lb=C.__needsSmoothNormals;wa=C.__vertexColorType;P=C.__uvType;M=C.__normalType;var Ta=n.geometry,
 $=void 0;aa=void 0;ma=void 0;O=void 0;Oa=void 0;Ga=void 0;Ga=void 0;var Ka=void 0,Xa=void 0,Ma=void 0,Va=Ra=Ja=ra=ia=0,Qa=0,L=0,ga=0,X=0,B=0,T=0,ja=C.__vertexArray,Na=C.__uvArray,Pa=C.__uv2Array,La=C.__normalArray,Ba=C.__tangentArray,Ha=C.__colorArray,Ca=C.__skinVertexAArray,Ia=C.__skinVertexBArray,Aa=C.__skinIndexArray,Da=C.__skinWeightArray,eb=C.__morphTargetsArrays,Ya=C.__faceArray,Ua=C.__lineArray,lb=C.__needsSmoothNormals;wa=C.__vertexColorType;P=C.__uvType;M=C.__normalType;var Ta=n.geometry,
-fb=Ta.__dirtyVertices,gb=Ta.__dirtyElements,db=Ta.__dirtyUvs,hb=Ta.__dirtyNormals,ib=Ta.__dirtyTangents,jb=Ta.__dirtyColors,kb=Ta.__dirtyMorphTargets,Wa=Ta.vertices,mb=C.faces,pb=Ta.faces,nb=Ta.faceVertexUvs[0],ob=Ta.faceVertexUvs[1],qb=Ta.colors,ab=Ta.skinVerticesA,bb=Ta.skinVerticesB,cb=Ta.skinIndices,$a=Ta.skinWeights,Za=Ta.morphTargets;S=0;for(va=mb.length;S<va;S++){Ga=mb[S];O=pb[Ga];nb&&(ca=nb[Ga]);ob&&(ha=ob[Ga]);Ga=O.vertexNormals;Oa=O.normal;Fa=O.vertexColors;Sa=O.color;if(O instanceof THREE.Face3){if(fb){U=
+fb=Ta.__dirtyVertices,gb=Ta.__dirtyElements,db=Ta.__dirtyUvs,hb=Ta.__dirtyNormals,ib=Ta.__dirtyTangents,jb=Ta.__dirtyColors,kb=Ta.__dirtyMorphTargets,Wa=Ta.vertices,mb=C.faces,pb=Ta.faces,nb=Ta.faceVertexUvs[0],ob=Ta.faceVertexUvs[1],ab=Ta.skinVerticesA,bb=Ta.skinVerticesB,cb=Ta.skinIndices,$a=Ta.skinWeights,Za=Ta.morphTargets;S=0;for(va=mb.length;S<va;S++){Ga=mb[S];O=pb[Ga];nb&&(ca=nb[Ga]);ob&&(ha=ob[Ga]);Ga=O.vertexNormals;Oa=O.normal;Fa=O.vertexColors;Sa=O.color;if(O instanceof THREE.Face3){if(fb){U=
 Wa[O.a].position;$=Wa[O.b].position;aa=Wa[O.c].position;ja[ra]=U.x;ja[ra+1]=U.y;ja[ra+2]=U.z;ja[ra+3]=$.x;ja[ra+4]=$.y;ja[ra+5]=$.z;ja[ra+6]=aa.x;ja[ra+7]=aa.y;ja[ra+8]=aa.z;ra+=9}if(kb){Ka=0;for(Xa=Za.length;Ka<Xa;Ka++){U=Za[Ka].vertices[O.a].position;$=Za[Ka].vertices[O.b].position;aa=Za[Ka].vertices[O.c].position;Ma=eb[Ka];Ma[T+0]=U.x;Ma[T+1]=U.y;Ma[T+2]=U.z;Ma[T+3]=$.x;Ma[T+4]=$.y;Ma[T+5]=$.z;Ma[T+6]=aa.x;Ma[T+7]=aa.y;Ma[T+8]=aa.z}T+=9}if($a.length){U=$a[O.a];$=$a[O.b];aa=$a[O.c];Da[B]=U.x;Da[B+
 Wa[O.a].position;$=Wa[O.b].position;aa=Wa[O.c].position;ja[ra]=U.x;ja[ra+1]=U.y;ja[ra+2]=U.z;ja[ra+3]=$.x;ja[ra+4]=$.y;ja[ra+5]=$.z;ja[ra+6]=aa.x;ja[ra+7]=aa.y;ja[ra+8]=aa.z;ra+=9}if(kb){Ka=0;for(Xa=Za.length;Ka<Xa;Ka++){U=Za[Ka].vertices[O.a].position;$=Za[Ka].vertices[O.b].position;aa=Za[Ka].vertices[O.c].position;Ma=eb[Ka];Ma[T+0]=U.x;Ma[T+1]=U.y;Ma[T+2]=U.z;Ma[T+3]=$.x;Ma[T+4]=$.y;Ma[T+5]=$.z;Ma[T+6]=aa.x;Ma[T+7]=aa.y;Ma[T+8]=aa.z}T+=9}if($a.length){U=$a[O.a];$=$a[O.b];aa=$a[O.c];Da[B]=U.x;Da[B+
 1]=U.y;Da[B+2]=U.z;Da[B+3]=U.w;Da[B+4]=$.x;Da[B+5]=$.y;Da[B+6]=$.z;Da[B+7]=$.w;Da[B+8]=aa.x;Da[B+9]=aa.y;Da[B+10]=aa.z;Da[B+11]=aa.w;U=cb[O.a];$=cb[O.b];aa=cb[O.c];Aa[B]=U.x;Aa[B+1]=U.y;Aa[B+2]=U.z;Aa[B+3]=U.w;Aa[B+4]=$.x;Aa[B+5]=$.y;Aa[B+6]=$.z;Aa[B+7]=$.w;Aa[B+8]=aa.x;Aa[B+9]=aa.y;Aa[B+10]=aa.z;Aa[B+11]=aa.w;U=ab[O.a];$=ab[O.b];aa=ab[O.c];Ca[B]=U.x;Ca[B+1]=U.y;Ca[B+2]=U.z;Ca[B+3]=1;Ca[B+4]=$.x;Ca[B+5]=$.y;Ca[B+6]=$.z;Ca[B+7]=1;Ca[B+8]=aa.x;Ca[B+9]=aa.y;Ca[B+10]=aa.z;Ca[B+11]=1;U=bb[O.a];$=bb[O.b];
 1]=U.y;Da[B+2]=U.z;Da[B+3]=U.w;Da[B+4]=$.x;Da[B+5]=$.y;Da[B+6]=$.z;Da[B+7]=$.w;Da[B+8]=aa.x;Da[B+9]=aa.y;Da[B+10]=aa.z;Da[B+11]=aa.w;U=cb[O.a];$=cb[O.b];aa=cb[O.c];Aa[B]=U.x;Aa[B+1]=U.y;Aa[B+2]=U.z;Aa[B+3]=U.w;Aa[B+4]=$.x;Aa[B+5]=$.y;Aa[B+6]=$.z;Aa[B+7]=$.w;Aa[B+8]=aa.x;Aa[B+9]=aa.y;Aa[B+10]=aa.z;Aa[B+11]=aa.w;U=ab[O.a];$=ab[O.b];aa=ab[O.c];Ca[B]=U.x;Ca[B+1]=U.y;Ca[B+2]=U.z;Ca[B+3]=1;Ca[B+4]=$.x;Ca[B+5]=$.y;Ca[B+6]=$.z;Ca[B+7]=1;Ca[B+8]=aa.x;Ca[B+9]=aa.y;Ca[B+10]=aa.z;Ca[B+11]=1;U=bb[O.a];$=bb[O.b];
 aa=bb[O.c];Ia[B]=U.x;Ia[B+1]=U.y;Ia[B+2]=U.z;Ia[B+3]=1;Ia[B+4]=$.x;Ia[B+5]=$.y;Ia[B+6]=$.z;Ia[B+7]=1;Ia[B+8]=aa.x;Ia[B+9]=aa.y;Ia[B+10]=aa.z;Ia[B+11]=1;B+=12}if(jb&&wa){if(Fa.length==3&&wa==THREE.VertexColors){U=Fa[0];$=Fa[1];aa=Fa[2]}else aa=$=U=Sa;Ha[X]=U.r;Ha[X+1]=U.g;Ha[X+2]=U.b;Ha[X+3]=$.r;Ha[X+4]=$.g;Ha[X+5]=$.b;Ha[X+6]=aa.r;Ha[X+7]=aa.g;Ha[X+8]=aa.b;X+=9}if(ib&&Ta.hasTangents){Fa=Wa[O.a].tangent;Sa=Wa[O.b].tangent;U=Wa[O.c].tangent;Ba[L]=Fa.x;Ba[L+1]=Fa.y;Ba[L+2]=Fa.z;Ba[L+3]=Fa.w;Ba[L+4]=
 aa=bb[O.c];Ia[B]=U.x;Ia[B+1]=U.y;Ia[B+2]=U.z;Ia[B+3]=1;Ia[B+4]=$.x;Ia[B+5]=$.y;Ia[B+6]=$.z;Ia[B+7]=1;Ia[B+8]=aa.x;Ia[B+9]=aa.y;Ia[B+10]=aa.z;Ia[B+11]=1;B+=12}if(jb&&wa){if(Fa.length==3&&wa==THREE.VertexColors){U=Fa[0];$=Fa[1];aa=Fa[2]}else aa=$=U=Sa;Ha[X]=U.r;Ha[X+1]=U.g;Ha[X+2]=U.b;Ha[X+3]=$.r;Ha[X+4]=$.g;Ha[X+5]=$.b;Ha[X+6]=aa.r;Ha[X+7]=aa.g;Ha[X+8]=aa.b;X+=9}if(ib&&Ta.hasTangents){Fa=Wa[O.a].tangent;Sa=Wa[O.b].tangent;U=Wa[O.c].tangent;Ba[L]=Fa.x;Ba[L+1]=Fa.y;Ba[L+2]=Fa.z;Ba[L+3]=Fa.w;Ba[L+4]=
@@ -282,7 +282,7 @@ Aa[B]=U.x;Aa[B+1]=U.y;Aa[B+2]=U.z;Aa[B+3]=U.w;Aa[B+4]=$.x;Aa[B+5]=$.y;Aa[B+6]=$.
 Ia[B+2]=U.z;Ia[B+3]=1;Ia[B+4]=$.x;Ia[B+5]=$.y;Ia[B+6]=$.z;Ia[B+7]=1;Ia[B+8]=aa.x;Ia[B+9]=aa.y;Ia[B+10]=aa.z;Ia[B+11]=1;Ia[B+12]=ma.x;Ia[B+13]=ma.y;Ia[B+14]=ma.z;Ia[B+15]=1;B+=16}if(jb&&wa){if(Fa.length==4&&wa==THREE.VertexColors){U=Fa[0];$=Fa[1];aa=Fa[2];Fa=Fa[3]}else Fa=aa=$=U=Sa;Ha[X]=U.r;Ha[X+1]=U.g;Ha[X+2]=U.b;Ha[X+3]=$.r;Ha[X+4]=$.g;Ha[X+5]=$.b;Ha[X+6]=aa.r;Ha[X+7]=aa.g;Ha[X+8]=aa.b;Ha[X+9]=Fa.r;Ha[X+10]=Fa.g;Ha[X+11]=Fa.b;X+=12}if(ib&&Ta.hasTangents){Fa=Wa[O.a].tangent;Sa=Wa[O.b].tangent;U=
 Ia[B+2]=U.z;Ia[B+3]=1;Ia[B+4]=$.x;Ia[B+5]=$.y;Ia[B+6]=$.z;Ia[B+7]=1;Ia[B+8]=aa.x;Ia[B+9]=aa.y;Ia[B+10]=aa.z;Ia[B+11]=1;Ia[B+12]=ma.x;Ia[B+13]=ma.y;Ia[B+14]=ma.z;Ia[B+15]=1;B+=16}if(jb&&wa){if(Fa.length==4&&wa==THREE.VertexColors){U=Fa[0];$=Fa[1];aa=Fa[2];Fa=Fa[3]}else Fa=aa=$=U=Sa;Ha[X]=U.r;Ha[X+1]=U.g;Ha[X+2]=U.b;Ha[X+3]=$.r;Ha[X+4]=$.g;Ha[X+5]=$.b;Ha[X+6]=aa.r;Ha[X+7]=aa.g;Ha[X+8]=aa.b;Ha[X+9]=Fa.r;Ha[X+10]=Fa.g;Ha[X+11]=Fa.b;X+=12}if(ib&&Ta.hasTangents){Fa=Wa[O.a].tangent;Sa=Wa[O.b].tangent;U=
 Wa[O.c].tangent;O=Wa[O.d].tangent;Ba[L]=Fa.x;Ba[L+1]=Fa.y;Ba[L+2]=Fa.z;Ba[L+3]=Fa.w;Ba[L+4]=Sa.x;Ba[L+5]=Sa.y;Ba[L+6]=Sa.z;Ba[L+7]=Sa.w;Ba[L+8]=U.x;Ba[L+9]=U.y;Ba[L+10]=U.z;Ba[L+11]=U.w;Ba[L+12]=O.x;Ba[L+13]=O.y;Ba[L+14]=O.z;Ba[L+15]=O.w;L+=16}if(hb&&M)if(Ga.length==4&&lb)for(O=0;O<4;O++){Oa=Ga[O];La[Qa]=Oa.x;La[Qa+1]=Oa.y;La[Qa+2]=Oa.z;Qa+=3}else for(O=0;O<4;O++){La[Qa]=Oa.x;La[Qa+1]=Oa.y;La[Qa+2]=Oa.z;Qa+=3}if(db&&ca!==undefined&&P)for(O=0;O<4;O++){Ga=ca[O];Na[Ja]=Ga.u;Na[Ja+1]=Ga.v;Ja+=2}if(db&&
 Wa[O.c].tangent;O=Wa[O.d].tangent;Ba[L]=Fa.x;Ba[L+1]=Fa.y;Ba[L+2]=Fa.z;Ba[L+3]=Fa.w;Ba[L+4]=Sa.x;Ba[L+5]=Sa.y;Ba[L+6]=Sa.z;Ba[L+7]=Sa.w;Ba[L+8]=U.x;Ba[L+9]=U.y;Ba[L+10]=U.z;Ba[L+11]=U.w;Ba[L+12]=O.x;Ba[L+13]=O.y;Ba[L+14]=O.z;Ba[L+15]=O.w;L+=16}if(hb&&M)if(Ga.length==4&&lb)for(O=0;O<4;O++){Oa=Ga[O];La[Qa]=Oa.x;La[Qa+1]=Oa.y;La[Qa+2]=Oa.z;Qa+=3}else for(O=0;O<4;O++){La[Qa]=Oa.x;La[Qa+1]=Oa.y;La[Qa+2]=Oa.z;Qa+=3}if(db&&ca!==undefined&&P)for(O=0;O<4;O++){Ga=ca[O];Na[Ja]=Ga.u;Na[Ja+1]=Ga.v;Ja+=2}if(db&&
 ha!==undefined&&P)for(O=0;O<4;O++){Ga=ha[O];Pa[Ra]=Ga.u;Pa[Ra+1]=Ga.v;Ra+=2}if(gb){Ya[Va]=ia;Ya[Va+1]=ia+1;Ya[Va+2]=ia+2;Ya[Va+3]=ia;Ya[Va+4]=ia+2;Ya[Va+5]=ia+3;Va+=6;Ua[ga]=ia;Ua[ga+1]=ia+1;Ua[ga+2]=ia;Ua[ga+3]=ia+3;Ua[ga+4]=ia+1;Ua[ga+5]=ia+2;Ua[ga+6]=ia+2;Ua[ga+7]=ia+3;ga+=8;ia+=4}}}if(fb){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ja,G)}if(kb){Ka=0;for(Xa=Za.length;Ka<Xa;Ka++){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[Ka]);f.bufferData(f.ARRAY_BUFFER,
 ha!==undefined&&P)for(O=0;O<4;O++){Ga=ha[O];Pa[Ra]=Ga.u;Pa[Ra+1]=Ga.v;Ra+=2}if(gb){Ya[Va]=ia;Ya[Va+1]=ia+1;Ya[Va+2]=ia+2;Ya[Va+3]=ia;Ya[Va+4]=ia+2;Ya[Va+5]=ia+3;Va+=6;Ua[ga]=ia;Ua[ga+1]=ia+1;Ua[ga+2]=ia;Ua[ga+3]=ia+3;Ua[ga+4]=ia+1;Ua[ga+5]=ia+2;Ua[ga+6]=ia+2;Ua[ga+7]=ia+3;ga+=8;ia+=4}}}if(fb){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ja,G)}if(kb){Ka=0;for(Xa=Za.length;Ka<Xa;Ka++){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[Ka]);f.bufferData(f.ARRAY_BUFFER,
-eb[Ka],G)}}if(jb&&qb.length){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ha,G)}if(hb){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,La,G)}if(ib&&Ta.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,G)}if(db&&Ja>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Na,G)}if(db&&Ra>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Pa,G)}if(gb){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
+eb[Ka],G)}}if(jb&&X>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ha,G)}if(hb){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,La,G)}if(ib&&Ta.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,G)}if(db&&Ja>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Na,G)}if(db&&Ra>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Pa,G)}if(gb){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
 C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ya,G);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ua,G)}if(B>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Ca,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,Ia,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,Aa,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,
 C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ya,G);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ua,G)}if(B>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Ca,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,Ia,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,Aa,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,
 Da,G)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;E=f.DYNAMIC_DRAW;P=void 0;P=void 0;wa=void 0;C=void 0;M=n.vertices;G=n.colors;ca=M.length;S=G.length;ha=n.__vertexArray;va=n.__colorArray;ia=n.__dirtyColors;if(n.__dirtyVertices){for(P=0;P<ca;P++){wa=M[P].position;C=P*3;ha[C]=wa.x;ha[C+1]=wa.y;ha[C+2]=wa.z}f.bindBuffer(f.ARRAY_BUFFER,
 Da,G)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;E=f.DYNAMIC_DRAW;P=void 0;P=void 0;wa=void 0;C=void 0;M=n.vertices;G=n.colors;ca=M.length;S=G.length;ha=n.__vertexArray;va=n.__colorArray;ia=n.__dirtyColors;if(n.__dirtyVertices){for(P=0;P<ca;P++){wa=M[P].position;C=P*3;ha[C]=wa.x;ha[C+1]=wa.y;ha[C+2]=wa.z}f.bindBuffer(f.ARRAY_BUFFER,
 n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ha,E)}if(ia){for(P=0;P<S;P++){color=G[P];C=P*3;va[C]=color.r;va[C+1]=color.g;va[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,va,E)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Line){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;E=f.DYNAMIC_DRAW;P=void 0;P=void 0;wa=void 0;C=void 0;M=n.vertices;G=n.colors;ca=M.length;S=G.length;ha=n.__vertexArray;va=n.__colorArray;ia=n.__dirtyColors;
 n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ha,E)}if(ia){for(P=0;P<S;P++){color=G[P];C=P*3;va[C]=color.r;va[C+1]=color.g;va[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,va,E)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Line){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;E=f.DYNAMIC_DRAW;P=void 0;P=void 0;wa=void 0;C=void 0;M=n.vertices;G=n.colors;ca=M.length;S=G.length;ha=n.__vertexArray;va=n.__colorArray;ia=n.__dirtyColors;
@@ -357,29 +357,30 @@ a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;e=j(k,h,this.q,th
 o,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
 o,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
 THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
 THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
 c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var o=new Image;o.onload=function(){if(!b(this.width)||!b(this.height)){var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
 c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var o=new Image;o.onload=function(){if(!b(this.width)||!b(this.height)){var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
-j.image.width=t;j.image.height=x;j.image.getContext("2d").drawImage(this,0,0,t,x)}else j.image=this;j.needsUpdate=!0};o.src=k}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
-255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+j.image.width=t;j.image.height=x;j.image.getContext("2d").drawImage(this,0,0,t,x)}else j.image=this;j.needsUpdate=!0};o.src=k}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*
+255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
+THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.JSONLoader.prototype.createModel(e.data,b,d)};c.postMessage(a)},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
 THREE.JSONLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.JSONLoader.prototype.createModel(e.data,b,d)};c.postMessage(a)},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
-else{var h,j,k,o,t,x,y,q,A,H,J=a.faces;q=a.vertices;var F=a.normals,K=0;for(h=0;h<a.uvs.length;h++)a.uvs[h].length&&K++;for(h=0;h<K;h++){g.faceUvs[h]=[];g.faceVertexUvs[h]=[]}k=0;for(o=q.length;k<o;){A=new THREE.Vertex;A.position.x=q[k++];A.position.y=q[k++];A.position.z=q[k++];g.vertices.push(A)}k=0;for(o=J.length;k<o;){t=J[k++];x=t&1;h=t&2;y=t&4;j=t&8;q=t&16;A=t&32;H=t&64;t&=128;if(x){x=new THREE.Face4;x.a=J[k++];x.b=J[k++];x.c=J[k++];x.d=J[k++];nVertices=4}else{x=new THREE.Face3;x.a=J[k++];x.b=
-J[k++];x.c=J[k++];nVertices=3}if(h){materialIndex=J[k++];x.materials=g.materials[materialIndex]}if(y)for(h=0;h<K;h++){uvLayer=a.uvs[h];uvIndex=J[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];g.faceUvs[h].push(new THREE.UV(u,v))}if(j)for(h=0;h<K;h++){uvLayer=a.uvs[h];uvs=[];for(j=0;j<nVertices;j++){uvIndex=J[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[j]=new THREE.UV(u,v)}g.faceVertexUvs[h].push(uvs)}if(q){normalIndex=J[k++]*3;normal=new THREE.Vector3;normal.x=F[normalIndex++];normal.y=
-F[normalIndex++];normal.z=F[normalIndex];x.normal=normal}if(A)for(h=0;h<nVertices;h++){normalIndex=J[k++]*3;normal=new THREE.Vector3;normal.x=F[normalIndex++];normal.y=F[normalIndex++];normal.z=F[normalIndex];x.vertexNormals.push(normal)}if(H){color=new THREE.Color(J[k++]);x.color=color}if(t)for(h=0;h<nVertices;h++){color=new THREE.Color(J[k++]);x.vertexColors.push(color)}g.faces.push(x)}}})();(function(){var h,j,k,o;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<j;h+=2){k=a.skinWeights[h];o=
-a.skinWeights[h+1];g.skinWeights.push(new THREE.Vector4(k,o,0,0))}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];o=a.skinIndices[h+1];g.skinIndices.push(new THREE.Vector4(k,o,0,0))}}g.bones=a.bones;g.animation=a.animation})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;
+else{var h,j,k,o,t,x,y,q,A,H,J=a.faces;q=a.vertices;var F=a.normals,K=a.colors,z=0;for(h=0;h<a.uvs.length;h++)a.uvs[h].length&&z++;for(h=0;h<z;h++){g.faceUvs[h]=[];g.faceVertexUvs[h]=[]}k=0;for(o=q.length;k<o;){A=new THREE.Vertex;A.position.x=q[k++];A.position.y=q[k++];A.position.z=q[k++];g.vertices.push(A)}k=0;for(o=J.length;k<o;){t=J[k++];x=t&1;h=t&2;y=t&4;j=t&8;q=t&16;A=t&32;H=t&64;t&=128;if(x){x=new THREE.Face4;x.a=J[k++];x.b=J[k++];x.c=J[k++];x.d=J[k++];nVertices=4}else{x=new THREE.Face3;x.a=
+J[k++];x.b=J[k++];x.c=J[k++];nVertices=3}if(h){materialIndex=J[k++];x.materials=g.materials[materialIndex]}if(y)for(h=0;h<z;h++){uvLayer=a.uvs[h];uvIndex=J[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];g.faceUvs[h].push(new THREE.UV(u,v))}if(j)for(h=0;h<z;h++){uvLayer=a.uvs[h];uvs=[];for(j=0;j<nVertices;j++){uvIndex=J[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[j]=new THREE.UV(u,v)}g.faceVertexUvs[h].push(uvs)}if(q){normalIndex=J[k++]*3;normal=new THREE.Vector3;normal.x=F[normalIndex++];
+normal.y=F[normalIndex++];normal.z=F[normalIndex];x.normal=normal}if(A)for(h=0;h<nVertices;h++){normalIndex=J[k++]*3;normal=new THREE.Vector3;normal.x=F[normalIndex++];normal.y=F[normalIndex++];normal.z=F[normalIndex];x.vertexNormals.push(normal)}if(H){color=new THREE.Color(J[k++]);x.color=color}if(t)for(h=0;h<nVertices;h++){colorIndex=J[k++];color=new THREE.Color(K[colorIndex]);x.vertexColors.push(color)}g.faces.push(x)}}})();(function(){var h,j,k,o;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<
+j;h+=2){k=a.skinWeights[h];o=a.skinWeights[h+1];g.skinWeights.push(new THREE.Vector4(k,o,0,0))}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];o=a.skinIndices[h+1];g.skinIndices.push(new THREE.Vector4(k,o,0,0))}}g.bones=a.bones;g.animation=a.animation})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;
 THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
 THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
 c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
 c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
 h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,d){var e=function(g){function h(p,n){var w=t(p,n),E=t(p,n+1),C=t(p,n+2),G=t(p,n+3),S=(G<<1&255|C>>7)-127;w|=(C&127)<<16|E<<8;if(w==0&&S==-127)return 0;return(1-2*(G>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,S)}function j(p,n){var w=t(p,n),E=t(p,n+1),C=t(p,n+2);return(t(p,n+3)<<24)+(C<<16)+(E<<8)+w}function k(p,n){var w=t(p,n);return(t(p,n+1)<<8)+w}function o(p,n){var w=t(p,n);return w>127?w-256:w}function t(p,
 h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,d){var e=function(g){function h(p,n){var w=t(p,n),E=t(p,n+1),C=t(p,n+2),G=t(p,n+3),S=(G<<1&255|C>>7)-127;w|=(C&127)<<16|E<<8;if(w==0&&S==-127)return 0;return(1-2*(G>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,S)}function j(p,n){var w=t(p,n),E=t(p,n+1),C=t(p,n+2);return(t(p,n+3)<<24)+(C<<16)+(E<<8)+w}function k(p,n){var w=t(p,n);return(t(p,n+1)<<8)+w}function o(p,n){var w=t(p,n);return w>127?w-256:w}function t(p,
 n){return p.charCodeAt(n)&255}function x(p){var n,w,E;n=j(a,p);w=j(a,p+Z);E=j(a,p+V);p=k(a,p+f);THREE.BinaryLoader.prototype.f3(F,n,w,E,p)}function y(p){var n,w,E,C,G,S;n=j(a,p);w=j(a,p+Z);E=j(a,p+V);C=k(a,p+f);G=j(a,p+fa);S=j(a,p+R);p=j(a,p+W);THREE.BinaryLoader.prototype.f3n(F,I,n,w,E,C,G,S,p)}function q(p){var n,w,E,C;n=j(a,p);w=j(a,p+na);E=j(a,p+N);C=j(a,p+xa);p=k(a,p+ta);THREE.BinaryLoader.prototype.f4(F,n,w,E,C,p)}function A(p){var n,w,E,C,G,S,P,M;n=j(a,p);w=j(a,p+na);E=j(a,p+N);C=j(a,p+xa);
 n){return p.charCodeAt(n)&255}function x(p){var n,w,E;n=j(a,p);w=j(a,p+Z);E=j(a,p+V);p=k(a,p+f);THREE.BinaryLoader.prototype.f3(F,n,w,E,p)}function y(p){var n,w,E,C,G,S;n=j(a,p);w=j(a,p+Z);E=j(a,p+V);C=k(a,p+f);G=j(a,p+fa);S=j(a,p+R);p=j(a,p+W);THREE.BinaryLoader.prototype.f3n(F,I,n,w,E,C,G,S,p)}function q(p){var n,w,E,C;n=j(a,p);w=j(a,p+na);E=j(a,p+N);C=j(a,p+xa);p=k(a,p+ta);THREE.BinaryLoader.prototype.f4(F,n,w,E,C,p)}function A(p){var n,w,E,C,G,S,P,M;n=j(a,p);w=j(a,p+na);E=j(a,p+N);C=j(a,p+xa);
-G=k(a,p+ta);S=j(a,p+qa);P=j(a,p+ua);M=j(a,p+la);p=j(a,p+ka);THREE.BinaryLoader.prototype.f4n(F,I,n,w,E,C,G,S,P,M,p)}function H(p){var n,w;n=j(a,p);w=j(a,p+oa);p=j(a,p+pa);THREE.BinaryLoader.prototype.uv3(F.uvs,Q[n*2],Q[n*2+1],Q[w*2],Q[w*2+1],Q[p*2],Q[p*2+1])}function J(p){var n,w,E;n=j(a,p);w=j(a,p+ea);E=j(a,p+da);p=j(a,p+sa);THREE.BinaryLoader.prototype.uv4(F.uvs,Q[n*2],Q[n*2+1],Q[w*2],Q[w*2+1],Q[E*2],Q[E*2+1],Q[p*2],Q[p*2+1])}var F=this,K=0,z,I=[],Q=[],Z,V,f,fa,R,W,na,N,xa,ta,qa,ua,la,ka,oa,pa,
-ea,da,sa,Ea,Y,ya,za,m,D;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,d,g);z={signature:a.substr(K,8),header_bytes:t(a,K+8),vertex_coordinate_bytes:t(a,K+9),normal_coordinate_bytes:t(a,K+10),uv_coordinate_bytes:t(a,K+11),vertex_index_bytes:t(a,K+12),normal_index_bytes:t(a,K+13),uv_index_bytes:t(a,K+14),material_index_bytes:t(a,K+15),nvertices:j(a,K+16),nnormals:j(a,K+16+4),nuvs:j(a,K+16+8),ntri_flat:j(a,K+16+12),ntri_smooth:j(a,K+16+16),ntri_flat_uv:j(a,K+16+20),ntri_smooth_uv:j(a,
-K+16+24),nquad_flat:j(a,K+16+28),nquad_smooth:j(a,K+16+32),nquad_flat_uv:j(a,K+16+36),nquad_smooth_uv:j(a,K+16+40)};K+=z.header_bytes;Z=z.vertex_index_bytes;V=z.vertex_index_bytes*2;f=z.vertex_index_bytes*3;fa=z.vertex_index_bytes*3+z.material_index_bytes;R=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;W=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;na=z.vertex_index_bytes;N=z.vertex_index_bytes*2;xa=z.vertex_index_bytes*3;ta=z.vertex_index_bytes*4;qa=z.vertex_index_bytes*
-4+z.material_index_bytes;ua=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;la=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;ka=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;oa=z.uv_index_bytes;pa=z.uv_index_bytes*2;ea=z.uv_index_bytes;da=z.uv_index_bytes*2;sa=z.uv_index_bytes*3;g=z.vertex_index_bytes*3+z.material_index_bytes;D=z.vertex_index_bytes*4+z.material_index_bytes;Ea=z.ntri_flat*g;Y=z.ntri_smooth*(g+z.normal_index_bytes*3);
-ya=z.ntri_flat_uv*(g+z.uv_index_bytes*3);za=z.ntri_smooth_uv*(g+z.normal_index_bytes*3+z.uv_index_bytes*3);m=z.nquad_flat*D;g=z.nquad_smooth*(D+z.normal_index_bytes*4);D=z.nquad_flat_uv*(D+z.uv_index_bytes*4);K+=function(p){for(var n,w,E,C=z.vertex_coordinate_bytes*3,G=p+z.nvertices*C;p<G;p+=C){n=h(a,p);w=h(a,p+z.vertex_coordinate_bytes);E=h(a,p+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(F,n,w,E)}return z.nvertices*C}(K);K+=function(p){for(var n,w,E,C=z.normal_coordinate_bytes*3,
-G=p+z.nnormals*C;p<G;p+=C){n=o(a,p);w=o(a,p+z.normal_coordinate_bytes);E=o(a,p+z.normal_coordinate_bytes*2);I.push(n/127,w/127,E/127)}return z.nnormals*C}(K);K+=function(p){for(var n,w,E=z.uv_coordinate_bytes*2,C=p+z.nuvs*E;p<C;p+=E){n=h(a,p);w=h(a,p+z.uv_coordinate_bytes);Q.push(n,w)}return z.nuvs*E}(K);Ea=K+Ea;Y=Ea+Y;ya=Y+ya;za=ya+za;m=za+m;g=m+g;D=g+D;(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes,E=w+z.uv_index_bytes*3,C=p+z.ntri_flat_uv*E;for(n=p;n<C;n+=E){x(n);H(n+w)}return C-
-p})(Y);(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,E=w+z.uv_index_bytes*3,C=p+z.ntri_smooth_uv*E;for(n=p;n<C;n+=E){y(n);H(n+w)}return C-p})(ya);(function(p){var n,w=z.vertex_index_bytes*4+z.material_index_bytes,E=w+z.uv_index_bytes*4,C=p+z.nquad_flat_uv*E;for(n=p;n<C;n+=E){q(n);J(n+w)}return C-p})(g);(function(p){var n,w=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,E=w+z.uv_index_bytes*4,C=p+z.nquad_smooth_uv*E;for(n=p;n<C;n+=E){A(n);
-J(n+w)}return C-p})(D);(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes,E=p+z.ntri_flat*w;for(n=p;n<E;n+=w)x(n);return E-p})(K);(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,E=p+z.ntri_smooth*w;for(n=p;n<E;n+=w)y(n);return E-p})(Ea);(function(p){var n,w=z.vertex_index_bytes*4+z.material_index_bytes,E=p+z.nquad_flat*w;for(n=p;n<E;n+=w)q(n);return E-p})(za);(function(p){var n,w=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*
-4,E=p+z.nquad_smooth*w;for(n=p;n<E;n+=w)A(n);return E-p})(m);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,null,a.materials[g]))},f3n:function(a,c,b,d,e,g,h,j,k){g=a.materials[g];var o=c[j*3],
-t=c[j*3+1];j=c[j*3+2];var x=c[k*3],y=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(o,t,j),new THREE.Vector3(x,y,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,o,t){h=a.materials[h];var x=c[k*3],y=c[k*3+1];k=c[k*3+2];var q=c[o*3],A=c[o*3+1];o=c[o*3+2];var H=c[t*3],J=c[t*3+1];t=c[t*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(x,y,k),new THREE.Vector3(q,A,o),new THREE.Vector3(H,
-J,t)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var o=[];o.push(new THREE.UV(c,b));o.push(new THREE.UV(d,e));o.push(new THREE.UV(g,h));o.push(new THREE.UV(j,k));a.push(o)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+G=k(a,p+ta);S=j(a,p+qa);P=j(a,p+ua);M=j(a,p+la);p=j(a,p+ka);THREE.BinaryLoader.prototype.f4n(F,I,n,w,E,C,G,S,P,M,p)}function H(p){var n,w;n=j(a,p);w=j(a,p+oa);p=j(a,p+pa);THREE.BinaryLoader.prototype.uv3(F.faceVertexUvs[0],Q[n*2],Q[n*2+1],Q[w*2],Q[w*2+1],Q[p*2],Q[p*2+1])}function J(p){var n,w,E;n=j(a,p);w=j(a,p+ea);E=j(a,p+da);p=j(a,p+sa);THREE.BinaryLoader.prototype.uv4(F.faceVertexUvs[0],Q[n*2],Q[n*2+1],Q[w*2],Q[w*2+1],Q[E*2],Q[E*2+1],Q[p*2],Q[p*2+1])}var F=this,K=0,z,I=[],Q=[],Z,V,f,fa,R,W,na,
+N,xa,ta,qa,ua,la,ka,oa,pa,ea,da,sa,Ea,Y,ya,za,m,D;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,d,g);z={signature:a.substr(K,8),header_bytes:t(a,K+8),vertex_coordinate_bytes:t(a,K+9),normal_coordinate_bytes:t(a,K+10),uv_coordinate_bytes:t(a,K+11),vertex_index_bytes:t(a,K+12),normal_index_bytes:t(a,K+13),uv_index_bytes:t(a,K+14),material_index_bytes:t(a,K+15),nvertices:j(a,K+16),nnormals:j(a,K+16+4),nuvs:j(a,K+16+8),ntri_flat:j(a,K+16+12),ntri_smooth:j(a,K+16+16),ntri_flat_uv:j(a,
+K+16+20),ntri_smooth_uv:j(a,K+16+24),nquad_flat:j(a,K+16+28),nquad_smooth:j(a,K+16+32),nquad_flat_uv:j(a,K+16+36),nquad_smooth_uv:j(a,K+16+40)};K+=z.header_bytes;Z=z.vertex_index_bytes;V=z.vertex_index_bytes*2;f=z.vertex_index_bytes*3;fa=z.vertex_index_bytes*3+z.material_index_bytes;R=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;W=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;na=z.vertex_index_bytes;N=z.vertex_index_bytes*2;xa=z.vertex_index_bytes*3;ta=
+z.vertex_index_bytes*4;qa=z.vertex_index_bytes*4+z.material_index_bytes;ua=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;la=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;ka=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;oa=z.uv_index_bytes;pa=z.uv_index_bytes*2;ea=z.uv_index_bytes;da=z.uv_index_bytes*2;sa=z.uv_index_bytes*3;g=z.vertex_index_bytes*3+z.material_index_bytes;D=z.vertex_index_bytes*4+z.material_index_bytes;Ea=z.ntri_flat*
+g;Y=z.ntri_smooth*(g+z.normal_index_bytes*3);ya=z.ntri_flat_uv*(g+z.uv_index_bytes*3);za=z.ntri_smooth_uv*(g+z.normal_index_bytes*3+z.uv_index_bytes*3);m=z.nquad_flat*D;g=z.nquad_smooth*(D+z.normal_index_bytes*4);D=z.nquad_flat_uv*(D+z.uv_index_bytes*4);K+=function(p){for(var n,w,E,C=z.vertex_coordinate_bytes*3,G=p+z.nvertices*C;p<G;p+=C){n=h(a,p);w=h(a,p+z.vertex_coordinate_bytes);E=h(a,p+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(F,n,w,E)}return z.nvertices*C}(K);K+=function(p){for(var n,
+w,E,C=z.normal_coordinate_bytes*3,G=p+z.nnormals*C;p<G;p+=C){n=o(a,p);w=o(a,p+z.normal_coordinate_bytes);E=o(a,p+z.normal_coordinate_bytes*2);I.push(n/127,w/127,E/127)}return z.nnormals*C}(K);K+=function(p){for(var n,w,E=z.uv_coordinate_bytes*2,C=p+z.nuvs*E;p<C;p+=E){n=h(a,p);w=h(a,p+z.uv_coordinate_bytes);Q.push(n,w)}return z.nuvs*E}(K);Ea=K+Ea;Y=Ea+Y;ya=Y+ya;za=ya+za;m=za+m;g=m+g;D=g+D;(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes,E=w+z.uv_index_bytes*3,C=p+z.ntri_flat_uv*E;
+for(n=p;n<C;n+=E){x(n);H(n+w)}return C-p})(Y);(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,E=w+z.uv_index_bytes*3,C=p+z.ntri_smooth_uv*E;for(n=p;n<C;n+=E){y(n);H(n+w)}return C-p})(ya);(function(p){var n,w=z.vertex_index_bytes*4+z.material_index_bytes,E=w+z.uv_index_bytes*4,C=p+z.nquad_flat_uv*E;for(n=p;n<C;n+=E){q(n);J(n+w)}return C-p})(g);(function(p){var n,w=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,E=w+z.uv_index_bytes*4,C=
+p+z.nquad_smooth_uv*E;for(n=p;n<C;n+=E){A(n);J(n+w)}return C-p})(D);(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes,E=p+z.ntri_flat*w;for(n=p;n<E;n+=w)x(n);return E-p})(K);(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,E=p+z.ntri_smooth*w;for(n=p;n<E;n+=w)y(n);return E-p})(Ea);(function(p){var n,w=z.vertex_index_bytes*4+z.material_index_bytes,E=p+z.nquad_flat*w;for(n=p;n<E;n+=w)q(n);return E-p})(za);(function(p){var n,w=z.vertex_index_bytes*
+4+z.material_index_bytes+z.normal_index_bytes*4,E=p+z.nquad_smooth*w;for(n=p;n<E;n+=w)A(n);return E-p})(m);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,null,a.materials[g]))},f3n:function(a,c,
+b,d,e,g,h,j,k){g=a.materials[g];var o=c[j*3],t=c[j*3+1];j=c[j*3+2];var x=c[k*3],y=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(o,t,j),new THREE.Vector3(x,y,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,o,t){h=a.materials[h];var x=c[k*3],y=c[k*3+1];k=c[k*3+2];var q=c[o*3],A=c[o*3+1];o=c[o*3+2];var H=c[t*3],J=c[t*3+1];t=c[t*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(x,y,k),
+new THREE.Vector3(q,A,o),new THREE.Vector3(H,J,t)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var o=[];o.push(new THREE.UV(c,b));o.push(new THREE.UV(d,e));o.push(new THREE.UV(g,h));o.push(new THREE.UV(j,k));a.push(o)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,o,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=o;e[g]=this.lerp(t[b],t[b+3],h);e[g+1]=this.lerp(t[b+1],t[b+4],h);e[g+2]=this.lerp(t[b+2],t[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,o,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,o,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=o;e[g]=this.lerp(t[b],t[b+3],h);e[g+1]=this.lerp(t[b+1],t[b+4],h);e[g+2]=this.lerp(t[b+2],t[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,o,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
 2]=o;d=b+this.yd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,o,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=o+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
 2]=o;d=b+this.yd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,o,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=o+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-

+ 75 - 77
build/custom/ThreeCanvas.js

@@ -1,6 +1,6 @@
 // ThreeCanvas.js r36 - http://github.com/mrdoob/three.js
 // ThreeCanvas.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,g,i,h;if(c==0)d=e=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:d=h;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=h;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=h;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,g,j,h;if(c==0)d=e=f=0;else{g=Math.floor(a*6);j=a*6-g;a=c*(1-b);h=c*(1-b*j);b=c*(1-b*(1-j));switch(g){case 1:d=h;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=h;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=h;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
@@ -12,72 +12,71 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(s,k,G,F){F=F.clone().subSelf(k);G=G.clone().subSelf(k);var K=s.clone().subSelf(k);s=F.dot(F);k=F.dot(G);F=F.dot(K);var I=G.dot(G);G=G.dot(K);K=1/(s*I-k*k);I=(I*F-k*G)*K;s=(s*G-k*F)*K;return I>0&&s>0&&I+s<1}var c,d,e,f,g,i,h,j,o,n,
-p,m=a.geometry,v=m.vertices,t=[];c=0;for(d=m.faces.length;c<d;c++){e=m.faces[c];n=this.origin.clone();p=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(v[e.a].position.clone());g=h.multiplyVector3(v[e.b].position.clone());i=h.multiplyVector3(v[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(v[e.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(e.normal.clone());o=p.dot(j);if(o<0){j=j.dot((new THREE.Vector3).sub(f,n))/o;n=n.addSelf(p.multiplyScalar(j));
-if(e instanceof THREE.Face3){if(b(n,f,g,i)){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};t.push(e)}}else if(e instanceof THREE.Face4&&(b(n,f,g,h)||b(n,g,i,h))){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};t.push(e)}}}return t}};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,j,o,n){i=!1;b=h;c=j;d=o;e=n;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;d=h;e=j}else{b=b<h?b:h;c=c<j?c:j;d=d>h?d:h;e=e>j?e:j}a()};
-this.add3Points=function(h,j,o,n,p,m){if(i){i=!1;b=h<o?h<p?h:p:o<p?o:p;c=j<n?j<m?j:m:n<m?n:m;d=h>o?h>p?h:p:o>p?o:p;e=j>n?j>m?j:m:n>m?n:m}else{b=h<o?h<p?h<b?h:b:p<b?p:b:o<p?o<b?o:b:p<b?p:b;c=j<n?j<m?j<c?j:c:m<c?m:c:n<m?n<c?n:c:m<c?m:c;d=h>o?h>p?h>d?h:d:p>d?p:d:o>p?o>d?o:d:p>d?p:d;e=j>n?j>m?j>e?j:e:m>e?m:e:n>m?n>e?n:e:m>e?m:e}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
-d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(y,u,B,z){z=z.clone().subSelf(u);B=B.clone().subSelf(u);var o=y.clone().subSelf(u);y=z.dot(z);u=z.dot(B);z=z.dot(o);var H=B.dot(B);B=B.dot(o);o=1/(y*H-u*u);H=(H*z-u*B)*o;y=(y*B-u*z)*o;return H>0&&y>0&&H+y<1}var c,d,e,f,g,j,h,i,n,m,
+q,l=a.geometry,v=l.vertices,r=[];c=0;for(d=l.faces.length;c<d;c++){e=l.faces[c];m=this.origin.clone();q=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(v[e.a].position.clone());g=h.multiplyVector3(v[e.b].position.clone());j=h.multiplyVector3(v[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(v[e.d].position.clone()):null;i=a.matrixRotationWorld.multiplyVector3(e.normal.clone());n=q.dot(i);if(n<0){i=i.dot((new THREE.Vector3).sub(f,m))/n;m=m.addSelf(q.multiplyScalar(i));
+if(e instanceof THREE.Face3){if(b(m,f,g,j)){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};r.push(e)}}else if(e instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,j,h))){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};r.push(e)}}}return r}};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,i,n,m){j=!1;b=h;c=i;d=n;e=m;a()};this.addPoint=function(h,i){if(j){j=!1;b=h;c=i;d=h;e=i}else{b=b<h?b:h;c=c<i?c:i;d=d>h?d:h;e=e>i?e:i}a()};
+this.add3Points=function(h,i,n,m,q,l){if(j){j=!1;b=h<n?h<q?h:q:n<q?n:q;c=i<m?i<l?i:l:m<l?m:l;d=h>n?h>q?h:q:n>q?n:q;e=i>m?i>l?i:l:m>l?m:l}else{b=h<n?h<q?h<b?h:b:q<b?q:b:n<q?n<b?n:b:q<b?q:b;c=i<m?i<l?i<c?i:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c;d=h>n?h>q?h>d?h:d:q>d?q:d:n>q?n>d?n:d:q>d?q:d;e=i>m?i>l?i>e?i:e:l>e?l:e:m>l?m>e?m:e:l>e?l:e}a()};this.addRectangle=function(h){if(j){j=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
+d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){j=!0;e=d=c=b=0;a()};this.isEmpty=function(){return j}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,f,g,i,h,j,o,n,p,m,v,t){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,i||0,h||0,j||0,o||1,n||0,p||0,m||0,v||0,t||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,i,h,j,o,n,p,m,v,t){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=o;this.n34=n;this.n41=p;this.n42=m;this.n43=v;this.n44=t;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,d,e,f,g,j,h,i,n,m,q,l,v,r){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,j||0,h||0,i||0,n||1,m||0,q||0,l||0,v||0,r||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,j,h,i,n,m,q,l,v,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=j;this.n31=h;this.n32=i;this.n33=n;this.n34=m;this.n41=q;this.n42=l;this.n43=v;this.n44=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
 e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();if(d.length()===0){f.x+=1.0E-4;d.cross(c,f).normalize()}e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
 e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();if(d.length()===0){f.x+=1.0E-4;d.cross(c,f).normalize()}e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
 d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
 d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,n=a.n32,p=a.n33,m=a.n34,v=a.n41,t=a.n42,s=a.n43,k=a.n44,G=b.n11,F=b.n12,K=b.n13,I=b.n14,S=b.n21,C=b.n22,
-A=b.n23,L=b.n24,y=b.n31,M=b.n32,D=b.n33,x=b.n34;this.n11=c*G+d*S+e*y;this.n12=c*F+d*C+e*M;this.n13=c*K+d*A+e*D;this.n14=c*I+d*L+e*x+f;this.n21=g*G+i*S+h*y;this.n22=g*F+i*C+h*M;this.n23=g*K+i*A+h*D;this.n24=g*I+i*L+h*x+j;this.n31=o*G+n*S+p*y;this.n32=o*F+n*C+p*M;this.n33=o*K+n*A+p*D;this.n34=o*I+n*L+p*x+m;this.n41=v*G+t*S+s*y;this.n42=v*F+t*C+s*M;this.n43=v*K+t*A+s*D;this.n44=v*I+t*L+s*x+k;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,n=a.n31,m=a.n32,q=a.n33,l=a.n34,v=a.n41,r=a.n42,y=a.n43,u=a.n44,B=b.n11,z=b.n12,o=b.n13,H=b.n14,I=b.n21,N=b.n22,
+O=b.n23,U=b.n24,s=b.n31,x=b.n32,E=b.n33,C=b.n34;this.n11=c*B+d*I+e*s;this.n12=c*z+d*N+e*x;this.n13=c*o+d*O+e*E;this.n14=c*H+d*U+e*C+f;this.n21=g*B+j*I+h*s;this.n22=g*z+j*N+h*x;this.n23=g*o+j*O+h*E;this.n24=g*H+j*U+h*C+i;this.n31=n*B+m*I+q*s;this.n32=n*z+m*N+q*x;this.n33=n*o+m*O+q*E;this.n34=n*H+m*U+q*C+l;this.n41=v*B+r*I+y*s;this.n42=v*z+r*N+y*x;this.n43=v*o+r*O+y*E;this.n44=v*H+r*U+y*C+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,o=this.n33,n=this.n34,p=this.n41,m=this.n42,v=this.n43,t=this.n44;return d*g*j*p-c*i*j*p-d*f*o*p+b*i*o*p+c*f*n*p-b*g*n*p-d*g*h*m+c*i*h*m+d*e*o*m-a*i*o*m-c*e*n*m+a*g*n*m+d*f*h*v-b*i*h*v-d*e*j*v+a*i*j*v+b*e*n*v-a*f*n*v-c*f*h*t+b*g*h*t+c*e*j*t-a*g*j*t-b*e*o*t+a*f*o*t},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,j=this.n24,h=this.n31,i=this.n32,n=this.n33,m=this.n34,q=this.n41,l=this.n42,v=this.n43,r=this.n44;return d*g*i*q-c*j*i*q-d*f*n*q+b*j*n*q+c*f*m*q-b*g*m*q-d*g*h*l+c*j*h*l+d*e*n*l-a*j*n*l-c*e*m*l+a*g*m*l+d*f*h*v-b*j*h*v-d*e*i*v+a*j*i*v+b*e*m*v-a*f*m*v-c*f*h*r+b*g*h*r+c*e*i*r-a*g*i*r-b*e*n*r+a*f*n*r},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,j=e*g;this.set(h*
-f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,j*g+c,j*i-d*f,0,h*i-d*g,j*i+d*f,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(j+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,j=a.z,h=e*f,i=e*g;this.set(h*
+f+c,h*g-d*j,h*j+d*g,0,h*g+d*j,i*g+c,i*j-d*f,0,h*j-d*g,i*j+d*f,e*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,j=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=j*f+a*d;this.n22=-j*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
+a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,j=d+d;a=b*f;var h=b*g;b*=j;var i=c*g;c*=j;d*=j;f*=e;g*=e;e*=j;this.n11=1-(i+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
 a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,n=a.n32,p=a.n33,m=a.n34,v=a.n41,t=a.n42,s=a.n43,k=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*m*t-j*p*t+j*n*s-i*m*s-h*n*k+i*p*k;b.n12=f*p*t-e*m*t-f*n*s+d*m*s+e*n*k-d*p*k;b.n13=e*j*t-f*h*t+f*i*s-d*j*s-e*i*k+d*h*k;b.n14=f*h*n-e*j*n-f*i*p+d*j*p+e*i*m-d*h*m;b.n21=j*p*v-h*m*v-j*o*s+g*m*s+h*o*k-g*p*k;b.n22=e*m*v-f*p*v+f*o*s-c*m*s-e*o*k+c*p*k;b.n23=f*h*v-e*j*v-f*g*s+c*j*s+e*g*k-c*h*k;
-b.n24=e*j*o-f*h*o+f*g*p-c*j*p-e*g*m+c*h*m;b.n31=i*m*v-j*n*v+j*o*t-g*m*t-i*o*k+g*n*k;b.n32=f*n*v-d*m*v-f*o*t+c*m*t+d*o*k-c*n*k;b.n33=e*j*v-f*i*v+f*g*t-c*j*t-d*g*k+c*i*k;b.n34=f*i*o-d*j*o-f*g*n+c*j*n+d*g*m-c*i*m;b.n41=h*n*v-i*p*v-h*o*t+g*p*t+i*o*s-g*n*s;b.n42=d*p*v-e*n*v+e*o*t-c*p*t-d*o*s+c*n*s;b.n43=e*i*v-d*h*v-e*g*t+c*h*t+d*g*s-c*i*s;b.n44=d*h*o-e*i*o+e*g*n-c*h*n-d*g*p+c*i*p;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*o;c[8]=a*n;return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,n=a.n31,m=a.n32,q=a.n33,l=a.n34,v=a.n41,r=a.n42,y=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*l*r-i*q*r+i*m*y-j*l*y-h*m*u+j*q*u;b.n12=f*q*r-e*l*r-f*m*y+d*l*y+e*m*u-d*q*u;b.n13=e*i*r-f*h*r+f*j*y-d*i*y-e*j*u+d*h*u;b.n14=f*h*m-e*i*m-f*j*q+d*i*q+e*j*l-d*h*l;b.n21=i*q*v-h*l*v-i*n*y+g*l*y+h*n*u-g*q*u;b.n22=e*l*v-f*q*v+f*n*y-c*l*y-e*n*u+c*q*u;b.n23=f*h*v-e*i*v-f*g*y+c*i*y+e*g*u-c*h*u;
+b.n24=e*i*n-f*h*n+f*g*q-c*i*q-e*g*l+c*h*l;b.n31=j*l*v-i*m*v+i*n*r-g*l*r-j*n*u+g*m*u;b.n32=f*m*v-d*l*v-f*n*r+c*l*r+d*n*u-c*m*u;b.n33=e*i*v-f*j*v+f*g*r-c*i*r-d*g*u+c*j*u;b.n34=f*j*n-d*i*n-f*g*m+c*i*m+d*g*l-c*j*l;b.n41=h*m*v-j*q*v-h*n*r+g*q*r+j*n*y-g*m*y;b.n42=d*q*v-e*m*v+e*n*r-c*q*r-d*n*y+c*m*y;b.n43=e*j*v-d*h*v-e*g*r+c*h*r+d*g*y-c*j*y;b.n44=d*h*n-e*j*n+e*g*m-c*h*m-d*g*q+c*j*q;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*j;c[5]=a*h;c[6]=a*i;c[7]=a*n;c[8]=a*m;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-d;j=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,j,h,i;g=new THREE.Matrix4;j=b-a;h=c-d;i=f-e;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((b+a)/j);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={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(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 THREE.Object3D.prototype={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(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
 b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
 b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
-THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*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*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;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,i=this.z,h=this.w,j=h*c+g*e-i*d,o=h*d+i*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+o*-i-n*-g;b.y=o*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-o*-f;return b}};
-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(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
-THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
+THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=d*e;this.w=g*f-j*c;this.x=g*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*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*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;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,j=this.z,h=this.w,i=h*c+g*e-j*d,n=h*d+j*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+n*-j-m*-g;b.y=n*h+c*-g+m*-f-i*-j;b.z=m*h+c*-j+i*-g-n*-f;return b}};
+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(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 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.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 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.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 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.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
 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.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
-THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[];this.faceVertexUvs=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={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].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 THREE.Geometry.prototype={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].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,i=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,
-c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
-new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(x,z,W,w,O,Y,H){f=x.vertices[z].position;g=x.vertices[W].position;i=x.vertices[w].position;h=e[O];j=e[Y];o=e[H];n=g.x-f.x;p=i.x-f.x;m=g.y-f.y;v=i.y-f.y;
-t=g.z-f.z;s=i.z-f.z;k=j.u-h.u;G=o.u-h.u;F=j.v-h.v;K=o.v-h.v;I=1/(k*K-G*F);A.set((K*n-F*p)*I,(K*m-F*v)*I,(K*t-F*s)*I);L.set((k*p-G*n)*I,(k*v-G*m)*I,(k*s-G*t)*I);S[z].addSelf(A);S[W].addSelf(A);S[w].addSelf(A);C[z].addSelf(L);C[W].addSelf(L);C[w].addSelf(L)}var b,c,d,e,f,g,i,h,j,o,n,p,m,v,t,s,k,G,F,K,I,S=[],C=[],A=new THREE.Vector3,L=new THREE.Vector3,y=new THREE.Vector3,M=new THREE.Vector3,D=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){S[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;
-for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.faceVertexUvs[b][0];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){D.copy(this.vertices[b].normal);d=S[b];y.copy(d);y.subSelf(D.multiplyScalar(D.dot(d))).normalize();M.cross(this.vertices[b].normal,d);d=M.dot(C[b]);d=d<0?-1:1;this.vertices[b].tangent.set(y.x,y.y,y.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
-z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
-this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,j=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){j.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)j.addSelf(f.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];j.sub(g.position,c.position);h.sub(b.position,c.position);j.crossSelf(h)}j.isZero()||
+j.normalize();f.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
+this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);
+c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(C,M,L,D,J,aa,F){f=C.vertices[M].position;g=C.vertices[L].position;j=C.vertices[D].position;h=e[J];i=e[aa];n=e[F];m=g.x-f.x;q=j.x-f.x;l=g.y-f.y;v=j.y-f.y;r=g.z-f.z;y=j.z-f.z;u=i.u-h.u;B=n.u-h.u;z=i.v-h.v;o=n.v-h.v;H=1/(u*o-B*z);O.set((o*
+m-z*q)*H,(o*l-z*v)*H,(o*r-z*y)*H);U.set((u*q-B*m)*H,(u*v-B*l)*H,(u*y-B*r)*H);I[M].addSelf(O);I[L].addSelf(O);I[D].addSelf(O);N[M].addSelf(U);N[L].addSelf(U);N[D].addSelf(U)}var b,c,d,e,f,g,j,h,i,n,m,q,l,v,r,y,u,B,z,o,H,I=[],N=[],O=new THREE.Vector3,U=new THREE.Vector3,s=new THREE.Vector3,x=new THREE.Vector3,E=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){I[b]=new THREE.Vector3;N[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.faceVertexUvs[b][0];if(d instanceof
+THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<
+c;b++){E.copy(this.vertices[b].normal);d=I[b];s.copy(d);s.subSelf(E.multiplyScalar(E.dot(d))).normalize();x.cross(this.vertices[b].normal,d);d=x.dot(N[b]);d=d<0?-1:1;this.vertices[b].tangent.set(s.x,s.y,s.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=
+1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},
+computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(e){for(var f=0;f<a.length;f++)a[f].update(e)};c.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};c.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};c.add=function(e){b[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");b[e.name]=e;if(e.initialized!==!0){for(var f=0;f<e.hierarchy.length;f++){for(var g=0;g<e.hierarchy[f].keys.length;g++){if(e.hierarchy[f].keys[g].time<
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(e){for(var f=0;f<a.length;f++)a[f].update(e)};c.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};c.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};c.add=function(e){b[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");b[e.name]=e;if(e.initialized!==!0){for(var f=0;f<e.hierarchy.length;f++){for(var g=0;g<e.hierarchy[f].keys.length;g++){if(e.hierarchy[f].keys[g].time<
-0)e.hierarchy[f].keys[g].time=0;if(e.hierarchy[f].keys[g].rot!==undefined&&!(e.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=e.hierarchy[f].keys[g].rot;e.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(e.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<e.hierarchy[f].keys.length;g++)for(var h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++){var j=e.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}e.hierarchy[f].usedMorphTargets=i;for(g=0;g<e.hierarchy[f].keys.length;g++){var o=
-{};for(j in i){for(h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++)if(e.hierarchy[f].keys[g].morphTargets[h]===j){o[j]=e.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===e.hierarchy[f].keys[g].morphTargets.length&&(o[j]=0)}e.hierarchy[f].keys[g].morphTargetsInfluences=o}}for(g=1;g<e.hierarchy[f].keys.length;g++)if(e.hierarchy[f].keys[g].time===e.hierarchy[f].keys[g-1].time){e.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<e.hierarchy[f].keys.length;g++)e.hierarchy[f].keys[g].index=g}g=parseInt(e.length*
+0)e.hierarchy[f].keys[g].time=0;if(e.hierarchy[f].keys[g].rot!==undefined&&!(e.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var j=e.hierarchy[f].keys[g].rot;e.hierarchy[f].keys[g].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(e.hierarchy[f].keys[0].morphTargets!==undefined){j={};for(g=0;g<e.hierarchy[f].keys.length;g++)for(var h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++){var i=e.hierarchy[f].keys[g].morphTargets[h];j[i]=-1}e.hierarchy[f].usedMorphTargets=j;for(g=0;g<e.hierarchy[f].keys.length;g++){var n=
+{};for(i in j){for(h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++)if(e.hierarchy[f].keys[g].morphTargets[h]===i){n[i]=e.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===e.hierarchy[f].keys[g].morphTargets.length&&(n[i]=0)}e.hierarchy[f].keys[g].morphTargetsInfluences=n}}for(g=1;g<e.hierarchy[f].keys.length;g++)if(e.hierarchy[f].keys[g].time===e.hierarchy[f].keys[g-1].time){e.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<e.hierarchy[f].keys.length;g++)e.hierarchy[f].keys[g].index=g}g=parseInt(e.length*
 e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(f=0;f<e.hierarchy.length;f++)e.JIT.hierarchy.push(Array(g));e.initialized=!0}};c.get=function(e){if(typeof e==="string")if(b[e])return b[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};c.parse=function(e){var f=[];if(e instanceof THREE.SkinnedMesh)for(var g=0;g<e.bones.length;g++)f.push(e.bones[g]);else d(e,f);return f};var d=function(e,f){f.push(e);for(var g=0;g<e.children.length;g++)d(e.children[g],f)};c.LINEAR=
 e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(f=0;f<e.hierarchy.length;f++)e.JIT.hierarchy.push(Array(g));e.initialized=!0}};c.get=function(e){if(typeof e==="string")if(b[e])return b[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};c.parse=function(e){var f=[];if(e instanceof THREE.SkinnedMesh)for(var g=0;g<e.bones.length;g++)f.push(e.bones[g]);else d(e,f);return f};var d=function(e,f){f.push(e);for(var g=0;g<e.children.length;g++)d(e.children[g],f)};c.LINEAR=
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,i,h,j,o=this.data.JIT.hierarchy,n,p;this.currentTime+=a*this.timeScale;p=this.currentTime;n=this.currentTime%=this.data.length;j=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,v=this.hierarchy.length;m<v;m++){a=this.hierarchy[m];h=a.animationCache;if(this.JITCompile&&o[m][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[m][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=o[m][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var t=0;t<3;t++){c=b[t];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=p){if(n<p)if(this.loop){g=this.data.hierarchy[m].keys[0];for(i=this.getNextKeyWith(c,m,1);i.time<n;){g=i;i=this.getNextKeyWith(c,m,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,m,i.index+1)}while(i.time<
-n)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-g.time)/(i.time-g.time);e=g[c];f=i[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",m,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",m,i.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c===
-"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&o[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(m=0;m<this.hierarchy.length;m++)o[m][j]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,i,h,j;e=(a.length-1)*b;f=Math.floor(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]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],i[0],h[0],j[0],e,c,g);d[1]=this.interpolate(f[1],i[1],h[1],j[1],e,c,g);d[2]=this.interpolate(f[2],i[2],h[2],j[2],e,c,g);return d};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,j,h,i,n=this.data.JIT.hierarchy,m,q;this.currentTime+=a*this.timeScale;q=this.currentTime;m=this.currentTime%=this.data.length;i=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,v=this.hierarchy.length;l<v;l++){a=this.hierarchy[l];h=a.animationCache;if(this.JITCompile&&n[l][i]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[l][i];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=n[l][i];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var r=0;r<3;r++){c=b[r];g=h.prevKey[c];j=h.nextKey[c];if(j.time<=q){if(m<q)if(this.loop){g=this.data.hierarchy[l].keys[0];for(j=this.getNextKeyWith(c,l,1);j.time<m;){g=j;j=this.getNextKeyWith(c,l,j.index+1)}}else{this.stop();return}else{do{g=j;j=this.getNextKeyWith(c,l,j.index+1)}while(j.time<
+m)}h.prevKey[c]=g;h.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-g.time)/(j.time-g.time);e=g[c];f=j[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+l);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",l,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",l,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c===
+"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&n[0][i]===undefined){this.hierarchy[0].update(undefined,!0);for(l=0;l<this.hierarchy.length;l++)n[l][i]=this.hierarchy[l]instanceof THREE.Bone?this.hierarchy[l].skinMatrix.clone():this.hierarchy[l].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,j,h,i;e=(a.length-1)*b;f=Math.floor(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]];j=a[c[1]];h=a[c[2]];i=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],j[0],h[0],i[0],e,c,g);d[1]=this.interpolate(f[1],j[1],h[1],i[1],e,c,g);d[2]=this.interpolate(f[2],j[2],h[2],i[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){var d=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<d.length-1?c:d.length-1;else c%=d.length;for(;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
 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){var d=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<d.length-1?c:d.length-1;else c%=d.length;for(;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(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]!==undefined)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(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]!==undefined)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
@@ -85,7 +84,7 @@ THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.po
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.FlatShading=0;THREE.SmoothShading=1;THREE.MaterialColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
+THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
 THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
@@ -106,7 +105,8 @@ undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
 THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
 THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
 undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
 undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
-a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
+a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
+THREE.ParticleCanvasMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.program=function(){};this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.program!==undefined)this.program=a.program;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
 THREE.Texture=function(a,b,c,d,e,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=f!==undefined?f:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
 THREE.Texture=function(a,b,c,d,e,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=f!==undefined?f:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
@@ -125,37 +125,35 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.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)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.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)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(C,A){return A.z-C.z}function b(C,A){var L=0,y=1,M=C.z+C.w,D=A.z+A.w,x=-C.z+C.w,z=-A.z+A.w;if(M>=0&&D>=0&&x>=0&&z>=0)return!0;else if(M<0&&D<0||x<0&&z<0)return!1;else{if(M<0)L=Math.max(L,M/(M-D));else D<0&&(y=Math.min(y,M/(M-D)));if(x<0)L=Math.max(L,x/(x-z));else z<0&&(y=Math.min(y,x/(x-z)));if(y<L)return!1;else{C.lerpSelf(A,L);A.lerpSelf(C,1-y);return!0}}}var c,d,e=[],f,g,i,h=[],j,o,n=[],p,m,v=[],t=new THREE.Vector4,s=new THREE.Vector4,k=new THREE.Matrix4,G=new THREE.Matrix4,
-F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Vector4,I=new THREE.Vector4,S;this.projectObjects=function(C,A,L){A=[];var y,M,D;d=0;M=C.objects;C=0;for(y=M.length;C<y;C++){D=M[C];var x;if(!(x=!D.visible))if(x=D instanceof THREE.Mesh){a:{x=void 0;for(var z=D.matrixWorld,W=-D.geometry.boundingSphere.radius*Math.max(D.scale.x,Math.max(D.scale.y,D.scale.z)),w=0;w<6;w++){x=F[w].x*z.n14+F[w].y*z.n24+F[w].z*z.n34+F[w].w;if(x<=W){x=
-!1;break a}}x=!0}x=!x}if(!x){c=e[d]=e[d]||new THREE.RenderableObject;t.copy(D.position);k.multiplyVector3(t);c.object=D;c.z=t.z;A.push(c);d++}}L&&A.sort(a);return A};this.projectScene=function(C,A,L){var y=[],M=A.near,D=A.far,x,z,W,w,O,Y,H,ja,ka,la,ma,$,N,E,T,P;i=o=m=0;A.matrixAutoUpdate&&A.updateMatrix();C.update(undefined,!1,A);k.multiply(A.projectionMatrix,A.matrixWorldInverse);F[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);F[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);F[2].set(k.n41+
-k.n21,k.n42+k.n22,k.n43+k.n23,k.n44+k.n24);F[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);F[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);F[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);for(x=0;x<6;x++){Y=F[x];Y.divideScalar(Math.sqrt(Y.x*Y.x+Y.y*Y.y+Y.z*Y.z))}Y=this.projectObjects(C,A,!0);C=0;for(x=Y.length;C<x;C++){H=Y[C].object;if(H.visible){ja=H.matrixWorld;ma=H.matrixRotationWorld;ka=H.materials;la=H.overdraw;if(H instanceof THREE.Mesh){$=H.geometry;N=$.vertices;
-z=0;for(W=N.length;z<W;z++){E=N[z];E.positionWorld.copy(E.position);ja.multiplyVector3(E.positionWorld);w=E.positionScreen;w.copy(E.positionWorld);k.multiplyVector4(w);w.x/=w.w;w.y/=w.w;E.__visible=w.z>M&&w.z<D}$=$.faces;z=0;for(W=$.length;z<W;z++){E=$[z];if(E instanceof THREE.Face3){w=N[E.a];O=N[E.b];T=N[E.c];if(w.__visible&&O.__visible&&T.__visible&&(H.doubleSided||H.flipSided!=(T.positionScreen.x-w.positionScreen.x)*(O.positionScreen.y-w.positionScreen.y)-(T.positionScreen.y-w.positionScreen.y)*
-(O.positionScreen.x-w.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(w.positionWorld);f.v2.positionWorld.copy(O.positionWorld);f.v3.positionWorld.copy(T.positionWorld);f.v1.positionScreen.copy(w.positionScreen);f.v2.positionScreen.copy(O.positionScreen);f.v3.positionScreen.copy(T.positionScreen);f.normalWorld.copy(E.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(E.centroid);ja.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);
-k.multiplyVector3(f.centroidScreen);T=E.vertexNormals;S=f.vertexNormalsWorld;w=0;for(O=T.length;w<O;w++){P=S[w]=S[w]||new THREE.Vector3;P.copy(T[w]);ma.multiplyVector3(P)}f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=E.materials;f.overdraw=la;if(H.geometry.uvs[z]){f.uvs[0]=H.geometry.uvs[z][0];f.uvs[1]=H.geometry.uvs[z][1];f.uvs[2]=H.geometry.uvs[z][2]}y.push(f);i++}}else if(E instanceof THREE.Face4){w=N[E.a];O=N[E.b];T=N[E.c];P=N[E.d];if(w.__visible&&O.__visible&&T.__visible&&P.__visible&&
-(H.doubleSided||H.flipSided!=((P.positionScreen.x-w.positionScreen.x)*(O.positionScreen.y-w.positionScreen.y)-(P.positionScreen.y-w.positionScreen.y)*(O.positionScreen.x-w.positionScreen.x)<0||(O.positionScreen.x-T.positionScreen.x)*(P.positionScreen.y-T.positionScreen.y)-(O.positionScreen.y-T.positionScreen.y)*(P.positionScreen.x-T.positionScreen.x)<0))){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(w.positionWorld);f.v2.positionWorld.copy(O.positionWorld);f.v3.positionWorld.copy(P.positionWorld);
-f.v1.positionScreen.copy(w.positionScreen);f.v2.positionScreen.copy(O.positionScreen);f.v3.positionScreen.copy(P.positionScreen);f.normalWorld.copy(E.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(E.centroid);ja.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=E.materials;f.overdraw=la;if(H.geometry.uvs[z]){f.uvs[0]=H.geometry.uvs[z][0];f.uvs[1]=H.geometry.uvs[z][1];
-f.uvs[2]=H.geometry.uvs[z][3]}y.push(f);i++;g=h[i]=h[i]||new THREE.RenderableFace3;g.v1.positionWorld.copy(O.positionWorld);g.v2.positionWorld.copy(T.positionWorld);g.v3.positionWorld.copy(P.positionWorld);g.v1.positionScreen.copy(O.positionScreen);g.v2.positionScreen.copy(T.positionScreen);g.v3.positionScreen.copy(P.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=ka;g.faceMaterials=
-E.materials;g.overdraw=la;if(H.geometry.uvs[z]){g.uvs[0]=H.geometry.uvs[z][1];g.uvs[1]=H.geometry.uvs[z][2];g.uvs[2]=H.geometry.uvs[z][3]}y.push(g);i++}}}}else if(H instanceof THREE.Line){G.multiply(k,ja);N=H.geometry.vertices;E=N[0];E.positionScreen.copy(E.position);G.multiplyVector4(E.positionScreen);z=1;for(W=N.length;z<W;z++){w=N[z];w.positionScreen.copy(w.position);G.multiplyVector4(w.positionScreen);O=N[z-1];K.copy(w.positionScreen);I.copy(O.positionScreen);if(b(K,I)){K.multiplyScalar(1/K.w);
-I.multiplyScalar(1/I.w);j=n[o]=n[o]||new THREE.RenderableLine;j.v1.positionScreen.copy(K);j.v2.positionScreen.copy(I);j.z=Math.max(K.z,I.z);j.materials=H.materials;y.push(j);o++}}}else if(H instanceof THREE.Particle){s.set(H.position.x,H.position.y,H.position.z,1);k.multiplyVector4(s);s.z/=s.w;if(s.z>0&&s.z<1){p=v[m]=v[m]||new THREE.RenderableParticle;p.x=s.x/s.w;p.y=s.y/s.w;p.z=s.z;p.rotation=H.rotation.z;p.scale.x=H.scale.x*Math.abs(p.x-(s.x+A.projectionMatrix.n11)/(s.w+A.projectionMatrix.n14));
-p.scale.y=H.scale.y*Math.abs(p.y-(s.y+A.projectionMatrix.n22)/(s.w+A.projectionMatrix.n24));p.materials=H.materials;y.push(p);m++}}}}L&&y.sort(a);return y};this.unprojectVector=function(C,A){var L=A.matrixWorld.clone();L.multiplySelf(THREE.Matrix4.makeInvert(A.projectionMatrix));L.multiplyVector3(C);return C}};
-THREE.CanvasRenderer=function(){function a(U){if(p!=U)j.globalAlpha=p=U}function b(U){if(m!=U){switch(U){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}m=U}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,g,i,h,j=e.getContext("2d"),o=new THREE.Color(0),n=0,p=1,m=0,v=null,t=null,s=1,k,G,F,K,I,S,C,A,L,y=new THREE.Color,
-M=new THREE.Color,D=new THREE.Color,x=new THREE.Color,z=new THREE.Color,W,w,O,Y,H,ja,ka,la,ma,$=new THREE.Rectangle,N=new THREE.Rectangle,E=new THREE.Rectangle,T=!1,P=new THREE.Color,aa=new THREE.Color,na=new THREE.Color,oa=new THREE.Color,La=Math.PI*2,Q=new THREE.Vector3,ra,sa,Ca,ba,ta,xa,pa=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);Ca=sa.getImageData(0,0,2,2);ba=Ca.data;ta=document.createElement("canvas");
-ta.width=ta.height=pa;xa=ta.getContext("2d");xa.translate(-pa/2,-pa/2);xa.scale(pa,pa);pa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(U,da){f=U;g=da;i=f/2;h=g/2;e.width=f;e.height=g;$.set(-i,-h,i,h);p=1;m=0;t=v=null;s=1};this.setClearColor=function(U,da){o=U;n=da};this.setClearColorHex=function(U,da){o.setHex(U);n=da};this.clear=function(){j.setTransform(1,0,0,-1,i,h);if(!N.isEmpty()){N.inflate(1);N.minSelf($);if(o.hex==0&&n==0)j.clearRect(N.getX(),
-N.getY(),N.getWidth(),N.getHeight());else{b(THREE.NormalBlending);a(1);j.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+n+")";j.fillRect(N.getX(),N.getY(),N.getWidth(),N.getHeight())}N.empty()}};this.render=function(U,da){function Ma(l){var B,u,q,r=l.lights;aa.setRGB(0,0,0);na.setRGB(0,0,0);oa.setRGB(0,0,0);l=0;for(B=r.length;l<B;l++){u=r[l];q=u.color;if(u instanceof THREE.AmbientLight){aa.r+=q.r;aa.g+=q.g;aa.b+=q.b}else if(u instanceof THREE.DirectionalLight){na.r+=
-q.r;na.g+=q.g;na.b+=q.b}else if(u instanceof THREE.PointLight){oa.r+=q.r;oa.g+=q.g;oa.b+=q.b}}}function ya(l,B,u,q){var r,J,V,X,Z=l.lights;l=0;for(r=Z.length;l<r;l++){J=Z[l];V=J.color;X=J.intensity;if(J instanceof THREE.DirectionalLight){J=u.dot(J.position)*X;if(J>0){q.r+=V.r*J;q.g+=V.g*J;q.b+=V.b*J}}else if(J instanceof THREE.PointLight){Q.sub(J.position,B);Q.normalize();J=u.dot(Q)*X;if(J>0){q.r+=V.r*J;q.g+=V.g*J;q.b+=V.b*J}}}}function Na(l,B,u){if(u.opacity!=0){a(u.opacity);b(u.blending);var q,
-r,J,V,X,Z;if(u instanceof THREE.ParticleBasicMaterial){if(u.map){V=u.map.image;X=V.width>>1;Z=V.height>>1;r=B.scale.x*i;J=B.scale.y*h;u=r*X;q=J*Z;E.set(l.x-u,l.y-q,l.x+u,l.y+q);if($.instersects(E)){j.save();j.translate(l.x,l.y);j.rotate(-B.rotation);j.scale(r,-J);j.translate(-X,-Z);j.drawImage(V,0,0);j.restore()}}}else if(u instanceof THREE.ParticleCircleMaterial){if(T){P.r=aa.r+na.r+oa.r;P.g=aa.g+na.g+oa.g;P.b=aa.b+na.b+oa.b;y.r=u.color.r*P.r;y.g=u.color.g*P.g;y.b=u.color.b*P.b;y.updateStyleString()}else y.__styleString=
-u.color.__styleString;u=B.scale.x*i;q=B.scale.y*h;E.set(l.x-u,l.y-q,l.x+u,l.y+q);if($.instersects(E)){r=y.__styleString;if(t!=r)j.fillStyle=t=r;j.save();j.translate(l.x,l.y);j.rotate(-B.rotation);j.scale(u,q);j.beginPath();j.arc(0,0,1,0,La,!0);j.closePath();j.fill();j.restore()}}}}function Oa(l,B,u,q){if(q.opacity!=0){a(q.opacity);b(q.blending);j.beginPath();j.moveTo(l.positionScreen.x,l.positionScreen.y);j.lineTo(B.positionScreen.x,B.positionScreen.y);j.closePath();if(q instanceof THREE.LineBasicMaterial){y.__styleString=
-q.color.__styleString;l=q.linewidth;if(s!=l)j.lineWidth=s=l;l=y.__styleString;if(v!=l)j.strokeStyle=v=l;j.stroke();E.inflate(q.linewidth*2)}}}function Ha(l,B,u,q,r,J){if(r.opacity!=0){a(r.opacity);b(r.blending);K=l.positionScreen.x;I=l.positionScreen.y;S=B.positionScreen.x;C=B.positionScreen.y;A=u.positionScreen.x;L=u.positionScreen.y;j.beginPath();j.moveTo(K,I);j.lineTo(S,C);j.lineTo(A,L);j.lineTo(K,I);j.closePath();if(r instanceof THREE.MeshBasicMaterial)if(r.map)r.map.mapping instanceof THREE.UVMapping&&
-ua(K,I,S,C,A,L,r.map.image,q.uvs[0].u,q.uvs[0].v,q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);else if(r.envMap){if(r.envMap.mapping instanceof THREE.SphericalReflectionMapping){l=da.matrixWorldInverse;Q.copy(q.vertexNormalsWorld[0]);Y=(Q.x*l.n11+Q.y*l.n12+Q.z*l.n13)*0.5+0.5;H=-(Q.x*l.n21+Q.y*l.n22+Q.z*l.n23)*0.5+0.5;Q.copy(q.vertexNormalsWorld[1]);ja=(Q.x*l.n11+Q.y*l.n12+Q.z*l.n13)*0.5+0.5;ka=-(Q.x*l.n21+Q.y*l.n22+Q.z*l.n23)*0.5+0.5;Q.copy(q.vertexNormalsWorld[2]);la=(Q.x*l.n11+Q.y*l.n12+Q.z*l.n13)*
-0.5+0.5;ma=-(Q.x*l.n21+Q.y*l.n22+Q.z*l.n23)*0.5+0.5;ua(K,I,S,C,A,L,r.envMap.image,Y,H,ja,ka,la,ma)}}else r.wireframe?za(r.color.__styleString,r.wireframeLinewidth):Aa(r.color.__styleString);else if(r instanceof THREE.MeshLambertMaterial){if(r.map&&!r.wireframe){r.map.mapping instanceof THREE.UVMapping&&ua(K,I,S,C,A,L,r.map.image,q.uvs[0].u,q.uvs[0].v,q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);b(THREE.SubtractiveBlending)}if(T)if(!r.wireframe&&r.shading==THREE.SmoothShading&&q.vertexNormalsWorld.length==
-3){M.r=D.r=x.r=aa.r;M.g=D.g=x.g=aa.g;M.b=D.b=x.b=aa.b;ya(J,q.v1.positionWorld,q.vertexNormalsWorld[0],M);ya(J,q.v2.positionWorld,q.vertexNormalsWorld[1],D);ya(J,q.v3.positionWorld,q.vertexNormalsWorld[2],x);z.r=(D.r+x.r)*0.5;z.g=(D.g+x.g)*0.5;z.b=(D.b+x.b)*0.5;O=Ia(M,D,x,z);ua(K,I,S,C,A,L,O,0,0,1,0,0,1)}else{P.r=aa.r;P.g=aa.g;P.b=aa.b;ya(J,q.centroidWorld,q.normalWorld,P);y.r=r.color.r*P.r;y.g=r.color.g*P.g;y.b=r.color.b*P.b;y.updateStyleString();r.wireframe?za(y.__styleString,r.wireframeLinewidth):
-Aa(y.__styleString)}else r.wireframe?za(r.color.__styleString,r.wireframeLinewidth):Aa(r.color.__styleString)}else if(r instanceof THREE.MeshDepthMaterial){W=da.near;w=da.far;M.r=M.g=M.b=1-Da(l.positionScreen.z,W,w);D.r=D.g=D.b=1-Da(B.positionScreen.z,W,w);x.r=x.g=x.b=1-Da(u.positionScreen.z,W,w);z.r=(D.r+x.r)*0.5;z.g=(D.g+x.g)*0.5;z.b=(D.b+x.b)*0.5;O=Ia(M,D,x,z);ua(K,I,S,C,A,L,O,0,0,1,0,0,1)}else if(r instanceof THREE.MeshNormalMaterial){y.r=Ea(q.normalWorld.x);y.g=Ea(q.normalWorld.y);y.b=Ea(q.normalWorld.z);
-y.updateStyleString();r.wireframe?za(y.__styleString,r.wireframeLinewidth):Aa(y.__styleString)}}}function za(l,B){if(v!=l)j.strokeStyle=v=l;if(s!=B)j.lineWidth=s=B;j.stroke();E.inflate(B*2)}function Aa(l){if(t!=l)j.fillStyle=t=l;j.fill()}function ua(l,B,u,q,r,J,V,X,Z,ga,ca,ha,va){var ea,ia;ea=V.width-1;ia=V.height-1;X*=ea;Z*=ia;ga*=ea;ca*=ia;ha*=ea;va*=ia;u-=l;q-=B;r-=l;J-=B;ga-=X;ca-=Z;ha-=X;va-=Z;ea=ga*va-ha*ca;if(ea!=0){ia=1/ea;ea=(va*u-ca*r)*ia;ca=(va*q-ca*J)*ia;u=(ga*r-ha*u)*ia;q=(ga*J-ha*q)*
-ia;l=l-ea*X-u*Z;B=B-ca*X-q*Z;j.save();j.transform(ea,ca,u,q,l,B);j.clip();j.drawImage(V,0,0);j.restore()}}function Ia(l,B,u,q){var r=~~(l.r*255),J=~~(l.g*255);l=~~(l.b*255);var V=~~(B.r*255),X=~~(B.g*255);B=~~(B.b*255);var Z=~~(u.r*255),ga=~~(u.g*255);u=~~(u.b*255);var ca=~~(q.r*255),ha=~~(q.g*255);q=~~(q.b*255);ba[0]=r<0?0:r>255?255:r;ba[1]=J<0?0:J>255?255:J;ba[2]=l<0?0:l>255?255:l;ba[4]=V<0?0:V>255?255:V;ba[5]=X<0?0:X>255?255:X;ba[6]=B<0?0:B>255?255:B;ba[8]=Z<0?0:Z>255?255:Z;ba[9]=ga<0?0:ga>255?
-255:ga;ba[10]=u<0?0:u>255?255:u;ba[12]=ca<0?0:ca>255?255:ca;ba[13]=ha<0?0:ha>255?255:ha;ba[14]=q<0?0:q>255?255:q;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(l,B,u){l=(l-B)/(u-B);return l*l*(3-2*l)}function Ea(l){l=(l+1)*0.5;return l<0?0:l>1?1:l}function Fa(l,B){var u=B.x-l.x,q=B.y-l.y,r=1/Math.sqrt(u*u+q*q);u*=r;q*=r;B.x+=u;B.y+=q;l.x-=u;l.y-=q}var Ba,Ja,R,fa,qa,Ga,Ka,wa;this.autoClear?this.clear():j.setTransform(1,0,0,-1,i,h);c=d.projectScene(U,da,this.sortElements);(T=U.lights.length>
-0)&&Ma(U);Ba=0;for(Ja=c.length;Ba<Ja;Ba++){R=c[Ba];E.empty();if(R instanceof THREE.RenderableParticle){k=R;k.x*=i;k.y*=h;fa=0;for(qa=R.materials.length;fa<qa;fa++)Na(k,R,R.materials[fa],U)}else if(R instanceof THREE.RenderableLine){k=R.v1;G=R.v2;k.positionScreen.x*=i;k.positionScreen.y*=h;G.positionScreen.x*=i;G.positionScreen.y*=h;E.addPoint(k.positionScreen.x,k.positionScreen.y);E.addPoint(G.positionScreen.x,G.positionScreen.y);if($.instersects(E)){fa=0;for(qa=R.materials.length;fa<qa;)Oa(k,G,R,
-R.materials[fa++],U)}}else if(R instanceof THREE.RenderableFace3){k=R.v1;G=R.v2;F=R.v3;k.positionScreen.x*=i;k.positionScreen.y*=h;G.positionScreen.x*=i;G.positionScreen.y*=h;F.positionScreen.x*=i;F.positionScreen.y*=h;if(R.overdraw){Fa(k.positionScreen,G.positionScreen);Fa(G.positionScreen,F.positionScreen);Fa(F.positionScreen,k.positionScreen)}E.add3Points(k.positionScreen.x,k.positionScreen.y,G.positionScreen.x,G.positionScreen.y,F.positionScreen.x,F.positionScreen.y);if($.instersects(E)){fa=0;
-for(qa=R.meshMaterials.length;fa<qa;){wa=R.meshMaterials[fa++];if(wa instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=R.faceMaterials.length;Ga<Ka;)(wa=R.faceMaterials[Ga++])&&Ha(k,G,F,R,wa,U)}else Ha(k,G,F,R,wa,U)}}}N.addRectangle(E)}j.setTransform(1,0,0,1,0,0)}};
+THREE.Projector=function(){function a(){var s=h[j]=h[j]||new THREE.RenderableVertex;j++;return s}function b(s,x){return x.z-s.z}function c(s,x){var E=0,C=1,M=s.z+s.w,L=x.z+x.w,D=-s.z+s.w,J=-x.z+x.w;if(M>=0&&L>=0&&D>=0&&J>=0)return!0;else if(M<0&&L<0||D<0&&J<0)return!1;else{if(M<0)E=Math.max(E,M/(M-L));else L<0&&(C=Math.min(C,M/(M-L)));if(D<0)E=Math.max(E,D/(D-J));else J<0&&(C=Math.min(C,D/(D-J)));if(C<E)return!1;else{s.lerpSelf(x,E);x.lerpSelf(s,1-C);return!0}}}var d,e,f=[],g,j,h=[],i,n,m=[],q,l,
+v=[],r,y,u=[],B=new THREE.Vector4,z=new THREE.Vector4,o=new THREE.Matrix4,H=new THREE.Matrix4,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,O=new THREE.Vector4,U;this.projectVector=function(s,x){o.multiply(x.projectionMatrix,x.matrixWorldInverse);o.multiplyVector3(s);return s};this.unprojectVector=function(s,x){o.multiply(THREE.Matrix4.makeInvert(x.projectionMatrix),x.matrixWorld);o.multiplyVector3(s);return s};
+this.projectObjects=function(s,x,E){x=[];var C,M,L;e=0;M=s.objects;s=0;for(C=M.length;s<C;s++){L=M[s];var D;if(!(D=!L.visible))if(D=L instanceof THREE.Mesh){a:{D=void 0;for(var J=L.matrixWorld,aa=-L.geometry.boundingSphere.radius*Math.max(L.scale.x,Math.max(L.scale.y,L.scale.z)),F=0;F<6;F++){D=I[F].x*J.n14+I[F].y*J.n24+I[F].z*J.n34+I[F].w;if(D<=aa){D=!1;break a}}D=!0}D=!D}if(!D){D=f[e]=f[e]||new THREE.RenderableObject;e++;d=D;B.copy(L.position);o.multiplyVector3(B);d.object=L;d.z=B.z;x.push(d)}}E&&
+x.sort(b);return x};this.projectScene=function(s,x,E){var C=[],M=x.near,L=x.far,D,J,aa,F,$,Q,da,qa,ea,X,K,ma,R,T;y=l=n=0;x.matrixAutoUpdate&&x.updateMatrix();s.update(undefined,!1,x);o.multiply(x.projectionMatrix,x.matrixWorldInverse);I[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);I[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);I[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);I[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);I[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-
+o.n33,o.n44-o.n34);I[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(D=0;D<6;D++){$=I[D];$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z))}$=this.projectObjects(s,x,!0);s=0;for(D=$.length;s<D;s++){Q=$[s].object;if(Q.visible){da=Q.matrixWorld;ea=Q.matrixRotationWorld;qa=Q.materials;j=0;if(Q instanceof THREE.Mesh){X=Q.geometry;K=X.vertices;ma=X.faces;J=0;for(aa=K.length;J<aa;J++){g=a();g.positionWorld.copy(K[J].position);da.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);
+o.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>M&&g.positionScreen.z<L}J=0;for(aa=ma.length;J<aa;J++){K=ma[J];if(K instanceof THREE.Face3){F=h[K.a];R=h[K.b];T=h[K.c];if(F.visible&&R.visible&&T.visible&&(Q.doubleSided||Q.flipSided!=(T.positionScreen.x-F.positionScreen.x)*(R.positionScreen.y-F.positionScreen.y)-(T.positionScreen.y-F.positionScreen.y)*(R.positionScreen.x-F.positionScreen.x)<0)){var ia=m[n]=
+m[n]||new THREE.RenderableFace3;n++;i=ia;i.v1.copy(F);i.v2.copy(R);i.v3.copy(T);i.normalWorld.copy(K.normal);ea.multiplyVector3(i.normalWorld);i.centroidWorld.copy(K.centroid);da.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);R=K.vertexNormals;U=i.vertexNormalsWorld;for(F=0;F<3;F++){T=U[F];T.copy(R[F]);ea.multiplyVector3(T)}if(F=X.faceVertexUvs[0][J]){i.uvs[0]=F[0];i.uvs[1]=F[1];i.uvs[2]=F[2]}i.meshMaterials=qa;i.faceMaterials=K.materials;
+i.z=i.centroidScreen.z;C.push(i)}}}}else if(Q instanceof THREE.Line){H.multiply(o,da);K=Q.geometry.vertices;F=a();F.positionScreen.copy(K[0].position);H.multiplyVector4(F.positionScreen);J=1;for(aa=K.length;J<aa;J++){F=a();F.positionScreen.copy(K[J].position);H.multiplyVector4(F.positionScreen);R=h[j-2];N.copy(F.positionScreen);O.copy(R.positionScreen);if(c(N,O)){N.multiplyScalar(1/N.w);O.multiplyScalar(1/O.w);da=v[l]=v[l]||new THREE.RenderableLine;l++;q=da;q.v1.positionScreen.copy(N);q.v2.positionScreen.copy(O);
+q.z=Math.max(N.z,O.z);q.materials=Q.materials;C.push(q)}}}else if(Q instanceof THREE.Particle){z.set(Q.position.x,Q.position.y,Q.position.z,1);o.multiplyVector4(z);z.z/=z.w;if(z.z>0&&z.z<1){da=u[y]=u[y]||new THREE.RenderableParticle;y++;r=da;r.x=z.x/z.w;r.y=z.y/z.w;r.z=z.z;r.rotation=Q.rotation.z;r.scale.x=Q.scale.x*Math.abs(r.x-(z.x+x.projectionMatrix.n11)/(z.w+x.projectionMatrix.n14));r.scale.y=Q.scale.y*Math.abs(r.y-(z.y+x.projectionMatrix.n22)/(z.w+x.projectionMatrix.n24));r.materials=Q.materials;
+C.push(r)}}}}E&&C.sort(b);return C}};
+THREE.CanvasRenderer=function(){function a(V){if(q!=V)i.globalAlpha=q=V}function b(V){if(l!=V){switch(V){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}l=V}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,g,j,h,i=e.getContext("2d"),n=new THREE.Color(0),m=0,q=1,l=0,v=null,r=null,y=1,u,B,z,o,H,I,N,O,U,s=new THREE.Color,
+x=new THREE.Color,E=new THREE.Color,C=new THREE.Color,M=new THREE.Color,L,D,J,aa,F,$,Q,da,qa,ea=new THREE.Rectangle,X=new THREE.Rectangle,K=new THREE.Rectangle,ma=!1,R=new THREE.Color,T=new THREE.Color,ia=new THREE.Color,na=new THREE.Color,P=new THREE.Vector3,ra,sa,Ca,ba,ta,xa,oa=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);Ca=sa.getImageData(0,0,2,2);ba=Ca.data;ta=document.createElement("canvas");ta.width=ta.height=
+oa;xa=ta.getContext("2d");xa.translate(-oa/2,-oa/2);xa.scale(oa,oa);oa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(V,fa){f=V;g=fa;j=f/2;h=g/2;e.width=f;e.height=g;ea.set(-j,-h,j,h);q=1;l=0;r=v=null;y=1};this.setClearColor=function(V,fa){n=V;m=fa};this.setClearColorHex=function(V,fa){n.setHex(V);m=fa};this.clear=function(){i.setTransform(1,0,0,-1,j,h);if(!X.isEmpty()){X.inflate(1);X.minSelf(ea);if(n.hex==0&&m==0)i.clearRect(X.getX(),X.getY(),
+X.getWidth(),X.getHeight());else{b(THREE.NormalBlending);a(1);i.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+m+")";i.fillRect(X.getX(),X.getY(),X.getWidth(),X.getHeight())}X.empty()}};this.render=function(V,fa){function La(k){var A,w,p,t=k.lights;T.setRGB(0,0,0);ia.setRGB(0,0,0);na.setRGB(0,0,0);k=0;for(A=t.length;k<A;k++){w=t[k];p=w.color;if(w instanceof THREE.AmbientLight){T.r+=p.r;T.g+=p.g;T.b+=p.b}else if(w instanceof THREE.DirectionalLight){ia.r+=
+p.r;ia.g+=p.g;ia.b+=p.b}else if(w instanceof THREE.PointLight){na.r+=p.r;na.g+=p.g;na.b+=p.b}}}function ya(k,A,w,p){var t,G,W,Y,Z=k.lights;k=0;for(t=Z.length;k<t;k++){G=Z[k];W=G.color;Y=G.intensity;if(G instanceof THREE.DirectionalLight){G=w.dot(G.position)*Y;if(G>0){p.r+=W.r*G;p.g+=W.g*G;p.b+=W.b*G}}else if(G instanceof THREE.PointLight){P.sub(G.position,A);P.normalize();G=w.dot(P)*Y;if(G>0){p.r+=W.r*G;p.g+=W.g*G;p.b+=W.b*G}}}}function Ma(k,A,w){if(w.opacity!=0){a(w.opacity);b(w.blending);var p,
+t,G,W,Y,Z;if(w instanceof THREE.ParticleBasicMaterial){if(w.map){W=w.map.image;Y=W.width>>1;Z=W.height>>1;w=A.scale.x*j;G=A.scale.y*h;p=w*Y;t=G*Z;K.set(k.x-p,k.y-t,k.x+p,k.y+t);if(ea.instersects(K)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(w,-G);i.translate(-Y,-Z);i.drawImage(W,0,0);i.restore()}}}else if(w instanceof THREE.ParticleCanvasMaterial){if(ma){R.r=T.r+ia.r+na.r;R.g=T.g+ia.g+na.g;R.b=T.b+ia.b+na.b;s.r=w.color.r*R.r;s.g=w.color.g*R.g;s.b=w.color.b*R.b;s.updateStyleString()}else s.__styleString=
+w.color.__styleString;p=A.scale.x*j;t=A.scale.y*h;K.set(k.x-p,k.y-t,k.x+p,k.y+t);if(ea.instersects(K)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(p,t);w.program(i,s);i.restore()}}}}function Na(k,A,w,p){if(p.opacity!=0){a(p.opacity);b(p.blending);i.beginPath();i.moveTo(k.positionScreen.x,k.positionScreen.y);i.lineTo(A.positionScreen.x,A.positionScreen.y);i.closePath();if(p instanceof THREE.LineBasicMaterial){s.__styleString=p.color.__styleString;k=p.linewidth;if(y!=k)i.lineWidth=y=
+k;k=s.__styleString;if(v!=k)i.strokeStyle=v=k;i.stroke();K.inflate(p.linewidth*2)}}}function Ha(k,A,w,p,t,G){if(t.opacity!=0){a(t.opacity);b(t.blending);o=k.positionScreen.x;H=k.positionScreen.y;I=A.positionScreen.x;N=A.positionScreen.y;O=w.positionScreen.x;U=w.positionScreen.y;i.beginPath();i.moveTo(o,H);i.lineTo(I,N);i.lineTo(O,U);i.lineTo(o,H);i.closePath();if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&ua(o,H,I,N,O,U,t.map.image,p.uvs[0].u,p.uvs[0].v,
+p.uvs[1].u,p.uvs[1].v,p.uvs[2].u,p.uvs[2].v);else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping){k=fa.matrixWorldInverse;P.copy(p.vertexNormalsWorld[0]);aa=(P.x*k.n11+P.y*k.n12+P.z*k.n13)*0.5+0.5;F=-(P.x*k.n21+P.y*k.n22+P.z*k.n23)*0.5+0.5;P.copy(p.vertexNormalsWorld[1]);$=(P.x*k.n11+P.y*k.n12+P.z*k.n13)*0.5+0.5;Q=-(P.x*k.n21+P.y*k.n22+P.z*k.n23)*0.5+0.5;P.copy(p.vertexNormalsWorld[2]);da=(P.x*k.n11+P.y*k.n12+P.z*k.n13)*0.5+0.5;qa=-(P.x*k.n21+P.y*k.n22+P.z*k.n23)*0.5+
+0.5;ua(o,H,I,N,O,U,t.envMap.image,aa,F,$,Q,da,qa)}}else t.wireframe?za(t.color.__styleString,t.wireframeLinewidth):Aa(t.color.__styleString);else if(t instanceof THREE.MeshLambertMaterial){if(t.map&&!t.wireframe){t.map.mapping instanceof THREE.UVMapping&&ua(o,H,I,N,O,U,t.map.image,p.uvs[0].u,p.uvs[0].v,p.uvs[1].u,p.uvs[1].v,p.uvs[2].u,p.uvs[2].v);b(THREE.SubtractiveBlending)}if(ma)if(!t.wireframe&&t.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3){x.r=E.r=C.r=T.r;x.g=E.g=C.g=T.g;x.b=
+E.b=C.b=T.b;ya(G,p.v1.positionWorld,p.vertexNormalsWorld[0],x);ya(G,p.v2.positionWorld,p.vertexNormalsWorld[1],E);ya(G,p.v3.positionWorld,p.vertexNormalsWorld[2],C);M.r=(E.r+C.r)*0.5;M.g=(E.g+C.g)*0.5;M.b=(E.b+C.b)*0.5;J=Ia(x,E,C,M);ua(o,H,I,N,O,U,J,0,0,1,0,0,1)}else{R.r=T.r;R.g=T.g;R.b=T.b;ya(G,p.centroidWorld,p.normalWorld,R);s.r=t.color.r*R.r;s.g=t.color.g*R.g;s.b=t.color.b*R.b;s.updateStyleString();t.wireframe?za(s.__styleString,t.wireframeLinewidth):Aa(s.__styleString)}else t.wireframe?za(t.color.__styleString,
+t.wireframeLinewidth):Aa(t.color.__styleString)}else if(t instanceof THREE.MeshDepthMaterial){L=fa.near;D=fa.far;x.r=x.g=x.b=1-Da(k.positionScreen.z,L,D);E.r=E.g=E.b=1-Da(A.positionScreen.z,L,D);C.r=C.g=C.b=1-Da(w.positionScreen.z,L,D);M.r=(E.r+C.r)*0.5;M.g=(E.g+C.g)*0.5;M.b=(E.b+C.b)*0.5;J=Ia(x,E,C,M);ua(o,H,I,N,O,U,J,0,0,1,0,0,1)}else if(t instanceof THREE.MeshNormalMaterial){s.r=Ea(p.normalWorld.x);s.g=Ea(p.normalWorld.y);s.b=Ea(p.normalWorld.z);s.updateStyleString();t.wireframe?za(s.__styleString,
+t.wireframeLinewidth):Aa(s.__styleString)}}}function za(k,A){if(v!=k)i.strokeStyle=v=k;if(y!=A)i.lineWidth=y=A;i.stroke();K.inflate(A*2)}function Aa(k){if(r!=k)i.fillStyle=r=k;i.fill()}function ua(k,A,w,p,t,G,W,Y,Z,ja,ca,ka,va){var ga,la;ga=W.width-1;la=W.height-1;Y*=ga;Z*=la;ja*=ga;ca*=la;ka*=ga;va*=la;w-=k;p-=A;t-=k;G-=A;ja-=Y;ca-=Z;ka-=Y;va-=Z;ga=ja*va-ka*ca;if(ga!=0){la=1/ga;ga=(va*w-ca*t)*la;ca=(va*p-ca*G)*la;w=(ja*t-ka*w)*la;p=(ja*G-ka*p)*la;k=k-ga*Y-w*Z;A=A-ca*Y-p*Z;i.save();i.transform(ga,
+ca,w,p,k,A);i.clip();i.drawImage(W,0,0);i.restore()}}function Ia(k,A,w,p){var t=~~(k.r*255),G=~~(k.g*255);k=~~(k.b*255);var W=~~(A.r*255),Y=~~(A.g*255);A=~~(A.b*255);var Z=~~(w.r*255),ja=~~(w.g*255);w=~~(w.b*255);var ca=~~(p.r*255),ka=~~(p.g*255);p=~~(p.b*255);ba[0]=t<0?0:t>255?255:t;ba[1]=G<0?0:G>255?255:G;ba[2]=k<0?0:k>255?255:k;ba[4]=W<0?0:W>255?255:W;ba[5]=Y<0?0:Y>255?255:Y;ba[6]=A<0?0:A>255?255:A;ba[8]=Z<0?0:Z>255?255:Z;ba[9]=ja<0?0:ja>255?255:ja;ba[10]=w<0?0:w>255?255:w;ba[12]=ca<0?0:ca>255?
+255:ca;ba[13]=ka<0?0:ka>255?255:ka;ba[14]=p<0?0:p>255?255:p;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(k,A,w){k=(k-A)/(w-A);return k*k*(3-2*k)}function Ea(k){k=(k+1)*0.5;return k<0?0:k>1?1:k}function Fa(k,A){var w=A.x-k.x,p=A.y-k.y,t=1/Math.sqrt(w*w+p*p);w*=t;p*=t;A.x+=w;A.y+=p;k.x-=w;k.y-=p}var Ba,Ja,S,ha,pa,Ga,Ka,wa;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,h);c=d.projectScene(V,fa,this.sortElements);(ma=V.lights.length>0)&&La(V);Ba=0;for(Ja=c.length;Ba<Ja;Ba++){S=
+c[Ba];K.empty();if(S instanceof THREE.RenderableParticle){u=S;u.x*=j;u.y*=h;ha=0;for(pa=S.materials.length;ha<pa;ha++)Ma(u,S,S.materials[ha],V)}else if(S instanceof THREE.RenderableLine){u=S.v1;B=S.v2;u.positionScreen.x*=j;u.positionScreen.y*=h;B.positionScreen.x*=j;B.positionScreen.y*=h;K.addPoint(u.positionScreen.x,u.positionScreen.y);K.addPoint(B.positionScreen.x,B.positionScreen.y);if(ea.instersects(K)){ha=0;for(pa=S.materials.length;ha<pa;)Na(u,B,S,S.materials[ha++],V)}}else if(S instanceof THREE.RenderableFace3){u=
+S.v1;B=S.v2;z=S.v3;u.positionScreen.x*=j;u.positionScreen.y*=h;B.positionScreen.x*=j;B.positionScreen.y*=h;z.positionScreen.x*=j;z.positionScreen.y*=h;if(S.overdraw){Fa(u.positionScreen,B.positionScreen);Fa(B.positionScreen,z.positionScreen);Fa(z.positionScreen,u.positionScreen)}K.add3Points(u.positionScreen.x,u.positionScreen.y,B.positionScreen.x,B.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(ea.instersects(K)){ha=0;for(pa=S.meshMaterials.length;ha<pa;){wa=S.meshMaterials[ha++];if(wa instanceof
+THREE.MeshFaceMaterial){Ga=0;for(Ka=S.faceMaterials.length;Ga<Ka;)(wa=S.faceMaterials[Ga++])&&Ha(u,B,z,S,wa,V)}else Ha(u,B,z,S,wa,V)}}}X.addRectangle(K)}i.setTransform(1,0,0,1,0,0)}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
-THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
-THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
+THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.uvs=[];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
+THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};

+ 49 - 53
build/custom/ThreeDOM.js

@@ -1,6 +1,6 @@
 // ThreeDOM.js r36 - http://github.com/mrdoob/three.js
 // ThreeDOM.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,f,g,i,h;if(c==0)e=d=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:e=h;d=c;f=a;break;case 2:e=a;d=c;f=b;break;case 3:e=a;d=h;f=c;break;case 4:e=b;d=a;f=c;break;case 5:e=c;d=a;f=h;break;case 6:case 0:e=c;d=b;f=a}}this.r=e;this.g=d;this.b=f;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,g,f,i,h;if(c==0)e=d=g=0;else{f=Math.floor(a*6);i=a*6-f;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(f){case 1:e=h;d=c;g=a;break;case 2:e=a;d=c;g=b;break;case 3:e=a;d=h;g=c;break;case 4:e=b;d=a;g=c;break;case 5:e=c;d=a;g=h;break;case 6:case 0:e=c;d=b;g=a}}this.r=e;this.g=d;this.b=g;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
@@ -12,62 +12,61 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(f,g){return f.distance-g.distance});return d},intersectObject:function(a){function b(q,l,D,z){z=z.clone().subSelf(l);D=D.clone().subSelf(l);var G=q.clone().subSelf(l);q=z.dot(z);l=z.dot(D);z=z.dot(G);var H=D.dot(D);D=D.dot(G);G=1/(q*H-l*l);H=(H*z-l*D)*G;q=(q*D-l*z)*G;return H>0&&q>0&&H+q<1}var c,e,d,f,g,i,h,j,o,m,
-n,k=a.geometry,r=k.vertices,p=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];m=this.origin.clone();n=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(r[d.a].position.clone());g=h.multiplyVector3(r[d.b].position.clone());i=h.multiplyVector3(r[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(r[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());o=n.dot(j);if(o<0){j=j.dot((new THREE.Vector3).sub(f,m))/o;m=m.addSelf(n.multiplyScalar(j));
-if(d instanceof THREE.Face3){if(b(m,f,g,i)){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};p.push(d)}}else if(d instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,i,h))){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};p.push(d)}}}return p}};
-THREE.Rectangle=function(){function a(){f=e-b;g=d-c}var b,c,e,d,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,o,m){i=!1;b=h;c=j;e=o;d=m;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
-this.add3Points=function(h,j,o,m,n,k){if(i){i=!1;b=h<o?h<n?h:n:o<n?o:n;c=j<m?j<k?j:k:m<k?m:k;e=h>o?h>n?h:n:o>n?o:n;d=j>m?j>k?j:k:m>k?m:k}else{b=h<o?h<n?h<b?h:b:n<b?n:b:o<n?o<b?o:b:n<b?n:b;c=j<m?j<k?j<c?j:c:k<c?k:c:m<k?m<c?m:c:k<c?k:c;e=h>o?h>n?h>e?h:e:n>e?n:e:o>n?o>e?o:e:n>e?n:e;d=j>m?j>k?j>d?j:d:k>d?k:d:m>k?m>d?m:d:k>d?k:d}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();e=h.getRight();d=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();e=e>h.getRight()?
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(g,f){return g.distance-f.distance});return d},intersectObject:function(a){function b(s,u,B,v){v=v.clone().subSelf(u);B=B.clone().subSelf(u);var o=s.clone().subSelf(u);s=v.dot(v);u=v.dot(B);v=v.dot(o);var G=B.dot(B);B=B.dot(o);o=1/(s*G-u*u);G=(G*v-u*B)*o;s=(s*B-u*v)*o;return G>0&&s>0&&G+s<1}var c,e,d,g,f,i,h,j,m,l,
+n,k=a.geometry,q=k.vertices,p=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];l=this.origin.clone();n=this.direction.clone();h=a.matrixWorld;g=h.multiplyVector3(q[d.a].position.clone());f=h.multiplyVector3(q[d.b].position.clone());i=h.multiplyVector3(q[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(q[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());m=n.dot(j);if(m<0){j=j.dot((new THREE.Vector3).sub(g,l))/m;l=l.addSelf(n.multiplyScalar(j));
+if(d instanceof THREE.Face3){if(b(l,g,f,i)){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};p.push(d)}}else if(d instanceof THREE.Face4&&(b(l,g,f,h)||b(l,f,i,h))){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};p.push(d)}}}return p}};
+THREE.Rectangle=function(){function a(){g=e-b;f=d-c}var b,c,e,d,g,f,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,m,l){i=!1;b=h;c=j;e=m;d=l;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
+this.add3Points=function(h,j,m,l,n,k){if(i){i=!1;b=h<m?h<n?h:n:m<n?m:n;c=j<l?j<k?j:k:l<k?l:k;e=h>m?h>n?h:n:m>n?m:n;d=j>l?j>k?j:k:l>k?l:k}else{b=h<m?h<n?h<b?h:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b;c=j<l?j<k?j<c?j:c:k<c?k:c:l<k?l<c?l:c:k<c?k:c;e=h>m?h>n?h>e?h:e:n>e?n:e:m>n?m>e?m:e:n>e?n:e;d=j>l?j>k?j>d?j:d:k>d?k:d:l>k?l>d?l:d:k>d?k:d}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();e=h.getRight();d=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();e=e>h.getRight()?
 e:h.getRight();d=d>h.getBottom()?d:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;e+=h;d+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();d=d<h.getBottom()?d:h.getBottom();a()};this.instersects=function(h){return Math.min(e,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(d,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;d=e=c=b=0;a()};this.isEmpty=function(){return i}};
 e:h.getRight();d=d>h.getBottom()?d:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;e+=h;d+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();d=d<h.getBottom()?d:h.getBottom();a()};this.instersects=function(h){return Math.min(e,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(d,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;d=e=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,d,f,g,i,h,j,o,m,n,k,r,p){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,o||1,m||0,n||0,k||0,r||0,p||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,e,d,f,g,i,h,j,o,m,n,k,r,p){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=o;this.n34=m;this.n41=n;this.n42=k;this.n43=r;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
-d=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;e.cross(c,f).normalize();if(e.length()===0){f.x+=1.0E-4;e.cross(c,f).normalize()}d.cross(f,e).normalize();this.n11=e.x;this.n12=d.x;this.n13=f.x;this.n21=e.y;this.n22=d.y;this.n23=f.y;this.n31=e.z;this.n32=d.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,d=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*d;a.y=(this.n21*b+this.n22*c+this.n23*
+THREE.Matrix4=function(a,b,c,e,d,g,f,i,h,j,m,l,n,k,q,p){this.set(a||1,b||0,c||0,e||0,d||0,g||1,f||0,i||0,h||0,j||0,m||1,l||0,n||0,k||0,q||0,p||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,d,g,f,i,h,j,m,l,n,k,q,p){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=g;this.n23=f;this.n24=i;this.n31=h;this.n32=j;this.n33=m;this.n34=l;this.n41=n;this.n42=k;this.n43=q;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
+d=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x+=1.0E-4;e.cross(c,g).normalize()}d.cross(g,e).normalize();this.n11=e.x;this.n12=d.x;this.n13=g.x;this.n21=e.y;this.n22=d.y;this.n23=g.y;this.n31=e.z;this.n32=d.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,d=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*d;a.y=(this.n21*b+this.n22*c+this.n23*
 e+this.n24)*d;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*d;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,d=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*d;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*d;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*d;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*d;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
 e+this.n24)*d;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*d;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,d=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*d;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*d;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*d;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*d;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,n=a.n33,k=a.n34,r=a.n41,p=a.n42,q=a.n43,l=a.n44,D=b.n11,z=b.n12,G=b.n13,H=b.n14,M=b.n21,x=b.n22,
-v=b.n23,E=b.n24,B=b.n31,F=b.n32,A=b.n33,w=b.n34;this.n11=c*D+e*M+d*B;this.n12=c*z+e*x+d*F;this.n13=c*G+e*v+d*A;this.n14=c*H+e*E+d*w+f;this.n21=g*D+i*M+h*B;this.n22=g*z+i*x+h*F;this.n23=g*G+i*v+h*A;this.n24=g*H+i*E+h*w+j;this.n31=o*D+m*M+n*B;this.n32=o*z+m*x+n*F;this.n33=o*G+m*v+n*A;this.n34=o*H+m*E+n*w+k;this.n41=r*D+p*M+q*B;this.n42=r*z+p*x+q*F;this.n43=r*G+p*v+q*A;this.n44=r*H+p*E+q*w+l;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,l=a.n32,n=a.n33,k=a.n34,q=a.n41,p=a.n42,s=a.n43,u=a.n44,B=b.n11,v=b.n12,o=b.n13,G=b.n14,D=b.n21,I=b.n22,
+J=b.n23,P=b.n24,t=b.n31,r=b.n32,F=b.n33,z=b.n34;this.n11=c*B+e*D+d*t;this.n12=c*v+e*I+d*r;this.n13=c*o+e*J+d*F;this.n14=c*G+e*P+d*z+g;this.n21=f*B+i*D+h*t;this.n22=f*v+i*I+h*r;this.n23=f*o+i*J+h*F;this.n24=f*G+i*P+h*z+j;this.n31=m*B+l*D+n*t;this.n32=m*v+l*I+n*r;this.n33=m*o+l*J+n*F;this.n34=m*G+l*P+n*z+k;this.n41=q*B+p*D+s*t;this.n42=q*v+p*I+s*r;this.n43=q*o+p*J+s*F;this.n44=q*G+p*P+s*z+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,o=this.n33,m=this.n34,n=this.n41,k=this.n42,r=this.n43,p=this.n44;return e*g*j*n-c*i*j*n-e*f*o*n+b*i*o*n+c*f*m*n-b*g*m*n-e*g*h*k+c*i*h*k+e*d*o*k-a*i*o*k-c*d*m*k+a*g*m*k+e*f*h*r-b*i*h*r-e*d*j*r+a*i*j*r+b*d*m*r-a*f*m*r-c*f*h*p+b*g*h*p+c*d*j*p-a*g*j*p-b*d*o*p+a*f*o*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,g=this.n22,f=this.n23,i=this.n24,h=this.n31,j=this.n32,m=this.n33,l=this.n34,n=this.n41,k=this.n42,q=this.n43,p=this.n44;return e*f*j*n-c*i*j*n-e*g*m*n+b*i*m*n+c*g*l*n-b*f*l*n-e*f*h*k+c*i*h*k+e*d*m*k-a*i*m*k-c*d*l*k+a*f*l*k+e*g*h*q-b*i*h*q-e*d*j*q+a*i*j*q+b*d*l*q-a*g*l*q-c*g*h*p+b*f*h*p+c*d*j*p-a*f*j*p-b*d*m*p+a*g*m*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),d=1-c,f=a.x,g=a.y,i=a.z,h=d*f,j=d*g;this.set(h*
-f+c,h*g-e*i,h*i+e*g,0,h*g+e*i,j*g+c,j*i-e*f,0,h*i-e*g,j*i+e*f,d*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var d=Math.cos(c);c=Math.sin(c);var f=Math.cos(e);e=Math.sin(e);var g=a*c,i=b*c;this.n11=d*f;this.n12=-d*e;this.n13=c;this.n21=i*f+a*e;this.n22=-i*e+a*f;this.n23=-b*d;this.n31=-g*f+b*e;this.n32=g*e+b*f;this.n33=a*d;return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,e=a.z,d=a.w,f=b+b,g=c+c,i=e+e;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;e*=i;f*=d;g*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+g;this.n21=h+d;this.n22=1-(a+e);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),d=1-c,g=a.x,f=a.y,i=a.z,h=d*g,j=d*f;this.set(h*
+g+c,h*f-e*i,h*i+e*f,0,h*f+e*i,j*f+c,j*i-e*g,0,h*i-e*f,j*i+e*g,d*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var d=Math.cos(c);c=Math.sin(c);var g=Math.cos(e);e=Math.sin(e);var f=a*c,i=b*c;this.n11=d*g;this.n12=-d*e;this.n13=c;this.n21=i*g+a*e;this.n22=-i*e+a*g;this.n23=-b*d;this.n31=-f*g+b*e;this.n32=f*e+b*g;this.n33=a*d;return this},setRotationFromQuaternion:function(a){var b=
+a.x,c=a.y,e=a.z,d=a.w,g=b+b,f=c+c,i=e+e;a=b*g;var h=b*f;b*=i;var j=c*f;c*=i;e*=i;g*=d;f*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+f;this.n21=h+d;this.n22=1-(a+e);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,d=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*d;this.n23=a.n23*d;this.n33=a.n33*d}};
 a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,d=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*d;this.n23=a.n23*d;this.n33=a.n33*d}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,n=a.n33,k=a.n34,r=a.n41,p=a.n42,q=a.n43,l=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*p-j*n*p+j*m*q-i*k*q-h*m*l+i*n*l;b.n12=f*n*p-d*k*p-f*m*q+e*k*q+d*m*l-e*n*l;b.n13=d*j*p-f*h*p+f*i*q-e*j*q-d*i*l+e*h*l;b.n14=f*h*m-d*j*m-f*i*n+e*j*n+d*i*k-e*h*k;b.n21=j*n*r-h*k*r-j*o*q+g*k*q+h*o*l-g*n*l;b.n22=d*k*r-f*n*r+f*o*q-c*k*q-d*o*l+c*n*l;b.n23=f*h*r-d*j*r-f*g*q+c*j*q+d*g*l-c*h*l;
-b.n24=d*j*o-f*h*o+f*g*n-c*j*n-d*g*k+c*h*k;b.n31=i*k*r-j*m*r+j*o*p-g*k*p-i*o*l+g*m*l;b.n32=f*m*r-e*k*r-f*o*p+c*k*p+e*o*l-c*m*l;b.n33=d*j*r-f*i*r+f*g*p-c*j*p-e*g*l+c*i*l;b.n34=f*i*o-e*j*o-f*g*m+c*j*m+e*g*k-c*i*k;b.n41=h*m*r-i*n*r-h*o*p+g*n*p+i*o*q-g*m*q;b.n42=e*n*r-d*m*r+d*o*p-c*n*p-e*o*q+c*m*q;b.n43=d*i*r-e*h*r-d*g*p+c*h*p+e*g*q-c*i*q;b.n44=e*h*o-d*i*o+d*g*m-c*h*m-e*g*n+c*i*n;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,d=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*d;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*o;c[8]=a*m;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,e,d,f){var g;g=new THREE.Matrix4;g.n11=2*d/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*d/(e-c);g.n23=(e+c)/(e-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+d)/(f-d);g.n34=-2*f*d/(f-d);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,e){var d;a=c*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,c,e)};
-THREE.Matrix4.makeOrtho=function(a,b,c,e,d,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-e;j=f-d;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+e)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+d)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,l=a.n32,n=a.n33,k=a.n34,q=a.n41,p=a.n42,s=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*p-j*n*p+j*l*s-i*k*s-h*l*u+i*n*u;b.n12=g*n*p-d*k*p-g*l*s+e*k*s+d*l*u-e*n*u;b.n13=d*j*p-g*h*p+g*i*s-e*j*s-d*i*u+e*h*u;b.n14=g*h*l-d*j*l-g*i*n+e*j*n+d*i*k-e*h*k;b.n21=j*n*q-h*k*q-j*m*s+f*k*s+h*m*u-f*n*u;b.n22=d*k*q-g*n*q+g*m*s-c*k*s-d*m*u+c*n*u;b.n23=g*h*q-d*j*q-g*f*s+c*j*s+d*f*u-c*h*u;
+b.n24=d*j*m-g*h*m+g*f*n-c*j*n-d*f*k+c*h*k;b.n31=i*k*q-j*l*q+j*m*p-f*k*p-i*m*u+f*l*u;b.n32=g*l*q-e*k*q-g*m*p+c*k*p+e*m*u-c*l*u;b.n33=d*j*q-g*i*q+g*f*p-c*j*p-e*f*u+c*i*u;b.n34=g*i*m-e*j*m-g*f*l+c*j*l+e*f*k-c*i*k;b.n41=h*l*q-i*n*q-h*m*p+f*n*p+i*m*s-f*l*s;b.n42=e*n*q-d*l*q+d*m*p-c*n*p-e*m*s+c*l*s;b.n43=d*i*q-e*h*q-d*f*p+c*h*p+e*f*s-c*i*s;b.n44=e*h*m-d*i*m+d*f*l-c*h*l-e*f*n+c*i*n;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,d=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*f+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*d;c[2]=a*g;c[3]=a*f;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*m;c[8]=a*l;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,e,d,g){var f;f=new THREE.Matrix4;f.n11=2*d/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*d/(e-c);f.n23=(e+c)/(e-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+d)/(g-d);f.n34=-2*g*d/(g-d);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,e){var d;a=c*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,c,e)};
+THREE.Matrix4.makeOrtho=function(a,b,c,e,d,g){var f,i,h,j;f=new THREE.Matrix4;i=b-a;h=c-e;j=g-d;f.n11=2/i;f.n12=0;f.n13=0;f.n14=-((b+a)/i);f.n21=0;f.n22=2/h;f.n23=0;f.n24=-((c+e)/h);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((g+d)/j);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={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(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 THREE.Object3D.prototype={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(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
 b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
 b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
-THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*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*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,o=h*e+i*c-f*d,m=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+o*-i-m*-g;b.y=o*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-o*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};
-THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;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.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
-THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var f=0;f<a.length;f++)a[f].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var f=0;f<d.hierarchy.length;f++){for(var g=0;g<d.hierarchy[f].keys.length;g++){if(d.hierarchy[f].keys[g].time<
-0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++){var j=d.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}d.hierarchy[f].usedMorphTargets=i;for(g=0;g<d.hierarchy[f].keys.length;g++){var o=
-{};for(j in i){for(h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++)if(d.hierarchy[f].keys[g].morphTargets[h]===j){o[j]=d.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===d.hierarchy[f].keys[g].morphTargets.length&&(o[j]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=o}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*
-d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(f=0;f<d.hierarchy.length;f++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};c.get=function(d){if(typeof d==="string")if(b[d])return b[d];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+d);return null}};c.parse=function(d){var f=[];if(d instanceof THREE.SkinnedMesh)for(var g=0;g<d.bones.length;g++)f.push(d.bones[g]);else e(d,f);return f};var e=function(d,f){f.push(d);for(var g=0;g<d.children.length;g++)e(d.children[g],f)};c.LINEAR=
+THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*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*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,m=h*e+i*c-g*d,l=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+m*-i-l*-f;b.y=m*h+c*-f+l*-g-j*-i;b.z=l*h+c*-i+j*-f-m*-g;return b}};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
+THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var g=0;g<a.length;g++)a[g].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var g=0;g<d.hierarchy.length;g++){for(var f=0;f<d.hierarchy[g].keys.length;f++){if(d.hierarchy[g].keys[f].time<
+0)d.hierarchy[g].keys[f].time=0;if(d.hierarchy[g].keys[f].rot!==undefined&&!(d.hierarchy[g].keys[f].rot instanceof THREE.Quaternion)){var i=d.hierarchy[g].keys[f].rot;d.hierarchy[g].keys[f].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[g].keys[0].morphTargets!==undefined){i={};for(f=0;f<d.hierarchy[g].keys.length;f++)for(var h=0;h<d.hierarchy[g].keys[f].morphTargets.length;h++){var j=d.hierarchy[g].keys[f].morphTargets[h];i[j]=-1}d.hierarchy[g].usedMorphTargets=i;for(f=0;f<d.hierarchy[g].keys.length;f++){var m=
+{};for(j in i){for(h=0;h<d.hierarchy[g].keys[f].morphTargets.length;h++)if(d.hierarchy[g].keys[f].morphTargets[h]===j){m[j]=d.hierarchy[g].keys[f].morphTargetsInfluences[h];break}h===d.hierarchy[g].keys[f].morphTargets.length&&(m[j]=0)}d.hierarchy[g].keys[f].morphTargetsInfluences=m}}for(f=1;f<d.hierarchy[g].keys.length;f++)if(d.hierarchy[g].keys[f].time===d.hierarchy[g].keys[f-1].time){d.hierarchy[g].keys.splice(f,1);f--}for(f=1;f<d.hierarchy[g].keys.length;f++)d.hierarchy[g].keys[f].index=f}f=parseInt(d.length*
+d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(g=0;g<d.hierarchy.length;g++)d.JIT.hierarchy.push(Array(f));d.initialized=!0}};c.get=function(d){if(typeof d==="string")if(b[d])return b[d];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+d);return null}};c.parse=function(d){var g=[];if(d instanceof THREE.SkinnedMesh)for(var f=0;f<d.bones.length;f++)g.push(d.bones[f]);else e(d,g);return g};var e=function(d,g){g.push(d);for(var f=0;f<d.children.length;f++)e(d.children[f],g)};c.LINEAR=
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,d;for(c=0;c<e;c++){d=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)d.useQuaternion=!0;d.matrixAutoUpdate=!0;if(d.animationCache===undefined){d.animationCache={};d.animationCache.prevKey={pos:0,rot:0,scl:0};d.animationCache.nextKey={pos:0,rot:0,scl:0};d.animationCache.originalMatrix=
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,d;for(c=0;c<e;c++){d=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)d.useQuaternion=!0;d.matrixAutoUpdate=!0;if(d.animationCache===undefined){d.animationCache={};d.animationCache.prevKey={pos:0,rot:0,scl:0};d.animationCache.nextKey={pos:0,rot:0,scl:0};d.animationCache.originalMatrix=
-d instanceof THREE.Bone?d.skinMatrix:d.matrix}var f=d.animationCache.prevKey;d=d.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];d.pos=this.getNextKeyWith("pos",c,1);d.rot=this.getNextKeyWith("rot",c,1);d.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+d instanceof THREE.Bone?d.skinMatrix:d.matrix}var g=d.animationCache.prevKey;d=d.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];d.pos=this.getNextKeyWith("pos",c,1);d.rot=this.getNextKeyWith("rot",c,1);d.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,f,g,i,h,j,o=this.data.JIT.hierarchy,m,n;this.currentTime+=a*this.timeScale;n=this.currentTime;m=this.currentTime%=this.data.length;j=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,r=this.hierarchy.length;k<r;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&o[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){c=b[p];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=n){if(m<n)if(this.loop){g=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<m;){g=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
-m)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(m-g.time)/(i.time-g.time);d=g[c];f=i[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+k);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",k,g.index-1).pos;this.points[1]=d;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",k,i.index+1).pos;e=e*0.33+0.33;d=this.interpolateCatmullRom(this.points,e);c.x=d[0];c.y=d[1];c.z=d[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
-"rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}}}}if(this.JITCompile&&o[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)o[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],d,f,g,i,h,j;d=(a.length-1)*b;f=Math.floor(d);d-=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]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=d*d;g=d*c;e[0]=this.interpolate(f[0],i[0],h[0],j[0],d,c,g);e[1]=this.interpolate(f[1],i[1],h[1],j[1],d,c,g);e[2]=this.interpolate(f[2],i[2],h[2],j[2],d,c,g);return e};
-THREE.Animation.prototype.interpolate=function(a,b,c,e,d,f,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*f+a*d+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,g,f,i,h,j,m=this.data.JIT.hierarchy,l,n;this.currentTime+=a*this.timeScale;n=this.currentTime;l=this.currentTime%=this.data.length;j=parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,q=this.hierarchy.length;k<q;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&m[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=m[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=m[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){c=b[p];f=h.prevKey[c];i=h.nextKey[c];if(i.time<=n){if(l<n)if(this.loop){f=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<l;){f=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{f=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
+l)}h.prevKey[c]=f;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(l-f.time)/(i.time-f.time);d=f[c];g=i[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+k);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=d[0]+(g[0]-d[0])*e;c.y=d[1]+(g[1]-d[1])*e;c.z=d[2]+(g[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",k,f.index-1).pos;this.points[1]=d;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",k,i.index+1).pos;e=e*0.33+0.33;d=this.interpolateCatmullRom(this.points,e);c.x=d[0];c.y=d[1];c.z=d[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
+"rot")THREE.Quaternion.slerp(d,g,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=d[0]+(g[0]-d[0])*e;c.y=d[1]+(g[1]-d[1])*e;c.z=d[2]+(g[2]-d[2])*e}}}}if(this.JITCompile&&m[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)m[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],d,g,f,i,h,j;d=(a.length-1)*b;g=Math.floor(d);d-=g;c[0]=g==0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=d*d;f=d*c;e[0]=this.interpolate(g[0],i[0],h[0],j[0],d,c,f);e[1]=this.interpolate(g[1],i[1],h[1],j[1],d,c,f);e[2]=this.interpolate(g[2],i[2],h[2],j[2],d,c,f);return e};
+THREE.Animation.prototype.interpolate=function(a,b,c,e,d,g,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*g+a*d+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
@@ -85,19 +84,16 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.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)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.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)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(x,v){return v.z-x.z}function b(x,v){var E=0,B=1,F=x.z+x.w,A=v.z+v.w,w=-x.z+x.w,t=-v.z+v.w;if(F>=0&&A>=0&&w>=0&&t>=0)return!0;else if(F<0&&A<0||w<0&&t<0)return!1;else{if(F<0)E=Math.max(E,F/(F-A));else A<0&&(B=Math.min(B,F/(F-A)));if(w<0)E=Math.max(E,w/(w-t));else t<0&&(B=Math.min(B,w/(w-t)));if(B<E)return!1;else{x.lerpSelf(v,E);v.lerpSelf(x,1-B);return!0}}}var c,e,d=[],f,g,i,h=[],j,o,m=[],n,k,r=[],p=new THREE.Vector4,q=new THREE.Vector4,l=new THREE.Matrix4,D=new THREE.Matrix4,
-z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,H=new THREE.Vector4,M;this.projectObjects=function(x,v,E){v=[];var B,F,A;e=0;F=x.objects;x=0;for(B=F.length;x<B;x++){A=F[x];var w;if(!(w=!A.visible))if(w=A instanceof THREE.Mesh){a:{w=void 0;for(var t=A.matrixWorld,N=-A.geometry.boundingSphere.radius*Math.max(A.scale.x,Math.max(A.scale.y,A.scale.z)),s=0;s<6;s++){w=z[s].x*t.n14+z[s].y*t.n24+z[s].z*t.n34+z[s].w;if(w<=N){w=
-!1;break a}}w=!0}w=!w}if(!w){c=d[e]=d[e]||new THREE.RenderableObject;p.copy(A.position);l.multiplyVector3(p);c.object=A;c.z=p.z;v.push(c);e++}}E&&v.sort(a);return v};this.projectScene=function(x,v,E){var B=[],F=v.near,A=v.far,w,t,N,s,C,L,u,P,Q,R,S,O,J,y,I,K;i=o=k=0;v.matrixAutoUpdate&&v.updateMatrix();x.update(undefined,!1,v);l.multiply(v.projectionMatrix,v.matrixWorldInverse);z[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);z[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);z[2].set(l.n41+
-l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);z[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);z[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);z[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);for(w=0;w<6;w++){L=z[w];L.divideScalar(Math.sqrt(L.x*L.x+L.y*L.y+L.z*L.z))}L=this.projectObjects(x,v,!0);x=0;for(w=L.length;x<w;x++){u=L[x].object;if(u.visible){P=u.matrixWorld;S=u.matrixRotationWorld;Q=u.materials;R=u.overdraw;if(u instanceof THREE.Mesh){O=u.geometry;J=O.vertices;t=
-0;for(N=J.length;t<N;t++){y=J[t];y.positionWorld.copy(y.position);P.multiplyVector3(y.positionWorld);s=y.positionScreen;s.copy(y.positionWorld);l.multiplyVector4(s);s.x/=s.w;s.y/=s.w;y.__visible=s.z>F&&s.z<A}O=O.faces;t=0;for(N=O.length;t<N;t++){y=O[t];if(y instanceof THREE.Face3){s=J[y.a];C=J[y.b];I=J[y.c];if(s.__visible&&C.__visible&&I.__visible&&(u.doubleSided||u.flipSided!=(I.positionScreen.x-s.positionScreen.x)*(C.positionScreen.y-s.positionScreen.y)-(I.positionScreen.y-s.positionScreen.y)*(C.positionScreen.x-
-s.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(C.positionWorld);f.v3.positionWorld.copy(I.positionWorld);f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(C.positionScreen);f.v3.positionScreen.copy(I.positionScreen);f.normalWorld.copy(y.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(y.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);l.multiplyVector3(f.centroidScreen);
-I=y.vertexNormals;M=f.vertexNormalsWorld;s=0;for(C=I.length;s<C;s++){K=M[s]=M[s]||new THREE.Vector3;K.copy(I[s]);S.multiplyVector3(K)}f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=y.materials;f.overdraw=R;if(u.geometry.uvs[t]){f.uvs[0]=u.geometry.uvs[t][0];f.uvs[1]=u.geometry.uvs[t][1];f.uvs[2]=u.geometry.uvs[t][2]}B.push(f);i++}}else if(y instanceof THREE.Face4){s=J[y.a];C=J[y.b];I=J[y.c];K=J[y.d];if(s.__visible&&C.__visible&&I.__visible&&K.__visible&&(u.doubleSided||u.flipSided!=((K.positionScreen.x-
-s.positionScreen.x)*(C.positionScreen.y-s.positionScreen.y)-(K.positionScreen.y-s.positionScreen.y)*(C.positionScreen.x-s.positionScreen.x)<0||(C.positionScreen.x-I.positionScreen.x)*(K.positionScreen.y-I.positionScreen.y)-(C.positionScreen.y-I.positionScreen.y)*(K.positionScreen.x-I.positionScreen.x)<0))){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(C.positionWorld);f.v3.positionWorld.copy(K.positionWorld);f.v1.positionScreen.copy(s.positionScreen);
-f.v2.positionScreen.copy(C.positionScreen);f.v3.positionScreen.copy(K.positionScreen);f.normalWorld.copy(y.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(y.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);l.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=y.materials;f.overdraw=R;if(u.geometry.uvs[t]){f.uvs[0]=u.geometry.uvs[t][0];f.uvs[1]=u.geometry.uvs[t][1];f.uvs[2]=u.geometry.uvs[t][3]}B.push(f);i++;g=
-h[i]=h[i]||new THREE.RenderableFace3;g.v1.positionWorld.copy(C.positionWorld);g.v2.positionWorld.copy(I.positionWorld);g.v3.positionWorld.copy(K.positionWorld);g.v1.positionScreen.copy(C.positionScreen);g.v2.positionScreen.copy(I.positionScreen);g.v3.positionScreen.copy(K.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=Q;g.faceMaterials=y.materials;g.overdraw=R;if(u.geometry.uvs[t]){g.uvs[0]=
-u.geometry.uvs[t][1];g.uvs[1]=u.geometry.uvs[t][2];g.uvs[2]=u.geometry.uvs[t][3]}B.push(g);i++}}}}else if(u instanceof THREE.Line){D.multiply(l,P);J=u.geometry.vertices;y=J[0];y.positionScreen.copy(y.position);D.multiplyVector4(y.positionScreen);t=1;for(N=J.length;t<N;t++){s=J[t];s.positionScreen.copy(s.position);D.multiplyVector4(s.positionScreen);C=J[t-1];G.copy(s.positionScreen);H.copy(C.positionScreen);if(b(G,H)){G.multiplyScalar(1/G.w);H.multiplyScalar(1/H.w);j=m[o]=m[o]||new THREE.RenderableLine;
-j.v1.positionScreen.copy(G);j.v2.positionScreen.copy(H);j.z=Math.max(G.z,H.z);j.materials=u.materials;B.push(j);o++}}}else if(u instanceof THREE.Particle){q.set(u.position.x,u.position.y,u.position.z,1);l.multiplyVector4(q);q.z/=q.w;if(q.z>0&&q.z<1){n=r[k]=r[k]||new THREE.RenderableParticle;n.x=q.x/q.w;n.y=q.y/q.w;n.z=q.z;n.rotation=u.rotation.z;n.scale.x=u.scale.x*Math.abs(n.x-(q.x+v.projectionMatrix.n11)/(q.w+v.projectionMatrix.n14));n.scale.y=u.scale.y*Math.abs(n.y-(q.y+v.projectionMatrix.n22)/
-(q.w+v.projectionMatrix.n24));n.materials=u.materials;B.push(n);k++}}}}E&&B.sort(a);return B};this.unprojectVector=function(x,v){var E=v.matrixWorld.clone();E.multiplySelf(THREE.Matrix4.makeInvert(v.projectionMatrix));E.multiplyVector3(x);return x}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,d,f;this.domElement=document.createElement("div");this.setSize=function(g,i){c=g;e=i;d=c/2;f=e/2};this.render=function(g,i){var h,j,o,m,n,k,r,p;a=b.projectScene(g,i);h=0;for(j=a.length;h<j;h++){n=a[h];if(n instanceof THREE.RenderableParticle){r=n.x*d+d;p=n.y*f+f;o=0;for(m=n.material.length;o<m;o++){k=n.material[o];if(k instanceof THREE.ParticleDOMMaterial){k=k.domElement;k.style.left=r+"px";k.style.top=p+"px"}}}}}};
+THREE.Projector=function(){function a(){var t=h[i]=h[i]||new THREE.RenderableVertex;i++;return t}function b(t,r){return r.z-t.z}function c(t,r){var F=0,z=1,H=t.z+t.w,C=r.z+r.w,x=-t.z+t.w,y=-r.z+r.w;if(H>=0&&C>=0&&x>=0&&y>=0)return!0;else if(H<0&&C<0||x<0&&y<0)return!1;else{if(H<0)F=Math.max(F,H/(H-C));else C<0&&(z=Math.min(z,H/(H-C)));if(x<0)F=Math.max(F,x/(x-y));else y<0&&(z=Math.min(z,x/(x-y)));if(z<F)return!1;else{t.lerpSelf(r,F);r.lerpSelf(t,1-z);return!0}}}var e,d,g=[],f,i,h=[],j,m,l=[],n,k,
+q=[],p,s,u=[],B=new THREE.Vector4,v=new THREE.Vector4,o=new THREE.Matrix4,G=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,J=new THREE.Vector4,P;this.projectVector=function(t,r){o.multiply(r.projectionMatrix,r.matrixWorldInverse);o.multiplyVector3(t);return t};this.unprojectVector=function(t,r){o.multiply(THREE.Matrix4.makeInvert(r.projectionMatrix),r.matrixWorld);o.multiplyVector3(t);return t};
+this.projectObjects=function(t,r,F){r=[];var z,H,C;d=0;H=t.objects;t=0;for(z=H.length;t<z;t++){C=H[t];var x;if(!(x=!C.visible))if(x=C instanceof THREE.Mesh){a:{x=void 0;for(var y=C.matrixWorld,M=-C.geometry.boundingSphere.radius*Math.max(C.scale.x,Math.max(C.scale.y,C.scale.z)),w=0;w<6;w++){x=D[w].x*y.n14+D[w].y*y.n24+D[w].z*y.n34+D[w].w;if(x<=M){x=!1;break a}}x=!0}x=!x}if(!x){x=g[d]=g[d]||new THREE.RenderableObject;d++;e=x;B.copy(C.position);o.multiplyVector3(B);e.object=C;e.z=B.z;r.push(e)}}F&&
+r.sort(b);return r};this.projectScene=function(t,r,F){var z=[],H=r.near,C=r.far,x,y,M,w,K,A,N,T,R,Q,E,S,L,O;s=k=m=0;r.matrixAutoUpdate&&r.updateMatrix();t.update(undefined,!1,r);o.multiply(r.projectionMatrix,r.matrixWorldInverse);D[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-
+o.n33,o.n44-o.n34);D[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(x=0;x<6;x++){K=D[x];K.divideScalar(Math.sqrt(K.x*K.x+K.y*K.y+K.z*K.z))}K=this.projectObjects(t,r,!0);t=0;for(x=K.length;t<x;t++){A=K[t].object;if(A.visible){N=A.matrixWorld;R=A.matrixRotationWorld;T=A.materials;i=0;if(A instanceof THREE.Mesh){Q=A.geometry;E=Q.vertices;S=Q.faces;y=0;for(M=E.length;y<M;y++){f=a();f.positionWorld.copy(E[y].position);N.multiplyVector3(f.positionWorld);f.positionScreen.copy(f.positionWorld);
+o.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>H&&f.positionScreen.z<C}y=0;for(M=S.length;y<M;y++){E=S[y];if(E instanceof THREE.Face3){w=h[E.a];L=h[E.b];O=h[E.c];if(w.visible&&L.visible&&O.visible&&(A.doubleSided||A.flipSided!=(O.positionScreen.x-w.positionScreen.x)*(L.positionScreen.y-w.positionScreen.y)-(O.positionScreen.y-w.positionScreen.y)*(L.positionScreen.x-w.positionScreen.x)<0)){var U=l[m]=l[m]||
+new THREE.RenderableFace3;m++;j=U;j.v1.copy(w);j.v2.copy(L);j.v3.copy(O);j.normalWorld.copy(E.normal);R.multiplyVector3(j.normalWorld);j.centroidWorld.copy(E.centroid);N.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);o.multiplyVector3(j.centroidScreen);L=E.vertexNormals;P=j.vertexNormalsWorld;for(w=0;w<3;w++){O=P[w];O.copy(L[w]);R.multiplyVector3(O)}if(w=Q.faceVertexUvs[0][y]){j.uvs[0]=w[0];j.uvs[1]=w[1];j.uvs[2]=w[2]}j.meshMaterials=T;j.faceMaterials=E.materials;j.z=j.centroidScreen.z;
+z.push(j)}}}}else if(A instanceof THREE.Line){G.multiply(o,N);E=A.geometry.vertices;w=a();w.positionScreen.copy(E[0].position);G.multiplyVector4(w.positionScreen);y=1;for(M=E.length;y<M;y++){w=a();w.positionScreen.copy(E[y].position);G.multiplyVector4(w.positionScreen);L=h[i-2];I.copy(w.positionScreen);J.copy(L.positionScreen);if(c(I,J)){I.multiplyScalar(1/I.w);J.multiplyScalar(1/J.w);N=q[k]=q[k]||new THREE.RenderableLine;k++;n=N;n.v1.positionScreen.copy(I);n.v2.positionScreen.copy(J);n.z=Math.max(I.z,
+J.z);n.materials=A.materials;z.push(n)}}}else if(A instanceof THREE.Particle){v.set(A.position.x,A.position.y,A.position.z,1);o.multiplyVector4(v);v.z/=v.w;if(v.z>0&&v.z<1){N=u[s]=u[s]||new THREE.RenderableParticle;s++;p=N;p.x=v.x/v.w;p.y=v.y/v.w;p.z=v.z;p.rotation=A.rotation.z;p.scale.x=A.scale.x*Math.abs(p.x-(v.x+r.projectionMatrix.n11)/(v.w+r.projectionMatrix.n14));p.scale.y=A.scale.y*Math.abs(p.y-(v.y+r.projectionMatrix.n22)/(v.w+r.projectionMatrix.n24));p.materials=A.materials;z.push(p)}}}}F&&
+z.sort(b);return z}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,d,g;this.domElement=document.createElement("div");this.setSize=function(f,i){c=f;e=i;d=c/2;g=e/2};this.render=function(f,i){var h,j,m,l,n,k,q,p;a=b.projectScene(f,i);h=0;for(j=a.length;h<j;h++){n=a[h];if(n instanceof THREE.RenderableParticle){q=n.x*d+d;p=n.y*g+g;m=0;for(l=n.material.length;m<l;m++){k=n.material[m];if(k instanceof THREE.ParticleDOMMaterial){k=k.domElement;k.style.left=q+"px";k.style.top=p+"px"}}}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,d=c.length;for(e=0;e<d;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,d=c.length;for(e=0;e<d;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};

文件差異過大導致無法顯示
+ 15 - 15
build/custom/ThreeExtras.js


+ 95 - 97
build/custom/ThreeSVG.js

@@ -1,91 +1,90 @@
 // ThreeSVG.js r36 - http://github.com/mrdoob/three.js
 // ThreeSVG.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,g,i,h;if(c==0)d=e=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:d=h;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=h;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=h;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,f,g,i,h;if(c==0)e=d=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:e=h;d=c;f=a;break;case 2:e=a;d=c;f=b;break;case 3:e=a;d=h;f=c;break;case 4:e=b;d=a;f=c;break;case 5:e=c;d=a;f=h;break;case 6:case 0:e=c;d=b;f=a}}this.r=e;this.g=d;this.b=f;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
-b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.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.set(c*a.z-d*a.y,d*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
+b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.set(c*a.z-e*a.y,e*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
-1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
-THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
+1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
+THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(v,l,J,r){r=r.clone().subSelf(l);J=J.clone().subSelf(l);var A=v.clone().subSelf(l);v=r.dot(r);l=r.dot(J);r=r.dot(A);var F=J.dot(J);J=J.dot(A);A=1/(v*F-l*l);F=(F*r-l*J)*A;v=(v*J-l*r)*A;return F>0&&v>0&&F+v<1}var c,d,e,f,g,i,h,j,o,n,
-m,k=a.geometry,q=k.vertices,s=[];c=0;for(d=k.faces.length;c<d;c++){e=k.faces[c];n=this.origin.clone();m=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(q[e.a].position.clone());g=h.multiplyVector3(q[e.b].position.clone());i=h.multiplyVector3(q[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(q[e.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(e.normal.clone());o=m.dot(j);if(o<0){j=j.dot((new THREE.Vector3).sub(f,n))/o;n=n.addSelf(m.multiplyScalar(j));
-if(e instanceof THREE.Face3){if(b(n,f,g,i)){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};s.push(e)}}else if(e instanceof THREE.Face4&&(b(n,f,g,h)||b(n,g,i,h))){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};s.push(e)}}}return s}};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,j,o,n){i=!1;b=h;c=j;d=o;e=n;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;d=h;e=j}else{b=b<h?b:h;c=c<j?c:j;d=d>h?d:h;e=e>j?e:j}a()};
-this.add3Points=function(h,j,o,n,m,k){if(i){i=!1;b=h<o?h<m?h:m:o<m?o:m;c=j<n?j<k?j:k:n<k?n:k;d=h>o?h>m?h:m:o>m?o:m;e=j>n?j>k?j:k:n>k?n:k}else{b=h<o?h<m?h<b?h:b:m<b?m:b:o<m?o<b?o:b:m<b?m:b;c=j<n?j<k?j<c?j:c:k<c?k:c:n<k?n<c?n:c:k<c?k:c;d=h>o?h>m?h>d?h:d:m>d?m:d:o>m?o>d?o:d:m>d?m:d;e=j>n?j>k?j>e?j:e:k>e?k:e:n>k?n>e?n:e:k>e?k:e}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
-d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(f,g){return f.distance-g.distance});return d},intersectObject:function(a){function b(y,u,I,q){q=q.clone().subSelf(u);I=I.clone().subSelf(u);var n=y.clone().subSelf(u);y=q.dot(q);u=q.dot(I);q=q.dot(n);var D=I.dot(I);I=I.dot(n);n=1/(y*D-u*u);D=(D*q-u*I)*n;y=(y*I-u*q)*n;return D>0&&y>0&&D+y<1}var c,e,d,f,g,i,h,j,o,m,
+l,k=a.geometry,r=k.vertices,p=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];m=this.origin.clone();l=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(r[d.a].position.clone());g=h.multiplyVector3(r[d.b].position.clone());i=h.multiplyVector3(r[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(r[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());o=l.dot(j);if(o<0){j=j.dot((new THREE.Vector3).sub(f,m))/o;m=m.addSelf(l.multiplyScalar(j));
+if(d instanceof THREE.Face3){if(b(m,f,g,i)){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};p.push(d)}}else if(d instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,i,h))){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};p.push(d)}}}return p}};
+THREE.Rectangle=function(){function a(){f=e-b;g=d-c}var b,c,e,d,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,o,m){i=!1;b=h;c=j;e=o;d=m;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
+this.add3Points=function(h,j,o,m,l,k){if(i){i=!1;b=h<o?h<l?h:l:o<l?o:l;c=j<m?j<k?j:k:m<k?m:k;e=h>o?h>l?h:l:o>l?o:l;d=j>m?j>k?j:k:m>k?m:k}else{b=h<o?h<l?h<b?h:b:l<b?l:b:o<l?o<b?o:b:l<b?l:b;c=j<m?j<k?j<c?j:c:k<c?k:c:m<k?m<c?m:c:k<c?k:c;e=h>o?h>l?h>e?h:e:l>e?l:e:o>l?o>e?o:e:l>e?l:e;d=j>m?j>k?j>d?j:d:k>d?k:d:m>k?m>d?m:d:k>d?k:d}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();e=h.getRight();d=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();e=e>h.getRight()?
+e:h.getRight();d=d>h.getBottom()?d:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;e+=h;d+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();d=d<h.getBottom()?d:h.getBottom();a()};this.instersects=function(h){return Math.min(e,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(d,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;d=e=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,f,g,i,h,j,o,n,m,k,q,s){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,i||0,h||0,j||0,o||1,n||0,m||0,k||0,q||0,s||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,i,h,j,o,n,m,k,q,s){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=o;this.n34=n;this.n41=m;this.n42=k;this.n43=q;this.n44=s;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
-e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();if(d.length()===0){f.x+=1.0E-4;d.cross(c,f).normalize()}e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
-d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,n=a.n32,m=a.n33,k=a.n34,q=a.n41,s=a.n42,v=a.n43,l=a.n44,J=b.n11,r=b.n12,A=b.n13,F=b.n14,R=b.n21,B=b.n22,
-z=b.n23,L=b.n24,G=b.n31,N=b.n32,H=b.n33,t=b.n34;this.n11=c*J+d*R+e*G;this.n12=c*r+d*B+e*N;this.n13=c*A+d*z+e*H;this.n14=c*F+d*L+e*t+f;this.n21=g*J+i*R+h*G;this.n22=g*r+i*B+h*N;this.n23=g*A+i*z+h*H;this.n24=g*F+i*L+h*t+j;this.n31=o*J+n*R+m*G;this.n32=o*r+n*B+m*N;this.n33=o*A+n*z+m*H;this.n34=o*F+n*L+m*t+k;this.n41=q*J+s*R+v*G;this.n42=q*r+s*B+v*N;this.n43=q*A+s*z+v*H;this.n44=q*F+s*L+v*t+l;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+THREE.Matrix4=function(a,b,c,e,d,f,g,i,h,j,o,m,l,k,r,p){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,o||1,m||0,l||0,k||0,r||0,p||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,d,f,g,i,h,j,o,m,l,k,r,p){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=o;this.n34=m;this.n41=l;this.n42=k;this.n43=r;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
+d=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;e.cross(c,f).normalize();if(e.length()===0){f.x+=1.0E-4;e.cross(c,f).normalize()}d.cross(f,e).normalize();this.n11=e.x;this.n12=d.x;this.n13=f.x;this.n21=e.y;this.n22=d.y;this.n23=f.y;this.n31=e.z;this.n32=d.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,d=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*d;a.y=(this.n21*b+this.n22*c+this.n23*
+e+this.n24)*d;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*d;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,d=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*d;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*d;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*d;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*d;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,l=a.n33,k=a.n34,r=a.n41,p=a.n42,y=a.n43,u=a.n44,I=b.n11,q=b.n12,n=b.n13,D=b.n14,H=b.n21,L=b.n22,
+M=b.n23,R=b.n24,z=b.n31,A=b.n32,O=b.n33,w=b.n34;this.n11=c*I+e*H+d*z;this.n12=c*q+e*L+d*A;this.n13=c*n+e*M+d*O;this.n14=c*D+e*R+d*w+f;this.n21=g*I+i*H+h*z;this.n22=g*q+i*L+h*A;this.n23=g*n+i*M+h*O;this.n24=g*D+i*R+h*w+j;this.n31=o*I+m*H+l*z;this.n32=o*q+m*L+l*A;this.n33=o*n+m*M+l*O;this.n34=o*D+m*R+l*w+k;this.n41=r*I+p*H+y*z;this.n42=r*q+p*L+y*A;this.n43=r*n+p*M+y*O;this.n44=r*D+p*R+y*w+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,o=this.n33,n=this.n34,m=this.n41,k=this.n42,q=this.n43,s=this.n44;return d*g*j*m-c*i*j*m-d*f*o*m+b*i*o*m+c*f*n*m-b*g*n*m-d*g*h*k+c*i*h*k+d*e*o*k-a*i*o*k-c*e*n*k+a*g*n*k+d*f*h*q-b*i*h*q-d*e*j*q+a*i*j*q+b*e*n*q-a*f*n*q-c*f*h*s+b*g*h*s+c*e*j*s-a*g*j*s-b*e*o*s+a*f*o*s},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,o=this.n33,m=this.n34,l=this.n41,k=this.n42,r=this.n43,p=this.n44;return e*g*j*l-c*i*j*l-e*f*o*l+b*i*o*l+c*f*m*l-b*g*m*l-e*g*h*k+c*i*h*k+e*d*o*k-a*i*o*k-c*d*m*k+a*g*m*k+e*f*h*r-b*i*h*r-e*d*j*r+a*i*j*r+b*d*m*r-a*f*m*r-c*f*h*p+b*g*h*p+c*d*j*p-a*g*j*p-b*d*o*p+a*f*o*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,j=e*g;this.set(h*
-f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,j*g+c,j*i-d*f,0,h*i-d*g,j*i+d*f,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(j+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
-a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,n=a.n32,m=a.n33,k=a.n34,q=a.n41,s=a.n42,v=a.n43,l=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*s-j*m*s+j*n*v-i*k*v-h*n*l+i*m*l;b.n12=f*m*s-e*k*s-f*n*v+d*k*v+e*n*l-d*m*l;b.n13=e*j*s-f*h*s+f*i*v-d*j*v-e*i*l+d*h*l;b.n14=f*h*n-e*j*n-f*i*m+d*j*m+e*i*k-d*h*k;b.n21=j*m*q-h*k*q-j*o*v+g*k*v+h*o*l-g*m*l;b.n22=e*k*q-f*m*q+f*o*v-c*k*v-e*o*l+c*m*l;b.n23=f*h*q-e*j*q-f*g*v+c*j*v+e*g*l-c*h*l;
-b.n24=e*j*o-f*h*o+f*g*m-c*j*m-e*g*k+c*h*k;b.n31=i*k*q-j*n*q+j*o*s-g*k*s-i*o*l+g*n*l;b.n32=f*n*q-d*k*q-f*o*s+c*k*s+d*o*l-c*n*l;b.n33=e*j*q-f*i*q+f*g*s-c*j*s-d*g*l+c*i*l;b.n34=f*i*o-d*j*o-f*g*n+c*j*n+d*g*k-c*i*k;b.n41=h*n*q-i*m*q-h*o*s+g*m*s+i*o*v-g*n*v;b.n42=d*m*q-e*n*q+e*o*s-c*m*s-d*o*v+c*n*v;b.n43=e*i*q-d*h*q-e*g*s+c*h*s+d*g*v-c*i*v;b.n44=d*h*o-e*i*o+e*g*n-c*h*n-d*g*m+c*i*m;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*o;c[8]=a*n;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-d;j=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),d=1-c,f=a.x,g=a.y,i=a.z,h=d*f,j=d*g;this.set(h*
+f+c,h*g-e*i,h*i+e*g,0,h*g+e*i,j*g+c,j*i-e*f,0,h*i-e*g,j*i+e*f,d*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var d=Math.cos(c);c=Math.sin(c);var f=Math.cos(e);e=Math.sin(e);var g=a*c,i=b*c;this.n11=d*f;this.n12=-d*e;this.n13=c;this.n21=i*f+a*e;this.n22=-i*e+a*f;this.n23=-b*d;this.n31=-g*f+b*e;this.n32=g*e+b*f;this.n33=a*d;return this},setRotationFromQuaternion:function(a){var b=
+a.x,c=a.y,e=a.z,d=a.w,f=b+b,g=c+c,i=e+e;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;e*=i;f*=d;g*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+g;this.n21=h+d;this.n22=1-(a+e);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
+a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,d=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*d;this.n23=a.n23*d;this.n33=a.n33*d}};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,l=a.n33,k=a.n34,r=a.n41,p=a.n42,y=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*p-j*l*p+j*m*y-i*k*y-h*m*u+i*l*u;b.n12=f*l*p-d*k*p-f*m*y+e*k*y+d*m*u-e*l*u;b.n13=d*j*p-f*h*p+f*i*y-e*j*y-d*i*u+e*h*u;b.n14=f*h*m-d*j*m-f*i*l+e*j*l+d*i*k-e*h*k;b.n21=j*l*r-h*k*r-j*o*y+g*k*y+h*o*u-g*l*u;b.n22=d*k*r-f*l*r+f*o*y-c*k*y-d*o*u+c*l*u;b.n23=f*h*r-d*j*r-f*g*y+c*j*y+d*g*u-c*h*u;
+b.n24=d*j*o-f*h*o+f*g*l-c*j*l-d*g*k+c*h*k;b.n31=i*k*r-j*m*r+j*o*p-g*k*p-i*o*u+g*m*u;b.n32=f*m*r-e*k*r-f*o*p+c*k*p+e*o*u-c*m*u;b.n33=d*j*r-f*i*r+f*g*p-c*j*p-e*g*u+c*i*u;b.n34=f*i*o-e*j*o-f*g*m+c*j*m+e*g*k-c*i*k;b.n41=h*m*r-i*l*r-h*o*p+g*l*p+i*o*y-g*m*y;b.n42=e*l*r-d*m*r+d*o*p-c*l*p-e*o*y+c*m*y;b.n43=d*i*r-e*h*r-d*g*p+c*h*p+e*g*y-c*i*y;b.n44=e*h*o-d*i*o+d*g*m-c*h*m-e*g*l+c*i*l;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,d=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*d;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*o;c[8]=a*m;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,e,d,f){var g;g=new THREE.Matrix4;g.n11=2*d/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*d/(e-c);g.n23=(e+c)/(e-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+d)/(f-d);g.n34=-2*f*d/(f-d);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,e){var d;a=c*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,c,e)};
+THREE.Matrix4.makeOrtho=function(a,b,c,e,d,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-e;j=f-d;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+e)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+d)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={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(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 THREE.Object3D.prototype={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(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
-1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
-b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
-THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*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*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;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,i=this.z,h=this.w,j=h*c+g*e-i*d,o=h*d+i*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+o*-i-n*-g;b.y=o*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-o*-f;return b}};
-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(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
-THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-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.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
-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.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
-THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[];this.faceVertexUvs=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
+b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
+THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*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*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,o=h*e+i*c-f*d,m=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+o*-i-m*-g;b.y=o*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-o*-f;return b}};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;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.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
+THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={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].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 THREE.Geometry.prototype={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].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,i=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,
-c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
-new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(t,C,S,y,K,D,w){f=t.vertices[C].position;g=t.vertices[S].position;i=t.vertices[y].position;h=e[K];j=e[D];o=e[w];n=g.x-f.x;m=i.x-f.x;k=g.y-f.y;q=i.y-f.y;
-s=g.z-f.z;v=i.z-f.z;l=j.u-h.u;J=o.u-h.u;r=j.v-h.v;A=o.v-h.v;F=1/(l*A-J*r);z.set((A*n-r*m)*F,(A*k-r*q)*F,(A*s-r*v)*F);L.set((l*m-J*n)*F,(l*q-J*k)*F,(l*v-J*s)*F);R[C].addSelf(z);R[S].addSelf(z);R[y].addSelf(z);B[C].addSelf(L);B[S].addSelf(L);B[y].addSelf(L)}var b,c,d,e,f,g,i,h,j,o,n,m,k,q,s,v,l,J,r,A,F,R=[],B=[],z=new THREE.Vector3,L=new THREE.Vector3,G=new THREE.Vector3,N=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){R[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
-for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.faceVertexUvs[b][0];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){H.copy(this.vertices[b].normal);d=R[b];G.copy(d);G.subSelf(H.multiplyScalar(H.dot(d))).normalize();N.cross(this.vertices[b].normal,d);d=N.dot(B[b]);d=d<0?-1:1;this.vertices[b].tangent.set(G.x,G.y,G.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
-z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
-this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(e){for(var f=0;f<a.length;f++)a[f].update(e)};c.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};c.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};c.add=function(e){b[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");b[e.name]=e;if(e.initialized!==!0){for(var f=0;f<e.hierarchy.length;f++){for(var g=0;g<e.hierarchy[f].keys.length;g++){if(e.hierarchy[f].keys[g].time<
-0)e.hierarchy[f].keys[g].time=0;if(e.hierarchy[f].keys[g].rot!==undefined&&!(e.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=e.hierarchy[f].keys[g].rot;e.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(e.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<e.hierarchy[f].keys.length;g++)for(var h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++){var j=e.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}e.hierarchy[f].usedMorphTargets=i;for(g=0;g<e.hierarchy[f].keys.length;g++){var o=
-{};for(j in i){for(h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++)if(e.hierarchy[f].keys[g].morphTargets[h]===j){o[j]=e.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===e.hierarchy[f].keys[g].morphTargets.length&&(o[j]=0)}e.hierarchy[f].keys[g].morphTargetsInfluences=o}}for(g=1;g<e.hierarchy[f].keys.length;g++)if(e.hierarchy[f].keys[g].time===e.hierarchy[f].keys[g-1].time){e.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<e.hierarchy[f].keys.length;g++)e.hierarchy[f].keys[g].index=g}g=parseInt(e.length*
-e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(f=0;f<e.hierarchy.length;f++)e.JIT.hierarchy.push(Array(g));e.initialized=!0}};c.get=function(e){if(typeof e==="string")if(b[e])return b[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};c.parse=function(e){var f=[];if(e instanceof THREE.SkinnedMesh)for(var g=0;g<e.bones.length;g++)f.push(e.bones[g]);else d(e,f);return f};var d=function(e,f){f.push(e);for(var g=0;g<e.children.length;g++)d(e.children[g],f)};c.LINEAR=
-0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
-e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,d,f,g,i=new THREE.Vector3,h=new THREE.Vector3;e=0;for(d=this.faces.length;e<d;e++){f=this.faces[e];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||
+i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[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{e=
+this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[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(e[c.a]);
+c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(w,P,N,E,G,B,x){f=w.vertices[P].position;g=w.vertices[N].position;i=w.vertices[E].position;h=d[G];j=d[B];o=d[x];m=g.x-f.x;l=i.x-f.x;k=g.y-f.y;r=i.y-f.y;p=g.z-f.z;y=i.z-f.z;u=j.u-h.u;I=o.u-h.u;q=j.v-h.v;n=o.v-h.v;D=1/(u*n-I*q);M.set((n*
+m-q*l)*D,(n*k-q*r)*D,(n*p-q*y)*D);R.set((u*l-I*m)*D,(u*r-I*k)*D,(u*y-I*p)*D);H[P].addSelf(M);H[N].addSelf(M);H[E].addSelf(M);L[P].addSelf(R);L[N].addSelf(R);L[E].addSelf(R)}var b,c,e,d,f,g,i,h,j,o,m,l,k,r,p,y,u,I,q,n,D,H=[],L=[],M=new THREE.Vector3,R=new THREE.Vector3,z=new THREE.Vector3,A=new THREE.Vector3,O=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){H[b]=new THREE.Vector3;L[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];d=this.faceVertexUvs[b][0];if(e instanceof
+THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<
+c;b++){O.copy(this.vertices[b].normal);e=H[b];z.copy(e);z.subSelf(O.multiplyScalar(O.dot(e))).normalize();A.cross(this.vertices[b].normal,e);e=A.dot(L[b]);e=e<0?-1:1;this.vertices[b].tangent.set(z.x,z.y,z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=
+1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},
+computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
+THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var f=0;f<a.length;f++)a[f].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var f=0;f<d.hierarchy.length;f++){for(var g=0;g<d.hierarchy[f].keys.length;g++){if(d.hierarchy[f].keys[g].time<
+0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++){var j=d.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}d.hierarchy[f].usedMorphTargets=i;for(g=0;g<d.hierarchy[f].keys.length;g++){var o=
+{};for(j in i){for(h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++)if(d.hierarchy[f].keys[g].morphTargets[h]===j){o[j]=d.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===d.hierarchy[f].keys[g].morphTargets.length&&(o[j]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=o}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*
+d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(f=0;f<d.hierarchy.length;f++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};c.get=function(d){if(typeof d==="string")if(b[d])return b[d];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+d);return null}};c.parse=function(d){var f=[];if(d instanceof THREE.SkinnedMesh)for(var g=0;g<d.bones.length;g++)f.push(d.bones[g]);else e(d,f);return f};var e=function(d,f){f.push(d);for(var g=0;g<d.children.length;g++)e(d.children[g],f)};c.LINEAR=
+0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,d;for(c=0;c<e;c++){d=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)d.useQuaternion=!0;d.matrixAutoUpdate=!0;if(d.animationCache===undefined){d.animationCache={};d.animationCache.prevKey={pos:0,rot:0,scl:0};d.animationCache.nextKey={pos:0,rot:0,scl:0};d.animationCache.originalMatrix=
+d instanceof THREE.Bone?d.skinMatrix:d.matrix}var f=d.animationCache.prevKey;d=d.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];d.pos=this.getNextKeyWith("pos",c,1);d.rot=this.getNextKeyWith("rot",c,1);d.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,i,h,j,o=this.data.JIT.hierarchy,n,m;this.currentTime+=a*this.timeScale;m=this.currentTime;n=this.currentTime%=this.data.length;j=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,q=this.hierarchy.length;k<q;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&o[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var s=0;s<3;s++){c=b[s];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=m){if(n<m)if(this.loop){g=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<n;){g=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
-n)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-g.time)/(i.time-g.time);e=g[c];f=i[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+k);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",k,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",k,i.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c===
-"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&o[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)o[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,i,h,j;e=(a.length-1)*b;f=Math.floor(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]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],i[0],h[0],j[0],e,c,g);d[1]=this.interpolate(f[1],i[1],h[1],j[1],e,c,g);d[2]=this.interpolate(f[2],i[2],h[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){var d=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<d.length-1?c:d.length-1;else c%=d.length;for(;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(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]!==undefined)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
-THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,f,g,i,h,j,o=this.data.JIT.hierarchy,m,l;this.currentTime+=a*this.timeScale;l=this.currentTime;m=this.currentTime%=this.data.length;j=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,r=this.hierarchy.length;k<r;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&o[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){c=b[p];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=l){if(m<l)if(this.loop){g=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<m;){g=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
+m)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(m-g.time)/(i.time-g.time);d=g[c];f=i[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+k);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",k,g.index-1).pos;this.points[1]=d;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",k,i.index+1).pos;e=e*0.33+0.33;d=this.interpolateCatmullRom(this.points,e);c.x=d[0];c.y=d[1];c.z=d[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
+"rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}}}}if(this.JITCompile&&o[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)o[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],d,f,g,i,h,j;d=(a.length-1)*b;f=Math.floor(d);d-=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]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=d*d;g=d*c;e[0]=this.interpolate(f[0],i[0],h[0],j[0],d,c,g);e[1]=this.interpolate(f[1],i[1],h[1],j[1],d,c,g);e[2]=this.interpolate(f[2],i[2],h[2],j[2],d,c,g);return e};
+THREE.Animation.prototype.interpolate=function(a,b,c,e,d,f,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*f+a*d+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
+THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.FlatShading=0;THREE.SmoothShading=1;THREE.MaterialColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
+THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
@@ -105,49 +104,48 @@ undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
 THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
 THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
 undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
 undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
-a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
+a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
+THREE.ParticleCanvasMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.program=function(){};this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.program!==undefined)this.program=a.program;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
 THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;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);
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;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=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)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;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,d=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<d;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(e=0;e<d;e++)this.children[e].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
 b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
-THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)e=
-"audio/mpeg";else if(b.indexOf(".ogg")!==-1)e="audio/ogg";else b.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
+THREE.Sound=function(a,b,c,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var d;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)d=
+"audio/mpeg";else if(b.indexOf(".ogg")!==-1)d="audio/ogg";else b.indexOf(".wav")!==-1&&(d="audio/wav");if(this.domElement.canPlayType(d)){d=document.createElement("source");d.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(d);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
+THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,b,c)};
 THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.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)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.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)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(B,z){return z.z-B.z}function b(B,z){var L=0,G=1,N=B.z+B.w,H=z.z+z.w,t=-B.z+B.w,C=-z.z+z.w;if(N>=0&&H>=0&&t>=0&&C>=0)return!0;else if(N<0&&H<0||t<0&&C<0)return!1;else{if(N<0)L=Math.max(L,N/(N-H));else H<0&&(G=Math.min(G,N/(N-H)));if(t<0)L=Math.max(L,t/(t-C));else C<0&&(G=Math.min(G,t/(t-C)));if(G<L)return!1;else{B.lerpSelf(z,L);z.lerpSelf(B,1-G);return!0}}}var c,d,e=[],f,g,i,h=[],j,o,n=[],m,k,q=[],s=new THREE.Vector4,v=new THREE.Vector4,l=new THREE.Matrix4,J=new THREE.Matrix4,
-r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],A=new THREE.Vector4,F=new THREE.Vector4,R;this.projectObjects=function(B,z,L){z=[];var G,N,H;d=0;N=B.objects;B=0;for(G=N.length;B<G;B++){H=N[B];var t;if(!(t=!H.visible))if(t=H instanceof THREE.Mesh){a:{t=void 0;for(var C=H.matrixWorld,S=-H.geometry.boundingSphere.radius*Math.max(H.scale.x,Math.max(H.scale.y,H.scale.z)),y=0;y<6;y++){t=r[y].x*C.n14+r[y].y*C.n24+r[y].z*C.n34+r[y].w;if(t<=S){t=
-!1;break a}}t=!0}t=!t}if(!t){c=e[d]=e[d]||new THREE.RenderableObject;s.copy(H.position);l.multiplyVector3(s);c.object=H;c.z=s.z;z.push(c);d++}}L&&z.sort(a);return z};this.projectScene=function(B,z,L){var G=[],N=z.near,H=z.far,t,C,S,y,K,D,w,M,P,x,u,I,O,p,E,Q;i=o=k=0;z.matrixAutoUpdate&&z.updateMatrix();B.update(undefined,!1,z);l.multiply(z.projectionMatrix,z.matrixWorldInverse);r[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);r[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);r[2].set(l.n41+
-l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);r[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);r[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);r[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);for(t=0;t<6;t++){D=r[t];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}D=this.projectObjects(B,z,!0);B=0;for(t=D.length;B<t;B++){w=D[B].object;if(w.visible){M=w.matrixWorld;u=w.matrixRotationWorld;P=w.materials;x=w.overdraw;if(w instanceof THREE.Mesh){I=w.geometry;O=I.vertices;C=
-0;for(S=O.length;C<S;C++){p=O[C];p.positionWorld.copy(p.position);M.multiplyVector3(p.positionWorld);y=p.positionScreen;y.copy(p.positionWorld);l.multiplyVector4(y);y.x/=y.w;y.y/=y.w;p.__visible=y.z>N&&y.z<H}I=I.faces;C=0;for(S=I.length;C<S;C++){p=I[C];if(p instanceof THREE.Face3){y=O[p.a];K=O[p.b];E=O[p.c];if(y.__visible&&K.__visible&&E.__visible&&(w.doubleSided||w.flipSided!=(E.positionScreen.x-y.positionScreen.x)*(K.positionScreen.y-y.positionScreen.y)-(E.positionScreen.y-y.positionScreen.y)*(K.positionScreen.x-
-y.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(y.positionWorld);f.v2.positionWorld.copy(K.positionWorld);f.v3.positionWorld.copy(E.positionWorld);f.v1.positionScreen.copy(y.positionScreen);f.v2.positionScreen.copy(K.positionScreen);f.v3.positionScreen.copy(E.positionScreen);f.normalWorld.copy(p.normal);u.multiplyVector3(f.normalWorld);f.centroidWorld.copy(p.centroid);M.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);l.multiplyVector3(f.centroidScreen);
-E=p.vertexNormals;R=f.vertexNormalsWorld;y=0;for(K=E.length;y<K;y++){Q=R[y]=R[y]||new THREE.Vector3;Q.copy(E[y]);u.multiplyVector3(Q)}f.z=f.centroidScreen.z;f.meshMaterials=P;f.faceMaterials=p.materials;f.overdraw=x;if(w.geometry.uvs[C]){f.uvs[0]=w.geometry.uvs[C][0];f.uvs[1]=w.geometry.uvs[C][1];f.uvs[2]=w.geometry.uvs[C][2]}G.push(f);i++}}else if(p instanceof THREE.Face4){y=O[p.a];K=O[p.b];E=O[p.c];Q=O[p.d];if(y.__visible&&K.__visible&&E.__visible&&Q.__visible&&(w.doubleSided||w.flipSided!=((Q.positionScreen.x-
-y.positionScreen.x)*(K.positionScreen.y-y.positionScreen.y)-(Q.positionScreen.y-y.positionScreen.y)*(K.positionScreen.x-y.positionScreen.x)<0||(K.positionScreen.x-E.positionScreen.x)*(Q.positionScreen.y-E.positionScreen.y)-(K.positionScreen.y-E.positionScreen.y)*(Q.positionScreen.x-E.positionScreen.x)<0))){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(y.positionWorld);f.v2.positionWorld.copy(K.positionWorld);f.v3.positionWorld.copy(Q.positionWorld);f.v1.positionScreen.copy(y.positionScreen);
-f.v2.positionScreen.copy(K.positionScreen);f.v3.positionScreen.copy(Q.positionScreen);f.normalWorld.copy(p.normal);u.multiplyVector3(f.normalWorld);f.centroidWorld.copy(p.centroid);M.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);l.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=P;f.faceMaterials=p.materials;f.overdraw=x;if(w.geometry.uvs[C]){f.uvs[0]=w.geometry.uvs[C][0];f.uvs[1]=w.geometry.uvs[C][1];f.uvs[2]=w.geometry.uvs[C][3]}G.push(f);i++;g=
-h[i]=h[i]||new THREE.RenderableFace3;g.v1.positionWorld.copy(K.positionWorld);g.v2.positionWorld.copy(E.positionWorld);g.v3.positionWorld.copy(Q.positionWorld);g.v1.positionScreen.copy(K.positionScreen);g.v2.positionScreen.copy(E.positionScreen);g.v3.positionScreen.copy(Q.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=P;g.faceMaterials=p.materials;g.overdraw=x;if(w.geometry.uvs[C]){g.uvs[0]=
-w.geometry.uvs[C][1];g.uvs[1]=w.geometry.uvs[C][2];g.uvs[2]=w.geometry.uvs[C][3]}G.push(g);i++}}}}else if(w instanceof THREE.Line){J.multiply(l,M);O=w.geometry.vertices;p=O[0];p.positionScreen.copy(p.position);J.multiplyVector4(p.positionScreen);C=1;for(S=O.length;C<S;C++){y=O[C];y.positionScreen.copy(y.position);J.multiplyVector4(y.positionScreen);K=O[C-1];A.copy(y.positionScreen);F.copy(K.positionScreen);if(b(A,F)){A.multiplyScalar(1/A.w);F.multiplyScalar(1/F.w);j=n[o]=n[o]||new THREE.RenderableLine;
-j.v1.positionScreen.copy(A);j.v2.positionScreen.copy(F);j.z=Math.max(A.z,F.z);j.materials=w.materials;G.push(j);o++}}}else if(w instanceof THREE.Particle){v.set(w.position.x,w.position.y,w.position.z,1);l.multiplyVector4(v);v.z/=v.w;if(v.z>0&&v.z<1){m=q[k]=q[k]||new THREE.RenderableParticle;m.x=v.x/v.w;m.y=v.y/v.w;m.z=v.z;m.rotation=w.rotation.z;m.scale.x=w.scale.x*Math.abs(m.x-(v.x+z.projectionMatrix.n11)/(v.w+z.projectionMatrix.n14));m.scale.y=w.scale.y*Math.abs(m.y-(v.y+z.projectionMatrix.n22)/
-(v.w+z.projectionMatrix.n24));m.materials=w.materials;G.push(m);k++}}}}L&&G.sort(a);return G};this.unprojectVector=function(B,z){var L=z.matrixWorld.clone();L.multiplySelf(THREE.Matrix4.makeInvert(z.projectionMatrix));L.multiplyVector3(B);return B}};
-THREE.SVGRenderer=function(){function a(D,w,M){var P,x,u,I;P=0;for(x=D.lights.length;P<x;P++){u=D.lights[P];if(u instanceof THREE.DirectionalLight){I=w.normalWorld.dot(u.position)*u.intensity;if(I>0){M.r+=u.color.r*I;M.g+=u.color.g*I;M.b+=u.color.b*I}}else if(u instanceof THREE.PointLight){L.sub(u.position,w.centroidWorld);L.normalize();I=w.normalWorld.dot(L)*u.intensity;if(I>0){M.r+=u.color.r*I;M.g+=u.color.g*I;M.b+=u.color.b*I}}}}function b(D,w,M,P,x,u){t=d(C++);t.setAttribute("d","M "+D.positionScreen.x+
-" "+D.positionScreen.y+" L "+w.positionScreen.x+" "+w.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)r.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(J){A.r=F.r;A.g=F.g;A.b=F.b;a(u,P,A);r.r=x.color.r*A.r;r.g=x.color.g*A.g;r.b=x.color.b*A.b;r.updateStyleString()}else r.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshDepthMaterial){z=1-x.__2near/(x.__farPlusNear-P.z*x.__farMinusNear);
-r.setRGB(z,z,z)}else x instanceof THREE.MeshNormalMaterial&&r.setRGB(e(P.normalWorld.x),e(P.normalWorld.y),e(P.normalWorld.z));x.wireframe?t.setAttribute("style","fill: none; stroke: "+r.__styleString+"; stroke-width: "+x.wireframeLinewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.wireframeLinecap+"; stroke-linejoin: "+x.wireframeLinejoin):t.setAttribute("style","fill: "+r.__styleString+"; fill-opacity: "+x.opacity);i.appendChild(t)}function c(D,w,M,P,x,u,I){t=d(C++);t.setAttribute("d",
-"M "+D.positionScreen.x+" "+D.positionScreen.y+" L "+w.positionScreen.x+" "+w.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(u instanceof THREE.MeshBasicMaterial)r.__styleString=u.color.__styleString;else if(u instanceof THREE.MeshLambertMaterial)if(J){A.r=F.r;A.g=F.g;A.b=F.b;a(I,x,A);r.r=u.color.r*A.r;r.g=u.color.g*A.g;r.b=u.color.b*A.b;r.updateStyleString()}else r.__styleString=u.color.__styleString;else if(u instanceof THREE.MeshDepthMaterial){z=
-1-u.__2near/(u.__farPlusNear-x.z*u.__farMinusNear);r.setRGB(z,z,z)}else u instanceof THREE.MeshNormalMaterial&&r.setRGB(e(x.normalWorld.x),e(x.normalWorld.y),e(x.normalWorld.z));u.wireframe?t.setAttribute("style","fill: none; stroke: "+r.__styleString+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):t.setAttribute("style","fill: "+r.__styleString+"; fill-opacity: "+u.opacity);i.appendChild(t)}
-function d(D){if(G[D]==null){G[D]=document.createElementNS("http://www.w3.org/2000/svg","path");K==0&&G[D].setAttribute("shape-rendering","crispEdges")}return G[D]}function e(D){return D<0?Math.min((1+D)*0.5,0.5):0.5+Math.min(D*0.5,0.5)}var f=null,g=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,j,o,n,m,k,q,s,v=new THREE.Rectangle,l=new THREE.Rectangle,J=!1,r=new THREE.Color(16777215),A=new THREE.Color(16777215),F=new THREE.Color(0),R=new THREE.Color(0),B=new THREE.Color(0),
-z,L=new THREE.Vector3,G=[],N=[],H=[],t,C,S,y,K=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(D){switch(D){case "high":K=1;break;case "low":K=0}};this.setSize=function(D,w){h=D;j=w;o=h/2;n=j/2;i.setAttribute("viewBox",-o+" "+-n+" "+h+" "+j);i.setAttribute("width",h);i.setAttribute("height",j);v.set(-o,-n,o,n)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(D,w){var M,P,x,u,I,O,p,E;this.autoClear&&
-this.clear();f=g.projectScene(D,w,this.sortElements);y=S=C=0;if(J=D.lights.length>0){p=D.lights;F.setRGB(0,0,0);R.setRGB(0,0,0);B.setRGB(0,0,0);M=0;for(P=p.length;M<P;M++){x=p[M];u=x.color;if(x instanceof THREE.AmbientLight){F.r+=u.r;F.g+=u.g;F.b+=u.b}else if(x instanceof THREE.DirectionalLight){R.r+=u.r;R.g+=u.g;R.b+=u.b}else if(x instanceof THREE.PointLight){B.r+=u.r;B.g+=u.g;B.b+=u.b}}}M=0;for(P=f.length;M<P;M++){p=f[M];l.empty();if(p instanceof THREE.RenderableParticle){m=p;m.x*=o;m.y*=-n;x=0;
-for(u=p.materials.length;x<u;x++)if(E=p.materials[x]){I=m;O=p;var Q=S++;if(N[Q]==null){N[Q]=document.createElementNS("http://www.w3.org/2000/svg","circle");K==0&&N[Q].setAttribute("shape-rendering","crispEdges")}t=N[Q];t.setAttribute("cx",I.x);t.setAttribute("cy",I.y);t.setAttribute("r",O.scale.x*o);if(E instanceof THREE.ParticleCircleMaterial){if(J){A.r=F.r+R.r+B.r;A.g=F.g+R.g+B.g;A.b=F.b+R.b+B.b;r.r=E.color.r*A.r;r.g=E.color.g*A.g;r.b=E.color.b*A.b;r.updateStyleString()}else r=E.color;t.setAttribute("style",
-"fill: "+r.__styleString)}i.appendChild(t)}}else if(p instanceof THREE.RenderableLine){m=p.v1;k=p.v2;m.positionScreen.x*=o;m.positionScreen.y*=-n;k.positionScreen.x*=o;k.positionScreen.y*=-n;l.addPoint(m.positionScreen.x,m.positionScreen.y);l.addPoint(k.positionScreen.x,k.positionScreen.y);if(v.instersects(l)){x=0;for(u=p.materials.length;x<u;)if(E=p.materials[x++]){I=m;O=k;Q=y++;if(H[Q]==null){H[Q]=document.createElementNS("http://www.w3.org/2000/svg","line");K==0&&H[Q].setAttribute("shape-rendering",
-"crispEdges")}t=H[Q];t.setAttribute("x1",I.positionScreen.x);t.setAttribute("y1",I.positionScreen.y);t.setAttribute("x2",O.positionScreen.x);t.setAttribute("y2",O.positionScreen.y);if(E instanceof THREE.LineBasicMaterial){r.__styleString=E.color.__styleString;t.setAttribute("style","fill: none; stroke: "+r.__styleString+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.linecap+"; stroke-linejoin: "+E.linejoin);i.appendChild(t)}}}}else if(p instanceof THREE.RenderableFace3){m=
-p.v1;k=p.v2;q=p.v3;m.positionScreen.x*=o;m.positionScreen.y*=-n;k.positionScreen.x*=o;k.positionScreen.y*=-n;q.positionScreen.x*=o;q.positionScreen.y*=-n;l.addPoint(m.positionScreen.x,m.positionScreen.y);l.addPoint(k.positionScreen.x,k.positionScreen.y);l.addPoint(q.positionScreen.x,q.positionScreen.y);if(v.instersects(l)){x=0;for(u=p.meshMaterials.length;x<u;){E=p.meshMaterials[x++];if(E instanceof THREE.MeshFaceMaterial){I=0;for(O=p.faceMaterials.length;I<O;)(E=p.faceMaterials[I++])&&b(m,k,q,p,
-E,D)}else E&&b(m,k,q,p,E,D)}}}else if(p instanceof THREE.RenderableFace4){m=p.v1;k=p.v2;q=p.v3;s=p.v4;m.positionScreen.x*=o;m.positionScreen.y*=-n;k.positionScreen.x*=o;k.positionScreen.y*=-n;q.positionScreen.x*=o;q.positionScreen.y*=-n;s.positionScreen.x*=o;s.positionScreen.y*=-n;l.addPoint(m.positionScreen.x,m.positionScreen.y);l.addPoint(k.positionScreen.x,k.positionScreen.y);l.addPoint(q.positionScreen.x,q.positionScreen.y);l.addPoint(s.positionScreen.x,s.positionScreen.y);if(v.instersects(l)){x=
-0;for(u=p.meshMaterials.length;x<u;){E=p.meshMaterials[x++];if(E instanceof THREE.MeshFaceMaterial){I=0;for(O=p.faceMaterials.length;I<O;)(E=p.faceMaterials[I++])&&c(m,k,q,s,p,E,D)}else E&&c(m,k,q,s,p,E,D)}}}}}};
-THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
-THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
-THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
+THREE.Projector=function(){function a(){var z=h[i]=h[i]||new THREE.RenderableVertex;i++;return z}function b(z,A){return A.z-z.z}function c(z,A){var O=0,w=1,P=z.z+z.w,N=A.z+A.w,E=-z.z+z.w,G=-A.z+A.w;if(P>=0&&N>=0&&E>=0&&G>=0)return!0;else if(P<0&&N<0||E<0&&G<0)return!1;else{if(P<0)O=Math.max(O,P/(P-N));else N<0&&(w=Math.min(w,P/(P-N)));if(E<0)O=Math.max(O,E/(E-G));else G<0&&(w=Math.min(w,E/(E-G)));if(w<O)return!1;else{z.lerpSelf(A,O);A.lerpSelf(z,1-w);return!0}}}var e,d,f=[],g,i,h=[],j,o,m=[],l,k,
+r=[],p,y,u=[],I=new THREE.Vector4,q=new THREE.Vector4,n=new THREE.Matrix4,D=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,M=new THREE.Vector4,R;this.projectVector=function(z,A){n.multiply(A.projectionMatrix,A.matrixWorldInverse);n.multiplyVector3(z);return z};this.unprojectVector=function(z,A){n.multiply(THREE.Matrix4.makeInvert(A.projectionMatrix),A.matrixWorld);n.multiplyVector3(z);return z};
+this.projectObjects=function(z,A,O){A=[];var w,P,N;d=0;P=z.objects;z=0;for(w=P.length;z<w;z++){N=P[z];var E;if(!(E=!N.visible))if(E=N instanceof THREE.Mesh){a:{E=void 0;for(var G=N.matrixWorld,B=-N.geometry.boundingSphere.radius*Math.max(N.scale.x,Math.max(N.scale.y,N.scale.z)),x=0;x<6;x++){E=H[x].x*G.n14+H[x].y*G.n24+H[x].z*G.n34+H[x].w;if(E<=B){E=!1;break a}}E=!0}E=!E}if(!E){E=f[d]=f[d]||new THREE.RenderableObject;d++;e=E;I.copy(N.position);n.multiplyVector3(I);e.object=N;e.z=I.z;A.push(e)}}O&&
+A.sort(b);return A};this.projectScene=function(z,A,O){var w=[],P=A.near,N=A.far,E,G,B,x,F,C,t,s,J,S,v,K,Q,T;y=k=o=0;A.matrixAutoUpdate&&A.updateMatrix();z.update(undefined,!1,A);n.multiply(A.projectionMatrix,A.matrixWorldInverse);H[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);H[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);H[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);H[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);H[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-
+n.n33,n.n44-n.n34);H[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);for(E=0;E<6;E++){F=H[E];F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z))}F=this.projectObjects(z,A,!0);z=0;for(E=F.length;z<E;z++){C=F[z].object;if(C.visible){t=C.matrixWorld;J=C.matrixRotationWorld;s=C.materials;i=0;if(C instanceof THREE.Mesh){S=C.geometry;v=S.vertices;K=S.faces;G=0;for(B=v.length;G<B;G++){g=a();g.positionWorld.copy(v[G].position);t.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);
+n.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>P&&g.positionScreen.z<N}G=0;for(B=K.length;G<B;G++){v=K[G];if(v instanceof THREE.Face3){x=h[v.a];Q=h[v.b];T=h[v.c];if(x.visible&&Q.visible&&T.visible&&(C.doubleSided||C.flipSided!=(T.positionScreen.x-x.positionScreen.x)*(Q.positionScreen.y-x.positionScreen.y)-(T.positionScreen.y-x.positionScreen.y)*(Q.positionScreen.x-x.positionScreen.x)<0)){var U=m[o]=m[o]||
+new THREE.RenderableFace3;o++;j=U;j.v1.copy(x);j.v2.copy(Q);j.v3.copy(T);j.normalWorld.copy(v.normal);J.multiplyVector3(j.normalWorld);j.centroidWorld.copy(v.centroid);t.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);n.multiplyVector3(j.centroidScreen);Q=v.vertexNormals;R=j.vertexNormalsWorld;for(x=0;x<3;x++){T=R[x];T.copy(Q[x]);J.multiplyVector3(T)}if(x=S.faceVertexUvs[0][G]){j.uvs[0]=x[0];j.uvs[1]=x[1];j.uvs[2]=x[2]}j.meshMaterials=s;j.faceMaterials=v.materials;j.z=j.centroidScreen.z;
+w.push(j)}}}}else if(C instanceof THREE.Line){D.multiply(n,t);v=C.geometry.vertices;x=a();x.positionScreen.copy(v[0].position);D.multiplyVector4(x.positionScreen);G=1;for(B=v.length;G<B;G++){x=a();x.positionScreen.copy(v[G].position);D.multiplyVector4(x.positionScreen);Q=h[i-2];L.copy(x.positionScreen);M.copy(Q.positionScreen);if(c(L,M)){L.multiplyScalar(1/L.w);M.multiplyScalar(1/M.w);t=r[k]=r[k]||new THREE.RenderableLine;k++;l=t;l.v1.positionScreen.copy(L);l.v2.positionScreen.copy(M);l.z=Math.max(L.z,
+M.z);l.materials=C.materials;w.push(l)}}}else if(C instanceof THREE.Particle){q.set(C.position.x,C.position.y,C.position.z,1);n.multiplyVector4(q);q.z/=q.w;if(q.z>0&&q.z<1){t=u[y]=u[y]||new THREE.RenderableParticle;y++;p=t;p.x=q.x/q.w;p.y=q.y/q.w;p.z=q.z;p.rotation=C.rotation.z;p.scale.x=C.scale.x*Math.abs(p.x-(q.x+A.projectionMatrix.n11)/(q.w+A.projectionMatrix.n14));p.scale.y=C.scale.y*Math.abs(p.y-(q.y+A.projectionMatrix.n22)/(q.w+A.projectionMatrix.n24));p.materials=C.materials;w.push(p)}}}}O&&
+w.sort(b);return w}};
+THREE.SVGRenderer=function(){function a(B,x,F){var C,t,s,J;C=0;for(t=B.lights.length;C<t;C++){s=B.lights[C];if(s instanceof THREE.DirectionalLight){J=x.normalWorld.dot(s.position)*s.intensity;if(J>0){F.r+=s.color.r*J;F.g+=s.color.g*J;F.b+=s.color.b*J}}else if(s instanceof THREE.PointLight){R.sub(s.position,x.centroidWorld);R.normalize();J=x.normalWorld.dot(R)*s.intensity;if(J>0){F.r+=s.color.r*J;F.g+=s.color.g*J;F.b+=s.color.b*J}}}}function b(B,x,F,C,t,s){w=e(P++);w.setAttribute("d","M "+B.positionScreen.x+
+" "+B.positionScreen.y+" L "+x.positionScreen.x+" "+x.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)q.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(I){n.r=D.r;n.g=D.g;n.b=D.b;a(s,C,n);q.r=t.color.r*n.r;q.g=t.color.g*n.g;q.b=t.color.b*n.b;q.updateStyleString()}else q.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){M=1-t.__2near/(t.__farPlusNear-C.z*t.__farMinusNear);
+q.setRGB(M,M,M)}else t instanceof THREE.MeshNormalMaterial&&q.setRGB(d(C.normalWorld.x),d(C.normalWorld.y),d(C.normalWorld.z));t.wireframe?w.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):w.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+t.opacity);i.appendChild(w)}function c(B,x,F,C,t,s,J){w=e(P++);w.setAttribute("d",
+"M "+B.positionScreen.x+" "+B.positionScreen.y+" L "+x.positionScreen.x+" "+x.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+"z");if(s instanceof THREE.MeshBasicMaterial)q.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshLambertMaterial)if(I){n.r=D.r;n.g=D.g;n.b=D.b;a(J,t,n);q.r=s.color.r*n.r;q.g=s.color.g*n.g;q.b=s.color.b*n.b;q.updateStyleString()}else q.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshDepthMaterial){M=
+1-s.__2near/(s.__farPlusNear-t.z*s.__farMinusNear);q.setRGB(M,M,M)}else s instanceof THREE.MeshNormalMaterial&&q.setRGB(d(t.normalWorld.x),d(t.normalWorld.y),d(t.normalWorld.z));s.wireframe?w.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+s.wireframeLinewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframeLinecap+"; stroke-linejoin: "+s.wireframeLinejoin):w.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+s.opacity);i.appendChild(w)}
+function e(B){if(z[B]==null){z[B]=document.createElementNS("http://www.w3.org/2000/svg","path");G==0&&z[B].setAttribute("shape-rendering","crispEdges")}return z[B]}function d(B){return B<0?Math.min((1+B)*0.5,0.5):0.5+Math.min(B*0.5,0.5)}var f=null,g=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,j,o,m,l,k,r,p,y=new THREE.Rectangle,u=new THREE.Rectangle,I=!1,q=new THREE.Color(16777215),n=new THREE.Color(16777215),D=new THREE.Color(0),H=new THREE.Color(0),L=new THREE.Color(0),
+M,R=new THREE.Vector3,z=[],A=[],O=[],w,P,N,E,G=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(B){switch(B){case "high":G=1;break;case "low":G=0}};this.setSize=function(B,x){h=B;j=x;o=h/2;m=j/2;i.setAttribute("viewBox",-o+" "+-m+" "+h+" "+j);i.setAttribute("width",h);i.setAttribute("height",j);y.set(-o,-m,o,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(B,x){var F,C,t,s,J,S,v,K;this.autoClear&&
+this.clear();f=g.projectScene(B,x,this.sortElements);E=N=P=0;if(I=B.lights.length>0){v=B.lights;D.setRGB(0,0,0);H.setRGB(0,0,0);L.setRGB(0,0,0);F=0;for(C=v.length;F<C;F++){t=v[F];s=t.color;if(t instanceof THREE.AmbientLight){D.r+=s.r;D.g+=s.g;D.b+=s.b}else if(t instanceof THREE.DirectionalLight){H.r+=s.r;H.g+=s.g;H.b+=s.b}else if(t instanceof THREE.PointLight){L.r+=s.r;L.g+=s.g;L.b+=s.b}}}F=0;for(C=f.length;F<C;F++){v=f[F];u.empty();if(v instanceof THREE.RenderableParticle){l=v;l.x*=o;l.y*=-m;t=0;
+for(s=v.materials.length;t<s;t++)if(K=v.materials[t]){J=l;S=v;var Q=N++;if(A[Q]==null){A[Q]=document.createElementNS("http://www.w3.org/2000/svg","circle");G==0&&A[Q].setAttribute("shape-rendering","crispEdges")}w=A[Q];w.setAttribute("cx",J.x);w.setAttribute("cy",J.y);w.setAttribute("r",S.scale.x*o);if(K instanceof THREE.ParticleCircleMaterial){if(I){n.r=D.r+H.r+L.r;n.g=D.g+H.g+L.g;n.b=D.b+H.b+L.b;q.r=K.color.r*n.r;q.g=K.color.g*n.g;q.b=K.color.b*n.b;q.updateStyleString()}else q=K.color;w.setAttribute("style",
+"fill: "+q.__styleString)}i.appendChild(w)}}else if(v instanceof THREE.RenderableLine){l=v.v1;k=v.v2;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);if(y.instersects(u)){t=0;for(s=v.materials.length;t<s;)if(K=v.materials[t++]){J=l;S=k;Q=E++;if(O[Q]==null){O[Q]=document.createElementNS("http://www.w3.org/2000/svg","line");G==0&&O[Q].setAttribute("shape-rendering",
+"crispEdges")}w=O[Q];w.setAttribute("x1",J.positionScreen.x);w.setAttribute("y1",J.positionScreen.y);w.setAttribute("x2",S.positionScreen.x);w.setAttribute("y2",S.positionScreen.y);if(K instanceof THREE.LineBasicMaterial){q.__styleString=K.color.__styleString;w.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+K.linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.linecap+"; stroke-linejoin: "+K.linejoin);i.appendChild(w)}}}}else if(v instanceof THREE.RenderableFace3){l=
+v.v1;k=v.v2;r=v.v3;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;r.positionScreen.x*=o;r.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);u.addPoint(r.positionScreen.x,r.positionScreen.y);if(y.instersects(u)){t=0;for(s=v.meshMaterials.length;t<s;){K=v.meshMaterials[t++];if(K instanceof THREE.MeshFaceMaterial){J=0;for(S=v.faceMaterials.length;J<S;)(K=v.faceMaterials[J++])&&b(l,k,r,v,
+K,B)}else K&&b(l,k,r,v,K,B)}}}else if(v instanceof THREE.RenderableFace4){l=v.v1;k=v.v2;r=v.v3;p=v.v4;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;r.positionScreen.x*=o;r.positionScreen.y*=-m;p.positionScreen.x*=o;p.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);u.addPoint(r.positionScreen.x,r.positionScreen.y);u.addPoint(p.positionScreen.x,p.positionScreen.y);if(y.instersects(u)){t=
+0;for(s=v.meshMaterials.length;t<s;){K=v.meshMaterials[t++];if(K instanceof THREE.MeshFaceMaterial){J=0;for(S=v.faceMaterials.length;J<S;)(K=v.faceMaterials[J++])&&c(l,k,r,p,v,K,B)}else K&&c(l,k,r,p,v,K,B)}}}}}};
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,d=c.length;for(e=0;e<d;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.uvs=[];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
+THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};

+ 176 - 179
build/custom/ThreeWebGL.js

@@ -1,91 +1,90 @@
 // ThreeWebGL.js r36 - http://github.com/mrdoob/three.js
 // ThreeWebGL.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,f,h,i,p,n;if(d==0)e=f=h=0;else{i=Math.floor(a*6);p=a*6-i;a=d*(1-b);n=d*(1-b*p);b=d*(1-b*(1-p));switch(i){case 1:e=n;f=d;h=a;break;case 2:e=a;f=d;h=b;break;case 3:e=a;f=n;h=d;break;case 4:e=b;f=a;h=d;break;case 5:e=d;f=a;h=n;break;case 6:case 0:e=d;f=b;h=a}}this.r=e;this.g=f;this.b=h;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,f,i,j,p,n;if(c==0)e=f=i=0;else{j=Math.floor(a*6);p=a*6-j;a=c*(1-b);n=c*(1-b*p);b=c*(1-b*(1-p));switch(j){case 1:e=n;f=c;i=a;break;case 2:e=a;f=c;i=b;break;case 3:e=a;f=n;i=c;break;case 4:e=b;f=a;i=c;break;case 5:e=c;f=a;i=n;break;case 6:case 0:e=c;f=b;i=a}}this.r=e;this.g=f;this.b=i;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
-this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,d){this.set(a||0,b||0,d||0)};
-THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
-b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.set(d*a.z-e*a.y,e*a.x-b*a.z,b*a.y-d*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
-a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
+this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
+THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
+b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.set(c*a.z-e*a.y,e*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
+a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
-1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,e||1)};
-THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
+1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
+THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,f=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(d)))}f.sort(function(h,i){return h.distance-i.distance});return f},intersectObject:function(a){function b(J,y,ja,V){V=V.clone().subSelf(y);ja=ja.clone().subSelf(y);var ka=J.clone().subSelf(y);J=V.dot(V);y=V.dot(ja);V=V.dot(ka);var ia=ja.dot(ja);ja=ja.dot(ka);ka=1/(J*ia-y*y);ia=(ia*V-y*ja)*ka;J=(J*ja-y*V)*ka;return ia>0&&J>0&&ia+J<1}var d,
-e,f,h,i,p,n,w,A,B,C,z=a.geometry,M=z.vertices,K=[];d=0;for(e=z.faces.length;d<e;d++){f=z.faces[d];B=this.origin.clone();C=this.direction.clone();n=a.matrixWorld;h=n.multiplyVector3(M[f.a].position.clone());i=n.multiplyVector3(M[f.b].position.clone());p=n.multiplyVector3(M[f.c].position.clone());n=f instanceof THREE.Face4?n.multiplyVector3(M[f.d].position.clone()):null;w=a.matrixRotationWorld.multiplyVector3(f.normal.clone());A=C.dot(w);if(A<0){w=w.dot((new THREE.Vector3).sub(h,B))/A;B=B.addSelf(C.multiplyScalar(w));
-if(f instanceof THREE.Face3){if(b(B,h,i,p)){f={distance:this.origin.distanceTo(B),point:B,face:f,object:a};K.push(f)}}else if(f instanceof THREE.Face4&&(b(B,h,i,n)||b(B,i,p,n))){f={distance:this.origin.distanceTo(B),point:B,face:f,object:a};K.push(f)}}}return K}};
-THREE.Rectangle=function(){function a(){h=e-b;i=f-d}var b,d,e,f,h,i,p=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(n,w,A,B){p=!1;b=n;d=w;e=A;f=B;a()};this.addPoint=function(n,w){if(p){p=!1;b=n;d=w;e=n;f=w}else{b=b<n?b:n;d=d<w?d:w;e=e>n?e:n;f=f>w?f:w}a()};
-this.add3Points=function(n,w,A,B,C,z){if(p){p=!1;b=n<A?n<C?n:C:A<C?A:C;d=w<B?w<z?w:z:B<z?B:z;e=n>A?n>C?n:C:A>C?A:C;f=w>B?w>z?w:z:B>z?B:z}else{b=n<A?n<C?n<b?n:b:C<b?C:b:A<C?A<b?A:b:C<b?C:b;d=w<B?w<z?w<d?w:d:z<d?z:d:B<z?B<d?B:d:z<d?z:d;e=n>A?n>C?n>e?n:e:C>e?C:e:A>C?A>e?A:e:C>e?C:e;f=w>B?w>z?w>f?w:f:z>f?z:f:B>z?B>f?B:f:z>f?z:f}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();d=n.getTop();e=n.getRight();f=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();d=d<n.getTop()?d:n.getTop();e=e>n.getRight()?
-e:n.getRight();f=f>n.getBottom()?f:n.getBottom()}a()};this.inflate=function(n){b-=n;d-=n;e+=n;f+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();d=d>n.getTop()?d:n.getTop();e=e<n.getRight()?e:n.getRight();f=f<n.getBottom()?f:n.getBottom();a()};this.instersects=function(n){return Math.min(e,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(f,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){p=!0;f=e=d=b=0;a()};this.isEmpty=function(){return p}};
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,f=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(i,j){return i.distance-j.distance});return f},intersectObject:function(a){function b(M,O,ia,R){R=R.clone().subSelf(O);ia=ia.clone().subSelf(O);var B=M.clone().subSelf(O);M=R.dot(R);O=R.dot(ia);R=R.dot(B);var la=ia.dot(ia);ia=ia.dot(B);B=1/(M*la-O*O);la=(la*R-O*ia)*B;M=(M*ia-O*R)*B;return la>0&&M>0&&la+M<1}var c,e,
+f,i,j,p,n,s,z,A,D,y=a.geometry,K=y.vertices,H=[];c=0;for(e=y.faces.length;c<e;c++){f=y.faces[c];A=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;i=n.multiplyVector3(K[f.a].position.clone());j=n.multiplyVector3(K[f.b].position.clone());p=n.multiplyVector3(K[f.c].position.clone());n=f instanceof THREE.Face4?n.multiplyVector3(K[f.d].position.clone()):null;s=a.matrixRotationWorld.multiplyVector3(f.normal.clone());z=D.dot(s);if(z<0){s=s.dot((new THREE.Vector3).sub(i,A))/z;A=A.addSelf(D.multiplyScalar(s));
+if(f instanceof THREE.Face3){if(b(A,i,j,p)){f={distance:this.origin.distanceTo(A),point:A,face:f,object:a};H.push(f)}}else if(f instanceof THREE.Face4&&(b(A,i,j,n)||b(A,j,p,n))){f={distance:this.origin.distanceTo(A),point:A,face:f,object:a};H.push(f)}}}return H}};
+THREE.Rectangle=function(){function a(){i=e-b;j=f-c}var b,c,e,f,i,j,p=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(n,s,z,A){p=!1;b=n;c=s;e=z;f=A;a()};this.addPoint=function(n,s){if(p){p=!1;b=n;c=s;e=n;f=s}else{b=b<n?b:n;c=c<s?c:s;e=e>n?e:n;f=f>s?f:s}a()};
+this.add3Points=function(n,s,z,A,D,y){if(p){p=!1;b=n<z?n<D?n:D:z<D?z:D;c=s<A?s<y?s:y:A<y?A:y;e=n>z?n>D?n:D:z>D?z:D;f=s>A?s>y?s:y:A>y?A:y}else{b=n<z?n<D?n<b?n:b:D<b?D:b:z<D?z<b?z:b:D<b?D:b;c=s<A?s<y?s<c?s:c:y<c?y:c:A<y?A<c?A:c:y<c?y:c;e=n>z?n>D?n>e?n:e:D>e?D:e:z>D?z>e?z:e:D>e?D:e;f=s>A?s>y?s>f?s:f:y>f?y:f:A>y?A>f?A:f:y>f?y:f}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();c=n.getTop();e=n.getRight();f=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();c=c<n.getTop()?c:n.getTop();e=e>n.getRight()?
+e:n.getRight();f=f>n.getBottom()?f:n.getBottom()}a()};this.inflate=function(n){b-=n;c-=n;e+=n;f+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();c=c>n.getTop()?c:n.getTop();e=e<n.getRight()?e:n.getRight();f=f<n.getBottom()?f:n.getBottom();a()};this.instersects=function(n){return Math.min(e,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(f,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){p=!0;f=e=c=b=0;a()};this.isEmpty=function(){return p}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,d,e,f,h,i,p,n,w,A,B,C,z,M,K){this.set(a||1,b||0,d||0,e||0,f||0,h||1,i||0,p||0,n||0,w||0,A||1,B||0,C||0,z||0,M||0,K||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,d,e,f,h,i,p,n,w,A,B,C,z,M,K){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=p;this.n31=n;this.n32=w;this.n33=A;this.n34=B;this.n41=C;this.n42=z;this.n43=M;this.n44=K;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__v1,
-f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(d,h).normalize();if(e.length()===0){h.x+=1.0E-4;e.cross(d,h).normalize()}f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,f=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*d+this.n23*
-e+this.n24)*f;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,d=a.y,e=a.z;a.x=b*this.n11+d*this.n12+e*this.n13;a.y=b*this.n21+d*this.n22+e*this.n23;a.z=b*this.n31+d*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,p=a.n22,n=a.n23,w=a.n24,A=a.n31,B=a.n32,C=a.n33,z=a.n34,M=a.n41,K=a.n42,J=a.n43,y=a.n44,ja=b.n11,V=b.n12,ka=b.n13,ia=b.n14,la=b.n21,Q=b.n22,
-c=b.n23,ma=b.n24,Z=b.n31,oa=b.n32,$=b.n33,U=b.n34;this.n11=d*ja+e*la+f*Z;this.n12=d*V+e*Q+f*oa;this.n13=d*ka+e*c+f*$;this.n14=d*ia+e*ma+f*U+h;this.n21=i*ja+p*la+n*Z;this.n22=i*V+p*Q+n*oa;this.n23=i*ka+p*c+n*$;this.n24=i*ia+p*ma+n*U+w;this.n31=A*ja+B*la+C*Z;this.n32=A*V+B*Q+C*oa;this.n33=A*ka+B*c+C*$;this.n34=A*ia+B*ma+C*U+z;this.n41=M*ja+K*la+J*Z;this.n42=M*V+K*Q+J*oa;this.n43=M*ka+K*c+J*$;this.n44=M*ia+K*ma+J*U+y;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;d[1]=
-this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
-a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,p=this.n24,n=this.n31,w=this.n32,A=this.n33,B=this.n34,C=this.n41,z=this.n42,M=this.n43,K=this.n44;return e*i*w*C-d*p*w*C-e*h*A*C+b*p*A*C+d*h*B*C-b*i*B*C-e*i*n*z+d*p*n*z+e*f*A*z-a*p*A*z-d*f*B*z+a*i*B*z+e*h*n*M-b*p*n*M-e*f*w*M+a*p*w*M+b*f*B*M-a*h*B*M-d*h*n*K+b*i*n*K+d*f*w*K-a*i*w*K-b*f*A*K+a*h*A*K},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
+THREE.Matrix4=function(a,b,c,e,f,i,j,p,n,s,z,A,D,y,K,H){this.set(a||1,b||0,c||0,e||0,f||0,i||1,j||0,p||0,n||0,s||0,z||1,A||0,D||0,y||0,K||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,f,i,j,p,n,s,z,A,D,y,K,H){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=i;this.n23=j;this.n24=p;this.n31=n;this.n32=s;this.n33=z;this.n34=A;this.n41=D;this.n42=y;this.n43=K;this.n44=H;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
+f=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(a,b).normalize();if(i.length()===0)i.z=1;e.cross(c,i).normalize();if(e.length()===0){i.x+=1.0E-4;e.cross(c,i).normalize()}f.cross(i,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=i.x;this.n21=e.y;this.n22=f.y;this.n23=i.y;this.n31=e.z;this.n32=f.z;this.n33=i.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*
+e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,z=a.n31,A=a.n32,D=a.n33,y=a.n34,K=a.n41,H=a.n42,M=a.n43,O=a.n44,ia=b.n11,R=b.n12,B=b.n13,la=b.n14,V=b.n21,ma=b.n22,
+d=b.n23,Ea=b.n24,N=b.n31,P=b.n32,sa=b.n33,ja=b.n34;this.n11=c*ia+e*V+f*N;this.n12=c*R+e*ma+f*P;this.n13=c*B+e*d+f*sa;this.n14=c*la+e*Ea+f*ja+i;this.n21=j*ia+p*V+n*N;this.n22=j*R+p*ma+n*P;this.n23=j*B+p*d+n*sa;this.n24=j*la+p*Ea+n*ja+s;this.n31=z*ia+A*V+D*N;this.n32=z*R+A*ma+D*P;this.n33=z*B+A*d+D*sa;this.n34=z*la+A*Ea+D*ja+y;this.n41=K*ia+H*V+M*N;this.n42=K*R+H*ma+M*P;this.n43=K*B+H*d+M*sa;this.n44=K*la+H*Ea+M*ja+O;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=
+this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
+a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,i=this.n22,j=this.n23,p=this.n24,n=this.n31,s=this.n32,z=this.n33,A=this.n34,D=this.n41,y=this.n42,K=this.n43,H=this.n44;return e*j*s*D-c*p*s*D-e*i*z*D+b*p*z*D+c*i*A*D-b*j*A*D-e*j*n*y+c*p*n*y+e*f*z*y-a*p*z*y-c*f*A*y+a*j*A*y+e*i*n*K-b*p*n*K-e*f*s*K+a*p*s*K+b*f*A*K-a*i*A*K-c*i*n*H+b*j*n*H+c*f*s*H-a*j*s*H-b*f*z*H+a*i*z*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
 this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
 this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
-a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,
-0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),f=
-1-d,h=a.x,i=a.y,p=a.z,n=f*h,w=f*i;this.set(n*h+d,n*i-e*p,n*p+e*i,0,n*i+e*p,w*i+d,w*p-e*h,0,n*p-e*i,w*p+e*h,f*p*p+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);var i=a*d,p=b*d;this.n11=f*h;this.n12=-f*e;this.n13=d;this.n21=p*h+a*e;this.n22=-p*e+a*h;this.n23=-b*f;this.n31=-i*h+b*e;this.n32=i*e+b*h;this.n33=
-a*f;return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,f=a.w,h=b+b,i=d+d,p=e+e;a=b*h;var n=b*i;b*=p;var w=d*i;d*=p;e*=p;h*=f;i*=f;f*=p;this.n11=1-(w+e);this.n12=n-f;this.n13=b+i;this.n21=n+f;this.n22=1-(a+e);this.n23=d-h;this.n31=b-i;this.n32=d+h;this.n33=1-(a+w);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
-a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var d=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,p=a.n22,n=a.n23,w=a.n24,A=a.n31,B=a.n32,C=a.n33,z=a.n34,M=a.n41,K=a.n42,J=a.n43,y=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*z*K-w*C*K+w*B*J-p*z*J-n*B*y+p*C*y;b.n12=h*C*K-f*z*K-h*B*J+e*z*J+f*B*y-e*C*y;b.n13=f*w*K-h*n*K+h*p*J-e*w*J-f*p*y+e*n*y;b.n14=h*n*B-f*w*B-h*p*C+e*w*C+f*p*z-e*n*z;b.n21=w*C*M-n*z*M-w*A*J+i*z*J+n*A*y-i*C*y;b.n22=f*z*M-h*C*M+h*A*J-d*z*J-f*A*y+d*C*y;b.n23=h*n*M-f*w*M-h*i*J+d*w*J+f*i*y-d*n*y;
-b.n24=f*w*A-h*n*A+h*i*C-d*w*C-f*i*z+d*n*z;b.n31=p*z*M-w*B*M+w*A*K-i*z*K-p*A*y+i*B*y;b.n32=h*B*M-e*z*M-h*A*K+d*z*K+e*A*y-d*B*y;b.n33=f*w*M-h*p*M+h*i*K-d*w*K-e*i*y+d*p*y;b.n34=h*p*A-e*w*A-h*i*B+d*w*B+e*i*z-d*p*z;b.n41=n*B*M-p*C*M-n*A*K+i*C*K+p*A*J-i*B*J;b.n42=e*C*M-f*B*M+f*A*K-d*C*K-e*A*J+d*B*J;b.n43=f*p*M-e*n*M-f*i*K+d*n*K+e*i*J-d*p*J;b.n44=e*n*A-f*p*A+f*i*B-d*n*B-e*i*C+d*p*C;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,w=a.n23*a.n12-a.n22*a.n13,A=-a.n23*a.n11+a.n21*a.n13,B=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*i+a.n31*w;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*f;d[2]=a*h;d[3]=a*i;d[4]=a*p;d[5]=a*n;d[6]=a*w;d[7]=a*A;d[8]=a*B;return b};
-THREE.Matrix4.makeFrustum=function(a,b,d,e,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-d);i.n23=(e+d)/(e-d);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,d,e)};
-THREE.Matrix4.makeOrtho=function(a,b,d,e,f,h){var i,p,n,w;i=new THREE.Matrix4;p=b-a;n=d-e;w=h-f;i.n11=2/p;i.n12=0;i.n13=0;i.n14=-((b+a)/p);i.n21=0;i.n22=2/n;i.n23=0;i.n24=-((d+e)/n);i.n31=0;i.n32=0;i.n33=-2/w;i.n34=-((h+f)/w);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,
+0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=
+1-c,i=a.x,j=a.y,p=a.z,n=f*i,s=f*j;this.set(n*i+c,n*j-e*p,n*p+e*j,0,n*j+e*p,s*j+c,s*p-e*i,0,n*p-e*j,s*p+e*i,f*p*p+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var i=Math.cos(e);e=Math.sin(e);var j=a*c,p=b*c;this.n11=f*i;this.n12=-f*e;this.n13=c;this.n21=p*i+a*e;this.n22=-p*e+a*i;this.n23=-b*f;this.n31=-j*i+b*e;this.n32=j*e+b*i;this.n33=
+a*f;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,i=b+b,j=c+c,p=e+e;a=b*i;var n=b*j;b*=p;var s=c*j;c*=p;e*=p;i*=f;j*=f;f*=p;this.n11=1-(s+e);this.n12=n-f;this.n13=b+j;this.n21=n+f;this.n22=1-(a+e);this.n23=c-i;this.n31=b-j;this.n32=c+i;this.n33=1-(a+s);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
+a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,z=a.n31,A=a.n32,D=a.n33,y=a.n34,K=a.n41,H=a.n42,M=a.n43,O=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*y*H-s*D*H+s*A*M-p*y*M-n*A*O+p*D*O;b.n12=i*D*H-f*y*H-i*A*M+e*y*M+f*A*O-e*D*O;b.n13=f*s*H-i*n*H+i*p*M-e*s*M-f*p*O+e*n*O;b.n14=i*n*A-f*s*A-i*p*D+e*s*D+f*p*y-e*n*y;b.n21=s*D*K-n*y*K-s*z*M+j*y*M+n*z*O-j*D*O;b.n22=f*y*K-i*D*K+i*z*M-c*y*M-f*z*O+c*D*O;b.n23=i*n*K-f*s*K-i*j*M+c*s*M+f*j*O-c*n*O;
+b.n24=f*s*z-i*n*z+i*j*D-c*s*D-f*j*y+c*n*y;b.n31=p*y*K-s*A*K+s*z*H-j*y*H-p*z*O+j*A*O;b.n32=i*A*K-e*y*K-i*z*H+c*y*H+e*z*O-c*A*O;b.n33=f*s*K-i*p*K+i*j*H-c*s*H-e*j*O+c*p*O;b.n34=i*p*z-e*s*z-i*j*A+c*s*A+e*j*y-c*p*y;b.n41=n*A*K-p*D*K-n*z*H+j*D*H+p*z*M-j*A*M;b.n42=e*D*K-f*A*K+f*z*H-c*D*H-e*z*M+c*A*M;b.n43=f*p*K-e*n*K-f*j*H+c*n*H+e*j*M-c*p*M;b.n44=e*n*z-f*p*z+f*j*A-c*n*A-e*j*D+c*p*D;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,s=a.n23*a.n12-a.n22*a.n13,z=-a.n23*a.n11+a.n21*a.n13,A=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*s;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*i;c[3]=a*j;c[4]=a*p;c[5]=a*n;c[6]=a*s;c[7]=a*z;c[8]=a*A;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,e,f,i){var j;j=new THREE.Matrix4;j.n11=2*f/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*f/(e-c);j.n23=(e+c)/(e-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+f)/(i-f);j.n34=-2*i*f/(i-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,c,e){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
+THREE.Matrix4.makeOrtho=function(a,b,c,e,f,i){var j,p,n,s;j=new THREE.Matrix4;p=b-a;n=c-e;s=i-f;j.n11=2/p;j.n12=0;j.n13=0;j.n14=-((b+a)/p);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+e)/n);j.n31=0;j.n32=0;j.n33=-2/s;j.n34=-((i+f)/s);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={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(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 THREE.Object3D.prototype={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(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
-1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
-b,d)}};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)};
-THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,f=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var i=a*b,p=e*f;this.w=i*h-p*d;this.x=i*d+p*h;this.y=e*b*h+a*f*d;this.z=a*f*h-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,f=this.w,h=a.x,i=a.y,p=a.z;a=a.w;this.x=b*a+f*h+d*p-e*i;this.y=d*a+f*i+e*h-b*p;this.z=e*a+f*p+b*i-d*h;this.w=f*a-b*h-d*i-e*p;return this},
-multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,f=a.z,h=this.x,i=this.y,p=this.z,n=this.w,w=n*d+i*f-p*e,A=n*e+p*d-h*f,B=n*f+h*e-i*d;d=-h*d-i*e-p*f;b.x=w*n+d*-h+A*-p-B*-i;b.y=A*n+d*-i+B*-h-w*-p;b.z=B*n+d*-p+w*-i-A*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,d,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}f=Math.sin((1-e)*h)/i;e=Math.sin(e*h)/i;d.w=a.w*f+b.w*e;d.x=a.x*f+b.x*e;d.y=a.y*f+b.y*e;d.z=a.z*f+b.z*e;return d};
-THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,b,d,e,f,h){this.a=a;this.b=b;this.c=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.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,d,e,f,h,i){this.a=a;this.b=b;this.c=d;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
-THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[];this.faceVertexUvs=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
-THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,f,h,i,p=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.vertices.length;e<f;e++){h=this.vertices[e];h.normal.set(0,0,0)}e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){p.set(0,0,0);b=0;for(d=h.vertexNormals.length;b<d;b++)p.addSelf(h.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[h.a];d=this.vertices[h.b];i=this.vertices[h.c];p.sub(i.position,
-d.position);n.sub(b.position,d.position);p.crossSelf(n)}p.isZero()||p.normalize();h.normal.copy(p)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
-new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(U,R,Da,N,na,ya,S){h=U.vertices[R].position;i=U.vertices[Da].position;p=U.vertices[N].position;n=f[na];w=f[ya];A=f[S];B=i.x-h.x;C=p.x-h.x;z=i.y-h.y;M=p.y-
-h.y;K=i.z-h.z;J=p.z-h.z;y=w.u-n.u;ja=A.u-n.u;V=w.v-n.v;ka=A.v-n.v;ia=1/(y*ka-ja*V);c.set((ka*B-V*C)*ia,(ka*z-V*M)*ia,(ka*K-V*J)*ia);ma.set((y*C-ja*B)*ia,(y*M-ja*z)*ia,(y*J-ja*K)*ia);la[R].addSelf(c);la[Da].addSelf(c);la[N].addSelf(c);Q[R].addSelf(ma);Q[Da].addSelf(ma);Q[N].addSelf(ma)}var b,d,e,f,h,i,p,n,w,A,B,C,z,M,K,J,y,ja,V,ka,ia,la=[],Q=[],c=new THREE.Vector3,ma=new THREE.Vector3,Z=new THREE.Vector3,oa=new THREE.Vector3,$=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){la[b]=new THREE.Vector3;
-Q[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];f=this.faceVertexUvs[b][0];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){$.copy(this.vertices[b].normal);e=la[b];Z.copy(e);Z.subSelf($.multiplyScalar($.dot(e))).normalize();oa.cross(this.vertices[b].normal,e);e=oa.dot(Q[b]);e=e<0?-1:1;this.vertices[b].tangent.set(Z.x,Z.y,Z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
-z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
-this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.AnimationHandler=function(){var a=[],b={},d={};d.update=function(f){for(var h=0;h<a.length;h++)a[h].update(f)};d.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};d.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};d.add=function(f){b[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");b[f.name]=f;if(f.initialized!==!0){for(var h=0;h<f.hierarchy.length;h++){for(var i=0;i<f.hierarchy[h].keys.length;i++){if(f.hierarchy[h].keys[i].time<
-0)f.hierarchy[h].keys[i].time=0;if(f.hierarchy[h].keys[i].rot!==undefined&&!(f.hierarchy[h].keys[i].rot instanceof THREE.Quaternion)){var p=f.hierarchy[h].keys[i].rot;f.hierarchy[h].keys[i].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(f.hierarchy[h].keys[0].morphTargets!==undefined){p={};for(i=0;i<f.hierarchy[h].keys.length;i++)for(var n=0;n<f.hierarchy[h].keys[i].morphTargets.length;n++){var w=f.hierarchy[h].keys[i].morphTargets[n];p[w]=-1}f.hierarchy[h].usedMorphTargets=p;for(i=0;i<f.hierarchy[h].keys.length;i++){var A=
-{};for(w in p){for(n=0;n<f.hierarchy[h].keys[i].morphTargets.length;n++)if(f.hierarchy[h].keys[i].morphTargets[n]===w){A[w]=f.hierarchy[h].keys[i].morphTargetsInfluences[n];break}n===f.hierarchy[h].keys[i].morphTargets.length&&(A[w]=0)}f.hierarchy[h].keys[i].morphTargetsInfluences=A}}for(i=1;i<f.hierarchy[h].keys.length;i++)if(f.hierarchy[h].keys[i].time===f.hierarchy[h].keys[i-1].time){f.hierarchy[h].keys.splice(i,1);i--}for(i=1;i<f.hierarchy[h].keys.length;i++)f.hierarchy[h].keys[i].index=i}i=parseInt(f.length*
-f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(h=0;h<f.hierarchy.length;h++)f.JIT.hierarchy.push(Array(i));f.initialized=!0}};d.get=function(f){if(typeof f==="string")if(b[f])return b[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};d.parse=function(f){var h=[];if(f instanceof THREE.SkinnedMesh)for(var i=0;i<f.bones.length;i++)h.push(f.bones[i]);else e(f,h);return h};var e=function(f,h){h.push(f);for(var i=0;i<f.children.length;i++)e(f.children[i],h)};d.LINEAR=
-0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(a,b,d,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var d,e=this.hierarchy.length,f;for(d=0;d<e;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
-f instanceof THREE.Bone?f.skinMatrix:f.matrix}var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[d].keys[0];h.rot=this.data.hierarchy[d].keys[0];h.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
+b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
+THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-f);f=Math.sin(-f);var i=Math.cos(c);c=Math.sin(c);var j=a*b,p=e*f;this.w=j*i-p*c;this.x=j*c+p*i;this.y=e*b*i+a*f*c;this.z=a*f*i-e*b*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*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,f=this.w,i=a.x,j=a.y,p=a.z;a=a.w;this.x=b*a+f*i+c*p-e*j;this.y=c*a+f*j+e*i-b*p;this.z=e*a+f*p+b*j-c*i;this.w=f*a-b*i-c*j-e*p;return this},
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,i=this.x,j=this.y,p=this.z,n=this.w,s=n*c+j*f-p*e,z=n*e+p*c-i*f,A=n*f+i*e-j*c;c=-i*c-j*e-p*f;b.x=s*n+c*-i+z*-p-A*-j;b.y=z*n+c*-j+A*-i-s*-p;b.z=A*n+c*-p+s*-j-z*-i;return b}};
+THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var i=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-e)*i)/j;e=Math.sin(e*i)/j;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,e,f,i){this.a=a;this.b=b;this.c=c;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.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,e,f,i,j){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
+THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Geometry.prototype={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].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,f,i,j,p=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){i=this.faces[e];if(a&&i.vertexNormals.length){p.set(0,0,0);b=0;for(c=i.vertexNormals.length;b<c;b++)p.addSelf(i.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[i.a];c=this.vertices[i.b];j=this.vertices[i.c];p.sub(j.position,c.position);n.sub(b.position,c.position);p.crossSelf(n)}p.isZero()||
+p.normalize();i.normal.copy(p)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[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{e=
+this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[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(e[c.a]);
+c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(ja,wa,na,U,ca,Ga,T){i=ja.vertices[wa].position;j=ja.vertices[na].position;p=ja.vertices[U].position;n=f[ca];s=f[Ga];z=f[T];A=j.x-i.x;D=p.x-i.x;y=j.y-i.y;K=p.y-i.y;H=j.z-i.z;M=p.z-i.z;O=s.u-n.u;ia=z.u-n.u;R=s.v-n.v;B=z.v-n.v;la=1/(O*B-
+ia*R);d.set((B*A-R*D)*la,(B*y-R*K)*la,(B*H-R*M)*la);Ea.set((O*D-ia*A)*la,(O*K-ia*y)*la,(O*M-ia*H)*la);V[wa].addSelf(d);V[na].addSelf(d);V[U].addSelf(d);ma[wa].addSelf(Ea);ma[na].addSelf(Ea);ma[U].addSelf(Ea)}var b,c,e,f,i,j,p,n,s,z,A,D,y,K,H,M,O,ia,R,B,la,V=[],ma=[],d=new THREE.Vector3,Ea=new THREE.Vector3,N=new THREE.Vector3,P=new THREE.Vector3,sa=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){V[b]=new THREE.Vector3;ma[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];
+f=this.faceVertexUvs[b][0];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=
+0;for(c=this.vertices.length;b<c;b++){sa.copy(this.vertices[b].normal);e=V[b];N.copy(e);N.subSelf(sa.multiplyScalar(sa.dot(e))).normalize();P.cross(this.vertices[b].normal,e);e=P.dot(ma[b]);e=e<0?-1:1;this.vertices[b].tangent.set(N.x,N.y,N.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};
+for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=
+a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
+THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(f){for(var i=0;i<a.length;i++)a[i].update(f)};c.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};c.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};c.add=function(f){b[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");b[f.name]=f;if(f.initialized!==!0){for(var i=0;i<f.hierarchy.length;i++){for(var j=0;j<f.hierarchy[i].keys.length;j++){if(f.hierarchy[i].keys[j].time<
+0)f.hierarchy[i].keys[j].time=0;if(f.hierarchy[i].keys[j].rot!==undefined&&!(f.hierarchy[i].keys[j].rot instanceof THREE.Quaternion)){var p=f.hierarchy[i].keys[j].rot;f.hierarchy[i].keys[j].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(f.hierarchy[i].keys[0].morphTargets!==undefined){p={};for(j=0;j<f.hierarchy[i].keys.length;j++)for(var n=0;n<f.hierarchy[i].keys[j].morphTargets.length;n++){var s=f.hierarchy[i].keys[j].morphTargets[n];p[s]=-1}f.hierarchy[i].usedMorphTargets=p;for(j=0;j<f.hierarchy[i].keys.length;j++){var z=
+{};for(s in p){for(n=0;n<f.hierarchy[i].keys[j].morphTargets.length;n++)if(f.hierarchy[i].keys[j].morphTargets[n]===s){z[s]=f.hierarchy[i].keys[j].morphTargetsInfluences[n];break}n===f.hierarchy[i].keys[j].morphTargets.length&&(z[s]=0)}f.hierarchy[i].keys[j].morphTargetsInfluences=z}}for(j=1;j<f.hierarchy[i].keys.length;j++)if(f.hierarchy[i].keys[j].time===f.hierarchy[i].keys[j-1].time){f.hierarchy[i].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[i].keys.length;j++)f.hierarchy[i].keys[j].index=j}j=parseInt(f.length*
+f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(i=0;i<f.hierarchy.length;i++)f.JIT.hierarchy.push(Array(j));f.initialized=!0}};c.get=function(f){if(typeof f==="string")if(b[f])return b[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};c.parse=function(f){var i=[];if(f instanceof THREE.SkinnedMesh)for(var j=0;j<f.bones.length;j++)i.push(f.bones[j]);else e(f,i);return i};var e=function(f,i){i.push(f);for(var j=0;j<f.children.length;j++)e(f.children[j],i)};c.LINEAR=
+0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,f;for(c=0;c<e;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
+f instanceof THREE.Bone?f.skinMatrix:f.matrix}var i=f.animationCache.prevKey;f=f.animationCache.nextKey;i.pos=this.data.hierarchy[c].keys[0];i.rot=this.data.hierarchy[c].keys[0];i.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],d,e,f,h,i,p,n,w,A=this.data.JIT.hierarchy,B,C;this.currentTime+=a*this.timeScale;C=this.currentTime;B=this.currentTime%=this.data.length;w=parseInt(Math.min(B*this.data.fps,this.data.length*this.data.fps),10);for(var z=0,M=this.hierarchy.length;z<M;z++){a=this.hierarchy[z];n=a.animationCache;if(this.JITCompile&&A[z][w]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=A[z][w];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=A[z][w];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var K=0;K<3;K++){d=b[K];i=n.prevKey[d];p=n.nextKey[d];if(p.time<=C){if(B<C)if(this.loop){i=this.data.hierarchy[z].keys[0];for(p=this.getNextKeyWith(d,z,1);p.time<B;){i=p;p=this.getNextKeyWith(d,z,p.index+1)}}else{this.stop();return}else{do{i=p;p=this.getNextKeyWith(d,z,p.index+1)}while(p.time<
-B)}n.prevKey[d]=i;n.nextKey[d]=p}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(B-i.time)/(p.time-i.time);f=i[d];h=p[d];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+z);e=e<0?0:1}if(d==="pos"){d=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=f[0]+(h[0]-f[0])*e;d.y=f[1]+(h[1]-f[1])*e;d.z=f[2]+(h[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",z,i.index-1).pos;this.points[1]=f;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",z,p.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);d.x=f[0];d.y=f[1];d.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(d===
-"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(d==="scl"){d=a.scale;d.x=f[0]+(h[0]-f[0])*e;d.y=f[1]+(h[1]-f[1])*e;d.z=f[2]+(h[2]-f[2])*e}}}}if(this.JITCompile&&A[0][w]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;z<this.hierarchy.length;z++)A[z][w]=this.hierarchy[z]instanceof THREE.Bone?this.hierarchy[z].skinMatrix.clone():this.hierarchy[z].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var d=[],e=[],f,h,i,p,n,w;f=(a.length-1)*b;h=Math.floor(f);f-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>a.length-2?h:h+1;d[3]=h>a.length-3?h:h+2;h=a[d[0]];p=a[d[1]];n=a[d[2]];w=a[d[3]];d=f*f;i=f*d;e[0]=this.interpolate(h[0],p[0],n[0],w[0],f,d,i);e[1]=this.interpolate(h[1],p[1],n[1],w[1],f,d,i);e[2]=this.interpolate(h[2],p[2],n[2],w[2],f,d,i);return e};
-THREE.Animation.prototype.interpolate=function(a,b,d,e,f,h,i){a=(d-a)*0.5;e=(e-b)*0.5;return(2*(b-d)+a+e)*i+(-3*(b-d)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,d){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<e.length-1?d:e.length-1;else d%=e.length;for(;d<e.length;d++)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,d){var e=this.data.hierarchy[b].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[e.length-1]};
-THREE.Camera=function(a,b,d,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,i,j,p,n,s,z=this.data.JIT.hierarchy,A,D;this.currentTime+=a*this.timeScale;D=this.currentTime;A=this.currentTime%=this.data.length;s=parseInt(Math.min(A*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,K=this.hierarchy.length;y<K;y++){a=this.hierarchy[y];n=a.animationCache;if(this.JITCompile&&z[y][s]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=z[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=z[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var H=0;H<3;H++){c=b[H];j=n.prevKey[c];p=n.nextKey[c];if(p.time<=D){if(A<D)if(this.loop){j=this.data.hierarchy[y].keys[0];for(p=this.getNextKeyWith(c,y,1);p.time<A;){j=p;p=this.getNextKeyWith(c,y,p.index+1)}}else{this.stop();return}else{do{j=p;p=this.getNextKeyWith(c,y,p.index+1)}while(p.time<
+A)}n.prevKey[c]=j;n.nextKey[c]=p}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(A-j.time)/(p.time-j.time);f=j[c];i=p[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+y);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+(i[0]-f[0])*e;c.y=f[1]+(i[1]-f[1])*e;c.z=f[2]+(i[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",y,j.index-1).pos;this.points[1]=f;this.points[2]=i;this.points[3]=this.getNextKeyWith("pos",y,p.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);c.x=f[0];c.y=f[1];c.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
+"rot")THREE.Quaternion.slerp(f,i,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=f[0]+(i[0]-f[0])*e;c.y=f[1]+(i[1]-f[1])*e;c.z=f[2]+(i[2]-f[2])*e}}}}if(this.JITCompile&&z[0][s]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)z[y][s]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,i,j,p,n,s;f=(a.length-1)*b;i=Math.floor(f);f-=i;c[0]=i==0?i:i-1;c[1]=i;c[2]=i>a.length-2?i:i+1;c[3]=i>a.length-3?i:i+2;i=a[c[0]];p=a[c[1]];n=a[c[2]];s=a[c[3]];c=f*f;j=f*c;e[0]=this.interpolate(i[0],p[0],n[0],s[0],f,c,j);e[1]=this.interpolate(i[1],p[1],n[1],s[1],f,c,j);e[2]=this.interpolate(i[2],p[2],n[2],s[2],f,c,j);return e};
+THREE.Animation.prototype.interpolate=function(a,b,c,e,f,i,j){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*j+(-3*(b-c)-2*a-e)*i+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
+THREE.Camera=function(a,b,c,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
-THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
-!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
+THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.FlatShading=0;THREE.SmoothShading=1;THREE.MaterialColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
+THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
 THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
@@ -109,51 +108,48 @@ THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.
 undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;
 undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;
 if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
 if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
-a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
-THREE.Texture=function(a,b,d,e,f,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
+a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
+THREE.Texture=function(a,b,c,e,f,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=i!==undefined?i:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
-THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var b,d,e,f={};for(b in a){f[b]={};for(d in a[b]){e=a[b][d];f[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return f},merge:function(a){var b,d,e,f={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)f[d]=e[d]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
-THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
+THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
+var Uniforms={clone:function(a){var b,c,e,f={};for(b in a){f[b]={};for(c in a[b]){e=a[b][c];f[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return f},merge:function(a){var b,c,e,f={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(c in e)f[c]=e[c]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
+THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;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 d=0;d<this.geometry.morphTargets.length;d++){this.morphTargetInfluences.push(0);
-this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;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=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)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;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
-b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,f,h,i,p;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){f=this.geometry.bones[d];h=f.pos;i=f.rotq;p=f.scl;e=this.addBone();e.name=f.name;e.position.set(h[0],h[1],h[2]);e.quaternion.set(i[0],i[1],i[2],i[3]);e.useQuaternion=!0;p!==undefined?e.scale.set(p[0],p[1],p[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){f=this.geometry.bones[d];
-e=this.bones[d];f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,b,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<d;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
+b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,f,i,j,p;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){f=this.geometry.bones[c];i=f.pos;j=f.rotq;p=f.scl;e=this.addBone();e.name=f.name;e.position.set(i[0],i[1],i[2]);e.quaternion.set(j[0],j[1],j[2],j[3]);e.useQuaternion=!0;p!==undefined?e.scale.set(p[0],p[1],p[2]):e.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){f=this.geometry.bones[c];
+e=this.bones[c];f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c)}c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<c;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
 b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],d=0;d<this.bones.length;d++){a=this.bones[d];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
-e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(b[h].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,i=this.geometry.skinIndices[a].y;
+e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[i].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
 THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
 THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
-THREE.Sound=function(a,b,d,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var f;d=this.sources.length;for(a=0;a<d;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)f=
+THREE.Sound=function(a,b,c,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var f;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)f=
 "audio/mpeg";else if(b.indexOf(".ogg")!==-1)f="audio/ogg";else b.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 "audio/mpeg";else if(b.indexOf(".ogg")!==-1)f="audio/ogg";else b.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,b,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
-THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var d=0;d<this.LODs.length;d++)if(b<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
-THREE.LOD.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=d.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(a>=this.LODs[e].visibleAtDistance){this.LODs[e-1].object3D.visible=
-!1;this.LODs[e].object3D.visible=!0}else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
+THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
+THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(a>=this.LODs[e].visibleAtDistance){this.LODs[e-1].object3D.visible=
+!1;this.LODs[e].object3D.visible=!0}else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.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)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.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)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
-THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==undefined?b:2.5E-4};
-THREE.Projector=function(){function a(Q,c){return c.z-Q.z}function b(Q,c){var ma=0,Z=1,oa=Q.z+Q.w,$=c.z+c.w,U=-Q.z+Q.w,R=-c.z+c.w;if(oa>=0&&$>=0&&U>=0&&R>=0)return!0;else if(oa<0&&$<0||U<0&&R<0)return!1;else{if(oa<0)ma=Math.max(ma,oa/(oa-$));else $<0&&(Z=Math.min(Z,oa/(oa-$)));if(U<0)ma=Math.max(ma,U/(U-R));else R<0&&(Z=Math.min(Z,U/(U-R)));if(Z<ma)return!1;else{Q.lerpSelf(c,ma);c.lerpSelf(Q,1-Z);return!0}}}var d,e,f=[],h,i,p,n=[],w,A,B=[],C,z,M=[],K=new THREE.Vector4,J=new THREE.Vector4,y=new THREE.Matrix4,
-ja=new THREE.Matrix4,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Vector4,ia=new THREE.Vector4,la;this.projectObjects=function(Q,c,ma){c=[];var Z,oa,$;e=0;oa=Q.objects;Q=0;for(Z=oa.length;Q<Z;Q++){$=oa[Q];var U;if(!(U=!$.visible))if(U=$ instanceof THREE.Mesh){a:{U=void 0;for(var R=$.matrixWorld,Da=-$.geometry.boundingSphere.radius*Math.max($.scale.x,Math.max($.scale.y,$.scale.z)),N=0;N<6;N++){U=V[N].x*R.n14+V[N].y*R.n24+
-V[N].z*R.n34+V[N].w;if(U<=Da){U=!1;break a}}U=!0}U=!U}if(!U){d=f[e]=f[e]||new THREE.RenderableObject;K.copy($.position);y.multiplyVector3(K);d.object=$;d.z=K.z;c.push(d);e++}}ma&&c.sort(a);return c};this.projectScene=function(Q,c,ma){var Z=[],oa=c.near,$=c.far,U,R,Da,N,na,ya,S,za,Ka,Pa,Oa,Ha,xa,Y,ua,Ba;p=A=z=0;c.matrixAutoUpdate&&c.updateMatrix();Q.update(undefined,!1,c);y.multiply(c.projectionMatrix,c.matrixWorldInverse);V[0].set(y.n41-y.n11,y.n42-y.n12,y.n43-y.n13,y.n44-y.n14);V[1].set(y.n41+y.n11,
-y.n42+y.n12,y.n43+y.n13,y.n44+y.n14);V[2].set(y.n41+y.n21,y.n42+y.n22,y.n43+y.n23,y.n44+y.n24);V[3].set(y.n41-y.n21,y.n42-y.n22,y.n43-y.n23,y.n44-y.n24);V[4].set(y.n41-y.n31,y.n42-y.n32,y.n43-y.n33,y.n44-y.n34);V[5].set(y.n41+y.n31,y.n42+y.n32,y.n43+y.n33,y.n44+y.n34);for(U=0;U<6;U++){ya=V[U];ya.divideScalar(Math.sqrt(ya.x*ya.x+ya.y*ya.y+ya.z*ya.z))}ya=this.projectObjects(Q,c,!0);Q=0;for(U=ya.length;Q<U;Q++){S=ya[Q].object;if(S.visible){za=S.matrixWorld;Oa=S.matrixRotationWorld;Ka=S.materials;Pa=
-S.overdraw;if(S instanceof THREE.Mesh){Ha=S.geometry;xa=Ha.vertices;R=0;for(Da=xa.length;R<Da;R++){Y=xa[R];Y.positionWorld.copy(Y.position);za.multiplyVector3(Y.positionWorld);N=Y.positionScreen;N.copy(Y.positionWorld);y.multiplyVector4(N);N.x/=N.w;N.y/=N.w;Y.__visible=N.z>oa&&N.z<$}Ha=Ha.faces;R=0;for(Da=Ha.length;R<Da;R++){Y=Ha[R];if(Y instanceof THREE.Face3){N=xa[Y.a];na=xa[Y.b];ua=xa[Y.c];if(N.__visible&&na.__visible&&ua.__visible&&(S.doubleSided||S.flipSided!=(ua.positionScreen.x-N.positionScreen.x)*
-(na.positionScreen.y-N.positionScreen.y)-(ua.positionScreen.y-N.positionScreen.y)*(na.positionScreen.x-N.positionScreen.x)<0)){h=n[p]=n[p]||new THREE.RenderableFace3;h.v1.positionWorld.copy(N.positionWorld);h.v2.positionWorld.copy(na.positionWorld);h.v3.positionWorld.copy(ua.positionWorld);h.v1.positionScreen.copy(N.positionScreen);h.v2.positionScreen.copy(na.positionScreen);h.v3.positionScreen.copy(ua.positionScreen);h.normalWorld.copy(Y.normal);Oa.multiplyVector3(h.normalWorld);h.centroidWorld.copy(Y.centroid);
-za.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);y.multiplyVector3(h.centroidScreen);ua=Y.vertexNormals;la=h.vertexNormalsWorld;N=0;for(na=ua.length;N<na;N++){Ba=la[N]=la[N]||new THREE.Vector3;Ba.copy(ua[N]);Oa.multiplyVector3(Ba)}h.z=h.centroidScreen.z;h.meshMaterials=Ka;h.faceMaterials=Y.materials;h.overdraw=Pa;if(S.geometry.uvs[R]){h.uvs[0]=S.geometry.uvs[R][0];h.uvs[1]=S.geometry.uvs[R][1];h.uvs[2]=S.geometry.uvs[R][2]}Z.push(h);p++}}else if(Y instanceof THREE.Face4){N=
-xa[Y.a];na=xa[Y.b];ua=xa[Y.c];Ba=xa[Y.d];if(N.__visible&&na.__visible&&ua.__visible&&Ba.__visible&&(S.doubleSided||S.flipSided!=((Ba.positionScreen.x-N.positionScreen.x)*(na.positionScreen.y-N.positionScreen.y)-(Ba.positionScreen.y-N.positionScreen.y)*(na.positionScreen.x-N.positionScreen.x)<0||(na.positionScreen.x-ua.positionScreen.x)*(Ba.positionScreen.y-ua.positionScreen.y)-(na.positionScreen.y-ua.positionScreen.y)*(Ba.positionScreen.x-ua.positionScreen.x)<0))){h=n[p]=n[p]||new THREE.RenderableFace3;
-h.v1.positionWorld.copy(N.positionWorld);h.v2.positionWorld.copy(na.positionWorld);h.v3.positionWorld.copy(Ba.positionWorld);h.v1.positionScreen.copy(N.positionScreen);h.v2.positionScreen.copy(na.positionScreen);h.v3.positionScreen.copy(Ba.positionScreen);h.normalWorld.copy(Y.normal);Oa.multiplyVector3(h.normalWorld);h.centroidWorld.copy(Y.centroid);za.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);y.multiplyVector3(h.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
-Ka;h.faceMaterials=Y.materials;h.overdraw=Pa;if(S.geometry.uvs[R]){h.uvs[0]=S.geometry.uvs[R][0];h.uvs[1]=S.geometry.uvs[R][1];h.uvs[2]=S.geometry.uvs[R][3]}Z.push(h);p++;i=n[p]=n[p]||new THREE.RenderableFace3;i.v1.positionWorld.copy(na.positionWorld);i.v2.positionWorld.copy(ua.positionWorld);i.v3.positionWorld.copy(Ba.positionWorld);i.v1.positionScreen.copy(na.positionScreen);i.v2.positionScreen.copy(ua.positionScreen);i.v3.positionScreen.copy(Ba.positionScreen);i.normalWorld.copy(h.normalWorld);
-i.centroidWorld.copy(h.centroidWorld);i.centroidScreen.copy(h.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=Ka;i.faceMaterials=Y.materials;i.overdraw=Pa;if(S.geometry.uvs[R]){i.uvs[0]=S.geometry.uvs[R][1];i.uvs[1]=S.geometry.uvs[R][2];i.uvs[2]=S.geometry.uvs[R][3]}Z.push(i);p++}}}}else if(S instanceof THREE.Line){ja.multiply(y,za);xa=S.geometry.vertices;Y=xa[0];Y.positionScreen.copy(Y.position);ja.multiplyVector4(Y.positionScreen);R=1;for(Da=xa.length;R<Da;R++){N=xa[R];N.positionScreen.copy(N.position);
-ja.multiplyVector4(N.positionScreen);na=xa[R-1];ka.copy(N.positionScreen);ia.copy(na.positionScreen);if(b(ka,ia)){ka.multiplyScalar(1/ka.w);ia.multiplyScalar(1/ia.w);w=B[A]=B[A]||new THREE.RenderableLine;w.v1.positionScreen.copy(ka);w.v2.positionScreen.copy(ia);w.z=Math.max(ka.z,ia.z);w.materials=S.materials;Z.push(w);A++}}}else if(S instanceof THREE.Particle){J.set(S.position.x,S.position.y,S.position.z,1);y.multiplyVector4(J);J.z/=J.w;if(J.z>0&&J.z<1){C=M[z]=M[z]||new THREE.RenderableParticle;C.x=
-J.x/J.w;C.y=J.y/J.w;C.z=J.z;C.rotation=S.rotation.z;C.scale.x=S.scale.x*Math.abs(C.x-(J.x+c.projectionMatrix.n11)/(J.w+c.projectionMatrix.n14));C.scale.y=S.scale.y*Math.abs(C.y-(J.y+c.projectionMatrix.n22)/(J.w+c.projectionMatrix.n24));C.materials=S.materials;Z.push(C);z++}}}}ma&&Z.sort(a);return Z};this.unprojectVector=function(Q,c){var ma=c.matrixWorld.clone();ma.multiplySelf(THREE.Matrix4.makeInvert(c.projectionMatrix));ma.multiplyVector3(Q);return Q}};
-THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,f=d.length;for(e=0;e<f;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==undefined?b:2.5E-4};
+THREE.Projector=function(){function a(){var N=n[p]=n[p]||new THREE.RenderableVertex;p++;return N}function b(N,P){return P.z-N.z}function c(N,P){var sa=0,ja=1,wa=N.z+N.w,na=P.z+P.w,U=-N.z+N.w,ca=-P.z+P.w;if(wa>=0&&na>=0&&U>=0&&ca>=0)return!0;else if(wa<0&&na<0||U<0&&ca<0)return!1;else{if(wa<0)sa=Math.max(sa,wa/(wa-na));else na<0&&(ja=Math.min(ja,wa/(wa-na)));if(U<0)sa=Math.max(sa,U/(U-ca));else ca<0&&(ja=Math.min(ja,U/(U-ca)));if(ja<sa)return!1;else{N.lerpSelf(P,sa);P.lerpSelf(N,1-ja);return!0}}}var e,
+f,i=[],j,p,n=[],s,z,A=[],D,y,K=[],H,M,O=[],ia=new THREE.Vector4,R=new THREE.Vector4,B=new THREE.Matrix4,la=new THREE.Matrix4,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ma=new THREE.Vector4,d=new THREE.Vector4,Ea;this.projectVector=function(N,P){B.multiply(P.projectionMatrix,P.matrixWorldInverse);B.multiplyVector3(N);return N};this.unprojectVector=function(N,P){B.multiply(THREE.Matrix4.makeInvert(P.projectionMatrix),P.matrixWorld);
+B.multiplyVector3(N);return N};this.projectObjects=function(N,P,sa){P=[];var ja,wa,na;f=0;wa=N.objects;N=0;for(ja=wa.length;N<ja;N++){na=wa[N];var U;if(!(U=!na.visible))if(U=na instanceof THREE.Mesh){a:{U=void 0;for(var ca=na.matrixWorld,Ga=-na.geometry.boundingSphere.radius*Math.max(na.scale.x,Math.max(na.scale.y,na.scale.z)),T=0;T<6;T++){U=V[T].x*ca.n14+V[T].y*ca.n24+V[T].z*ca.n34+V[T].w;if(U<=Ga){U=!1;break a}}U=!0}U=!U}if(!U){U=i[f]=i[f]||new THREE.RenderableObject;f++;e=U;ia.copy(na.position);
+B.multiplyVector3(ia);e.object=na;e.z=ia.z;P.push(e)}}sa&&P.sort(b);return P};this.projectScene=function(N,P,sa){var ja=[],wa=P.near,na=P.far,U,ca,Ga,T,pa,ka,Ka,Ua,Ma,Qa,ya,Va,Ja,g;M=y=z=0;P.matrixAutoUpdate&&P.updateMatrix();N.update(undefined,!1,P);B.multiply(P.projectionMatrix,P.matrixWorldInverse);V[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);V[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);V[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);V[3].set(B.n41-B.n21,B.n42-
+B.n22,B.n43-B.n23,B.n44-B.n24);V[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);V[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(U=0;U<6;U++){pa=V[U];pa.divideScalar(Math.sqrt(pa.x*pa.x+pa.y*pa.y+pa.z*pa.z))}pa=this.projectObjects(N,P,!0);N=0;for(U=pa.length;N<U;N++){ka=pa[N].object;if(ka.visible){Ka=ka.matrixWorld;Ma=ka.matrixRotationWorld;Ua=ka.materials;p=0;if(ka instanceof THREE.Mesh){Qa=ka.geometry;ya=Qa.vertices;Va=Qa.faces;ca=0;for(Ga=ya.length;ca<Ga;ca++){j=a();j.positionWorld.copy(ya[ca].position);
+Ka.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);B.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>wa&&j.positionScreen.z<na}ca=0;for(Ga=Va.length;ca<Ga;ca++){ya=Va[ca];if(ya instanceof THREE.Face3){T=n[ya.a];Ja=n[ya.b];g=n[ya.c];if(T.visible&&Ja.visible&&g.visible&&(ka.doubleSided||ka.flipSided!=(g.positionScreen.x-T.positionScreen.x)*(Ja.positionScreen.y-T.positionScreen.y)-(g.positionScreen.y-
+T.positionScreen.y)*(Ja.positionScreen.x-T.positionScreen.x)<0)){var m=A[z]=A[z]||new THREE.RenderableFace3;z++;s=m;s.v1.copy(T);s.v2.copy(Ja);s.v3.copy(g);s.normalWorld.copy(ya.normal);Ma.multiplyVector3(s.normalWorld);s.centroidWorld.copy(ya.centroid);Ka.multiplyVector3(s.centroidWorld);s.centroidScreen.copy(s.centroidWorld);B.multiplyVector3(s.centroidScreen);Ja=ya.vertexNormals;Ea=s.vertexNormalsWorld;for(T=0;T<3;T++){g=Ea[T];g.copy(Ja[T]);Ma.multiplyVector3(g)}if(T=Qa.faceVertexUvs[0][ca]){s.uvs[0]=
+T[0];s.uvs[1]=T[1];s.uvs[2]=T[2]}s.meshMaterials=Ua;s.faceMaterials=ya.materials;s.z=s.centroidScreen.z;ja.push(s)}}}}else if(ka instanceof THREE.Line){la.multiply(B,Ka);ya=ka.geometry.vertices;T=a();T.positionScreen.copy(ya[0].position);la.multiplyVector4(T.positionScreen);ca=1;for(Ga=ya.length;ca<Ga;ca++){T=a();T.positionScreen.copy(ya[ca].position);la.multiplyVector4(T.positionScreen);Ja=n[p-2];ma.copy(T.positionScreen);d.copy(Ja.positionScreen);if(c(ma,d)){ma.multiplyScalar(1/ma.w);d.multiplyScalar(1/
+d.w);Ka=K[y]=K[y]||new THREE.RenderableLine;y++;D=Ka;D.v1.positionScreen.copy(ma);D.v2.positionScreen.copy(d);D.z=Math.max(ma.z,d.z);D.materials=ka.materials;ja.push(D)}}}else if(ka instanceof THREE.Particle){R.set(ka.position.x,ka.position.y,ka.position.z,1);B.multiplyVector4(R);R.z/=R.w;if(R.z>0&&R.z<1){Ka=O[M]=O[M]||new THREE.RenderableParticle;M++;H=Ka;H.x=R.x/R.w;H.y=R.y/R.w;H.z=R.z;H.rotation=ka.rotation.z;H.scale.x=ka.scale.x*Math.abs(H.x-(R.x+P.projectionMatrix.n11)/(R.w+P.projectionMatrix.n14));
+H.scale.y=ka.scale.y*Math.abs(H.y-(R.y+P.projectionMatrix.n22)/(R.w+P.projectionMatrix.n24));H.materials=ka.materials;ja.push(H)}}}}sa&&ja.sort(b);return ja}};
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,f=c.length;for(e=0;e<f;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -178,78 +174,79 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function b(g,m,o){var j,k,s,q=g.vertices,r=q.length,E=g.colors,u=E.length,v=g.__vertexArray,L=g.__colorArray,W=g.__sortArray,H=g.__dirtyVertices,I=g.__dirtyColors;if(o.sortParticles){Ka.multiplySelf(o.matrixWorld);for(j=0;j<r;j++){k=q[j].position;Ha.copy(k);Ka.multiplyVector3(Ha);W[j]=[Ha.z,j]}W.sort(function(O,T){return T[0]-O[0]});for(j=0;j<r;j++){k=q[W[j][1]].position;s=j*3;v[s]=k.x;v[s+1]=k.y;v[s+2]=k.z}for(j=0;j<u;j++){s=j*3;color=E[W[j][1]];L[s]=color.r;L[s+1]=
-color.g;L[s+2]=color.b}}else{if(H)for(j=0;j<r;j++){k=q[j].position;s=j*3;v[s]=k.x;v[s+1]=k.y;v[s+2]=k.z}if(I)for(j=0;j<u;j++){color=E[j];s=j*3;L[s]=color.r;L[s+1]=color.g;L[s+2]=color.b}}if(H||o.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,m)}if(I||o.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,L,m)}}function d(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
-function e(g,m,o,j,k){j.program||oa.initMaterial(j,m,o,k);var s=j.program,q=s.uniforms,r=j.uniforms;if(s!=ma){c.useProgram(s);ma=s}c.uniformMatrix4fv(q.projectionMatrix,!1,Pa);if(o&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){r.fogNear.value=o.near;r.fogFar.value=o.far}else if(o instanceof
-THREE.FogExp2)r.fogDensity.value=o.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j.lights){var E,u,v=0,L=0,W=0,H,I,O,T=xa,X=T.directional.colors,P=T.directional.positions,Ca=T.point.colors,x=T.point.positions,Aa=0,ta=0;o=u=u=0;for(E=m.length;o<E;o++){u=m[o];H=u.color;I=u.position;O=u.intensity;if(u instanceof THREE.AmbientLight){v+=H.r;L+=H.g;W+=H.b}else if(u instanceof THREE.DirectionalLight){u=Aa*3;X[u]=H.r*O;X[u+1]=H.g*O;X[u+2]=H.b*O;P[u]=I.x;P[u+1]=I.y;
-P[u+2]=I.z;Aa+=1}else if(u instanceof THREE.PointLight){u=ta*3;Ca[u]=H.r*O;Ca[u+1]=H.g*O;Ca[u+2]=H.b*O;x[u]=I.x;x[u+1]=I.y;x[u+2]=I.z;ta+=1}}for(o=Aa*3;o<X.length;o++)X[o]=0;for(o=ta*3;o<Ca.length;o++)Ca[o]=0;T.point.length=ta;T.directional.length=Aa;T.ambient[0]=v;T.ambient[1]=L;T.ambient[2]=W;m=xa;r.enableLighting.value=m.directional.length+m.point.length;r.ambientLightColor.value=m.ambient;r.directionalLightColor.value=m.directional.colors;r.directionalLightDirection.value=m.directional.positions;
-r.pointLightColor.value=m.point.colors;r.pointLightPosition.value=m.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.map.texture=j.map;r.lightMap.texture=j.lightMap;r.envMap.texture=j.envMap;r.reflectivity.value=j.reflectivity;r.refractionRatio.value=j.refractionRatio;r.combine.value=j.combine;r.useRefract.value=
-j.envMap&&j.envMap.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.size.value=j.size;r.scale.value=Q.height/2;r.map.texture=j.map}else if(j instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(j.ambient.r,
-j.ambient.g,j.ambient.b);r.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);r.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)r.opacity.value=j.opacity;for(var aa in r)if(v=s.uniforms[aa]){o=r[aa];E=o.type;m=o.value;if(E=="i")c.uniform1i(v,m);else if(E=="f")c.uniform1f(v,m);else if(E=="fv1")c.uniform1fv(v,m);else if(E=="fv")c.uniform3fv(v,m);else if(E==
-"v2")c.uniform2f(v,m.x,m.y);else if(E=="v3")c.uniform3f(v,m.x,m.y,m.z);else if(E=="c")c.uniform3f(v,m.r,m.g,m.b);else if(E=="t"){c.uniform1i(v,m);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){if(o.image.length==6){if(o.needsUpdate){if(o.__wasSetOnce){c.bindTexture(c.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube);for(E=0;E<6;++E)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,0,0,c.RGBA,c.UNSIGNED_BYTE,o.image[E])}else{o.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,
-o.image.__webGLTextureCube);for(E=0;E<6;++E)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,o.image[E]);o.__wasSetOnce=!0}ja(c.TEXTURE_CUBE_MAP,o,o.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}c.activeTexture(c.TEXTURE0+m);c.bindTexture(c.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(o.needsUpdate){if(o.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,o.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,o.image)}else{o.__webGLTexture=
-c.createTexture();c.bindTexture(c.TEXTURE_2D,o.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,o.image);o.__wasSetOnce=!0}ja(c.TEXTURE_2D,o,o.image);c.bindTexture(c.TEXTURE_2D,null);o.needsUpdate=!1}c.activeTexture(c.TEXTURE0+m);c.bindTexture(c.TEXTURE_2D,o.__webGLTexture)}}}c.uniformMatrix4fv(q.modelViewMatrix,!1,k._modelViewMatrixArray);c.uniformMatrix3fv(q.normalMatrix,!1,k._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||
-j.envMap)&&c.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(j instanceof THREE.MeshShaderMaterial||j.envMap||j.skinning)&&c.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&c.uniformMatrix4fv(q.viewMatrix,!1,Oa);if(j.skinning){c.uniformMatrix4fv(q.cameraInverseMatrix,!1,Oa);c.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return s}
-function f(g,m,o,j,k,s){if(j.opacity!=0){g=e(g,m,o,j,s).attributes;if(j.morphTargets){m=j.program.attributes;s.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[s.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,k.__webGLVertexBuffer);c.vertexAttribPointer(m.position,3,c.FLOAT,!1,0,0);if(s.morphTargetForcedOrder.length){o=0;for(var q=s.morphTargetForcedOrder,r=s.morphTargetInfluences;o<j.numSupportedMorphTargets&&o<q.length;){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[q[o]]);
-c.vertexAttribPointer(m["morphTarget"+o],3,c.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[o]=r[q[o]];o++}}else{q=[];var E=-1,u=0;r=s.morphTargetInfluences;var v,L=r.length;o=0;for(s.morphTargetBase!==-1&&(q[s.morphTargetBase]=!0);o<j.numSupportedMorphTargets;){for(v=0;v<L;v++)if(!q[v]&&r[v]>E){u=v;E=r[u]}c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[u]);c.vertexAttribPointer(m["morphTarget"+o],3,c.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[o]=E;q[u]=1;E=-1;o++}}c.uniform1fv(j.program.uniforms.morphTargetInfluences,
-s.__webGLMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,k.__webGLVertexBuffer);c.vertexAttribPointer(g.position,3,c.FLOAT,!1,0,0)}if(g.color>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLColorBuffer);c.vertexAttribPointer(g.color,3,c.FLOAT,!1,0,0)}if(g.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLNormalBuffer);c.vertexAttribPointer(g.normal,3,c.FLOAT,!1,0,0)}if(g.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLTangentBuffer);c.vertexAttribPointer(g.tangent,4,c.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,
-k.__webGLUVBuffer);c.vertexAttribPointer(g.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(g.uv)}else c.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLUV2Buffer);c.vertexAttribPointer(g.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(g.uv2)}else c.disableVertexAttribArray(g.uv2);if(j.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);c.vertexAttribPointer(g.skinVertexA,
-4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);c.vertexAttribPointer(g.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);c.vertexAttribPointer(g.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);c.vertexAttribPointer(g.skinWeight,4,c.FLOAT,!1,0,0)}if(s instanceof THREE.Mesh)if(j.wireframe){c.lineWidth(j.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);c.drawElements(c.LINES,
-k.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,k.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(j.linewidth);c.drawArrays(s,0,k.__webGLLineCount)}else if(s instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,k.__webGLParticleCount);else s instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function h(g,m){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer=
-c.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=c.createBuffer();if(g.hasPos){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,g.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(m.attributes.position);c.vertexAttribPointer(m.attributes.position,3,c.FLOAT,!1,0,0)}if(g.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,g.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(m.attributes.normal);c.vertexAttribPointer(m.attributes.normal,
-3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,g.count);g.count=0}function i(g){if($!=g.doubleSided){g.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);$=g.doubleSided}if(U!=g.flipSided){g.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);U=g.flipSided}}function p(g){if(Da!=g){g?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Da=g}}function n(g){za[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);za[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);za[2].set(g.n41+g.n21,g.n42+g.n22,
-g.n43+g.n23,g.n44+g.n24);za[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);za[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);za[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=za[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function w(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),j=0;j<6;j++){g=za[j].x*m.n14+za[j].y*m.n24+za[j].z*m.n34+za[j].w;if(g<=o)return!1}return!0}function A(g,
-m){g.list[g.count]=m;g.count+=1}function B(g){var m,o,j=g.object,k=g.opaque,s=g.transparent;s.count=0;g=k.count=0;for(m=j.materials.length;g<m;g++){o=j.materials[g];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?A(s,o):A(k,o)}}function C(g){var m,o,j,k,s=g.object,q=g.buffer,r=g.opaque,E=g.transparent;E.count=0;g=r.count=0;for(j=s.materials.length;g<j;g++){m=s.materials[g];if(m instanceof THREE.MeshFaceMaterial){m=0;for(o=q.materials.length;m<o;m++)(k=q.materials[m])&&(k.opacity&&k.opacity<
-1||k.blending!=THREE.NormalBlending?A(E,k):A(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?A(E,k):A(r,k)}}}function z(g,m){return m.z-g.z}function M(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function K(g){function m(W){var H=[];o=0;for(j=W.length;o<j;o++)W[o]==undefined?H.push("undefined"):H.push(W[o].id);return H.join("_")}var o,
-j,k,s,q,r,E,u,v={},L=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(s=g.faces.length;k<s;k++){q=g.faces[k];r=q.materials;E=m(r);v[E]==undefined&&(v[E]={hash:E,counter:0});u=v[E].hash+"_"+v[E].counter;g.geometryGroups[u]==undefined&&(g.geometryGroups[u]={faces:[],materials:r,vertices:0,numMorphTargets:L});q=q instanceof THREE.Face3?3:4;if(g.geometryGroups[u].vertices+q>65535){v[E].counter+=1;u=v[E].hash+"_"+v[E].counter;g.geometryGroups[u]==undefined&&(g.geometryGroups[u]=
-{faces:[],materials:r,vertices:0,numMorphTargets:L})}g.geometryGroups[u].faces.push(k);g.geometryGroups[u].vertices+=q}}function J(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function y(g){if(g!=R){switch(g){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);
-break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}R=g}}function ja(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){c.texParameteri(g,c.TEXTURE_WRAP_S,la(m.wrapS));c.texParameteri(g,c.TEXTURE_WRAP_T,la(m.wrapT));c.texParameteri(g,c.TEXTURE_MAG_FILTER,la(m.magFilter));c.texParameteri(g,c.TEXTURE_MIN_FILTER,la(m.minFilter));c.generateMipmap(g)}else{c.texParameteri(g,
-c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(g,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(g,c.TEXTURE_MAG_FILTER,ia(m.magFilter));c.texParameteri(g,c.TEXTURE_MIN_FILTER,ia(m.minFilter))}}function V(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=c.createFramebuffer();g.__webGLRenderbuffer=c.createRenderbuffer();g.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,g.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,g.width,g.height);c.bindTexture(c.TEXTURE_2D,
-g.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,la(g.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,la(g.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,la(g.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,la(g.minFilter));c.texImage2D(c.TEXTURE_2D,0,la(g.format),g.width,g.height,0,la(g.format),la(g.type),null);c.bindFramebuffer(c.FRAMEBUFFER,g.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,g.__webGLTexture,
-0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,g.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=ya;g=S}if(m!=Z){c.bindFramebuffer(c.FRAMEBUFFER,m);c.viewport(N,na,o,g);Z=m}}function ka(g,m){var o;if(g=="fragment")o=c.createShader(c.FRAGMENT_SHADER);else g=="vertex"&&(o=c.createShader(c.VERTEX_SHADER));c.shaderSource(o,
-m);c.compileShader(o);if(!c.getShaderParameter(o,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(o));return null}return o}function ia(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function la(g){switch(g){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;
-case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;
-case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var Q=document.createElement("canvas"),c,ma=null,Z=null,oa=this,$=null,U=null,R=null,Da=null,N=0,na=0,ya=0,S=
-0,za=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ka=new THREE.Matrix4,Pa=new Float32Array(16),Oa=new Float32Array(16),Ha=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Y=!0,ua=new THREE.Color(0),Ba=0;if(a){if(a.antialias!==undefined)Y=a.antialias;a.clearColor!==undefined&&ua.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ba=a.clearAlpha}this.maxMorphTargets=
-8;this.domElement=Q;this.autoClear=!0;this.sortObjects=!0;(function(g,m,o){try{if(!(c=Q.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(j){console.error(j)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(Y,ua,Ba);this.context=c;this.setSize=function(g,m){Q.width=
-g;Q.height=m;this.setViewport(0,0,Q.width,Q.height)};this.setViewport=function(g,m,o,j){N=g;na=m;ya=o;S=j;c.viewport(N,na,ya,S)};this.setScissor=function(g,m,o,j){c.scissor(g,m,o,j)};this.enableScissorTest=function(g){g?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){c.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);c.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){c.clearColor(g.r,g.g,g.b,m)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|
-c.DEPTH_BUFFER_BIT)};this.initMaterial=function(g,m,o,j){var k,s,q;if(g instanceof THREE.MeshDepthMaterial)d(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)d(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)d(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)d(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)d(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)d(g,THREE.ShaderLib.basic);else g instanceof
-THREE.ParticleBasicMaterial&&d(g,THREE.ShaderLib.particle_basic);var r,E,u,v;q=u=v=0;for(r=m.length;q<r;q++){E=m[q];E instanceof THREE.DirectionalLight&&u++;E instanceof THREE.PointLight&&v++}if(v+u<=4)m=u;else{m=Math.ceil(4*u/(v+u));v=4-m}q={directional:m,point:v};r=50;if(j!==undefined&&j instanceof THREE.SkinnedMesh)r=j.bones.length;v=g.fragmentShader;m=g.vertexShader;r={fog:o,map:g.map,envMap:g.envMap,lightMap:g.lightMap,vertexColors:g.vertexColors,sizeAttenuation:g.sizeAttenuation,skinning:g.skinning,
-morphTargets:g.morphTargets,maxDirLights:q.directional,maxPointLights:q.point,maxBones:r};o=c.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-r=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-c.attachShader(o,ka("fragment",q+v));c.attachShader(o,ka("vertex",r+m));c.linkProgram(o);c.getProgramParameter(o,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(o,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k);
-k=g.program;v=0;for(m=o.length;v<m;v++){q=o[v];k.uniforms[q]=c.getUniformLocation(k,q)}o=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(k=0;k<this.maxMorphTargets;k++)o.push("morphTarget"+k);for(s in g.attributes)o.push(s);s=g.program;k=o;o=0;for(v=k.length;o<v;o++){m=k[o];s.attributes[m]=c.getAttribLocation(s,m)}s=g.program.attributes;c.enableVertexAttribArray(s.position);s.color>=0&&c.enableVertexAttribArray(s.color);s.normal>=0&&c.enableVertexAttribArray(s.normal);
-s.tangent>=0&&c.enableVertexAttribArray(s.tangent);if(g.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0){c.enableVertexAttribArray(s.skinVertexA);c.enableVertexAttribArray(s.skinVertexB);c.enableVertexAttribArray(s.skinIndex);c.enableVertexAttribArray(s.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(s.morphTarget0>=0){c.enableVertexAttribArray(s.morphTarget0);g.numSupportedMorphTargets++}if(s.morphTarget1>=0){c.enableVertexAttribArray(s.morphTarget1);
-g.numSupportedMorphTargets++}if(s.morphTarget2>=0){c.enableVertexAttribArray(s.morphTarget2);g.numSupportedMorphTargets++}if(s.morphTarget3>=0){c.enableVertexAttribArray(s.morphTarget3);g.numSupportedMorphTargets++}if(s.morphTarget4>=0){c.enableVertexAttribArray(s.morphTarget4);g.numSupportedMorphTargets++}if(s.morphTarget5>=0){c.enableVertexAttribArray(s.morphTarget5);g.numSupportedMorphTargets++}if(s.morphTarget6>=0){c.enableVertexAttribArray(s.morphTarget6);g.numSupportedMorphTargets++}if(s.morphTarget7>=
-0){c.enableVertexAttribArray(s.morphTarget7);g.numSupportedMorphTargets++}j.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)j.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,j){var k,s,q,r,E,u,v,L,W=g.lights,H=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(Oa);m.projectionMatrix.flattenToArray(Pa);Ka.multiply(m.projectionMatrix,m.matrixWorldInverse);n(Ka);this.initWebGLObjects(g);
-V(o);(this.autoClear||j)&&this.clear();E=g.__webglObjects.length;for(j=0;j<E;j++){k=g.__webglObjects[j];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||w(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);M(v,m);C(k);k.render=!0;if(this.sortObjects){Ha.copy(v.position);Ka.multiplyVector3(Ha);k.z=Ha.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(z);u=g.__webglObjectsImmediate.length;for(j=0;j<u;j++){k=g.__webglObjectsImmediate[j];v=k.object;if(v.visible){v.matrixAutoUpdate&&
-v.matrixWorld.flattenToArray(v._objectMatrixArray);M(v,m);B(k)}}y(THREE.NormalBlending);for(j=0;j<E;j++){k=g.__webglObjects[j];if(k.render){v=k.object;L=k.buffer;q=k.opaque;i(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);f(m,W,H,r,L,v)}}}for(j=0;j<u;j++){k=g.__webglObjectsImmediate[j];v=k.object;if(v.visible){q=k.opaque;i(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);s=e(m,W,H,r,v);v.render(function(I){h(I,s)})}}}for(j=0;j<E;j++){k=g.__webglObjects[j];if(k.render){v=k.object;L=k.buffer;
-q=k.transparent;i(v);for(k=0;k<q.count;k++){r=q.list[k];y(r.blending);p(r.depthTest);f(m,W,H,r,L,v)}}}for(j=0;j<u;j++){k=g.__webglObjectsImmediate[j];v=k.object;if(v.visible){q=k.transparent;i(v);for(k=0;k<q.count;k++){r=q.list[k];y(r.blending);p(r.depthTest);s=e(m,W,H,r,v);v.render(function(I){h(I,s)})}}}if(o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,o.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=
-function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var m=g.__objectsAdded[0],o=g,j=void 0,k=void 0,s=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){k=m.geometry;k.geometryGroups==undefined&&K(k);for(j in k.geometryGroups){s=
-k.geometryGroups[j];if(!s.__webGLVertexBuffer){var q=s;q.__webGLVertexBuffer=c.createBuffer();q.__webGLNormalBuffer=c.createBuffer();q.__webGLTangentBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q.__webGLUVBuffer=c.createBuffer();q.__webGLUV2Buffer=c.createBuffer();q.__webGLSkinVertexABuffer=c.createBuffer();q.__webGLSkinVertexBBuffer=c.createBuffer();q.__webGLSkinIndicesBuffer=c.createBuffer();q.__webGLSkinWeightsBuffer=c.createBuffer();q.__webGLFaceBuffer=c.createBuffer();q.__webGLLineBuffer=
-c.createBuffer();if(q.numMorphTargets){var r=void 0,E=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(E=q.numMorphTargets;r<E;r++)q.__webGLMorphTargetsBuffers.push(c.createBuffer())}q=s;var u=m,v=void 0,L=void 0,W=E=r=0;v=void 0;var H=void 0;L=void 0;L=void 0;var I=u.geometry;H=I.faces;var O=q.faces;v=0;for(L=O.length;v<L;v++){fi=O[v];face=H[fi];if(face instanceof THREE.Face3){r+=3;E+=1;W+=3}else if(face instanceof THREE.Face4){r+=4;E+=2;W+=4}}v=q;L=u;H=void 0;O=void 0;var T=void 0,X=void 0;T=void 0;
-var P=[];H=0;for(O=L.materials.length;H<O;H++){T=L.materials[H];if(T instanceof THREE.MeshFaceMaterial){T=0;for(l=v.materials.length;T<l;T++)(X=v.materials[T])&&P.push(X)}else(X=T)&&P.push(X)}L=P;a:{v=void 0;H=void 0;O=L.length;for(v=0;v<O;v++){H=L[v];if(H.map||H.lightMap){v=!0;break a}}v=!1}a:{H=void 0;O=void 0;P=L.length;for(H=0;H<P;H++){O=L[H];if(O.vertexColors){H=O.vertexColors;break a}}H=!1}a:{O=void 0;P=void 0;T=L.length;for(O=0;O<T;O++){P=L[O];if(!(P instanceof THREE.MeshBasicMaterial||P instanceof
-THREE.MeshDepthMaterial)){L=P&&P.shading!=undefined&&P.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}L=!1}q.__vertexArray=new Float32Array(r*3);if(L)q.__normalArray=new Float32Array(r*3);if(I.hasTangents)q.__tangentArray=new Float32Array(r*4);if(H)q.__colorArray=new Float32Array(r*3);if(v){if(I.faceUvs.length>0||I.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(I.faceUvs.length>1||I.faceVertexUvs.length>1)q.__uv2Array=new Float32Array(r*2)}if(u.geometry.skinWeights.length&&
-u.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(E*3);q.__lineArray=new Uint16Array(W*2);if(q.numMorphTargets){u=void 0;I=void 0;q.__morphTargetsArrays=[];u=0;for(I=q.numMorphTargets;u<I;u++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=L==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=
-H;q.__normalType=L;q.__webGLFaceCount=E*3;q.__webGLLineCount=W*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}J(o.__webglObjects,s,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){j=k;j.__webGLVertexBuffer=c.createBuffer();j.__webGLColorBuffer=c.createBuffer();j=k;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLVertexCount=
-s;k.__dirtyVertices=!0;k.__dirtyColors=!0}J(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){j=k;j.__webGLVertexBuffer=c.createBuffer();j.__webGLColorBuffer=c.createBuffer();j=k;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLLineCount=s;k.__dirtyVertices=!0;k.__dirtyColors=!0}J(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=m.geometry;if(!k.__webGLVertexBuffer){j=k;j.__webGLVertexBuffer=
-c.createBuffer();j.__webGLColorBuffer=c.createBuffer();j=k;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__sortArray=[];j.__webGLParticleCount=s;k.__dirtyVertices=!0;k.__dirtyColors=!0}J(o.__webglObjects,k,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&o.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,1)}for(;g.__objectsRemoved.length;){m=g.__objectsRemoved[0];
-o=g;k=void 0;j=void 0;for(k=o.__webglObjects.length-1;k>=0;k--){j=o.__webglObjects[k].object;m==j&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m<o;m++){j=g.__webglObjects[m].object;s=void 0;k=void 0;q=void 0;if(j instanceof THREE.Mesh){k=j.geometry;for(s in k.geometryGroups){q=k.geometryGroups[s];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents){r=c.DYNAMIC_DRAW;E=void 0;
-W=void 0;var Ca=void 0,x=void 0,Aa=void 0,ta=void 0,aa=void 0,Fa=void 0,Ja=void 0;Ca=void 0;var D=void 0,F=void 0,G=void 0,ca=void 0;aa=void 0;Fa=void 0;D=void 0;x=void 0;D=void 0;F=void 0;G=void 0;aa=void 0;D=void 0;F=void 0;G=void 0;ca=void 0;D=void 0;F=void 0;G=void 0;ca=void 0;D=void 0;F=void 0;G=void 0;ca=void 0;D=void 0;F=void 0;G=void 0;ca=void 0;x=void 0;ta=void 0;Aa=void 0;Ja=void 0;var va=void 0,Ta=void 0,pa=void 0,t=X=T=P=O=H=L=v=I=u=0,qa=0,ra=q.__vertexArray,Va=q.__uvArray,Wa=q.__uv2Array,
-Ia=q.__normalArray,da=q.__tangentArray,sa=q.__colorArray,ea=q.__skinVertexAArray,fa=q.__skinVertexBArray,ga=q.__skinIndexArray,ha=q.__skinWeightArray,Ya=q.__morphTargetsArrays,La=q.__faceArray,Ea=q.__lineArray,eb=q.__needsSmoothNormals,Xa=q.__vertexColorType,wa=j.geometry,Za=wa.__dirtyVertices,$a=wa.__dirtyElements,Ua=wa.__dirtyUvs,ab=wa.__dirtyNormals,bb=wa.__dirtyTangents,cb=wa.__dirtyColors,db=wa.__dirtyMorphTargets,Ga=wa.vertices,fb=q.faces,gb=wa.faces,hb=wa.faceVertexUvs[0],ib=wa.faceVertexUvs[1],
-jb=wa.colors,Qa=wa.skinVerticesA,Ra=wa.skinVerticesB,Sa=wa.skinIndices,Na=wa.skinWeights,Ma=wa.morphTargets;E=0;for(W=fb.length;E<W;E++){Ca=fb[E];x=gb[Ca];Ja=hb[Ca];Ca=ib[Ca];Aa=x.vertexNormals;ta=x.normal;aa=x.vertexColors;Fa=x.color;if(x instanceof THREE.Face3){if(Za){D=Ga[x.a].position;F=Ga[x.b].position;G=Ga[x.c].position;ra[I]=D.x;ra[I+1]=D.y;ra[I+2]=D.z;ra[I+3]=F.x;ra[I+4]=F.y;ra[I+5]=F.z;ra[I+6]=G.x;ra[I+7]=G.y;ra[I+8]=G.z;I+=9}if(db){va=0;for(Ta=Ma.length;va<Ta;va++){D=Ma[va].vertices[x.a].position;
-F=Ma[va].vertices[x.b].position;G=Ma[va].vertices[x.c].position;pa=Ya[va];pa[qa+0]=D.x;pa[qa+1]=D.y;pa[qa+2]=D.z;pa[qa+3]=F.x;pa[qa+4]=F.y;pa[qa+5]=F.z;pa[qa+6]=G.x;pa[qa+7]=G.y;pa[qa+8]=G.z}qa+=9}if(Na.length){D=Na[x.a];F=Na[x.b];G=Na[x.c];ha[t]=D.x;ha[t+1]=D.y;ha[t+2]=D.z;ha[t+3]=D.w;ha[t+4]=F.x;ha[t+5]=F.y;ha[t+6]=F.z;ha[t+7]=F.w;ha[t+8]=G.x;ha[t+9]=G.y;ha[t+10]=G.z;ha[t+11]=G.w;D=Sa[x.a];F=Sa[x.b];G=Sa[x.c];ga[t]=D.x;ga[t+1]=D.y;ga[t+2]=D.z;ga[t+3]=D.w;ga[t+4]=F.x;ga[t+5]=F.y;ga[t+6]=F.z;ga[t+
-7]=F.w;ga[t+8]=G.x;ga[t+9]=G.y;ga[t+10]=G.z;ga[t+11]=G.w;D=Qa[x.a];F=Qa[x.b];G=Qa[x.c];ea[t]=D.x;ea[t+1]=D.y;ea[t+2]=D.z;ea[t+3]=1;ea[t+4]=F.x;ea[t+5]=F.y;ea[t+6]=F.z;ea[t+7]=1;ea[t+8]=G.x;ea[t+9]=G.y;ea[t+10]=G.z;ea[t+11]=1;D=Ra[x.a];F=Ra[x.b];G=Ra[x.c];fa[t]=D.x;fa[t+1]=D.y;fa[t+2]=D.z;fa[t+3]=1;fa[t+4]=F.x;fa[t+5]=F.y;fa[t+6]=F.z;fa[t+7]=1;fa[t+8]=G.x;fa[t+9]=G.y;fa[t+10]=G.z;fa[t+11]=1;t+=12}if(cb&&Xa){if(aa.length==3&&Xa==THREE.VertexColors){D=aa[0];F=aa[1];G=aa[2]}else G=F=D=Fa;sa[X]=D.r;sa[X+
-1]=D.g;sa[X+2]=D.b;sa[X+3]=F.r;sa[X+4]=F.g;sa[X+5]=F.b;sa[X+6]=G.r;sa[X+7]=G.g;sa[X+8]=G.b;X+=9}if(bb&&wa.hasTangents){aa=Ga[x.a].tangent;Fa=Ga[x.b].tangent;D=Ga[x.c].tangent;da[P]=aa.x;da[P+1]=aa.y;da[P+2]=aa.z;da[P+3]=aa.w;da[P+4]=Fa.x;da[P+5]=Fa.y;da[P+6]=Fa.z;da[P+7]=Fa.w;da[P+8]=D.x;da[P+9]=D.y;da[P+10]=D.z;da[P+11]=D.w;P+=12}if(ab)if(Aa.length==3&&eb)for(x=0;x<3;x++){ta=Aa[x];Ia[O]=ta.x;Ia[O+1]=ta.y;Ia[O+2]=ta.z;O+=3}else for(x=0;x<3;x++){Ia[O]=ta.x;Ia[O+1]=ta.y;Ia[O+2]=ta.z;O+=3}if(Ua&&Ja)for(x=
-0;x<3;x++){Aa=Ja[x];Va[v]=Aa.u;Va[v+1]=Aa.v;v+=2}if(Ua&&Ca)for(x=0;x<3;x++){Ja=Ca[x];Wa[L]=Ja.u;Wa[L+1]=Ja.v;L+=2}if($a){La[H]=u;La[H+1]=u+1;La[H+2]=u+2;H+=3;Ea[T]=u;Ea[T+1]=u+1;Ea[T+2]=u;Ea[T+3]=u+2;Ea[T+4]=u+1;Ea[T+5]=u+2;T+=6;u+=3}}else if(x instanceof THREE.Face4){if(Za){D=Ga[x.a].position;F=Ga[x.b].position;G=Ga[x.c].position;ca=Ga[x.d].position;ra[I]=D.x;ra[I+1]=D.y;ra[I+2]=D.z;ra[I+3]=F.x;ra[I+4]=F.y;ra[I+5]=F.z;ra[I+6]=G.x;ra[I+7]=G.y;ra[I+8]=G.z;ra[I+9]=ca.x;ra[I+10]=ca.y;ra[I+11]=ca.z;I+=
-12}if(db){va=0;for(Ta=Ma.length;va<Ta;va++){D=Ma[va].vertices[x.a].position;F=Ma[va].vertices[x.b].position;G=Ma[va].vertices[x.c].position;ca=Ma[va].vertices[x.d].position;pa=Ya[va];pa[qa+0]=D.x;pa[qa+1]=D.y;pa[qa+2]=D.z;pa[qa+3]=F.x;pa[qa+4]=F.y;pa[qa+5]=F.z;pa[qa+6]=G.x;pa[qa+7]=G.y;pa[qa+8]=G.z;pa[qa+9]=ca.x;pa[qa+10]=ca.y;pa[qa+11]=ca.z}qa+=12}if(Na.length){D=Na[x.a];F=Na[x.b];G=Na[x.c];ca=Na[x.d];ha[t]=D.x;ha[t+1]=D.y;ha[t+2]=D.z;ha[t+3]=D.w;ha[t+4]=F.x;ha[t+5]=F.y;ha[t+6]=F.z;ha[t+7]=F.w;ha[t+
-8]=G.x;ha[t+9]=G.y;ha[t+10]=G.z;ha[t+11]=G.w;ha[t+12]=ca.x;ha[t+13]=ca.y;ha[t+14]=ca.z;ha[t+15]=ca.w;D=Sa[x.a];F=Sa[x.b];G=Sa[x.c];ca=Sa[x.d];ga[t]=D.x;ga[t+1]=D.y;ga[t+2]=D.z;ga[t+3]=D.w;ga[t+4]=F.x;ga[t+5]=F.y;ga[t+6]=F.z;ga[t+7]=F.w;ga[t+8]=G.x;ga[t+9]=G.y;ga[t+10]=G.z;ga[t+11]=G.w;ga[t+12]=ca.x;ga[t+13]=ca.y;ga[t+14]=ca.z;ga[t+15]=ca.w;D=Qa[x.a];F=Qa[x.b];G=Qa[x.c];ca=Qa[x.d];ea[t]=D.x;ea[t+1]=D.y;ea[t+2]=D.z;ea[t+3]=1;ea[t+4]=F.x;ea[t+5]=F.y;ea[t+6]=F.z;ea[t+7]=1;ea[t+8]=G.x;ea[t+9]=G.y;ea[t+
-10]=G.z;ea[t+11]=1;ea[t+12]=ca.x;ea[t+13]=ca.y;ea[t+14]=ca.z;ea[t+15]=1;D=Ra[x.a];F=Ra[x.b];G=Ra[x.c];ca=Ra[x.d];fa[t]=D.x;fa[t+1]=D.y;fa[t+2]=D.z;fa[t+3]=1;fa[t+4]=F.x;fa[t+5]=F.y;fa[t+6]=F.z;fa[t+7]=1;fa[t+8]=G.x;fa[t+9]=G.y;fa[t+10]=G.z;fa[t+11]=1;fa[t+12]=ca.x;fa[t+13]=ca.y;fa[t+14]=ca.z;fa[t+15]=1;t+=16}if(cb&&Xa){if(aa.length==4&&Xa==THREE.VertexColors){D=aa[0];F=aa[1];G=aa[2];aa=aa[3]}else aa=G=F=D=Fa;sa[X]=D.r;sa[X+1]=D.g;sa[X+2]=D.b;sa[X+3]=F.r;sa[X+4]=F.g;sa[X+5]=F.b;sa[X+6]=G.r;sa[X+7]=
-G.g;sa[X+8]=G.b;sa[X+9]=aa.r;sa[X+10]=aa.g;sa[X+11]=aa.b;X+=12}if(bb&&wa.hasTangents){aa=Ga[x.a].tangent;Fa=Ga[x.b].tangent;D=Ga[x.c].tangent;x=Ga[x.d].tangent;da[P]=aa.x;da[P+1]=aa.y;da[P+2]=aa.z;da[P+3]=aa.w;da[P+4]=Fa.x;da[P+5]=Fa.y;da[P+6]=Fa.z;da[P+7]=Fa.w;da[P+8]=D.x;da[P+9]=D.y;da[P+10]=D.z;da[P+11]=D.w;da[P+12]=x.x;da[P+13]=x.y;da[P+14]=x.z;da[P+15]=x.w;P+=16}if(ab)if(Aa.length==4&&eb)for(x=0;x<4;x++){ta=Aa[x];Ia[O]=ta.x;Ia[O+1]=ta.y;Ia[O+2]=ta.z;O+=3}else for(x=0;x<4;x++){Ia[O]=ta.x;Ia[O+
-1]=ta.y;Ia[O+2]=ta.z;O+=3}if(Ua&&Ja)for(x=0;x<4;x++){Aa=Ja[x];Va[v]=Aa.u;Va[v+1]=Aa.v;v+=2}if(Ua&&Ca)for(x=0;x<4;x++){Ja=Ca[x];Wa[L]=Ja.u;Wa[L+1]=Ja.v;L+=2}if($a){La[H]=u;La[H+1]=u+1;La[H+2]=u+2;La[H+3]=u;La[H+4]=u+2;La[H+5]=u+3;H+=6;Ea[T]=u;Ea[T+1]=u+1;Ea[T+2]=u;Ea[T+3]=u+3;Ea[T+4]=u+1;Ea[T+5]=u+2;Ea[T+6]=u+2;Ea[T+7]=u+3;T+=8;u+=4}}}if(Za){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,ra,r)}if(db){va=0;for(Ta=Ma.length;va<Ta;va++){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[va]);
-c.bufferData(c.ARRAY_BUFFER,Ya[va],r)}}if(cb&&jb.length){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,sa,r)}if(ab){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Ia,r)}if(bb&&wa.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,da,r)}if(Ua&&v>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Va,r)}if(Ua&&L>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,
-Wa,r)}if($a){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,La,r);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Ea,r)}if(t>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ea,r);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,fa,r);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ga,r);c.bindBuffer(c.ARRAY_BUFFER,
-q.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,ha,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){k=j.geometry;if(k.__dirtyVertices||k.__dirtyColors){j=k;s=c.DYNAMIC_DRAW;u=void 0;u=void 0;I=void 0;q=void 0;v=j.vertices;r=j.colors;L=v.length;E=r.length;H=j.__vertexArray;W=j.__colorArray;O=j.__dirtyColors;if(j.__dirtyVertices){for(u=0;u<L;u++){I=v[u].position;
-q=u*3;H[q]=I.x;H[q+1]=I.y;H[q+2]=I.z}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,H,s)}if(O){for(u=0;u<E;u++){color=r[u];q=u*3;W[q]=color.r;W[q+1]=color.g;W[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,W,s)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(j instanceof THREE.Line){k=j.geometry;if(k.__dirtyVertices||k.__dirtyColors){j=k;s=c.DYNAMIC_DRAW;u=void 0;u=void 0;I=void 0;q=void 0;v=j.vertices;r=j.colors;L=v.length;
-E=r.length;H=j.__vertexArray;W=j.__colorArray;O=j.__dirtyColors;if(j.__dirtyVertices){for(u=0;u<L;u++){I=v[u].position;q=u*3;H[q]=I.x;H[q+1]=I.y;H[q+2]=I.z}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,H,s)}if(O){for(u=0;u<E;u++){color=r[u];q=u*3;W[q]=color.r;W[q+1]=color.g;W[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,W,s)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){k=j.geometry;
-(k.__dirtyVertices||k.__dirtyColors||j.sortParticles)&&b(k,c.DYNAMIC_DRAW,j);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,m){if(g){!m||m=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(g=="back")c.cullFace(c.BACK);else g=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.WebGLRenderer=function(a){function b(g,m,o){var h,k,t,q=g.vertices,r=q.length,E=g.colors,x=E.length,v=g.__vertexArray,L=g.__colorArray,W=g.__sortArray,I=g.__dirtyVertices,Q=g.__dirtyColors;if(o.sortParticles){ka.multiplySelf(o.matrixWorld);for(h=0;h<r;h++){k=q[h].position;Ma.copy(k);ka.multiplyVector3(Ma);W[h]=[Ma.z,h]}W.sort(function(J,Y){return Y[0]-J[0]});for(h=0;h<r;h++){k=q[W[h][1]].position;t=h*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}for(h=0;h<x;h++){t=h*3;color=E[W[h][1]];L[t]=color.r;L[t+1]=
+color.g;L[t+2]=color.b}}else{if(I)for(h=0;h<r;h++){k=q[h].position;t=h*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}if(Q)for(h=0;h<x;h++){color=E[h];t=h*3;L[t]=color.r;L[t+1]=color.g;L[t+2]=color.b}}if(I||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,v,m)}if(Q||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,L,m)}}function c(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
+function e(g,m,o,h,k){h.program||P.initMaterial(h,m,o,k);var t=h.program,q=t.uniforms,r=h.uniforms;if(t!=Ea){d.useProgram(t);Ea=t}d.uniformMatrix4fv(q.projectionMatrix,!1,Ka);if(o&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){r.fogNear.value=o.near;r.fogFar.value=o.far}else if(o instanceof
+THREE.FogExp2)r.fogDensity.value=o.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h.lights){var E,x,v=0,L=0,W=0,I,Q,J,Y=Qa,Aa=Y.directional.colors,S=Y.directional.positions,Z=Y.point.colors,w=Y.point.positions,va=0,X=0;o=x=x=0;for(E=m.length;o<E;o++){x=m[o];I=x.color;Q=x.position;J=x.intensity;if(x instanceof THREE.AmbientLight){v+=I.r;L+=I.g;W+=I.b}else if(x instanceof THREE.DirectionalLight){x=va*3;Aa[x]=I.r*J;Aa[x+1]=I.g*J;Aa[x+2]=I.b*J;S[x]=Q.x;S[x+1]=
+Q.y;S[x+2]=Q.z;va+=1}else if(x instanceof THREE.PointLight){x=X*3;Z[x]=I.r*J;Z[x+1]=I.g*J;Z[x+2]=I.b*J;w[x]=Q.x;w[x+1]=Q.y;w[x+2]=Q.z;X+=1}}for(o=va*3;o<Aa.length;o++)Aa[o]=0;for(o=X*3;o<Z.length;o++)Z[o]=0;Y.point.length=X;Y.directional.length=va;Y.ambient[0]=v;Y.ambient[1]=L;Y.ambient[2]=W;m=Qa;r.enableLighting.value=m.directional.length+m.point.length;r.ambientLightColor.value=m.ambient;r.directionalLightColor.value=m.directional.colors;r.directionalLightDirection.value=m.directional.positions;
+r.pointLightColor.value=m.point.colors;r.pointLightPosition.value=m.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity;r.map.texture=h.map;r.lightMap.texture=h.lightMap;r.envMap.texture=h.envMap;r.reflectivity.value=h.reflectivity;r.refractionRatio.value=h.refractionRatio;r.combine.value=h.combine;r.useRefract.value=
+h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity;r.size.value=h.size;r.scale.value=ma.height/2;r.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(h.ambient.r,
+h.ambient.g,h.ambient.b);r.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);r.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)r.opacity.value=h.opacity;for(var Ba in r)if(v=t.uniforms[Ba]){o=r[Ba];E=o.type;m=o.value;if(E=="i")d.uniform1i(v,m);else if(E=="f")d.uniform1f(v,m);else if(E=="fv1")d.uniform1fv(v,m);else if(E=="fv")d.uniform3fv(v,m);else if(E==
+"v2")d.uniform2f(v,m.x,m.y);else if(E=="v3")d.uniform3f(v,m.x,m.y,m.z);else if(E=="c")d.uniform3f(v,m.r,m.g,m.b);else if(E=="t"){d.uniform1i(v,m);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){if(o.image.length==6){if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube);for(E=0;E<6;++E)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image[E])}else{o.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,
+o.image.__webGLTextureCube);for(E=0;E<6;++E)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image[E]);o.__wasSetOnce=!0}ia(d.TEXTURE_CUBE_MAP,o,o.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image)}else{o.__webGLTexture=
+d.createTexture();d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image);o.__wasSetOnce=!0}ia(d.TEXTURE_2D,o,o.image);d.bindTexture(d.TEXTURE_2D,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_2D,o.__webGLTexture)}}}d.uniformMatrix4fv(q.modelViewMatrix,!1,k._modelViewMatrixArray);d.uniformMatrix3fv(q.normalMatrix,!1,k._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||
+h.envMap)&&d.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&d.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&d.uniformMatrix4fv(q.viewMatrix,!1,Ua);if(h.skinning){d.uniformMatrix4fv(q.cameraInverseMatrix,!1,Ua);d.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return t}
+function f(g,m,o,h,k,t){if(h.opacity!=0){g=e(g,m,o,h,t).attributes;if(h.morphTargets){m=h.program.attributes;t.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[t.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(m.position,3,d.FLOAT,!1,0,0);if(t.morphTargetForcedOrder.length){o=0;for(var q=t.morphTargetForcedOrder,r=t.morphTargetInfluences;o<h.numSupportedMorphTargets&&o<q.length;){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[q[o]]);
+d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=r[q[o]];o++}}else{q=[];var E=-1,x=0;r=t.morphTargetInfluences;var v,L=r.length;o=0;for(t.morphTargetBase!==-1&&(q[t.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(v=0;v<L;v++)if(!q[v]&&r[v]>E){x=v;E=r[x]}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[x]);d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=E;q[x]=1;E=-1;o++}}d.uniform1fv(h.program.uniforms.morphTargetInfluences,
+t.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(g.position,3,d.FLOAT,!1,0,0)}if(g.color>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLColorBuffer);d.vertexAttribPointer(g.color,3,d.FLOAT,!1,0,0)}if(g.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLNormalBuffer);d.vertexAttribPointer(g.normal,3,d.FLOAT,!1,0,0)}if(g.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLTangentBuffer);d.vertexAttribPointer(g.tangent,4,d.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,
+k.__webGLUVBuffer);d.vertexAttribPointer(g.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv)}else d.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLUV2Buffer);d.vertexAttribPointer(g.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv2)}else d.disableVertexAttribArray(g.uv2);if(h.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);d.vertexAttribPointer(g.skinVertexA,
+4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);d.vertexAttribPointer(g.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);d.vertexAttribPointer(g.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);d.vertexAttribPointer(g.skinWeight,4,d.FLOAT,!1,0,0)}if(t instanceof THREE.Mesh)if(h.wireframe){d.lineWidth(h.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);d.drawElements(d.LINES,
+k.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,k.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(h.linewidth);d.drawArrays(t,0,k.__webGLLineCount)}else if(t instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,k.__webGLParticleCount);else t instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function i(g,m){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer=
+d.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=d.createBuffer();if(g.hasPos){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,g.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.position);d.vertexAttribPointer(m.attributes.position,3,d.FLOAT,!1,0,0)}if(g.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,g.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.normal);d.vertexAttribPointer(m.attributes.normal,
+3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,g.count);g.count=0}function j(g){if(sa!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);sa=g.doubleSided}if(ja!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);ja=g.flipSided}}function p(g){if(na!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);na=g}}function n(g){pa[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);pa[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);pa[2].set(g.n41+g.n21,g.n42+g.n22,
+g.n43+g.n23,g.n44+g.n24);pa[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);pa[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);pa[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=pa[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function s(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),h=0;h<6;h++){g=pa[h].x*m.n14+pa[h].y*m.n24+pa[h].z*m.n34+pa[h].w;if(g<=o)return!1}return!0}function z(g,
+m){g.list[g.count]=m;g.count+=1}function A(g){var m,o,h=g.object,k=g.opaque,t=g.transparent;t.count=0;g=k.count=0;for(m=h.materials.length;g<m;g++){o=h.materials[g];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?z(t,o):z(k,o)}}function D(g){var m,o,h,k,t=g.object,q=g.buffer,r=g.opaque,E=g.transparent;E.count=0;g=r.count=0;for(h=t.materials.length;g<h;g++){m=t.materials[g];if(m instanceof THREE.MeshFaceMaterial){m=0;for(o=q.materials.length;m<o;m++)(k=q.materials[m])&&(k.opacity&&k.opacity<
+1||k.blending!=THREE.NormalBlending?z(E,k):z(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?z(E,k):z(r,k)}}}function y(g,m){return m.z-g.z}function K(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function H(g){function m(W){var I=[];o=0;for(h=W.length;o<h;o++)W[o]==undefined?I.push("undefined"):I.push(W[o].id);return I.join("_")}var o,
+h,k,t,q,r,E,x,v={},L=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(t=g.faces.length;k<t;k++){q=g.faces[k];r=q.materials;E=m(r);v[E]==undefined&&(v[E]={hash:E,counter:0});x=v[E].hash+"_"+v[E].counter;g.geometryGroups[x]==undefined&&(g.geometryGroups[x]={faces:[],materials:r,vertices:0,numMorphTargets:L});q=q instanceof THREE.Face3?3:4;if(g.geometryGroups[x].vertices+q>65535){v[E].counter+=1;x=v[E].hash+"_"+v[E].counter;g.geometryGroups[x]==undefined&&(g.geometryGroups[x]=
+{faces:[],materials:r,vertices:0,numMorphTargets:L})}g.geometryGroups[x].faces.push(k);g.geometryGroups[x].vertices+=q}}function M(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function O(g){if(g!=wa){switch(g){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
+break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}wa=g}}function ia(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){d.texParameteri(g,d.TEXTURE_WRAP_S,V(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,V(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,V(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,V(m.minFilter));d.generateMipmap(g)}else{d.texParameteri(g,
+d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_MAG_FILTER,la(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,la(m.minFilter))}}function R(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=d.createFramebuffer();g.__webGLRenderbuffer=d.createRenderbuffer();g.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,g.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,g.width,g.height);d.bindTexture(d.TEXTURE_2D,
+g.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,V(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,V(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,V(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,V(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,V(g.format),g.width,g.height,0,V(g.format),V(g.type),null);d.bindFramebuffer(d.FRAMEBUFFER,g.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,g.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,
+d.DEPTH_ATTACHMENT,d.RENDERBUFFER,g.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=Ga;g=T}if(m!=N){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(U,ca,o,g);N=m}}function B(g,m){var o;if(g=="fragment")o=d.createShader(d.FRAGMENT_SHADER);else g=="vertex"&&(o=d.createShader(d.VERTEX_SHADER));d.shaderSource(o,m);d.compileShader(o);if(!d.getShaderParameter(o,
+d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(o));console.error(m);return null}return o}function la(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return d.LINEAR}}function V(g){switch(g){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
+case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;
+case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var ma=document.createElement("canvas"),d,Ea=null,N=null,P=this,sa=null,ja=null,wa=null,na=null,U=0,ca=0,Ga=0,T=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,Ka=new Float32Array(16),Ua=new Float32Array(16),Ma=new THREE.Vector4,Qa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},ya=!0,Va=new THREE.Color(0),Ja=0;if(a){if(a.antialias!==undefined)ya=a.antialias;a.clearColor!==undefined&&Va.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ja=a.clearAlpha}this.maxMorphTargets=8;this.domElement=ma;this.autoClear=!0;this.sortObjects=
+!0;(function(g,m,o){try{if(!(d=ma.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(h){console.error(h)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(ya,Va,Ja);this.context=d;this.setSize=function(g,m){ma.width=g;ma.height=m;this.setViewport(0,0,ma.width,ma.height)};
+this.setViewport=function(g,m,o,h){U=g;ca=m;Ga=o;T=h;d.viewport(U,ca,Ga,T)};this.setScissor=function(g,m,o,h){d.scissor(g,m,o,h)};this.enableScissorTest=function(g){g?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){d.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);d.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){d.clearColor(g.r,g.g,g.b,m)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial=
+function(g,m,o,h){var k,t,q;if(g instanceof THREE.MeshDepthMaterial)c(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)c(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)c(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)c(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)c(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)c(g,THREE.ShaderLib.basic);else g instanceof THREE.ParticleBasicMaterial&&
+c(g,THREE.ShaderLib.particle_basic);var r,E,x,v;q=x=v=0;for(r=m.length;q<r;q++){E=m[q];E instanceof THREE.DirectionalLight&&x++;E instanceof THREE.PointLight&&v++}if(v+x<=4)m=x;else{m=Math.ceil(4*x/(v+x));v=4-m}q={directional:m,point:v};r=50;if(h!==undefined&&h instanceof THREE.SkinnedMesh)r=h.bones.length;v=g.fragmentShader;m=g.vertexShader;r={fog:o,map:g.map,envMap:g.envMap,lightMap:g.lightMap,vertexColors:g.vertexColors,sizeAttenuation:g.sizeAttenuation,skinning:g.skinning,morphTargets:g.morphTargets,
+maxDirLights:q.directional,maxPointLights:q.point,maxBones:r};o=d.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
+r=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+d.attachShader(o,B("fragment",q+v));d.attachShader(o,B("vertex",r+m));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k);
+k=g.program;v=0;for(m=o.length;v<m;v++){q=o[v];k.uniforms[q]=d.getUniformLocation(k,q)}o=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(k=0;k<this.maxMorphTargets;k++)o.push("morphTarget"+k);for(t in g.attributes)o.push(t);t=g.program;k=o;o=0;for(v=k.length;o<v;o++){m=k[o];t.attributes[m]=d.getAttribLocation(t,m)}t=g.program.attributes;d.enableVertexAttribArray(t.position);t.color>=0&&d.enableVertexAttribArray(t.color);t.normal>=0&&d.enableVertexAttribArray(t.normal);
+t.tangent>=0&&d.enableVertexAttribArray(t.tangent);if(g.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0){d.enableVertexAttribArray(t.skinVertexA);d.enableVertexAttribArray(t.skinVertexB);d.enableVertexAttribArray(t.skinIndex);d.enableVertexAttribArray(t.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(t.morphTarget0>=0){d.enableVertexAttribArray(t.morphTarget0);g.numSupportedMorphTargets++}if(t.morphTarget1>=0){d.enableVertexAttribArray(t.morphTarget1);
+g.numSupportedMorphTargets++}if(t.morphTarget2>=0){d.enableVertexAttribArray(t.morphTarget2);g.numSupportedMorphTargets++}if(t.morphTarget3>=0){d.enableVertexAttribArray(t.morphTarget3);g.numSupportedMorphTargets++}if(t.morphTarget4>=0){d.enableVertexAttribArray(t.morphTarget4);g.numSupportedMorphTargets++}if(t.morphTarget5>=0){d.enableVertexAttribArray(t.morphTarget5);g.numSupportedMorphTargets++}if(t.morphTarget6>=0){d.enableVertexAttribArray(t.morphTarget6);g.numSupportedMorphTargets++}if(t.morphTarget7>=
+0){d.enableVertexAttribArray(t.morphTarget7);g.numSupportedMorphTargets++}h.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)h.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,h){var k,t,q,r,E,x,v,L,W=g.lights,I=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(Ua);m.projectionMatrix.flattenToArray(Ka);ka.multiply(m.projectionMatrix,m.matrixWorldInverse);n(ka);this.initWebGLObjects(g);
+R(o);(this.autoClear||h)&&this.clear();E=g.__webglObjects.length;for(h=0;h<E;h++){k=g.__webglObjects[h];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||s(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);K(v,m);D(k);k.render=!0;if(this.sortObjects){Ma.copy(v.position);ka.multiplyVector3(Ma);k.z=Ma.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(y);x=g.__webglObjectsImmediate.length;for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){v.matrixAutoUpdate&&
+v.matrixWorld.flattenToArray(v._objectMatrixArray);K(v,m);A(k)}}O(THREE.NormalBlending);for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;L=k.buffer;q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);f(m,W,I,r,L,v)}}}for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);t=e(m,W,I,r,v);v.render(function(Q){i(Q,t)})}}}for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;L=k.buffer;
+q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];O(r.blending);p(r.depthTest);f(m,W,I,r,L,v)}}}for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];O(r.blending);p(r.depthTest);t=e(m,W,I,r,v);v.render(function(Q){i(Q,t)})}}}if(o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=
+function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var m=g.__objectsAdded[0],o=g,h=void 0,k=void 0,t=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){k=m.geometry;k.geometryGroups==undefined&&H(k);for(h in k.geometryGroups){t=
+k.geometryGroups[h];if(!t.__webGLVertexBuffer){var q=t;q.__webGLVertexBuffer=d.createBuffer();q.__webGLNormalBuffer=d.createBuffer();q.__webGLTangentBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q.__webGLUVBuffer=d.createBuffer();q.__webGLUV2Buffer=d.createBuffer();q.__webGLSkinVertexABuffer=d.createBuffer();q.__webGLSkinVertexBBuffer=d.createBuffer();q.__webGLSkinIndicesBuffer=d.createBuffer();q.__webGLSkinWeightsBuffer=d.createBuffer();q.__webGLFaceBuffer=d.createBuffer();q.__webGLLineBuffer=
+d.createBuffer();if(q.numMorphTargets){var r=void 0,E=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(E=q.numMorphTargets;r<E;r++)q.__webGLMorphTargetsBuffers.push(d.createBuffer())}q=t;var x=m,v=void 0,L=void 0,W=E=r=0;v=void 0;L=void 0;var I=void 0;L=void 0;var Q=x.geometry;I=Q.faces;var J=q.faces;v=0;for(L=J.length;v<L;v++){fi=J[v];face=I[fi];if(face instanceof THREE.Face3){r+=3;E+=1;W+=3}else if(face instanceof THREE.Face4){r+=4;E+=2;W+=4}}v=q;L=x;I=void 0;J=void 0;var Y=void 0,Aa=void 0;Y=void 0;
+var S=[];I=0;for(J=L.materials.length;I<J;I++){Y=L.materials[I];if(Y instanceof THREE.MeshFaceMaterial){Y=0;for(l=v.materials.length;Y<l;Y++)(Aa=v.materials[Y])&&S.push(Aa)}else(Aa=Y)&&S.push(Aa)}L=S;a:{v=void 0;I=void 0;J=L.length;for(v=0;v<J;v++){I=L[v];if(I.map||I.lightMap){v=!0;break a}}v=!1}a:{I=void 0;J=void 0;S=L.length;for(I=0;I<S;I++){J=L[I];if(!(J instanceof THREE.MeshBasicMaterial||J instanceof THREE.MeshDepthMaterial)){I=J&&J.shading!=undefined&&J.shading==THREE.SmoothShading?THREE.SmoothShading:
+THREE.FlatShading;break a}}I=!1}a:{J=void 0;S=void 0;Y=L.length;for(J=0;J<Y;J++){S=L[J];if(S.vertexColors){L=S.vertexColors;break a}}L=!1}q.__vertexArray=new Float32Array(r*3);if(I)q.__normalArray=new Float32Array(r*3);if(Q.hasTangents)q.__tangentArray=new Float32Array(r*4);if(L)q.__colorArray=new Float32Array(r*3);if(v){if(Q.faceUvs.length>0||Q.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(Q.faceUvs.length>1||Q.faceVertexUvs.length>1)q.__uv2Array=new Float32Array(r*2)}if(x.geometry.skinWeights.length&&
+x.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(E*3);q.__lineArray=new Uint16Array(W*2);if(q.numMorphTargets){x=void 0;Q=void 0;q.__morphTargetsArrays=[];x=0;for(Q=q.numMorphTargets;x<Q;x++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=I==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=
+L;q.__normalType=I;q.__webGLFaceCount=E*3;q.__webGLLineCount=W*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}M(o.__webglObjects,t,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__webGLVertexCount=
+t;k.__dirtyVertices=!0;k.__dirtyColors=!0}M(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__webGLLineCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}M(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=
+d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__sortArray=[];h.__webGLParticleCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}M(o.__webglObjects,k,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&o.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,1)}for(;g.__objectsRemoved.length;){m=g.__objectsRemoved[0];
+o=g;k=void 0;h=void 0;for(k=o.__webglObjects.length-1;k>=0;k--){h=o.__webglObjects[k].object;m==h&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m<o;m++){h=g.__webglObjects[m].object;t=void 0;k=void 0;q=void 0;if(h instanceof THREE.Mesh){k=h.geometry;for(t in k.geometryGroups){q=k.geometryGroups[t];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents){r=d.DYNAMIC_DRAW;E=void 0;
+W=void 0;var Z=void 0,w=void 0;Z=void 0;var va=void 0,X=void 0,Ba=void 0;x=void 0;Q=void 0;v=void 0;L=void 0;I=void 0;var C=void 0,F=void 0,G=void 0,$=void 0;X=void 0;Ba=void 0;C=void 0;w=void 0;C=void 0;F=void 0;G=void 0;X=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;w=void 0;va=void 0;Z=void 0;Z=void 0;var xa=void 0,Wa=void 0,qa=void 0,La=Aa=Y=S=J=0,Ca=0,aa=0,Da=0,oa=0,u=0,ra=0,ta=q.__vertexArray,
+Ya=q.__uvArray,Za=q.__uv2Array,Ia=q.__normalArray,da=q.__tangentArray,ua=q.__colorArray,ea=q.__skinVertexAArray,fa=q.__skinVertexBArray,ga=q.__skinIndexArray,ha=q.__skinWeightArray,$a=q.__morphTargetsArrays,Na=q.__faceArray,Fa=q.__lineArray,gb=q.__needsSmoothNormals;Q=q.__vertexColorType;x=q.__uvType;v=q.__normalType;var za=h.geometry,ab=za.__dirtyVertices,bb=za.__dirtyElements,Xa=za.__dirtyUvs,cb=za.__dirtyNormals,db=za.__dirtyTangents,eb=za.__dirtyColors,fb=za.__dirtyMorphTargets,Ha=za.vertices,
+hb=q.faces,kb=za.faces,ib=za.faceVertexUvs[0],jb=za.faceVertexUvs[1],Ra=za.skinVerticesA,Sa=za.skinVerticesB,Ta=za.skinIndices,Pa=za.skinWeights,Oa=za.morphTargets;E=0;for(W=hb.length;E<W;E++){Z=hb[E];w=kb[Z];ib&&(L=ib[Z]);jb&&(I=jb[Z]);Z=w.vertexNormals;va=w.normal;X=w.vertexColors;Ba=w.color;if(w instanceof THREE.Face3){if(ab){C=Ha[w.a].position;F=Ha[w.b].position;G=Ha[w.c].position;ta[S]=C.x;ta[S+1]=C.y;ta[S+2]=C.z;ta[S+3]=F.x;ta[S+4]=F.y;ta[S+5]=F.z;ta[S+6]=G.x;ta[S+7]=G.y;ta[S+8]=G.z;S+=9}if(fb){xa=
+0;for(Wa=Oa.length;xa<Wa;xa++){C=Oa[xa].vertices[w.a].position;F=Oa[xa].vertices[w.b].position;G=Oa[xa].vertices[w.c].position;qa=$a[xa];qa[ra+0]=C.x;qa[ra+1]=C.y;qa[ra+2]=C.z;qa[ra+3]=F.x;qa[ra+4]=F.y;qa[ra+5]=F.z;qa[ra+6]=G.x;qa[ra+7]=G.y;qa[ra+8]=G.z}ra+=9}if(Pa.length){C=Pa[w.a];F=Pa[w.b];G=Pa[w.c];ha[u]=C.x;ha[u+1]=C.y;ha[u+2]=C.z;ha[u+3]=C.w;ha[u+4]=F.x;ha[u+5]=F.y;ha[u+6]=F.z;ha[u+7]=F.w;ha[u+8]=G.x;ha[u+9]=G.y;ha[u+10]=G.z;ha[u+11]=G.w;C=Ta[w.a];F=Ta[w.b];G=Ta[w.c];ga[u]=C.x;ga[u+1]=C.y;ga[u+
+2]=C.z;ga[u+3]=C.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=G.x;ga[u+9]=G.y;ga[u+10]=G.z;ga[u+11]=G.w;C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];ea[u]=C.x;ea[u+1]=C.y;ea[u+2]=C.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=G.x;ea[u+9]=G.y;ea[u+10]=G.z;ea[u+11]=1;C=Sa[w.a];F=Sa[w.b];G=Sa[w.c];fa[u]=C.x;fa[u+1]=C.y;fa[u+2]=C.z;fa[u+3]=1;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=1;fa[u+8]=G.x;fa[u+9]=G.y;fa[u+10]=G.z;fa[u+11]=1;u+=12}if(eb&&Q){if(X.length==3&&Q==THREE.VertexColors){C=
+X[0];F=X[1];G=X[2]}else G=F=C=Ba;ua[oa]=C.r;ua[oa+1]=C.g;ua[oa+2]=C.b;ua[oa+3]=F.r;ua[oa+4]=F.g;ua[oa+5]=F.b;ua[oa+6]=G.r;ua[oa+7]=G.g;ua[oa+8]=G.b;oa+=9}if(db&&za.hasTangents){X=Ha[w.a].tangent;Ba=Ha[w.b].tangent;C=Ha[w.c].tangent;da[aa]=X.x;da[aa+1]=X.y;da[aa+2]=X.z;da[aa+3]=X.w;da[aa+4]=Ba.x;da[aa+5]=Ba.y;da[aa+6]=Ba.z;da[aa+7]=Ba.w;da[aa+8]=C.x;da[aa+9]=C.y;da[aa+10]=C.z;da[aa+11]=C.w;aa+=12}if(cb&&v)if(Z.length==3&&gb)for(w=0;w<3;w++){va=Z[w];Ia[Ca]=va.x;Ia[Ca+1]=va.y;Ia[Ca+2]=va.z;Ca+=3}else for(w=
+0;w<3;w++){Ia[Ca]=va.x;Ia[Ca+1]=va.y;Ia[Ca+2]=va.z;Ca+=3}if(Xa&&L!==undefined&&x)for(w=0;w<3;w++){Z=L[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Xa&&I!==undefined&&x)for(w=0;w<3;w++){Z=I[w];Za[Aa]=Z.u;Za[Aa+1]=Z.v;Aa+=2}if(bb){Na[La]=J;Na[La+1]=J+1;Na[La+2]=J+2;La+=3;Fa[Da]=J;Fa[Da+1]=J+1;Fa[Da+2]=J;Fa[Da+3]=J+2;Fa[Da+4]=J+1;Fa[Da+5]=J+2;Da+=6;J+=3}}else if(w instanceof THREE.Face4){if(ab){C=Ha[w.a].position;F=Ha[w.b].position;G=Ha[w.c].position;$=Ha[w.d].position;ta[S]=C.x;ta[S+1]=C.y;ta[S+2]=C.z;ta[S+3]=
+F.x;ta[S+4]=F.y;ta[S+5]=F.z;ta[S+6]=G.x;ta[S+7]=G.y;ta[S+8]=G.z;ta[S+9]=$.x;ta[S+10]=$.y;ta[S+11]=$.z;S+=12}if(fb){xa=0;for(Wa=Oa.length;xa<Wa;xa++){C=Oa[xa].vertices[w.a].position;F=Oa[xa].vertices[w.b].position;G=Oa[xa].vertices[w.c].position;$=Oa[xa].vertices[w.d].position;qa=$a[xa];qa[ra+0]=C.x;qa[ra+1]=C.y;qa[ra+2]=C.z;qa[ra+3]=F.x;qa[ra+4]=F.y;qa[ra+5]=F.z;qa[ra+6]=G.x;qa[ra+7]=G.y;qa[ra+8]=G.z;qa[ra+9]=$.x;qa[ra+10]=$.y;qa[ra+11]=$.z}ra+=12}if(Pa.length){C=Pa[w.a];F=Pa[w.b];G=Pa[w.c];$=Pa[w.d];
+ha[u]=C.x;ha[u+1]=C.y;ha[u+2]=C.z;ha[u+3]=C.w;ha[u+4]=F.x;ha[u+5]=F.y;ha[u+6]=F.z;ha[u+7]=F.w;ha[u+8]=G.x;ha[u+9]=G.y;ha[u+10]=G.z;ha[u+11]=G.w;ha[u+12]=$.x;ha[u+13]=$.y;ha[u+14]=$.z;ha[u+15]=$.w;C=Ta[w.a];F=Ta[w.b];G=Ta[w.c];$=Ta[w.d];ga[u]=C.x;ga[u+1]=C.y;ga[u+2]=C.z;ga[u+3]=C.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=G.x;ga[u+9]=G.y;ga[u+10]=G.z;ga[u+11]=G.w;ga[u+12]=$.x;ga[u+13]=$.y;ga[u+14]=$.z;ga[u+15]=$.w;C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];$=Ra[w.d];ea[u]=C.x;ea[u+1]=C.y;ea[u+2]=
+C.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=G.x;ea[u+9]=G.y;ea[u+10]=G.z;ea[u+11]=1;ea[u+12]=$.x;ea[u+13]=$.y;ea[u+14]=$.z;ea[u+15]=1;C=Sa[w.a];F=Sa[w.b];G=Sa[w.c];$=Sa[w.d];fa[u]=C.x;fa[u+1]=C.y;fa[u+2]=C.z;fa[u+3]=1;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=1;fa[u+8]=G.x;fa[u+9]=G.y;fa[u+10]=G.z;fa[u+11]=1;fa[u+12]=$.x;fa[u+13]=$.y;fa[u+14]=$.z;fa[u+15]=1;u+=16}if(eb&&Q){if(X.length==4&&Q==THREE.VertexColors){C=X[0];F=X[1];G=X[2];X=X[3]}else X=G=F=C=Ba;ua[oa]=C.r;ua[oa+
+1]=C.g;ua[oa+2]=C.b;ua[oa+3]=F.r;ua[oa+4]=F.g;ua[oa+5]=F.b;ua[oa+6]=G.r;ua[oa+7]=G.g;ua[oa+8]=G.b;ua[oa+9]=X.r;ua[oa+10]=X.g;ua[oa+11]=X.b;oa+=12}if(db&&za.hasTangents){X=Ha[w.a].tangent;Ba=Ha[w.b].tangent;C=Ha[w.c].tangent;w=Ha[w.d].tangent;da[aa]=X.x;da[aa+1]=X.y;da[aa+2]=X.z;da[aa+3]=X.w;da[aa+4]=Ba.x;da[aa+5]=Ba.y;da[aa+6]=Ba.z;da[aa+7]=Ba.w;da[aa+8]=C.x;da[aa+9]=C.y;da[aa+10]=C.z;da[aa+11]=C.w;da[aa+12]=w.x;da[aa+13]=w.y;da[aa+14]=w.z;da[aa+15]=w.w;aa+=16}if(cb&&v)if(Z.length==4&&gb)for(w=0;w<
+4;w++){va=Z[w];Ia[Ca]=va.x;Ia[Ca+1]=va.y;Ia[Ca+2]=va.z;Ca+=3}else for(w=0;w<4;w++){Ia[Ca]=va.x;Ia[Ca+1]=va.y;Ia[Ca+2]=va.z;Ca+=3}if(Xa&&L!==undefined&&x)for(w=0;w<4;w++){Z=L[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Xa&&I!==undefined&&x)for(w=0;w<4;w++){Z=I[w];Za[Aa]=Z.u;Za[Aa+1]=Z.v;Aa+=2}if(bb){Na[La]=J;Na[La+1]=J+1;Na[La+2]=J+2;Na[La+3]=J;Na[La+4]=J+2;Na[La+5]=J+3;La+=6;Fa[Da]=J;Fa[Da+1]=J+1;Fa[Da+2]=J;Fa[Da+3]=J+3;Fa[Da+4]=J+1;Fa[Da+5]=J+2;Fa[Da+6]=J+2;Fa[Da+7]=J+3;Da+=8;J+=4}}}if(ab){d.bindBuffer(d.ARRAY_BUFFER,
+q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,ta,r)}if(fb){xa=0;for(Wa=Oa.length;xa<Wa;xa++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[xa]);d.bufferData(d.ARRAY_BUFFER,$a[xa],r)}}if(eb&&oa>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,ua,r)}if(cb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ia,r)}if(db&&za.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,da,r)}if(Xa&&
+Y>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ya,r)}if(Xa&&Aa>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(bb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Na,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Fa,r)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,ea,r);d.bindBuffer(d.ARRAY_BUFFER,
+q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,fa,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,ga,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ha,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;
+x=void 0;Q=void 0;q=void 0;v=h.vertices;r=h.colors;L=v.length;E=r.length;I=h.__vertexArray;W=h.__colorArray;J=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<L;x++){Q=v[x].position;q=x*3;I[q]=Q.x;I[q+1]=Q.y;I[q+2]=Q.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,I,t)}if(J){for(x=0;x<E;x++){color=r[x];q=x*3;W[q]=color.r;W[q+1]=color.g;W[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,W,t)}}k.__dirtyVertices=!1;k.__dirtyColors=
+!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;x=void 0;Q=void 0;q=void 0;v=h.vertices;r=h.colors;L=v.length;E=r.length;I=h.__vertexArray;W=h.__colorArray;J=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<L;x++){Q=v[x].position;q=x*3;I[q]=Q.x;I[q+1]=Q.y;I[q+2]=Q.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,I,t)}if(J){for(x=0;x<E;x++){color=r[x];q=x*3;W[q]=color.r;W[q+1]=color.g;W[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,
+h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,W,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){k=h.geometry;(k.__dirtyVertices||k.__dirtyColors||h.sortParticles)&&b(k,d.DYNAMIC_DRAW,h);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,m){if(g){!m||m=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(g=="back")d.cullFace(d.BACK);else g=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};
+this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};

文件差異過大導致無法顯示
+ 7 - 2
examples/obj/cubecolors/cubecolors.js


文件差異過大導致無法顯示
+ 11 - 4
examples/obj/leeperrysmith/LeePerrySmith.js


+ 4 - 5
examples/webgl_geometry_blenderexport_colors.html

@@ -33,9 +33,8 @@
 		<div id="container"></div>
 		<div id="container"></div>
 		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> webgl - io blender - vertex colors</div>
 		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> webgl - io blender - vertex colors</div>
 
 
-		<script type="text/javascript" src="../build/custom/ThreeWebGL.js"></script>
-		<script type="text/javascript" src="../build/custom/ThreeExtras.js"></script>
-
+		<script type="text/javascript" src="../build/Three.js"></script>
+		
 		<script type="text/javascript" src="js/Detector.js"></script>
 		<script type="text/javascript" src="js/Detector.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
@@ -74,8 +73,8 @@
 				light.position.normalize();
 				light.position.normalize();
 				scene.addLight( light );
 				scene.addLight( light );
 
 
-				var loader = new THREE.Loader();
-				loader.loadAscii( { model: "obj/cubecolors/cubecolors.js", callback: createScene } );
+				var loader = new THREE.JSONLoader();
+				loader.load( { model: "obj/cubecolors/cubecolors.js", callback: createScene } );
 
 
 				renderer = new THREE.WebGLRenderer();
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.setSize( window.innerWidth, window.innerHeight );

+ 4 - 4
examples/webgl_materials_normalmap.html

@@ -160,10 +160,10 @@
 
 
 				var material2 = new THREE.MeshPhongMaterial( { color: diffuse, specular: specular, ambient: ambient, shininess: shininess } );
 				var material2 = new THREE.MeshPhongMaterial( { color: diffuse, specular: specular, ambient: ambient, shininess: shininess } );
 
 
-				loader = new THREE.Loader( true );
+				loader = new THREE.BinaryLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 				document.body.appendChild( loader.statusDomElement );
 
 
-				loader.loadBinary( { model: "obj/ninja/NinjaLo_bin.js", callback: function( geometry ) { createScene( geometry, scale, material1, material2 ) } } );
+				loader.load( { model: "obj/ninja/NinjaLo_bin.js", callback: function( geometry ) { createScene( geometry, scale, material1, material2 ) } } );
 
 
 				webglRenderer = new THREE.WebGLRenderer();
 				webglRenderer = new THREE.WebGLRenderer();
 				webglRenderer.setSize( window.innerWidth, window.innerHeight );
 				webglRenderer.setSize( window.innerWidth, window.innerHeight );
@@ -187,9 +187,9 @@
 
 
 			function createScene( geometry, scale, material1, material2 ) {
 			function createScene( geometry, scale, material1, material2 ) {
 
 
-				geometry.computeTangents();
+				//geometry.computeTangents();
 
 
-				mesh1 = SceneUtils.addMesh( scene, geometry, scale, -scale * 12, 0, 0, 0,0,0, material1 );
+				//mesh1 = SceneUtils.addMesh( scene, geometry, scale, -scale * 12, 0, 0, 0,0,0, material1 );
 				mesh2 = SceneUtils.addMesh( scene, geometry, scale,  scale * 12, 0, 0, 0,0,0, material2 );
 				mesh2 = SceneUtils.addMesh( scene, geometry, scale,  scale * 12, 0, 0, 0,0,0, material2 );
 
 
 				loader.statusDomElement.style.display = "none";
 				loader.statusDomElement.style.display = "none";

+ 4 - 3
examples/webgl_materials_normalmap2.html

@@ -141,10 +141,10 @@
 				var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms };
 				var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms };
 				var material = new THREE.MeshShaderMaterial( parameters );
 				var material = new THREE.MeshShaderMaterial( parameters );
 
 
-				loader = new THREE.Loader( true );
+				loader = new THREE.JSONLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 				document.body.appendChild( loader.statusDomElement );
 
 
-				loader.loadAscii( { model: "obj/leeperrysmith/LeePerrySmith.js", callback: function( geometry ) { createScene( geometry, 100, material ) } } );
+				loader.load( { model: "obj/leeperrysmith/LeePerrySmith.js", callback: function( geometry ) { createScene( geometry, 100, material ) } } );
 
 
 				webglRenderer = new THREE.WebGLRenderer();
 				webglRenderer = new THREE.WebGLRenderer();
 				webglRenderer.setSize( window.innerWidth, window.innerHeight );
 				webglRenderer.setSize( window.innerWidth, window.innerHeight );
@@ -166,8 +166,9 @@
 
 
 			function createScene( geometry, scale, material ) {
 			function createScene( geometry, scale, material ) {
 
 
-				geometry.computeTangents();
+				//geometry.computeTangents();
 
 
+				material = new THREE.MeshFaceMaterial();
 				mesh1 = SceneUtils.addMesh( scene, geometry, scale, 0, - 50, 0, 0, 0, 0, material );
 				mesh1 = SceneUtils.addMesh( scene, geometry, scale, 0, - 50, 0, 0, 0, 0, material );
 
 
 				loader.statusDomElement.style.display = "none";
 				loader.statusDomElement.style.display = "none";

+ 2 - 2
src/extras/io/BinaryLoader.js

@@ -507,7 +507,7 @@ THREE.BinaryLoader.prototype = {
 				u3 = uvs[ uvc*2 ];
 				u3 = uvs[ uvc*2 ];
 				v3 = uvs[ uvc*2 + 1 ];
 				v3 = uvs[ uvc*2 + 1 ];
 
 
-				THREE.BinaryLoader.prototype.uv3( scope.uvs, u1, v1, u2, v2, u3, v3 );
+				THREE.BinaryLoader.prototype.uv3( scope.faceVertexUvs[ 0 ], u1, v1, u2, v2, u3, v3 );
 
 
 			}
 			}
 
 
@@ -532,7 +532,7 @@ THREE.BinaryLoader.prototype = {
 				u4 = uvs[ uvd*2 ];
 				u4 = uvs[ uvd*2 ];
 				v4 = uvs[ uvd*2 + 1 ];
 				v4 = uvs[ uvd*2 + 1 ];
 
 
-				THREE.BinaryLoader.prototype.uv4( scope.uvs, u1, v1, u2, v2, u3, v3, u4, v4 );
+				THREE.BinaryLoader.prototype.uv4( scope.faceVertexUvs[ 0 ], u1, v1, u2, v2, u3, v3, u4, v4 );
 
 
 			}
 			}
 
 

+ 6 - 3
src/extras/io/JSONLoader.js

@@ -88,10 +88,11 @@ THREE.JSONLoader.prototype = {
 				faces = json.faces,
 				faces = json.faces,
 				vertices = json.vertices,
 				vertices = json.vertices,
 				normals = json.normals,
 				normals = json.normals,
+				colors = json.colors,
 
 
 				nUvLayers = 0;
 				nUvLayers = 0;
 				
 				
-				// discard empty arrays
+				// disregard empty arrays
 				
 				
 				for ( i = 0; i < json.uvs.length; i++ ) {
 				for ( i = 0; i < json.uvs.length; i++ ) {
 					
 					
@@ -256,9 +257,11 @@ THREE.JSONLoader.prototype = {
 
 
 						for ( i = 0; i < nVertices; i++ ) {
 						for ( i = 0; i < nVertices; i++ ) {
 
 
-							color = new THREE.Color( faces[ offset ++ ] );
+							colorIndex = faces[ offset ++ ];
+							
+							color = new THREE.Color( colors[ colorIndex ] );
 							face.vertexColors.push( color );
 							face.vertexColors.push( color );
-
+							
 						}
 						}
 
 
 					}
 					}

+ 1 - 1
src/extras/io/Loader.js

@@ -121,7 +121,7 @@ THREE.Loader.prototype = {
 		// defaults
 		// defaults
 		
 		
 		mtype = "MeshLambertMaterial";
 		mtype = "MeshLambertMaterial";
-		mpars = { color: 0xeeeeee, opacity: 1.0, map: null, lightMap: null, vertexColors: m.vertexColors };
+		mpars = { color: 0xeeeeee, opacity: 1.0, map: null, lightMap: null, vertexColors: m.vertexColors ? THREE.VertexColors : false };
 		
 		
 		// parameters from model file
 		// parameters from model file
 		
 		

+ 4 - 3
src/materials/Material.js

@@ -2,10 +2,11 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.FlatShading = 0;
-THREE.SmoothShading = 1;
+THREE.NoShading = 0;
+THREE.FlatShading = 1;
+THREE.SmoothShading = 2;
 
 
-THREE.MaterialColors = 0;
+THREE.NoColors = 0;
 THREE.FaceColors = 1;
 THREE.FaceColors = 1;
 THREE.VertexColors = 2;
 THREE.VertexColors = 2;
 
 

+ 1 - 1
src/renderers/WebGLRenderer.js

@@ -1177,7 +1177,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			}
 			}
 		}
 		}
 
 
-		if ( dirtyColors && obj_colors.length ) {
+		if ( dirtyColors && offset_color > 0 ) {
 
 
 			_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLColorBuffer );
 			_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLColorBuffer );
 			_gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint );
 			_gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint );

+ 4 - 3
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/__init__.py

@@ -17,10 +17,11 @@
 # ##### END GPL LICENSE BLOCK #####
 # ##### END GPL LICENSE BLOCK #####
 
 
 # To support reload properly, try to access a package var, if it's there, reload everything
 # To support reload properly, try to access a package var, if it's there, reload everything
-if "bpy" in locals():
-    import sys
-    reload(sys.modules.get("io_mesh_threejs.export_threejs", sys))
 
 
+if "bpy" in locals():
+    import imp
+    if "export_threejs" in locals():
+        imp.reload(export_threejs)
 
 
 import bpy
 import bpy
 from bpy.props import *
 from bpy.props import *

+ 124 - 166
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/export_threejs.py

@@ -57,12 +57,17 @@ TEMPLATE_FILE_ASCII = """\
  *
  *
  * vertices: %(nvertex)d
  * vertices: %(nvertex)d
  * faces: %(nface)d
  * faces: %(nface)d
+ * normals: %(nnormal)d
+ * uvs: %(nuv)d
+ * colors: %(ncolor)d
  * materials: %(nmaterial)d
  * materials: %(nmaterial)d
  *
  *
  */
  */
 
 
 var model = {
 var model = {
 
 
+    'version' : 2,
+    
     'materials': [%(materials)s],
     'materials': [%(materials)s],
 
 
     'normals': [%(normals)s],
     'normals': [%(normals)s],
@@ -71,17 +76,9 @@ var model = {
 
 
     'colors': [%(colors)s],
     'colors': [%(colors)s],
 
 
-    'uvs': [%(uvs)s],
-
-    'triangles': [%(triangles)s],
-    'trianglesUvs': [%(trianglesUvs)s],
-    'trianglesNormals': [%(trianglesNormals)s],
-    'trianglesNormalsUvs': [%(trianglesNormalsUvs)s],
+    'uvs': [[%(uvs)s]],
 
 
-    'quads': [%(quads)s],
-    'quadsUvs': [%(quadsUvs)s],
-    'quadsNormals': [%(quadsNormals)s],
-    'quadsNormalsUvs': [%(quadsNormalsUvs)s],
+    'faces': [%(faces)s],
 
 
     'end': (new Date).getTime()
     'end': (new Date).getTime()
 
 
@@ -92,24 +89,9 @@ postMessage( model );
 
 
 TEMPLATE_VERTEX = "%f,%f,%f"
 TEMPLATE_VERTEX = "%f,%f,%f"
 
 
-TEMPLATE_UV_TRI = "%f,%f,%f,%f,%f,%f"
-TEMPLATE_UV_QUAD = "%f,%f,%f,%f,%f,%f,%f,%f"
-
-TEMPLATE_TRI = "%d,%d,%d,%d"
-TEMPLATE_QUAD = "%d,%d,%d,%d,%d"
-
-TEMPLATE_TRI_UV = "%d,%d,%d,%d,%d,%d,%d"
-TEMPLATE_QUAD_UV = "%d,%d,%d,%d,%d,%d,%d,%d,%d"
-
-TEMPLATE_TRI_N = "%d,%d,%d,%d,%d,%d,%d"
-TEMPLATE_QUAD_N = "%d,%d,%d,%d,%d,%d,%d,%d,%d"
-
-TEMPLATE_TRI_N_UV = "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
-TEMPLATE_QUAD_N_UV = "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
-
 TEMPLATE_N = "%f,%f,%f"
 TEMPLATE_N = "%f,%f,%f"
-TEMPLATE_C = "%f,%f,%f"
 TEMPLATE_UV = "%f,%f"
 TEMPLATE_UV = "%f,%f"
+TEMPLATE_C = "0x%06x"
 
 
 # #####################################################
 # #####################################################
 # Utils
 # Utils
@@ -127,14 +109,21 @@ def get_normal_indices(v, normals, mesh):
         n.append( normals[veckey3d(mv[i].normal)] )
         n.append( normals[veckey3d(mv[i].normal)] )
     return n
     return n
 
 
-def get_uv_indices(f, uvs, mesh):
+def get_uv_indices(face_index, uvs, mesh):
     uv = []
     uv = []
-    face_index = f[1]
     uv_layer = mesh.uv_textures.active.data
     uv_layer = mesh.uv_textures.active.data
     for i in uv_layer[face_index].uv:
     for i in uv_layer[face_index].uv:
         uv.append( uvs[veckey2d(i)] )
         uv.append( uvs[veckey2d(i)] )
     return uv
     return uv
 
 
+def get_color_indices(v, normals, mesh):
+    # TODO: make it proper
+    # this just reuses vertex indices as color indices
+    n = []
+    for i in range(len(v)):
+        n.append( v[i] )
+    return n
+
 # #####################################################
 # #####################################################
 # Alignment
 # Alignment
 # #####################################################
 # #####################################################
@@ -221,131 +210,100 @@ def generate_vertex(v):
 
 
 def generate_normal(n):
 def generate_normal(n):
     return TEMPLATE_N % (n[0], n[1], n[2])
     return TEMPLATE_N % (n[0], n[1], n[2])
-
+    
 def generate_vertex_color(c):
 def generate_vertex_color(c):
-    return TEMPLATE_C % (c[0], c[1], c[2])
+    hexcolor = ( int(c[0] * 255) << 16  ) + ( int(c[1] * 255) << 8 ) + int(c[2] * 255)
+    return TEMPLATE_C % hexcolor
     
     
 def generate_uv(uv):
 def generate_uv(uv):
     return TEMPLATE_UV % (uv[0], 1.0 - uv[1])
     return TEMPLATE_UV % (uv[0], 1.0 - uv[1])
 
 
-def generate_triangle(f):
-    v = f[0].vertices
-    m = f[0].material_index
-    return TEMPLATE_TRI % (v[0], v[1], v[2],
-                           m)
-
-def generate_quad(f):
-    v = f[0].vertices
-    m = f[0].material_index
-    return TEMPLATE_QUAD % (v[0], v[1], v[2], v[3],
-                            m)
-
-def generate_triangle_n(f, normals, mesh):
-    v = f[0].vertices
-    m = f[0].material_index
-    n = get_normal_indices(v, normals, mesh)
-
-    return TEMPLATE_TRI_N % (v[0], v[1], v[2],
-                             m,
-                             n[0], n[1], n[2])
-
-def generate_quad_n(f, normals, mesh):
-    v = f[0].vertices
-    m = f[0].material_index
-    n = get_normal_indices(v, normals, mesh)
-
-    return TEMPLATE_QUAD_N % (v[0], v[1], v[2], v[3],
-                              m,
-                              n[0], n[1], n[2], n[3])
-
-def generate_triangle_uv(f, uvs, mesh):
-    v = f[0].vertices
-    m = f[0].material_index
-    uv = get_uv_indices(f, uvs, mesh)
-
-    return TEMPLATE_TRI_UV % (v[0], v[1], v[2],
-                              m,
-                              uv[0], uv[1], uv[2])
-
-def generate_quad_uv(f, uvs, mesh):
-    v = f[0].vertices
-    m = f[0].material_index
-    uv = get_uv_indices(f, uvs, mesh)
-
-    return TEMPLATE_QUAD_UV % (v[0], v[1], v[2], v[3],
-                               m,
-                               uv[0], uv[1], uv[2], uv[3])
-
-def generate_triangle_n_uv(f, normals, uvs, mesh):
-    v = f[0].vertices
-    m = f[0].material_index
-    n = get_normal_indices(v, normals, mesh)
-    uv = get_uv_indices(f, uvs, mesh)
-
-    return TEMPLATE_TRI_N_UV % (v[0], v[1], v[2],
-                                m,
-                                n[0], n[1], n[2],
-                                uv[0], uv[1], uv[2])
-
-def generate_quad_n_uv(f, normals, uvs, mesh):
-    v = f[0].vertices
-    m = f[0].material_index
-    n = get_normal_indices(v, normals, mesh)
-    uv = get_uv_indices(f, uvs, mesh)
-
-    return TEMPLATE_QUAD_N_UV % (v[0], v[1], v[2], v[3],
-                                 m,
-                                 n[0], n[1], n[2], n[3],
-                                 uv[0], uv[1], uv[2], uv[3])
-
-# #####################################################
-# Faces
-# #####################################################
-def sort_faces(faces, use_normals, use_uv_coords):
-    data = {
-    'triangles_flat': [],
-    'triangles_flat_uv': [],
-    'triangles_smooth': [],
-    'triangles_smooth_uv': [],
-
-    'quads_flat': [],
-    'quads_flat_uv': [],
-    'quads_smooth': [],
-    'quads_smooth_uv': []
-    }
-
-    for i, f in enumerate(faces):
-
-        if len(f.vertices) == 3:
-
-            if use_normals and use_uv_coords:
-                data['triangles_smooth_uv'].append([f,i])
-            elif use_normals and not use_uv_coords:
-                data['triangles_smooth'].append([f,i])
-            elif use_uv_coords:
-                data['triangles_flat_uv'].append([f,i])
-            else:
-                data['triangles_flat'].append([f,i])
+def setBit(value, position, on):
+    if on:
+        mask = 1 << position
+        return (value | mask)
+    else:
+        mask = ~(1 << position)
+        return (value & mask)    
+    
+def generate_face(f, i, normals, uvs, colors, mesh, use_normals, use_colors, use_uv_coords):
+    isTriangle = ( len(f.vertices) == 3 )
+    
+    if isTriangle:
+        nVertices = 3
+    else:
+        nVertices = 4
+        
+    hasMaterial = True # for the moment objects without materials get default material
+    
+    hasFaceUvs = False # not supported in Blender
+    hasFaceVertexUvs = use_uv_coords
 
 
-        elif len(f.vertices) == 4:
+    hasFaceNormals = False # don't export any face normals (as they are computed in engine)
+    hasFaceVertexNormals = use_normals
+    
+    hasFaceColors = False       # not supported in Blender
+    hasFaceVertexColors = use_colors
+
+    faceType = 0
+    faceType = setBit(faceType, 0, not isTriangle)
+    faceType = setBit(faceType, 1, hasMaterial)
+    faceType = setBit(faceType, 2, hasFaceUvs)
+    faceType = setBit(faceType, 3, hasFaceVertexUvs)
+    faceType = setBit(faceType, 4, hasFaceNormals)
+    faceType = setBit(faceType, 5, hasFaceVertexNormals)
+    faceType = setBit(faceType, 6, hasFaceColors)
+    faceType = setBit(faceType, 7, hasFaceVertexColors)    
+    
+    faceData = []
+    
+    # order is important, must match order in JSONLoader
+    
+    # face type
+    # vertex indices
+    # material index
+    # face uvs index
+    # face vertex uvs indices
+    # face color index
+    # face vertex colors indices
+    
+    faceData.append(faceType)    
+    
+    # must clamp in case on polygons bigger than quads
+    for i in range(nVertices):
+        index = f.vertices[i]
+        faceData.append(index)
+    
+    if hasMaterial:
+        faceData.append( f.material_index )
+
+    if hasFaceVertexUvs:
+        uv = get_uv_indices(i, uvs, mesh)
+        for i in range(nVertices):
+            index = uv[i]
+            faceData.append(index)
+
+    if hasFaceVertexNormals:
+        n = get_normal_indices(f.vertices, normals, mesh)
+        for i in range(nVertices):
+            index = n[i]
+            faceData.append(index)
+            
+    if hasFaceVertexColors:
+        c = get_color_indices(f.vertices, colors, mesh)
+        for i in range(nVertices):
+            index = c[i]
+            faceData.append(index)
 
 
-            if use_normals and use_uv_coords:
-                data['quads_smooth_uv'].append([f,i])
-            elif use_normals and not use_uv_coords:
-                data['quads_smooth'].append([f,i])
-            elif use_uv_coords:
-                data['quads_flat_uv'].append([f,i])
-            else:
-                data['quads_flat'].append([f,i])
+    return ",".join( map(str, faceData) )
 
 
-    return data
 
 
 # #####################################################
 # #####################################################
 # Normals
 # Normals
 # #####################################################
 # #####################################################
 def extract_vertex_normals(mesh, use_normals):
 def extract_vertex_normals(mesh, use_normals):
     if not use_normals:
     if not use_normals:
-        return {}
+        return {}, 0
 
 
     count = 0
     count = 0
     normals = {}
     normals = {}
@@ -357,7 +315,7 @@ def extract_vertex_normals(mesh, use_normals):
                 normals[key] = count
                 normals[key] = count
                 count += 1
                 count += 1
 
 
-    return normals
+    return normals, count
 
 
 def generate_normals(normals, use_normals):
 def generate_normals(normals, use_normals):
     if not use_normals:
     if not use_normals:
@@ -373,8 +331,11 @@ def generate_normals(normals, use_normals):
 # Vertex colors
 # Vertex colors
 # #####################################################
 # #####################################################
 def extract_vertex_colors(mesh, use_colors):
 def extract_vertex_colors(mesh, use_colors):
+    
+    # TODO: handle properly per face vertex colors
+    
     if not use_colors:
     if not use_colors:
-        return {}
+        return {}, 0
 
 
     colors = {}
     colors = {}
 
 
@@ -392,11 +353,12 @@ def extract_vertex_colors(mesh, use_colors):
                 colors[vertex_index] = fc[0], fc[1], fc[2]
                 colors[vertex_index] = fc[0], fc[1], fc[2]
 
 
     # make sure all vertices have some color
     # make sure all vertices have some color
-    for i in range(len(mesh.vertices)):
+    count = len(mesh.vertices)
+    for i in range(count):
         if i not in colors:
         if i not in colors:
             colors[i] = (0,0,0)
             colors[i] = (0,0,0)
             
             
-    return colors
+    return colors, count
 
 
 def generate_vertex_colors(colors, use_colors):
 def generate_vertex_colors(colors, use_colors):
     if not use_colors:
     if not use_colors:
@@ -413,7 +375,7 @@ def generate_vertex_colors(colors, use_colors):
 # #####################################################
 # #####################################################
 def extract_uvs(mesh, use_uv_coords):
 def extract_uvs(mesh, use_uv_coords):
     if not use_uv_coords:
     if not use_uv_coords:
-        return {}
+        return {}, 0
 
 
     count = 0
     count = 0
     uvs = {}
     uvs = {}
@@ -427,7 +389,7 @@ def extract_uvs(mesh, use_uv_coords):
                 uvs[key] = count
                 uvs[key] = count
                 count += 1
                 count += 1
 
 
-    return uvs
+    return uvs, count
 
 
 def generate_uvs(uvs, use_uv_coords):
 def generate_uvs(uvs, use_uv_coords):
     if not use_uv_coords:
     if not use_uv_coords:
@@ -499,7 +461,7 @@ def generate_materials(mtl, materials, use_colors):
         mtl_string = "\t{\n%s\n\t}" % mtl_raw
         mtl_string = "\t{\n%s\n\t}" % mtl_raw
         mtl_array.append([index, mtl_string])
         mtl_array.append([index, mtl_string])
 
 
-    return ",\n\n".join([m for i,m in sorted(mtl_array)])
+    return ",\n\n".join([m for i,m in sorted(mtl_array)]), len(mtl_array)
 
 
 def extract_materials(mesh, scene):
 def extract_materials(mesh, scene):
     world = scene.world
     world = scene.world
@@ -580,34 +542,30 @@ def generate_ascii_model(mesh, scene, use_normals, use_colors, use_uv_coords, al
     elif align_model == 3:
     elif align_model == 3:
         top(vertices)
         top(vertices)
 
 
-    sfaces = sort_faces(mesh.faces, use_normals, use_uv_coords)
-
-    normals = extract_vertex_normals(mesh, use_normals)
-    colors = extract_vertex_colors(mesh, use_colors)
-    uvs = extract_uvs(mesh, use_uv_coords)
+    normals, nnormal = extract_vertex_normals(mesh, use_normals)
+    colors, ncolor = extract_vertex_colors(mesh, use_colors)
+    uvs, nuv = extract_uvs(mesh, use_uv_coords)
 
 
+    mstring, nmaterial = generate_materials_string(mesh, scene, use_colors)
+    
     text = TEMPLATE_FILE_ASCII % {
     text = TEMPLATE_FILE_ASCII % {
-    "vertices"      : ",".join(generate_vertex(v) for v in vertices),
-
-    "triangles"     : ",".join(generate_triangle(f) for f in sfaces['triangles_flat']),
-    "trianglesUvs"  : ",".join(generate_triangle_uv(f, uvs, mesh) for f in sfaces['triangles_flat_uv']),
-    "trianglesNormals"   : ",".join(generate_triangle_n(f, normals, mesh) for f in sfaces['triangles_smooth']),
-    "trianglesNormalsUvs": ",".join(generate_triangle_n_uv(f, normals, uvs, mesh) for f in sfaces['triangles_smooth_uv']),
-
-    "quads"         : ",".join(generate_quad(f) for f in sfaces['quads_flat']),
-    "quadsUvs"      : ",".join(generate_quad_uv(f, uvs, mesh) for f in sfaces['quads_flat_uv']),
-    "quadsNormals"       : ",".join(generate_quad_n(f, normals, mesh) for f in sfaces['quads_smooth']),
-    "quadsNormalsUvs"    : ",".join(generate_quad_n_uv(f, normals, uvs, mesh) for f in sfaces['quads_smooth_uv']),
+    "nvertex"   : len(mesh.vertices),
+    "nface"     : len(mesh.faces),
+    "nuv"       : nuv,
+    "nnormal"   : nnormal,
+    "ncolor"    : ncolor,
+    "nmaterial" : nmaterial,
 
 
     "uvs"           : generate_uvs(uvs, use_uv_coords),
     "uvs"           : generate_uvs(uvs, use_uv_coords),
     "normals"       : generate_normals(normals, use_normals),
     "normals"       : generate_normals(normals, use_normals),
     "colors"        : generate_vertex_colors(colors, use_colors),
     "colors"        : generate_vertex_colors(colors, use_colors),
 
 
-    "materials" : generate_materials_string(mesh, scene, use_colors),
+    "materials" : mstring,
+
+    "vertices"      : ",".join(generate_vertex(v) for v in vertices),
+
+    "faces"     : ",".join(generate_face(f, i, normals, uvs, colors, mesh, use_normals, use_colors, use_uv_coords) for i, f in enumerate(mesh.faces))
 
 
-    "nvertex"   : len(mesh.vertices),
-    "nface"     : len(mesh.faces),
-    "nmaterial" : 0
     }
     }
 
 
     return text
     return text

部分文件因文件數量過多而無法顯示