Browse Source

Merge remote-tracking branch 'remotes/zz85/master' into unflip

alteredq 13 years ago
parent
commit
46134f6fd9
4 changed files with 189 additions and 177 deletions
  1. 38 38
      build/Three.js
  2. 10 10
      build/custom/ThreeCanvas.js
  3. 120 120
      build/custom/ThreeWebGL.js
  4. 21 9
      src/core/Geometry.js

+ 38 - 38
build/Three.js

@@ -74,19 +74,19 @@ this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.s
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion===true?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?this.matrixWorld.multiply(this.parent.matrixWorld,
 this.useQuaternion===true?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?this.matrixWorld.multiply(this.parent.matrixWorld,
 this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a;if(f===g.length){a=new THREE.RenderableObject;g.push(a)}else a=g[f];f++;return a}function b(){var a;if(i===j.length){a=new THREE.RenderableVertex;j.push(a)}else a=j[i];i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,
+THREE.Projector=function(){function a(){var a;if(f===g.length){a=new THREE.RenderableObject;g.push(a)}else a=g[f];f++;return a}function b(){var a;if(i===j.length){a=new THREE.RenderableVertex;j.push(a)}else a=j[i];i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,
 g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,f,g=[],h,i,j=[],m,o,k=[],p,r=[],n,q,s=[],u,w,t=[],x={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,C=new THREE.Vector4,z=new THREE.Matrix4,v=new THREE.Matrix4,H=new THREE.Frustum,E=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=
 g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,f,g=[],h,i,j=[],m,o,k=[],p,r=[],n,q,s=[],u,w,t=[],x={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,C=new THREE.Vector4,z=new THREE.Matrix4,v=new THREE.Matrix4,H=new THREE.Frustum,E=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=
 function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof
 function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof
 THREE.Line)&&(b.frustumCulled===false||H.contains(b)===true)){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d===true&&x.objects.sort(c);return x};this.projectScene=function(a,
 THREE.Line)&&(b.frustumCulled===false||H.contains(b)===true)){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d===true&&x.objects.sort(c);return x};this.projectScene=function(a,
-e,f){var g=e.near,F=e.far,D=false,W,R,N,ba,U,I,ca,ha,L,X,S,T,ia,ma,Aa;w=q=p=o=0;x.elements.length=0;if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);H.setFromMatrix(z);x=this.projectGraph(a,false);a=0;for(W=x.objects.length;a<W;a++){L=x.objects[a].object;X=L.matrixWorld;i=0;if(L instanceof THREE.Mesh){S=L.geometry;T=L.geometry.materials;
+f,e){var g=f.near,F=f.far,D=false,W,R,N,ba,U,I,ca,ha,L,X,S,T,ia,ma,Aa;w=q=p=o=0;x.elements.length=0;if(f.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(f)}a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);z.multiply(f.projectionMatrix,f.matrixWorldInverse);H.setFromMatrix(z);x=this.projectGraph(a,false);a=0;for(W=x.objects.length;a<W;a++){L=x.objects[a].object;X=L.matrixWorld;i=0;if(L instanceof THREE.Mesh){S=L.geometry;T=L.geometry.materials;
 ba=S.vertices;ia=S.faces;ma=S.faceVertexUvs;S=L.matrixRotationWorld.extractRotation(X);R=0;for(N=ba.length;R<N;R++){h=b();h.positionWorld.copy(ba[R]);X.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);z.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}ba=0;for(R=ia.length;ba<R;ba++){N=ia[ba];if(N instanceof THREE.Face3){U=j[N.a];
 ba=S.vertices;ia=S.faces;ma=S.faceVertexUvs;S=L.matrixRotationWorld.extractRotation(X);R=0;for(N=ba.length;R<N;R++){h=b();h.positionWorld.copy(ba[R]);X.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);z.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}ba=0;for(R=ia.length;ba<R;ba++){N=ia[ba];if(N instanceof THREE.Face3){U=j[N.a];
 I=j[N.b];ca=j[N.c];if(U.visible===true&&I.visible===true&&ca.visible===true){D=(ca.positionScreen.x-U.positionScreen.x)*(I.positionScreen.y-U.positionScreen.y)-(ca.positionScreen.y-U.positionScreen.y)*(I.positionScreen.x-U.positionScreen.x)<0;if(L.doubleSided===true||D!==L.flipSided){ha=void 0;if(o===k.length){ha=new THREE.RenderableFace3;k.push(ha)}else ha=k[o];o++;m=ha;m.v1.copy(U);m.v2.copy(I);m.v3.copy(ca)}else continue}else continue}else if(N instanceof THREE.Face4){U=j[N.a];I=j[N.b];ca=j[N.c];
 I=j[N.b];ca=j[N.c];if(U.visible===true&&I.visible===true&&ca.visible===true){D=(ca.positionScreen.x-U.positionScreen.x)*(I.positionScreen.y-U.positionScreen.y)-(ca.positionScreen.y-U.positionScreen.y)*(I.positionScreen.x-U.positionScreen.x)<0;if(L.doubleSided===true||D!==L.flipSided){ha=void 0;if(o===k.length){ha=new THREE.RenderableFace3;k.push(ha)}else ha=k[o];o++;m=ha;m.v1.copy(U);m.v2.copy(I);m.v3.copy(ca)}else continue}else continue}else if(N instanceof THREE.Face4){U=j[N.a];I=j[N.b];ca=j[N.c];
 ha=j[N.d];if(U.visible===true&&I.visible===true&&ca.visible===true&&ha.visible===true){D=(ha.positionScreen.x-U.positionScreen.x)*(I.positionScreen.y-U.positionScreen.y)-(ha.positionScreen.y-U.positionScreen.y)*(I.positionScreen.x-U.positionScreen.x)<0||(I.positionScreen.x-ca.positionScreen.x)*(ha.positionScreen.y-ca.positionScreen.y)-(I.positionScreen.y-ca.positionScreen.y)*(ha.positionScreen.x-ca.positionScreen.x)<0;if(L.doubleSided===true||D!==L.flipSided){Aa=void 0;if(p===r.length){Aa=new THREE.RenderableFace4;
 ha=j[N.d];if(U.visible===true&&I.visible===true&&ca.visible===true&&ha.visible===true){D=(ha.positionScreen.x-U.positionScreen.x)*(I.positionScreen.y-U.positionScreen.y)-(ha.positionScreen.y-U.positionScreen.y)*(I.positionScreen.x-U.positionScreen.x)<0||(I.positionScreen.x-ca.positionScreen.x)*(ha.positionScreen.y-ca.positionScreen.y)-(I.positionScreen.y-ca.positionScreen.y)*(ha.positionScreen.x-ca.positionScreen.x)<0;if(L.doubleSided===true||D!==L.flipSided){Aa=void 0;if(p===r.length){Aa=new THREE.RenderableFace4;
 r.push(Aa)}else Aa=r[p];p++;m=Aa;m.v1.copy(U);m.v2.copy(I);m.v3.copy(ca);m.v4.copy(ha)}else continue}else continue}m.normalWorld.copy(N.normal);D===false&&(L.flipSided===true||L.doubleSided===true)&&m.normalWorld.negate();S.multiplyVector3(m.normalWorld);m.centroidWorld.copy(N.centroid);X.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);z.multiplyVector3(m.centroidScreen);ca=N.vertexNormals;U=0;for(I=ca.length;U<I;U++){ha=m.vertexNormalsWorld[U];ha.copy(ca[U]);D===false&&(L.flipSided===
 r.push(Aa)}else Aa=r[p];p++;m=Aa;m.v1.copy(U);m.v2.copy(I);m.v3.copy(ca);m.v4.copy(ha)}else continue}else continue}m.normalWorld.copy(N.normal);D===false&&(L.flipSided===true||L.doubleSided===true)&&m.normalWorld.negate();S.multiplyVector3(m.normalWorld);m.centroidWorld.copy(N.centroid);X.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);z.multiplyVector3(m.centroidScreen);ca=N.vertexNormals;U=0;for(I=ca.length;U<I;U++){ha=m.vertexNormalsWorld[U];ha.copy(ca[U]);D===false&&(L.flipSided===
 true||L.doubleSided===true)&&ha.negate();S.multiplyVector3(ha)}U=0;for(I=ma.length;U<I;U++){Aa=ma[U][ba];if(Aa!==void 0){ca=0;for(ha=Aa.length;ca<ha;ca++)m.uvs[U][ca]=Aa[ca]}}m.material=L.material;m.faceMaterial=N.materialIndex!==null?T[N.materialIndex]:null;m.z=m.centroidScreen.z;x.elements.push(m)}}else if(L instanceof THREE.Line){v.multiply(z,X);ba=L.geometry.vertices;U=b();U.positionScreen.copy(ba[0]);v.multiplyVector4(U.positionScreen);X=L.type===THREE.LinePieces?2:1;R=1;for(N=ba.length;R<N;R++){U=
 true||L.doubleSided===true)&&ha.negate();S.multiplyVector3(ha)}U=0;for(I=ma.length;U<I;U++){Aa=ma[U][ba];if(Aa!==void 0){ca=0;for(ha=Aa.length;ca<ha;ca++)m.uvs[U][ca]=Aa[ca]}}m.material=L.material;m.faceMaterial=N.materialIndex!==null?T[N.materialIndex]:null;m.z=m.centroidScreen.z;x.elements.push(m)}}else if(L instanceof THREE.Line){v.multiply(z,X);ba=L.geometry.vertices;U=b();U.positionScreen.copy(ba[0]);v.multiplyVector4(U.positionScreen);X=L.type===THREE.LinePieces?2:1;R=1;for(N=ba.length;R<N;R++){U=
 b();U.positionScreen.copy(ba[R]);v.multiplyVector4(U.positionScreen);if(!((R+1)%X>0)){I=j[i-2];E.copy(U.positionScreen);O.copy(I.positionScreen);if(d(E,O)===true){E.multiplyScalar(1/E.w);O.multiplyScalar(1/O.w);T=void 0;if(q===s.length){T=new THREE.RenderableLine;s.push(T)}else T=s[q];q++;n=T;n.v1.positionScreen.copy(E);n.v2.positionScreen.copy(O);n.z=Math.max(E.z,O.z);n.material=L.material;x.elements.push(n)}}}}}a=0;for(W=x.sprites.length;a<W;a++){L=x.sprites[a].object;X=L.matrixWorld;if(L instanceof
 b();U.positionScreen.copy(ba[R]);v.multiplyVector4(U.positionScreen);if(!((R+1)%X>0)){I=j[i-2];E.copy(U.positionScreen);O.copy(I.positionScreen);if(d(E,O)===true){E.multiplyScalar(1/E.w);O.multiplyScalar(1/O.w);T=void 0;if(q===s.length){T=new THREE.RenderableLine;s.push(T)}else T=s[q];q++;n=T;n.v1.positionScreen.copy(E);n.v2.positionScreen.copy(O);n.z=Math.max(E.z,O.z);n.material=L.material;x.elements.push(n)}}}}}a=0;for(W=x.sprites.length;a<W;a++){L=x.sprites[a].object;X=L.matrixWorld;if(L instanceof
-THREE.Particle){C.set(X.elements[12],X.elements[13],X.elements[14],1);z.multiplyVector4(C);C.z=C.z/C.w;if(C.z>0&&C.z<1){g=void 0;if(w===t.length){g=new THREE.RenderableParticle;t.push(g)}else g=t[w];w++;u=g;u.x=C.x/C.w;u.y=C.y/C.w;u.z=C.z;u.rotation=L.rotation.z;u.scale.x=L.scale.x*Math.abs(u.x-(C.x+e.projectionMatrix.elements[0])/(C.w+e.projectionMatrix.elements[12]));u.scale.y=L.scale.y*Math.abs(u.y-(C.y+e.projectionMatrix.elements[5])/(C.w+e.projectionMatrix.elements[13]));u.material=L.material;
-x.elements.push(u)}}}f&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+THREE.Particle){C.set(X.elements[12],X.elements[13],X.elements[14],1);z.multiplyVector4(C);C.z=C.z/C.w;if(C.z>0&&C.z<1){g=void 0;if(w===t.length){g=new THREE.RenderableParticle;t.push(g)}else g=t[w];w++;u=g;u.x=C.x/C.w;u.y=C.y/C.w;u.z=C.z;u.rotation=L.rotation.z;u.scale.x=L.scale.x*Math.abs(u.x-(C.x+f.projectionMatrix.elements[0])/(C.w+f.projectionMatrix.elements[12]));u.scale.y=L.scale.y*Math.abs(u.y-(C.y+f.projectionMatrix.elements[5])/(C.w+f.projectionMatrix.elements[13]));u.material=L.material;
+x.elements.push(u)}}}e&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="YXZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="YXZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=
 c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="ZXY"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="ZYX"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="YZX"){this.x=f*d*e+c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e-f*g*h}else if(b==="XZY"){this.x=f*d*e-c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e+f*g*h}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
 c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="ZXY"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="ZYX"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="YZX"){this.x=f*d*e+c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e-f*g*h}else if(b==="XZY"){this.x=f*d*e-c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e+f*g*h}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
 d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;if(j>0){c=0.5/Math.sqrt(j+1);this.w=0.25/c;this.x=(i-g)*c;this.y=(d-h)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+h)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-h)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
 d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;if(j>0){c=0.5/Math.sqrt(j+1);this.w=0.25/c;this.x=(i-g)*c;this.y=(d-h)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+h)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-h)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
@@ -108,16 +108,16 @@ else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Ve
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
 e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
 e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
 [];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];i=new THREE.Vector3;j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(i);h.push(j)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
 [];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];i=new THREE.Vector3;j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(i);h.push(j)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
-i=g.faceNormals[c];j=g.vertexNormals[c];i.copy(e.normal);if(e instanceof THREE.Face3){j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2])}else{j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2]);j.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,z){h=a.vertices[b];i=a.vertices[c];
-j=a.vertices[d];m=g[e];o=g[f];k=g[z];p=i.x-h.x;r=j.x-h.x;n=i.y-h.y;q=j.y-h.y;s=i.z-h.z;u=j.z-h.z;w=o.u-m.u;t=k.u-m.u;x=o.v-m.v;F=k.v-m.v;C=1/(w*F-t*x);E.set((F*p-x*r)*C,(F*n-x*q)*C,(F*s-x*u)*C);O.set((w*r-t*p)*C,(w*q-t*n)*C,(w*u-t*s)*C);v[b].addSelf(E);v[c].addSelf(E);v[d].addSelf(E);H[b].addSelf(O);H[c].addSelf(O);H[d].addSelf(O)}var b,c,d,e,f,g,h,i,j,m,o,k,p,r,n,q,s,u,w,t,x,F,C,z,v=[],H=[],E=new THREE.Vector3,O=new THREE.Vector3,Q=new THREE.Vector3,Y=new THREE.Vector3,B=new THREE.Vector3;b=0;for(c=
+i=g.faceNormals[c];j=g.vertexNormals[c];i.copy(e.normal);if(e instanceof THREE.Face3){j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2])}else{j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2]);j.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,e,z){h=a.vertices[b];i=a.vertices[c];
+j=a.vertices[d];m=g[f];o=g[e];k=g[z];p=i.x-h.x;r=j.x-h.x;n=i.y-h.y;q=j.y-h.y;s=i.z-h.z;u=j.z-h.z;w=o.u-m.u;t=k.u-m.u;x=o.v-m.v;F=k.v-m.v;C=1/(w*F-t*x);E.set((F*p-x*r)*C,(F*n-x*q)*C,(F*s-x*u)*C);O.set((w*r-t*p)*C,(w*q-t*n)*C,(w*u-t*s)*C);v[b].addSelf(E);v[c].addSelf(E);v[d].addSelf(E);H[b].addSelf(O);H[c].addSelf(O);H[d].addSelf(O)}var b,c,d,e,f,g,h,i,j,m,o,k,p,r,n,q,s,u,w,t,x,F,C,z,v=[],H=[],E=new THREE.Vector3,O=new THREE.Vector3,Q=new THREE.Vector3,Y=new THREE.Vector3,B=new THREE.Vector3;b=0;for(c=
 this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;H[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var J=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){B.copy(f.vertexNormals[d]);e=f[J[d]];z=v[e];Q.copy(z);Q.subSelf(B.multiplyScalar(B.dot(z))).normalize();
 this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;H[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var J=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){B.copy(f.vertexNormals[d]);e=f[J[d]];z=v[e];Q.copy(z);Q.subSelf(B.multiplyScalar(B.dot(z))).normalize();
 Y.cross(f.vertexNormals[d],z);e=Y.dot(H[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(Q.x,Q.y,Q.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
 Y.cross(f.vertexNormals[d],z);e=Y.dot(H[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(Q.x,Q.y,Q.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
-a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
-e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){e=this.faces[f];if(e instanceof THREE.Face3){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c]}else if(e instanceof THREE.Face4){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e.d=c[e.d];d=[e.a,e.b,e.c,e.d];for(a=3;a>0;a--)if(d.indexOf(e["abcd"[a]])!=a){d.splice(a,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2]);e=0;for(d=this.faceVertexUvs.length;e<d;e++)(h=
-this.faceVertexUvs[e][f])&&h.splice(a,1);break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(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}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,m,o,k;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
-f+2;j=this.points[c[0]];m=this.points[c[1]];o=this.points[c[2]];k=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,m.x,o.x,k.x,g,h,i);d.y=b(j.y,m.y,o.y,k.y,g,h,i);d.z=b(j.z,m.z,o.z,k.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++){b=
-a/c;d=this.getPoint(b);g.copy(d);i=i+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){h[b]=i;e=b}}h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++){d=e+c*(1/g)*(f-e);d=this.getPoint(d);
+a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=
+[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];d=[a.a,a.b,a.c,a.d];for(e=3;e>0;e--)if(d.indexOf(a["abcd"[e]])!==e){d.splice(e,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);
+d=0;for(h=this.faceVertexUvs.length;d<h;d++)(i=this.faceVertexUvs[d][f])&&i.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,d,f,e,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,m,o,k;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
+f+2;j=this.points[c[0]];m=this.points[c[1]];o=this.points[c[2]];k=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,m.x,o.x,k.x,g,h,i);d.y=b(j.y,m.y,o.y,k.y,g,h,i);d.z=b(j.z,m.z,o.z,k.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,f=b=b=0,e=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;e.copy(this.points[0]);for(a=1;a<c;a++){b=
+a/c;d=this.getPoint(b);g.copy(d);i=i+g.distanceTo(e);e.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){h[b]=i;f=b}}h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,f,e,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);f=(b-1)/(this.points.length-1);e=b/(this.points.length-1);for(c=1;c<g-1;c++){d=f+c*(1/g)*(e-f);d=this.getPoint(d);
 h.push(i.copy(d).clone())}h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
 h.push(i.copy(d).clone())}h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
 THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
 THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
 THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
 THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
@@ -131,7 +131,7 @@ THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new T
 this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
+Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=h.crossOrigin;f.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
 d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
 d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
 if(a.shading){var m=a.shading.toLowerCase();m==="phong"?i="MeshPhongMaterial":m==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;
 if(a.shading){var m=a.shading.toLowerCase();m==="phong"?i="MeshPhongMaterial":m==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;
 if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,
 if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,
@@ -141,13 +141,13 @@ THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryL
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
 f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
 f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,m,o,k,p,r,n,q,s,u,w,t;function x(a){return a%4?4-a%4:0}function F(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,e,f,g,h,i,j,m,k=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=k[d*3];f=k[d*3+1];g=k[d*3+2];h=P[e*2];e=P[e*2+1];i=P[f*2];j=P[f*2+1];f=P[g*2];m=P[g*2+1];g=Y.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));n.push(new THREE.UV(f,
-m));g.push(n)}}function v(b,c){var d,e,f,g,h,i,j,m,k,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=P[e*2];e=P[e*2+1];j=P[f*2];k=P[f*2+1];m=P[g*2];n=P[g*2+1];g=P[h*2];f=P[h*2+1];h=Y.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,k));p.push(new THREE.UV(m,n));p.push(new THREE.UV(g,f));h.push(p)}}function H(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=i[d];
-Y.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function E(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];Y.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function O(b,c,d,e){for(var f,g,h,i,j,m,k,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];m=d[e*3+1];k=d[e*3+2];i=n[e];var o=J[m*3],p=J[m*3+1];m=J[m*3+2];var r=J[k*3],
-q=J[k*3+1];k=J[k*3+2];Y.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(J[j*3],J[j*3+1],J[j*3+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(r,q,k)],null,i))}}function Q(b,c,d,e){for(var f,g,h,i,j,m,k,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];m=d[e*4];k=d[e*4+1];n=d[e*4+2];o=d[e*4+3];j=p[e];var r=J[k*3],q=J[k*3+1];k=J[k*3+2];var s=J[n*3],t=J[n*3+1];n=J[n*3+2];var u=J[o*3],v=J[o*3+1];o=J[o*3+2];Y.faces.push(new THREE.Face4(f,
-g,h,i,[new THREE.Vector3(J[m*3],J[m*3+1],J[m*3+2]),new THREE.Vector3(r,q,k),new THREE.Vector3(s,t,n),new THREE.Vector3(u,v,o)],null,j))}}var Y=this,B=0,J=[],P=[],D,W,R;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Y,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,B,12);c=F(a,B+12);F(a,B+13);F(a,B+14);F(a,B+15);e=F(a,B+16);i=F(a,B+17);j=F(a,B+18);m=F(a,B+19);o=C(a,B+20);k=C(a,B+20+4);p=C(a,B+20+8);b=C(a,B+20+12);r=
-C(a,B+20+16);n=C(a,B+20+20);q=C(a,B+20+24);s=C(a,B+20+28);u=C(a,B+20+32);w=C(a,B+20+36);t=C(a,B+20+40);B=B+c;c=e*3+m;R=e*4+m;D=b*c;W=r*(c+i*3);e=n*(c+j*3);m=q*(c+i*3+j*3);c=s*R;i=u*(R+i*4);j=w*(R+j*4);B=B+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];Y.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(B);B=B+function(b){if(k){var b=new Int8Array(a,b,k*3),c,d,e,f;for(c=0;c<k;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];J.push(d/
-127,e/127,f/127)}}return k*3*Int8Array.BYTES_PER_ELEMENT}(B);B=B+x(k*3);B=B+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,e;for(c=0;c<p;c++){d=b[c*2];e=b[c*2+1];P.push(d,e)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(B);D=B+D+x(b*2);W=D+W+x(r*2);e=W+e+x(n*2);m=e+m+x(q*2);c=m+c+x(s*2);i=c+i+x(u*2);j=i+j+x(w*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;H(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);z(n,b)}})(W);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,m,o,k,p,r,n,q,s,u,w,t;function x(a){return a%4?4-a%4:0}function F(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,f,e,g,h,i,j,m,k=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=k[d*3];e=k[d*3+1];g=k[d*3+2];h=P[f*2];f=P[f*2+1];i=P[e*2];j=P[e*2+1];e=P[g*2];m=P[g*2+1];g=Y.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,f));n.push(new THREE.UV(i,j));n.push(new THREE.UV(e,
+m));g.push(n)}}function v(b,c){var d,f,e,g,h,i,j,m,k,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[d*4];e=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=P[f*2];f=P[f*2+1];j=P[e*2];k=P[e*2+1];m=P[g*2];n=P[g*2+1];g=P[h*2];e=P[h*2+1];h=Y.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(j,k));p.push(new THREE.UV(m,n));p.push(new THREE.UV(g,e));h.push(p)}}function H(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=i[d];
+Y.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function E(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];Y.faces.push(new THREE.Face4(f,e,g,h,null,null,i))}}function O(b,c,d,f){for(var e,g,h,i,j,m,k,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];j=d[f*3];m=d[f*3+1];k=d[f*3+2];i=n[f];var o=J[m*3],p=J[m*3+1];m=J[m*3+2];var r=J[k*3],
+q=J[k*3+1];k=J[k*3+2];Y.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(J[j*3],J[j*3+1],J[j*3+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(r,q,k)],null,i))}}function Q(b,c,d,f){for(var e,g,h,i,j,m,k,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];i=c[f*4+3];m=d[f*4];k=d[f*4+1];n=d[f*4+2];o=d[f*4+3];j=p[f];var r=J[k*3],q=J[k*3+1];k=J[k*3+2];var s=J[n*3],t=J[n*3+1];n=J[n*3+2];var u=J[o*3],v=J[o*3+1];o=J[o*3+2];Y.faces.push(new THREE.Face4(e,
+g,h,i,[new THREE.Vector3(J[m*3],J[m*3+1],J[m*3+2]),new THREE.Vector3(r,q,k),new THREE.Vector3(s,t,n),new THREE.Vector3(u,v,o)],null,j))}}var Y=this,B=0,J=[],P=[],D,W,R;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Y,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,B,12);c=F(a,B+12);F(a,B+13);F(a,B+14);F(a,B+15);e=F(a,B+16);i=F(a,B+17);j=F(a,B+18);m=F(a,B+19);o=C(a,B+20);k=C(a,B+20+4);p=C(a,B+20+8);b=C(a,B+20+12);r=
+C(a,B+20+16);n=C(a,B+20+20);q=C(a,B+20+24);s=C(a,B+20+28);u=C(a,B+20+32);w=C(a,B+20+36);t=C(a,B+20+40);B=B+c;c=e*3+m;R=e*4+m;D=b*c;W=r*(c+i*3);e=n*(c+j*3);m=q*(c+i*3+j*3);c=s*R;i=u*(R+i*4);j=w*(R+j*4);B=B+function(b){var b=new Float32Array(a,b,o*3),c,d,f,e;for(c=0;c<o;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];Y.vertices.push(new THREE.Vector3(d,f,e))}return o*3*Float32Array.BYTES_PER_ELEMENT}(B);B=B+function(b){if(k){var b=new Int8Array(a,b,k*3),c,d,f,e;for(c=0;c<k;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];J.push(d/
+127,f/127,e/127)}}return k*3*Int8Array.BYTES_PER_ELEMENT}(B);B=B+x(k*3);B=B+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,f;for(c=0;c<p;c++){d=b[c*2];f=b[c*2+1];P.push(d,f)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(B);D=B+D+x(b*2);W=D+W+x(r*2);e=W+e+x(n*2);m=e+m+x(q*2);c=m+c+x(s*2);i=c+i+x(u*2);j=i+j+x(w*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;H(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);z(n,b)}})(W);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
 q*Uint32Array.BYTES_PER_ELEMENT*3;O(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);z(q,c)}})(e);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;E(w,a,b+w*Uint32Array.BYTES_PER_ELEMENT*4);v(w,b)}})(i);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4,c=b+t*Uint32Array.BYTES_PER_ELEMENT*4;Q(t,a,b,c+t*Uint32Array.BYTES_PER_ELEMENT*4);v(t,c)}})(j);b&&H(b,B,B+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;O(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
 q*Uint32Array.BYTES_PER_ELEMENT*3;O(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);z(q,c)}})(e);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;E(w,a,b+w*Uint32Array.BYTES_PER_ELEMENT*4);v(w,b)}})(i);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4,c=b+t*Uint32Array.BYTES_PER_ELEMENT*4;Q(t,a,b,c+t*Uint32Array.BYTES_PER_ELEMENT*4);v(t,c)}})(j);b&&H(b,B,B+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;O(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
 3)}})(D);s&&E(s,m,m+s*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;Q(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 3)}})(D);s&&E(s,m,m+s*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;Q(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
@@ -258,9 +258,9 @@ T);o(i,j.v3.positionWorld,j.vertexNormalsWorld[2],ia);X.r=Math.max(0,Math.min(k.
 ia.g,1));ia.b=Math.max(0,Math.min(k.color.b*ia.b,1));Qa=Gc(X,S,T,ia);x(B,J,P,D,N,ba);jc(B,J,P,D,N,ba,0,0,1,0,0,1,Qa);x(U,I,W,R,ca,ha);jc(U,I,W,R,ca,ha,1,0,1,1,0,1,Qa)}else{L.r=pa.r;L.g=pa.g;L.b=pa.b;o(i,j.centroidWorld,j.normalWorld,L);L.r=Math.max(0,Math.min(k.color.r*L.r,1));L.g=Math.max(0,Math.min(k.color.g*L.g,1));L.b=Math.max(0,Math.min(k.color.b*L.b,1));w(B,J,P,D,W,R,N,ba);k.wireframe===true?Pb(L,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(L)}else{w(B,J,P,D,W,R,N,ba);k.wireframe===
 ia.g,1));ia.b=Math.max(0,Math.min(k.color.b*ia.b,1));Qa=Gc(X,S,T,ia);x(B,J,P,D,N,ba);jc(B,J,P,D,N,ba,0,0,1,0,0,1,Qa);x(U,I,W,R,ca,ha);jc(U,I,W,R,ca,ha,1,0,1,1,0,1,Qa)}else{L.r=pa.r;L.g=pa.g;L.b=pa.b;o(i,j.centroidWorld,j.normalWorld,L);L.r=Math.max(0,Math.min(k.color.r*L.r,1));L.g=Math.max(0,Math.min(k.color.g*L.g,1));L.b=Math.max(0,Math.min(k.color.b*L.b,1));w(B,J,P,D,W,R,N,ba);k.wireframe===true?Pb(L,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(L)}else{w(B,J,P,D,W,R,N,ba);k.wireframe===
 true?Pb(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(k.color)}else if(k instanceof THREE.MeshNormalMaterial){L.r=kc(j.normalWorld.x);L.g=kc(j.normalWorld.y);L.b=kc(j.normalWorld.z);w(B,J,P,D,W,R,N,ba);k.wireframe===true?Pb(L,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(L)}else if(k instanceof THREE.MeshDepthMaterial){Ha=m.near;Pa=m.far;X.r=X.g=X.b=1-dc(a.positionScreen.z,Ha,Pa);S.r=S.g=S.b=1-dc(d.positionScreen.z,Ha,Pa);T.r=T.g=T.b=1-dc(g.positionScreen.z,
 true?Pb(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(k.color)}else if(k instanceof THREE.MeshNormalMaterial){L.r=kc(j.normalWorld.x);L.g=kc(j.normalWorld.y);L.b=kc(j.normalWorld.z);w(B,J,P,D,W,R,N,ba);k.wireframe===true?Pb(L,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(L)}else if(k instanceof THREE.MeshDepthMaterial){Ha=m.near;Pa=m.far;X.r=X.g=X.b=1-dc(a.positionScreen.z,Ha,Pa);S.r=S.g=S.b=1-dc(d.positionScreen.z,Ha,Pa);T.r=T.g=T.b=1-dc(g.positionScreen.z,
 Ha,Pa);ia.r=ia.g=ia.b=1-dc(e.positionScreen.z,Ha,Pa);Qa=Gc(X,S,T,ia);x(B,J,P,D,N,ba);jc(B,J,P,D,N,ba,0,0,1,0,0,1,Qa);x(U,I,W,R,ca,ha);jc(U,I,W,R,ca,ha,1,0,1,1,0,1,Qa)}}}function x(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b)}function w(a,b,c,d,e,f,g,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,h);n.lineTo(a,b)}function Pb(a,b,c,e){if(F!==b)F=n.lineWidth=b;if(C!==c)C=n.lineCap=c;if(z!==e)z=n.lineJoin=e;d(a.getContextStyle());n.stroke();
 Ha,Pa);ia.r=ia.g=ia.b=1-dc(e.positionScreen.z,Ha,Pa);Qa=Gc(X,S,T,ia);x(B,J,P,D,N,ba);jc(B,J,P,D,N,ba,0,0,1,0,0,1,Qa);x(U,I,W,R,ca,ha);jc(U,I,W,R,ca,ha,1,0,1,1,0,1,Qa)}}}function x(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b)}function w(a,b,c,d,e,f,g,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,h);n.lineTo(a,b)}function Pb(a,b,c,e){if(F!==b)F=n.lineWidth=b;if(C!==c)C=n.lineCap=c;if(z!==e)z=n.lineJoin=e;d(a.getContextStyle());n.stroke();
-Ba.inflate(b*2)}function Gb(a){e(a.getContextStyle());n.fill()}function kd(a,b,c,d,f,g,h,l,i,k,j,m,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||ma[o.id]===void 0){var qa=o.wrapS==THREE.RepeatWrapping,p=o.wrapT==THREE.RepeatWrapping;ma[o.id]=n.createPattern(o.image,qa===true&&p===true?"repeat":qa===true&&p===false?"repeat-x":qa===false&&p===true?"repeat-y":"no-repeat");o.needsUpdate=false}e(ma[o.id]);var qa=o.offset.x/o.repeat.x,p=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,
-q=o.image.height*o.repeat.y,h=(h+qa)*r,l=(l+p)*q,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+qa)*r-h,k=(k+p)*q-l,j=(j+qa)*r-h,m=(m+p)*q-l,qa=i*m-j*k;if(qa===0){if(Aa[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");b.drawImage(o.image,0,0);Aa[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=Aa[o.id];h=(Math.floor(h)+Math.floor(l)*o.image.width)*4;L.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Gb(L)}else{qa=1/qa;o=(m*c-k*f)*qa;k=(m*d-k*g)*
-qa;c=(i*f-j*c)*qa;d=(i*g-j*d)*qa;a=a-o*h-c*l;h=b-k*h-d*l;n.save();n.transform(o,k,c,d,a,h);n.fill();n.restore()}}}function jc(a,b,c,d,e,f,g,h,l,i,k,j,m){var o,qa;o=m.width-1;qa=m.height-1;g=g*o;h=h*qa;c=c-a;d=d-b;e=e-a;f=f-b;l=l*o-g;i=i*qa-h;k=k*o-g;j=j*qa-h;qa=1/(l*j-k*i);o=(j*c-i*e)*qa;i=(j*d-i*f)*qa;c=(l*e-k*c)*qa;d=(l*f-k*d)*qa;a=a-o*g-c*h;b=b-i*g-d*h;n.save();n.transform(o,i,c,d,a,b);n.clip();n.drawImage(m,0,0);n.restore()}function Gc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=
+Ba.inflate(b*2)}function Gb(a){e(a.getContextStyle());n.fill()}function kd(a,b,c,d,f,g,h,i,l,k,j,m,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||ma[o.id]===void 0){var qa=o.wrapS==THREE.RepeatWrapping,p=o.wrapT==THREE.RepeatWrapping;ma[o.id]=n.createPattern(o.image,qa===true&&p===true?"repeat":qa===true&&p===false?"repeat-x":qa===false&&p===true?"repeat-y":"no-repeat");o.needsUpdate=false}e(ma[o.id]);var qa=o.offset.x/o.repeat.x,p=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,
+q=o.image.height*o.repeat.y,h=(h+qa)*r,i=(i+p)*q,c=c-a,d=d-b,f=f-a,g=g-b,l=(l+qa)*r-h,k=(k+p)*q-i,j=(j+qa)*r-h,m=(m+p)*q-i,qa=l*m-j*k;if(qa===0){if(Aa[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");b.drawImage(o.image,0,0);Aa[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=Aa[o.id];h=(Math.floor(h)+Math.floor(i)*o.image.width)*4;L.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Gb(L)}else{qa=1/qa;o=(m*c-k*f)*qa;k=(m*d-k*g)*
+qa;c=(l*f-j*c)*qa;d=(l*g-j*d)*qa;a=a-o*h-c*i;h=b-k*h-d*i;n.save();n.transform(o,k,c,d,a,h);n.fill();n.restore()}}}function jc(a,b,c,d,e,f,g,h,i,l,k,j,m){var o,qa;o=m.width-1;qa=m.height-1;g=g*o;h=h*qa;c=c-a;d=d-b;e=e-a;f=f-b;i=i*o-g;l=l*qa-h;k=k*o-g;j=j*qa-h;qa=1/(i*j-k*l);o=(j*c-l*e)*qa;l=(j*d-l*f)*qa;c=(i*e-k*c)*qa;d=(i*f-k*d)*qa;a=a-o*g-c*h;b=b-l*g-d*h;n.save();n.transform(o,l,c,d,a,b);n.clip();n.drawImage(m,0,0);n.restore()}function Gc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=
 ~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),k=~~(c.g*255),c=~~(c.b*255),j=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);Wa[0]=e<0?0:e>255?255:e;Wa[1]=f<0?0:f>255?255:f;Wa[2]=a<0?0:a>255?255:a;Wa[4]=g<0?0:g>255?255:g;Wa[5]=h<0?0:h>255?255:h;Wa[6]=b<0?0:b>255?255:b;Wa[8]=i<0?0:i>255?255:i;Wa[9]=k<0?0:k>255?255:k;Wa[10]=c<0?0:c>255?255:c;Wa[12]=j<0?0:j>255?255:j;Wa[13]=m<0?0:m>255?255:m;Wa[14]=d<0?0:d>255?255:d;lb.putImageData(Ob,0,0);Fc.drawImage(l,0,0);return qa}function dc(a,b,c){a=(a-b)/(c-b);
 ~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),k=~~(c.g*255),c=~~(c.b*255),j=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);Wa[0]=e<0?0:e>255?255:e;Wa[1]=f<0?0:f>255?255:f;Wa[2]=a<0?0:a>255?255:a;Wa[4]=g<0?0:g>255?255:g;Wa[5]=h<0?0:h>255?255:h;Wa[6]=b<0?0:b>255?255:b;Wa[8]=i<0?0:i>255?255:i;Wa[9]=k<0?0:k>255?255:k;Wa[10]=c<0?0:c>255?255:c;Wa[12]=j<0?0:j>255?255:j;Wa[13]=m<0?0:m>255?255:m;Wa[14]=d<0?0:d>255?255:d;lb.putImageData(Ob,0,0);Fc.drawImage(l,0,0);return qa}function dc(a,b,c){a=(a-b)/(c-b);
 return a*a*(3-2*a)}function kc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Qb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!==0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Hc,ld,Na,ib;this.autoClear===true?this.clear():n.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,m,this.sortElements);h=g.elements;i=g.lights;db=i.length>0;db===true&&k(i);Hc=0;for(ld=h.length;Hc<ld;Hc++){Na=h[Hc];ib=Na.material;ib=ib instanceof THREE.MeshFaceMaterial?
 return a*a*(3-2*a)}function kc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Qb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!==0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Hc,ld,Na,ib;this.autoClear===true?this.clear():n.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,m,this.sortElements);h=g.elements;i=g.lights;db=i.length>0;db===true&&k(i);Hc=0;for(ld=h.length;Hc<ld;Hc++){Na=h[Hc];ib=Na.material;ib=ib instanceof THREE.MeshFaceMaterial?
 Na.faceMaterial:ib;if(!(ib===void 0||ib.visible===false)){Ba.empty();if(Na instanceof THREE.RenderableParticle){v=Na;v.x=v.x*p;v.y=v.y*r;q(v,Na,ib,a)}else if(Na instanceof THREE.RenderableLine){v=Na.v1;H=Na.v2;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;Ba.addPoint(v.positionScreen.x,v.positionScreen.y);Ba.addPoint(H.positionScreen.x,H.positionScreen.y);cb.intersects(Ba)===true&&s(v,
 Na.faceMaterial:ib;if(!(ib===void 0||ib.visible===false)){Ba.empty();if(Na instanceof THREE.RenderableParticle){v=Na;v.x=v.x*p;v.y=v.y*r;q(v,Na,ib,a)}else if(Na instanceof THREE.RenderableLine){v=Na.v1;H=Na.v2;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;Ba.addPoint(v.positionScreen.x,v.positionScreen.y);Ba.addPoint(H.positionScreen.x,H.positionScreen.y);cb.intersects(Ba)===true&&s(v,
@@ -310,26 +310,26 @@ var i=a.colors,k=i.length,j=a.__vertexArray,m=a.__colorArray,o=a.__sortArray,n=a
 if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=o[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=o[d][1];
 if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=o[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=o[d][1];
 g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(n)for(d=0;d<g;d++){e=h[d];f=d*3;j[f]=e.x;j[f+1]=e.y;j[f+2]=e.z}if(p)for(d=0;d<k;d++){e=i[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(k=r.length;i<k;i++){h=r[i];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===
 g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(n)for(d=0;d<g;d++){e=h[d];f=d*3;j[f]=e.x;j[f+1]=e.y;j[f+2]=e.z}if(p)for(d=0;d<k;d++){e=i[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(k=r.length;i<k;i++){h=r[i];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===
 3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(n||c.sortParticles){l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,j,b)}if(p||c.sortParticles){l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,
 3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(n||c.sortParticles){l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,j,b)}if(p||c.sortParticles){l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,
-m,b)}if(r){i=0;for(k=r.length;i<k;i++){h=r[i];if(h.needsUpdate||c.sortParticles){l.bindBuffer(l.ARRAY_BUFFER,h.buffer);l.bufferData(l.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){ca=N=null;U=I=X=L=Ha=Aa=S=-1;Sa=true;a[d].render(b,c,kb,cb);ca=N=null;U=I=X=L=Ha=Aa=S=-1;Sa=true}}function j(a,b,c,d,e,f,g,h){var i,l,k,j;if(b){l=a.length-1;j=b=-1}else{l=0;b=a.length;j=1}for(var m=l;m!==b;m=m+j){i=
-a[m];if(i.render){l=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&D.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);D.setDepthTest(i.depthTest);D.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}D.setObjectFaces(l);k instanceof THREE.BufferGeometry?D.renderBufferDirect(d,e,f,i,k,l):D.renderBuffer(d,e,f,i,k,l)}}}function m(a,b,c,d,e,f,g){for(var h,i,l=0,k=a.length;l<k;l++){h=a[l];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;
-f&&D.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);D.setDepthTest(h.depthTest);D.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}D.renderImmediateObject(c,d,e,h,i)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function k(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,b){for(var c=a.length-
-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){if(d.needsUpdate){d.program&&D.deallocateMaterial(d);D.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences)e.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);var f=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==N){l.useProgram(g);N=g;f=true}if(d.id!==U){U=d.id;f=true}if(f||a!==ca){l.uniformMatrix4fv(h.projectionMatrix,
-false,a._projectionMatrixArray);a!==ca&&(ca=a)}if(f){if(c&&d.fog){i.fogColor.value=c.color;if(c instanceof THREE.Fog){i.fogNear.value=c.near;i.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Sa){for(var k,j=0,m=0,o=0,n,p,r,q=sa,s=q.directional.colors,u=q.directional.positions,v=q.point.colors,x=q.point.positions,w=q.point.distances,F=q.spot.colors,B=q.spot.positions,H=q.spot.distances,
-I=q.spot.directions,X=q.spot.angles,E=q.spot.exponents,J=0,O=0,T=0,L=r=0,c=L=0,f=b.length;c<f;c++){k=b[c];if(!k.onlyShadow&&k.visible){n=k.color;p=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(D.gammaInput){j=j+n.r*n.r;m=m+n.g*n.g;o=o+n.b*n.b}else{j=j+n.r;m=m+n.g;o=o+n.b}else if(k instanceof THREE.DirectionalLight){r=J*3;if(D.gammaInput){s[r]=n.r*n.r*p*p;s[r+1]=n.g*n.g*p*p;s[r+2]=n.b*n.b*p*p}else{s[r]=n.r*p;s[r+1]=n.g*p;s[r+2]=n.b*p}Ga.copy(k.matrixWorld.getPosition());Ga.subSelf(k.target.matrixWorld.getPosition());
+m,b)}if(r){i=0;for(k=r.length;i<k;i++){h=r[i];if(h.needsUpdate||c.sortParticles){l.bindBuffer(l.ARRAY_BUFFER,h.buffer);l.bufferData(l.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function i(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){ca=N=null;U=I=X=L=Ha=Aa=S=-1;Sa=true;a[d].render(b,c,kb,cb);ca=N=null;U=I=X=L=Ha=Aa=S=-1;Sa=true}}function j(a,b,c,d,f,e,g,h){var i,l,k,j;if(b){l=a.length-1;j=b=-1}else{l=0;b=a.length;j=1}for(var m=l;m!==b;m=m+j){i=
+a[m];if(i.render){l=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&D.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);D.setDepthTest(i.depthTest);D.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}D.setObjectFaces(l);k instanceof THREE.BufferGeometry?D.renderBufferDirect(d,f,e,i,k,l):D.renderBuffer(d,f,e,i,k,l)}}}function m(a,b,c,d,f,e,g){for(var h,i,l=0,k=a.length;l<k;l++){h=a[l];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;
+e&&D.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);D.setDepthTest(h.depthTest);D.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}D.renderImmediateObject(c,d,f,h,i)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function k(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,b){for(var c=a.length-
+1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,f){if(d.needsUpdate){d.program&&D.deallocateMaterial(d);D.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==N){l.useProgram(g);N=g;e=true}if(d.id!==U){U=d.id;e=true}if(e||a!==ca){l.uniformMatrix4fv(h.projectionMatrix,
+false,a._projectionMatrixArray);a!==ca&&(ca=a)}if(e){if(c&&d.fog){i.fogColor.value=c.color;if(c instanceof THREE.Fog){i.fogNear.value=c.near;i.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Sa){for(var k,j=0,m=0,o=0,n,p,r,q=sa,s=q.directional.colors,u=q.directional.positions,v=q.point.colors,x=q.point.positions,w=q.point.distances,F=q.spot.colors,B=q.spot.positions,H=q.spot.distances,
+I=q.spot.directions,X=q.spot.angles,E=q.spot.exponents,J=0,O=0,T=0,L=r=0,c=L=0,e=b.length;c<e;c++){k=b[c];if(!k.onlyShadow&&k.visible){n=k.color;p=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(D.gammaInput){j=j+n.r*n.r;m=m+n.g*n.g;o=o+n.b*n.b}else{j=j+n.r;m=m+n.g;o=o+n.b}else if(k instanceof THREE.DirectionalLight){r=J*3;if(D.gammaInput){s[r]=n.r*n.r*p*p;s[r+1]=n.g*n.g*p*p;s[r+2]=n.b*n.b*p*p}else{s[r]=n.r*p;s[r+1]=n.g*p;s[r+2]=n.b*p}Ga.copy(k.matrixWorld.getPosition());Ga.subSelf(k.target.matrixWorld.getPosition());
 Ga.normalize();u[r]=Ga.x;u[r+1]=Ga.y;u[r+2]=Ga.z;J=J+1}else if(k instanceof THREE.PointLight){L=O*3;if(D.gammaInput){v[L]=n.r*n.r*p*p;v[L+1]=n.g*n.g*p*p;v[L+2]=n.b*n.b*p*p}else{v[L]=n.r*p;v[L+1]=n.g*p;v[L+2]=n.b*p}n=k.matrixWorld.getPosition();x[L]=n.x;x[L+1]=n.y;x[L+2]=n.z;w[O]=r;O=O+1}else if(k instanceof THREE.SpotLight){L=T*3;if(D.gammaInput){F[L]=n.r*n.r*p*p;F[L+1]=n.g*n.g*p*p;F[L+2]=n.b*n.b*p*p}else{F[L]=n.r*p;F[L+1]=n.g*p;F[L+2]=n.b*p}n=k.matrixWorld.getPosition();B[L]=n.x;B[L+1]=n.y;B[L+2]=
 Ga.normalize();u[r]=Ga.x;u[r+1]=Ga.y;u[r+2]=Ga.z;J=J+1}else if(k instanceof THREE.PointLight){L=O*3;if(D.gammaInput){v[L]=n.r*n.r*p*p;v[L+1]=n.g*n.g*p*p;v[L+2]=n.b*n.b*p*p}else{v[L]=n.r*p;v[L+1]=n.g*p;v[L+2]=n.b*p}n=k.matrixWorld.getPosition();x[L]=n.x;x[L+1]=n.y;x[L+2]=n.z;w[O]=r;O=O+1}else if(k instanceof THREE.SpotLight){L=T*3;if(D.gammaInput){F[L]=n.r*n.r*p*p;F[L+1]=n.g*n.g*p*p;F[L+2]=n.b*n.b*p*p}else{F[L]=n.r*p;F[L+1]=n.g*p;F[L+2]=n.b*p}n=k.matrixWorld.getPosition();B[L]=n.x;B[L+1]=n.y;B[L+2]=
-n.z;H[T]=r;Ga.copy(n);Ga.subSelf(k.target.matrixWorld.getPosition());Ga.normalize();I[L]=Ga.x;I[L+1]=Ga.y;I[L+2]=Ga.z;X[T]=Math.cos(k.angle);E[T]=k.exponent;T=T+1}}}c=J*3;for(f=s.length;c<f;c++)s[c]=0;c=O*3;for(f=v.length;c<f;c++)v[c]=0;c=T*3;for(f=F.length;c<f;c++)F[c]=0;q.directional.length=J;q.point.length=O;q.spot.length=T;q.ambient[0]=j;q.ambient[1]=m;q.ambient[2]=o;Sa=false}c=sa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=
+n.z;H[T]=r;Ga.copy(n);Ga.subSelf(k.target.matrixWorld.getPosition());Ga.normalize();I[L]=Ga.x;I[L+1]=Ga.y;I[L+2]=Ga.z;X[T]=Math.cos(k.angle);E[T]=k.exponent;T=T+1}}}c=J*3;for(e=s.length;c<e;c++)s[c]=0;c=O*3;for(e=v.length;c<e;c++)v[c]=0;c=T*3;for(e=F.length;c<e;c++)F[c]=0;q.directional.length=J;q.point.length=O;q.spot.length=T;q.ambient[0]=j;q.ambient[1]=m;q.ambient[2]=o;Sa=false}c=sa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=
 c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngle.value=c.spot.angles;i.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=
 c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngle.value=c.spot.angles;i.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=
 d.opacity;D.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);i.lightMap.texture=d.lightMap;i.envMap.texture=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
 d.opacity;D.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);i.lightMap.texture=d.lightMap;i.envMap.texture=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
 THREE.LineBasicMaterial){i.diffuse.value=d.color;i.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){i.psColor.value=d.color;i.opacity.value=d.opacity;i.size.value=d.size;i.scale.value=z.height/2;i.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){i.shininess.value=d.shininess;if(D.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive);i.specular.value.copyGammaToLinear(d.specular)}else{i.ambient.value=d.ambient;
 THREE.LineBasicMaterial){i.diffuse.value=d.color;i.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){i.psColor.value=d.color;i.opacity.value=d.opacity;i.size.value=d.size;i.scale.value=z.height/2;i.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){i.shininess.value=d.shininess;if(D.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive);i.specular.value.copyGammaToLinear(d.specular)}else{i.ambient.value=d.ambient;
 i.emissive.value=d.emissive;i.specular.value=d.specular}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(D.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){i.mNear.value=a.near;i.mFar.value=a.far;i.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=
 i.emissive.value=d.emissive;i.specular.value=d.specular}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(D.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){i.mNear.value=a.near;i.mFar.value=a.far;i.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=
-d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){f=c=0;for(k=b.length;f<k;f++){j=b[f];if(j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade)){i.shadowMap.texture[c]=j.shadowMap;i.shadowMapSize.value[c]=j.shadowMapSize;i.shadowMatrix.value[c]=j.shadowMatrix;i.shadowDarkness.value[c]=j.shadowDarkness;i.shadowBias.value[c]=j.shadowBias;c++}}}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(j=g.uniforms[b[i][1]]){f=b[i][0];m=f.type;k=f.value;
-if(m==="i")l.uniform1i(j,k);else if(m==="f")l.uniform1f(j,k);else if(m==="v2")l.uniform2f(j,k.x,k.y);else if(m==="v3")l.uniform3f(j,k.x,k.y,k.z);else if(m==="v4")l.uniform4f(j,k.x,k.y,k.z,k.w);else if(m==="c")l.uniform3f(j,k.r,k.g,k.b);else if(m==="fv1")l.uniform1fv(j,k);else if(m==="fv")l.uniform3fv(j,k);else if(m==="v2v"){if(f._array===void 0)f._array=new Float32Array(2*k.length);m=0;for(o=k.length;m<o;m++){q=m*2;f._array[q]=k[m].x;f._array[q+1]=k[m].y}l.uniform2fv(j,f._array)}else if(m==="v3v"){if(f._array===
-void 0)f._array=new Float32Array(3*k.length);m=0;for(o=k.length;m<o;m++){q=m*3;f._array[q]=k[m].x;f._array[q+1]=k[m].y;f._array[q+2]=k[m].z}l.uniform3fv(j,f._array)}else if(m==="v4v"){if(f._array===void 0)f._array=new Float32Array(4*k.length);m=0;for(o=k.length;m<o;m++){q=m*4;f._array[q]=k[m].x;f._array[q+1]=k[m].y;f._array[q+2]=k[m].z;f._array[q+3]=k[m].w}l.uniform4fv(j,f._array)}else if(m==="m4"){if(f._array===void 0)f._array=new Float32Array(16);k.flattenToArray(f._array);l.uniformMatrix4fv(j,
-false,f._array)}else if(m==="m4v"){if(f._array===void 0)f._array=new Float32Array(16*k.length);m=0;for(o=k.length;m<o;m++)k[m].flattenToArrayOffset(f._array,m*16);l.uniformMatrix4fv(j,false,f._array)}else if(m==="t"){l.uniform1i(j,k);if(j=f.texture)if(j.image instanceof Array&&j.image.length===6){f=j;if(f.image.length===6)if(f.needsUpdate){if(!f.image.__webglTextureCube)f.image.__webglTextureCube=l.createTexture();l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,f.image.__webglTextureCube);
-l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,f.flipY);k=[];for(j=0;j<6;j++){m=k;o=j;if(D.autoScaleCubemaps){q=f.image[j];u=Wa;if(!(q.width<=u&&q.height<=u)){v=Math.max(q.width,q.height);s=Math.floor(q.width*u/v);u=Math.floor(q.height*u/v);v=document.createElement("canvas");v.width=s;v.height=u;v.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,u);q=v}}else q=f.image[j];m[o]=q}j=k[0];m=(j.width&j.width-1)===0&&(j.height&j.height-1)===0;o=C(f.format);q=C(f.type);t(l.TEXTURE_CUBE_MAP,f,m);for(j=0;j<6;j++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
-j,0,o,o,q,k[j]);f.generateMipmaps&&m&&l.generateMipmap(l.TEXTURE_CUBE_MAP);f.needsUpdate=false;if(f.onUpdate)f.onUpdate()}else{l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,f.image.__webglTextureCube)}}else if(j instanceof THREE.WebGLRenderTargetCube){f=j;l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,f.__webglTexture)}else D.setTexture(j,k)}else if(m==="tv"){if(f._array===void 0){f._array=[];m=0;for(o=f.texture.length;m<o;m++)f._array[m]=k+m}l.uniform1iv(j,f._array);
-m=0;for(o=f.texture.length;m<o;m++)(j=f.texture[m])&&D.setTexture(j,f._array[m])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();l.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==null&&l.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray);d.skinning&&l.uniformMatrix4fv(h.boneGlobalMatrices,
-false,e.boneMatrices)}l.uniformMatrix4fv(h.modelViewMatrix,false,e._modelViewMatrix.elements);h.normalMatrix&&l.uniformMatrix3fv(h.normalMatrix,false,e._normalMatrix.elements);h.objectMatrix!==null&&l.uniformMatrix4fv(h.objectMatrix,false,e.matrixWorld.elements);return g}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(Pa!==a){a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL);
+d.opacity;if(f.receiveShadow&&!d._shadowPass&&i.shadowMatrix){e=c=0;for(k=b.length;e<k;e++){j=b[e];if(j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade)){i.shadowMap.texture[c]=j.shadowMap;i.shadowMapSize.value[c]=j.shadowMapSize;i.shadowMatrix.value[c]=j.shadowMatrix;i.shadowDarkness.value[c]=j.shadowDarkness;i.shadowBias.value[c]=j.shadowBias;c++}}}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(j=g.uniforms[b[i][1]]){e=b[i][0];m=e.type;k=e.value;
+if(m==="i")l.uniform1i(j,k);else if(m==="f")l.uniform1f(j,k);else if(m==="v2")l.uniform2f(j,k.x,k.y);else if(m==="v3")l.uniform3f(j,k.x,k.y,k.z);else if(m==="v4")l.uniform4f(j,k.x,k.y,k.z,k.w);else if(m==="c")l.uniform3f(j,k.r,k.g,k.b);else if(m==="fv1")l.uniform1fv(j,k);else if(m==="fv")l.uniform3fv(j,k);else if(m==="v2v"){if(e._array===void 0)e._array=new Float32Array(2*k.length);m=0;for(o=k.length;m<o;m++){q=m*2;e._array[q]=k[m].x;e._array[q+1]=k[m].y}l.uniform2fv(j,e._array)}else if(m==="v3v"){if(e._array===
+void 0)e._array=new Float32Array(3*k.length);m=0;for(o=k.length;m<o;m++){q=m*3;e._array[q]=k[m].x;e._array[q+1]=k[m].y;e._array[q+2]=k[m].z}l.uniform3fv(j,e._array)}else if(m==="v4v"){if(e._array===void 0)e._array=new Float32Array(4*k.length);m=0;for(o=k.length;m<o;m++){q=m*4;e._array[q]=k[m].x;e._array[q+1]=k[m].y;e._array[q+2]=k[m].z;e._array[q+3]=k[m].w}l.uniform4fv(j,e._array)}else if(m==="m4"){if(e._array===void 0)e._array=new Float32Array(16);k.flattenToArray(e._array);l.uniformMatrix4fv(j,
+false,e._array)}else if(m==="m4v"){if(e._array===void 0)e._array=new Float32Array(16*k.length);m=0;for(o=k.length;m<o;m++)k[m].flattenToArrayOffset(e._array,m*16);l.uniformMatrix4fv(j,false,e._array)}else if(m==="t"){l.uniform1i(j,k);if(j=e.texture)if(j.image instanceof Array&&j.image.length===6){e=j;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=l.createTexture();l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);
+l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,e.flipY);k=[];for(j=0;j<6;j++){m=k;o=j;if(D.autoScaleCubemaps){q=e.image[j];u=Wa;if(!(q.width<=u&&q.height<=u)){v=Math.max(q.width,q.height);s=Math.floor(q.width*u/v);u=Math.floor(q.height*u/v);v=document.createElement("canvas");v.width=s;v.height=u;v.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,u);q=v}}else q=e.image[j];m[o]=q}j=k[0];m=(j.width&j.width-1)===0&&(j.height&j.height-1)===0;o=C(e.format);q=C(e.type);t(l.TEXTURE_CUBE_MAP,e,m);for(j=0;j<6;j++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
+j,0,o,o,q,k[j]);e.generateMipmaps&&m&&l.generateMipmap(l.TEXTURE_CUBE_MAP);e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(j instanceof THREE.WebGLRenderTargetCube){e=j;l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,e.__webglTexture)}else D.setTexture(j,k)}else if(m==="tv"){if(e._array===void 0){e._array=[];m=0;for(o=e.texture.length;m<o;m++)e._array[m]=k+m}l.uniform1iv(j,e._array);
+m=0;for(o=e.texture.length;m<o;m++)(j=e.texture[m])&&D.setTexture(j,e._array[m])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();l.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==null&&l.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray);d.skinning&&l.uniformMatrix4fv(h.boneGlobalMatrices,
+false,f.boneMatrices)}l.uniformMatrix4fv(h.modelViewMatrix,false,f._modelViewMatrix.elements);h.normalMatrix&&l.uniformMatrix3fv(h.normalMatrix,false,f._normalMatrix.elements);h.objectMatrix!==null&&l.uniformMatrix4fv(h.objectMatrix,false,f.matrixWorld.elements);return g}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(Pa!==a){a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL);
 Pa=a}if(a&&(Qa!==b||Va!==c)){l.polygonOffset(b,c);Qa=b;Va=c}}function w(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);if(!l.getShaderParameter(c,l.COMPILE_STATUS)){console.error(l.getShaderInfoLog(c));console.error(b);return null}return c}function t(a,b,c){if(c){l.texParameteri(a,l.TEXTURE_WRAP_S,C(b.wrapS));l.texParameteri(a,l.TEXTURE_WRAP_T,C(b.wrapT));l.texParameteri(a,l.TEXTURE_MAG_FILTER,
 Pa=a}if(a&&(Qa!==b||Va!==c)){l.polygonOffset(b,c);Qa=b;Va=c}}function w(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);if(!l.getShaderParameter(c,l.COMPILE_STATUS)){console.error(l.getShaderInfoLog(c));console.error(b);return null}return c}function t(a,b,c){if(c){l.texParameteri(a,l.TEXTURE_WRAP_S,C(b.wrapS));l.texParameteri(a,l.TEXTURE_WRAP_T,C(b.wrapT));l.texParameteri(a,l.TEXTURE_MAG_FILTER,
 C(b.magFilter));l.texParameteri(a,l.TEXTURE_MIN_FILTER,C(b.minFilter))}else{l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE);l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE);l.texParameteri(a,l.TEXTURE_MAG_FILTER,F(b.magFilter));l.texParameteri(a,l.TEXTURE_MIN_FILTER,F(b.minFilter))}}function x(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height);l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,
 C(b.magFilter));l.texParameteri(a,l.TEXTURE_MIN_FILTER,C(b.minFilter))}else{l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE);l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE);l.texParameteri(a,l.TEXTURE_MAG_FILTER,F(b.magFilter));l.texParameteri(a,l.TEXTURE_MIN_FILTER,F(b.minFilter))}}function x(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height);l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,
 l.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height);l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)}else l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function F(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?l.NEAREST:l.LINEAR}function C(a){return a===THREE.RepeatWrapping?l.REPEAT:a===THREE.ClampToEdgeWrapping?
 l.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height);l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)}else l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function F(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?l.NEAREST:l.LINEAR}function C(a){return a===THREE.RepeatWrapping?l.REPEAT:a===THREE.ClampToEdgeWrapping?

+ 10 - 10
build/custom/ThreeCanvas.js

@@ -111,9 +111,9 @@ m=g.faceNormals[c];l=g.vertexNormals[c];m.copy(f.normal);if(f instanceof THREE.F
 l=a.vertices[d];h=g[e];n=g[f];k=g[L];o=m.x-j.x;q=l.x-j.x;i=m.y-j.y;p=l.y-j.y;r=m.z-j.z;s=l.z-j.z;v=n.u-h.u;A=k.u-h.u;w=n.v-h.v;B=k.v-h.v;x=1/(v*B-A*w);D.set((B*o-w*q)*x,(B*i-w*p)*x,(B*r-w*s)*x);H.set((v*q-A*o)*x,(v*p-A*i)*x,(v*s-A*r)*x);u[b].addSelf(D);u[c].addSelf(D);u[d].addSelf(D);z[b].addSelf(H);z[c].addSelf(H);z[d].addSelf(H)}var b,c,d,f,e,g,j,m,l,h,n,k,o,q,i,p,r,s,v,A,w,B,x,F,u=[],z=[],D=new THREE.Vector3,H=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=
 l=a.vertices[d];h=g[e];n=g[f];k=g[L];o=m.x-j.x;q=l.x-j.x;i=m.y-j.y;p=l.y-j.y;r=m.z-j.z;s=l.z-j.z;v=n.u-h.u;A=k.u-h.u;w=n.v-h.v;B=k.v-h.v;x=1/(v*B-A*w);D.set((B*o-w*q)*x,(B*i-w*p)*x,(B*r-w*s)*x);H.set((v*q-A*o)*x,(v*p-A*i)*x,(v*s-A*r)*x);u[b].addSelf(D);u[c].addSelf(D);u[d].addSelf(D);z[b].addSelf(H);z[c].addSelf(H);z[d].addSelf(H)}var b,c,d,f,e,g,j,m,l,h,n,k,o,q,i,p,r,s,v,A,w,B,x,F,u=[],z=[],D=new THREE.Vector3,H=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=
 this.vertices.length;b<c;b++){u[b]=new THREE.Vector3;z[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];g=this.faceVertexUvs[0][b];if(e instanceof THREE.Face3)a(this,e.a,e.b,e.c,0,1,2);else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.d,0,1,3);a(this,e.b,e.c,e.d,1,2,3)}}var E=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++){t.copy(e.vertexNormals[d]);f=e[E[d]];F=u[f];P.copy(F);P.subSelf(t.multiplyScalar(t.dot(F))).normalize();
 this.vertices.length;b<c;b++){u[b]=new THREE.Vector3;z[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];g=this.faceVertexUvs[0][b];if(e instanceof THREE.Face3)a(this,e.a,e.b,e.c,0,1,2);else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.d,0,1,3);a(this,e.b,e.c,e.d,1,2,3)}}var E=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++){t.copy(e.vertexNormals[d]);f=e[E[d]];F=u[f];P.copy(F);P.subSelf(t.multiplyScalar(t.dot(F))).normalize();
 M.cross(e.vertexNormals[d],F);f=M.dot(z[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(P.x,P.y,P.z,f)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<f;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
 M.cross(e.vertexNormals[d],F);f=M.dot(z[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(P.x,P.y,P.z,f)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<f;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
-a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g,j;e=0;for(g=this.vertices.length;e<g;e++){d=this.vertices[e];d=[Math.round(d.x*
-f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=e;b.push(this.vertices[e]);c[e]=b.length-1}else c[e]=c[a[d]]}e=0;for(g=this.faces.length;e<g;e++){f=this.faces[e];if(f instanceof THREE.Face3){f.a=c[f.a];f.b=c[f.b];f.c=c[f.c]}else if(f instanceof THREE.Face4){f.a=c[f.a];f.b=c[f.b];f.c=c[f.c];f.d=c[f.d];d=[f.a,f.b,f.c,f.d];for(a=3;a>0;a--)if(d.indexOf(f["abcd"[a]])!=a){d.splice(a,1);this.faces[e]=new THREE.Face3(d[0],d[1],d[2]);f=0;for(d=this.faceVertexUvs.length;f<d;f++)(j=
-this.faceVertexUvs[f][e])&&j.splice(a,1);break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);
+a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g,j,m;e=0;for(g=this.vertices.length;e<g;e++){d=this.vertices[e];d=
+[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=e;b.push(this.vertices[e]);c[e]=b.length-1}else c[e]=c[a[d]]}e=0;for(g=this.faces.length;e<g;e++){a=this.faces[e];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];d=[a.a,a.b,a.c,a.d];for(f=3;f>0;f--)if(d.indexOf(a["abcd"[f]])!==f){d.splice(f,1);this.faces[e]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);
+d=0;for(j=this.faceVertexUvs.length;d<j;d++)(m=this.faceVertexUvs[d][e])&&m.splice(f,1);this.faces[e].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);
 THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);
 THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);
 THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
@@ -134,13 +134,13 @@ THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryL
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var j=JSON.parse(g.responseText);a.loadAjaxBuffers(j,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var j=JSON.parse(g.responseText);a.loadAjaxBuffers(j,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,j=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){j==0&&(j=e.getResponseHeader("Content-Length"));f({total:j,loaded:e.responseText.length})}}else e.readyState==2&&(j=e.getResponseHeader("Content-Length"))};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,j=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){j==0&&(j=e.getResponseHeader("Content-Length"));f({total:j,loaded:e.responseText.length})}}else e.readyState==2&&(j=e.getResponseHeader("Content-Length"))};
 e.open("GET",g,true);e.responseType="arraybuffer";e.send(null)};
 e.open("GET",g,true);e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,m,l,h,n,k,o,q,i,p,r,s,v,A;function w(a){return a%4?4-a%4:0}function B(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function F(b,c){var d,e,f,g,h,j,l,i,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=G[e*2];e=G[e*2+1];j=G[f*2];l=G[f*2+1];f=G[g*2];i=G[g*2+1];g=M.faceVertexUvs[0];var k=[];k.push(new THREE.UV(h,e));k.push(new THREE.UV(j,l));k.push(new THREE.UV(f,
-i));g.push(k)}}function u(b,c){var d,e,f,g,h,j,l,i,m,k,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];j=G[e*2];e=G[e*2+1];l=G[f*2];m=G[f*2+1];i=G[g*2];k=G[g*2+1];g=G[h*2];f=G[h*2+1];h=M.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,e));o.push(new THREE.UV(l,m));o.push(new THREE.UV(i,k));o.push(new THREE.UV(g,f));h.push(o)}}function z(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=j[d];
-M.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function D(b,c,d){for(var e,f,g,h,j,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];j=l[d];M.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}}function H(b,c,d,e){for(var f,g,h,j,l,i,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),k=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];l=d[e*3];i=d[e*3+1];m=d[e*3+2];j=k[e];var n=E[i*3],o=E[i*3+1];i=E[i*3+2];var p=E[m*3],
-q=E[m*3+1];m=E[m*3+2];M.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(E[l*3],E[l*3+1],E[l*3+2]),new THREE.Vector3(n,o,i),new THREE.Vector3(p,q,m)],null,j))}}function P(b,c,d,e){for(var f,g,h,j,l,i,m,k,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];j=c[e*4+3];i=d[e*4];m=d[e*4+1];k=d[e*4+2];n=d[e*4+3];l=o[e];var p=E[m*3],q=E[m*3+1];m=E[m*3+2];var r=E[k*3],s=E[k*3+1];k=E[k*3+2];var t=E[n*3],z=E[n*3+1];n=E[n*3+2];M.faces.push(new THREE.Face4(f,
-g,h,j,[new THREE.Vector3(E[i*3],E[i*3+1],E[i*3+2]),new THREE.Vector3(p,q,m),new THREE.Vector3(r,s,k),new THREE.Vector3(t,z,n)],null,l))}}var M=this,t=0,E=[],G=[],N,Q,O;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(M,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,t,12);c=B(a,t+12);B(a,t+13);B(a,t+14);B(a,t+15);f=B(a,t+16);m=B(a,t+17);l=B(a,t+18);h=B(a,t+19);n=x(a,t+20);k=x(a,t+20+4);o=x(a,t+20+8);b=x(a,t+20+12);q=
-x(a,t+20+16);i=x(a,t+20+20);p=x(a,t+20+24);r=x(a,t+20+28);s=x(a,t+20+32);v=x(a,t+20+36);A=x(a,t+20+40);t=t+c;c=f*3+h;O=f*4+h;N=b*c;Q=q*(c+m*3);f=i*(c+l*3);h=p*(c+m*3+l*3);c=r*O;m=s*(O+m*4);l=v*(O+l*4);t=t+function(b){var b=new Float32Array(a,b,n*3),c,d,e,f;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];M.vertices.push(new THREE.Vector3(d,e,f))}return n*3*Float32Array.BYTES_PER_ELEMENT}(t);t=t+function(b){if(k){var b=new Int8Array(a,b,k*3),c,d,e,f;for(c=0;c<k;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];E.push(d/
-127,e/127,f/127)}}return k*3*Int8Array.BYTES_PER_ELEMENT}(t);t=t+w(k*3);t=t+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(t);N=t+N+w(b*2);Q=N+Q+w(q*2);f=Q+f+w(i*2);h=f+h+w(p*2);c=h+c+w(r*2);m=c+m+w(s*2);l=m+l+w(v*2);(function(a){if(i){var b=a+i*Uint32Array.BYTES_PER_ELEMENT*3;z(i,a,b+i*Uint32Array.BYTES_PER_ELEMENT*3);F(i,b)}})(Q);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,m,l,h,n,k,o,q,i,p,r,s,v,A;function w(a){return a%4?4-a%4:0}function B(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function F(b,c){var d,e,g,f,h,j,l,i,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];g=m[d*3+1];f=m[d*3+2];h=G[e*2];e=G[e*2+1];j=G[g*2];l=G[g*2+1];g=G[f*2];i=G[f*2+1];f=M.faceVertexUvs[0];var k=[];k.push(new THREE.UV(h,e));k.push(new THREE.UV(j,l));k.push(new THREE.UV(g,
+i));f.push(k)}}function u(b,c){var d,e,g,f,h,j,l,i,m,k,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];g=n[d*4+1];f=n[d*4+2];h=n[d*4+3];j=G[e*2];e=G[e*2+1];l=G[g*2];m=G[g*2+1];i=G[f*2];k=G[f*2+1];f=G[h*2];g=G[h*2+1];h=M.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,e));o.push(new THREE.UV(l,m));o.push(new THREE.UV(i,k));o.push(new THREE.UV(f,g));h.push(o)}}function z(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];g=c[d*3+1];f=c[d*3+2];h=j[d];
+M.faces.push(new THREE.Face3(e,g,f,null,null,h))}}function D(b,c,d){for(var e,g,f,h,j,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];g=c[d*4+1];f=c[d*4+2];h=c[d*4+3];j=l[d];M.faces.push(new THREE.Face4(e,g,f,h,null,null,j))}}function H(b,c,d,e){for(var g,f,h,j,l,i,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),k=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*3];f=c[e*3+1];h=c[e*3+2];l=d[e*3];i=d[e*3+1];m=d[e*3+2];j=k[e];var n=E[i*3],o=E[i*3+1];i=E[i*3+2];var p=E[m*3],
+q=E[m*3+1];m=E[m*3+2];M.faces.push(new THREE.Face3(g,f,h,[new THREE.Vector3(E[l*3],E[l*3+1],E[l*3+2]),new THREE.Vector3(n,o,i),new THREE.Vector3(p,q,m)],null,j))}}function P(b,c,d,e){for(var g,f,h,j,l,i,m,k,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*4];f=c[e*4+1];h=c[e*4+2];j=c[e*4+3];i=d[e*4];m=d[e*4+1];k=d[e*4+2];n=d[e*4+3];l=o[e];var p=E[m*3],q=E[m*3+1];m=E[m*3+2];var r=E[k*3],s=E[k*3+1];k=E[k*3+2];var t=E[n*3],z=E[n*3+1];n=E[n*3+2];M.faces.push(new THREE.Face4(g,
+f,h,j,[new THREE.Vector3(E[i*3],E[i*3+1],E[i*3+2]),new THREE.Vector3(p,q,m),new THREE.Vector3(r,s,k),new THREE.Vector3(t,z,n)],null,l))}}var M=this,t=0,E=[],G=[],N,Q,O;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(M,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,t,12);c=B(a,t+12);B(a,t+13);B(a,t+14);B(a,t+15);f=B(a,t+16);m=B(a,t+17);l=B(a,t+18);h=B(a,t+19);n=x(a,t+20);k=x(a,t+20+4);o=x(a,t+20+8);b=x(a,t+20+12);q=
+x(a,t+20+16);i=x(a,t+20+20);p=x(a,t+20+24);r=x(a,t+20+28);s=x(a,t+20+32);v=x(a,t+20+36);A=x(a,t+20+40);t=t+c;c=f*3+h;O=f*4+h;N=b*c;Q=q*(c+m*3);f=i*(c+l*3);h=p*(c+m*3+l*3);c=r*O;m=s*(O+m*4);l=v*(O+l*4);t=t+function(b){var b=new Float32Array(a,b,n*3),c,d,e,g;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];g=b[c*3+2];M.vertices.push(new THREE.Vector3(d,e,g))}return n*3*Float32Array.BYTES_PER_ELEMENT}(t);t=t+function(b){if(k){var b=new Int8Array(a,b,k*3),c,d,e,g;for(c=0;c<k;c++){d=b[c*3];e=b[c*3+1];g=b[c*3+2];E.push(d/
+127,e/127,g/127)}}return k*3*Int8Array.BYTES_PER_ELEMENT}(t);t=t+w(k*3);t=t+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(t);N=t+N+w(b*2);Q=N+Q+w(q*2);f=Q+f+w(i*2);h=f+h+w(p*2);c=h+c+w(r*2);m=c+m+w(s*2);l=m+l+w(v*2);(function(a){if(i){var b=a+i*Uint32Array.BYTES_PER_ELEMENT*3;z(i,a,b+i*Uint32Array.BYTES_PER_ELEMENT*3);F(i,b)}})(Q);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
 p*Uint32Array.BYTES_PER_ELEMENT*3;H(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);F(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;D(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);u(v,b)}})(m);(function(a){if(A){var b=a+A*Uint32Array.BYTES_PER_ELEMENT*4,c=b+A*Uint32Array.BYTES_PER_ELEMENT*4;P(A,a,b,c+A*Uint32Array.BYTES_PER_ELEMENT*4);u(A,c)}})(l);b&&z(b,t,t+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;H(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
 p*Uint32Array.BYTES_PER_ELEMENT*3;H(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);F(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;D(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);u(v,b)}})(m);(function(a){if(A){var b=a+A*Uint32Array.BYTES_PER_ELEMENT*4,c=b+A*Uint32Array.BYTES_PER_ELEMENT*4;P(A,a,b,c+A*Uint32Array.BYTES_PER_ELEMENT*4);u(A,c)}})(l);b&&z(b,t,t+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;H(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
 3)}})(N);r&&D(r,h,h+r*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4;P(s,a,b,b+s*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=Object.create(THREE.Geometry.prototype);b(new f(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 3)}})(N);r&&D(r,h,h+r*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4;P(s,a,b,b+s*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=Object.create(THREE.Geometry.prototype);b(new f(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);

File diff suppressed because it is too large
+ 120 - 120
build/custom/ThreeWebGL.js


+ 21 - 9
src/core/Geometry.js

@@ -619,27 +619,39 @@ THREE.Geometry.prototype = {
 				face.d = changes[ face.d ];
 				face.d = changes[ face.d ];
 
 
 				// check dups in (a, b, c, d) and convert to -> face3
 				// check dups in (a, b, c, d) and convert to -> face3
-				o = [face.a, face.b, face.c, face.d];
-				for (k=3;k>0;k--) {
-					if ( o.indexOf(face[abcd[k]]) != k ) {
+
+				o = [ face.a, face.b, face.c, face.d ];
+
+				for ( k = 3; k > 0; k -- ) {
+
+					if ( o.indexOf( face[ abcd[ k ] ] ) !== k ) {
+
 						// console.log('faces', face.a, face.b, face.c, face.d, 'dup at', k);
 						// console.log('faces', face.a, face.b, face.c, face.d, 'dup at', k);
-						o.splice(k, 1);
-						this.faces[ i ] = new THREE.Face3(o[0], o[1], o[2]);
-						for (j=0,jl=this.faceVertexUvs.length;j<jl;j++) {
-							u = this.faceVertexUvs[j][i];
-							if (u) u.splice(k, 1);
+
+						o.splice( k, 1 );
+
+						this.faces[ i ] = new THREE.Face3( o[0], o[1], o[2], face.normal, face.color, face.materialIndex );
+
+						for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) {
+
+							u = this.faceVertexUvs[ j ][ i ];
+							if ( u ) u.splice( k, 1 );
+
 						}
 						}
 
 
+						this.faces[ i ].vertexColors = face.vertexColors;
+
 						break;
 						break;
 					}
 					}
-				}
 
 
+				}
 
 
 			}
 			}
 
 
 		}
 		}
 
 
 		// Use unique set of vertices
 		// Use unique set of vertices
+
 		var diff = this.vertices.length - unique.length;
 		var diff = this.vertices.length - unique.length;
 		this.vertices = unique;
 		this.vertices = unique;
 		return diff;
 		return diff;

Some files were not shown because too many files changed in this diff