浏览代码

Normalizing DirectionalLight in CanvasRenderer and SVGRenderer. Fixes #2071.

Mr.doob 13 年之前
父节点
当前提交
987602dc0c

+ 12 - 12
build/Three.js

@@ -5,7 +5,7 @@ function(a){clearTimeout(a)}})();THREE.FrontSide=0;THREE.BackSide=1;THREE.Double
 THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};
 THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.UnsignedShort4444Type=1016;
 THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.Clock=function(a){this.autoStart=a!==void 0?a:true;this.elapsedTime=this.oldTime=this.startTime=0;this.running=false};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=true};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=false};
-THREE.Clock.prototype.getElapsedTime=function(){return this.elapsedTime=this.elapsedTime+this.getDelta()};THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime=this.elapsedTime+a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
+THREE.Clock.prototype.getElapsedTime=function(){return this.elapsedTime=this.elapsedTime+this.getDelta()};THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime=this.elapsedTime+a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);
 this.b=Math.sqrt(this.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,f;if(c===0)this.r=this.g=this.b=0;else{d=Math.floor(a*6);e=a*6-d;a=c*(1-b);f=c*(1-b*e);b=c*(1-b*(1-e));if(d===0){this.r=c;this.g=b;this.b=a}else if(d===1){this.r=f;this.g=c;this.b=a}else if(d===2){this.r=a;this.g=c;this.b=b}else if(d===3){this.r=a;this.g=f;this.b=c}else if(d===4){this.r=b;this.g=a;this.b=c}else if(d===5){this.r=c;this.g=a;this.b=f}}return this},setHex:function(a){a=
 Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},lerpSelf:function(a,b){this.r=this.r+(a.r-this.r)*b;this.g=this.g+(a.g-this.g)*b;this.b=this.b+(a.b-this.b)*b;return this},getHex:function(){return Math.floor(this.r*255)<<16^Math.floor(this.g*255)<<8^Math.floor(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
@@ -27,7 +27,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
 a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(Math.abs(d-g)<0.01&&Math.abs(f-c)<0.01&&Math.abs(i-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(f+c)<0.1&&Math.abs(i+b)<0.1&&Math.abs(e+h+j-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;if(e>h&&e>j)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(h>
-j)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=i/c}else if(j<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(j);b=f/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};
+j)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=i/c}else if(j<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(j);b=f/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],l=c[8],m=c[9],n=c[10],p=c[11],r=c[12],o=c[13],q=c[14],c=c[15];b[0].set(f-a,j-g,p-l,c-r);b[1].set(f+a,j+g,p+l,c+r);b[2].set(f+d,j+h,p+m,c+o);b[3].set(f-d,j-h,p-m,c-o);b[4].set(f-e,j-i,p-n,c-q);b[5].set(f+e,j+i,p+n,c+q);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;e<6;e++){b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
@@ -73,7 +73,7 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){thi
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 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)},clone:function(){}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 THREE.Projector=function(){function a(a,c){g=0;C.objects.length=0;C.sprites.length=0;C.lights.length=0;var e=function(a){if(a.visible!==false){if((a instanceof THREE.Mesh||a instanceof THREE.Line)&&(a.frustumCulled===false||J.contains(a)===true)){E.copy(a.matrixWorld.getPosition());u.multiplyVector3(E);f=b();f.object=a;f.z=E.z;C.objects.push(f)}else if(a instanceof THREE.Sprite||a instanceof THREE.Particle){E.copy(a.matrixWorld.getPosition());u.multiplyVector3(E);f=b();f.object=a;f.z=E.z;C.sprites.push(f)}else a instanceof
 THREE.Light&&C.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)e(a.children[c])}};e(a);c===true&&C.objects.sort(d);return C}function b(){var a;if(g===h.length){a=new THREE.RenderableObject;h.push(a)}else a=h[g];g++;return a}function c(){var a;if(j===l.length){a=new THREE.RenderableVertex;l.push(a)}else a=l[j];j++;return a}function d(a,b){return b.z-a.z}function e(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;
 f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,g,h=[],i,j,l=[],m,n,p=[],r,o=[],q,s,x=[],t,w,z=[],C={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,A=new THREE.Vector4,u=new THREE.Matrix4,H=new THREE.Matrix4,J=new THREE.Frustum,M=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);u.multiply(b.projectionMatrix,
@@ -92,9 +92,9 @@ c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="ZXY"){this.x=f*d*e-c*g*h;this.y=c*g*
 d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;if(j>0){c=0.5/Math.sqrt(j+1);this.w=0.25/c;this.x=(i-g)*c;this.y=(d-h)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+h)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-h)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
 (d+h)/c;this.y=(g+i)/c;this.z=0.25*c}return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
 this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,
-f=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*e-h*d,l=i*d+h*c-f*e,m=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+l*-h-m*-g;b.y=l*i+c*-g+m*-f-j*-h;b.z=m*i+c*-h+j*-g-l*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
+f=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*e-h*d,l=i*d+h*c-f*e,m=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+l*-h-m*-g;b.y=l*i+c*-g+m*-f-j*-h;b.z=m*i+c*-h+j*-g-l*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
 this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
 THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
@@ -114,7 +114,7 @@ this.vertices.length;b<c;b++){u[b]=new THREE.Vector3;H[b]=new THREE.Vector3}b=0;
 Z.cross(f.vertexNormals[d],A);e=Z.dot(H[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(O.x,O.y,O.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,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;
+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},clone:function(){}};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,l,m,n;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]];l=this.points[c[1]];m=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,l.x,m.x,n.x,g,h,i);d.y=b(j.y,l.y,m.y,n.y,g,h,i);d.z=b(j.z,l.z,m.z,n.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);
@@ -250,7 +250,7 @@ void 0?a.canvas:document.createElement("canvas"),m,n,p,r,o=l.getContext("2d"),q=
 Ba=new THREE.Vector3,k,$a,Fb,Xa,ob,cb,a=16;k=document.createElement("canvas");k.width=k.height=2;$a=k.getContext("2d");$a.fillStyle="rgba(0,0,0,1)";$a.fillRect(0,0,2,2);Fb=$a.getImageData(0,0,2,2);Xa=Fb.data;ob=document.createElement("canvas");ob.width=ob.height=a;cb=ob.getContext("2d");cb.translate(-a/2,-a/2);cb.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){m=a;n=b;p=Math.floor(m/2);r=Math.floor(n/
 2);l.width=m;l.height=n;Ta.set(-p,-r,p,r);Ga.set(-p,-r,p,r);x=1;t=0;A=E=C=z=w=null};this.setClearColor=function(a,b){q.copy(a);s=b!==void 0?b:1;Ga.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=b!==void 0?b:1;Ga.set(-p,-r,p,r)};this.clear=function(){o.setTransform(1,0,0,-1,p,r);if(Ga.isEmpty()===false){Ga.minSelf(Ta);Ga.inflate(2);s<1&&o.clearRect(Math.floor(Ga.getX()),Math.floor(Ga.getY()),Math.floor(Ga.getWidth()),Math.floor(Ga.getHeight()));if(s>0){c(THREE.NormalBlending);b(1);
 e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+s+")");o.fillRect(Math.floor(Ga.getX()),Math.floor(Ga.getY()),Math.floor(Ga.getWidth()),Math.floor(Ga.getHeight()))}Ga.empty()}};this.render=function(a,l){function m(a){var b,c,d,e;sa.setRGB(0,0,0);Ia.setRGB(0,0,0);Ua.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){sa.r=sa.r+e.r;sa.g=sa.g+e.g;sa.b=sa.b+e.b}else if(d instanceof THREE.DirectionalLight){Ia.r=Ia.r+e.r;Ia.g=
-Ia.g+e.g;Ia.b=Ia.b+e.b}else if(d instanceof THREE.PointLight){Ua.r=Ua.r+e.r;Ua.g=Ua.g+e.g;Ua.b=Ua.b+e.b}}}function n(a,b,c,d){var e,f,g,h,k,i;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){k=g.matrixWorld.getPosition();i=c.dot(k);if(!(i<=0)){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}else if(g instanceof THREE.PointLight){k=g.matrixWorld.getPosition();i=c.dot(Ba.sub(k,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(k)/
+Ia.g+e.g;Ia.b=Ia.b+e.b}else if(d instanceof THREE.PointLight){Ua.r=Ua.r+e.r;Ua.g=Ua.g+e.g;Ua.b=Ua.b+e.b}}}function n(a,b,c,d){var e,f,g,h,k,i;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){k=g.matrixWorld.getPosition().normalize();i=c.dot(k);if(!(i<=0)){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}else if(g instanceof THREE.PointLight){k=g.matrixWorld.getPosition();i=c.dot(Ba.sub(k,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(k)/
 g.distance,1));if(i!=0){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var h,k,i,j,l,m;if(g instanceof THREE.ParticleBasicMaterial){if(g.map===null){i=f.object.scale.x;j=f.object.scale.y;i=i*f.scale.x*p;j=j*f.scale.y*r;ua.set(a.x-i,a.y-j,a.x+i,a.y+j);if(Ta.intersects(ua)===false)return;e(g.color.getContextStyle());o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(i,j);o.fillRect(-1,-1,2,2)}else{g=g.map.image;l=g.width>>1;m=g.height>>
 1;i=f.scale.x*p;j=f.scale.y*r;h=i*l;k=j*m;ua.set(a.x-h,a.y-k,a.x+h,a.y+k);if(Ta.intersects(ua)===false)return;o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(i,-j);o.translate(-l,-m);o.drawImage(g,0,0)}o.restore()}else if(g instanceof THREE.ParticleCanvasMaterial){h=f.scale.x*p;k=f.scale.y*r;ua.set(a.x-h,a.y-k,a.x+h,a.y+k);if(Ta.intersects(ua)!==false){d(g.color.getContextStyle());e(g.color.getContextStyle());o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(h,k);g.program(o);
 o.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);o.beginPath();o.moveTo(a.positionScreen.x,a.positionScreen.y);o.lineTo(e.positionScreen.x,e.positionScreen.y);o.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(C!==a)C=o.lineWidth=a;a=g.linecap;if(E!==a)E=o.lineCap=a;a=g.linejoin;if(A!==a)A=o.lineJoin=a;d(g.color.getContextStyle());o.stroke();ua.inflate(g.linewidth*2)}}function t(a,d,e,g,h,k,j,m){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;
@@ -580,7 +580,7 @@ this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);t
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
-THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=
+THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=
 false;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey=null;f.animationCache.nextKey=null;f.animationCache.originalMatrix=e instanceof THREE.Bone?
 e.skinMatrix:e.matrix}e=this.data.hierarchy[c].keys;if(e.length){f.animationCache.prevKey=e[0];f.animationCache.nextKey=e[1];this.startTime=Math.min(e[0].time,this.startTime);this.endTime=Math.max(e[e.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
@@ -599,7 +599,7 @@ THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;thi
 THREE.CombinedCamera.prototype.setLens=function(a,b){var c=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};
 THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=false};
 THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};
-THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.heightMax=1;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
+THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.005;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.heightMax=1;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
 this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=false;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.onMouseDown=function(a){this.domElement!==
 document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=true;break;case 2:this.moveBackward=true}this.mouseDragOn=true};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=false;break;case 2:this.moveBackward=false}this.mouseDragOn=false};this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-
 this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=true;break;case 37:case 65:this.moveLeft=true;break;case 40:case 83:this.moveBackward=true;break;case 39:case 68:this.moveRight=true;break;case 82:this.moveUp=true;break;case 70:this.moveDown=true;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
@@ -610,14 +610,14 @@ this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.
 c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),false);this.handleResize()};
 THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,s=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++){s=d*h.chunks[f]/h.total;b.keys[f]={time:s,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
 return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);e.vertices[c]=new THREE.Vector3(d.x,d.y,d.z)}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
-this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
+this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
 document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=
 a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};
 this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),
 b=new THREE.MeshLambertMaterial({color:65280}),c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),p=0;p<b.points.length;p++){c=new THREE.Mesh(g,h);c.position.copy(b.points[p]);a.add(c)}}this.domElement.addEventListener("mousemove",d(this,
 this.onMouseMove),false)};this.handleResize()};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
+THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
 new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=
 0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -736,7 +736,7 @@ b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b
 "color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");p=false};this.render=function(a,d,e,s){var a=a.__webglFlares,x=a.length;if(x){var t=new THREE.Vector3,w=s/e,z=e*0.5,C=s*0.5,E=16/s,A=new THREE.Vector2(E*w,E),u=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),J=n,E=m;b.useProgram(l);if(!p){b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);p=true}b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,
 1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(E.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(E.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var M,O,Z,B,G;for(M=0;M<x;M++){E=16/s;A.set(E*w,E);B=a[M];t.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(t);d.projectionMatrix.multiplyVector3(t);u.copy(t);H.x=u.x*z+z;H.y=u.y*C+C;if(j||H.x>0&&H.x<e&&H.y>0&&
 H.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,A.x,A.y);b.uniform3f(J.screenPosition,u.x,u.y,u.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(u);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);O=0;for(Z=B.lensFlares.length;O<Z;O++){G=B.lensFlares[O];if(G.opacity>0.0010&&G.scale>0.0010){u.x=G.x;u.y=G.y;u.z=G.z;E=G.size*G.scale/s;A.x=E*w;A.y=E;b.uniform3f(J.screenPosition,u.x,u.y,u.z);b.uniform2f(J.scale,A.x,A.y);b.uniform1f(J.rotation,G.rotation);b.uniform1f(J.opacity,G.opacity);
+b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(u);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);O=0;for(Z=B.lensFlares.length;O<Z;O++){G=B.lensFlares[O];if(G.opacity>0.001&&G.scale>0.001){u.x=G.x;u.y=G.y;u.z=G.z;E=G.size*G.scale/s;A.x=E*w;A.y=E;b.uniform3f(J.screenPosition,u.x,u.y,u.z);b.uniform2f(J.scale,A.x,A.y);b.uniform1f(J.rotation,G.rotation);b.uniform1f(J.opacity,G.opacity);
 b.uniform3f(J.color,G.color.r,G.color.g,G.color.b);c.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst);c.setTexture(G.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f=new THREE.Frustum,g=new THREE.Matrix4,h=new THREE.Vector3,i=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
 vertexShader:f.vertexShader,uniforms:g,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,l){var m,n,p,r,o,q,s,x,t,w=[];r=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);m=0;for(n=j.__lights.length;m<n;m++){p=j.__lights[m];if(p.castShadow)if(p instanceof THREE.DirectionalLight&&

+ 9 - 9
build/custom/ThreeCanvas.js

@@ -26,7 +26,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
 a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,f=a[0];d=a[4];var e=a[8],g=a[1],j=a[5],m=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-g)<0.01&&Math.abs(e-c)<0.01&&Math.abs(m-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(e+c)<0.1&&Math.abs(m+b)<0.1&&Math.abs(f+j+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;f=(f+1)/2;j=(j+1)/2;k=(k+1)/2;d=(d+g)/4;e=(e+c)/4;m=(m+b)/4;if(f>j&&f>k)if(f<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(f);c=d/b;d=e/b}else if(j>
-k)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=m/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=e/d;c=m/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-m)*(b-m)+(e-c)*(e-c)+(g-d)*(g-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-m)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+j+k-1)/2);return this}};
+k)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=m/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=e/d;c=m/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-m)*(b-m)+(e-c)*(e-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-m)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+j+k-1)/2);return this}};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],f=c[2],e=c[3],g=c[4],j=c[5],m=c[6],k=c[7],h=c[8],n=c[9],i=c[10],o=c[11],q=c[12],l=c[13],p=c[14],c=c[15];b[0].set(e-a,k-g,o-h,c-q);b[1].set(e+a,k+g,o+h,c+q);b[2].set(e+d,k+j,o+n,c+l);b[3].set(e-d,k-j,o-n,c-l);b[4].set(e-f,k-m,o-i,c-p);b[5].set(e+f,k+m,o+i,c+p);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),f=0;f<6;f++){b=c[f].x*d[12]+c[f].y*d[13]+c[f].z*d[14]+c[f].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
@@ -72,7 +72,7 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){thi
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b){f=f.getChildByName(a,b);if(f!==void 0)return f}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion===true?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?this.matrixWorld.multiply(this.parent.matrixWorld,
-this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
+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)},clone:function(){}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 THREE.Projector=function(){function a(a,c){g=0;A.objects.length=0;A.sprites.length=0;A.lights.length=0;var f=function(a){if(a.visible!==false){if((a instanceof THREE.Mesh||a instanceof THREE.Line)&&(a.frustumCulled===false||C.contains(a)===true)){y.copy(a.matrixWorld.getPosition());s.multiplyVector3(y);e=b();e.object=a;e.z=y.z;A.objects.push(e)}else if(a instanceof THREE.Sprite||a instanceof THREE.Particle){y.copy(a.matrixWorld.getPosition());s.multiplyVector3(y);e=b();e.object=a;e.z=y.z;A.sprites.push(e)}else a instanceof
 THREE.Light&&A.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)f(a.children[c])}};f(a);c===true&&A.objects.sort(d);return A}function b(){var a;if(g===j.length){a=new THREE.RenderableObject;j.push(a)}else a=j[g];g++;return a}function c(){var a;if(k===h.length){a=new THREE.RenderableVertex;h.push(a)}else a=h[k];k++;return a}function d(a,b){return b.z-a.z}function f(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(e>=0&&g>=0&&f>=0&&h>=0)return true;if(e<0&&g<0||f<0&&h<0)return false;
 e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g)));f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,g,j=[],m,k,h=[],n,i,o=[],q,l=[],p,r,u=[],v,B,x=[],A={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,E=new THREE.Vector4,s=new THREE.Matrix4,w=new THREE.Matrix4,C=new THREE.Frustum,K=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);s.multiply(b.projectionMatrix,
@@ -91,9 +91,9 @@ c*d*j-e*g*f;this.w=c*d*f+e*g*j}else if(b==="ZXY"){this.x=e*d*f-c*g*j;this.y=c*g*
 d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],f=b[1],e=b[5],g=b[9],j=b[2],m=b[6],b=b[10],k=c+e+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(m-g)*c;this.y=(d-j)*c;this.z=(f-a)*c}else if(c>e&&c>b){c=2*Math.sqrt(1+c-e-b);this.w=(m-g)/c;this.x=0.25*c;this.y=(a+f)/c;this.z=(d+j)/c}else if(e>b){c=2*Math.sqrt(1+e-c-b);this.w=(d-j)/c;this.x=(a+f)/c;this.y=0.25*c;this.z=(g+m)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
 (d+j)/c;this.y=(g+m)/c;this.z=0.25*c}return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
 this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,j=a.z,a=a.w;this.x=b*a+f*e+c*j-d*g;this.y=c*a+f*g+d*e-b*j;this.z=d*a+f*j+b*g-c*e;this.w=f*a-b*e-c*g-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,
-e=this.x,g=this.y,j=this.z,m=this.w,k=m*c+g*f-j*d,h=m*d+j*c-e*f,n=m*f+e*d-g*c,c=-e*c-g*d-j*f;b.x=k*m+c*-e+h*-j-n*-g;b.y=h*m+c*-g+n*-e-k*-j;b.z=n*m+c*-j+k*-g-h*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var j=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.0010){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);
+e=this.x,g=this.y,j=this.z,m=this.w,k=m*c+g*f-j*d,h=m*d+j*c-e*f,n=m*f+e*d-g*c,c=-e*c-g*d-j*f;b.x=k*m+c*-e+h*-j-n*-g;b.y=h*m+c*-g+n*-e-k*-j;b.z=n*m+c*-j+k*-g-h*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var j=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.001){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);
 this.y=0.5*(d+this.y);this.z=0.5*(f+this.z);return this}g=Math.sin((1-b)*j)/m;j=Math.sin(b*j)/m;this.w=e*g+this.w*j;this.x=c*g+this.x*j;this.y=d*g+this.y*j;this.z=f*g+this.z*j;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(f<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;f=-f}else c.copy(b);if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}f=Math.sin((1-d)*b)/e;d=Math.sin(d*b)/e;c.w=a.w*f+c.w*d;c.x=a.x*f+c.x*d;c.y=a.y*f+c.y*d;c.z=a.z*f+c.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(f<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;f=-f}else c.copy(b);if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}f=Math.sin((1-d)*b)/e;d=Math.sin(d*b)/e;c.w=a.w*f+c.w*d;c.x=a.x*f+c.x*d;c.y=a.y*f+c.y*d;c.z=a.z*f+c.z*d;return c};
 THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
@@ -113,7 +113,7 @@ this.vertices.length;b<c;b++){s[b]=new THREE.Vector3;w[b]=new THREE.Vector3}b=0;
 N.cross(e.vertexNormals[d],E);f=N.dot(w[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(M.x,M.y,M.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,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);
+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},clone:function(){}};THREE.GeometryCount=0;THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);
 THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);
 THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
@@ -222,10 +222,10 @@ void 0?a.canvas:document.createElement("canvas"),n,i,o,q,l=h.getContext("2d"),p=
 new THREE.Vector3,ra,sa,ya,ea,ta,va,a=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);ya=sa.getImageData(0,0,2,2);ea=ya.data;ta=document.createElement("canvas");ta.width=ta.height=a;va=ta.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;i=b;o=Math.floor(n/2);q=Math.floor(i/
 2);h.width=n;h.height=i;ia.set(-o,-q,o,q);ba.set(-o,-q,o,q);u=1;v=0;E=y=A=x=B=null};this.setClearColor=function(a,b){p.copy(a);r=b!==void 0?b:1;ba.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){p.setHex(a);r=b!==void 0?b:1;ba.set(-o,-q,o,q)};this.clear=function(){l.setTransform(1,0,0,-1,o,q);if(ba.isEmpty()===false){ba.minSelf(ia);ba.inflate(2);r<1&&l.clearRect(Math.floor(ba.getX()),Math.floor(ba.getY()),Math.floor(ba.getWidth()),Math.floor(ba.getHeight()));if(r>0){c(THREE.NormalBlending);b(1);
 f("rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")");l.fillRect(Math.floor(ba.getX()),Math.floor(ba.getY()),Math.floor(ba.getWidth()),Math.floor(ba.getHeight()))}ba.empty()}};this.render=function(a,h){function i(a){var b,c,d,e;Z.setRGB(0,0,0);ma.setRGB(0,0,0);na.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){Z.r=Z.r+e.r;Z.g=Z.g+e.g;Z.b=Z.b+e.b}else if(d instanceof THREE.DirectionalLight){ma.r=ma.r+e.r;ma.g=ma.g+e.g;
-ma.b=ma.b+e.b}else if(d instanceof THREE.PointLight){na.r=na.r+e.r;na.g=na.g+e.g;na.b=na.b+e.b}}}function n(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){k=g.matrixWorld.getPosition();j=c.dot(k);if(!(j<=0)){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}else if(g instanceof THREE.PointLight){k=g.matrixWorld.getPosition();j=c.dot(V.sub(k,b).normalize());if(!(j<=0)){j=j*(g.distance==0?1:1-Math.min(b.distanceTo(k)/g.distance,
-1));if(j!=0){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}}}}function p(a,e,g){b(g.opacity);c(g.blending);var h,j,k,m,i,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map===null){k=e.object.scale.x;m=e.object.scale.y;k=k*e.scale.x*o;m=m*e.scale.y*q;X.set(a.x-k,a.y-m,a.x+k,a.y+m);if(ia.intersects(X)===false)return;f(g.color.getContextStyle());l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(k,m);l.fillRect(-1,-1,2,2)}else{g=g.map.image;i=g.width>>1;n=g.height>>1;k=e.scale.x*
-o;m=e.scale.y*q;h=k*i;j=m*n;X.set(a.x-h,a.y-j,a.x+h,a.y+j);if(ia.intersects(X)===false)return;l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(k,-m);l.translate(-i,-n);l.drawImage(g,0,0)}l.restore()}else if(g instanceof THREE.ParticleCanvasMaterial){h=e.scale.x*o;j=e.scale.y*q;X.set(a.x-h,a.y-j,a.x+h,a.y+j);if(ia.intersects(X)!==false){d(g.color.getContextStyle());f(g.color.getContextStyle());l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(h,j);g.program(l);l.restore()}}}function r(a,
-e,f,g){b(g.opacity);c(g.blending);l.beginPath();l.moveTo(a.positionScreen.x,a.positionScreen.y);l.lineTo(e.positionScreen.x,e.positionScreen.y);l.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!==a)A=l.lineWidth=a;a=g.linecap;if(y!==a)y=l.lineCap=a;a=g.linejoin;if(E!==a)E=l.lineJoin=a;d(g.color.getContextStyle());l.stroke();X.inflate(g.linewidth*2)}}function u(a,d,f,g,k,j,l,i){e.info.render.vertices=e.info.render.vertices+3;e.info.render.faces++;b(i.opacity);c(i.blending);
+ma.b=ma.b+e.b}else if(d instanceof THREE.PointLight){na.r=na.r+e.r;na.g=na.g+e.g;na.b=na.b+e.b}}}function n(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){k=g.matrixWorld.getPosition().normalize();j=c.dot(k);if(!(j<=0)){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}else if(g instanceof THREE.PointLight){k=g.matrixWorld.getPosition();j=c.dot(V.sub(k,b).normalize());if(!(j<=0)){j=j*(g.distance==0?1:1-Math.min(b.distanceTo(k)/
+g.distance,1));if(j!=0){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}}}}function p(a,e,g){b(g.opacity);c(g.blending);var h,j,k,m,i,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map===null){k=e.object.scale.x;m=e.object.scale.y;k=k*e.scale.x*o;m=m*e.scale.y*q;X.set(a.x-k,a.y-m,a.x+k,a.y+m);if(ia.intersects(X)===false)return;f(g.color.getContextStyle());l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(k,m);l.fillRect(-1,-1,2,2)}else{g=g.map.image;i=g.width>>1;n=g.height>>
+1;k=e.scale.x*o;m=e.scale.y*q;h=k*i;j=m*n;X.set(a.x-h,a.y-j,a.x+h,a.y+j);if(ia.intersects(X)===false)return;l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(k,-m);l.translate(-i,-n);l.drawImage(g,0,0)}l.restore()}else if(g instanceof THREE.ParticleCanvasMaterial){h=e.scale.x*o;j=e.scale.y*q;X.set(a.x-h,a.y-j,a.x+h,a.y+j);if(ia.intersects(X)!==false){d(g.color.getContextStyle());f(g.color.getContextStyle());l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(h,j);g.program(l);l.restore()}}}
+function r(a,e,f,g){b(g.opacity);c(g.blending);l.beginPath();l.moveTo(a.positionScreen.x,a.positionScreen.y);l.lineTo(e.positionScreen.x,e.positionScreen.y);l.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!==a)A=l.lineWidth=a;a=g.linecap;if(y!==a)y=l.lineCap=a;a=g.linejoin;if(E!==a)E=l.lineJoin=a;d(g.color.getContextStyle());l.stroke();X.inflate(g.linewidth*2)}}function u(a,d,f,g,k,j,l,i){e.info.render.vertices=e.info.render.vertices+3;e.info.render.faces++;b(i.opacity);c(i.blending);
 t=a.positionScreen.x;G=a.positionScreen.y;I=d.positionScreen.x;O=d.positionScreen.y;P=f.positionScreen.x;R=f.positionScreen.y;x(t,G,I,O,P,R);if(i instanceof THREE.MeshBasicMaterial)if(i.map!==null){if(i.map.mapping instanceof THREE.UVMapping){fa=l.uvs[0];Fa(t,G,I,O,P,R,fa[g].u,fa[g].v,fa[k].u,fa[k].v,fa[j].u,fa[j].v,i.map)}}else if(i.envMap!==null){if(i.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=h.matrixWorldInverse;V.copy(l.vertexNormalsWorld[g]);za=(V.x*a.elements[0]+V.y*a.elements[4]+
 V.z*a.elements[8])*0.5+0.5;Aa=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(l.vertexNormalsWorld[k]);Ba=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ca=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(l.vertexNormalsWorld[j]);Da=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ea=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;Fa(t,G,I,O,P,R,za,Aa,Ba,Ca,Da,Ea,i.envMap)}}else i.wireframe===true?ja(i.color,
 i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color);else if(i instanceof THREE.MeshLambertMaterial)if(ua===true)if(i.wireframe===false&&i.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==3){F.r=H.r=L.r=Z.r;F.g=H.g=L.g=Z.g;F.b=H.b=L.b=Z.b;n(m,l.v1.positionWorld,l.vertexNormalsWorld[0],F);n(m,l.v2.positionWorld,l.vertexNormalsWorld[1],H);n(m,l.v3.positionWorld,l.vertexNormalsWorld[2],L);F.r=Math.max(0,Math.min(i.color.r*F.r,1));F.g=Math.max(0,Math.min(i.color.g*F.g,1));

+ 5 - 5
build/custom/ThreeExtras.js

@@ -118,7 +118,7 @@ this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);t
 THREE.Animation.prototype.interpolateCatmullRom=function(b,a){var c=[],d=[],e,f,g,h,i,j;e=(b.length-1)*a;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>b.length-2?f:f+1;c[3]=f>b.length-3?f:f+2;f=b[c[0]];h=b[c[1]];i=b[c[2]];j=b[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(b,a,c,d,e,f,g){b=(c-b)*0.5;d=(d-a)*0.5;return(2*(a-c)+b+d)*g+(-3*(a-c)-2*b-d)*f+b*e+a};THREE.Animation.prototype.getNextKeyWith=function(b,a,c){for(var d=this.data.hierarchy[a].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(d[c][b]!==void 0)return d[c];return this.data.hierarchy[a].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,a,c){for(var d=this.data.hierarchy[a].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][b]!==void 0)return d[c];return this.data.hierarchy[a].keys[d.length-1]};
-THREE.KeyFrameAnimation=function(b,a,c){this.root=b;this.data=THREE.AnimationHandler.get(a);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;b=0;for(a=this.hierarchy.length;b<a;b++){var c=this.data.hierarchy[b].sids,d=this.hierarchy[b];if(this.data.hierarchy[b].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,b,0);g&&g.apply(f)}d.matrixAutoUpdate=
+THREE.KeyFrameAnimation=function(b,a,c){this.root=b;this.data=THREE.AnimationHandler.get(a);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=0.001;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;b=0;for(a=this.hierarchy.length;b<a;b++){var c=this.data.hierarchy[b].sids,d=this.hierarchy[b];if(this.data.hierarchy[b].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,b,0);g&&g.apply(f)}d.matrixAutoUpdate=
 false;this.data.hierarchy[b].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}};
 THREE.KeyFrameAnimation.prototype.play=function(b,a){if(!this.isPlaying){this.isPlaying=true;this.loop=b!==void 0?b:true;this.currentTime=a!==void 0?a:0;this.startTimeMs=a;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey=null;f.animationCache.nextKey=null;f.animationCache.originalMatrix=e instanceof THREE.Bone?
 e.skinMatrix:e.matrix}e=this.data.hierarchy[c].keys;if(e.length){f.animationCache.prevKey=e[0];f.animationCache.nextKey=e[1];this.startTime=Math.min(e[0].time,this.startTime);this.endTime=Math.max(e[e.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
@@ -137,7 +137,7 @@ THREE.CombinedCamera.prototype.setSize=function(b,a){this.cameraP.aspect=b/a;thi
 THREE.CombinedCamera.prototype.setLens=function(b,a){var c=2*Math.atan((a!==void 0?a:24)/(b*2))*(180/Math.PI);this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(b){this.zoom=b;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};
 THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=false};
 THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};
-THREE.FirstPersonControls=function(b,a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=b;this.target=new THREE.Vector3(0,0,0);this.domElement=a!==void 0?a:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.heightMax=1;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
+THREE.FirstPersonControls=function(b,a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=b;this.target=new THREE.Vector3(0,0,0);this.domElement=a!==void 0?a:document;this.movementSpeed=1;this.lookSpeed=0.005;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.heightMax=1;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
 this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=false;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.onMouseDown=function(a){this.domElement!==
 document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=true;break;case 2:this.moveBackward=true}this.mouseDragOn=true};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=false;break;case 2:this.moveBackward=false}this.mouseDragOn=false};this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-
 this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=true;break;case 37:case 65:this.moveLeft=true;break;case 40:case 83:this.moveBackward=true;break;case 39:case 68:this.moveRight=true;break;case 82:this.moveUp=true;break;case 70:this.moveDown=true;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
@@ -148,14 +148,14 @@ this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.
 c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),false);this.handleResize()};
 THREE.PathControls=function(b,a){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,s=0;f=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++){s=d*h.chunks[f]/h.total;b.keys[f]={time:s,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
 return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);e.vertices[c]=new THREE.Vector3(d.x,d.y,d.z)}return e}this.object=b;this.domElement=a!==void 0?a:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
-this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
+this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
 document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=
 a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};
 this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),
 b=new THREE.MeshLambertMaterial({color:65280}),c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),k=0;k<b.points.length;k++){c=new THREE.Mesh(g,h);c.position.copy(b.points[k]);a.add(c)}}this.domElement.addEventListener("mousemove",d(this,
 this.onMouseMove),false)};this.handleResize()};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(b,a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=b;this.domElement=a!==void 0?a:document;a&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
+THREE.FlyControls=function(b,a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=b;this.domElement=a!==void 0?a:document;a&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
 new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=
 0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -274,7 +274,7 @@ a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);if(a.getParameter(a
 "color");n.scale=a.getUniformLocation(l,"scale");n.rotation=a.getUniformLocation(l,"rotation");n.screenPosition=a.getUniformLocation(l,"screenPosition");k=false};this.render=function(b,d,e,s){var b=b.__webglFlares,u=b.length;if(u){var t=new THREE.Vector3,r=s/e,v=e*0.5,z=s*0.5,A=16/s,x=new THREE.Vector2(A*r,A),w=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),B=n,A=m;a.useProgram(l);if(!k){a.enableVertexAttribArray(m.vertex);a.enableVertexAttribArray(m.uv);k=true}a.uniform1i(B.occlusionMap,0);a.uniform1i(B.map,
 1);a.bindBuffer(a.ARRAY_BUFFER,f);a.vertexAttribPointer(A.vertex,2,a.FLOAT,false,16,0);a.vertexAttribPointer(A.uv,2,a.FLOAT,false,16,8);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,g);a.disable(a.CULL_FACE);a.depthMask(false);var E,G,L,H,D;for(E=0;E<u;E++){A=16/s;x.set(A*r,A);H=b[E];t.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(t);d.projectionMatrix.multiplyVector3(t);w.copy(t);C.x=w.x*v+v;C.y=w.y*z+z;if(j||C.x>0&&C.x<e&&C.y>0&&
 C.y<s){a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,h);a.copyTexImage2D(a.TEXTURE_2D,0,a.RGB,C.x-8,C.y-8,16,16,0);a.uniform1i(B.renderType,0);a.uniform2f(B.scale,x.x,x.y);a.uniform3f(B.screenPosition,w.x,w.y,w.z);a.disable(a.BLEND);a.enable(a.DEPTH_TEST);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0);a.activeTexture(a.TEXTURE0);a.bindTexture(a.TEXTURE_2D,i);a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,C.x-8,C.y-8,16,16,0);a.uniform1i(B.renderType,1);a.disable(a.DEPTH_TEST);a.activeTexture(a.TEXTURE1);
-a.bindTexture(a.TEXTURE_2D,h);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0);H.positionScreen.copy(w);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();a.uniform1i(B.renderType,2);a.enable(a.BLEND);G=0;for(L=H.lensFlares.length;G<L;G++){D=H.lensFlares[G];if(D.opacity>0.0010&&D.scale>0.0010){w.x=D.x;w.y=D.y;w.z=D.z;A=D.size*D.scale/s;x.x=A*r;x.y=A;a.uniform3f(B.screenPosition,w.x,w.y,w.z);a.uniform2f(B.scale,x.x,x.y);a.uniform1f(B.rotation,D.rotation);a.uniform1f(B.opacity,D.opacity);
+a.bindTexture(a.TEXTURE_2D,h);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0);H.positionScreen.copy(w);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();a.uniform1i(B.renderType,2);a.enable(a.BLEND);G=0;for(L=H.lensFlares.length;G<L;G++){D=H.lensFlares[G];if(D.opacity>0.001&&D.scale>0.001){w.x=D.x;w.y=D.y;w.z=D.z;A=D.size*D.scale/s;x.x=A*r;x.y=A;a.uniform3f(B.screenPosition,w.x,w.y,w.z);a.uniform2f(B.scale,x.x,x.y);a.uniform1f(B.rotation,D.rotation);a.uniform1f(B.opacity,D.opacity);
 a.uniform3f(B.color,D.color.r,D.color.g,D.color.b);c.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst);c.setTexture(D.texture,1);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0)}}}}a.enable(a.CULL_FACE);a.enable(a.DEPTH_TEST);a.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var b,a,c,d,e,f=new THREE.Frustum,g=new THREE.Matrix4,h=new THREE.Vector3,i=new THREE.Vector3;this.init=function(f){b=f.context;a=f;var f=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
 vertexShader:f.vertexShader,uniforms:g,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(b,c){a.shadowMapEnabled&&a.shadowMapAutoUpdate&&this.update(b,c)};this.update=function(j,l){var m,n,k,o,q,p,s,u,t,r=[];o=0;b.clearColor(1,1,1,1);b.disable(b.BLEND);b.enable(b.CULL_FACE);a.shadowMapCullFrontFaces?b.cullFace(b.FRONT):b.cullFace(b.BACK);a.setDepthTest(true);m=0;for(n=j.__lights.length;m<n;m++){k=j.__lights[m];if(k.castShadow)if(k instanceof THREE.DirectionalLight&&

+ 6 - 6
build/custom/ThreeWebGL.js

@@ -26,7 +26,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
 a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],h=a[1],j=a[5],l=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-h)<0.01&&Math.abs(f-c)<0.01&&Math.abs(l-b)<0.01){if(Math.abs(d+h)<0.1&&Math.abs(f+c)<0.1&&Math.abs(l+b)<0.1&&Math.abs(e+j+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;j=(j+1)/2;k=(k+1)/2;d=(d+h)/4;f=(f+c)/4;l=(l+b)/4;if(e>j&&e>k)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(j>
-k)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=l/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=f/d;c=l/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-l)*(b-l)+(f-c)*(f-c)+(h-d)*(h-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-l)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+j+k-1)/2);return this}};
+k)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=l/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=f/d;c=l/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-l)*(b-l)+(f-c)*(f-c)+(h-d)*(h-d));Math.abs(a)<0.001&&(a=1);this.x=(b-l)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+j+k-1)/2);return this}};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],j=c[5],l=c[6],k=c[7],i=c[8],m=c[9],n=c[10],o=c[11],u=c[12],q=c[13],r=c[14],c=c[15];b[0].set(f-a,k-h,o-i,c-u);b[1].set(f+a,k+h,o+i,c+u);b[2].set(f+d,k+j,o+m,c+q);b[3].set(f-d,k-j,o-m,c-q);b[4].set(f-e,k-l,o-n,c-r);b[5].set(f+e,k+l,o+n,c+r);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;e<6;e++){b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
@@ -72,7 +72,7 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){thi
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 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)},clone:function(){}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 THREE.Projector=function(){function a(a,c){h=0;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var e=function(a){if(a.visible!==false){if((a instanceof THREE.Mesh||a instanceof THREE.Line)&&(a.frustumCulled===false||I.contains(a)===true)){A.copy(a.matrixWorld.getPosition());C.multiplyVector3(A);f=b();f.object=a;f.z=A.z;E.objects.push(f)}else if(a instanceof THREE.Sprite||a instanceof THREE.Particle){A.copy(a.matrixWorld.getPosition());C.multiplyVector3(A);f=b();f.object=a;f.z=A.z;E.sprites.push(f)}else a instanceof
 THREE.Light&&E.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)e(a.children[c])}};e(a);c===true&&E.objects.sort(d);return E}function b(){var a;if(h===j.length){a=new THREE.RenderableObject;j.push(a)}else a=j[h];h++;return a}function c(){var a;if(k===i.length){a=new THREE.RenderableVertex;i.push(a)}else a=i[k];k++;return a}function d(a,b){return b.z-a.z}function e(a,b){var c=0,d=1,f=a.z+a.w,h=b.z+b.w,e=-a.z+a.w,j=-b.z+b.w;if(f>=0&&h>=0&&e>=0&&j>=0)return true;if(f<0&&h<0||e<0&&j<0)return false;
 f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));e<0?c=Math.max(c,e/(e-j)):j<0&&(d=Math.min(d,e/(e-j)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,h,j=[],l,k,i=[],m,n,o=[],u,q=[],r,p,x=[],w,H,v=[],E={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,G=new THREE.Vector4,C=new THREE.Matrix4,P=new THREE.Matrix4,I=new THREE.Frustum,U=new THREE.Vector4,V=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,
@@ -91,9 +91,9 @@ c*d*j-f*h*e;this.w=c*d*e+f*h*j}else if(b==="ZXY"){this.x=f*d*e-c*h*j;this.y=c*h*
 d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],h=b[9],j=b[2],l=b[6],b=b[10],k=c+f+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(l-h)*c;this.y=(d-j)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(l-h)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+j)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-j)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(h+l)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
 (d+j)/c;this.y=(h+l)/c;this.z=0.25*c}return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
 this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,h=a.y,j=a.z,a=a.w;this.x=b*a+e*f+c*j-d*h;this.y=c*a+e*h+d*f-b*j;this.z=d*a+e*j+b*h-c*f;this.w=e*a-b*f-c*h-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,
-f=this.x,h=this.y,j=this.z,l=this.w,k=l*c+h*e-j*d,i=l*d+j*c-f*e,m=l*e+f*d-h*c,c=-f*c-h*d-j*e;b.x=k*l+c*-f+i*-j-m*-h;b.y=i*l+c*-h+m*-f-k*-j;b.z=m*l+c*-j+k*-h-i*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,h=f*a.w+c*a.x+d*a.y+e*a.z;if(h<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;h=-h}else this.copy(a);if(h>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var j=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
+f=this.x,h=this.y,j=this.z,l=this.w,k=l*c+h*e-j*d,i=l*d+j*c-f*e,m=l*e+f*d-h*c,c=-f*c-h*d-j*e;b.x=k*l+c*-f+i*-j-m*-h;b.y=i*l+c*-h+m*-f-k*-j;b.z=m*l+c*-j+k*-h-i*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,h=f*a.w+c*a.x+d*a.y+e*a.z;if(h<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;h=-h}else this.copy(a);if(h>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var j=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
 this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}h=Math.sin((1-b)*j)/l;j=Math.sin(b*j)/l;this.w=f*h+this.w*j;this.x=c*h+this.x*j;this.y=d*h+this.y*j;this.z=e*h+this.z*j;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
 THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,e,f,h){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
@@ -113,7 +113,7 @@ this.vertices.length;b<c;b++){C[b]=new THREE.Vector3;P[b]=new THREE.Vector3}b=0;
 S.cross(f.vertexNormals[d],G);e=S.dot(P[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(V.x,V.y,V.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,h,j,l;f=0;for(h=this.vertices.length;f<h;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(h=this.faces.length;f<h;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(j=this.faceVertexUvs.length;d<j;d++)(l=this.faceVertexUvs[d][f])&&l.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
+d=0;for(j=this.faceVertexUvs.length;d<j;d++)(l=this.faceVertexUvs[d][f])&&l.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){}};THREE.GeometryCount=0;
 THREE.Spline=function(a){function b(a,b,c,d,f,h,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*h+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,h,j,l,k,i,m,n;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);h=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;k=this.points[c[0]];i=this.points[c[1]];m=this.points[c[2]];n=this.points[c[3]];j=h*h;l=h*j;d.x=b(k.x,i.x,m.x,n.x,h,j,l);d.y=b(k.y,i.y,m.y,n.y,h,j,l);d.z=b(k.z,i.z,m.z,n.z,h,j,l);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,h=new THREE.Vector3,e=new THREE.Vector3,j=[],i=0;j[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++){b=
 a/c;d=this.getPoint(b);e.copy(d);i=i+e.distanceTo(h);h.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){j[b]=i;f=b}}j[j.length]=i;return{chunks:j,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,f,h,e,j=[],i=new THREE.Vector3,k=this.getLength();j.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];e=Math.ceil(a*c/k.total);f=(b-1)/(this.points.length-1);h=b/(this.points.length-1);for(c=1;c<e-1;c++){d=f+c*(1/e)*(h-f);d=this.getPoint(d);
@@ -447,7 +447,7 @@ b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b
 "color");n.scale=b.getUniformLocation(i,"scale");n.rotation=b.getUniformLocation(i,"rotation");n.screenPosition=b.getUniformLocation(i,"screenPosition");o=false};this.render=function(a,d,e,p){var a=a.__webglFlares,x=a.length;if(x){var w=new THREE.Vector3,H=p/e,v=e*0.5,E=p*0.5,A=16/p,G=new THREE.Vector2(A*H,A),C=new THREE.Vector3(1,1,0),P=new THREE.Vector2(1,1),I=n,A=m;b.useProgram(i);if(!o){b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);o=true}b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
 1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(A.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(false);var U,V,S,z,O;for(U=0;U<x;U++){A=16/p;G.set(A*H,A);z=a[U];w.set(z.matrixWorld.elements[12],z.matrixWorld.elements[13],z.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(w);d.projectionMatrix.multiplyVector3(w);C.copy(w);P.x=C.x*v+v;P.y=C.y*E+E;if(k||P.x>0&&P.x<e&&P.y>0&&
 P.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,P.x-8,P.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,G.x,G.y);b.uniform3f(I.screenPosition,C.x,C.y,C.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,l);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,P.x-8,P.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,j);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(C);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);V=0;for(S=z.lensFlares.length;V<S;V++){O=z.lensFlares[V];if(O.opacity>0.0010&&O.scale>0.0010){C.x=O.x;C.y=O.y;C.z=O.z;A=O.size*O.scale/p;G.x=A*H;G.y=A;b.uniform3f(I.screenPosition,C.x,C.y,C.z);b.uniform2f(I.scale,G.x,G.y);b.uniform1f(I.rotation,O.rotation);b.uniform1f(I.opacity,O.opacity);
+b.bindTexture(b.TEXTURE_2D,j);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(C);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);V=0;for(S=z.lensFlares.length;V<S;V++){O=z.lensFlares[V];if(O.opacity>0.001&&O.scale>0.001){C.x=O.x;C.y=O.y;C.z=O.z;A=O.size*O.scale/p;G.x=A*H;G.y=A;b.uniform3f(I.screenPosition,C.x,C.y,C.z);b.uniform2f(I.scale,G.x,G.y);b.uniform1f(I.rotation,O.rotation);b.uniform1f(I.opacity,O.opacity);
 b.uniform3f(I.color,O.color.r,O.color.g,O.color.b);c.setBlending(O.blending,O.blendEquation,O.blendSrc,O.blendDst);c.setTexture(O.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f=new THREE.Frustum,h=new THREE.Matrix4,j=new THREE.Vector3,l=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:h,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
 vertexShader:f.vertexShader,uniforms:h,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,i){var m,n,o,u,q,r,p,x,w,H=[];u=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);m=0;for(n=k.__lights.length;m<n;m++){o=k.__lights[m];if(o.castShadow)if(o instanceof THREE.DirectionalLight&&

+ 1 - 3
examples/canvas_performance.html

@@ -83,9 +83,7 @@
 				scene.add( ambientLight );
 
 				var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff );
-				directionalLight.position.x = 0;
-				directionalLight.position.y = 1;
-				directionalLight.position.z = 0;
+				directionalLight.position.set( 0, 1, 0 );
 				scene.add( directionalLight );
 
 				var pointLight = new THREE.PointLight( 0xff0000, 1, 500 );

+ 1 - 1
examples/js/renderers/SVGRenderer.js

@@ -235,7 +235,7 @@ THREE.SVGRenderer = function () {
 
 			if ( light instanceof THREE.DirectionalLight ) {
 
-				lightPosition = light.matrixWorld.getPosition();
+				lightPosition = light.matrixWorld.getPosition().normalize();
 
 				amount = normal.dot( lightPosition );
 

+ 1 - 0
examples/misc_ubiquity_test.html

@@ -132,6 +132,7 @@
 				scene.add( ambient );
 
 				var directional = new THREE.DirectionalLight( 0xffff00 );
+				directional.position.set( - 1, 0.5, 0 );
 				scene.add( directional );
 
 				canvasRenderer = new THREE.CanvasRenderer();

+ 1 - 1
src/renderers/CanvasRenderer.js

@@ -368,7 +368,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 				if ( light instanceof THREE.DirectionalLight ) {
 
-					lightPosition = light.matrixWorld.getPosition();
+					lightPosition = light.matrixWorld.getPosition().normalize();
 
 					amount = normal.dot( lightPosition );